Merge branch 'core' of ssh://git.mnml.gg:40022/~/mnml into core

This commit is contained in:
ntr 2019-12-13 20:09:53 +10:00
commit f941feea6f
2 changed files with 28 additions and 2 deletions

View File

@ -75,6 +75,7 @@ impl Effect {
match self {
Effect::Banish => true,
// delete sustain immunitiy???
Effect::Sustain => [
Skill::Stun,
Skill::Silence,
@ -198,7 +199,10 @@ impl Effect {
}
}
pub fn colour(&self) -> Option<Colour> {
// Old colour matching system for buffs / debuffs
// Had issues as some effects will be considered as both a buff and debuff e.g. invert,
// Ended up being confusing with mismatch skills that have red / blue e.g. amplify, haste, hybrid
/* pub fn colour(&self) -> Option<Colour> {
match self {
// physical
Effect::Stun => Some(Colour::Red),
@ -245,5 +249,5 @@ impl Effect {
Effect::Countered => None,
Effect::Ko => None,
}
}
}*/
}

View File

@ -1970,6 +1970,28 @@ mod tests {
}));
}
#[test]
fn sustain_test() {
// Standard case where construct gets ko from a big hit
let mut game = create_2v2_test_game();
let player = game.players[0].id;
let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id;
game.players[0].constructs[0].red_power.force(1000000);
game.new_resolve(Cast::new(source, player, target, Skill::Attack));
assert!(game.players[1].constructs[0].is_ko() == true);
// Sustain case where construct survives
let mut game = create_2v2_test_game();
let player = game.players[0].id;
let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id;
game.players[0].constructs[0].red_power.force(1000000);
game.new_resolve(Cast::new(source, player, target, Skill::Sustain));
game.new_resolve(Cast::new(source, player, target, Skill::Attack));
assert!(game.players[1].constructs[0].is_ko() == false);
}
#[test]
fn tick_consistency_test() {
let mut game = create_test_game();