Jump to content

[fix]SPELLMOD_30


Auntie Mangos

Recommended Posts

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

fixes cost "refund" if hit fails - uses this spellmod to decrease cost

For which repository revision was the patch created?

9664

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

http://getmangos.eu/community/showthread.php?13282-[bUG]-Primal-Precision

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

me

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 2b8f690..08646a4 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3747,6 +3747,20 @@ void Spell::TakePower()
        return;
    }

+    bool needApplyMod = false;
+    for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
+    {
+        if (itr->missCondition != SPELL_MISS_NONE)
+        {
+            needApplyMod = true;
+            break;
+        }
+    }
+
+    if (needApplyMod)
+        if (Player* modOwner = m_caster->GetSpellModOwner())
+            modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST_ON_HIT_FAIL, m_powerCost, this);
+
    m_caster->ModifyPower(powerType, -(int32)m_powerCost);

    // Set the five second timer
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 61a8af1..9861994 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -112,7 +112,8 @@ enum SpellModOp
    // spellmod 25 unused
    SPELLMOD_FREQUENCY_OF_SUCCESS   = 26,                   // Only used with SPELL_AURA_ADD_PCT_MODIFIER and affects used on proc spells
    SPELLMOD_MULTIPLE_VALUE         = 27,
-    SPELLMOD_RESIST_DISPEL_CHANCE   = 28
+    SPELLMOD_RESIST_DISPEL_CHANCE   = 28,
+    SPELLMOD_COST_ON_HIT_FAIL       = 30
};

#define MAX_SPELLMOD 32



used in TakePower() because target map is filled after all cost calculations and because its not related to original cost requirements/mods

Link to comment
Share on other sites

  • 40 years later...
Guest
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