Initial setup for script hooks (likely to be revamped)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-11-08 18:45:43 +01:00
parent 19e1308f93
commit c3bfbb569e
5 changed files with 88 additions and 0 deletions

View File

@@ -78,12 +78,15 @@ void TurnHandler::ExecuteAttackChoice(const AttackTurnChoice *choice) {
void TurnHandler::HandleAttackForTarget(ExecutingAttack &attack, Creature *target, ExecutingAttack::TargetData &targetData) {
//HOOK: Check if attack fails on target
target->ExecuteScripts(Hook::IncomingAttackFails, {std::any(attack), std::any(target)});
//HOOK: Check if target is invulnerable
target->ExecuteScripts(Hook::IsInvulnerable, {std::any(attack), std::any(target)});
if (!targetData.IsHit()){
//HOOK: On attack miss.
target->ExecuteScripts(Hook::AttackMiss, {std::any(attack), std::any(target)});
return;
}