- What bug does the patch fix? What features does the patch add?
32264 ( Inhibit Magic ) Should stack depending on range to caster.
It comes with a function to handle similar spells
- For which repository revision was the patch created?
8569 mangos 0.12
- Who has been writing this patch?
me
http://paste2.org/p/788465
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 2e0d0dc..e488b61 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2050,6 +2050,46 @@ void Aura::TriggerSpell()
/*** AURA EFFECTS ***/
/*********************************************************/
+void Aura::StackByRange(float max_range, float min_range, int32 stack_size)
+{
+ Unit* caster = GetCaster();
+ uint32 spell_id = m_spellProto->Id;
+
+ if(m_target->IsWithinDist(caster, min_range) || !caster || !caster->isAlive() || !m_target || !m_target->isAlive())
+ return;
+
+
+ SpellEntry* TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(spell_id);
+ if(m_target->IsWithinDist(caster, max_range))
+ {
+ Unit::AuraMap& auras = m_target->GetAuras();
+ int32 count = 0;
+ for(Unit::AuraMap::iterator i = auras.begin(); i != auras.end(); ++i)
+ {
+ if(i->second->GetId() == spell_id)
+ ++count;
+ }
+ for(count; count < stack_size; ++count)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ {
+ if (!TempSpell->Effect[i])
+ continue;
+ m_target->AddAura(new Aura(TempSpell, SpellEffectIndex(i), NULL, m_target, caster));
+ }
+ }
+ for(count; count > stack_size; --count)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ {
+ if (!TempSpell->Effect[i])
+ continue;
+ m_target->RemoveSingleAuraFromStack(spell_id, SpellEffectIndex(i));
+ }
+ }
+ }
+}
+
void Aura::HandleAuraDummy(bool apply, bool Real)
{
// spells required only Real aura add/remove
@@ -5060,6 +5100,18 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/)
{
+ if (apply)
+ {
+ switch(m_spellProto->Id)
+ {
+ case 32264:
+ StackByRange(50.0f, 35.0f, 4);
+ StackByRange(35.0f, 25.0f, 3);
+ StackByRange(25.0f, 10.0f, 2);
+ StackByRange(10.0f, 0, 1);
+ break;
+ }
+ }
m_target->ApplyCastTimePercentMod(float(m_modifier.m_amount),apply);
}
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 3e653a2..abeb401 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -217,6 +217,7 @@ class MANGOS_DLL_SPEC Aura
virtual ~Aura();
+ void StackByRange(float max_range, float min_range, int32 stack_size);
void SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue);
Modifier* GetModifier() {return &m_modifier;}
int32 GetMiscValue() {return m_spellProto->EffectMiscValue[m_effIndex];}