Fixes for damage calculations always using a base power of 0.
This commit is contained in:
@@ -4,7 +4,7 @@ using namespace CreatureLib::Battling;
|
||||
int DamageLibrary::GetDamage(ExecutingAttack* attack, Creature* target, uint8_t hitIndex) const {
|
||||
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel());
|
||||
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||
auto bp = hit.GetBasePower();
|
||||
auto bp = hit->GetBasePower();
|
||||
auto statMod = GetStatModifier(attack, target, hitIndex);
|
||||
// HOOK: Modify stat modifier
|
||||
int damage = static_cast<int>((((levelMod * static_cast<float>(bp) * statMod) / 50) + 2) *
|
||||
@@ -33,9 +33,9 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||
defensiveStat = Core::Statistic::MagicalDefense;
|
||||
}
|
||||
|
||||
auto bypassDefensive = hit.IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||
auto bypassDefensive = hit->IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||
// HOOK: allow bypassing defensive stat modifiers.
|
||||
auto bypassOffensive = hit.IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
||||
auto bypassOffensive = hit->IsCritical() && user->GetStatBoost(offensiveStat) < 0;
|
||||
// HOOK: Allow bypassing offensive stat modifiers.
|
||||
|
||||
float offensiveValue;
|
||||
@@ -58,7 +58,7 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||
float DamageLibrary::GetDamageModifier(ExecutingAttack* attack, Creature* target, uint8_t hitIndex) const {
|
||||
float mod = 1;
|
||||
auto hit = attack->GetAttackDataForTarget(target).GetHit(hitIndex);
|
||||
mod *= hit.GetEffectiveness();
|
||||
mod *= hit->GetEffectiveness();
|
||||
// HOOK: Modify damage modifier.
|
||||
return mod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user