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

This commit is contained in:
Deukhoofd 2021-11-19 12:12:46 +01:00
parent 59313e6da8
commit 2ea928e67b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 2 additions and 1 deletions

View File

@ -174,9 +174,9 @@ namespace CreatureLib::Battling {
void Creature::OnFaint() {
EnsureNotNull(_battleData.Battle)
EnsureNotNull(_battleData.Side)
// HOOK: On Faint
if (_battleData.Battle.HasValue()) {
_battleData.Battle.GetValue()->TriggerEventListener<FaintEvent>(this);
HOOK(OnFaint, this, this);
}
_library->GetExperienceLibrary()->HandleExperienceGain(this, _battleData.SeenOpponents);
if (_battleData.Battle.HasValue() && _battleData.Side.HasValue()) {

View File

@ -99,6 +99,7 @@ namespace CreatureLib::Battling {
[[maybe_unused]] bool* result){};
virtual void OnEndTurn(){};
virtual void OnFaint([[maybe_unused]] Creature* creature){};
};
}