*Allow SPELL_AURA_ABILITY_PERIODIC_CRIT to make PERIODIC_LEECH auras crit.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-08-28 19:46:09 +02:00
parent ab5f515f21
commit 4d8808879d
4 changed files with 28 additions and 33 deletions
+20 -27
View File
@@ -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;
bool crit = IsPeriodicTickCrit(pCaster);
if (crit)
pdamage = pCaster->SpellCriticalDamageBonus(m_spellProto, pdamage, m_target);
}
break;
}
//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;
bool crit = IsPeriodicTickCrit(pCaster);
if (crit)
pdamage = pCaster->SpellCriticalHealingBonus(m_spellProto, pdamage, m_target);
}
break;
}
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;
}
+2
View File
@@ -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
+2 -2
View File
@@ -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))
+2 -2
View File
@@ -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);