Adds script hook to modify number of hits
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
374a4d10a8
commit
a3b7002cd4
|
@ -96,8 +96,14 @@ void TurnHandler::ExecuteAttackChoice(const ArbUt::BorrowedPtr<AttackTurnChoice>
|
|||
try_creature(targets = TargetResolver::ResolveTargets(choice->GetTarget(), targetType, battle.GetValue());
|
||||
, "Exception during target determination");
|
||||
|
||||
u8 numberHits = 1;
|
||||
HOOK(ModifyNumberOfHits, choice, choice, &numberHits);
|
||||
if (numberHits == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto attackScoped = ArbUt::ScopedPtr<ExecutingAttack>(
|
||||
new ExecutingAttack(targets, 1, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript()));
|
||||
new ExecutingAttack(targets, numberHits, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript()));
|
||||
bool prevented = false;
|
||||
HOOK(PreventAttack, attackScoped, attackScoped, &prevented);
|
||||
if (prevented) {
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace CreatureLib::Battling {
|
|||
virtual void ChangePriority([[maybe_unused]] AttackTurnChoice* choice, [[maybe_unused]] int8_t* priority){};
|
||||
virtual void ChangeAttack([[maybe_unused]] AttackTurnChoice* choice,
|
||||
[[maybe_unused]] ArbUt::StringView* outAttack){};
|
||||
virtual void ModifyNumberOfHits([[maybe_unused]] AttackTurnChoice* choice, [[maybe_unused]] u8* numberOfHits){};
|
||||
virtual void PreventAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
|
||||
virtual void FailAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outFailed){};
|
||||
virtual void StopBeforeAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
|
||||
|
|
Loading…
Reference in New Issue