[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

@ -2477,21 +2477,14 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
else
{
// Final heal only on dispelled or duration end
if (!(GetAuraDuration() <= 0 || m_removeMode == AURA_REMOVE_BY_DISPEL))
// Final heal on duration end
if (m_removeMode != AURA_REMOVE_BY_EXPIRE)
return;
// have a look if there is still some other Lifebloom dummy aura
Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID &&
((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000)))
return;
// final heal
if (target->IsInWorld() && GetStackAmount() > 0)
{
int32 amount = m_modifier.m_amount / GetStackAmount();
int32 amount = m_modifier.m_amount;
target->CastCustomSpell(target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID());
if (Unit* caster = GetCaster())

View file

@ -597,8 +597,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
}
if (needConsume)
for (uint32 i = 0; i < doses; ++i)
unitTarget->RemoveSingleAuraHolderFromStack(spellId, m_caster->GetGUID());
unitTarget->RemoveAuraHolderFromStack(spellId, doses, m_caster->GetGUID());
damage *= doses;
damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses);
@ -4073,7 +4072,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx)
// Ok if exist some buffs for dispel try dispel it
if (!dispel_list.empty())
{
std::list < std::pair<uint32,uint64> > success_list;// (spell_id,casterGuid)
std::list<std::pair<SpellAuraHolder* ,uint32> > success_list;// (spell_id,casterGuid)
std::list < uint32 > fail_list; // spell_id
// some spells have effect value = 0 and all from its by meaning expect 1
@ -4109,7 +4108,20 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx)
if (roll_chance_i(miss_chance))
fail_list.push_back(spellInfo->Id);
else
success_list.push_back(std::pair<uint32,uint64>(holder->GetId(),holder->GetCasterGUID()));
{
bool foundDispelled = false;
for (std::list<std::pair<SpellAuraHolder* ,uint32> >::iterator success_iter = success_list.begin(); success_iter != success_list.end(); ++success_iter)
{
if (success_iter->first->GetId() == holder->GetId() && success_iter->first->GetCasterGUID() == holder->GetCasterGUID())
{
success_iter->second += 1;
foundDispelled = true;
break;
}
}
if (!foundDispelled)
success_list.push_back(std::pair<SpellAuraHolder* ,uint32>(holder, 1));
}
}
// Send success log and really remove auras
if (!success_list.empty())
@ -4121,12 +4133,12 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx)
data << uint32(m_spellInfo->Id); // Dispel spell id
data << uint8(0); // not used
data << uint32(count); // count
for (std::list<std::pair<uint32,uint64> >::iterator j = success_list.begin(); j != success_list.end(); ++j)
for (std::list<std::pair<SpellAuraHolder* ,uint32> >::iterator j = success_list.begin(); j != success_list.end(); ++j)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first);
data << uint32(spellInfo->Id); // Spell Id
SpellAuraHolder* dispelledHolder = j->first;
data << uint32(dispelledHolder->GetId()); // Spell Id
data << uint8(0); // 0 - dispeled !=0 cleansed
unitTarget->RemoveSingleAuraHolderDueToSpellByDispel(spellInfo->Id, j->second, m_caster);
unitTarget->RemoveAuraHolderDueToSpellByDispel(dispelledHolder->GetId(), j->second, dispelledHolder->GetCasterGUID(), m_caster);
}
m_caster->SendMessageToSet(&data, true);
@ -5434,7 +5446,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
return;
}
case 24590: // Brittle Armor - need remove one 24575 Brittle Armor aura
unitTarget->RemoveSingleAuraHolderFromStack(24575);
unitTarget->RemoveAuraHolderFromStack(24575);
return;
case 26275: // PX-238 Winter Wondervolt TRAP
{
@ -5453,7 +5465,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
return;
}
case 26465: // Mercurial Shield - need remove one 26464 Mercurial Shield aura
unitTarget->RemoveSingleAuraHolderFromStack(26464);
unitTarget->RemoveAuraHolderFromStack(26464);
return;
case 25140: // Orb teleport spells
case 25143:

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);
}
}

View file

@ -1534,8 +1534,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void RemoveAllAurasOnDeath();
// removing specific aura FROM stack by diff reasons and selections
void RemoveSingleAuraHolderFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveSingleAuraHolderDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAuraHolderFromStack(uint32 spellId, int32 stackAmount = 1, uint64 casterGUID = 0, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, int32 stackAmount, uint64 casterGUID, Unit *dispeler);
void DelaySpellAuraHolder(uint32 spellId, int32 delaytime);

View file

@ -618,14 +618,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!procSpell || procSpell->Id == 24659)
return false;
// Need remove one 24659 aura
RemoveSingleAuraHolderFromStack(24659);
RemoveAuraHolderFromStack(24659);
return true;
}
// Restless Strength
case 24661:
{
// Need remove one 24662 aura
RemoveSingleAuraHolderFromStack(24662);
RemoveAuraHolderFromStack(24662);
return true;
}
// Adaptive Warding (Frostfire Regalia set)
@ -2356,7 +2356,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
}
CastSpell(target, spell, true, castItem, triggeredByAura);
if ((*itr)->GetHolder()->DropAuraCharge())
RemoveSingleAuraHolderFromStack((*itr)->GetId());
RemoveAuraHolderFromStack((*itr)->GetId());
return true;
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10198"
#define REVISION_NR "10199"
#endif // __REVISION_NR_H__