From 783fa736d4b0f0e91ecb19801a6c37d0dcd39a4a Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 17 Dec 2018 17:13:04 +1100 Subject: [PATCH 1/2] move durations onto effect --- server/src/skill.rs | 86 +++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/server/src/skill.rs b/server/src/skill.rs index 2a56286b..bfe2bfb2 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -260,6 +260,33 @@ impl Effect { Effect::Ko => Category::Ko, } } + + pub fn duration(&self) -> u8 { + match self { + Effect::Evasion => 1, + Effect::Block => 1, + Effect::Parry => 1, + + Effect::Stun => 2, + Effect::Vulnerable => 2, + Effect::Snare => 1, + + Effect::Empower => 2, + + Effect::Decay => 2, + Effect::Drain => 2, + Effect::Triage => 2, + + Effect::Amplify => 2, + Effect::Silence => 2, + + _ => { + println!("{:?} does not have a duration", self); + return 1; + }, + } + } + } #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] @@ -723,31 +750,6 @@ impl Skill { } } - pub fn duration(&self) -> u8 { - match self { - Skill::Evade => 1, - Skill::Stun => 2, - Skill::Block => 1, - - Skill::Empower => 2, - - Skill::Decay => 3, - Skill::Drain => 3, - Skill::Triage => 3, - - Skill::Amplify => 2, - Skill::Silence => 3, - - Skill::TestBlock => 1, - Skill::TestParry => 1, - Skill::TestStun => 2, - _ => { - println!("{:?} does not have a duration", self); - return 2; - }, - } - } - pub fn self_targeting(&self) -> bool { match self { Skill::Block => true, @@ -782,7 +784,7 @@ fn attack(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res } fn stun(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let stun = CrypEffect { effect: Effect::Stun, duration: Skill::Stun.duration(), tick: None }; + let stun = CrypEffect { effect: Effect::Stun, duration: Effect::Stun.duration(), tick: None }; let immunity = target.immune(Skill::Stun); let immune = immunity.immune; @@ -802,8 +804,8 @@ fn stun(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Reso } fn throw(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let stun = CrypEffect { effect: Effect::Stun, duration: Skill::Stun.duration(), tick: None }; - let vulnerable = CrypEffect { effect: Effect::Vulnerable, duration: Skill::Stun.duration(), tick: None }; + let stun = CrypEffect { effect: Effect::Stun, duration: Effect::Stun.duration(), tick: None }; + let vulnerable = CrypEffect { effect: Effect::Vulnerable, duration: Effect::Vulnerable.duration(), tick: None }; let immunity = target.immune(Skill::Throw); let immune = immunity.immune; @@ -832,7 +834,7 @@ fn throw(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res fn block(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let block = CrypEffect { effect: Effect::Block, duration: Skill::Block.duration(), tick: None }; + let block = CrypEffect { effect: Effect::Block, duration: Effect::Block.duration(), tick: None }; let immunity = target.immune(Skill::Block); let immune = immunity.immune; @@ -852,7 +854,7 @@ fn block(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res } fn parry(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let parry = CrypEffect { effect: Effect::Parry, duration: Skill::Parry.duration(), tick: None }; + let parry = CrypEffect { effect: Effect::Parry, duration: Effect::Parry.duration(), tick: None }; let immunity = target.immune(Skill::Parry); let immune = immunity.immune; @@ -873,7 +875,7 @@ fn parry(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res fn evade(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let evade = CrypEffect { effect: Effect::Evasion, duration: Skill::Evade.duration(), tick: None }; + let evade = CrypEffect { effect: Effect::Evasion, duration: Effect::Evasion.duration(), tick: None }; let immunity = target.immune(Skill::Evade); let immune = immunity.immune; @@ -898,7 +900,7 @@ fn evade_roll() -> bool { } fn snare(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let snare = CrypEffect { effect: Effect::Snare, duration: Skill::Snare.duration(), tick: None }; + let snare = CrypEffect { effect: Effect::Snare, duration: Effect::Snare.duration(), tick: None }; let immunity = target.immune(Skill::Snare); let immune = immunity.immune; @@ -918,7 +920,7 @@ fn snare(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res } fn empower(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let empower = CrypEffect { effect: Effect::Empower, duration: Skill::Empower.duration(), tick: None }; + let empower = CrypEffect { effect: Effect::Empower, duration: Effect::Empower.duration(), tick: None }; let immunity = target.immune(Skill::Empower); let immune = immunity.immune; @@ -963,7 +965,7 @@ fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resol fn triage(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { let triage = CrypEffect { effect: Effect::Triage, - duration: Skill::Triage.duration(), + duration: Effect::Triage.duration(), tick: Some(Cast::new_tick(cryp, target, Skill::TriageTick)), }; let immunity = target.immune(Skill::Triage); @@ -1026,7 +1028,7 @@ fn blast(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Reso } fn amplify(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let amplify = CrypEffect { effect: Effect::Amplify, duration: Skill::Amplify.duration(), tick: None }; + let amplify = CrypEffect { effect: Effect::Amplify, duration: Effect::Amplify.duration(), tick: None }; let immunity = target.immune(Skill::Amplify); let immune = immunity.immune; @@ -1048,7 +1050,7 @@ fn amplify(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> R fn decay(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { let decay = CrypEffect { effect: Effect::Decay, - duration: Skill::Decay.duration(), + duration: Effect::Decay.duration(), tick: Some(Cast::new_tick(cryp, target, Skill::DecayTick)), }; let immunity = target.immune(Skill::Empower); @@ -1090,7 +1092,7 @@ fn decay_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> } fn hex(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let hex = CrypEffect { effect: Effect::Hex, duration: Skill::Hex.duration(), tick: None }; + let hex = CrypEffect { effect: Effect::Hex, duration: Effect::Hex.duration(), tick: None }; let immunity = target.immune(Skill::Hex); let immune = immunity.immune; @@ -1110,7 +1112,7 @@ fn hex(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resol } fn curse(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let curse = CrypEffect { effect: Effect::Curse, duration: Skill::Curse.duration(), tick: None }; + let curse = CrypEffect { effect: Effect::Curse, duration: Effect::Curse.duration(), tick: None }; let immunity = target.immune(Skill::Curse); let immune = immunity.immune; @@ -1132,7 +1134,7 @@ fn curse(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res fn drain(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { let drain = CrypEffect { effect: Effect::Drain, - duration: Skill::Drain.duration(), + duration: Effect::Drain.duration(), tick: Some(Cast::new_tick(cryp, target, Skill::DrainTick)), }; let immunity = target.immune(Skill::Drain); @@ -1184,7 +1186,7 @@ fn drain_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> } fn shield(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let shield = CrypEffect { effect: Effect::Shield, duration: Skill::Shield.duration(), tick: None }; + let shield = CrypEffect { effect: Effect::Shield, duration: Effect::Shield.duration(), tick: None }; let immunity = target.immune(Skill::Shield); let immune = immunity.immune; @@ -1204,7 +1206,7 @@ fn shield(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Re } fn silence(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let silence = CrypEffect { effect: Effect::Silence, duration: Skill::Silence.duration(), tick: None }; + let silence = CrypEffect { effect: Effect::Silence, duration: Effect::Silence.duration(), tick: None }; let immunity = target.immune(Skill::Silence); let immune = immunity.immune; @@ -1256,7 +1258,7 @@ fn purify(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Re } fn banish(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution { - let banish = CrypEffect { effect: Effect::Banish, duration: Skill::Banish.duration(), tick: None }; + let banish = CrypEffect { effect: Effect::Banish, duration: Effect::Banish.duration(), tick: None }; let immunity = target.immune(Skill::Banish); let immune = immunity.immune; From 47b8182cfbc570ec00135721d832bce33df461c4 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 17 Dec 2018 17:45:53 +1100 Subject: [PATCH 2/2] skill descriptions --- client/src/scenes/constants.js | 162 +++++++++++++++----------- client/src/scenes/cryp.page.js | 3 +- client/src/scenes/statsheet.skills.js | 6 +- server/src/skill.rs | 19 ++- 4 files changed, 110 insertions(+), 80 deletions(-) diff --git a/client/src/scenes/constants.js b/client/src/scenes/constants.js index a6d1850d..ee9ed187 100644 --- a/client/src/scenes/constants.js +++ b/client/src/scenes/constants.js @@ -27,6 +27,7 @@ const statsX = () => crypListWidth() + gameListWidth(); const statsKnownX = () => Math.floor(statsX() + statsWidth() / 4); const statsLearnableX = () => Math.floor(statsX() + statsWidth() / 2); const statsTextMargin = () => 24; +const statsLearnableMargin = () => 12; const logWidth = () => combatWidth(); const logHeight = () => combatHeight() * 0.3; @@ -37,6 +38,7 @@ const logX = () => combatWidth() * 0.6; module.exports = { TEXT: { NORMAL: { fontFamily: 'monospace', fontSize: 16, color: '#ffffff' }, + LEARNABLE: { fontFamily: 'monospace', fontSize: 12, color: '#ffffff' }, HEADER: { fontFamily: 'monospace', fontSize: 24, color: '#ffffff', fontStyle: 'bold' }, }, @@ -63,6 +65,7 @@ module.exports = { knownX: statsKnownX, learnableX: statsLearnableX, textMargin: statsTextMargin, + learnableMargin: statsLearnableMargin, }, COMBAT: { @@ -117,77 +120,94 @@ module.exports = { SKILLS: { LEARNABLE: [ - 'Attack', - - // ----------------- - // Nature - // ----------------- - 'Block', // reduce dmg - 'Parry', // avoid all dmg - 'Snare', - - // 'Paralyse', - - // 'Strangle', // physical dot and disable - - 'Stun', - 'Throw', - 'Evade', // actively evade - 'Evasion', // adds evasion to cryp - - - // ----------------- - // Technology - // ----------------- - // 'Replicate', - // 'Swarm', - // 'Orbit', - // 'Repair', - // 'Scan', // track? - - // ----------------- - // Nonviolence - // ----------------- - 'Heal', - 'Triage', // hot - // 'TriageTick', - // 'Charm', - // 'Calm', - // 'Rez', - - // ------------------- - // Destruction - // ------------------- - 'Blast', - 'Amplify', - 'Decay', // dot - // 'DecayTick', // dot - 'Drain', - // 'DrainTick', - 'Curse', - // 'Plague', // aoe dot - // 'Ruin', // aoe - - // ----------------- - // Purity - // ----------------- - 'Empower', - // 'Slay', - 'Shield', - 'Silence', - // 'Inquiry', - 'Purify', - 'Purge', - // '// Precision', - - // ----------------- - // Chaos - // ----------------- - 'Banish', // disables everything, incoming and outgoing - 'Hex', // stun but as a spell - // 'Fear', - // 'Taunt', - // 'Pause', // speed slow + { + name: 'Attack', + description: 'a fast physical attack with phys dmg', + }, + { + name: 'Block', + description: 'decreases incoming physical damage for 1T', + }, + { + name: 'Parry', + description: 'prevents all physical damage for 1T', + }, + { + name: 'Evade', + description: 'gives a chance to evade physical damage for 1T', + }, + { + name: 'Snare', + description: 'prevents physical skills from being used for 2T', + }, + { + name: 'Stun', + description: 'physical skill that prevents target cryp from using any skills', + }, + { + name: 'Evasion', + description: 'grants Evade effect to a cryp', + }, + { + name: 'Heal', + description: 'heal a cryp with spell dmg', + }, + { + name: 'Triage', + description: 'grants a spell dmg based healing over time buff', + }, + { + name: 'Throw', + description: 'stuns and makes the target take increased physical damage', + }, + { + name: 'Blast', + description: 'blast the target with magic damage', + }, + { + name: 'Amplify', + description: 'increase the magic damage dealt by a cryp', + }, + { + name: 'Decay', + description: 'afflict a cryp with a spell damage based damage over time debuff', + }, + { + name: 'Drain', + description: 'drain hp from target cryp with a spell damage based debuff', + }, + { + name: 'Curse', + description: 'target cryp takes increased magic damage', + }, + { + name: 'Empower', + description: 'increase the physical damage dealt by a cryp', + }, + { + name: 'Shield', + description: 'grants immunity to magical skills to target cryp', + }, + { + name: 'Silence', + description: 'prevent target cryp from casting magical skills', + }, + { + name: 'Purify', + description: 'remove physical debuffs from target cryp', + }, + { + name: 'Purge', + description: 'remove magical debuffs from target cryp', + }, + { + name: 'Banish', + description: 'target cryp is prevented from casting any skills and taking any damage', + }, + { + name: 'Hex', + description: 'magical based skill that prevents target cryp from using any skills', + }, ], }, }; diff --git a/client/src/scenes/cryp.page.js b/client/src/scenes/cryp.page.js index ee7755e2..a1bffb8c 100644 --- a/client/src/scenes/cryp.page.js +++ b/client/src/scenes/cryp.page.js @@ -33,10 +33,11 @@ class CrypPage extends Phaser.GameObjects.Group { }; const learnable = (skill, i) => { + console.log(skill); const SKILL_X = STATS.learnableX(); const SKILL_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN; - const text = scene.add.text(SKILL_X, SKILL_Y, skill, TEXT.NORMAL) + const text = scene.add.text(SKILL_X, SKILL_Y, `${skill.name}\n${skill.description}`, TEXT.NORMAL) .setInteractive(); text.on('pointerdown', () => { diff --git a/client/src/scenes/statsheet.skills.js b/client/src/scenes/statsheet.skills.js index d31098fc..752dbaab 100644 --- a/client/src/scenes/statsheet.skills.js +++ b/client/src/scenes/statsheet.skills.js @@ -76,12 +76,12 @@ class Skills extends Phaser.Scene { this.learnSkills = this.add.group(); const learnable = (skill, i) => { const SKILL_X = X_ORIG_LEARN; - const SKILL_Y = Y_ORIG + (i * TEXT_MARGIN) + TEXT_MARGIN; + const SKILL_Y = Y_ORIG + (i * STATS.learnableMargin() * 3) + TEXT_MARGIN; - this.learnSkills.add(this.add.text(SKILL_X, SKILL_Y, skill, TEXT.NORMAL) + this.learnSkills.add(this.add.text(SKILL_X, SKILL_Y, [skill.name, skill.description], TEXT.LEARNABLE) .setInteractive() .on('pointerdown', () => { - this.registry.get('ws').sendCrypLearn(cryp.id, skill); + this.registry.get('ws').sendCrypLearn(cryp.id, skill.name); })); }; diff --git a/server/src/skill.rs b/server/src/skill.rs index bfe2bfb2..231dba61 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -196,9 +196,12 @@ impl Effect { pub fn modifications(&self) -> Vec { match self { - Effect::Amplify => vec![Stat::SpellDmg], Effect::Empower => vec![Stat::PhysDmg], + Effect::Vulnerable => vec![Stat::PhysDmg], Effect::Block => vec![Stat::PhysDmg], + + Effect::Amplify => vec![Stat::SpellDmg], + Effect::Curse => vec![Stat::SpellDmg], _ => vec![], } } @@ -208,10 +211,16 @@ impl Effect { // and OR with base stat pub fn apply(&self, value: u64) -> u64 { match self { - Effect::Block => value >> 1, - Effect::Amplify => value << 1, - Effect::Empower => value << 1, - _ => panic!("{:?} does not have a mod effect", self), + Effect::Empower => value << 1, + Effect::Vulnerable => value << 1, + Effect::Block => value >> 1, + + Effect::Amplify => value << 1, + Effect::Curse => value << 1, + _ => { + println!("{:?} does not have a mod effect", self); + return value; + }, } }