better duplicate ko check
This commit is contained in:
parent
7d253ab65d
commit
c99f189c69
@ -299,9 +299,9 @@ pub fn resolve(skill: Skill, source: &mut Construct, target: &mut Construct, mut
|
||||
}
|
||||
|
||||
fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) -> Resolutions {
|
||||
for Resolution { source, target, event, stages: _ } in resolutions.clone() {
|
||||
for Resolution { source, target: event_target, event, stages: _ } in resolutions.clone() {
|
||||
let mut source = game.construct_by_id(source.id).unwrap().clone();
|
||||
let mut target = game.construct_by_id(target.id).unwrap().clone();
|
||||
let mut target = game.construct_by_id(event_target.id).unwrap().clone();
|
||||
|
||||
match event {
|
||||
Event::Damage { amount, skill, mitigation, colour: c } => {
|
||||
@ -352,18 +352,14 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) ->
|
||||
_ => (),
|
||||
};
|
||||
|
||||
if target.is_ko() {
|
||||
if target.is_ko() && event_target.green == 0 {
|
||||
// Check target is actually ko if sending ko event
|
||||
target.effects.clear();
|
||||
resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly));
|
||||
}
|
||||
|
||||
game.update_construct(&mut source);
|
||||
game.update_construct(&mut target);
|
||||
|
||||
if target.is_ko() {
|
||||
// Don't loop for multiple resolutions which led to KO
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return resolutions;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user