Adds unit test for Anchor Shot.

This commit is contained in:
Deukhoofd 2021-03-28 18:16:20 +02:00
parent 4b401e59d6
commit 09dbf75da7
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#include <CreatureLib/Battling/Models/ExecutingAttack.hpp>
#include <PkmnLib/Battling/Battle/Battle.hpp>
#include <PkmnLib/Battling/Pokemon/CreatePokemon.hpp>
#include "../../../../extern/doctest.hpp"
#include "../../Macros/MoveMacros.hpp"
TEST_CASE("Anchor Shot - Locks pokemon in") {
SETUP_MOVE_TEST(Anchor_Shot)
script->OnSecondaryEffect(executingMove, targetMon, 0);
REQUIRE(userMon->HasVolatileScript("PreventFoeRunning"_cnc));
auto preventRun = false;
auto runChoice = CreatureLib::Battling::FleeTurnChoice(targetMon);
auto aggregator = userMon->GetScriptIterator();
while (aggregator.HasNext()) {
auto next = aggregator.GetNext();
auto castNext = next.ForceAs<PkmnLib::Battling::PkmnScript>();
castNext->PreventOpponentRunAway(&runChoice, &preventRun);
}
CHECK(preventRun);
CLEANUP_MOVE_TEST
}