diff options
author | megamage <none@none> | 2009-06-16 11:02:37 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-16 11:02:37 -0500 |
commit | aaec3c819167afb3f40410142654ed4d57926b10 (patch) | |
tree | 1fcae9dc92c55d005f78a4876b9bdd60975f74ae /src | |
parent | 0916d5f189e6fd2abc6a00fc8c26b1a5d8ca9b21 (diff) |
[8024] Implement SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR(285). Author: Beaste
Also drop outdated support code for 61216 and ranks.
This implement work talents 61216 and 48978 with ranks.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 39 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/StatSystem.cpp | 11 |
4 files changed, 28 insertions, 25 deletions
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index a14aaebe57f..f38bd455896 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -330,7 +330,7 @@ enum AuraType SPELL_AURA_MOD_BASE_HEALTH_PCT = 282, SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells SPELL_AURA_LINKED = 284, - SPELL_AURA_MOD_AP_FROM_STAT, + SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285, SPELL_AURA_286, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_288, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 14054b67a66..75278467a31 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -338,7 +338,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus &Aura::HandleUnused, //284 not used by any spells (3.08a) - &Aura::HandleUnused, //285 not used by any spells (3.08a) + &Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage &Aura::HandleUnused, //286 not used by any spells (3.08a) &Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult &Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell. @@ -5393,6 +5393,16 @@ void AuraEffect::HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bo ((Player*)m_target)->UpdateAttackPowerAndDamage(false); } +void AuraEffect::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real, bool /*changeAmount*/) +{ + // spells required only Real aura add/remove + if(!Real) + return; + + // Recalculate bonus + if(m_target->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_target)->UpdateAttackPowerAndDamage(false); +} /********************************/ /*** DAMAGE BONUS ***/ /********************************/ @@ -6753,34 +6763,19 @@ void AuraEffect::PeriodicDummyTick() // return; break; } - case SPELLFAMILY_WARRIOR: - { - // Armored to the Teeth - if (spell->SpellIconID == 3516) - { - // Increases your attack power by $s1 for every $s2 armor value you have. - // Calculate AP bonus (from 1 efect of this spell) - int32 apBonus = m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target); - m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this); - return; - } - break; - } case SPELLFAMILY_WARLOCK: + { switch (spell->Id) { // Demonic Circle case 48018: - GameObject* obj = m_target->GetGameObject(spell->Id); - if (!obj) return; - // We must take a range of teleport spell, not summon. - const SpellEntry* goToCircleSpell = sSpellStore.LookupEntry(48020); - if (m_target->IsWithinDist(obj,GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(goToCircleSpell->rangeIndex)))) - m_target->SendAuraVisualForSelf(true,62388, 1); - else - m_target->SendAuraVisualForSelf(false,62388); + if(GameObject* obj = m_target->GetGameObject(spell->Id)) + // We must take a range of teleport spell, not summon. + m_target->SendAuraVisualForSelf(m_target->IsWithinDist(obj, GetSpellMaxRange(48020, true)), 62388, 1); + return; } break; + } case SPELLFAMILY_DRUID: { switch (spell->Id) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 38771c557c2..987c8b0db25 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -303,6 +303,7 @@ class TRINITY_DLL_SPEC AuraEffect void HandleAuraModAttackPowerPercent(bool apply, bool Real, bool changeAmount); void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real, bool changeAmount); void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount); + void HandleAuraModAttackPowerOfArmor(bool apply, bool Real, bool changeAmount); void HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount); void HandleSpiritOfRedemption(bool apply, bool Real, bool changeAmount); void HandleModManaRegen(bool apply, bool Real, bool changeAmount); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 896a6e98a4a..7a0b6f285eb 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -144,9 +144,9 @@ bool Player::UpdateAllStats() SetStat(Stats(i), (int32)value); } - UpdateAttackPowerAndDamage(); - UpdateAttackPowerAndDamage(true); UpdateArmor(); + // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR + UpdateAttackPowerAndDamage(true); UpdateMaxHealth(); for(int i = POWER_MANA; i < MAX_POWERS; ++i) @@ -207,6 +207,8 @@ 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() @@ -372,6 +374,11 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) AuraEffectList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT); for(AuraEffectList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i) attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f); + + AuraEffectList const& mAPbyArmor = GetAurasByType(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)->GetMiscValue()); } float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f; |