void UpdateAI(const uint32 uiDiff) override { if (!m_pInstance) return; if (m_pInstance->GetData(TYPE_PLAGUE_WING_ENTRANCE) != IN_PROGRESS) return; // random summon creatures if (m_uiSummonTimer) { if (m_uiSummonTimer <= uiDiff) { float fX, fY, fZ; uint8 uiMaxInsects = urand(MAX_INSECT_PER_ROUND * 0.5, MAX_INSECT_PER_ROUND); for (uint8 i = 0; i < uiMaxInsects; ++i) { m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 15.0f, fX, fY, fZ); m_creature->SummonCreature(NPC_FLESH_EATING_INSECT, fX, fY, fZ + 20.0f, 0, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 5 * MINUTE * IN_MILLISECONDS); } m_uiSummonTimer = urand(2000, 5000); } else m_uiSummonTimer -= uiDiff; } // event can last max 5 min if (m_uiEventTimer) { if (m_uiEventTimer <= uiDiff) { bool bEventFailed = true; // check withing all players in map if any are still alive and in LoS Map::PlayerList const& pAllPlayers = m_pInstance->instance->GetPlayers(); if (!pAllPlayers.isEmpty()) { for (Map::PlayerList::const_iterator itr = pAllPlayers.begin(); itr != pAllPlayers.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (pPlayer->isAlive() && pPlayer->IsWithinLOSInMap(m_creature)) bEventFailed = false; } } } // set event as done if there are still players around m_pInstance->SetData(TYPE_PLAGUE_WING_ENTRANCE, bEventFailed ? FAIL : DONE); m_uiSummonTimer = 0; m_uiEventTimer = 0; } else m_uiEventTimer -= uiDiff; } }
void SummonedCreatureJustDied(Creature* pSummoned) override { if (!m_pInstance) return; if (m_pInstance->GetData(TYPE_PLAGUE_WING_ENTRANCE) != IN_PROGRESS) return; if (pSummoned->GetEntry() == NPC_FLESH_EATING_INSECT) { ++m_uiInsectCounter; if (m_uiInsectCounter >= TOTAL_INSECTS_PER_EVENT) { m_uiSummonTimer = 0; m_uiEventTimer = 0; m_pInstance->SetData(TYPE_PLAGUE_WING_ENTRANCE, DONE); m_creature->ForcedDespawn(); } } }
void Aggro(Unit* /*pWho*/) override { if (m_pInstance) { m_pInstance->SetData(TYPE_ROTFACE, IN_PROGRESS); if (Creature* pPutricide = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE)) { pPutricide->CastSpell(pPutricide, SPELL_OOZE_FLOOD_PERIODIC, TRIGGERED_OLD_TRIGGERED); pPutricide->SetWalk(false); pPutricide->GetMotionMaster()->MovePoint(102, afBalconyLocation[0], afBalconyLocation[1], afBalconyLocation[2]); // heroic aggro text if (m_pInstance->IsHeroicDifficulty() && m_pInstance->GetData(TYPE_FESTERGUT) == DONE) DoScriptText(SAY_PUTRICIDE_AGGRO, pPutricide); } } DoScriptText(SAY_AGGRO, m_creature); DoCastSpellIfCan(m_creature, SPELL_MUTATED_INFECTION_1, CAST_TRIGGERED); }
void UpdateAI(const uint32 uiDiff) override { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (!m_pInstance) return; // Berserk if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) { DoScriptText(SAY_BERSERK, m_creature); m_uiBerserkTimer = 0; } } else m_uiBerserkTimer -= uiDiff; } if (m_uiGaseousBlightTimer) { if (m_uiGaseousBlightTimer <= uiDiff) { // two stage event; first trigger all the puddle stalkers around then set the room in gas switch (m_uiGaseousBlightStage) { case 0: if (Creature* pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE)) { pProfessor->HandleEmote(EMOTE_ONESHOT_TALK_NOSHEATHE); pProfessor->CastSpell(pProfessor, SPELL_GASEOUS_BLIGHT_INIT, true); DoScriptText((m_pInstance->GetData(TYPE_ROTFACE) == DONE && m_pInstance->IsHeroicDifficulty()) ? SAY_BLIGHT_ROTFACE_DEAD : SAY_BLIGHT, pProfessor); } m_uiGaseousBlightTimer = 1000; break; case 1: if (DoCastSpellIfCan(m_creature, SPELL_GASEOUS_BLIGHT_1) == CAST_OK) m_uiGaseousBlightTimer = 0; break; } ++m_uiGaseousBlightStage; } else m_uiGaseousBlightTimer -= uiDiff; } // Inhale Blight and Pungent Blight if (m_uiInhaleBlightTimer < uiDiff) { SpellAuraHolder* pHolder = m_creature->GetSpellAuraHolder(m_pInstance->Is25ManDifficulty() ? SPELL_INHALED_BLIGHT_25 : SPELL_INHALED_BLIGHT_10); // inhale the gas or if already have 3 stacks - release it if (pHolder && pHolder->GetStackAmount() >= 3) { if (DoCastSpellIfCan(m_creature, SPELL_PUNGENT_BLIGHT) == CAST_OK) { DoScriptText(SAY_PUNGUENT_BLIGHT, m_creature); m_uiInhaleBlightTimer = 38000; } } else { if (DoCastSpellIfCan(m_creature, SPELL_INHALE_BLIGHT) == CAST_OK) m_uiInhaleBlightTimer = 36000; } } else m_uiInhaleBlightTimer -= uiDiff; // Gas Spore if (m_uiGasSporeTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_GAS_SPORE) == CAST_OK) { DoScriptText(EMOTE_SPORES, m_creature); m_uiGasSporeTimer = 40000; } } else m_uiGasSporeTimer -= uiDiff; // Vile Gas if (m_uiVileGasTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_VILE_GAS) == CAST_OK) m_uiVileGasTimer = 30000; } else m_uiVileGasTimer -= uiDiff; // Heroic spells if (m_pInstance->IsHeroicDifficulty()) { if (m_uiMalleableGooTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_MALLEABLE_GOO_SUMMON) == CAST_OK) m_uiMalleableGooTimer = 15000; } else m_uiMalleableGooTimer -= uiDiff; } DoMeleeAttackIfReady(); }