Pass ExecutingAttack values by reference instead of pointer.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -7,8 +7,8 @@ uint32_t DamageLibrary::GetDamage(ExecutingAttack* attack, Creature* target, uin
|
||||
AssertNotNull(attack)
|
||||
AssertNotNull(target)
|
||||
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel()) / 5 + 2;
|
||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
||||
auto bp = hit->GetBasePower();
|
||||
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||
auto bp = hit.GetBasePower();
|
||||
auto statMod = GetStatModifier(attack, target, hitIndex);
|
||||
HOOK(ModifyStatModifier, attack, attack, target, hitIndex, &statMod);
|
||||
uint32_t damage = static_cast<uint32_t>((((levelMod * static_cast<float>(bp) * statMod) / 50) + 2) *
|
||||
@@ -31,7 +31,7 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||
auto user = attack->GetUser();
|
||||
AssertNotNull(user)
|
||||
HOOK(ChangeDamageStatsUser, attack, attack, target, hitIndex, &user);
|
||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
||||
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||
Library::Statistic offensiveStat;
|
||||
Library::Statistic defensiveStat;
|
||||
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
|
||||
@@ -42,9 +42,9 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||
defensiveStat = Library::Statistic::MagicalDefense;
|
||||
}
|
||||
|
||||
auto bypassDefensive = hit->IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||
auto bypassDefensive = hit.IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||
HOOK(BypassDefensiveStat, attack, attack, target, hitIndex, &bypassDefensive);
|
||||
auto bypassOffensive = hit->IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
||||
auto bypassOffensive = hit.IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
||||
HOOK(BypassOffensiveStat, attack, attack, target, hitIndex, &bypassOffensive);
|
||||
|
||||
float offensiveValue;
|
||||
@@ -68,9 +68,8 @@ float DamageLibrary::GetDamageModifier(ExecutingAttack* attack, Creature* target
|
||||
AssertNotNull(attack)
|
||||
AssertNotNull(target)
|
||||
float mod = 1;
|
||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
||||
AssertNotNull(hit)
|
||||
mod *= hit->GetEffectiveness();
|
||||
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||
mod *= hit.GetEffectiveness();
|
||||
HOOK(ModifyDamageModifier, attack, attack, target, hitIndex, &mod);
|
||||
return mod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user