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

This commit is contained in:
Deukhoofd 2021-11-19 18:01:58 +01:00
parent aaadbfb4f2
commit f811fc0654
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 4 additions and 0 deletions

View File

@ -255,6 +255,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, const ArbUt::Bo
}
if (damage > 0) {
target->Damage(damage, DamageSource::AttackDamage);
HOOK(OnIncomingHit, target, attack, target.GetRaw(), hitIndex);
if (attackData->HasSecondaryEffect() && !user->IsFainted()) {
bool preventSecondary = false;

View File

@ -81,6 +81,9 @@ namespace CreatureLib::Battling {
virtual void OverrideIncomingDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] u8 hitIndex, [[maybe_unused]] u32* damage){};
virtual void OnIncomingHit([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] u8 hitNumber){};
virtual void PreventSecondaryEffects([[maybe_unused]] const ExecutingAttack* attack,
[[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber,
[[maybe_unused]] bool* outResult){};