decay values enum Pog?

This commit is contained in:
Mashy 2019-12-14 05:13:38 +10:00
parent f941feea6f
commit b033c719bc

View File

@ -100,10 +100,10 @@ impl Cast {
Skill::CounterAttackPlus |
Skill::CounterAttackPlusPlus => counter_attack(self, game),
Skill::Decay => decay(self, game),
Skill::DecayPlus => decay_plus(self, game),
Skill::DecayPlusPlus => decay_plus_plus(self, game),
Skill::DecayTick => decay_tick(self, game),
Skill::Decay => decay(self, game, Decay::Decay),
Skill::DecayPlus => decay(self, game, Decay::DecayPlus),
Skill::DecayPlusPlus => decay(self, game, Decay::DecayPlusPlus),
Skill::DecayTick => decay_tick(self, game),
Skill::Electrify => electrify(self, game),
Skill::ElectrifyPlus => electrify_plus(self, game),
@ -1422,68 +1422,41 @@ fn counter_attack(cast: Cast, game: &mut Game) {
);
}
fn decay(cast: Cast, game: &mut Game) {
let amount = game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier());
game.action(cast,
Action::Damage {
construct: cast.target,
colour: Colour::Blue,
amount,
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)) },
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 2, meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick, speed: cast.speed, amount }) },
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks
},
);
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
enum Decay {
Decay,
DecayPlus,
DecayPlusPlus,
}
fn decay_plus(cast: Cast, game: &mut Game) {
let amount = game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier());
game.action(cast,
Action::Damage {
construct: cast.target,
colour: Colour::Blue,
amount,
impl Decay {
pub fn decay_dmg_multiplier(self) -> usize {
match self {
Decay::Decay => 33, Decay::DecayPlus => 37, Decay::DecayPlusPlus => 45,
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(35)) },
}
pub fn decay_duration(self) -> u8 {
match self {
Decay::Decay => 3, Decay::DecayPlus => 4, Decay::DecayPlusPlus => 5,
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick, speed: cast.speed, amount }) },
}
pub fn wither_multiplier(self) -> usize {
match self {
Decay::Decay => 50, Decay::DecayPlus => 35, Decay::DecayPlusPlus => 20,
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks
},
);
}
pub fn wither_duration(self) -> u8 {
match self {
Decay::Decay => 3, Decay::DecayPlus => 4, Decay::DecayPlusPlus => 5,
}
}
}
fn decay_plus_plus(cast: Cast, game: &mut Game) {
let amount = game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier());
fn decay(cast: Cast, game: &mut Game, values: Decay) {
let amount = game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(values.decay_dmg_multiplier());
game.action(cast,
Action::Damage {
construct: cast.target,
@ -1494,13 +1467,17 @@ fn decay_plus_plus(cast: Cast, game: &mut Game) {
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Wither, duration: 4, meta: Some(EffectMeta::Multiplier(20)) },
effect: ConstructEffect {
effect: Effect::Wither,
duration: values.wither_duration(),
meta: Some(EffectMeta::Multiplier(values.wither_multiplier()))
},
}
);
game.action(cast,
Action::Effect {
construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta:
effect: ConstructEffect { effect: Effect::Decay, duration: values.decay_duration(), meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick, speed: cast.speed, amount }) },
}
);