[10634] Include non-percent mana cost in EffectDestroyAllTotems mana return.

Also small speedup for no-return spells.
This commit is contained in:
VladimirMangos 2010-10-21 01:55:21 +04:00
parent bf2b256720
commit 0901a4c2ac
2 changed files with 8 additions and 5 deletions

View file

@ -7621,11 +7621,14 @@ void Spell::EffectDestroyAllTotems(SpellEffectIndex /*eff_idx*/)
{
if (Totem* totem = m_caster->GetTotem(TotemSlot(slot)))
{
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id))
if (damage)
{
uint32 manacost = m_caster->GetCreateMana() * spellInfo->ManaCostPercentage / 100;
mana += manacost * damage / 100;
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id))
{
uint32 manacost = spellInfo->manaCost + m_caster->GetCreateMana() * spellInfo->ManaCostPercentage / 100;
mana += manacost * damage / 100;
}
}
totem->UnSummon();
}