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();
|
scripts.Clear();
|
||||||
creature.GetValue()->GetOwnScripts(scripts);
|
creature.GetValue()->GetOwnScripts(scripts);
|
||||||
for (auto& s : scripts) {
|
for (auto& script : scripts) {
|
||||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scripts.Clear();
|
scripts.Clear();
|
||||||
side->GetOwnScripts(scripts);
|
side->GetOwnScripts(scripts);
|
||||||
for (auto& s : scripts) {
|
for (auto& script : scripts) {
|
||||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scripts.Clear();
|
scripts.Clear();
|
||||||
battle->GetOwnScripts(scripts);
|
battle->GetOwnScripts(scripts);
|
||||||
for (auto& s : scripts) {
|
for (auto& script : scripts) {
|
||||||
EXECUTE_SCRIPT_FUNC(s, OnEndTurn);
|
EXECUTE_SCRIPT_FUNC(script, OnEndTurn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queue->HasCompletedQueue = true;
|
queue->HasCompletedQueue = true;
|
||||||
|
@ -254,7 +254,11 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, const ArbUt::Bo
|
||||||
}
|
}
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
target->Damage(damage, DamageSource::AttackDamage);
|
target->Damage(damage, DamageSource::AttackDamage);
|
||||||
|
if (!target->IsFainted()) {
|
||||||
HOOK(OnIncomingHit, target, attack, target.GetRaw(), hitIndex);
|
HOOK(OnIncomingHit, target, attack, target.GetRaw(), hitIndex);
|
||||||
|
} else {
|
||||||
|
HOOK(OnFaintingOpponent, attack, attack, target.GetRaw(), hitIndex);
|
||||||
|
}
|
||||||
|
|
||||||
if (attackData->HasSecondaryEffect() && !user->IsFainted()) {
|
if (attackData->HasSecondaryEffect() && !user->IsFainted()) {
|
||||||
bool preventSecondary = false;
|
bool preventSecondary = false;
|
||||||
|
|
|
@ -85,6 +85,8 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
virtual void OnIncomingHit([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
virtual void OnIncomingHit([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target,
|
||||||
[[maybe_unused]] u8 hitNumber){};
|
[[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,
|
virtual void PreventSecondaryEffects([[maybe_unused]] const ExecutingAttack* attack,
|
||||||
[[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber,
|
[[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber,
|
||||||
|
|
Loading…
Reference in New Issue