Adds OnFaintingOpponent script hook.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
70ac3813cf
commit
9270dcca8c
|
@ -26,20 +26,20 @@ void TurnHandler::RunTurn(const ArbUt::BorrowedPtr<ChoiceQueue>& queue, const Ar
|
|||
}
|
||||
scripts.Clear();
|
||||
creature.GetValue()->GetOwnScripts(scripts);
|
||||
for (auto& s : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
||||
for (auto& script : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||
}
|
||||
}
|
||||
scripts.Clear();
|
||||
side->GetOwnScripts(scripts);
|
||||
for (auto& s : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
||||
for (auto& script : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||
}
|
||||
}
|
||||
scripts.Clear();
|
||||
battle->GetOwnScripts(scripts);
|
||||
for (auto& s : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
||||
for (auto& script : scripts) {
|
||||
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||
}
|
||||
}
|
||||
queue->HasCompletedQueue = true;
|
||||
|
@ -254,7 +254,11 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, const ArbUt::Bo
|
|||
}
|
||||
if (damage > 0) {
|
||||
target->Damage(damage, DamageSource::AttackDamage);
|
||||
HOOK(OnIncomingHit, target, attack, target.GetRaw(), hitIndex);
|
||||
if (!target->IsFainted()) {
|
||||
HOOK(OnIncomingHit, target, attack, target.GetRaw(), hitIndex);
|
||||
} else {
|
||||
HOOK(OnFaintingOpponent, attack, attack, target.GetRaw(), hitIndex);
|
||||
}
|
||||
|
||||
if (attackData->HasSecondaryEffect() && !user->IsFainted()) {
|
||||
bool preventSecondary = false;
|
||||
|
|
|
@ -85,6 +85,8 @@ namespace CreatureLib::Battling {
|
|||
|
||||
virtual void OnIncomingHit([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
||||
[[maybe_unused]] u8 hitNumber){};
|
||||
virtual void OnFaintingOpponent([[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,
|
||||
|
|
Loading…
Reference in New Issue