Core/Spells: Lifebloom final bloom.

Each dispelled stack will count towards the final bloom.
I left spell_bonus_data stuff out following Shauren's comment.
This commit is contained in:
johnholiver
2011-05-05 19:16:13 -03:00
parent 13cfd105fe
commit 99959e8cd7
4 changed files with 47 additions and 16 deletions
+27 -6
View File
@@ -3616,13 +3616,13 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode rem
}
}
inline void Unit::RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode)
inline void Unit::RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode, uint8 chargesRemoved/*= 1*/)
{
if (iter->second->ModStackAmount(-1))
if (iter->second->ModStackAmount(-chargesRemoved))
RemoveOwnedAura(iter, removeMode);
}
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller)
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller, uint8 chargesRemoved/*= 1*/)
{
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
{
@@ -3630,14 +3630,35 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
if (aura->GetCasterGUID() == casterGUID)
{
if (aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES)
aura->DropCharge();
{
for (uint8 i = 0; i < chargesRemoved; i++)
aura->DropCharge();
}
else
RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL, chargesRemoved);
//Lifebloom
if (aura->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && (aura->GetSpellProto()->SpellFamilyFlags[1] & 0x10))
{
if (Unit * caster = aura->GetCaster())
{
if (AuraEffect const * aurEff = aura->GetEffect(EFFECT_1))
{
// final heal
int32 healAmount = aurEff->GetAmount();
int32 stack = chargesRemoved;
CastCustomSpell(this, 33778, &healAmount, &stack, NULL, true, NULL, NULL, aura->GetCasterGUID());
// mana
int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellProto()->ManaCostPercentage) * chargesRemoved / 2;
caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID());
}
}
}
// Unstable Affliction (crash if before removeaura?)
if (aura->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (aura->GetSpellProto()->SpellFamilyFlags[1] & 0x0100))
{
if (AuraEffect const * aurEff = aura->GetEffect(0))
if (AuraEffect const * aurEff = aura->GetEffect(EFFECT_0))
{
int32 damage = aurEff->GetAmount()*9;
// backfire damage and silence
+2 -2
View File
@@ -1647,8 +1647,8 @@ class Unit : public WorldObject
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
inline void RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller);
inline void RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode, uint8 chargesRemoved = 1);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller, uint8 chargesRemoved = 1);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId);
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except = NULL, bool negative = true, bool positive = true);
@@ -5950,8 +5950,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
// Lifebloom
if (GetSpellProto()->SpellFamilyFlags[1] & 0x10)
{
// Final heal only on dispelled or duration end
if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && aurApp->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
// Final heal only on duration end
if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
+16 -6
View File
@@ -3224,7 +3224,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// Ok if exist some buffs for dispel try dispel it
uint32 failCount = 0;
DispelList success_list;
DispelChargesList success_list;
WorldPacket dataFail(SMSG_DISPEL_FAILED, 8+8+4+4+damage*4);
// dispel N = damage buffs (or while exist buffs for dispel)
for (int32 count = 0; count < damage && !dispel_list.empty();)
@@ -3244,7 +3244,17 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
{
if (success)
{
success_list.push_back(std::make_pair(itr->first->GetId(), itr->first->GetCasterGUID()));
bool alreadyListed = false;
for (DispelChargesList::iterator successItr = success_list.begin(); successItr != success_list.end(); ++successItr)
{
if (successItr->first->GetId() == itr->first->GetId())
{
++successItr->second;
alreadyListed = true;
}
}
if (!alreadyListed)
success_list.push_back(std::make_pair(itr->first, 1));
--itr->second;
if (itr->second <= 0)
dispel_list.erase(itr);
@@ -3271,19 +3281,19 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
if (success_list.empty())
return;
WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+damage*5);
WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+success_list.size()*5);
// Send packet header
dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
dataSuccess << uint8(0); // not used
dataSuccess << uint32(success_list.size()); // count
for (DispelList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
for (DispelChargesList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
{
// Send dispelled spell info
dataSuccess << uint32(itr->first); // Spell Id
dataSuccess << uint32(itr->first->GetId()); // Spell Id
dataSuccess << uint8(0); // 0 - dispelled !=0 cleansed
unitTarget->RemoveAurasDueToSpellByDispel(itr->first, itr->second, m_caster);
unitTarget->RemoveAurasDueToSpellByDispel(itr->first->GetId(), itr->first->GetCasterGUID(), m_caster, itr->second);
}
m_caster->SendMessageToSet(&dataSuccess, true);