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

@ -15,6 +15,18 @@ Rare `Increased % mitigation from armour`
Rare `Increased % mitigation from spell shield` 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 ### ### Spell Damage && Spell Healing ###
Rare `Increased Spell Power` Rare `Increased Spell Power`
@ -24,7 +36,8 @@ Uncommon `Increased Spell Damage`
Uncommon `Increased Physical Damage` Uncommon `Increased Physical Damage`
### Healing ### ### 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 # # Nature - Technology - Nonviolence - Destruction - Purity - Chaos #

View File

@ -10,6 +10,7 @@ use failure::err_msg;
use account::Account; use account::Account;
use rpc::{CrypSpawnParams, CrypLearnParams, CrypForgetParams}; use rpc::{CrypSpawnParams, CrypLearnParams, CrypForgetParams};
use skill::{Skill, Cooldown, Effect, Cast, Category, Immunity, Disable, ResolutionResult}; use skill::{Skill, Cooldown, Effect, Cast, Category, Immunity, Disable, ResolutionResult};
use spec::{Spec};
use game::{Log}; use game::{Log};
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
@ -77,6 +78,31 @@ impl CrypStat {
self 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)] #[derive(Debug,Clone,Serialize,Deserialize)]

View File

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