Adds more script hooks

This commit is contained in:
Deukhoofd 2019-11-24 10:34:42 +01:00
parent f6415fba27
commit 583bde3768
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 11 additions and 3 deletions

View File

@ -77,10 +77,15 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice *choice) {
} }
//HOOK: check if attack fails //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(StopBeforeAttack, attack, attack);
HOOK(OnBeforeAttack, attack, attack);
//HOOK: On Before Attack
for (auto& kv: attack->GetTargets()){ for (auto& kv: attack->GetTargets()){
HandleAttackForTarget(attack, kv.first, kv.second); HandleAttackForTarget(attack, kv.first, kv.second);

View File

@ -29,6 +29,9 @@ namespace CreatureLib::Battling{
virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){}; virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){};
virtual void PreventAttack(ExecutingAttack* attack,bool& result){}; 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 FailIncomingAttack(ExecutingAttack* attack, Creature* target, bool& result){};
virtual void IsInvulnerable(ExecutingAttack* attack, Creature* target , bool& result){}; virtual void IsInvulnerable(ExecutingAttack* attack, Creature* target , bool& result){};