Adds OnEndTurn script hook.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2021-03-28 18:24:49 +02:00
parent 23bd0da646
commit 21231761ef
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,16 @@ void TurnHandler::RunTurn(const ArbUt::BorrowedPtr<ChoiceQueue>& queue, const Ar
<< CreatureLib::Battling::TurnChoiceKindHelper::ToString(item->GetKind()) << " " << CreatureLib::Battling::TurnChoiceKindHelper::ToString(item->GetKind()) << " "
<< " with message"); << " with message");
} }
if (!battle->HasEnded()) {
for (const auto& side : battle->GetSides()) {
for (const auto& creature : side->GetCreatures()) {
if (!creature.HasValue()) {
continue;
}
HOOK(OnEndTurn, creature.GetValue());
}
}
}
queue->HasCompletedQueue = true; queue->HasCompletedQueue = true;
} }

View File

@ -85,6 +85,8 @@ namespace CreatureLib::Battling {
virtual void PreventRunAway([[maybe_unused]] const FleeTurnChoice* choice, [[maybe_unused]] bool* result){}; virtual void PreventRunAway([[maybe_unused]] const FleeTurnChoice* choice, [[maybe_unused]] bool* result){};
virtual void PreventOpponentRunAway([[maybe_unused]] const FleeTurnChoice* choice, virtual void PreventOpponentRunAway([[maybe_unused]] const FleeTurnChoice* choice,
[[maybe_unused]] bool* result){}; [[maybe_unused]] bool* result){};
virtual void OnEndTurn(){};
}; };
} }