From 17d71b2258614ea97643ea762db1d87c52e3d3c9 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 15 Jan 2019 22:29:51 +1100 Subject: [PATCH] specs init --- server/NODES.md | 37 +++++++++++++++++++++++++------------ server/src/cryp.rs | 26 ++++++++++++++++++++++++++ server/src/main.rs | 3 ++- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/server/NODES.md b/server/NODES.md index b3f99567..ba131b32 100644 --- a/server/NODES.md +++ b/server/NODES.md @@ -3,28 +3,41 @@ ### Defenses ### -Rare `Increased Stamina` +Rare `Increased Stamina` -Common `Increased Evasion rating` -Common `Increased Spell Shield rating` -Common `Increased Armour rating` +Common `Increased Evasion rating` +Common `Increased Spell Shield rating` +Common `Increased Armour rating` -Rare `Reduced hp loss penalty to evade chance` -Rare `Increased base evasion chance per X evasion rating` -Rare `Increased % mitigation from armour` -Rare `Increased % mitigation from spell shield` +Rare `Reduced hp loss penalty to evade chance` +Rare `Increased base evasion chance per X evasion rating` +Rare `Increased % mitigation from armour` +Rare `Increased % mitigation from spell shield` +Rare `cooldown reduction` +Rare `effect duration` + +Rare `increased phys dmg, 0 spell damage` +Rare `increased spell dmg, 0 phys damage` + +Rare `increased phys dmg, silenced` +Rare `increased spell dmg, snared` + +Rare `increased speed, increased durations` +Rare `increased speed, increased cooldowns` + ### Spell Damage && Spell Healing ### -Rare `Increased Spell Power` +Rare `Increased Spell Power` ### Damage Only ### -Uncommon `Increased Spell Damage` -Uncommon `Increased Physical Damage` +Uncommon `Increased Spell Damage` +Uncommon `Increased Physical Damage` ### Healing ### -Uncommon `Increased Healing` Multiplier to spell damage roll +Uncommon `Increased Healing Received` Multiplier to spell damage roll +Uncommon `Increased Healing Done` Multiplier to spell damage roll # Nature - Technology - Nonviolence - Destruction - Purity - Chaos # diff --git a/server/src/cryp.rs b/server/src/cryp.rs index 805ba71c..3834207e 100644 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -10,6 +10,7 @@ use failure::err_msg; use account::Account; use rpc::{CrypSpawnParams, CrypLearnParams, CrypForgetParams}; use skill::{Skill, Cooldown, Effect, Cast, Category, Immunity, Disable, ResolutionResult}; +use spec::{Spec}; use game::{Log}; #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] @@ -77,6 +78,31 @@ impl CrypStat { self } + fn modified(&self, specs: &CrypSpecs) -> u64 { + let specs = specs.affects(self.stat); + // applied with fold because it can be zeroed or multiplied + // but still needs access to the base amount + let modified = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base)); + return modified; + } +} + + +#[derive(Debug,Clone,Serialize,Deserialize)] +struct CrypSpecs { + common: Vec, + uncommon: Vec, + rare: Vec, +} + +impl CrypSpecs { + fn affects(&self, stat: Stat) -> Vec { + [&self.common, &self.uncommon, &self.rare] + .iter() + .flat_map(|specs| specs.iter().filter(|s| s.affects == stat)) + .map(|s| *s) + .collect::>() + } } #[derive(Debug,Clone,Serialize,Deserialize)] diff --git a/server/src/main.rs b/server/src/main.rs index 7180e527..5c859276 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -22,7 +22,8 @@ mod cryp; mod game; mod net; mod skill; -mod passives; +mod spec; +// mod passives; mod rpc; mod account; mod item;