From c8b4d06b6af7a3d2996b8cb4c0aba0420b694d7e Mon Sep 17 00:00:00 2001 From: Zwisus Date: Fri, 18 Mar 2016 11:51:16 +0800 Subject: [PATCH] Fix Paladin Hammer of Wrath,Judgement of Command,Seal of Command PROC,Seal of Righteousness Dummy Proc receive benefit from Spell Damage and Healing. Prevent Seal of Command damage overflow. Fix Talent improve Seal of Righteousness. Config in DB spell_bonus_data. --- src/game/Object/Unit.cpp | 51 ++++++++++++++++++- src/game/WorldHandlers/SpellEffects.cpp | 27 ++++++---- .../WorldHandlers/UnitAuraProcHandler.cpp | 17 +++++-- 3 files changed, 80 insertions(+), 15 deletions(-) diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index c638932e..29d263cf 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -1332,11 +1332,58 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S { // Melee and Ranged Spells case SPELL_DAMAGE_CLASS_RANGED: + { + // Calculate damage bonus + switch (spellInfo->Id) + { + // Paladin Hammer of Wrath receive benefit from Spell Damage and Healing + case 24274: case 24275: case 24239: + { + damage = SpellDamageBonusDone(pVictim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = pVictim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); + break; + } + default: + { + damage = MeleeDamageBonusDone(pVictim, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); + damage = pVictim->MeleeDamageBonusTaken(this, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); + } + break; + } + + // if crit add critical bonus + if (crit) + { + damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; + damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim); + } + } + break; case SPELL_DAMAGE_CLASS_MELEE: { // Calculate damage bonus - damage = MeleeDamageBonusDone(pVictim, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); - damage = pVictim->MeleeDamageBonusTaken(this, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); + switch (spellInfo->Id) + { + // Paladin + // Judgement of Command receive benefit from Spell Damage and Healing + case 20467: case 20963: case 20964: case 20965: case 20966: + // Seal of Command PROC receive benefit from Spell Damage and Healing + case 20424: + // Seal of Righteousness Dummy Proc receive benefit from Spell Damage and Healing + case 25735: case 25736: case 25737: case 25738: case 25739: case 25740: + case 25713: case 25742: + { + damage = SpellDamageBonusDone(pVictim, spellInfo, damage, SPELL_DIRECT_DAMAGE); + damage = pVictim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); + break; + } + default: + { + damage = MeleeDamageBonusDone(pVictim, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); + damage = pVictim->MeleeDamageBonusTaken(this, damage, attackType, spellInfo, SPELL_DIRECT_DAMAGE); + } + break; + } // if crit add critical bonus if (crit) diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 8a8e0610..7506c7d8 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -3177,16 +3177,6 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) switch (m_spellInfo->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - // Seal of Command - receive benefit from Spell Damage and Healing - if (m_spellInfo->Id == 20424) - { - spell_bonus = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, spell_bonus, SPELL_DIRECT_DAMAGE); - spell_bonus = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, spell_bonus, SPELL_DIRECT_DAMAGE); - } - break; - } case SPELLFAMILY_ROGUE: { // Ambush @@ -3215,6 +3205,23 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: weaponDamagePercentMod *= float(CalculateDamage(SpellEffectIndex(j), unitTarget)) / 100.0f; + //Prevent Seal of Command damage overflow + if (m_spellInfo->Id == 20424) + { + Unit::AuraList const& mModDamagePercentDone = m_caster->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (Unit::AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + { + if (((*i)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_HOLY) && ((*i)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) && + (*i)->GetSpellProto()->EquippedItemClass == -1 && + // -1 == any item class (not wand then) + (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) + // 0 == any inventory type (not wand then) + { + totalDamagePercentMod /= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; + } + } + } + // applied only to prev.effects fixed damage if (customBonusDamagePercentMod) { fixed_bonus = int32(fixed_bonus * bonusDamagePercentMod); } diff --git a/src/game/WorldHandlers/UnitAuraProcHandler.cpp b/src/game/WorldHandlers/UnitAuraProcHandler.cpp index ce6346e8..5afc832b 100644 --- a/src/game/WorldHandlers/UnitAuraProcHandler.cpp +++ b/src/game/WorldHandlers/UnitAuraProcHandler.cpp @@ -724,15 +724,26 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura int damagePoint; + // Talent - Improve Seal of Righteousness + uint32 ModSpellId[] = { 20224, 20225, 20330, 20331, 20332 }; + float ModPct = 1.0f; + AuraList const& mModDamagePercentModifier = GetAurasByType(SPELL_AURA_ADD_PCT_MODIFIER); + for (AuraList::const_iterator i = mModDamagePercentModifier.begin(); i != mModDamagePercentModifier.end(); ++i) + { + for (int j = 0; j < 5; j++) + { + if ((*i)->GetId() == ModSpellId[j]) + ModPct *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; + } + } + triggerAmount = triggerAmount * ModPct; + // In the description, we can find the divider of the base points for min/max effects. int min=triggerAmount/87; int max=triggerAmount/25; damagePoint = (speed<=1.5?min:(speed>=4.0?max:min+(((max-min)/2.5f)*(speed-1.5)))); - damagePoint = SpellDamageBonusDone(pVictim, dummySpell, damagePoint, SPELL_DIRECT_DAMAGE); - damagePoint = pVictim->SpellDamageBonusTaken(this, dummySpell, damagePoint, SPELL_DIRECT_DAMAGE); - CastCustomSpell(pVictim, spellId, &damagePoint, NULL, NULL, true, NULL, triggeredByAura); return SPELL_AURA_PROC_OK; // no hidden cooldown }