[10199] Fix 33763 and ranks final heal and mana return on dispel and on expire

This commit is contained in:
Laise 2010-07-16 21:34:05 +03:00
parent 2284df7868
commit ae51168ffc
6 changed files with 54 additions and 34 deletions

View file

@ -4238,7 +4238,7 @@ void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex
}
}
void Unit::RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, int32 stackAmount, uint64 casterGUID, Unit *dispeler)
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
@ -4253,13 +4253,28 @@ void Unit::RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 caste
damage *= 9;
// Remove spell auras from stack
RemoveSingleAuraHolderFromStack(spellId, casterGUID, AURA_REMOVE_BY_DISPEL);
RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL);
// backfire damage and silence
dispeler->CastCustomSpell(dispeler, 31117, &damage, NULL, NULL, true, NULL, NULL,casterGUID);
return;
}
}
// Lifebloom
else if (spellEntry->SpellFamilyName == SPELLFAMILY_DRUID && (spellEntry->SpellFamilyFlags & UI64LIT(0x0000001000000000)))
{
if (Aura* dotAura = GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, UI64LIT(0x0000001000000000), 0x00000000, casterGUID))
{
int32 amount = ( dotAura->GetModifier()->m_amount / dotAura->GetStackAmount() ) * stackAmount;
CastCustomSpell(this, 33778, &amount, NULL, NULL, true, NULL, dotAura, casterGUID);
if (Unit* caster = dotAura->GetCaster())
{
int32 returnmana = (spellEntry->ManaCostPercentage * caster->GetCreateMana() / 100) * stackAmount / 2;
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, dotAura, casterGUID);
}
}
}
// Flame Shock
else if (spellEntry->SpellFamilyName == SPELLFAMILY_SHAMAN && (spellEntry->SpellFamilyFlags & UI64LIT(0x10000000)))
{
@ -4286,7 +4301,7 @@ void Unit::RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 caste
}
// Remove spell auras from stack
RemoveSingleAuraHolderFromStack(spellId, casterGUID, AURA_REMOVE_BY_DISPEL);
RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL);
// Haste
if (triggeredSpell)
@ -4305,7 +4320,7 @@ void Unit::RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 caste
bp0 *= 8;
// Remove spell auras from stack
RemoveSingleAuraHolderFromStack(spellId, casterGUID, AURA_REMOVE_BY_DISPEL);
RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL);
CastCustomSpell(this, 64085, &bp0, NULL, NULL, true, NULL, NULL, casterGUID);
return;
@ -4313,7 +4328,7 @@ void Unit::RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 caste
}
}
RemoveSingleAuraHolderFromStack(spellId, casterGUID, AURA_REMOVE_BY_DISPEL);
RemoveAuraHolderFromStack(spellId, stackAmount, casterGUID, AURA_REMOVE_BY_DISPEL);
}
void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer)
@ -4391,14 +4406,14 @@ void Unit::RemoveAurasWithDispelType( DispelType type )
}
}
void Unit::RemoveSingleAuraHolderFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode mode)
void Unit::RemoveAuraHolderFromStack(uint32 spellId, int32 stackAmount, uint64 casterGUID, AuraRemoveMode mode)
{
SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId);
for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; ++iter)
{
if (!casterGUID || iter->second->GetCasterGUID() == casterGUID)
{
if (iter->second->ModStackAmount(-1))
if (iter->second->ModStackAmount(-stackAmount))
{
RemoveSpellAuraHolder(iter->second, mode);
break;
@ -9535,7 +9550,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
removedSpells.unique();
// Remove auras from removedAuras
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
RemoveSingleAuraHolderFromStack(*i);
RemoveAuraHolderFromStack(*i);
}
}