link damage fix + test
This commit is contained in:
parent
13b8c5b766
commit
89a09e5ebc
@ -5,8 +5,11 @@ game ready not auto starting resolve phase
|
||||
cooldowns set after cast
|
||||
cooldowns reduced after 1 complete cast
|
||||
|
||||
don't focus if ko
|
||||
highlight skills being used
|
||||
ruin cd
|
||||
triage 0 heal
|
||||
effects info
|
||||
|
||||
sleep heal
|
||||
invert animation - too slow
|
||||
slay animation still looks a bit weird
|
||||
electric / electrocute anim order some issue
|
||||
triaged / decayed / siphoned / electrocute effect removal with purify / purge
|
||||
inverted green damage ??
|
||||
|
||||
@ -495,7 +495,7 @@ impl Construct {
|
||||
self.effects = self.effects.clone().into_iter().filter_map(|mut effect| {
|
||||
effect.duration = effect.duration.saturating_sub(1);
|
||||
|
||||
println!("{:?}", effect);
|
||||
// println!("{:?}", effect);
|
||||
|
||||
if effect.duration == 0 {
|
||||
return None;
|
||||
|
||||
@ -427,12 +427,12 @@ impl Game {
|
||||
// temp vec of this round's resolving skills
|
||||
// because need to check cooldown use before pushing them into the complete list
|
||||
let mut r_animation_ms = 0;
|
||||
println!("{:?}", self.stack);
|
||||
// println!("{:?}", self.stack);
|
||||
while let Some(cast) = self.stack.pop() {
|
||||
self.new_resolve(cast);
|
||||
};
|
||||
|
||||
println!("processing durations");
|
||||
// println!("processing durations");
|
||||
self.progress_durations();
|
||||
|
||||
// go through the whole most recent round and modify delays of the resolutions
|
||||
@ -1269,6 +1269,7 @@ mod tests {
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Ruin).is_some());
|
||||
}
|
||||
|
||||
|
||||
// #[cfg(test)]
|
||||
// mod tests {
|
||||
// use skill::*;
|
||||
@ -1681,56 +1682,6 @@ mod tests {
|
||||
// assert!(game.construct_by_id(y_construct.id).unwrap().affected(Effect::Electrocute));
|
||||
// }
|
||||
|
||||
// // #[test]
|
||||
// // fn link_test() {
|
||||
// // let mut game = create_test_game();
|
||||
|
||||
// // let x_player = game.players[0].clone();
|
||||
// // let y_player = game.players[1].clone();
|
||||
|
||||
// // let x_construct = x_player.constructs[0].clone();
|
||||
// // let y_construct = y_player.constructs[0].clone();
|
||||
|
||||
// // game.construct_by_id(x_construct.id).unwrap().learn_mut(Skill::Link);
|
||||
|
||||
// // while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Link).is_some() {
|
||||
// // game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
// // }
|
||||
|
||||
// // // apply buff
|
||||
// // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Link).unwrap();
|
||||
// // game.player_ready(x_player.id).unwrap();
|
||||
// // game.player_ready(y_player.id).unwrap();
|
||||
// // game = game.resolve_phase_start();
|
||||
// // assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Link));
|
||||
|
||||
// // let Resolution { source: _, target: _, Resolution, stages: _ } = game.Resolutions.last.unwrap().pop().unwrap();
|
||||
// // match Resolution {
|
||||
// // Resolution::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Link),
|
||||
// // _ => panic!("not siphon"),
|
||||
// // };
|
||||
|
||||
// // let Resolution { source: _, target: _, Resolution, stages: _ } = game.Resolutions.last.unwrap().pop().unwrap();
|
||||
// // match Resolution {
|
||||
// // Resolution::Recharge { red: _, blue: _, skill: _ } => (),
|
||||
// // _ => panic!("link result was not recharge"),
|
||||
// // }
|
||||
|
||||
// // // attack and receive link hit
|
||||
// // game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
// // game.player_ready(x_player.id).unwrap();
|
||||
// // game.player_ready(y_player.id).unwrap();
|
||||
// // game = game.resolve_phase_start();
|
||||
|
||||
// // let Resolution { source: _, target, Resolution, stages: _ } = game.Resolutions.last.unwrap().pop().unwrap();
|
||||
// // assert_eq!(target.id, y_construct.id);
|
||||
// // match Resolution {
|
||||
// // Resolution::Damage { amount, skill: _, mitigation: _, colour: _} =>
|
||||
// // assert_eq!(amount, x_construct.red_power().pct(Skill::Attack.multiplier()) >> 1),
|
||||
// // _ => panic!("not damage link"),
|
||||
// // };
|
||||
// // }
|
||||
|
||||
// // #[test]
|
||||
// // fn absorb_test() {
|
||||
// // let mut game = create_test_game();
|
||||
@ -2091,6 +2042,43 @@ mod tests {
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[test]
|
||||
fn link_test() {
|
||||
let mut game = create_2v2_test_game();
|
||||
let player_id = game.players[0].id;
|
||||
let source = game.players[0].constructs[0].id;
|
||||
let target = game.players[1].constructs[0].id;
|
||||
game.players[1].constructs[0].blue_life.force(0);
|
||||
|
||||
game.new_resolve(Cast::new(source, player_id, target, Skill::Link));
|
||||
|
||||
let last = game.resolutions.len() - 1;
|
||||
let resolutions = &game.resolutions[last];
|
||||
|
||||
assert!(resolutions.iter().any(|r| match r.event {
|
||||
Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
|
||||
construct == target && amount == 320.pct(50) && colour == Colour::Blue,
|
||||
_ => false,
|
||||
}));
|
||||
|
||||
game = game.resolve_phase_start();
|
||||
game.new_resolve(Cast::new(source, player_id, target, Skill::Triage));
|
||||
game.new_resolve(Cast::new(source, player_id, target, Skill::Link));
|
||||
|
||||
let last = game.resolutions.len() - 1;
|
||||
let resolutions = &game.resolutions[last];
|
||||
|
||||
assert!(resolutions.iter().any(|r| match r.event {
|
||||
Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
|
||||
construct == target && amount == 320.pct(75) && colour == Colour::Blue,
|
||||
_ => false,
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn siphon_test() {
|
||||
let mut game = create_2v2_test_game();
|
||||
|
||||
@ -1844,11 +1844,16 @@ fn link(cast: Cast, game: &mut Game, values: Link) {
|
||||
effect: ConstructEffect { effect: Effect::Stun, duration: values.duration(), meta: None },
|
||||
}
|
||||
);
|
||||
|
||||
let bp = game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(values.blue_dmg_base());
|
||||
let links = game.value(Value::Effects { construct: cast.target });
|
||||
let amount = bp.pct(100 + 100usize.saturating_mul(links));
|
||||
|
||||
game.action(cast,
|
||||
Action::Damage {
|
||||
construct: cast.target,
|
||||
colour: Colour::Blue,
|
||||
amount: game.value(Value::Effects { construct: cast.target }).pct(values.blue_dmg_base()),
|
||||
amount: amount,
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -2086,7 +2091,7 @@ fn sleep(cast: Cast, game: &mut Game, values: Sleep) {
|
||||
Action::Heal {
|
||||
construct: cast.target,
|
||||
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(values.green_heal_multi()),
|
||||
colour: Colour::Blue,
|
||||
colour: Colour::Green,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user