Support overriding attacks through script hooks.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2021-05-13 13:16:52 +02:00
parent 188e88ab80
commit 13153b3119
4 changed files with 21 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ uint8_t DamageLibrary::GetBasePower(ExecutingAttack* attack, Creature* target, u
[[maybe_unused]] const ExecutingAttack::HitData& hitData) const {
EnsureNotNull(attack)
EnsureNotNull(target)
auto bp = attack->GetAttack()->GetAttack()->GetBasePower();
auto bp = attack->GetUseAttack()->GetBasePower();
HOOK(OverrideBasePower, attack, attack, target, hitIndex, &bp);
return bp;
}
@@ -34,7 +34,7 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
HOOK(ChangeDamageStatsUser, attack, attack, target, hitIndex, &user);
Library::Statistic offensiveStat;
Library::Statistic defensiveStat;
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
if (attack->GetUseAttack()->GetCategory() == Library::AttackCategory::Physical) {
offensiveStat = Library::Statistic::PhysicalAttack;
defensiveStat = Library::Statistic::PhysicalDefense;
} else {