strike speed and strangling unremovable

This commit is contained in:
ntr 2019-06-05 12:44:44 +10:00
parent a8fa6d102e
commit f3636e4e09
3 changed files with 41 additions and 14 deletions

View File

@ -34,10 +34,8 @@
*CLIENT* *CLIENT*
reconnect based on time delta reconnect based on time delta
menu footer
fix refresh button fix refresh button
*SERVER* *SERVER*
* std game mode * std game mode
* time control * time control

View File

@ -202,7 +202,7 @@ impl Item {
} }
} }
pub fn speed(&self) -> u8 { pub fn speed(&self) -> u64 {
match self { match self {
Item::Attack => 1, Item::Attack => 1,
Item::Stun => 2, Item::Stun => 2,

View File

@ -475,6 +475,8 @@ enum EffectCategory {
Buff, Buff,
Debuff, Debuff,
Constant,
Ko, Ko,
} }
@ -657,8 +659,6 @@ impl Effect {
Effect::Snare => EffectCategory::Debuff, Effect::Snare => EffectCategory::Debuff,
Effect::Clutch => EffectCategory::Buff, Effect::Clutch => EffectCategory::Buff,
Effect::Taunt => EffectCategory::Buff, Effect::Taunt => EffectCategory::Buff,
Effect::Strangle => EffectCategory::Debuff,
Effect::Strangling => EffectCategory::Buff,
// magic // magic
Effect::Hex => EffectCategory::Debuff, Effect::Hex => EffectCategory::Debuff,
@ -690,6 +690,10 @@ impl Effect {
Effect::Regen => EffectCategory::Buff, Effect::Regen => EffectCategory::Buff,
Effect::Siphon => EffectCategory::Debuff, Effect::Siphon => EffectCategory::Debuff,
// can't be purged or purified
Effect::Strangle => EffectCategory::Constant,
Effect::Strangling => EffectCategory::Constant,
// not in game // not in game
Effect::Injured => EffectCategory::Debuff, Effect::Injured => EffectCategory::Debuff,
@ -1324,9 +1328,9 @@ impl Skill {
} }
} }
pub fn speed(&self) -> u8 { pub fn speed(&self) -> u64 {
match self { match self {
Skill::StrikeI => u8::max_value(), Skill::StrikeI => Item::from(Skill::StrikeI).speed().pct(150),
Skill::StrikeII => Skill::StrikeI.speed(), Skill::StrikeII => Skill::StrikeI.speed(),
Skill::StrikeIII => Skill::StrikeI.speed(), Skill::StrikeIII => Skill::StrikeI.speed(),
@ -1553,15 +1557,20 @@ fn strangle_tick(source: &mut Construct, target: &mut Construct, mut results: Re
// remove immunity if target ko // remove immunity if target ko
if target.is_ko() && !source.is_ko() { if target.is_ko() && !source.is_ko() {
let i = source.effects if let Some(i) = source.effects
.iter() .iter()
.position(|e| e.effect == Effect::Strangling) .position(|e| e.effect == Effect::Strangling) {
.expect("no strangling on construct");
source.effects.remove(i); source.effects.remove(i);
results.push(Resolution::new(source, source) results.push(Resolution::new(source, source)
.event(Event::Removal { effect: Effect::Strangling, construct_effects: target.effects.clone() }) .event(Event::Removal { effect: Effect::Strangling, construct_effects: target.effects.clone() })
.stages(LogStages::PostOnly)); .stages(LogStages::PostOnly));
} }
else {
error!("{:?}", results);
println!("{:?}", results);
panic!("no strangling on source");
}
}
return results; return results;
} }
@ -2236,4 +2245,24 @@ mod tests {
purify(&mut x.clone(), &mut x, vec![], Skill::PurifyI); purify(&mut x.clone(), &mut x, vec![], Skill::PurifyI);
assert!(!x.effects.iter().any(|e| e.effect == Effect::Decay)); assert!(!x.effects.iter().any(|e| e.effect == Effect::Decay));
} }
#[test]
fn strangle_test() {
let mut x = Construct::new()
.named(&"muji".to_string());
let mut y = Construct::new()
.named(&"pretaliation".to_string());
strangle(&mut x, &mut y, vec![], Skill::StrangleI);
assert!(y.effects.iter().any(|e| e.effect == Effect::Strangle));
assert!(x.effects.iter().any(|e| e.effect == Effect::Strangling));
// ensure can't be removed
purify(&mut x, &mut y, vec![], Skill::PurifyI);
assert!(y.effects.iter().any(|e| e.effect == Effect::Strangle));
purge(&mut x.clone(), &mut x, vec![], Skill::PurgeI);
assert!(x.effects.iter().any(|e| e.effect == Effect::Strangling));
}
} }