Implements marking opponents as seen.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-12-14 12:40:50 +01:00
parent c25d7b865e
commit 3baed93597
5 changed files with 58 additions and 2 deletions

View File

@@ -185,4 +185,40 @@ TEST_CASE("Switch Creature in, but have attack aimed at it. Attack should hit ne
REQUIRE(c1->GetCurrentHealth() == c1->GetBoostedStat(Core::Statistic::Health));
}
TEST_CASE("Switch Creature in, mark as seen opponent for opponent", "[Integrations]") {
auto library = TestLibrary::Get();
auto c1 = CreateCreature(library, "testSpecies1", 100).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
auto c2 = CreateCreature(library, "testSpecies1", 1).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
CreatureParty party1{c1, c2};
auto battleParty1 = BattleParty(&party1, {CreatureIndex(0, 0)});
auto c3 = CreateCreature(library, "testSpecies1", 1).WithAttack("standard", AttackLearnMethod::Unknown)->Create();
CreatureParty party2{c3};
auto battleParty2 = BattleParty(&party2, {CreatureIndex(1, 0)});
auto battle = Battle(library, {battleParty1, battleParty2});
battle.SwitchCreature(0, 0, c1);
battle.SwitchCreature(1, 0, c3);
auto seen = c3->GetSeenOpponents();
REQUIRE(seen.size() == 1);
REQUIRE(seen.find(c1) != seen.end());
battle.TrySetChoice(new SwitchTurnChoice(c1, c2));
battle.TrySetChoice(new PassTurnChoice(c3));
seen = c3->GetSeenOpponents();
REQUIRE(seen.size() == 2);
REQUIRE(seen.find(c1) != seen.end());
REQUIRE(seen.find(c2) != seen.end());
battle.TrySetChoice(new SwitchTurnChoice(c2, c1));
battle.TrySetChoice(new PassTurnChoice(c3));
seen = c3->GetSeenOpponents();
REQUIRE(seen.size() == 2);
REQUIRE(seen.find(c1) != seen.end());
REQUIRE(seen.find(c2) != seen.end());
}
#endif