Actually implement handling of StopBeforeAttack script hook
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-02-03 19:11:44 +01:00
parent c6620021a7
commit cd7ddcf78e
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 6 additions and 2 deletions

View File

@ -82,7 +82,11 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
return; return;
} }
HOOK(StopBeforeAttack, attack, attack); bool stopBeforeAttack = false;
HOOK(StopBeforeAttack, attack, attack, &stopBeforeAttack);
if (stopBeforeAttack) {
return;
}
HOOK(OnBeforeAttack, attack, attack); HOOK(OnBeforeAttack, attack, attack);
for (auto& kv : attack->GetTargets()) { for (auto& kv : attack->GetTargets()) {

View File

@ -30,7 +30,7 @@ namespace CreatureLib::Battling {
virtual void ChangeAttack(AttackTurnChoice* choice, std::string* outAttack){}; virtual void ChangeAttack(AttackTurnChoice* choice, std::string* outAttack){};
virtual void PreventAttack(ExecutingAttack* attack, bool* outResult){}; virtual void PreventAttack(ExecutingAttack* attack, bool* outResult){};
virtual void FailAttack(ExecutingAttack* attack, bool* outFailed){}; virtual void FailAttack(ExecutingAttack* attack, bool* outFailed){};
virtual void StopBeforeAttack(ExecutingAttack* attack){}; virtual void StopBeforeAttack(ExecutingAttack* attack, bool* outResult){};
virtual void OnBeforeAttack(ExecutingAttack* attack){}; virtual void OnBeforeAttack(ExecutingAttack* attack){};
virtual void FailIncomingAttack(ExecutingAttack* attack, Creature* target, bool* outResult){}; virtual void FailIncomingAttack(ExecutingAttack* attack, Creature* target, bool* outResult){};