diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index d195aa9792..0b81cf7fc7 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -401,7 +401,7 @@ enum AuraType SPELL_AURA_363 = 363, SPELL_AURA_364 = 364, SPELL_AURA_365 = 365, - SPELL_AURA_MOD_SPELL_POWER_OF_ATTACK_POWER = 366, + SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT = 366, SPELL_AURA_367 = 367, SPELL_AURA_368 = 368, SPELL_AURA_369 = 369, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 7d8d8c86de..09d1ec85aa 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -370,7 +370,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS] = &Aura::HandleNULL, //314 SPELL_AURA_PREVENT_RESURRECTION 2 spells int 4.3.4 prevents ressurection ? &Aura::HandleNULL, //315 SPELL_AURA_UNDERWATER_WALKING 4 spells in 4.3.4 underwater walking &Aura::HandleUnused, //316 0 spells in 4.3.4 - &Aura::HandleNULL, //317 SPELL_AURA_MOD_INCREASE_SPELL_POWER_PCT 13 spells in 4.3.4 + &Aura::HandleModIncreaseSpellPowerPct, //317 SPELL_AURA_MOD_INCREASE_SPELL_POWER_PCT 13 spells in 4.3.4, implemented in Unit::SpellBaseDamageBonusDone and Unit::SpellBaseHealingBonusDone &Aura::HandleAuraMastery, //318 SPELL_AURA_MASTERY 12 spells in 4.3 &Aura::HandleNULL, //319 SPELL_AURA_MOD_MELEE_ATTACK_SPEED 47 spells in 4.3.4 &Aura::HandleNULL, //320 SPELL_AURA_MOD_RANGED_ATTACK_SPEED 5 spells in 4.3.4 @@ -419,7 +419,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS] = &Aura::HandleNULL, //363 1 spells in 4.3.4 Throw Totem &Aura::HandleUnused, //364 0 spells in 4.3.4 &Aura::HandleNULL, //365 1 spells in 4.3.4 Max Far Clip Plane - &Aura::HandleNULL, //366 SPELL_AURA_MOD_SPELL_POWER_OF_ATTACK_POWER 1 spells in 4.3.4 + &Aura::HandleOverrideSpellPowerByAp, //366 SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT 1 spells in 4.3.4 &Aura::HandleNULL, //367 2 spells in 4.3.4 test spells &Aura::HandleUnused, //368 0 spells in 4.3.4 &Aura::HandleNULL, //369 5 spells in 4.3.4 darkmoon faire related @@ -10308,3 +10308,19 @@ void SpellAuraHolder::UnregisterAndCleanupTrackedAuras() m_trackedAuraType = TRACK_AURA_TYPE_NOT_TRACKED; } + +void Aura::HandleModIncreaseSpellPowerPct(bool apply, bool Real) +{ + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) + return; + + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); +} + +void Aura::HandleOverrideSpellPowerByAp(bool apply, bool Real) +{ + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) + return; + + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); +} diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index ff6b08e605..e9b213b4e5 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -375,6 +375,8 @@ class MANGOS_DLL_SPEC Aura void HandleAuraSetVehicleId(bool apply, bool Real); void HandleAuraMastery(bool apply, bool Real); void HandleAuraModBlockCritChance(bool apply, bool Real); + void HandleModIncreaseSpellPowerPct(bool apply, bool Real); + void HandleOverrideSpellPowerByAp(bool apply, bool Real); virtual ~Aura(); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index a67377071b..40adcc106b 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -111,6 +111,8 @@ void Player::UpdateSpellDamageAndHealingBonus() // Get damage bonus for all schools for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i))); + + SetStatFloatValue(PLAYER_FIELD_OVERRIDE_SPELL_POWER_BY_AP_PCT, GetTotalAuraModifier(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT)); } bool Player::UpdateAllStats() diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2b315fbce0..ce50f53d9d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7045,6 +7045,16 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) { int32 DoneAdvertisedBenefit = 0; + Unit::AuraList const& mOverrideSpellPowerAuras = GetAurasByType(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT); + if (!mOverrideSpellPowerAuras.empty()) + { + for (Unit::AuraList::const_iterator itr = mOverrideSpellPowerAuras.begin(); itr != mOverrideSpellPowerAuras.end(); ++itr) + if (schoolMask & (*itr)->GetModifier()->m_miscvalue) + DoneAdvertisedBenefit += (*itr)->GetModifier()->m_amount; + + return int32(GetTotalAttackPowerValue(BASE_ATTACK) * (100.0f + DoneAdvertisedBenefit) / 100.0f); + } + // ..done AuraList const& mDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE); for (AuraList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i) @@ -7083,6 +7093,15 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); } } + + // pct spell power modifier + Unit::AuraList const& mSpellPowerPctAuras = GetAurasByType(SPELL_AURA_MOD_INCREASE_SPELL_POWER_PCT); + for (Unit::AuraList::const_iterator itr = mSpellPowerPctAuras.begin(); itr != mSpellPowerPctAuras.end(); ++itr) + { + if (!(*itr)->GetModifier()->m_miscvalue || (*itr)->GetModifier()->m_miscvalue & schoolMask) + DoneAdvertisedBenefit = int32(DoneAdvertisedBenefit * (100.0f + (*itr)->GetModifier()->m_amount) / 100.0f); + } + return DoneAdvertisedBenefit; } @@ -7531,6 +7550,16 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) { int32 AdvertisedBenefit = 0; + Unit::AuraList const& mOverrideSpellPowerAuras = GetAurasByType(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT); + if (!mOverrideSpellPowerAuras.empty()) + { + for (Unit::AuraList::const_iterator itr = mOverrideSpellPowerAuras.begin(); itr != mOverrideSpellPowerAuras.end(); ++itr) + if (schoolMask & (*itr)->GetModifier()->m_miscvalue) + AdvertisedBenefit += (*itr)->GetModifier()->m_amount; + + return int32(GetTotalAttackPowerValue(BASE_ATTACK) * (100.0f + AdvertisedBenefit) / 100.0f); + } + AuraList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE); for (AuraList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i) if (!(*i)->GetModifier()->m_miscvalue || ((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) @@ -7560,6 +7589,15 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) if ((*i)->GetModifier()->m_miscvalue & schoolMask) AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); } + + // pct spell power modifier + Unit::AuraList const& mSpellPowerPctAuras = GetAurasByType(SPELL_AURA_MOD_INCREASE_SPELL_POWER_PCT); + for (Unit::AuraList::const_iterator itr = mSpellPowerPctAuras.begin(); itr != mSpellPowerPctAuras.end(); ++itr) + { + if (!(*itr)->GetModifier()->m_miscvalue || (*itr)->GetModifier()->m_miscvalue & schoolMask) + AdvertisedBenefit = int32(AdvertisedBenefit * (100.0f + (*itr)->GetModifier()->m_amount) / 100.0f); + } + return AdvertisedBenefit; } diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index a311339895..63f31f6356 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -398,7 +398,7 @@ pAuraProcHandler AuraProcHandler[TOTAL_AURAS] = &Unit::HandleNULLProc, //363 1 spells in 4.3.4 Throw Totem &Unit::HandleNULLProc, //364 0 spells in 4.3.4 &Unit::HandleNULLProc, //365 1 spells in 4.3.4 Max Far Clip Plane - &Unit::HandleNULLProc, //366 SPELL_AURA_MOD_SPELL_POWER_OF_ATTACK_POWER 1 spells in 4.3.4 + &Unit::HandleNULLProc, //366 SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT 1 spells in 4.3.4 &Unit::HandleNULLProc, //367 2 spells in 4.3.4 test spells &Unit::HandleNULLProc, //368 0 spells in 4.3.4 &Unit::HandleNULLProc, //369 5 spells in 4.3.4 darkmoon faire related diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 304f20bab5..57fccd3334 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12512" + #define REVISION_NR "12513" #endif // __REVISION_NR_H__