diff options
author | johnholiver <johnholiver@gmail.com> | 2011-05-05 19:06:11 -0300 |
---|---|---|
committer | johnholiver <johnholiver@gmail.com> | 2011-05-05 19:16:13 -0300 |
commit | 99959e8cd786a961fe392a01ade53618c0c44f0a (patch) | |
tree | f53357286bb865d2f9edfd8916e0e65bcad05ebc /src | |
parent | 13cfd105fe2cdd0786b5f2560f67f506535566be (diff) |
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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 35 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 22 |
4 files changed, 48 insertions, 17 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 445488d7d82..21dc29ec3f3 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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 diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 1d1b34e1520..6502203a83a 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -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); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 8fd24da80a8..1246815aaaa 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -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 diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 510ec8dc9a5..6c9bfba4953 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -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); |