diff options
author | QAston <none@none> | 2009-08-28 19:46:09 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-08-28 19:46:09 +0200 |
commit | 4d8808879df730669a050bafe3ad9890131b35a9 (patch) | |
tree | 1009a2ea9bbdf426a06f217a1af371d1c5d5029d /src | |
parent | ab5f515f21d1f9e735e8b2c91a64f2dd02512ed5 (diff) |
*Allow SPELL_AURA_ABILITY_PERIODIC_CRIT to make PERIODIC_LEECH auras crit.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellAuras.cpp | 51 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.h | 4 |
4 files changed, 28 insertions, 33 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1e42a41210f..d698553487b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5775,20 +5775,9 @@ void AuraEffect::PeriodicTick() else pdamage = uint32(m_target->GetMaxHealth()*pdamage/100); - bool crit = false; - Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); - for(Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) - { - if (!(*itr)->isAffectedOnSpell(m_spellProto)) - continue; - - if (pCaster->isSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) - { - crit = true; - pdamage = pCaster->SpellCriticalDamageBonus(m_spellProto, pdamage, m_target); - } - break; - } + bool crit = IsPeriodicTickCrit(pCaster); + if (crit) + pdamage = pCaster->SpellCriticalDamageBonus(m_spellProto, pdamage, m_target); //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players @@ -5845,6 +5834,10 @@ void AuraEffect::PeriodicTick() uint32 pdamage = GetAmount() > 0 ? GetAmount() : 0; pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount()); + bool crit = IsPeriodicTickCrit(pCaster); + if (crit) + pdamage = pCaster->SpellCriticalDamageBonus(m_spellProto, pdamage, m_target); + //Calculate armor mitigation if it is a physical spell if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) { @@ -5866,7 +5859,7 @@ void AuraEffect::PeriodicTick() sLog.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); - pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0); + pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0, crit); Unit* target = m_target; // aura can be deleted in DealDamage SpellEntry const* spellProto = GetSpellProto(); @@ -5955,20 +5948,9 @@ void AuraEffect::PeriodicTick() pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount()); } - bool crit = false; - Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); - for(Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) - { - if (!(*itr)->isAffectedOnSpell(m_spellProto)) - continue; - - if (pCaster->isSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) - { - crit = true; - pdamage = pCaster->SpellCriticalHealingBonus(m_spellProto, pdamage, m_target); - } - break; - } + bool crit = IsPeriodicTickCrit(pCaster); + if (crit) + pdamage = pCaster->SpellCriticalHealingBonus(m_spellProto, pdamage, m_target); sLog.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); @@ -7006,3 +6988,14 @@ int32 AuraEffect::CalculateCrowdControlAuraAmount(Unit * caster) return damageCap; } +int32 AuraEffect::IsPeriodicTickCrit(Unit const * pCaster) const +{ + Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); + for(Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) + { + if ((*itr)->isAffectedOnSpell(m_spellProto) && pCaster->isSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) + return true; + } + return false; +} + diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 4f714066f0b..1c94be8034a 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -402,6 +402,8 @@ class TRINITY_DLL_SPEC AuraEffect bool m_isAreaAura:1; bool m_isPersistent:1; bool m_isApplied:1; + private: + int32 IsPeriodicTickCrit(Unit const * pCaster) const; }; class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d6170c323d9..a828f634ec9 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8478,7 +8478,7 @@ uint32 Unit::BuildAuraStateUpdateForTarget(Unit * target) const return auraStates; } -bool Unit::HasAuraState(AuraState flag, SpellEntry const *spellProto, Unit * Caster) const +bool Unit::HasAuraState(AuraState flag, SpellEntry const *spellProto, Unit const * Caster) const { if (Caster) { @@ -9492,7 +9492,7 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic return TakenAdvertisedBenefit; } -bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) +bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const { // not critting spell if((spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_CRIT)) diff --git a/src/game/Unit.h b/src/game/Unit.h index b1a0c6e4d8c..2242ed6b915 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1704,7 +1704,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject float GetAPMultiplier(WeaponAttackType attType, bool normalized); void ModifyAuraState(AuraState flag, bool apply); uint32 BuildAuraStateUpdateForTarget(Unit * target) const; - bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit * Caster = NULL) const ; + bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit const * Caster = NULL) const ; void UnsummonAllTotems(); Unit* SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo = NULL); int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask); @@ -1715,7 +1715,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject uint32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); - bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK); + bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); |