diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 42 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.h | 5 |
5 files changed, 43 insertions, 12 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 88a7d8508c3..5a6cd08e449 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6183,7 +6183,7 @@ void Spell::CalculateDamageDoneForAllTargets() if (target.missCondition==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target { - target.damage += CalculateDamageDone(unit, mask, multiplier); + target.damage += CalculateDamageDone(unit, mask, multiplier); target.crit = m_caster->isSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType); } else if (target.missCondition == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index f38bd455896..f1b2f5f12f4 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -331,7 +331,7 @@ enum AuraType SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells SPELL_AURA_LINKED = 284, SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285, - SPELL_AURA_286, + SPELL_AURA_ABILITY_PERIODIC_CRIT = 286, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_288, SPELL_AURA_289, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9263747ce7c..ac23d3dc9e7 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -339,7 +339,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus &Aura::HandleUnused, //284 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, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in AuraEffect::PeriodicTick &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. &Aura::HandleUnused, //289 unused @@ -6093,6 +6093,21 @@ 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; + } + //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 if (m_target->GetTypeId()==TYPEID_PLAYER) @@ -6105,7 +6120,7 @@ void AuraEffect::PeriodicTick() pCaster->DealDamageMods(m_target,pdamage,&absorb); - SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f, crit); m_target->SendPeriodicAuraLog(&pInfo); Unit* target = m_target; // aura can be deleted in DealDamage @@ -6251,12 +6266,27 @@ void AuraEffect::PeriodicTick() else 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; + } + 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()); int32 gain = m_target->ModifyHealth(pdamage); - SpellPeriodicAuraLogInfo pInfo(this, pdamage, pdamage - gain, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, pdamage - gain, 0, 0, 0.0f, crit); m_target->SendPeriodicAuraLog(&pInfo); // add HoTs to amount healed in bgs @@ -6371,7 +6401,7 @@ void AuraEffect::PeriodicTick() modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier); } - SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier); + SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier, false); m_target->SendPeriodicAuraLog(&pInfo); int32 gain_amount = int32(drain_amount*gain_multiplier); @@ -6440,7 +6470,7 @@ void AuraEffect::PeriodicTick() sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); - SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); m_target->SendPeriodicAuraLog(&pInfo); int32 gain = m_target->ModifyPower(power,amount); @@ -6465,7 +6495,7 @@ void AuraEffect::PeriodicTick() uint32 amount = m_amount; - SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); m_target->SendPeriodicAuraLog(&pInfo); sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 29b7b09a12b..5f126728c40 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4687,13 +4687,13 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo) data << uint32(GetSpellSchoolMask(aura->GetSpellProto())); data << uint32(pInfo->absorb); // absorb data << uint32(pInfo->resist); // resist - data << uint8(0); // new 3.1.2 + data << uint8(pInfo->critical); // new 3.1.2 critical tick break; case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_OBS_MOD_HEALTH: data << uint32(pInfo->damage); // damage data << uint32(pInfo->overDamage); // overheal? - data << uint8(0); // new 3.1.2 + data << uint8(pInfo->critical); // new 3.1.2 critical tick break; case SPELL_AURA_OBS_MOD_ENERGY: case SPELL_AURA_PERIODIC_ENERGIZE: diff --git a/src/game/Unit.h b/src/game/Unit.h index ceb6859386b..d55b272e96f 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -823,8 +823,8 @@ struct SpellNonMeleeDamage{ struct SpellPeriodicAuraLogInfo { - SpellPeriodicAuraLogInfo(AuraEffect *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier) - : auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier) {} + SpellPeriodicAuraLogInfo(AuraEffect *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical) + : auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier), critical(_critical){} AuraEffect *auraEff; uint32 damage; @@ -832,6 +832,7 @@ struct SpellPeriodicAuraLogInfo uint32 resist; uint32 overDamage; // overkill/overheal float multiplier; + bool critical; }; uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition); |