bool CheckPhaseMinions() { summons.RemoveNotExisting(); if (summons.empty()) { ResetPlayersPhaseMask(); return true; } uint16 phase = 1; for (std::list<uint64>::iterator itr = summons.begin(); itr != summons.end(); ++itr) { if (Creature *summon = ObjectAccessor::GetCreature(*me, *itr)) phase |= summon->GetPhaseMask(); } Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if (Player* pPlayer = i->GetSource()) if ((pPlayer->GetPhaseMask() & phase) == 0) pPlayer->RemoveAurasDueToSpell(GetSpellForPhaseMask(pPlayer->GetPhaseMask())); } return false; }
void KilledUnit(Unit* pVictim) { DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); if (pVictim->GetTypeId() == TYPEID_PLAYER) pVictim->RemoveAurasDueToSpell(GetSpellForPhaseMask(pVictim->GetPhaseMask())); }
void ResetPlayersPhaseMask() { Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { Player* player = i->getSource(); player->RemoveAurasDueToSpell(GetSpellForPhaseMask(player->GetPhaseMask())); } }
void SummonedCreatureDespawn(Creature* summon) { uint32 phase= summon->GetPhaseMask(); uint32 nextPhase = 0; Summons.Despawn(summon); // Check if all summons in this phase killed for (SummonList::const_iterator iter = Summons.begin(); iter != Summons.end(); ++iter) { if (Creature* visage = Unit::GetCreature(*me, *iter)) { // Not all are dead if (phase == visage->GetPhaseMask()) return; else nextPhase = visage->GetPhaseMask(); } } // Roll Insanity uint32 spell = GetSpellForPhaseMask(phase); uint32 spell2 = GetSpellForPhaseMask(nextPhase); Map* map = me->GetMap(); if (!map) return; Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* player = i->getSource()) { if (player->HasAura(spell)) { player->RemoveAurasDueToSpell(spell); if (spell2) // if there is still some different mask cast spell for it player->CastSpell(player, spell2, true); } } } } }
void ResetPlayersPhaseMask() { Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if (Player* pPlayer = i->GetSource()) if (uint32 spellId = GetSpellForPhaseMask(pPlayer->GetPhaseMask())) pPlayer->RemoveAurasDueToSpell(spellId); } }