uint8 BSWScriptedAI::_auraCount(uint8 m_uiSpellIdx, Unit* pTarget, SpellEffectIndex index) { BSWRecord* pSpell = &m_BSWRecords[m_uiSpellIdx]; return _auraCount(pSpell->m_uiSpellEntry[currentDifficulty], pTarget, index); };
bool BSWScriptedAI::_doRemove(uint32 SpellID, Unit* pTarget, uint8 index) { if (!_hasAura(SpellID, pTarget)) return false; if (index == EFFECT_INDEX_ALL) { pTarget->RemoveAurasDueToSpell(SpellID); } else if (_auraCount(SpellID,pTarget,(SpellEffectIndex)index) > 1) { if (SpellAuraHolderPtr holder = pTarget->GetSpellAuraHolder(SpellID, pTarget->GetObjectGuid())) { if (holder->ModStackAmount(-1)) { pTarget->RemoveSpellAuraHolder(holder, AURA_REMOVE_BY_DISPEL); } else return false; } } else pTarget->RemoveAurasDueToSpell(SpellID); debug_log("BSW: Removed effects of spell %u index %u",SpellID, index); return true; };
bool BossSpellWorker::_doRemove(uint8 m_uiSpellIdx, Unit* pTarget, uint8 index) { SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx]; debug_log("BSW: Removing effects of spell %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget); switch (pSpell->m_CastTarget) { case DO_NOTHING: return true; case SUMMON_NORMAL: case SUMMON_TEMP: case SUMMON_INSTANT: return false; case CAST_ON_SELF: case APPLY_AURA_SELF: pTarget = boss; break; case CAST_ON_SUMMONS: case CAST_ON_VICTIM: case CAST_ON_BOTTOMAGGRO: case CAST_ON_TARGET: case APPLY_AURA_TARGET: if (!pTarget) return false; break; case CAST_ON_RANDOM: case CAST_ON_RANDOM_PLAYER: case APPLY_AURA_ALLPLAYERS: case CAST_ON_ALLPLAYERS: { Map::PlayerList const& pPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) { pTarget = itr->getSource(); if (_hasAura(m_uiSpellIdx,pTarget)) pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]); } return true; } break; default: debug_log("BSW: FAILED Removing effects of spell %u type %u - unsupported type",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget); return false; } if (!pTarget || !pTarget->IsInMap(boss) || !pTarget->isAlive()) { error_log("BSW: FAILED removing effects of spell number %u - no target or target not in map or target is dead",pSpell->m_uiSpellEntry[currentDifficulty]); return false; } if (index == EFFECT_INDEX_ALL) { pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]); return true; } if (_auraCount(m_uiSpellIdx,pTarget,(SpellEffectIndex)index) > 1) { if (pTarget->GetAura(pSpell->m_uiSpellEntry[currentDifficulty],(SpellEffectIndex)index)->modStackAmount(-1)) return true; else return false; } else pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]); return true; };