diff --git a/client/src/scenes/combat.render.resolutions.js b/client/src/scenes/combat.render.resolutions.js index 28965a15..27b4745c 100644 --- a/client/src/scenes/combat.render.resolutions.js +++ b/client/src/scenes/combat.render.resolutions.js @@ -74,22 +74,49 @@ function animatePhase(scene, game, resolution, cb) { // Target cryp takes damage scene.time.delayedCall(ANIMATION_DURATION, () => { - const combatTick = resolution.resolution.results[0][1]; - const damage = combatTick.category === 'PhysHeal' ? combatTick.amount * -1 : combatTick.amount; - targetSpawn.takeDamage(damage); - scene.registry.set('gameLog', scene.registry.get('gameLog') + 1); + // ew + const { resolution: { results } } = resolution; - // Move cryps back - scene.time.delayedCall(DAMAGE_TICK, () => { - if (moveSourceOrig) scene.tweens.add(moveSourceOrig); - scene.tweens.add(moveTargetOrig); + eachSeries(results, + (result, tickCb) => { + // touch + if (!results.length) return tickCb(); - // all done - scene.time.delayedCall(MOVE_CREEP, () => { - animations.destroy(true); - return cb(); + const [resultType, values] = result; + if (resultType === 'Damage') { + targetSpawn.takeDamage(values.amount); + scene.registry.set('gameLog', scene.registry.get('gameLog') + 1); + return setTimeout(tickCb, DAMAGE_TICK); + } + if (resultType === 'Healing') { + targetSpawn.takeDamage(values.amount * -1); + scene.registry.set('gameLog', scene.registry.get('gameLog') + 1); + return setTimeout(tickCb, DAMAGE_TICK); + } + if (resultType === 'Effect') { + console.log('target has new effect', values.effect); + return setTimeout(tickCb, DAMAGE_TICK); + } + + if (resultType === 'Removal') { + console.log('target effect removed', values.effect); + return setTimeout(tickCb, DAMAGE_TICK); + } + + // unhandled result type + return tickCb(); + }, + (err) => { + // Move cryps back + if (moveSourceOrig) scene.tweens.add(moveSourceOrig); + scene.tweens.add(moveTargetOrig); + + // all done + scene.time.delayedCall(MOVE_CREEP, () => { + animations.destroy(true); + return cb(); + }); }); - }); }); }); } diff --git a/client/src/socket.js b/client/src/socket.js index c6b42b79..1293e3c9 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/game.rs b/server/src/game.rs index 0003e391..e9d18706 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -412,6 +412,9 @@ impl Game { ResolutionResult::Damage { amount, category: _, immunity: _ } => { self.log.push(format!("{:?} {:?} {:?} {:?}", source.name, cast.skill, target.name, amount)); }, + ResolutionResult::Healing { amount, category: _, immunity: _ } => { + self.log.push(format!("{:?} {:?} {:?} {:?}", source.name, cast.skill, target.name, amount)); + }, ResolutionResult::Effect { effect, duration, immunity: _ } => { self.log.push(format!("{:?} {:?} {:?} {:?} {:?}T", source.name, cast.skill, target.name, effect, duration)); }, diff --git a/server/src/skill.rs b/server/src/skill.rs index b7b9c043..88dd523f 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -82,6 +82,7 @@ impl Disable { #[derive(Debug,Clone,PartialEq,Serialize,Deserialize)] pub enum ResolutionResult { Damage { amount: u64, category: Category , immunity: Immunity }, + Healing { amount: u64, category: Category , immunity: Immunity }, Effect { effect: Effect, duration: u8, immunity: Immunity }, Removal { effect: Effect, immunity: Immunity }, } @@ -148,10 +149,9 @@ pub enum Effect { impl Effect { pub fn immune(&self, skill: Skill) -> bool { match self { - Effect::Block => match skill { - Skill::Stun | - Skill::TestStun | - Skill::Attack => true, + Effect::Block => match skill.category() { + Category::Spell => false, + Category::Physical => true, _ => false, }, Effect::Shield => match skill.category() { @@ -455,12 +455,12 @@ impl Skill { // Preservation // ----------------- Skill::Heal => Category::Physical, - Skill::Triage => Category::Physical, // hot - Skill::TriageTick => Category::Physical, // hot + Skill::Triage => Category::Spell, // hot + Skill::TriageTick => Category::Spell, // hot Skill::Throw => Category::Physical, // no dmg stun, adds vulnerable - Skill::Charm => Category::Physical, + Skill::Charm => Category::Spell, Skill::Calm => Category::Physical, - Skill::Rez => Category::Physical, + Skill::Rez => Category::Spell, // ----------------- // Destruction @@ -852,7 +852,7 @@ fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resol let immunity = target.immune(Skill::Heal); let immune = immunity.immune; - let heal_result = ResolutionResult::Damage { + let heal_result = ResolutionResult::Healing { amount, category: Category::PhysHeal, immunity, @@ -898,7 +898,7 @@ fn triage_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) - let immunity = target.immune(Skill::TriageTick); let immune = immunity.immune; - let heal_result = ResolutionResult::Damage { + let heal_result = ResolutionResult::Healing { amount, category: Category::PhysHeal, immunity, @@ -1074,7 +1074,7 @@ fn drain_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> immunity: immunity.clone(), }; - let drain_tick_heal_result = ResolutionResult::Damage { + let drain_tick_heal_result = ResolutionResult::Healing { amount, category: Category::SpellHeal, immunity,