dmg -> damage

This commit is contained in:
ntr 2019-02-16 10:58:10 +11:00
parent 8a78528c80
commit a822177fb8
11 changed files with 96 additions and 96 deletions

View File

@ -162,7 +162,7 @@ module.exports = {
[ { name: 'Amplify',
description: 'increase the magic damage dealt by a cryp' },
{ name: 'Attack',
description: 'a fast attack with red dmg' },
description: 'a fast attack with red damage' },
{ name: 'Banish',
description:
'target cryp is prevented from casting any skills and taking any damage' },
@ -181,7 +181,7 @@ module.exports = {
description: 'increase the red damage dealt by a cryp' },
{ name: 'Haste',
description: 'magical skill that increases speed of target cryp' },
{ name: 'Heal', description: 'heal a cryp with blue dmg' },
{ name: 'Heal', description: 'heal a cryp with blue damage' },
{ name: 'Hex',
description:
'magical based skill that prevents target cryp from using any skills' },
@ -205,7 +205,7 @@ module.exports = {
{ name: 'Throw',
description: 'stuns and makes the target take increased red damage' },
{ name: 'Triage',
description: 'grants a blue dmg based healing over time buff' }
description: 'grants a blue damage based healing over time buff' }
]
},
};

View File

@ -115,8 +115,8 @@ class MenuCrypList extends Phaser.Scene {
cryp.stamina,
cryp.red_shield,
cryp.blue_shield,
cryp.red_dmg,
cryp.blue_dmg,
cryp.red_damage,
cryp.blue_damage,
cryp.speed,
];
CRYP_STATS.forEach((stat, j) => crypStat(stat, j, crypInfo));

View File

@ -69,8 +69,8 @@ class StatSheet extends Phaser.Scene {
cryp.red_shield,
cryp.blue_shield,
cryp.evasion,
cryp.red_dmg,
cryp.blue_dmg,
cryp.red_damage,
cryp.blue_damage,
cryp.speed,
];

View File

@ -30,11 +30,11 @@ Rare `25% hex for blast`
Rare `cooldown reduction`
Rare `effect duration`
Rare `increased phys dmg, 0 spell damage`
Rare `increased spell dmg, 0 phys damage`
Rare `increased phys damage, 0 spell damage`
Rare `increased spell damage, 0 phys damage`
Rare `increased phys dmg, silenced`
Rare `increased spell dmg, snared`
Rare `increased phys damage, silenced`
Rare `increased spell damage, snared`
Rare `increased speed, increased durations`
Rare `increased speed, increased cooldowns`

View File

@ -21,11 +21,11 @@ resolve phase:
2.2 <- attack (normal resolve)
1.1 <- hexed (no skills for the rest of this turn and next)
## Dmg Chart
## Damage Chart
| Red | Magic | Modifiers |
| ------ | ------ | ------ |
| dmg | dmg | speed |
| damage | damage | speed |
| evasion | resistance | cooldowns |
| reduction | absorption? | durations |

View File

@ -136,10 +136,10 @@ pub struct CrypRecover {
pub struct Cryp {
pub id: Uuid,
pub account: Uuid,
pub red_dmg: CrypStat,
pub red_damage: CrypStat,
pub red_shield: CrypStat,
pub blue_shield: CrypStat,
pub blue_dmg: CrypStat,
pub blue_damage: CrypStat,
pub speed: CrypStat,
pub stamina: CrypStat,
pub hp: CrypStat,
@ -164,9 +164,9 @@ impl Cryp {
return Cryp {
id,
account: id,
red_dmg: CrypStat { base: 0, value: 0, stat: Stat::RedDamage },
red_damage: CrypStat { base: 0, value: 0, stat: Stat::RedDamage },
red_shield: CrypStat { base: 0, value: 0, stat: Stat::RedShield },
blue_dmg: CrypStat { base: 0, value: 0, stat: Stat::BlueDamage },
blue_damage: CrypStat { base: 0, value: 0, stat: Stat::BlueDamage },
blue_shield: CrypStat { base: 0, value: 0, stat: Stat::BlueShield },
speed: CrypStat { base: 0, value: 0, stat: Stat::Speed },
stamina: CrypStat { base: 0, value: 0, stat: Stat::Stamina },
@ -238,8 +238,8 @@ impl Cryp {
let evasion_max = 5;
match stat {
Stat::RedDamage => self.red_dmg.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::BlueDamage => self.blue_dmg.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::RedDamage => self.red_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::BlueDamage => self.blue_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::Speed => self.speed.set(rng.gen_range(stat_min, stat_max), &self.specs),
Stat::Stamina => {
self.stamina.set(rng.gen_range(stam_min, stam_max), &self.specs);
@ -331,9 +331,9 @@ impl Cryp {
fn recalculate_stats(&mut self) -> &mut Cryp {
self.stamina.recalculate(&self.specs);
self.hp.recalculate(&self.specs);
self.red_dmg.recalculate(&self.specs);
self.red_damage.recalculate(&self.specs);
self.red_shield.recalculate(&self.specs);
self.blue_dmg.recalculate(&self.specs);
self.blue_damage.recalculate(&self.specs);
self.blue_shield.recalculate(&self.specs);
self.evasion.recalculate(&self.specs);
self.speed.recalculate(&self.specs);
@ -468,24 +468,24 @@ impl Cryp {
// }
// Stats
pub fn red_dmg(&self) -> u64 {
let red_dmg_mods = self.effects.iter()
pub fn red_damage(&self) -> u64 {
let red_damage_mods = self.effects.iter()
.filter(|e| e.effect.modifications().contains(&Stat::RedDamage))
.map(|cryp_effect| cryp_effect.effect)
.collect::<Vec<Effect>>();
let modified_red_dmg = red_dmg_mods.iter().fold(self.red_dmg.value, |acc, m| m.apply(acc));
return modified_red_dmg;
let modified_red_damage = red_damage_mods.iter().fold(self.red_damage.value, |acc, m| m.apply(acc));
return modified_red_damage;
}
pub fn blue_dmg(&self) -> u64 {
let blue_dmg_mods = self.effects.iter()
pub fn blue_damage(&self) -> u64 {
let blue_damage_mods = self.effects.iter()
.filter(|e| e.effect.modifications().contains(&Stat::BlueDamage))
.map(|cryp_effect| cryp_effect.effect)
.collect::<Vec<Effect>>();
let modified_blue_dmg = blue_dmg_mods.iter().fold(self.blue_dmg.value, |acc, m| m.apply(acc));
return modified_blue_dmg;
let modified_blue_damage = blue_damage_mods.iter().fold(self.blue_damage.value, |acc, m| m.apply(acc));
return modified_blue_damage;
}
pub fn skill_speed(&self, s: Skill) -> u64 {
@ -551,7 +551,7 @@ impl Cryp {
};
}
pub fn deal_red_dmg(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
pub fn deal_red_damage(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
let immunity = self.immune(skill);
let immune = immunity.immune;
@ -559,26 +559,26 @@ impl Cryp {
return ResolutionResult::Damage {
amount: 0,
mitigation: 0,
category: Category::RedDmg,
category: Category::RedDamage,
immunity,
};
}
let red_dmg_mods = self.effects.iter()
let red_damage_mods = self.effects.iter()
.filter(|e| e.effect.modifications().contains(&Stat::RedDamageTaken))
.map(|cryp_effect| cryp_effect.effect)
.collect::<Vec<Effect>>();
// println!("{:?}", red_dmg_mods);
// println!("{:?}", red_damage_mods);
let modified_dmg = red_dmg_mods.iter().fold(amount, |acc, m| m.apply(acc));
let modified_damage = red_damage_mods.iter().fold(amount, |acc, m| m.apply(acc));
// calculate amount of damage red_shield will not absorb
// eg 50 red_shield 25 dmg -> 0 remainder 25 mitigation
// 50 red_shield 100 dmg -> 50 remainder 50 mitigation
// 50 red_shield 5 dmg -> 0 remainder 5 mitigation
let remainder = modified_dmg.saturating_sub(self.red_shield.value);
let mitigation = modified_dmg.saturating_sub(remainder);
// eg 50 red_shield 25 damage -> 0 remainder 25 mitigation
// 50 red_shield 100 damage -> 50 remainder 50 mitigation
// 50 red_shield 5 damage -> 0 remainder 5 mitigation
let remainder = modified_damage.saturating_sub(self.red_shield.value);
let mitigation = modified_damage.saturating_sub(remainder);
// reduce red_shield by mitigation amount
self.red_shield.reduce(mitigation);
@ -589,12 +589,12 @@ impl Cryp {
return ResolutionResult::Damage {
amount: remainder,
mitigation,
category: Category::RedDmg,
category: Category::RedDamage,
immunity,
};
}
pub fn deal_blue_dmg(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
pub fn deal_blue_damage(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
let immunity = self.immune(skill);
let immune = immunity.immune;
@ -602,21 +602,21 @@ impl Cryp {
return ResolutionResult::Damage {
amount: 0,
mitigation: 0,
category: Category::BlueDmg,
category: Category::BlueDamage,
immunity,
};
}
let blue_dmg_mods = self.effects.iter()
let blue_damage_mods = self.effects.iter()
.filter(|e| e.effect.modifications().contains(&Stat::BlueDamageTaken))
.map(|cryp_effect| cryp_effect.effect)
.collect::<Vec<Effect>>();
// println!("{:?}", blue_dmg_mods);
// println!("{:?}", blue_damage_mods);
let modified_dmg = blue_dmg_mods.iter().fold(amount, |acc, m| m.apply(acc));
let remainder = modified_dmg.saturating_sub(self.blue_shield.value);
let mitigation = modified_dmg.saturating_sub(remainder);
let modified_damage = blue_damage_mods.iter().fold(amount, |acc, m| m.apply(acc));
let remainder = modified_damage.saturating_sub(self.blue_shield.value);
let mitigation = modified_damage.saturating_sub(remainder);
self.blue_shield.reduce(mitigation);
self.hp.reduce(remainder);
@ -624,7 +624,7 @@ impl Cryp {
return ResolutionResult::Damage {
amount: remainder,
mitigation,
category: Category::BlueDmg,
category: Category::BlueDamage,
immunity,
};
}

View File

@ -1014,7 +1014,7 @@ mod tests {
let x_cryp = x_team.cryps[0].clone();
let y_cryp = y_team.cryps[0].clone();
game.team_by_id(y_team.id).cryp_by_id(y_cryp.id).unwrap().red_dmg.force(u64::max_value());
game.team_by_id(y_team.id).cryp_by_id(y_cryp.id).unwrap().red_damage.force(u64::max_value());
game.team_by_id(y_team.id).cryp_by_id(y_cryp.id).unwrap().speed.force(u64::max_value());
// just in case

View File

@ -1104,7 +1104,7 @@ mod tests {
let x_cryp = x_team.cryps[0].clone();
let y_cryp = y_team.cryps[0].clone();
game.team_by_id(y_team.id).cryp_by_id(y_cryp.id).unwrap().red_dmg.set(u64::max_value());
game.team_by_id(y_team.id).cryp_by_id(y_cryp.id).unwrap().red_damage.set(u64::max_value());
let x_stun_id = game.add_skill(x_team.id, x_cryp.id, Some(y_team.id), Skill::TestStun).unwrap();
let y_attack_id = game.add_skill(y_team.id, y_cryp.id, Some(x_team.id), Skill::Attack).unwrap();

View File

@ -25,8 +25,8 @@ pub enum ItemAction {
RerollBlueShield,
RerollEvasion,
SpecRedDmg5,
SpecBlueDmg5,
SpecRedDamage5,
SpecBlueDamage5,
SpecRedShield5,
SpecBlueShield5,
SpecBlueEvasion5,
@ -60,8 +60,8 @@ impl Item {
ItemAction::RerollBlueShield => reroll(self, tx, target, Stat::BlueShield),
ItemAction::RerollEvasion => reroll(self, tx, target, Stat::Evasion),
ItemAction::SpecRedDmg5 => spec_add(self, tx, target, SpecType::RedDamage5),
ItemAction::SpecBlueDmg5 => spec_add(self, tx, target, SpecType::BlueDamage5),
ItemAction::SpecRedDamage5 => spec_add(self, tx, target, SpecType::RedDamage5),
ItemAction::SpecBlueDamage5 => spec_add(self, tx, target, SpecType::BlueDamage5),
_ => unimplemented!(),
}
}

View File

@ -337,8 +337,8 @@ impl Rpc {
ItemAction::RerollRedShield,
ItemAction::RerollBlueShield,
ItemAction::RerollEvasion,
ItemAction::SpecRedDmg5,
ItemAction::SpecBlueDmg5,
ItemAction::SpecRedDamage5,
ItemAction::SpecBlueDamage5,
].into_iter() {
let item = Item::new(*action, account.id);
item_create(item, tx, account.id)?;

View File

@ -298,12 +298,12 @@ impl Effect {
pub enum Category {
Red,
RedHeal,
RedDmg,
RedDamage,
RedDebuff,
RedBuff,
RedTick,
Blue,
BlueDmg,
BlueDamage,
BlueHeal,
BlueDebuff,
BlueBuff,
@ -318,8 +318,8 @@ pub enum Skill {
// -----------------
// Nature
// -----------------
Block, // reduce dmg
Parry, // avoid all dmg
Block, // reduce damage
Parry, // avoid all damage
Snare,
Paralyse,
@ -345,7 +345,7 @@ pub enum Skill {
Heal,
Triage, // hot
TriageTick,
Throw, // no dmg stun, adds vulnerable
Throw, // no damage stun, adds vulnerable
Charm,
Calm,
Rez,
@ -389,7 +389,7 @@ pub enum Skill {
Haste,
Slow,
// used by tests, no cd, no dmg
// used by tests, no cd, no damage
TestTouch,
TestStun,
TestBlock,
@ -405,8 +405,8 @@ impl Skill {
// -----------------
// Nature
// -----------------
Skill::Block => None, // reduce dmg
Skill::Parry => None, // avoid all dmg
Skill::Block => None, // reduce damage
Skill::Parry => None, // avoid all damage
Skill::Snare => Some(1),
Skill::Paralyse => Some(1),
@ -431,7 +431,7 @@ impl Skill {
Skill::Heal => None,
Skill::Triage => None, // hot
Skill::TriageTick => None,
Skill::Throw => Some(1), // no dmg stun, adds vulnerable
Skill::Throw => Some(1), // no damage stun, adds vulnerable
Skill::Charm => Some(1),
Skill::Calm => None,
Skill::Rez => Some(2),
@ -490,8 +490,8 @@ impl Skill {
// -----------------
// Nature
// -----------------
Skill::Block => Category::Red, // reduce dmg
Skill::Parry => Category::Red, // avoid all dmg
Skill::Block => Category::Red, // reduce damage
Skill::Parry => Category::Red, // avoid all damage
Skill::Snare => Category::Red,
Skill::Paralyse => Category::Red,
@ -516,7 +516,7 @@ impl Skill {
Skill::Heal => Category::Red,
Skill::Triage => Category::Blue, // hot
Skill::TriageTick => Category::BlueTick, // hot
Skill::Throw => Category::Red, // no dmg stun, adds vulnerable
Skill::Throw => Category::Red, // no damage stun, adds vulnerable
Skill::Charm => Category::Blue,
Skill::Calm => Category::Red,
Skill::Rez => Category::Blue,
@ -583,10 +583,10 @@ impl Skill {
match self {
// defensive block
Skill::Block => 10, // reduce dmg
Skill::Parry => 10, // avoid all dmg
Skill::Block => 10, // reduce damage
Skill::Parry => 10, // avoid all damage
Skill::Snare => 10,
Skill::Shield => 10, // avoid magic dmg,
Skill::Shield => 10, // avoid magic damage,
// fast phys combat
Skill::Attack => 5,
@ -614,7 +614,7 @@ impl Skill {
Skill::Plague => 2, // aoe dot
Skill::Silence => 2,
Skill::Stun => 2,
Skill::Throw => 2, // no dmg stun, adds vulnerable
Skill::Throw => 2, // no damage stun, adds vulnerable
Skill::TriageTick => 2, // hot
Skill::Heal => 1,
@ -703,7 +703,7 @@ impl Skill {
Skill::Heal => heal(source, target, resolution),
Skill::Triage => triage(source, target, resolution), // hot
Skill::TriageTick => triage_tick(source, target, resolution), // hot
Skill::Throw => throw(source, target, resolution), // no dmg stun, adds vulnerable
Skill::Throw => throw(source, target, resolution), // no damage stun, adds vulnerable
Skill::Charm => panic!("nyi"), // target casts random spell on teammate
Skill::Calm => panic!("nyi"), // physical fear, taunt removal
Skill::Rez => panic!("nyi"),
@ -712,7 +712,7 @@ impl Skill {
// Destruction
// -----------------
Skill::Blast => blast(source, target, resolution),
Skill::Amplify => amplify(source, target, resolution), // increase magic dmg
Skill::Amplify => amplify(source, target, resolution), // increase magic damage
Skill::Decay => decay(source, target, resolution), // dot
Skill::DecayTick => decay_tick(source, target, resolution), // dot
Skill::Drain => drain(source, target, resolution),
@ -725,9 +725,9 @@ impl Skill {
// Purity
// -----------------
// Skill::Precision => panic!("nyi"),
Skill::Empower => empower(source, target, resolution), // increased phys dmg
Skill::Slay => panic!("nyi"), // phys dmg mult by target magic dmg
Skill::Shield => shield(source, target, resolution), // target is immune to magic dmg and fx
Skill::Empower => empower(source, target, resolution), // increased phys damage
Skill::Slay => panic!("nyi"), // phys damage mult by target magic damage
Skill::Shield => shield(source, target, resolution), // target is immune to magic damage and fx
Skill::Silence => silence(source, target, resolution), // target cannot cast spells
Skill::Inquiry => panic!("nyi"), //
Skill::Purify => purify(source, target, resolution), // dispel all debuffs
@ -780,8 +780,8 @@ impl Skill {
}
fn attack(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.red_dmg();
resolution.results.push(target.deal_red_dmg(Skill::Attack, amount));
let amount = cryp.red_damage();
resolution.results.push(target.deal_red_damage(Skill::Attack, amount));
return resolution;
}
@ -828,7 +828,7 @@ fn empower(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> R
}
fn heal(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_dmg();
let amount = cryp.blue_damage();
resolution.results.push(target.heal(Skill::Heal, amount));
return resolution;
}
@ -858,14 +858,14 @@ fn triage(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res
}
fn triage_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_dmg().wrapping_div(2);
let amount = cryp.blue_damage().wrapping_div(2);
resolution.results.push(target.heal(Skill::TriageTick, amount));
return resolution;
}
fn blast(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_dmg();
resolution.results.push(target.deal_blue_dmg(Skill::Blast, amount));
let amount = cryp.blue_damage();
resolution.results.push(target.deal_blue_damage(Skill::Blast, amount));
return resolution;
}
@ -898,8 +898,8 @@ fn decay(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Reso
}
fn decay_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_dmg();
resolution.results.push(target.deal_blue_dmg(Skill::DecayTick, amount));
let amount = cryp.blue_damage();
resolution.results.push(target.deal_blue_damage(Skill::DecayTick, amount));
return resolution;
}
@ -926,17 +926,17 @@ fn drain(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Reso
}
fn drain_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
let amount = cryp.blue_dmg();
let drain_dmg = target.deal_blue_dmg(Skill::DrainTick, amount);
resolution.results.push(drain_dmg.clone());
let amount = cryp.blue_damage();
let drain_damage = target.deal_blue_damage(Skill::DrainTick, amount);
resolution.results.push(drain_damage.clone());
match drain_dmg {
match drain_damage {
ResolutionResult::Damage { amount, mitigation, category: _, immunity } => {
if !immunity.immune {
resolution.results.push(cryp.heal(Skill::Heal, amount));
}
},
_ => panic!("drain tick dmg not dealt {:?}", drain_dmg),
_ => panic!("drain tick damage not dealt {:?}", drain_damage),
}
return resolution;
@ -1011,7 +1011,7 @@ mod tests {
.learn(Skill::Heal)
.create();
x.deal_red_dmg(Skill::Attack, 5);
x.deal_red_damage(Skill::Attack, 5);
heal(&mut y, &mut x, Resolution::new(Skill::Heal));
}
@ -1051,7 +1051,7 @@ mod tests {
.create();
// ensure it doesn't have 0 pd
x.red_dmg.force(100);
x.red_damage.force(100);
y.hp.force(500);
block(&mut y.clone(), &mut y, Resolution::new(Skill::Block));
@ -1078,13 +1078,13 @@ mod tests {
.create();
// ensure it doesn't have 0 sd
x.blue_dmg.force(50);
x.blue_damage.force(50);
// remove all mitigation
y.red_shield.force(0);
y.blue_shield.force(0);
y.deal_red_dmg(Skill::Attack, 5);
y.deal_red_damage(Skill::Attack, 5);
let prev_hp = y.hp();
let res = Resolution::new(Skill::Triage);
@ -1118,11 +1118,11 @@ mod tests {
.level(8)
.create();
x.blue_dmg.force(50);
x.blue_damage.force(50);
amplify(&mut x.clone(), &mut x, Resolution::new(Skill::Amplify));
assert!(x.effects.iter().any(|e| e.effect == Effect::Amplify));
assert_eq!(x.blue_dmg(), 100);
assert_eq!(x.blue_damage(), 100);
}
#[test]