tests back

This commit is contained in:
ntr 2019-12-13 15:05:18 +10:00
parent bf4038b09d
commit f63a8b3f8f
2 changed files with 276 additions and 280 deletions

View File

@ -1647,316 +1647,315 @@ mod tests {
// } // }
// #[test] #[test]
// fn upkeep_test() { fn upkeep_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// game.players[0].set_ready(true); game.players[0].set_ready(true);
// game.phase_end = Some(Utc::now().checked_sub_signed(Duration::seconds(500)).unwrap()); game.phase_end = Some(Utc::now().checked_sub_signed(Duration::seconds(500)).unwrap());
// game = game.upkeep(); game = game.upkeep();
// // assert!(game.players[1].warnings == 1); // assert!(game.players[1].warnings == 1);
// } }
// #[test] #[test]
// fn attack_test() { fn attack_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.add_skill(player_id, source, target, Skill::Attack).unwrap(); game.add_skill(player_id, source, target, Skill::Attack).unwrap();
// game = game.resolve_phase_start(); game = game.resolve_phase_start();
// } }
// #[test] #[test]
// fn bash_test() { fn bash_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Bash)); game.resolve(Cast::new(source, player_id, target, Skill::Bash));
// } }
// #[test] #[test]
// fn slay_test() { fn slay_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Slay)); game.resolve(Cast::new(source, player_id, target, Skill::Slay));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } => Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
// construct == target && amount > 0 && colour == Colour::Red, construct == target && amount > 0 && colour == Colour::Red,
// _ => false, _ => false,
// })); }));
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } => Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
// construct == target && amount > 0 && colour == Colour::Red, construct == target && amount > 0 && colour == Colour::Red,
// _ => false, _ => false,
// })); }));
// } }
// #[test] #[test]
// fn purify_test() { fn purify_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let source_player_id = game.players[0].id; let source_player_id = game.players[0].id;
// let target_player_id = game.players[1].id; let target_player_id = game.players[1].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, source_player_id, target, Skill::Decay)); game.resolve(Cast::new(source, source_player_id, target, Skill::Decay));
// // don't mention 3 we volvo now // don't mention 3 we volvo now
// assert!(game.players[1].constructs[0].effects.len() == 3); assert!(game.players[1].constructs[0].effects.len() == 3);
// game.resolve(Cast::new(target, target_player_id, target, Skill::Purify)); game.resolve(Cast::new(target, target_player_id, target, Skill::Purify));
// assert!(game.players[1].constructs[0].effects.len() == 1); assert!(game.players[1].constructs[0].effects.len() == 1);
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Effect { construct, effect, duration: _, display: _ } => Event::Effect { construct, effect, duration: _, display: _ } =>
// construct == target && effect == Effect::Pure, construct == target && effect == Effect::Pure,
// _ => false, _ => false,
// })); }));
// // Check for healing here // Check for healing here
// } }
// #[test] #[test]
// fn invert_test() { fn invert_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Strike)); game.resolve(Cast::new(source, player_id, target, Skill::Strike));
// game.resolve(Cast::new(source, player_id, target, Skill::Invert)); game.resolve(Cast::new(source, player_id, target, Skill::Invert));
// game.resolve(Cast::new(source, player_id, target, Skill::Strike)); game.resolve(Cast::new(source, player_id, target, Skill::Strike));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Healing { construct, colour, amount, overhealing: _, display: _, } => Event::Healing { construct, colour, amount, overhealing: _, display: _, } =>
// construct == target && amount > 0 && colour == Colour::Green, construct == target && amount > 0 && colour == Colour::Green,
// _ => false, _ => false,
// })); }));
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Healing { construct, colour, amount, overhealing: _, display: _ } => Event::Healing { construct, colour, amount, overhealing: _, display: _ } =>
// construct == target && amount > 0 && colour == Colour::Red, construct == target && amount > 0 && colour == Colour::Red,
// _ => false, _ => false,
// })); }));
// } }
// #[test] #[test]
// fn siphon_test() { fn siphon_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); game.resolve(Cast::new(source, player_id, target, Skill::Siphon));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// // siphon should // siphon should
// // apply effect // damage target // heal source // apply effect // damage target // heal source
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Effect { construct, effect, duration: _, display: _ } => Event::Effect { construct, effect, duration: _, display: _ } =>
// construct == target && effect == Effect::Siphon, construct == target && effect == Effect::Siphon,
// _ => false, _ => false,
// })); }));
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } => Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
// construct == target && amount > 0 && colour == Colour::Blue, construct == target && amount > 0 && colour == Colour::Blue,
// _ => false, _ => false,
// })); }));
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Healing { construct, colour, amount: _, overhealing: _, display: _ } => Event::Healing { construct, colour, amount: _, overhealing: _, display: _ } =>
// construct == source && colour == Colour::Green, construct == source && colour == Colour::Green,
// _ => false, _ => false,
// })); }));
// game = game.resolve_phase_start(); game = game.resolve_phase_start();
// // que ota? // que ota?
// game.resolve(Cast::new(source, player_id, target, Skill::Siphon)); game.resolve(Cast::new(source, player_id, target, Skill::Siphon));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// let damage_resolutions.iter().filter(|r| match r.event { let damage_events = resolutions.iter().filter(|r| match r.event {
// Event::Damage { construct: _, colour: _, amount: _, mitigation: _, display: _ } => true, Event::Damage { construct: _, colour: _, amount: _, mitigation: _, display: _ } => true,
// _ => false, _ => false,
// }).count(); }).count();
// assert_eq!(damage_events, 1); assert_eq!(damage_events, 1);
// } }
// #[test] #[test]
// fn reflect_test() { fn reflect_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Reflect)); game.resolve(Cast::new(source, player_id, target, Skill::Reflect));
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } => Event::Damage { construct, colour, amount, mitigation: _, display: _ } =>
// construct == source && amount > 0 && colour == Colour::Blue, construct == source && amount > 0 && colour == Colour::Blue,
// _ => false, _ => false,
// })); }));
// } }
// #[test] #[test]
// fn absorb_test() { fn absorb_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Absorb)); game.resolve(Cast::new(source, player_id, target, Skill::Absorb));
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation: _, display: _ } => { Event::Damage { construct, colour, amount, mitigation: _, display: _ } => {
// assert!(construct == target && amount > 0 && colour == Colour::Blue && r.skill == Skill::Blast); assert!(construct == target && amount > 0 && colour == Colour::Blue && r.skill == Skill::Blast);
// resolutions.iter().any(|r| match r.event { resolutions.iter().any(|r| match r.event {
// Event::Meta { construct, effect, meta } => Event::Meta { construct, effect, meta } =>
// construct == target && effect == Effect::Absorption && { construct == target && effect == Effect::Absorption && {
// match meta { match meta {
// EffectMeta::AddedDamage(added_dmg) => added_dmg == amount, EffectMeta::AddedDamage(added_dmg) => added_dmg == amount,
// _ => false, _ => false,
// } }
// }, },
// _ => false, _ => false,
// }) })
// }, },
// _ => false, _ => false,
// })); }));
// assert!(match game.players[1].constructs[0].effects[0].meta { assert!(match game.players[1].constructs[0].effects[0].meta {
// Some(EffectMeta::AddedDamage(d)) => d, Some(EffectMeta::AddedDamage(d)) => d,
// _ => 0 _ => 0
// // 320 base blue power and 125 base blue life // 320 base blue power and 125 base blue life
// } == 320.pct(Skill::Blast.multiplier()) - 125); } == 320.pct(Skill::Blast.multiplier()) - 125);
// } }
// #[test] #[test]
// fn absorb_multi_damage_test() { fn absorb_multi_damage_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// // Abosrb restores blue life here // Abosrb restores blue life here
// game.resolve(Cast::new(source, player_id, target, Skill::Absorb)); game.resolve(Cast::new(source, player_id, target, Skill::Absorb));
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// assert!(match game.players[1].constructs[0].effects[0].meta { assert!(match game.players[1].constructs[0].effects[0].meta {
// Some(EffectMeta::AddedDamage(d)) => d, Some(EffectMeta::AddedDamage(d)) => d,
// _ => 0 _ => 0
// // 320 base blue power and 125 base blue life // 320 base blue power and 125 base blue life
// } == 320.pct(Skill::Blast.multiplier()) - 125); } == 320.pct(Skill::Blast.multiplier()) - 125);
// } }
// #[test] #[test]
// fn multi_reflect_test() { fn multi_reflect_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let target_player_id = game.players[1].id; let target_player_id = game.players[1].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, source, Skill::Reflect)); game.resolve(Cast::new(source, player_id, source, Skill::Reflect));
// game.resolve(Cast::new(target, target_player_id, target, Skill::Reflect)); game.resolve(Cast::new(target, target_player_id, target, Skill::Reflect));
// game.resolve(Cast::new(source, player_id, target, Skill::Blast)); game.resolve(Cast::new(source, player_id, target, Skill::Blast));
// assert!(game.players[0].constructs[0].is_ko() == false); assert!(game.players[0].constructs[0].is_ko() == false);
// assert!(game.players[1].constructs[0].is_ko() == false); assert!(game.players[1].constructs[0].is_ko() == false);
// } }
// // refer fixme.md (infinite counterattack loop) // refer fixme.md (infinite counterattack loop)
// /*#[test] /*#[test]
// fn multi_counter_test() { fn multi_counter_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let target_player_id = game.players[1].id; let target_player_id = game.players[1].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// game.resolve(Cast::new(source, player_id, source, Skill::Counter)); game.resolve(Cast::new(source, player_id, source, Skill::Counter));
// game.resolve(Cast::new(target, target_player_id, target, Skill::Counter)); game.resolve(Cast::new(target, target_player_id, target, Skill::Counter));
// game.resolve(Cast::new(source, player_id, target, Skill::Attack)); game.resolve(Cast::new(source, player_id, target, Skill::Attack));
// assert!(game.players[0].constructs[0].is_ko() == false); assert!(game.players[0].constructs[0].is_ko() == false);
// assert!(game.players[1].constructs[0].is_ko() == false); assert!(game.players[1].constructs[0].is_ko() == false);
// }*/ }*/
// #[test] #[test]
// fn intercept_test() { fn intercept_test() {
// let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
// let player_id = game.players[0].id; let player_id = game.players[0].id;
// let other_player_id = game.players[1].id; let other_player_id = game.players[1].id;
// let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
// let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
// let interceptor = game.players[1].constructs[1].id; let interceptor = game.players[1].constructs[1].id;
// // Cast intercept // Cast intercept
// game.resolve(Cast::new(interceptor, other_player_id, interceptor, Skill::Intercept)); game.resolve(Cast::new(interceptor, other_player_id, interceptor, Skill::Intercept));
// // Enemy casts skill on target which as a teammate intercepting // Enemy casts skill on target which as a teammate intercepting
// game.resolve(Cast::new(source, player_id, target, Skill::Attack)); game.resolve(Cast::new(source, player_id, target, Skill::Attack));
// // Intercepting teammate attacks someone on same team // Intercepting teammate attacks someone on same team
// game.resolve(Cast::new(interceptor, other_player_id, target, Skill::Attack)); game.resolve(Cast::new(interceptor, other_player_id, target, Skill::Attack));
// let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
// let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
// // There should be no damage events on the target // There should be no damage events on the target
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation, display: _ } => Event::Damage { construct, colour, amount, mitigation, display: _ } =>
// construct == target && (amount > 0 || mitigation > 0) && colour == Colour::Red, construct == target && (amount > 0 || mitigation > 0) && colour == Colour::Red,
// _ => false, _ => false,
// }) == false); }) == false);
// // Should be damage events on the interceptor // Should be damage events on the interceptor
// assert!(resolutions.iter().any(|r| match r.event { assert!(resolutions.iter().any(|r| match r.event {
// Event::Damage { construct, colour, amount, mitigation, display: _ } => Event::Damage { construct, colour, amount, mitigation, display: _ } =>
// construct == interceptor && (amount > 0 || mitigation > 0) && colour == Colour::Red, construct == interceptor && (amount > 0 || mitigation > 0) && colour == Colour::Red,
// _ => false, _ => false,
// })); }));
} }
/*
#[test] #[test]
fn tick_speed_tests() { fn tick_speed_tests() {
let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
@ -1988,5 +1987,5 @@ mod tests {
let last = game.resolutions.len() - 1; let last = game.resolutions.len() - 1;
let resolutions = &game.resolutions[last]; let resolutions = &game.resolutions[last];
assert!(Skill::SiphonTick == resolutions[0].skill); assert!(Skill::SiphonTick == resolutions[0].skill);
}*/ }
// } }

View File

@ -1248,7 +1248,7 @@ fn absorption(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Absorption, duration: 3, meta: Some(EffectMeta::AddedDamage(0)) }, effect: ConstructEffect { effect: Effect::Absorption, duration: 3, meta: Some(EffectMeta::AddedDamage(0)) },
} }
); );
game.action(cast, game.action(cast,
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.source, construct: cast.source,
effect: Effect::Absorption, effect: Effect::Absorption,
@ -1270,7 +1270,7 @@ fn absorption_plus(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Absorption, duration: 4, meta: Some(EffectMeta::AddedDamage(0)) }, effect: ConstructEffect { effect: Effect::Absorption, duration: 4, meta: Some(EffectMeta::AddedDamage(0)) },
} }
); );
game.action(cast, game.action(cast,
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.target, construct: cast.target,
effect: Effect::Absorption, effect: Effect::Absorption,
@ -1292,7 +1292,7 @@ fn absorption_plus_plus(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Absorption, duration: 5, meta: Some(EffectMeta::AddedDamage(0)) }, effect: ConstructEffect { effect: Effect::Absorption, duration: 5, meta: Some(EffectMeta::AddedDamage(0)) },
} }
); );
game.action(cast, game.action(cast,
Action::SetEffectMeta { Action::SetEffectMeta {
construct: cast.target, construct: cast.target,
effect: Effect::Absorption, effect: Effect::Absorption,
@ -1316,7 +1316,7 @@ fn banish(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.target, stat: Stat::BlueLife }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.target, stat: Stat::BlueLife }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Banish, duration: 2, meta: None } effect: ConstructEffect { effect: Effect::Banish, duration: 2, meta: None }
@ -1342,7 +1342,7 @@ fn bash(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None } effect: ConstructEffect { effect: Effect::Stun, duration: 2, meta: None }
} }
); );
game.action(cast, game.action(cast,
Action::IncreaseCooldowns { Action::IncreaseCooldowns {
construct: cast.target, construct: cast.target,
turns: 1, turns: 1,
@ -1505,14 +1505,14 @@ fn decay(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)) }, effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(50)) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 2, meta: effect: ConstructEffect { effect: Effect::Decay, duration: 2, meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick }) }, Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTick }) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks
@ -1534,14 +1534,14 @@ fn decay_plus(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(35)) }, effect: ConstructEffect { effect: Effect::Wither, duration: 3, meta: Some(EffectMeta::Multiplier(35)) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlus }) }, Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlus }) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks
@ -1563,14 +1563,14 @@ fn decay_plus_plus(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Wither, duration: 4, meta: Some(EffectMeta::Multiplier(20)) }, effect: ConstructEffect { effect: Effect::Wither, duration: 4, meta: Some(EffectMeta::Multiplier(20)) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta: effect: ConstructEffect { effect: Effect::Decay, duration: 4, meta:
Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlusPlus }) }, Some(EffectMeta::CastTick { source: cast.source, target: cast.target, skill: Skill::DecayTickPlusPlus }) },
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Decayed, duration: 1, meta: None }, // immunity to additional ticks
@ -1880,7 +1880,7 @@ fn purify(cast: Cast, game: &mut Game) {
amount, amount,
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(150)) } effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(150)) }
@ -1905,7 +1905,7 @@ fn purify_plus(cast: Cast, game: &mut Game) {
amount, amount,
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(175)) } effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(175)) }
@ -1930,7 +1930,7 @@ fn purify_plus_plus(cast: Cast, game: &mut Game) {
amount, amount,
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(200)) } effect: ConstructEffect { effect: Effect::Pure, duration: 2, meta: Some(EffectMeta::Multiplier(200)) }
@ -2020,13 +2020,13 @@ fn siphon(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks
} }
); );
game.action(cast, game.action(cast,
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
@ -2050,13 +2050,13 @@ fn siphon_plus(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks
} }
); );
game.action(cast, game.action(cast,
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
@ -2080,13 +2080,13 @@ fn siphon_plus_plus(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::BluePower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks
} }
); );
game.action(cast, game.action(cast,
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
@ -2109,7 +2109,7 @@ fn siphon_tick(cast: Cast, game: &mut Game) {
effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks effect: ConstructEffect { effect: Effect::Siphoned, duration: 1, meta: None }, // immunity to additional ticks
} }
); );
game.action(cast, game.action(cast,
Action::Heal { Action::Heal {
construct: cast.source, construct: cast.source,
colour: Colour::Green, colour: Colour::Green,
@ -2184,16 +2184,16 @@ fn sleep_plus_plus(cast: Cast, game: &mut Game) {
} }
fn silence(cast: Cast, game: &mut Game) { fn silence(cast: Cast, game: &mut Game) {
let bp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower });
let silences = game.value(Value::ColourSkills { construct: cast.target, colour: Colour::Blue });
let amount = bp.pct(45usize.saturating_mul(silences));
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Silence, duration: 2, meta: None }, effect: ConstructEffect { effect: Effect::Silence, duration: 2, meta: None },
} }
); );
let bp = game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower });
let silences = game.value(Value::ColourSkills { construct: cast.target, colour: Colour::Blue });
let amount = bp.pct(45usize.saturating_mul(silences));
game.action(cast, game.action(cast,
Action::Damage { Action::Damage {
construct: cast.target, construct: cast.target,
@ -2244,7 +2244,7 @@ fn triage(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None },
@ -2267,7 +2267,7 @@ fn triage_plus(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None },
@ -2290,7 +2290,7 @@ fn triage_plus_plus(cast: Cast, game: &mut Game) {
amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()), amount: game.value(Value::Stat { construct: cast.source, stat: Stat::GreenPower }).pct(cast.skill.multiplier()),
} }
); );
game.action(cast, game.action(cast,
Action::Effect { Action::Effect {
construct: cast.target, construct: cast.target,
effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None }, effect: ConstructEffect { effect: Effect::Triaged, duration: 1, meta: None },
@ -2658,6 +2658,3 @@ mod tests {
// assert!(y.disabled(Skill::Heal).is_some()); // assert!(y.disabled(Skill::Heal).is_some());
// } // }
} }
// // haste_strike_check(game)