specs init

This commit is contained in:
ntr 2019-01-15 22:29:51 +11:00
parent a44b9bc929
commit 17d71b2258
3 changed files with 53 additions and 13 deletions

View File

@ -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 #

View File

@ -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<Spec>,
uncommon: Vec<Spec>,
rare: Vec<Spec>,
}
impl CrypSpecs {
fn affects(&self, stat: Stat) -> Vec<Spec> {
[&self.common, &self.uncommon, &self.rare]
.iter()
.flat_map(|specs| specs.iter().filter(|s| s.affects == stat))
.map(|s| *s)
.collect::<Vec<Spec>>()
}
}
#[derive(Debug,Clone,Serialize,Deserialize)]

View File

@ -22,7 +22,8 @@ mod cryp;
mod game;
mod net;
mod skill;
mod passives;
mod spec;
// mod passives;
mod rpc;
mod account;
mod item;