Merge branch 'develop' into release/1.11.2

This commit is contained in:
ntr 2020-01-07 16:19:17 +10:00
commit b3c6c59d35
2 changed files with 18 additions and 76 deletions

View File

@ -632,11 +632,11 @@ impl Game {
Value::ColourSkills { construct, colour } =>
self.construct(construct).stat(Stat::Skills(colour)),
Value::DamageReceived { construct, colour } =>
Value::DamageReceived { construct } =>
self.events.iter().fold(0, |dmg, e| match e {
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
match construct == *event_construct && colour == *event_colour {
true => dmg + amount,
Event::Damage { construct: event_construct, amount, mitigation, colour: _, display: _ } =>
match construct == *event_construct {
true => amount + mitigation,
false => dmg,
}
_ => dmg,
@ -856,7 +856,7 @@ pub enum Value {
ColourSkills { construct: Uuid, colour: Colour },
Effects { construct: Uuid },
Removals { construct: Uuid },
DamageReceived { construct: Uuid, colour: Colour },
DamageReceived { construct: Uuid },
TickDamage { construct: Uuid, effect: Effect },
// Affected { construct: Uuid, effect: Effect }, // not an int :(
}
@ -1295,10 +1295,6 @@ mod tests {
}
// #[cfg(test)]
// mod tests {
// use skill::*;
// #[test]
// fn attack_actions_test() {
// let cast = Cast::new(Uuid::new_v4(), Uuid::new_v4(), Uuid::new_v4(), Skill::Attack);
@ -1478,48 +1474,6 @@ mod tests {
// };
// }
// #[test]
// fn siphon_test() {
// let mut x = Construct::new()
// .named(&"muji".to_string());
// let mut y = Construct::new()
// .named(&"camel".to_string());
// x.blue_power.force(256);
// x.green_power.force(220);
// x.green_life.force(1024);
// y.blue_life.force(0);
// x.green_life.reduce(512);
// cast_actions(Skill::Siphon, &mut x, &mut y, vec![]);
// assert!(y.affected(Effect::Siphon));
// assert!(x.green_life() == (512 + 256.pct(Skill::SiphonTick.multiplier()) + 220.pct(Skill::SiphonTick.multiplier())));
// let Event { source: _, target: _, event, stages: _ } = resolutions.remove(0);
// match event {
// Event::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Siphon),
// _ => panic!("not siphon"),
// };
// let Event { source: _, target: _, event, stages: _ } = resolutions.remove(0);
// match event {
// Event::Damage { amount, skill: _, mitigation: _, colour: _} => assert_eq!(amount, 256.pct(Skill::SiphonTick.multiplier())
// + 220.pct(Skill::SiphonTick.multiplier())),
// _ => panic!("not damage siphon"),
// };
// let Event { source: _, target, event, stages: _ } = resolutions.remove(0);
// match event {
// Event::Heal { amount, skill: _, overhealing: _ } => {
// assert_eq!(amount, 256.pct(Skill::SiphonTick.multiplier()) + 220.pct(Skill::SiphonTick.multiplier()));
// assert_eq!(target.id, x.id);
// },
// _ => panic!("not healing"),
// };
// }
// #[test]
// fn triage_test() {
// let mut x = Construct::new()
@ -2192,7 +2146,7 @@ mod tests {
}).count() == 2);
let _siphon_dmg = resolutions.iter().find_map(|r| match r.skill {
let siphon_dmg = resolutions.iter().find_map(|r| match r.skill {
Skill::Siphon => {
match r.event {
Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
@ -2202,24 +2156,12 @@ mod tests {
_ => None
}).expect("no siphon dmg");
// let hybrid_dmg = resolutions.iter().find_map(|r| match r.skill {
// Skill::HybridBlast => {
// match r.event {
// Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
// _ => None,
// }
// },
// _ => None
// }).expect("no hybrid dmg");
// assert!(resolutions.iter().any(|r| match r.event {
// Event::Healing { construct, colour, amount, overhealing, display: _ } => {
// construct == source && (amount + overhealing) == siphon_dmg && colour == Colour::Green
// // this works
// // construct == source && (amount + overhealing) == (siphon_dmg + hybrid_dmg) && colour == Colour::Green
// },
// _ => false,
// }));
assert!(resolutions.iter().any(|r| match r.event {
Event::Healing { construct, colour, amount, overhealing, display: _ } => {
construct == source && (amount + overhealing) == siphon_dmg && colour == Colour::Green
},
_ => false,
}));
}
#[test]
@ -2360,13 +2302,13 @@ mod tests {
let resolutions = &game.resolutions[last];
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);
resolutions.iter().any(|r| match r.event {
Event::Meta { construct, effect, meta } =>
construct == target && effect == Effect::Absorption && {
match meta {
EffectMeta::AddedDamage(added_dmg) => added_dmg == amount,
EffectMeta::AddedDamage(added_dmg) => added_dmg == amount + mitigation,
_ => false,
}
},

View File

@ -1002,7 +1002,7 @@ fn siphon(cast: Cast, game: &mut Game, values: Siphon) {
Action::Heal {
construct: cast.source,
colour: Colour::Green,
amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }).pct(100),
amount: game.value(Value::DamageReceived { construct: cast.target }).pct(100),
},
);
@ -1032,7 +1032,7 @@ fn siphon_tick(cast: Cast, game: &mut Game) {
Action::Heal {
construct: cast.source,
colour: Colour::Green,
amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Blue }).pct(100),
amount: game.value(Value::DamageReceived { construct: cast.target }).pct(100),
},
);
}
@ -1073,7 +1073,7 @@ fn slay(cast: Cast, game: &mut Game, values: Slay) {
Action::Heal {
construct: cast.source,
colour: Colour::Green,
amount: game.value(Value::DamageReceived { construct: cast.target, colour: Colour::Red }).pct(values.self_heal_multi()),
amount: game.value(Value::DamageReceived { construct: cast.target }).pct(values.self_heal_multi()),
},
);
}
@ -1318,7 +1318,7 @@ fn absorption(cast: Cast, game: &mut Game, values: Absorption) {
Action::SetEffectMeta {
construct: cast.target,
effect: Effect::Absorption,
amount: game.value(Value::DamageReceived { construct: cast.source, colour: Colour::Blue }).pct(100),
amount: game.value(Value::DamageReceived { construct: cast.source }).pct(100),
},
);
}