diff --git a/client/src/scenes/cryp.row.js b/client/src/scenes/cryp.row.js index aad8dde7..3e33ce0b 100644 --- a/client/src/scenes/cryp.row.js +++ b/client/src/scenes/cryp.row.js @@ -1,6 +1,6 @@ const Phaser = require('phaser'); -const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU } } = require('./constants'); +const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU, STATS } } = require('./constants'); const TEXT_MARGIN = 24; @@ -45,9 +45,20 @@ class CrypRows extends Phaser.GameObjects.Group { row.cryp = cryp; this.add(row); + + const crypStat = (stat, j) => { + const STAT_X = 0; + const STAT_Y = (j * TEXT_MARGIN) + ROW_Y + TEXT_MARGIN; + + const text = list.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL); + this.add(text); + }; + + const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg]; + CRYP_STATS.forEach(crypStat); + this.add(list.add.text(ROW_WIDTH - 20, ROW_Y, i + 1, TEXT.HEADER)); this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER)); - this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 1), cryp.stamina.base, TEXT.NORMAL)); }); return true; } diff --git a/client/src/socket.js b/client/src/socket.js index 1293e3c9..c6b42b79 100644 --- a/client/src/socket.js +++ b/client/src/socket.js @@ -186,7 +186,7 @@ function createSocket(events) { if (!account) events.loginPrompt(); if (process.env.NODE_ENV !== 'production') { - // send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); + send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); } return true; diff --git a/server/src/cryp.rs b/server/src/cryp.rs index c9167766..5330d0d9 100644 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -154,21 +154,31 @@ impl Cryp { pub fn create(mut self) -> Cryp { let mut rng = thread_rng(); - let max = match self.lvl == 64 { + let stam_max = match self.lvl == 64 { true => u64::max_value(), + false => 2_u64.pow(self.lvl.into()), + }; + + let stam_min = match self.lvl == 1 { + true => 2_u64, false => 2_u64.pow(self.lvl.saturating_sub(1).into()), }; - let min = match self.lvl == 1 { + let other_max = match self.lvl == 1 { + true => 2_u64, + false => 2_u64.pow(self.lvl.saturating_sub(1).into()), + }; + + let other_min = match self.lvl == 1 { true => 2_u64, false => 2_u64.pow(self.lvl.saturating_sub(2).into()), }; - self.xp = max; + self.xp = stam_max; - self.phys_dmg.set(rng.gen_range(min, max)); - self.spell_dmg.set(rng.gen_range(min, max)); - self.stamina.set(rng.gen_range(min, max)); + self.phys_dmg.set(rng.gen_range(other_min, other_max)); + self.spell_dmg.set(rng.gen_range(other_min, other_max)); + self.stamina.set(rng.gen_range(stam_min, stam_max)); self.hp.set(self.stamina.base); self diff --git a/server/src/game.rs b/server/src/game.rs index e1a2c939..9b60b180 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -407,6 +407,14 @@ impl Game { } fn log_resolution(&mut self, source: &Cryp, target: &Cryp, cast: &Cast) -> &mut Game { + match cast.resolution.disable.disabled { + true => { + self.log.push(format!("{:?} {:?} {:?} disabled [{:?}]", source.name, cast.skill, target.name, cast.resolution.disable.effects)); + return self; + }, + false => (), + }; + for result in cast.resolution.results.iter() { match result { ResolutionResult::Damage { amount, category: _, immunity: _ } => { @@ -690,14 +698,14 @@ fn generate_mob(lvl: u8) -> Cryp { let mut rng = thread_rng(); // rng panics on min == max - let mob_lvl: u8 = match lvl { - 1 => 1, - _ => rng.gen_range(lvl.saturating_sub(2), lvl) - }; + // let mob_lvl: u8 = match lvl { + // 1 => 1, + // _ => rng.gen_range(lvl.saturating_sub(2), lvl) + // }; return Cryp::new() .named(&"bamboo basher".to_string()) - .level(mob_lvl) + .level(lvl) .create(); }