diff options
author | QAston <none@none> | 2009-06-16 15:29:07 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-06-16 15:29:07 +0200 |
commit | 2e6db5421eb0132fc84d26b6f0c28c76a6b89a67 (patch) | |
tree | c0da76853de39de1e4c8b8c8c0792e04ce4890e9 | |
parent | 56408648456b8b78d0bfed4aec8d74473ab6b62e (diff) |
*Fix aura type 280.
--HG--
branch : trunk
-rw-r--r-- | src/game/Player.cpp | 36 | ||||
-rw-r--r-- | src/game/Player.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 12 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 2 | ||||
-rw-r--r-- | src/game/StatSystem.cpp | 30 | ||||
-rw-r--r-- | src/game/Unit.cpp | 33 | ||||
-rw-r--r-- | src/game/Unit.h | 1 |
9 files changed, 81 insertions, 38 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index af7057518fb..9c37f9a6bee 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -4999,6 +4999,8 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) } break; case CR_ARMOR_PENETRATION: + if(affectStats) + UpdateArmorPenetration(amount); break; } } @@ -10625,10 +10627,22 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) ApplyEquipCooldown(pItem); + // update expertise and armor penetration - passive auras may need it + if( slot == EQUIPMENT_SLOT_MAINHAND ) UpdateExpertise(BASE_ATTACK); else if( slot == EQUIPMENT_SLOT_OFFHAND ) UpdateExpertise(OFF_ATTACK); + + switch(slot) + { + case EQUIPMENT_SLOT_MAINHAND: + case EQUIPMENT_SLOT_OFFHAND: + case EQUIPMENT_SLOT_RANGED: + RecalculateRating(CR_ARMOR_PENETRATION); + default: + break; + } } else { @@ -10771,6 +10785,16 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update ) } else if( slot == EQUIPMENT_SLOT_OFFHAND ) UpdateExpertise(OFF_ATTACK); + // update armor penetration - passive auras may need it + switch(slot) + { + case EQUIPMENT_SLOT_MAINHAND: + case EQUIPMENT_SLOT_OFFHAND: + case EQUIPMENT_SLOT_RANGED: + RecalculateRating(CR_ARMOR_PENETRATION); + default: + break; + } } } // need update known currency @@ -10878,7 +10902,17 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) // remove item dependent auras and casts (only weapon and armor slots) RemoveItemDependentAurasAndCasts(pItem); - // update expertise + // update expertise and armor penetration - passive auras may need it + switch(slot) + { + case EQUIPMENT_SLOT_MAINHAND: + case EQUIPMENT_SLOT_OFFHAND: + case EQUIPMENT_SLOT_RANGED: + RecalculateRating(CR_ARMOR_PENETRATION); + default: + break; + } + if ( slot == EQUIPMENT_SLOT_MAINHAND ) UpdateExpertise(BASE_ATTACK); else if( slot == EQUIPMENT_SLOT_OFFHAND ) diff --git a/src/game/Player.h b/src/game/Player.h index c879222d8d8..b6720abaa39 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1556,6 +1556,7 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateDefenseBonusesMod(); void ApplyRatingMod(CombatRating cr, int32 value, bool apply); + inline void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);} float GetMeleeCritFromAgility(); float GetDodgeFromAgility(); float GetSpellCritFromIntellect(); @@ -1582,6 +1583,7 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateAllSpellCritChances(); void UpdateSpellCritChance(uint32 school); + void UpdateArmorPenetration(int32 amount); void UpdateExpertise(WeaponAttackType attType); void ApplyManaRegenBonus(int32 amount, bool apply); void UpdateManaRegen(); diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 5f784ed8b85..a14aaebe57f 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -325,7 +325,7 @@ enum AuraType SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277, SPELL_AURA_MOD_DISARM_RANGED = 278, SPELL_AURA_279 = 279, - SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE = 280, + SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280, SPELL_AURA_MOD_HONOR_GAIN_PCT = 281, SPELL_AURA_MOD_BASE_HEALTH_PCT = 282, SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 027a648cd80..14054b67a66 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -333,7 +333,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap &Aura::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon &Aura::HandleNULL, //279 visual effects? 58836 and 57507 - &Aura::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE + &Aura::HandleModArmorPenetrationPct, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT &Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus @@ -5728,7 +5728,7 @@ void AuraEffect::HandleForceMoveForward(bool apply, bool Real, bool /*changeAmou m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); } -void AuraEffect::HandleAuraModExpertise(bool /*apply*/, bool Real, bool /*changeAmount*/) +void AuraEffect::HandleAuraModExpertise(bool /*apply*/, bool Real, bool changeAmount) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -7272,6 +7272,14 @@ void AuraEffect::HandleAuraSafeFall( bool Apply, bool Real , bool /*changeAmount ((Player*)m_target)->ActivateTaxiPathTo(506,GetId()); } +void AuraEffect::HandleModArmorPenetrationPct(bool apply, bool Real, bool changeAmount) +{ + if(m_target->GetTypeId() != TYPEID_PLAYER) + return; + + ((Player*)m_target)->RecalculateRating(CR_ARMOR_PENETRATION); +} + void AuraEffect::HandleReflectSpells( bool Apply, bool Real , bool /*changeAmount*/) { // implemented in Unit::SpellHitResult diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 36f576b89fe..38771c557c2 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -332,6 +332,7 @@ class TRINITY_DLL_SPEC AuraEffect void HandleAuraAllowOnlyAbility(bool apply, bool Real, bool changeAmount); void HandleCharmConvert(bool apply, bool Real, bool changeAmount); void HandleReflectSpells( bool Apply, bool Real , bool changeAmount); + void HandleModArmorPenetrationPct(bool Apply, bool Real, bool changeAmount); // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras void HandleShapeshiftBoosts(bool apply); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 674fe0e2ba6..610ebba2b71 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4332,7 +4332,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) if (roll_chance_i(aurEff->GetAmount())) consumeDiseases = false; } - totalDamagePercentMod *= (float(CalculateDamage(2, unitTarget) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2) + 100.0f) / 100.f; + totalDamagePercentMod *= (float(CalculateDamage(2, unitTarget) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2) + 100.0f) / 100.0f; } // Blood-Caked Strike - Blood-Caked Blade // Blood Strike else if (m_spellInfo->SpellIconID == 1736 || m_spellInfo->SpellFamilyFlags[0] & 0x400000) diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index b3f1ae585fc..896a6e98a4a 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -160,6 +160,7 @@ bool Player::UpdateAllStats() UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); UpdateExpertise(OFF_ATTACK); + RecalculateRating(CR_ARMOR_PENETRATION); for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); @@ -618,6 +619,35 @@ void Player::UpdateSpellCritChance(uint32 school) SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit); } +void Player::UpdateArmorPenetration(int32 amount) +{ + AuraEffectList const& expAuras = GetAurasByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for(AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr) + { + // item neutral spell + if((*itr)->GetSpellProto()->EquippedItemClass == -1) + { + amount *= ((*itr)->GetAmount() + 100.0f) / 100.0f; + continue; + } + + // item dependent spell - check curent weapons + for(int i = 0; i < MAX_ATTACK; ++i) + { + Item *weapon = GetWeaponForAttack(WeaponAttackType(i)); + + if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + { + amount *= ((*itr)->GetAmount() + 100.0f) / 100.0f; + break; + } + } + } + + // Store Rating Value + SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_ARMOR_PENETRATION, amount); +} + void Player::UpdateMeleeHitChances() { m_modMeleeHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 4c93c6652eb..a2f3a6ac79d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1373,37 +1373,6 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama damageInfo->damage = damage; } -int32 Unit::GetIgnoredArmorMultiplier(SpellEntry const *spellInfo, WeaponAttackType attackType) -{ - if (GetTypeId() != TYPEID_PLAYER) - return 0; - //check if spell uses weapon - if (!spellInfo || spellInfo->EquippedItemClass!=ITEM_CLASS_WEAPON) - return 0; - Item *item = NULL; - if(attackType == BASE_ATTACK) - item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - else if (attackType == OFF_ATTACK) - item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - else if (attackType == RANGED_ATTACK) - item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED); - if (!item) - return 0; - - AuraEffectList const& armAuras = GetAurasByType(SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE); - int32 armorIgnored = 0; - for(AuraEffectList::const_iterator i = armAuras.begin();i != armAuras.end(); ++i) - { - if (!((*i)->GetSpellProto()->EquippedItemClass==item->GetProto()->Class - && (*i)->GetSpellProto()->EquippedItemSubClassMask & (1<<item->GetProto()->SubClass))) - continue; - - if((*i)->GetAmount()) - armorIgnored += (*i)->GetAmount(); - } - return (-armorIgnored); -} - void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) { if (damageInfo==0) @@ -1831,7 +1800,6 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura armor += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL); - armor *= float((GetIgnoredArmorMultiplier(spellInfo, attackType)+100.0f)/100.0f); if(spellInfo) if(Player *modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor); @@ -7693,6 +7661,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Can proc only if target has hp below 35% if(!pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this)) return false; + break; } // Custom basepoints/target for exist spell diff --git a/src/game/Unit.h b/src/game/Unit.h index fc27db35c42..ffc4c91f7a8 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1195,7 +1195,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss); void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false); - int32 GetIgnoredArmorMultiplier(SpellEntry const *spellInfo, WeaponAttackType attackType); void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss); float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; |