diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2016-12-30 15:59:59 -0300 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2018-04-29 18:38:51 +0200 |
| commit | 87ed45d912ab6ffc6cf09bbf3a42ac59533ce5e1 (patch) | |
| tree | 0e191b1aab573536bd1ff780fc3b364044e7e926 /src/server/game/Entities/Player | |
| parent | 95408869c0a76fa478a0049f4370da3aa3e6e8c8 (diff) | |
Core/Spell: kill old charge restoring system. Mods are fully handled by proc system now.
- Fixes an edge case of spell failing due to out of range and re-adding charges to an existing aura.
(cherry picked from commit ee6d1d02c09941e44ff76ed240770f1102f14267)
Diffstat (limited to 'src/server/game/Entities/Player')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 56 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 |
2 files changed, 0 insertions, 58 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c31a3ebd6a3..9becff0eb34 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21901,62 +21901,6 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) } } -// Restore spellmods in case of failed cast -void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId /*= 0*/, Aura* aura /*= nullptr*/) -{ - if (!spell || spell->m_appliedMods.empty()) - return; - - std::vector<Aura*> aurasQueue; - for (uint8 i = 0; i < MAX_SPELLMOD; ++i) - { - for (uint8 j = 0; j < SPELLMOD_END; ++j) - { - for (SpellModifier* mod : m_spellMods[i][j]) - { - // Spellmods without charged aura set cannot be charged - if (!mod->ownerAura->IsUsingCharges()) - continue; - - // Restore only specific owner aura mods - if (ownerAuraId && mod->spellId != ownerAuraId) - continue; - - if (aura && mod->ownerAura != aura) - continue; - - // Check if mod affected this spell - // First, check if the mod aura applied at least one spellmod to this spell - Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura); - if (iterMod == spell->m_appliedMods.end()) - continue; - // Second, check if the current mod is one of those applied by the mod aura - if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags)) - continue; - - // remove from list - This will be done after all mods have been gone through - // to ensure we iterate over all mods of an aura before removing said aura - // from applied mods (Else, an aura with two mods on the current spell would - // only see the first of its modifier restored) - aurasQueue.push_back(mod->ownerAura); - - // add charges back to aura - mod->ownerAura->ModCharges(1); - } - } - } - - for (Aura* aura : aurasQueue) - spell->m_appliedMods.erase(aura); -} - -void Player::RestoreAllSpellMods(uint32 ownerAuraId /*= 0*/, Aura* aura /*= nullptr*/) -{ - for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) - if (Spell* spell = m_currentSpells[i]) - RestoreSpellMods(spell, ownerAuraId, aura); -} - void Player::ApplyModToSpell(SpellModifier* mod, Spell* spell) { if (!spell) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index f5752bd450d..e0022324bc6 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1681,8 +1681,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> static bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr); template <class T> void ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr) const; - void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr); - void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr); static void ApplyModToSpell(SpellModifier* mod, Spell* spell); void SetSpellModTakingSpell(Spell* spell, bool apply); void SendSpellModifiers() const; |
