void ShatterGolems() { if (m_lGolemGUIDList.empty()) return; uint8 m_uiBrittleGolemsCount = 0; for(GUIDList::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) { // only shatter brittle golems if (pTemp->GetEntry() == NPC_BRITTLE_GOLEM) { pTemp->CastSpell(pTemp, m_bIsRegularMode ? SPELL_SHATTER : SPELL_SHATTER_H, true); ++m_uiBrittleGolemsCount; } } } // If shattered more than 4 golems mark achiev as failed if (m_uiBrittleGolemsCount > MAX_ACHIEV_GOLEMS) { if (m_pInstance) m_pInstance->SetData(TYPE_VOLKHAN, SPECIAL); } }
void DespawnGolems() { if (m_lGolemGUIDList.empty()) return; for(GUIDList::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr)) { if (pTemp->isAlive()) pTemp->ForcedDespawn(); } } }
void ShatterRemainingCrystals() { if (m_lCrystalGuids.empty()) return; for (GUIDList::const_iterator itr = m_lCrystalGuids.begin(); itr != m_lCrystalGuids.end(); ++itr) { //Creature* pCrystal = m_creature->GetMap()->GetCreature(FelCrystals[i]); Creature* pCrystal = m_creature->GetMap()->GetCreature(*itr); if (pCrystal && pCrystal->isAlive()) pCrystal->DealDamage(pCrystal, pCrystal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } }
void Aggro(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); if (m_pInstance) { m_pInstance->SetData(TYPE_SELIN, IN_PROGRESS); if (m_lCrystalGuids.empty()) { // Get and output crystals m_pInstance->GetFelCrystalList(m_lCrystalGuids); for (GUIDList::const_iterator itr = m_lCrystalGuids.begin(); itr != m_lCrystalGuids.end(); ++itr) debug_log("SSC: Selin: Added Fel Crystal %s to list", ObjectGuid(*itr).GetString().c_str()); } } }
void instance_molten_core::DoHandleAdds(GUIDList &luiAddsGUIDs, bool bRespawn /*=true*/) { if (luiAddsGUIDs.empty()) return; for (GUIDList::const_iterator itr = luiAddsGUIDs.begin(); itr != luiAddsGUIDs.end(); ++itr) { if (Creature* pAdd = instance->GetCreature(*itr)) { // Respawn dead mobs (or corpses) if (bRespawn && !pAdd->isAlive()) pAdd->Respawn(); // Kill adds else if (!bRespawn) pAdd->DealDamage(pAdd, pAdd->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } }
void SummonAdds(bool /*bRightSide*/, uint32 uiSummonEntry) { GUIDList* plSummonPosGuids; switch (uiSummonEntry) { case NPC_UNREL_TRAINEE: plSummonPosGuids = &m_lTraineeSummonPosGuids; break; case NPC_UNREL_DEATH_KNIGHT: plSummonPosGuids = &m_lDeathKnightSummonPosGuids; break; case NPC_UNREL_RIDER: plSummonPosGuids = &m_lRiderSummonPosGuids; break; default: return; } if (plSummonPosGuids->empty()) return; for (GUIDList::iterator itr = plSummonPosGuids->begin(); itr != plSummonPosGuids->end(); ++itr) { if (Creature* pPos = m_creature->GetMap()->GetCreature(*itr)) m_creature->SummonCreature(uiSummonEntry, pPos->GetPositionX(), pPos->GetPositionY(), pPos->GetPositionZ(), pPos->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); } }
void JustRespawned() { Reset(); // Needed to reset the flags properly GUIDList lTeslaGUIDList; if (!m_pInstance) return; m_pInstance->GetThadTeslaCreatures(lTeslaGUIDList); if (lTeslaGUIDList.empty()) return; for (GUIDList::const_iterator itr = lTeslaGUIDList.begin(); itr != lTeslaGUIDList.end(); ++itr) { if (Creature* pTesla = m_pInstance->instance->GetCreature(*itr)) { if (npc_tesla_coilAI* pTeslaAI = dynamic_cast<npc_tesla_coilAI*> (pTesla->AI())) pTeslaAI->ReApplyChain(m_creature->GetEntry()); } } }
void InitSentinelsNear(Unit* pTarget) { if (!m_lAssistList.empty()) { for(GUIDList::const_iterator itr = m_lAssistList.begin(); itr != m_lAssistList.end(); ++itr) { if (*itr == m_creature->GetObjectGuid()) continue; if (Creature* pBuddy = m_creature->GetMap()->GetCreature(*itr)) { if (pBuddy->isAlive()) pBuddy->AI()->AttackStart(pTarget); } } return; } std::list<Creature*> lAssistList; GetCreatureListWithEntryInGrid(lAssistList, m_creature, m_creature->GetEntry(), 80.0f); if (lAssistList.empty()) return; for(std::list<Creature*>::iterator iter = lAssistList.begin(); iter != lAssistList.end(); ++iter) { m_lAssistList.push_back((*iter)->GetObjectGuid()); if ((*iter)->GetObjectGuid() == m_creature->GetObjectGuid()) continue; (*iter)->AI()->AttackStart(pTarget); } if (m_lAssistList.size() != MAX_BUDDY) error_log("SSC: npc_anubisath_sentinel found too few/too many buddies, expected %u.", MAX_BUDDY); }
void SelectNearestCrystal() { if (m_lCrystalGuids.empty()) return; m_crystalGuid.Clear(); Creature* pCrystal = NULL; Creature* pCrystalChosen = NULL; for (GUIDList::const_iterator itr = m_lCrystalGuids.begin(); itr != m_lCrystalGuids.end(); ++itr) { pCrystal = m_creature->GetMap()->GetCreature(*itr); if (pCrystal && pCrystal->isAlive()) { // select nearest if (!pCrystalChosen || m_creature->GetDistanceOrder(pCrystal, pCrystalChosen, false)) { m_crystalGuid = pCrystal->GetObjectGuid(); pCrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell. } } } if (pCrystalChosen) { DoScriptText(SAY_ENERGY, m_creature); DoScriptText(EMOTE_CRYSTAL, m_creature); pCrystalChosen->CastSpell(pCrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); float x, y, z; // coords that we move to, close to the crystal. pCrystalChosen->GetClosePoint(x, y, z, m_creature->GetObjectBoundingRadius(), CONTACT_DISTANCE); m_creature->SetWalk(false); m_creature->GetMotionMaster()->MovePoint(1, x, y, z); m_bDrainingCrystal = true; } }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) return; if (m_uiMark_Count >= 100) if (m_uiEnrage_Timer < uiDiff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_BERSERK, true); m_uiEnrage_Timer = 300000; } else m_uiEnrage_Timer -= uiDiff; // Mark of Blaumeux if (m_uiMark_Timer < uiDiff) { DoCastSpellIfCan(m_creature,SPELL_MARK_OF_BLAUMEUX,CAST_TRIGGERED); m_uiMark_Timer = 15000; m_uiMark_Count++; } else m_uiMark_Timer -= uiDiff; // Shield Wall - All 4 horsemen will shield wall at 50% hp and 20% hp for 20 seconds if (m_bShieldWall1 && m_creature->GetHealthPercent() < 50.0f) { if (m_bShieldWall1) { DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL); m_bShieldWall1 = false; } } else if (m_bShieldWall2 && m_creature->GetHealthPercent() < 20.0f) { if (m_bShieldWall2) { DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL); m_bShieldWall2 = false; } } // Void Zone if (m_uiVoidZone_Timer < uiDiff) { // get random player in 45yard range (maybe this can be done easier?) ThreatList const& tList = m_creature->getThreatManager().getThreatList(); if(!tList.empty()) { GUIDList lClosePlayerList; lClosePlayerList.clear(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) if(Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) if (m_creature->GetDistance2d(pUnit) < 45.f) lClosePlayerList.push_back(pUnit->GetGUID()); if(!lClosePlayerList.empty()) { GUIDList::iterator i = lClosePlayerList.begin(); advance(i, (rand() % lClosePlayerList.size())); if(Player* pTarget = m_creature->GetMap()->GetPlayer(*i)) DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_VOIDZONE : H_SPELL_VOIDZONE, CAST_TRIGGERED); } } m_uiVoidZone_Timer = 12000; } else m_uiVoidZone_Timer -= uiDiff; if (m_uiShadowBolt_Timer < uiDiff) { // cast on closest player ThreatList const& tList = m_creature->getThreatManager().getThreatList(); if (!tList.empty()) { Unit* pTarget = m_creature->GetMap()->GetUnit((*tList.begin())->getUnitGuid()); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) if (pTarget && m_creature->GetDistance2d(pUnit) < m_creature->GetDistance2d(pTarget)) pTarget = pUnit; if (pTarget && m_creature->GetDistance2d(pTarget)< 45.0f) DoCast(pTarget, m_bIsRegularMode ? SPELL_SHADOW_BOLT : H_SPELL_SHADOW_BOLT, true); else DoCast(m_creature, SPELL_UNYIELDING_PAIN, true); } m_uiShadowBolt_Timer = 2000; } else m_uiShadowBolt_Timer -= uiDiff; DoMeleeAttackIfReady(); }