Remove event hook threads, as it caused issues when being called from dotnet.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -186,6 +186,37 @@ TEST_CASE("Switch Creature in", "[Integrations]") {
|
||||
REQUIRE(battle.GetCreature(CreatureIndex(0, 0)) == c2);
|
||||
}
|
||||
|
||||
TEST_CASE("Switch Creature in with event listener", "[Integrations]") {
|
||||
auto library = TestLibrary::Get();
|
||||
auto c1 = CreateCreature(library, "testSpecies1"_cnc, 100)
|
||||
.WithAttack("standard"_cnc, AttackLearnMethod::Unknown)
|
||||
.Create();
|
||||
auto c2 =
|
||||
CreateCreature(library, "testSpecies1"_cnc, 1).WithAttack("standard"_cnc, AttackLearnMethod::Unknown).Create();
|
||||
CreatureParty party1{c1, c2};
|
||||
auto battleParty1 = new BattleParty(&party1, {CreatureIndex(0, 0)});
|
||||
auto c3 =
|
||||
CreateCreature(library, "testSpecies1"_cnc, 1).WithAttack("standard"_cnc, AttackLearnMethod::Unknown).Create();
|
||||
CreatureParty party2{c3};
|
||||
auto battleParty2 = new BattleParty(&party2, {CreatureIndex(1, 0)});
|
||||
|
||||
auto battle = Battle(library, {battleParty1, battleParty2});
|
||||
std::vector<const EventData*> events;
|
||||
battle.RegisterEventListener([&](const EventData* evt) mutable -> void { events.push_back(evt); });
|
||||
|
||||
battle.SwitchCreature(0, 0, c1);
|
||||
battle.SwitchCreature(1, 0, c3);
|
||||
|
||||
REQUIRE(events.size() == 2);
|
||||
|
||||
REQUIRE(battle.GetCreature(CreatureIndex(0, 0)) == c1);
|
||||
|
||||
battle.TrySetChoice(new SwitchTurnChoice(c1, c2));
|
||||
battle.TrySetChoice(new PassTurnChoice(c3));
|
||||
|
||||
REQUIRE(battle.GetCreature(CreatureIndex(0, 0)) == c2);
|
||||
}
|
||||
|
||||
TEST_CASE("Switch Creature in, but have attack aimed at it. Attack should hit new creature", "[Integrations]") {
|
||||
auto library = TestLibrary::Get();
|
||||
auto c1 =
|
||||
|
||||
Reference in New Issue
Block a user