diff --git a/src/Battling/Flow/TurnHandler.cpp b/src/Battling/Flow/TurnHandler.cpp index 52efffa..9e2c901 100644 --- a/src/Battling/Flow/TurnHandler.cpp +++ b/src/Battling/Flow/TurnHandler.cpp @@ -77,10 +77,15 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice *choice) { } //HOOK: check if attack fails + bool fail = false; + HOOK(FailAttack, attack, attack, fail); + if (fail){ + //TODO: Fail handling. + return; + } - //HOOK: Check if attack stops after decreasing PP - - //HOOK: On Before Attack + HOOK(StopBeforeAttack, attack, attack); + HOOK(OnBeforeAttack, attack, attack); for (auto& kv: attack->GetTargets()){ HandleAttackForTarget(attack, kv.first, kv.second); diff --git a/src/Battling/ScriptHandling/Script.hpp b/src/Battling/ScriptHandling/Script.hpp index 815e3c0..e17f2f9 100644 --- a/src/Battling/ScriptHandling/Script.hpp +++ b/src/Battling/ScriptHandling/Script.hpp @@ -29,6 +29,9 @@ namespace CreatureLib::Battling{ virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){}; virtual void PreventAttack(ExecutingAttack* attack,bool& result){}; + virtual void FailAttack(ExecutingAttack* attack, bool& failed){}; + virtual void StopBeforeAttack(ExecutingAttack* attack){}; + virtual void OnBeforeAttack(ExecutingAttack* attack){}; virtual void FailIncomingAttack(ExecutingAttack* attack, Creature* target, bool& result){}; virtual void IsInvulnerable(ExecutingAttack* attack, Creature* target , bool& result){};