aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp29
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp1
2 files changed, 21 insertions, 9 deletions
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 397a4b993db..6ca1045f63a 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -164,7 +164,10 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);
if (HasAuraType(SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT))
+ {
UpdateAttackPowerAndDamage();
+ UpdateAttackPowerAndDamage(true);
+ }
}
void Player::UpdateSpellDamageAndHealingBonus()
@@ -178,7 +181,10 @@ void Player::UpdateSpellDamageAndHealingBonus()
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
if (HasAuraType(SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT))
+ {
UpdateAttackPowerAndDamage();
+ UpdateAttackPowerAndDamage(true);
+ }
}
bool Player::UpdateAllStats()
@@ -314,19 +320,24 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
index = UNIT_FIELD_RANGED_ATTACK_POWER;
index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MOD_POS;
index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER;
- val2 = (level + std::max(GetStat(STAT_AGILITY), 0.0f)) * entry->RangedAttackPowerPerAgility;
}
- else if (!HasAuraType(SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT))
+
+ if (!HasAuraType(SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT))
{
- float strengthValue = std::max(GetStat(STAT_STRENGTH) * entry->AttackPowerPerStrength, 0.0f);
- float agilityValue = std::max(GetStat(STAT_AGILITY) * entry->AttackPowerPerAgility, 0.0f);
+ if (!ranged)
+ {
+ float strengthValue = std::max(GetStat(STAT_STRENGTH) * entry->AttackPowerPerStrength, 0.0f);
+ float agilityValue = std::max(GetStat(STAT_AGILITY) * entry->AttackPowerPerAgility, 0.0f);
- SpellShapeshiftFormEntry const* form = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm());
- // Directly taken from client, SHAPESHIFT_FLAG_AP_FROM_STRENGTH ?
- if (form && form->Flags & 0x20)
- agilityValue += std::max(GetStat(STAT_AGILITY) * entry->AttackPowerPerStrength, 0.0f);
+ SpellShapeshiftFormEntry const* form = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm());
+ // Directly taken from client, SHAPESHIFT_FLAG_AP_FROM_STRENGTH ?
+ if (form && form->Flags & 0x20)
+ agilityValue += std::max(GetStat(STAT_AGILITY) * entry->AttackPowerPerStrength, 0.0f);
- val2 = strengthValue + agilityValue;
+ val2 = strengthValue + agilityValue;
+ }
+ else
+ val2 = (level + std::max(GetStat(STAT_AGILITY), 0.0f)) * entry->RangedAttackPowerPerAgility;
}
else
{
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 350ba8af206..4ae91981448 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3996,6 +3996,7 @@ void AuraEffect::HandleOverrideAttackPowerBySpellPower(AuraApplication const* au
target->ApplyModSignedFloatValue(PLAYER_FIELD_OVERRIDE_AP_BY_SPELL_POWER_PERCENT, float(m_amount), apply);
target->UpdateAttackPowerAndDamage();
+ target->UpdateAttackPowerAndDamage(true);
}
/********************************/