fix ticks properly..."

This commit is contained in:
ntr 2019-05-08 14:51:53 +10:00
parent 0b6f609aad
commit d8c5effb2d
2 changed files with 9 additions and 4 deletions

View File

@ -1429,6 +1429,9 @@ mod tests {
let x_cryp = x_player.cryps[0].clone();
let y_cryp = y_player.cryps[0].clone();
// make the purify cryp super fast so it beats out decay
game.cryp_by_id(y_cryp.id).unwrap().speed.force(10000000);
game.cryp_by_id(x_cryp.id).unwrap().learn_mut(Skill::Decay);
while game.cryp_by_id(x_cryp.id).unwrap().skill_on_cd(Skill::Decay).is_some() {
game.cryp_by_id(x_cryp.id).unwrap().reduce_cooldowns();
@ -1467,7 +1470,8 @@ mod tests {
while let Some(Resolution { source: _, target: _, event }) = game.resolved.pop() {
match event {
Event::Damage { amount: _, skill: _, mitigation: _, colour: _ } => panic!("{:?} damage event", event),
Event::Damage { amount: _, skill: _, mitigation: _, colour: _ } =>
panic!("{:?} damage event", event),
_ => (),
}
};
@ -1486,7 +1490,8 @@ mod tests {
while let Some(Resolution { source: _, target: _, event }) = game.resolved.pop() {
match event {
Event::Damage { amount: _, skill: _, mitigation: _, colour: _ } => panic!("{:?} damage event", event),
Event::Damage { amount: _, skill: _, mitigation: _, colour: _ } =>
panic!("{:#?} {:#?} damage event", game.resolved, event),
_ => (),
}
};

View File

@ -35,7 +35,7 @@ pub fn pre_resolve(cast: &Cast, game: &mut Game, mut resolutions: Resolutions) -
if cast.is_tick && target.effects.iter().find(|ce| match ce.tick {
Some(t) => t.id == cast.id,
None => false,
}).is_some() {
}).is_none() {
continue;
}
@ -1405,7 +1405,7 @@ fn purify(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions, skill:
let amount = source.green_damage().pct(skill.multiplier());
while let Some(i) = target.effects
.iter()
.position(|ce| [Category::Debuff, Category::Debuff].contains(&ce.effect.category())) {
.position(|ce| Category::Debuff == ce.effect.category()) {
let ce = target.effects.remove(i);
results.push(Resolution::new(source, target).event(Event::Removal { effect: ce.effect }));
target.deal_green_damage(skill, amount)