Jump to content

[fix] SpellCrit from OverrideClassScripts


pasdVn

Recommended Posts

This fix makes it possible, that also positive Spells can get affected by scripted crit chances.

-> This will fix "Renewed Hope", and "Test of Faith"

From 589dcbfd6e1bfca0c218649874976d66981347ae Mon Sep 17 00:00:00 2001
From: pasdVn <[email protected]>
Date: Mon, 2 Feb 2009 11:09:40 +0100
Subject: [PATCH] fixed spell crit chance from SPELLAURA_OVERRIDE_CLASS_CRIPTS

"Renewed Hope", 57470 and ranks
---
src/game/Unit.cpp |   19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 6788079..cf2d42d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7724,15 +7724,18 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
                crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
            }
            // taken
-            if (pVictim && !IsPositiveSpell(spellProto->Id))
-            {
-                // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
-                crit_chance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
-                // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
-                crit_chance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
-                // Modify by player victim resilience
-                if (pVictim->GetTypeId() == TYPEID_PLAYER)
-                    crit_chance -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL);
+            if (pVictim )
+            {
+                if ( !IsPositiveSpell(spellProto->Id) )
+                {
+                    // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
+                    crit_chance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
+                    // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
+                    crit_chance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
+                    // Modify by player victim resilience
+                    if (pVictim->GetTypeId() == TYPEID_PLAYER)
+                        crit_chance -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL);
+                }

                // scripted (increase crit chance ... against ... target by x%
                AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
-- 
1.6.0.2.1172.ga5ed0

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use