Fixed battle ending after any faint.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-12-07 22:52:43 +01:00
parent f5aa168f1b
commit dc9296194e
3 changed files with 51 additions and 8 deletions

View File

@@ -106,6 +106,37 @@ TEST_CASE("When creature is dealt enough damage, faint it and mark battle as end
REQUIRE(battle.GetResult() == 0);
}
TEST_CASE("When another creature is available on faint, make sure the battle hasn't ended", "[Integrations]") {
auto library = TestLibrary::Get();
auto c1 = CreateCreature(library, "testSpecies1", 100).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
CreatureParty party1{c1};
auto battleParty1 = BattleParty(&party1, {CreatureIndex(0, 0)});
auto c2 = CreateCreature(library, "testSpecies1", 1).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
auto c3 = CreateCreature(library, "testSpecies1", 1).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
CreatureParty party2{c2, c3};
auto battleParty2 = BattleParty(&party2, {CreatureIndex(1, 0)});
auto battle = Battle(library, {battleParty1, battleParty2});
REQUIRE_FALSE(battle.HasEnded());
battle.SwitchCreature(0, 0, c1);
battle.SwitchCreature(1, 0, c2);
REQUIRE_FALSE(battle.HasEnded());
battle.TrySetChoice(new AttackTurnChoice(c1, c1->GetAttacks()[0], CreatureIndex(1, 0)));
battle.TrySetChoice(new PassTurnChoice(c2));
REQUIRE_FALSE(battle.HasEnded());
battle.SwitchCreature(1, 0, c3);
battle.TrySetChoice(new AttackTurnChoice(c1, c1->GetAttacks()[0], CreatureIndex(1, 0)));
battle.TrySetChoice(new PassTurnChoice(c3));
REQUIRE(battle.HasEnded());
REQUIRE(battle.GetResult() == 0);
}
#endif