Jump to content

[11141][Patch] Fix SpellMod for melee-ranged spells

Auntie Mangos

Recommended Posts

What bug does the patch fix? What features does the patch add?

Add use of SpellMod for melee spells, as needed ie for Zap, and rogue talents

For which repository revision was the patch created?


Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Bugreport by Feanordev @ http://getmangos.eu/community/post/131365/#p131365

Who has been writing this patch? Please include either forum user names or email addresses.


Tested by Feanordev (slightly different version) at http://getmangos.eu/community/post/131482/#p131482

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index ed547cf..025b27f 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -5743,7 +5743,12 @@ SpellCastResult Spell::CheckRange(bool strict)
                    return SPELL_CAST_OK;

                // with additional 5 dist for non stricted case (some melee spells have delay in apply
-                return m_caster->CanReachWithMeleeAttack(target, strict ? 0.0f : 5.0f) ? SPELL_CAST_OK : SPELL_FAILED_OUT_OF_RANGE;
+                float range_mod = strict ? 0.0f : 5.0f;
+                float base = ATTACK_DISTANCE;
+                if (Player* modOwner = m_caster->GetSpellModOwner())
+                    range_mod += modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, base, this);
+                return m_caster->CanReachWithMeleeAttack(target, range_mod) ? SPELL_CAST_OK : SPELL_FAILED_OUT_OF_RANGE;
            break;                                          // let continue in generic way for no target

Link to comment
Share on other sites

  • 41 years later...
This topic is now closed to further replies.
  • 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