aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp20
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp20
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h2
-rw-r--r--src/server/game/Spells/SpellInfo.cpp1
-rw-r--r--src/server/game/Spells/SpellMgr.cpp5
5 files changed, 29 insertions, 19 deletions
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index cf61198ddd9..c1d0e5b31a0 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -209,7 +209,7 @@ bool Player::UpdateAllStats()
}
UpdateArmor();
- // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
+ UpdateAttackPowerAndDamage(false);
UpdateAttackPowerAndDamage(true);
UpdateMaxHealth();
@@ -276,8 +276,6 @@ void Player::UpdateArmor()
Pet* pet = GetPet();
if (pet)
pet->UpdateArmor();
-
- UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
float Player::GetHealthBonusFromStamina()
@@ -461,22 +459,20 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
if ((getClassMask() & CLASSMASK_WAND_USERS) == 0)
{
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
- for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
- attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
+ for (AuraEffect const* aurEff : mRAPbyStat)
+ attPowerMod += CalculatePct(GetStat(Stats(aurEff->GetMiscValue())), aurEff->GetAmount());
}
}
else
{
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
- for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
- attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
-
- AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
- for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
- // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
- attPowerMod += int32(GetArmor() / (*iter)->GetAmount());
+ for (AuraEffect const* aurEff : mAPbyStat)
+ attPowerMod += CalculatePct(GetStat(Stats(aurEff->GetMiscValue())), aurEff->GetAmount());
}
+ // applies to both, amount updated in PeriodicTick each 30 seconds
+ attPowerMod += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
+
float attPowerMultiplier = GetPctModifierValue(unitMod, TOTAL_PCT) - 1.0f;
SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 84f7ace72e1..9e76cdfb5ac 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -344,7 +344,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_MOD_BASE_HEALTH_PCT
&AuraEffect::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
&AuraEffect::HandleAuraLinked, //284 SPELL_AURA_LINKED
- &AuraEffect::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage
+ &AuraEffect::HandleNoImmediateEffect, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in AuraEffect::PeriodicTick and Player::UpdateAttackPowerAndDamage
&AuraEffect::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in AuraEffect::PeriodicTick
&AuraEffect::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //288 SPELL_AURA_IGNORE_HIT_DIRECTION implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult Unit::RollMeleeOutcomeAgainst
@@ -543,6 +543,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru
case SPELL_AURA_POWER_BURN:
case SPELL_AURA_PERIODIC_DUMMY:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
+ case SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR:
m_isPeriodic = true;
break;
default:
@@ -874,6 +875,9 @@ void AuraEffect::PeriodicTick(AuraApplication* aurApp, Unit* caster) const
case SPELL_AURA_POWER_BURN:
HandlePeriodicPowerBurnAuraTick(target, caster);
break;
+ case SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR:
+ HandleModAttackPowerOfArmorAuraTick(target, caster);
+ break;
default:
break;
}
@@ -4086,11 +4090,6 @@ void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication con
void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
- HandleAuraModAttackPowerOfArmor(aurApp, mode, apply);
-}
-
-void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
-{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
@@ -5640,6 +5639,15 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con
caster->ProcSkillsAndAuras(target, procAttacker, procVictim, spellTypeMask, PROC_SPELL_PHASE_NONE, hitMask, nullptr, &dotDamageInfo, nullptr);
}
+void AuraEffect::HandleModAttackPowerOfArmorAuraTick(Unit* target, Unit* caster) const
+{
+ int32 const armorMod = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, target);
+ const_cast<AuraEffect*>(this)->SetAmount(target->GetArmor() / armorMod);
+
+ target->UpdateAttackPowerAndDamage(false);
+ target->UpdateAttackPowerAndDamage(true);
+}
+
void AuraEffect::HandleBreakableCCAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
{
int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index b79cbdfc66f..f01f0d9d32d 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -270,7 +270,6 @@ class TC_GAME_API AuraEffect
void HandleAuraModRangedAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraModAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
- void HandleAuraModAttackPowerOfArmor(AuraApplication const* aurApp, uint8 mode, bool apply) const;
// damage bonus
void HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool apply) const;
@@ -310,6 +309,7 @@ class TC_GAME_API AuraEffect
void HandleObsModPowerAuraTick(Unit* target, Unit* caster) const;
void HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const;
void HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) const;
+ void HandleModAttackPowerOfArmorAuraTick(Unit* target, Unit* caster) const;
// aura effect proc handlers
void HandleBreakableCCAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 1f4cc10b4fd..527eab26d5b 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -3123,6 +3123,7 @@ uint32 SpellInfo::GetMaxTicks() const
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
+ case SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR:
// skip infinite periodics
if (Effects[x].Amplitude > 0 && DotDuration > 0)
{
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 6be03a6b714..4dafa614139 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -4618,6 +4618,11 @@ void SpellMgr::LoadSpellInfoCorrections()
if (!spellInfo->Speed && !spellInfo->SpellFamilyName)
spellInfo->Speed = SPEED_CHARGE;
break;
+ case SPELL_EFFECT_APPLY_AURA:
+ // special aura updates each 30 seconds
+ if (spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR)
+ spellInfo->Effects[j].Amplitude = 30 * IN_MILLISECONDS;
+ break;
}
// Passive talent auras cannot target pets