void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(!m_bIsEnrage && m_uiEnrage2Timer < uiDiff) { DoCast(m_creature, SPELL_BERSERK); m_bIsEnrage = true; }else m_uiEnrage2Timer -= uiDiff; if(m_bIsBloom && m_uiBloomTimer < uiDiff) { std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *TargetedPlayer = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (TargetedPlayer && TargetedPlayer->GetTypeId() == TYPEID_PLAYER && TargetedPlayer->isAlive()) TargetedPlayer->CastSpell(TargetedPlayer, m_bIsRegularMode ? SPELL_BLOOM : SPELL_BLOOM_H, false); } m_uiBloomTimer = 20000; m_bIsBloom = false; }else m_uiBloomTimer -= uiDiff; if(m_uiNecroticAuraTimer < uiDiff) { if(m_creature->getVictim()) m_creature->CastSpell(m_creature->getVictim(), SPELL_NECROTIC_AURA, false); m_uiNecroticAuraTimer = 20000; }else m_uiNecroticAuraTimer -= uiDiff; if(m_uiDeatchBloomTimer < uiDiff) { if(m_creature->getVictim()) m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_DEATHBLOOM : SPELL_DEATHBLOOM_H, false); m_uiDeatchBloomTimer = (m_bIsRegularMode ? 30000 : 20000); m_uiBloomTimer = 6000; m_bIsBloom = true; }else m_uiDeatchBloomTimer -= uiDiff; if(m_uiDoomTimer < uiDiff) { if(m_creature->getVictim()) m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_DOOM : SPELL_DOOM_H, false); m_uiDoomTimer = 30000; if(m_uiEnrageTimer < uiDiff) m_uiDoomTimer = 15000; else m_uiEnrageTimer -= uiDiff; }else m_uiDoomTimer -= uiDiff; if (m_uiSummonTimer < uiDiff) { for(uint8 i=0; i<3; ++i) if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) { Creature* pSummonedSpores = m_creature->SummonCreature(CREATURE_SPORE, pTarget->GetPositionX()+1, pTarget->GetPositionY()+1, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN,80000); if (pSummonedSpores) { pSummonedSpores->AddThreat(pTarget); pSummonedSpores->AI()->AttackStart(pTarget); } } m_uiSummonTimer = 30000; }else m_uiSummonTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (m_bIsActiveCheck) { if (!m_bIsActived && Active_Timer < uiDiff) { m_bIsActived = true; Active_Timer = 1000; }else Active_Timer -= uiDiff; } else { if (Active_Timer < uiDiff) { if(m_pInstance) { bool m_bIsAlive = false; Creature* pStalagg; Creature* pFeugen; if (pStalagg = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_STALAGG)))) if (pStalagg->isAlive()) m_bIsAlive = true; if (pFeugen = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_FEUGEN)))) if (pFeugen->isAlive()) m_bIsAlive = true; if (!m_bIsAlive) { m_bIsActiveCheck = true; Active_Timer = 15000; } else { if (pStalagg->isInCombat() && pFeugen->isInCombat()) { if (SwitchTarget_Timer < uiDiff) { Unit* pStalaggTarget; Unit* pFeugenTarget; float StalaggTargetThreat; float FeugenTargetThreat; // Get Stalagg's target threat if (pStalagg && pStalagg->isAlive()) { if (pStalaggTarget = pStalagg->getVictim()) StalaggTargetThreat = m_creature->getThreatManager().getThreat(pStalaggTarget); } // Get Feugen's target threat if (pFeugen && pFeugen->isAlive()) { if (pFeugenTarget = pFeugen->getVictim()) FeugenTargetThreat = m_creature->getThreatManager().getThreat(pFeugenTarget); } // Switch Feugen's target from Stalagg if (pStalagg && pStalagg->isAlive()) { if (pFeugen && pFeugen->isAlive()) { HostilReference* ref = pFeugen->getThreatManager().getOnlineContainer().getReferenceByTarget(pFeugenTarget); if (ref) { pStalagg->CastSpell(pFeugenTarget, 54517, true); ((Player*)pFeugenTarget)->TeleportTo(pFeugenTarget->GetMapId(), pStalagg->GetPositionX(), pStalagg->GetPositionY(), pStalagg->GetPositionZ(), 0, TELE_TO_NOT_LEAVE_COMBAT); ref->removeReference(); pStalagg->AddThreat(pFeugenTarget, FeugenTargetThreat); pStalagg->AI()->AttackStart(pFeugenTarget); } } } // Switch Stalagg's target from Feugen if (pFeugen && pFeugen->isAlive()) { if (pStalagg && pStalagg->isAlive()) { HostilReference* ref = pStalagg->getThreatManager().getOnlineContainer().getReferenceByTarget(pStalaggTarget); if (ref) { pFeugen->CastSpell(pStalaggTarget, 54517, true); ((Player*)pStalaggTarget)->TeleportTo(pStalaggTarget->GetMapId(), pFeugen->GetPositionX(), pFeugen->GetPositionY(), pFeugen->GetPositionZ(), 0, TELE_TO_NOT_LEAVE_COMBAT); ref->removeReference(); pFeugen->AddThreat(pStalaggTarget, StalaggTargetThreat); pFeugen->AI()->AttackStart(pStalaggTarget); } } } SwitchTarget_Timer = 20000; }else SwitchTarget_Timer -= uiDiff; } else if (pStalagg->isInCombat() || pFeugen->isInCombat()) { if (m_pInstance) m_pInstance->SetData(TYPE_THADDIUS, IN_PROGRESS); } else if (!pStalagg->isInCombat() && !pFeugen->isInCombat()) { if (m_pInstance) m_pInstance->SetData(TYPE_THADDIUS, NOT_STARTED); } Active_Timer = 1000; } } }else Active_Timer -= uiDiff; } if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; if (ChainLightning_Timer < uiDiff) { DoCast(m_creature, m_bIsHeroicMode ? H_SPELL_CHAIN_LIGHTNING : SPELL_CHAIN_LIGHTNING); ChainLightning_Timer = 15000; }else ChainLightning_Timer -= uiDiff; if(m_bIsPolarityShift) { // workaround for POLARITY_SHIFT if (PolarityShift_Timer < uiDiff) { Map *map = m_creature->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); if (PlayerList.isEmpty()) return; for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) { switch(rand()%2) { case 0: if (i->getSource()->HasAura(SPELL_CHARGE_NEGATIVE_NEARDMG)) i->getSource()->RemoveAurasDueToSpell(SPELL_CHARGE_NEGATIVE_NEARDMG); i->getSource()->CastSpell(i->getSource(), SPELL_CHARGE_POSITIVE_NEARDMG, true); break; case 1: if (i->getSource()->HasAura(SPELL_CHARGE_POSITIVE_NEARDMG)) i->getSource()->RemoveAurasDueToSpell(SPELL_CHARGE_POSITIVE_NEARDMG); i->getSource()->CastSpell(i->getSource(), SPELL_CHARGE_NEGATIVE_NEARDMG, true); break; } } } m_bIsPolarityShift = false; PolarityShift_Timer = 27000; }else PolarityShift_Timer -= uiDiff; } else { if(PolarityShift_Timer < uiDiff) { DoCast(m_creature, SPELL_POLARITY_SHIFT); // need core support m_bIsPolarityShift = true; PolarityShift_Timer = 3000; }else PolarityShift_Timer -= uiDiff; } if (Enrage_Timer < uiDiff) { DoCast(m_creature, SPELL_BESERK); Enrage_Timer = 300000; }else Enrage_Timer -= uiDiff; if (Scream_Timer < uiDiff) { switch(rand()%4) { case 0: DoScriptText(SAY_SCREAM1, m_creature);break; case 1: DoScriptText(SAY_SCREAM2, m_creature);break; case 2: DoScriptText(SAY_SCREAM3, m_creature);break; case 3: DoScriptText(SAY_SCREAM4, m_creature);break; } Scream_Timer = 60000+rand()%30000; }else Scream_Timer -= uiDiff; if (RangeCheck_Timer < uiDiff) { m_bInMeleeRange = false; std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //if in melee range if (pTarget && pTarget->IsWithinDistInMap(m_creature, ATTACK_DISTANCE)) { m_bInMeleeRange = true; break; } } if (!m_bInMeleeRange) DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO,0), SPELL_BALL_LIGHTNING); RangeCheck_Timer = 2000; }else RangeCheck_Timer -= uiDiff; //if nobody is in melee range if (m_bInMeleeRange) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_STATIC_DISRUPTION: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); if (target) { TargetGUID = target->GetGUID(); DoCast(target, SPELL_STATIC_DISRUPTION, false); me->SetInFront(me->GetVictim()); } /*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(10000, 18000)); break; } case EVENT_GUST_OF_WIND: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); if (target) DoCast(target, SPELL_GUST_OF_WIND); events.ScheduleEvent(EVENT_GUST_OF_WIND, urand(20000, 30000)); break; } case EVENT_CALL_LIGHTNING: DoCastVictim(SPELL_CALL_LIGHTNING); events.ScheduleEvent(EVENT_CALL_LIGHTNING, urand(12000, 17000)); // totaly random timer. can't find any info on this break; case EVENT_ELECTRICAL_STORM: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!target) { EnterEvadeMode(); return; } target->CastSpell(target, 44007, true); // cloud visual DoCast(target, SPELL_ELECTRICAL_STORM, false); // storm cyclon + visual float x, y, z; target->GetPosition(x, y, z); /// @todo: fix it in correct way, that causes player to can fly until logout /* if (target) { target->SetDisableGravity(true); target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0); } */ Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetDisableGravity(true); Cloud->StopMoving(); Cloud->SetObjectScale(1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } StormCount = 1; events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 60000); // 60 seconds(bosskillers) events.ScheduleEvent(EVENT_RAIN, urand(47000, 52000)); break; } case EVENT_RAIN: if (!isRaining) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } else events.ScheduleEvent(EVENT_RAIN, 1000); break; case EVENT_STORM_SEQUENCE: { Unit* target = ObjectAccessor::GetUnit(*me, CloudGUID); if (!target || !target->IsAlive()) { EnterEvadeMode(); return; } else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, CycloneGUID)) Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or... HandleStormSequence(target); break; } case EVENT_SUMMON_EAGLES: Talk(SAY_SUMMON); float x, y, z; me->GetPosition(x, y, z); for (uint8 i = 0; i < 8; ++i) { Unit* bird = ObjectAccessor::GetUnit(*me, BirdGUIDs[i]); if (!bird) //they despawned on die { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { x = target->GetPositionX() + irand(-10, 10); y = target->GetPositionY() + irand(-10, 10); z = target->GetPositionZ() + urand(16, 20); if (z > 95) z = 95.0f - urand(0, 5); } Creature* creature = me->SummonCreature(NPC_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (creature) { creature->AddThreat(me->GetVictim(), 1.0f); creature->AI()->AttackStart(me->GetVictim()); BirdGUIDs[i] = creature->GetGUID(); } } } break; case EVENT_ENRAGE: Talk(SAY_ENRAGE); DoCast(me, SPELL_BERSERK, true); events.ScheduleEvent(EVENT_ENRAGE, 600000); break; default: break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (Intro && !Done) { if (AggroTimer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Talk(SAY_AGGRO); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Done = true; if (AggroTargetGUID) { Unit* unit = Unit::GetUnit(*me, AggroTargetGUID); if (unit) AttackStart(unit); DoZoneInCombat(); } else { EnterEvadeMode(); return; } } else AggroTimer -= diff; } if (!UpdateVictim() || !Done) return; if (SummonShadowsTimer <= diff) { //MindControlGhost(); for (uint8 i = 0; i < 2; ++i) { Creature* Shadow = NULL; float X = CalculateRandomLocation(me->GetPositionX(), 10); Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); if (Shadow) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); if (target) Shadow->AI()->AttackStart(target); } } SummonShadowsTimer = 60000; } else SummonShadowsTimer -= diff; if (SummonDoomBlossomTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { float X = CalculateRandomLocation(target->GetPositionX(), 20); float Y = CalculateRandomLocation(target->GetPositionY(), 20); float Z = target->GetPositionZ(); Z = me->GetMap()->GetHeight(me->GetPhaseMask(), X, Y, Z); Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); if (DoomBlossom) { DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoomBlossom->setFaction(me->getFaction()); DoomBlossom->AddThreat(target, 1.0f); CAST_AI(mob_doom_blossom::mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); target->CombatStart(DoomBlossom); SetThreatList(DoomBlossom); SummonDoomBlossomTimer = 35000; } } } else SummonDoomBlossomTimer -= diff; if (IncinerateTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); if (target) { Talk(SAY_SPECIAL); DoCast(target, SPELL_INCINERATE); IncinerateTimer = urand(20, 51) * 1000; } } else IncinerateTimer -= diff; if (CrushingShadowsTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target && target->isAlive()) DoCast(target, SPELL_CRUSHING_SHADOWS); CrushingShadowsTimer = urand(10, 26) * 1000; } else CrushingShadowsTimer -= diff; /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/ /*if (ShadowOfDeathTimer <= diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); if (target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) { DoCast(target, SPELL_SHADOW_OF_DEATH); GhostGUID = target->GetGUID(); ShadowOfDeathTimer = 30000; SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player } } else ShadowOfDeathTimer -= diff;*/ if (RandomYellTimer <= diff) { Talk(SAY_SPELL); RandomYellTimer = urand(50, 101) * 1000; } else RandomYellTimer -= diff; if (!me->HasAura(SPELL_BERSERK)) { if (EnrageTimer <= diff) { DoCast(me, SPELL_BERSERK); Talk(SAY_ENRAGE); } else EnrageTimer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; if(CheckKilrekTimer < diff) { CheckKilrekTimer = 5000; if(pInstance) uint64 KilrekGUID = pInstance->GetData64(DATA_KILREK); else ERROR_INST_DATA(me); Creature* Kilrek = (Unit::GetCreature(*me, pInstance->GetData64(DATA_KILREK))); if(SummonKilrek && Kilrek) { Kilrek->Respawn(); if(Kilrek->AI()) { Kilrek->AI()->AttackStart(me->getVictim()); me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); } else DoCast(me, SPELL_SUMMON_IMP, true); } if(!Kilrek || !Kilrek->isDead()) { DoCast(me, SPELL_SUMMON_IMP, true); CheckKilrekTimer = 40000; } }else CheckKilrekTimer -= diff; if(SacrificeTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if (target && target->isAlive()) { DoCast(target, SPELL_SACRIFICE, true); Creature* Chains = me->SummonCreature(CREATURE_DEMONCHAINS, -11234.077148, -1698.314209, 179.237320, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000); if(Chains) { CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me); SacrificeTimer = 30000; } } }else SacrificeTimer -= diff; if(ShadowboltTimer < diff) { DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); ShadowboltTimer = 10000; }else ShadowboltTimer -= diff; if(SummonTimer < diff) { if(!SummonedPortals) { for(uint8 i = 0; i < 2; ++i) { Creature* Portal = me->SummonCreature(CREATURE_PORTAL, PortalLocations[i][0], PortalLocations[i][1], PORTAL_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if(Portal) PortalGUID[i] = Portal->GetGUID(); } SummonedPortals = true; switch(rand()%2) { case 0: DoScriptText(SAY_SUMMON1, me); break; case 1: DoScriptText(SAY_SUMMON2, me); break; } } uint32 random = rand()%2; Creature* Imp = me->SummonCreature(CREATURE_FIENDISHIMP, PortalLocations[random][0], PortalLocations[random][1], PORTAL_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000); if(Imp) { Imp->AddThreat(me->getVictim(), 1.0f); Imp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1)); } SummonTimer = 5000; }else SummonTimer -= diff; if(!Berserk) { if(BerserkTimer < diff) { DoCast(me, SPELL_BERSERK); Berserk = true; }else BerserkTimer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!SisterDeath) { if (pInstance) { Unit* Temp = NULL; Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { DoScriptText(YELL_SISTER_ALYTHESS_DEAD, m_creature); DoCast(m_creature, SPELL_EMPOWER); m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; } } } if (!UpdateVictim()) return; if (SisterDeath) { if (ConflagrationTimer <= diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); } } else ConflagrationTimer -= diff; } else { if (ShadownovaTimer <= diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_SHADOW_NOVA); if (!SisterDeath) { if (pTarget) DoScriptText(EMOTE_SHADOW_NOVA, m_creature, pTarget); DoScriptText(YELL_SHADOW_NOVA, m_creature); } ShadownovaTimer = 30000+(rand()%5000); } } else ShadownovaTimer -=diff; } if (ConfoundingblowTimer <= diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_CONFOUNDING_BLOW); ConfoundingblowTimer = 20000 + (rand()%5000); } } else ConfoundingblowTimer -=diff; if (ShadowimageTimer <= diff) { Unit *pTarget = NULL; Creature* temp = NULL; for (uint8 i = 0; i<3; ++i) { pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); if (temp && pTarget) { temp->AddThreat(pTarget,1000000);//don't change target(healers) temp->AI()->AttackStart(pTarget); } } ShadowimageTimer = 20000; } else ShadowimageTimer -=diff; if (ShadowbladesTimer <= diff) { if (!m_creature->IsNonMeleeSpellCasted(false)) { DoCast(m_creature, SPELL_SHADOW_BLADES); ShadowbladesTimer = 10000; } } else ShadowbladesTimer -=diff; if (EnrageTimer < diff && !Enraged) { m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); DoScriptText(YELL_ENRAGE, m_creature); DoCast(m_creature, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { //If we are within range melee the target if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) { HandleTouchedSpells(m_creature->getVictim(), SPELL_DARK_TOUCHED); m_creature->AttackerStateUpdate(m_creature->getVictim()); m_creature->resetAttackTimer(); } } }
void UpdateAI(uint32 diff) { if (!me->IsInCombat()) return; if (IsBanished) { // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check if (me->getThreatManager().getThreatList().size() < 2) { EnterEvadeMode(); return; } if (DefenderTimer <= diff) { uint32 ran = rand()%2; Creature* Defender = me->SummonCreature(NPC_DEFENDER, SpawnLocations[ran].x, SpawnLocations[ran].y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); if (Defender) { Defender->SetWalk(false); bool move = true; if (AkamaGUID) { if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID)) { float x, y, z; Akama->GetPosition(x, y, z); // They move towards AKama Defender->GetMotionMaster()->MovePoint(0, x, y, z); Defender->AI()->AttackStart(Akama); } else move = false; } else move = false; if (!move) Defender->GetMotionMaster()->MovePoint(0, AKAMA_X, AKAMA_Y, AKAMA_Z); } DefenderTimer = 15000; } else DefenderTimer -= diff; if (SummonTimer <= diff) { SummonCreature(); SummonTimer = 35000; } else SummonTimer -= diff; if (DeathCount >= 6) { if (AkamaGUID) { Creature* Akama = Unit::GetCreature((*me), AkamaGUID); if (Akama && Akama->IsAlive()) { IsBanished = false; me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveChase(Akama); Akama->GetMotionMaster()->Clear(); // Shade should move to Akama, not the other way around Akama->GetMotionMaster()->MoveIdle(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Crazy amount of threat me->AddThreat(Akama, 10000000.0f); Akama->AddThreat(me, 10000000.0f); me->Attack(Akama, true); Akama->Attack(me, true); } } } } else // No longer banished, let's fight Akama now { if (ReduceHealthTimer <= diff) { if (AkamaGUID) { Creature* Akama = Unit::GetCreature((*me), AkamaGUID); if (Akama && Akama->IsAlive()) { //10 % less health every few seconds. me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); ReduceHealthTimer = 12000; } } } else ReduceHealthTimer -= diff; if (HasKilledAkama) { if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug { HasKilledAkamaAndReseting = true; me->RemoveAllAuras(); me->DeleteThreatList(); me->CombatStop(); //me->SetFullHealth(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->GetMotionMaster()->MoveTargetedHome(); } if (ResetTimer <= diff) { EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama return; } else ResetTimer -= diff; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (Channeling == true) { for(int ind = 0 ; ind < 4; ind++) m_creature->CastSpell(m_creature->getVictim(),SPELL_SUMMON_CARRION_BEETLES,true); Channeling = false; } if (Phase == 1) { if (SPELL_IMPALE_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) m_creature->CastSpell(target, HEROIC(SPELL_IMPALE,H_SPELL_IMPALE), true); SPELL_IMPALE_Timer = 9000; }else SPELL_IMPALE_Timer -= diff; if(!Summoned_Guardian) { Creature* Guardian; for(uint8 i=0; i < 2; ++i) { Guardian = m_creature->SummonCreature(CREATURE_GUARDIAN,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Guardian) { Guardian->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Guardian); } } Summoned_Guardian = true; } if(!Summoned_Venomancer) { if(VENOMANCER_Timer < diff) { if(Phase_Time > 1) { Creature* Venomancer; for(uint8 i=0; i < 2; ++i) { Venomancer = m_creature->SummonCreature(CREATURE_VENOMANCER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Venomancer) { Venomancer->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Venomancer); } } Summoned_Venomancer = true; } }else VENOMANCER_Timer -= diff; } if(!Summoned_Datter) { if(DATTER_Timer < diff) { if(Phase_Time > 2) { Creature* Datter; for(uint8 i=0; i < 2; ++i) { Datter = m_creature->SummonCreature(CREATURE_DATTER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Datter) { Datter->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Datter); } } Summoned_Datter = true; } }else DATTER_Timer -= diff; } if (UNDERGROUND_Timer < diff) { m_creature->RemoveAura(SPELL_SUBMERGE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Phase = 0; }else UNDERGROUND_Timer -= diff; } if (Phase == 0) { if (SPELL_LEECHING_SWARM_Timer < diff) { m_creature->CastSpell(m_creature,SPELL_LEECHING_SWARM,true); SPELL_LEECHING_SWARM_Timer = 19000; }else SPELL_LEECHING_SWARM_Timer -= diff; if (SPELL_CARRION_BEETLES_Timer < diff) { Channeling = true; m_creature->CastSpell(m_creature->getVictim(),SPELL_CARRION_BEETLES,false); SPELL_CARRION_BEETLES_Timer = 25000; }else SPELL_CARRION_BEETLES_Timer -= diff; if (SPELL_POUND_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_POUND,H_SPELL_POUND)); SPELL_POUND_Timer = 16500; }else SPELL_POUND_Timer -= diff; } if ((Phase_Time == 0 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75) || (Phase_Time == 1 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50) || (Phase_Time == 2 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 25)) { ++Phase_Time; Summoned_Guardian = false; Summoned_Venomancer = false; Summoned_Datter = false; UNDERGROUND_Timer = 40000; VENOMANCER_Timer = 25000; DATTER_Timer = 32000; m_creature->CastSpell(m_creature,SPELL_SUBMERGE,false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Phase = 1; } if (!Phase == 1) { DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostilTarget() && !m_creature->getVictim()) return; if(StormCount) { Unit* target = Unit::GetUnit(*m_creature, CloudGUID); if(!target || !target->isAlive()) { EnterEvadeMode(); return; } else if(Unit* Cyclone = Unit::GetUnit(*m_creature, CycloneGUID)) Cyclone->CastSpell(target, 25160, true); // keep casting or... if(StormSequenceTimer < diff) { HandleStormSequence(target); }else StormSequenceTimer -= diff; return; } if (Enrage_Timer < diff) { DoYell(SAY_ONENRAGE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONENRAGE); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); Enrage_Timer = 600000; }else Enrage_Timer -= diff; if (StaticDisruption_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if(!target) target = m_creature->getVictim(); TargetGUID = target->GetGUID(); m_creature->CastSpell(target, SPELL_STATIC_DISRUPTION, false); m_creature->SetInFront(m_creature->getVictim()); StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s float dist = m_creature->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); if (dist < 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f); }else StaticDisruption_Timer -= diff; if (SDisruptAOEVisual_Timer < diff) { Unit* SDVictim = Unit::GetUnit((*m_creature), TargetGUID); if(SDVictim && SDVictim->isAlive()) SDVictim->CastSpell(SDVictim, SPELL_STATIC_VISUAL, true); SDisruptAOEVisual_Timer = 99999; TargetGUID = 0; }else SDisruptAOEVisual_Timer -= diff; if (GustOfWind_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); if(!target) target = m_creature->getVictim(); DoCast(target, SPELL_GUST_OF_WIND); GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; if (CallLighting_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_CALL_LIGHTNING); CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } if (ElectricalStorm_Timer < diff) { Unit* target = SelectRandomPlayer(50); if(!target) target = m_creature->getVictim(); float x, y, z; target->GetPosition(x, y, z); Creature *Cloud = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, m_creature->GetPositionZ() + 10, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); if(Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->AddMonsterMoveFlag(MONSTER_MOVE_LEVITATING); Cloud->StopMoving(); Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->CastSpell(Cloud, 45213, true); // cloud visual m_creature->StopMoving(); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->CastSpell(Cloud, 43501, false); // siphon soul } Unit *Cyclone = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); if(Cyclone) { Cyclone->CastSpell(Cyclone, 25160, true); // wind visual CycloneGUID = Cyclone->GetGUID(); } ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) StormCount = 1; StormSequenceTimer = 0; } else ElectricalStorm_Timer -= diff; if (SummonEagles_Timer < diff) { DoYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ONSUMMON); float x, y, z; m_creature->GetPosition(x, y, z); for (uint8 i = 0; i < 6 + rand()%3; i++) { if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { x = target->GetPositionX() + 10 - rand()%20; y = target->GetPositionY() + 10 - rand()%20; z = target->GetPositionZ() + 6 + rand()%5 + 10; if(z > 95) z = 95 - rand()%5; } Creature *pCreature = m_creature->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (pCreature) { pCreature->AddThreat(m_creature->getVictim(), 1.0f); pCreature->AI()->AttackStart(m_creature->getVictim()); } } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; DoMeleeAttackIfReady(); }
void instance_blackwing_lair::Update(uint32 uiDiff) { //IN_PROGRESS = Razorgore Phase 1 if (GetData(TYPE_RAZORGORE) == IN_PROGRESS) { if (m_uiRazorgoreSummonTimer <= uiDiff) { if (Creature* pRazorgore = GetSingleCreatureFromStorage(NPC_RAZORGORE)) { for (uint32 i = 0; i < 8; i++) { /* SPAWNS BY VALUE * =========== * 0 = nothing * 1 - 3 = orc * 4 = dragon */ uint8 orcCount = 0; if (m_uiOrcSummoned < MAX_BLACKWING_ORC) orcCount = 3; uint8 dragonCount = 0; if (m_uiDragonkinSummoned < MAX_BLACKWING_DRAGONKIN) dragonCount = 1; if (orcCount || dragonCount) { uint32 spawnType = urand(1, orcCount + dragonCount); if (!orcCount) spawnType = 4; Creature* spawnedOrcs = 0; Creature* spawnedDragon = 0; if (spawnType < 4) { ++m_uiOrcSummoned; spawnedOrcs = pRazorgore->SummonCreature(urand(0, 1) ? NPC_BLACKWING_LEGIONNAIRE : NPC_BLACKWING_MAGE, Corner[i].x, Corner[i].y, Corner[i].z, Corner[i].o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); } else { ++m_uiDragonkinSummoned; spawnedDragon = pRazorgore->SummonCreature(NPC_DEATH_TALON_DRAGONSPAWN, Corner[i].x, Corner[i].y, Corner[i].z, Corner[i].o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); } //All adds have initial aggro on the Razorgore controller. The mage types will run to the center of the room and start to attack the controller with their ranged fireballs Unit* pController = pRazorgore->GetCharmerOrOwner(); if (spawnedOrcs) { razorgoreAdds.push_back(spawnedOrcs); if (pController && pController->isAlive()) spawnedOrcs->AI()->AttackStart(pController); else { if (Unit* pTarget = spawnedOrcs->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) spawnedOrcs->AI()->AttackStart(pTarget); } } if (spawnedDragon) { razorgoreAdds.push_back(spawnedDragon); if (pRazorgore->isAlive()) { spawnedDragon->AI()->AttackStart(pRazorgore); spawnedDragon->AddThreat(pRazorgore, 100.0f); } else { if (Unit* pTarget = spawnedDragon->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) spawnedDragon->AI()->AttackStart(pTarget); } } } } } m_uiRazorgoreSummonTimer = TIMER_NEXT_ADD_SPAWN; } else m_uiRazorgoreSummonTimer -= uiDiff; } /*if (GetData(TYPE_RAZORGORE) == DONE) { HandleGameObject(GO_PORTCULLIS_RAZORGORE, true); for(auto& creature : m_lBlackwingGuardsman) { if (Creature* guardsman = instance->GetCreature(creature)) guardsman->ForcedDespawn(); } if (Creature* grethok = GetSingleCreatureFromStorage(NPC_GRETHOK_THE_CONTROLLER)) grethok->ForcedDespawn(); }*/ if (m_uiChromaggusPullTimer) { if (m_uiChromaggusPullTimer <= uiDiff) { if (Creature* pChromaggus = GetSingleCreatureFromStorage(NPC_CHROMAGGUS)) { pChromaggus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pChromaggus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pChromaggus->SetInCombatWithZone(); } m_uiChromaggusPullTimer = 0; } else m_uiChromaggusPullTimer -= uiDiff; } if (m_uiGuardsmanManager && !m_uiGuardsmanManager) { if (m_uiGuardsmanManagerTimer <= uiDiff) { for (auto& creature : m_lBlackwingGuardsman) { if (Creature* pGuardsmans = instance->GetCreature(creature)) { if (pGuardsmans->isDead() && GetData(TYPE_RAZORGORE) != DONE && GetData(TYPE_RAZORGORE) != SPECIAL && GetData(TYPE_RAZORGORE) != IN_PROGRESS && GetData(TYPE_RAZORGORE) != FAIL) pGuardsmans->Respawn(); m_uiGuardsmanManager = false; } } m_uiGuardsmanManagerTimer = 30000; } else m_uiGuardsmanManagerTimer -= uiDiff; } if (m_uiGrethokManager && !m_uiGrethokManager) { if (m_uiGrethokManagerTimer <= uiDiff) { if (Creature* pGrethok = GetSingleCreatureFromStorage(NPC_GRETHOK_THE_CONTROLLER)) { if (pGrethok->isDead() && GetData(TYPE_RAZORGORE) != DONE && GetData(TYPE_RAZORGORE) != SPECIAL && GetData(TYPE_RAZORGORE) != IN_PROGRESS && GetData(TYPE_RAZORGORE) != FAIL) pGrethok->Respawn(); m_uiGrethokManager = false; } m_uiGrethokManagerTimer = 30000; } else m_uiGrethokManagerTimer -= uiDiff; } if (m_uiRazorgorManager) { if (m_uiRazorgorManagerTimer <= uiDiff) { if (Creature* pRazorgore = GetSingleCreatureFromStorage(NPC_RAZORGORE)) { if (pRazorgore->isDead() && GetData(TYPE_RAZORGORE) != DONE) SetData(TYPE_RAZORGORE, DONE); m_uiRazorgorManager = false; } m_uiRazorgorManagerTimer = 30000; } else m_uiRazorgorManagerTimer -= uiDiff; } if (m_uiVealManager) { if (m_uiVealManagerTimer <= uiDiff) { if (Creature* pVeal = GetSingleCreatureFromStorage(NPC_VAELASTRASZ)) { if (pVeal->isDead() && GetData(TYPE_VAELASTRASZ) != DONE) SetData(TYPE_VAELASTRASZ, DONE); m_uiVealManager = false; } m_uiVealManagerTimer = 30000; } else m_uiVealManagerTimer -= uiDiff; } /*if (m_uiLashLayerManager) { if (m_uiLashLayerManagerTimer <= uiDiff) { if (Creature* pLash = GetSingleCreatureFromStorage(NPC_LASHLAYER)) { if (pLash->isDead() && GetData(TYPE_LASHLAYER) != DONE) SetData(TYPE_LASHLAYER, DONE); m_uiLashLayerManager = false; } m_uiLashLayerManagerTimer = 30000; } else m_uiLashLayerManagerTimer -= uiDiff; }*/ if (m_uiChromaggusManager) { if (m_uiChromaggusManagerTimer <= uiDiff) { if (Creature* pChromaggus = GetSingleCreatureFromStorage(NPC_CHROMAGGUS)) { if (pChromaggus->isDead() && GetData(TYPE_CHROMAGGUS) != DONE) SetData(TYPE_CHROMAGGUS, DONE); m_uiChromaggusManager = false; } m_uiChromaggusManagerTimer = 30000; } else m_uiChromaggusManagerTimer -= uiDiff; }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (SummonKilrekTimer <= diff && SummonedKilrek == false) { Creature* Kilrek = me->SummonCreature(CREATURE_KILREK, -11237.955078, -1693.597412, 179.237823, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000); if (Kilrek) { Kilrek->SetReactState(REACT_AGGRESSIVE); Kilrek->AddThreat(me->GetVictim(), 1.0f); Kilrek->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1)); SummonedKilrek = true; } } else SummonKilrekTimer -= diff; if (ReSummonKilrek_Timer <= diff && SummonedKilrek == true && ReSummonedKilrek == false) { if (me->HasAura(SPELL_BROKEN_PACT, 0)) me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); Creature* Kilrek = me->SummonCreature(CREATURE_KILREK, -11237.955078, -1693.597412, 179.237823, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000); if (Kilrek) { Kilrek->SetReactState(REACT_AGGRESSIVE); Kilrek->AddThreat(me->GetVictim(), 1.0f); Kilrek->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1)); ReSummonedKilrek = true; } } else ReSummonKilrek_Timer -= diff; if (SacrificeTimer <= diff) { Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); // target tank as well patch pre 2.1.0 if (pTarget && pTarget->IsAlive()) { DoCast(pTarget, SPELL_SACRIFICE, true); me->SummonCreature(17248, -11233.81f, -1698.38f, 179.236f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30500); if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000)) { CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID(); Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); DoScriptText(RAND(SAY_SACRIFICE1, SAY_SACRIFICE2), me); SacrificeTimer = 30000; } } } else SacrificeTimer -= diff; if (ShadowboltTimer <= diff) { DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); ShadowboltTimer = 10000; } else ShadowboltTimer -= diff; if (SummonTimer <= diff) { if (!SummonedPortals) { for (uint8 i = 0; i < 2; ++i) { Creature* Portal = me->SummonCreature(CREATURE_PORTAL, PortalLocations[i][0], PortalLocations[i][1], PORTAL_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (Portal) PortalGUID[i] = Portal->GetGUID(); } SummonedPortals = true; } uint32 random = rand() % 2; Creature* Imp = me->SummonCreature(CREATURE_FIENDISHIMP, PortalLocations[random][0], PortalLocations[random][1], PORTAL_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000); if (Imp) { Imp->AddThreat(me->GetVictim(), 1.0f); Imp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } SummonTimer = urand(1500, 5000); } else SummonTimer -= diff; if (!Berserk) { if (BerserkTimer <= diff) { DoCast(me, SPELL_BERSERK); Berserk = true; } else BerserkTimer -= diff; } DoMeleeAttackIfReady(); }
//Called at World update tick void UpdateAI(uint32 const diff) { if (!me->getVictim()) { if (!Unit::GetCreature(*me, m_uiJalootGuid)) { if (TempSummon* jaloot = me->SummonCreature(NPC_JALOOT, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS)) { m_uiJalootGuid = jaloot->GetGUID(); jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } else { if (Creature * jaloot = Unit::GetCreature(*me, m_uiJalootGuid)) if (jaloot->isAlive() && me->isAlive()) { jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } if (!Unit::GetCreature(*me, m_uiZepikGuid)) { if (TempSummon* zepik = me->SummonCreature(NPC_ZEPIK, SpawnLocations[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS)) { m_uiZepikGuid = zepik->GetGUID(); zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } else { if (Creature * zepik = Unit::GetCreature(*me, m_uiZepikGuid)) if (zepik->isAlive() && me->isAlive()) { zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } } //Return since we have no target if (!UpdateVictim()) return; if (HealthBelowPct(30) && m_uiArtriusPhase == 0) { m_uiArtriusPhase = 1; if (Creature* jaloot = Unit::GetCreature(*me, m_uiJalootGuid)) { jaloot->RemoveAllAuras(); jaloot->setFaction(FACTION_MONSTER); jaloot->SetInCombatWith(me->getVictim()); jaloot->AddThreat(me->getVictim(), 0.0f); me->CastSpell(jaloot, SPELL_BINDINGS_OF_SUBMISSION); } if (Creature* zepik = Unit::GetCreature(*me, m_uiZepikGuid)) { zepik->RemoveAllAuras(); zepik->setFaction(FACTION_MONSTER); zepik->SetInCombatWith(me->getVictim()); zepik->AddThreat(me->getVictim(), 0.0f); me->CastSpell(zepik, SPELL_BINDINGS_OF_SUBMISSION); } } if ( m_uiArtriusPhase == 0 || m_uiArtriusPhase == 2 ) { if ( m_uiFrostboltTimer <= diff ) { DoCast(me->getVictim(), SPELL_FROSTBOLT); m_uiFrostboltTimer = 5 * IN_MILLISECONDS; } else m_uiFrostboltTimer -= diff; if ( m_uiFrostNovaTimer <= diff ) { if ( me->IsInRange(me->getVictim(), 5.0f, 10.0f) ) { DoCast(SPELL_FROST_NOVA); m_uiFrostNovaTimer = 5 * IN_MILLISECONDS; } } else m_uiFrostNovaTimer -= diff; if ( m_uiIceLanceTimer <= diff ) { if (me->getVictim()->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) { DoCast(me->getVictim(), SPELL_ICE_LANCE); m_uiIceLanceTimer = 5 * IN_MILLISECONDS; } } else m_uiIceLanceTimer -= diff; if ( m_uiIcyVeinsTimer <= diff ) { if (!me->HasUnitState(UNIT_STATE_CASTING)) { DoCast(SPELL_ICY_VEINS); m_uiIcyVeinsTimer = 25 * IN_MILLISECONDS; } } else m_uiIcyVeinsTimer -= diff; } else { Creature* jaloot = Unit::GetCreature(*me, m_uiJalootGuid); Creature* zepik = Unit::GetCreature(*me, m_uiZepikGuid); if (!jaloot || !zepik) return; if (jaloot->isDead()) { m_uiArtriusPhase = 2; me->RemoveAllAuras(); zepik->RestoreFaction(); zepik->SetInCombatWith(me); zepik->AddThreat(me, 0.0f); } if (zepik->isDead()) { m_uiArtriusPhase = 2; me->RemoveAllAuras(); jaloot->RestoreFaction(); jaloot->SetInCombatWith(me); jaloot->AddThreat(me, 0.0f); } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictimWithGaze() || !CheckInRoom()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_WOUND: DoCast(me->getVictim(), SPELL_MORTAL_WOUND); events.ScheduleEvent(EVENT_WOUND, 10000); break; case EVENT_ENRAGE: // TODO : Add missing text DoCast(me, SPELL_ENRAGE); events.ScheduleEvent(EVENT_ENRAGE, 15000); break; case EVENT_DECIMATE: // TODO : Add missing text DoCastAOE(SPELL_DECIMATE); events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(120000,90000)); for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { Creature *minion = Unit::GetCreature(*me, *itr); if (minion && minion->isAlive() ) { //hack int32 damage = int32(minion->GetHealth()) - int32(minion->CountPctFromMaxHealth(5)); if (damage > 0) me->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, minion, true); if(minion->AI()) //is useless { minion->GetMotionMaster()->MoveChase(me); minion->AddThreat(me,9999999); } } } break; case EVENT_BERSERK: if(!me->HasAura(SPELL_BERSERK)) DoCast(me, SPELL_BERSERK); events.ScheduleEvent(EVENT_BERSERK, 1*60000); break; case EVENT_SUMMON: for (int32 i = 0; i < RAID_MODE(1, 2); ++i) DoSummon(MOB_ZOMBIE, PosSummon[RAID_MODE(0,rand() % 3)]); events.ScheduleEvent(EVENT_SUMMON, 10000); break; } } if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) { if (me->IsWithinMeleeRange(me->getVictim())) { me->Kill(me->getVictim()); me->ModifyHealth(int32(me->CountPctFromMaxHealth(5))); } } else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiEnfeebleResetTimer) { if (m_uiEnfeebleResetTimer <= uiDiff) //Let's not forget to reset that { EnfeebleResetHealth(); m_uiEnfeebleResetTimer=0; } else m_uiEnfeebleResetTimer -= uiDiff; } if (m_creature->hasUnitState(UNIT_STAT_STUNNED)) //While shifting to m_uiPhase 2 m_malchezaarGuid stuns himself return; if (m_creature->GetTargetGuid() != m_creature->getVictim()->GetObjectGuid()) m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); if (m_uiPhase == 1) { if (m_creature->GetHealthPercent() < 60.0f) { m_creature->InterruptNonMeleeSpells(false); m_uiPhase = 2; //animation DoCastSpellIfCan(m_creature, SPELL_EQUIP_AXES); //text DoScriptText(SAY_AXE_TOSS1, m_creature); //passive thrash aura m_creature->CastSpell(m_creature, SPELL_THRASH_AURA, true); //models SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); //damage const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); m_creature->UpdateDamagePhysical(BASE_ATTACK); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); //Sigh, updating only works on main attack , do it manually .... m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100); } } else if (m_uiPhase == 2) { if (m_creature->GetHealthPercent() < 30.0f) { InfernalTimer = 15000; m_uiPhase = 3; ClearWeapons(); //remove thrash m_creature->RemoveAurasDueToSpell(SPELL_THRASH_AURA); DoScriptText(SAY_AXE_TOSS2, m_creature); Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); for (uint32 i = 0; i < 2; ++i) { Creature* pAxe = m_creature->SummonCreature(MALCHEZARS_AXE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (pAxe) { pAxe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pAxe->setFaction(m_creature->getFaction()); m_aAxeGuid[i] = pAxe->GetObjectGuid(); if (pTarget) { pAxe->AI()->AttackStart(pTarget); // pAxe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly // So we'll use a hack to add a lot of threat to our pTarget pAxe->AddThreat(pTarget, 10000000.0f); } } } if (m_uiShadowNovaTimer > 35000) m_uiShadowNovaTimer = m_uiEnfeebleTimer + 5000; return; } if (SunderArmorTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR); SunderArmorTimer = urand(10000, 18000); } else SunderArmorTimer -= uiDiff; if (m_uiCleave_Timer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleave_Timer = urand(6000, 12000); } else m_uiCleave_Timer -= uiDiff; } else { if (m_uiAxesTargetSwitchTimer < uiDiff) { m_uiAxesTargetSwitchTimer = urand(7500, 20000); Unit *target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) { for(int i = 0; i < 2; ++i) { Creature *axe = m_creature->GetMap()->GetCreature(m_aAxeGuid[i]); if (axe) { float threat = 1000000.0f; if (axe->getVictim() && m_creature->getThreatManager().getThreat(axe->getVictim())) { threat = axe->getThreatManager().getThreat(axe->getVictim()); axe->getThreatManager().modifyThreatPercent(axe->getVictim(), -100); } if (target) axe->AddThreat(target, threat); //axe->getThreatManager().tauntFadeOut(axe->getVictim()); //axe->getThreatManager().tauntApply(target); } } } } else m_uiAxesTargetSwitchTimer -= uiDiff; if (m_uiAmplifyDamageTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCastSpellIfCan(pTarget, SPELL_AMPLIFY_DAMAGE); m_uiAmplifyDamageTimer = urand(20000, 30000); } else m_uiAmplifyDamageTimer -= uiDiff; } //Time for global and double timers if (InfernalTimer < uiDiff) { SummonInfernal(); InfernalTimer = m_uiPhase == 3 ? 14500 : 44500; //15 secs in m_uiPhase 3, 45 otherwise } else InfernalTimer -= uiDiff; if (m_uiShadowNovaTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWNOVA); m_uiShadowNovaTimer = m_uiPhase == 3 ? 31000 : -1; } else m_uiShadowNovaTimer -= uiDiff; if (m_uiPhase != 2) { if (m_uiSWPainTimer < uiDiff) { Unit* target = NULL; if (m_uiPhase == 1) target = m_creature->getVictim(); // the tank else //anyone but the tank target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (target) DoCastSpellIfCan(target, SPELL_SW_PAIN); m_uiSWPainTimer = 20000; } else m_uiSWPainTimer -= uiDiff; } if (m_uiPhase != 3) { if (m_uiEnfeebleTimer < uiDiff) { EnfeebleHealthEffect(); m_uiEnfeebleTimer = 30000; m_uiShadowNovaTimer = 5000; m_uiEnfeebleResetTimer = 9000; } else m_uiEnfeebleTimer -= uiDiff; } if (m_uiPhase==2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (StormCount) { Unit* target = Unit::GetUnit(*me, CloudGUID); if (!target || !target->isAlive()) { EnterEvadeMode(); return; } else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID)) Cyclone->CastSpell(target, 25160, true); // keep casting or... if (StormSequenceTimer <= diff) HandleStormSequence(target); else StormSequenceTimer -= diff; return; } if (Enrage_Timer <= diff) { me->MonsterYell(SAY_ONENRAGE, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONENRAGE); DoCast(me, SPELL_BERSERK, true); Enrage_Timer = 600000; } else Enrage_Timer -= diff; if (StaticDisruption_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); TargetGUID = target->GetGUID(); DoCast(target, SPELL_STATIC_DISRUPTION, false); me->SetInFront(me->getVictim()); StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s /*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ } else StaticDisruption_Timer -= diff; if (GustOfWind_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); DoCast(target, SPELL_GUST_OF_WIND); GustOfWind_Timer = urand(20, 30) * 1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; if (CallLighting_Timer <= diff) { DoCast(me->getVictim(), SPELL_CALL_LIGHTNING); CallLighting_Timer = urand(12, 17) * 1000; //totaly random timer. can't find any info on this } else CallLighting_Timer -= diff; if (!isRaining && ElectricalStorm_Timer < uint32(8000 + rand() % 5000)) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } if (ElectricalStorm_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!target) { EnterEvadeMode(); return; } target->CastSpell(target, 44007, true);//cloud visual DoCast(target, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual float x, y, z; target->GetPosition(x, y, z); if (target) { target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0); } Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); Cloud->StopMoving(); Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) StormCount = 1; StormSequenceTimer = 0; } else ElectricalStorm_Timer -= diff; if (SummonEagles_Timer <= diff) { me->MonsterYell(SAY_ONSUMMON, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_ONSUMMON); float x, y, z; me->GetPosition(x, y, z); for (uint8 i = 0; i < 8; ++i) { Unit* bird = Unit::GetUnit(*me, BirdGUIDs[i]); if (!bird) //they despawned on die { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { x = target->GetPositionX() + irand(-10, 10); y = target->GetPositionY() + irand(-10, 10); z = target->GetPositionZ() + urand(16, 20); if (z > 95) z = 95.0f - urand(0, 5); } Creature* creature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (creature) { creature->AddThreat(me->getVictim(), 1.0f); creature->AI()->AttackStart(me->getVictim()); BirdGUIDs[i] = creature->GetGUID(); } } } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if(!m_creature->getVictim() && !m_creature->SelectHostilTarget()) return; switch(Phase) { case 0: { // *Heroic mode only: if(Heroic) if(PyroblastTimer < diff) { DoCast(m_creature, SPELL_SHOCK_BARRIER, true); DoCast(m_creature->getVictim(), SPELL_PYROBLAST); PyroblastTimer = 60000; }else PyroblastTimer -= diff; if(FireballTimer < diff) { // *Normal/Heroic mode support if(Heroic) DoCast(m_creature->getVictim(), SPELL_FIREBALL_HEROIC); else DoCast(m_creature->getVictim(), SPELL_FIREBALL_NORMAL); FireballTimer = 2000 + rand()%4000; }else FireballTimer -= diff; if(PhoenixTimer < diff) { uint32 random = rand()%2 + 1; float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000); if(Phoenix) { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); if(target) { Phoenix->AddThreat(target,1000); Phoenix->Attack(target,true); Phoenix->GetMotionMaster()->MoveChase(target); } else { Phoenix->AddThreat(m_creature->getVictim(),1000); Phoenix->Attack(m_creature->getVictim(),true); Phoenix->GetMotionMaster()->MoveChase(m_creature->getVictim()); } } DoYell(SAY_PHOENIX, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature,SOUND_PHOENIX); PhoenixTimer = 40000; }else PhoenixTimer -= diff; if(FlameStrikeTimer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) { m_creature->InterruptNonMeleeSpells(false); DoCast(target, SPELL_FLAMESTRIKE3, true); FlameStrikeTimer = 20000 + rand()%5000; DoYell(SAY_FLAMESTRIKE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_FLAMESTRIKE); } }else FlameStrikeTimer -= diff; // Below 50% if(m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth()) { m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); GravityLapseTimer = 0; GravityLapsePhase = 0; Phase = 1; } DoMeleeAttackIfReady(); } break; case 1: { m_creature->StopMoving(); if(GravityLapseTimer < diff) { switch(GravityLapsePhase) { case 0: if(FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { DoYell(SAY_GRAVITY_LAPSE,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature,SOUND_GRAVITY_LAPSE); FirstGravityLapse = false; if(pInstance) { GameObject* KaelLeft = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_LEFT)); if(KaelLeft) KaelLeft->SetGoState(0); GameObject* KaelRight = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_RIGHT)); if(KaelRight) KaelRight->SetGoState(0); } }else { DoYell(SAY_RECAST_GRAVITY,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature,SOUND_RECAST_GRAVITY); } m_creature->StopMoving(); DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; for(uint8 i = 0; i < 3; ++i) { Creature* Orb = m_creature->SummonCreature(CREATURE_ARCANE_SPHERE,KaelLocations[3+i][0],KaelLocations[3+i][1],LOCATION_Z,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); if(Orb) { SetThreatList(Orb); Unit *target = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,i); if(target) { Orb->AddThreat(target,1000); Orb->Attack(target,true); Orb->GetMotionMaster()->MoveChase(target); } else { Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); if(ntarget) { Orb->AddThreat(ntarget,1000); Orb->Attack(ntarget,true); Orb->GetMotionMaster()->MoveChase(ntarget); } } } } DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL); break; case 4: m_creature->InterruptNonMeleeSpells(false); DoYell(SAY_TIRED,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature,SOUND_TIRED); DoCast(m_creature, SPELL_POWER_FEEDBACK); RemoveGravityLapse(); GravityLapseTimer = 10000; GravityLapsePhase = 0; break; } }else GravityLapseTimer -= diff; } break; } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that { EnfeebleResetHealth(); EnfeebleResetTimer = 0; } else EnfeebleResetTimer -= diff; if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself return; if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); if (phase == 1) { if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) { me->InterruptNonMeleeSpells(false); phase = 2; //animation DoCast(me, SPELL_EQUIP_AXES); //text DoScriptText(SAY_AXE_TOSS1, me); //passive thrash aura DoCast(me, SPELL_THRASH_AURA, true); //models me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, AXE_EQUIP_MODEL); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, AXE_EQUIP_INFO); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, AXE_EQUIP_MODEL); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, AXE_EQUIP_INFO); //damage const CreatureInfo *cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); //Sigh, updating only works on main attack, do it manually .... me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); } } else if (phase == 2) { if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) { InfernalTimer = 15000; phase = 3; ClearWeapons(); //remove thrash me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); DoScriptText(SAY_AXE_TOSS2, me); Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) { Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (axe) { axe->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, AXE_EQUIP_MODEL); axe->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, AXE_EQUIP_INFO); axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); axe->setFaction(me->getFaction()); axes[i] = axe->GetGUID(); if (pTarget) { axe->AI()->AttackStart(pTarget); //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly // So we'll use a hack to add a lot of threat to our target axe->AddThreat(pTarget, 10000000.0f); } } } if (ShadowNovaTimer > 35000) ShadowNovaTimer = EnfeebleTimer + 5000; return; } if (SunderArmorTimer <= diff) { DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); SunderArmorTimer = urand(10000,18000); } else SunderArmorTimer -= diff; if (Cleave_Timer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); Cleave_Timer = urand(6000,12000); } else Cleave_Timer -= diff; } else { if (AxesTargetSwitchTimer <= diff) { AxesTargetSwitchTimer = urand(7500,20000); if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { for (uint8 i = 0; i < 2; ++i) { if (Unit *axe = Unit::GetUnit(*me, axes[i])) { if (axe->getVictim()) DoModifyThreatPercent(axe->getVictim(), -100); if (pTarget) axe->AddThreat(pTarget, 1000000.0f); //axe->getThreatManager().tauntFadeOut(axe->getVictim()); //axe->getThreatManager().tauntApply(pTarget); } } } } else AxesTargetSwitchTimer -= diff; if (AmplifyDamageTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); AmplifyDamageTimer = urand(20000,30000); } else AmplifyDamageTimer -= diff; } //Time for global and double timers if (InfernalTimer <= diff) { SummonInfernal(diff); InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise } else InfernalTimer -= diff; if (ShadowNovaTimer <= diff) { DoCast(me->getVictim(), SPELL_SHADOWNOVA); ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); } else ShadowNovaTimer -= diff; if (phase != 2) { if (SWPainTimer <= diff) { Unit *pTarget = NULL; if (phase == 1) pTarget = me->getVictim(); // the tank else // anyone but the tank pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (pTarget) DoCast(pTarget, SPELL_SW_PAIN); SWPainTimer = 20000; } else SWPainTimer -= diff; } if (phase != 3) { if (EnfeebleTimer <= diff) { EnfeebleHealthEffect(); EnfeebleTimer = 30000; ShadowNovaTimer = 5000; EnfeebleResetTimer = 9000; } else EnfeebleTimer -= diff; } if (phase == 2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!Materialize) { DoCast(me, SPELL_MATERIALIZE); Materialize = true; } if (me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || me->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it DoCast(me, SPELL_PHASE_SLIP); if (!UpdateVictim()) return; if (ManaBurnTimer <= diff) // cast Mana Burn { if (me->getVictim()->GetCreateMana() > 0) { DoCast(me->getVictim(), SPELL_MANA_BURN); ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd } } else ManaBurnTimer -= diff; if (PlayerGUID) // start: support for quest 10190 { Player* pTarget = Unit::GetPlayer(*me, PlayerGUID); if (pTarget && !Weak && me->GetHealth() < (me->GetMaxHealth() / 100 * WeakPercent) && pTarget->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) { DoScriptText(EMOTE_WEAK, me); Weak = true; } if (Weak && !Drained && me->HasAura(34219, 0)) { Drained = true; Health = me->GetHealth(); // get the normal mob's data Level = me->getLevel(); me->AttackStop(); // delete the normal mob me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); me->RemoveCorpse(); Creature* DrainedPhaseHunter = NULL; if (!DrainedPhaseHunter) DrainedPhaseHunter = me->SummonCreature(SUMMONED_MOB, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob if (DrainedPhaseHunter) { DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data DrainedPhaseHunter->SetHealth(Health); DrainedPhaseHunter->AddThreat(pTarget, 10000.0f); DrainedPhaseHunter->AI()->AttackStart(pTarget); } } }// end: support for quest 10190 DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); if (!PlayerGUID) { m_creature->setDeathState(JUST_DIED); return; } if (!m_creature->isInCombat() && !Event_onWait) { if (checkPlayer_Timer < diff) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) AttackStart(pPlayer->getAttackerForHelper()); checkPlayer_Timer = 1000; }else checkPlayer_Timer -= diff; } if (Event_onWait && Event_Timer < diff) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) { m_creature->setDeathState(JUST_DIED); return; } switch(CurrWP) { case 0: switch(Step) { case 0: m_creature->Say(CLINTAR_SPIRIT_SAY_START,0,PlayerGUID); Event_Timer = 8000; Step = 1; break; case 1: Event_onWait = false; break; } break; case 6: switch(Step) { case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); Event_Timer = 5000; Step = 1; break; case 1: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, m_creature, pPlayer); Event_onWait = false; break; } break; case 15: switch(Step) { case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); Event_Timer = 5000; Step = 1; break; case 1: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); Event_onWait = false; break; } break; case 16: switch(Step) { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, m_creature, pPlayer); Event_Timer = 15000; Step = 1; break; case 1: Event_onWait = false; break; } break; case 20: switch(Step) { case 0: { Creature *mob = m_creature->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); if (mob) { mob->AddThreat(m_creature,10000.0f); mob->AI()->AttackStart(m_creature); } Event_Timer = 2000; Step = 1; break; } case 1: Event_onWait = false; break; } break; case 24: switch(Step) { case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); Event_Timer = 5000; Step = 1; break; case 1: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); Event_onWait = false; break; } break; case 25: switch(Step) { case 0: DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, m_creature, pPlayer); Event_Timer = 4000; Step = 1; break; case 1: Event_onWait = false; break; } break; case 40: switch(Step) { case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, m_creature, pPlayer); pPlayer->CompleteQuest(10965); Event_Timer = 1500; Step = 1; break; case 1: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); Event_Timer = 3000; Step = 2; break; case 2: pPlayer->TalkedToCreature(m_creature->GetEntry(), m_creature->GetGUID()); PlayerGUID = 0; Reset(); m_creature->setDeathState(JUST_DIED); break; } break; default: Event_onWait = false; break; } } else if (Event_onWait) Event_Timer -= diff; }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(addsPhase) { if(AddsPhaseTimer < diff) { addsPhase = false; //make boss active and attackable SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); //m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoScriptText(SAY_HEART_CLOSE, m_creature); } else AddsPhaseTimer -= diff; if(NextWaveTimer < diff) { NextWaveTimer = 15000; int rnd = irand(0,3); /*if( m_creature->GetDistance2d(AddX[rnd], AddY[rnd]) > 220) { EnterEvadeMode(); return; }*/ int i; Creature *add; Unit *target; if(!Regular || (AddsPhaseTimer > 15000)) { add = m_creature->SummonCreature(CR_PUMMELER, AddX[rnd], AddY[rnd], AddZ[rnd], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); add->SetActiveObjectState(true); target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(add && target && target->isAlive()) add->AddThreat(target, 1.0f); } for(i=0; i < ScrapbotCount; i++) { add = m_creature->SummonCreature(CR_SCRAPBOT, AddX[rnd], AddY[rnd], AddZ[rnd], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); add->SetActiveObjectState(true); target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(add && target && target->isAlive()) add->AddThreat(target, 1.0f); } for(i=0; i < BoombotCount; i++) { add = m_creature->SummonCreature(CR_BOOMBOT, AddX[rnd], AddY[rnd], AddZ[rnd], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); add->SetActiveObjectState(true); target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(add && target && target->isAlive()) add->AddThreat(target, 1.0f); } } else NextWaveTimer -= diff; } else { if (addsPhaseNumber && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= addsPhaseNumber*25)) { addsPhaseNumber--; addsPhase = true; AddsPhaseTimer = 30000; NextWaveTimer = 5000; //make boss unattackable and inactive SetCombatMovement(false); m_creature->GetMotionMaster()->Clear(); //m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoScriptText(SAY_HEART_OPEN, m_creature); } //regular spells if(TantrumTimer < diff) { DoCast(m_creature->getVictim(), SP_TANTRUM); TantrumTimer = 45000; DoScriptText(SAY_TANTRUM, m_creature); } else TantrumTimer -= diff; if(LightTimer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target && target->isAlive()) DoCast(target, Regular ? SP_SEARING_LIGHT : H_SP_SEARING_LIGHT); LightTimer = 10000; } else LightTimer -= diff; if(GravityTimer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target && target->isAlive()) DoCast(target, Regular ? SP_GRAVITY : H_SP_GRAVITY); GravityTimer = 15000 + rand()%5000; } else GravityTimer -= diff; if(EnrageTimer < diff) { DoCast(m_creature, SP_ENRAGE); EnrageTimer = 60000; DoScriptText(SAY_BERSERK, m_creature); } else EnrageTimer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (!m_creature->getVictim() && !m_creature->SelectHostilTarget()) return; switch(Phase) { case 0: { // *Heroic mode only: if (m_bIsHeroicMode) { if (PyroblastTimer < diff) { DoCast(m_creature, SPELL_SHOCK_BARRIER, true); DoCast(m_creature->getVictim(), SPELL_PYROBLAST); PyroblastTimer = 60000; }else PyroblastTimer -= diff; } if (FireballTimer < diff) { DoCast(m_creature->getVictim(), m_bIsHeroicMode ? SPELL_FIREBALL_HEROIC : SPELL_FIREBALL_NORMAL); FireballTimer = 2000 + rand()%4000; }else FireballTimer -= diff; if (PhoenixTimer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,1); uint32 random = rand()%2 + 1; float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if (Phoenix) { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); Phoenix->AI()->AttackStart(target); } DoScriptText(SAY_PHOENIX, m_creature); PhoenixTimer = 60000; }else PhoenixTimer -= diff; if (FlameStrikeTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_FLAMESTRIKE3, true); DoScriptText(SAY_FLAMESTRIKE, m_creature); } FlameStrikeTimer = 15000 + rand()%10000; }else FlameStrikeTimer -= diff; // Below 50% if (m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth()) { m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); GravityLapseTimer = 0; GravityLapsePhase = 0; Phase = 1; } DoMeleeAttackIfReady(); } break; case 1: { if (GravityLapseTimer < diff) { switch(GravityLapsePhase) { case 0: if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { DoScriptText(SAY_GRAVITY_LAPSE, m_creature); FirstGravityLapse = false; if (m_pInstance) { if (GameObject* pKaelLeft = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_KAEL_STATUE_LEFT))) pKaelLeft->SetGoState(GO_STATE_ACTIVE); if (GameObject* pKaelRight = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_KAEL_STATUE_RIGHT))) pKaelRight->SetGoState(GO_STATE_ACTIVE); } } else { DoScriptText(SAY_RECAST_GRAVITY, m_creature); } DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; for(uint8 i = 0; i < 3; ++i) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Orb && target) { //SetThreatList(Orb); Orb->AddThreat(target, 1.0f); Orb->AI()->AttackStart(target); } } DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL); break; case 4: m_creature->InterruptNonMeleeSpells(false); DoScriptText(SAY_TIRED, m_creature); DoCast(m_creature, SPELL_POWER_FEEDBACK); RemoveGravityLapse(); GravityLapseTimer = 10000; GravityLapsePhase = 0; break; } }else GravityLapseTimer -= diff; } break; } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that { EnfeebleResetHealth(); EnfeebleResetTimer = 0; } else EnfeebleResetTimer -= diff; if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself return; if (me->GetVictim() && me->GetTarget() != me->EnsureVictim()->GetGUID()) me->SetTarget(me->EnsureVictim()->GetGUID()); if (phase == 1) { if (HealthBelowPct(60)) { me->InterruptNonMeleeSpells(false); phase = 2; //animation DoCast(me, SPELL_EQUIP_AXES); //text Talk(SAY_AXE_TOSS1); //passive thrash aura DoCast(me, SPELL_THRASH_AURA, true); //models SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); me->SetCanDualWield(true); } } else if (phase == 2) { if (HealthBelowPct(30)) { InfernalTimer = 15000; phase = 3; ClearWeapons(); //remove thrash me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); Talk(SAY_AXE_TOSS2); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) { Creature* axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (axe) { axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); axe->setFaction(me->getFaction()); axes[i] = axe->GetGUID(); if (target) { axe->AI()->AttackStart(target); //axe->getThreatManager().tauntApply(target); //Taunt Apply and fade out does not work properly // So we'll use a hack to add a lot of threat to our target axe->AddThreat(target, 10000000.0f); } } } if (ShadowNovaTimer > 35000) ShadowNovaTimer = EnfeebleTimer + 5000; return; } if (SunderArmorTimer <= diff) { DoCastVictim(SPELL_SUNDER_ARMOR); SunderArmorTimer = urand(10000, 18000); } else SunderArmorTimer -= diff; if (Cleave_Timer <= diff) { DoCastVictim(SPELL_CLEAVE); Cleave_Timer = urand(6000, 12000); } else Cleave_Timer -= diff; } else { if (AxesTargetSwitchTimer <= diff) { AxesTargetSwitchTimer = urand(7500, 20000); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { for (uint8 i = 0; i < 2; ++i) { if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i])) { if (axe->GetVictim()) DoModifyThreatPercent(axe->GetVictim(), -100); if (target) axe->AddThreat(target, 1000000.0f); //axe->getThreatManager().tauntFadeOut(axe->GetVictim()); //axe->getThreatManager().tauntApply(target); } } } } else AxesTargetSwitchTimer -= diff; if (AmplifyDamageTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_AMPLIFY_DAMAGE); AmplifyDamageTimer = urand(20000, 30000); } else AmplifyDamageTimer -= diff; } //Time for global and double timers if (InfernalTimer <= diff) { SummonInfernal(diff); InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise } else InfernalTimer -= diff; if (ShadowNovaTimer <= diff) { DoCastVictim(SPELL_SHADOWNOVA); ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); } else ShadowNovaTimer -= diff; if (phase != 2) { if (SWPainTimer <= diff) { Unit* target = NULL; if (phase == 1) target = me->GetVictim(); // the tank else // anyone but the tank target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (target) DoCast(target, SPELL_SW_PAIN); SWPainTimer = 20000; } else SWPainTimer -= diff; } if (phase != 3) { if (EnfeebleTimer <= diff) { EnfeebleHealthEffect(); EnfeebleTimer = 30000; ShadowNovaTimer = 5000; EnfeebleResetTimer = 9000; } else EnfeebleTimer -= diff; } if (phase == 2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; switch (Phase) { case 0: { // *Heroic mode only: if (IsHeroic()) { if (PyroblastTimer <= diff) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(me, SPELL_SHOCK_BARRIER, true); DoCast(me->getVictim(), SPELL_PYROBLAST); PyroblastTimer = 60000; } else PyroblastTimer -= diff; } if (FireballTimer <= diff) { DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); FireballTimer = urand(2000, 6000); } else FireballTimer -= diff; if (PhoenixTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); uint8 random = urand(1, 2); float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if (Phoenix) { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); Phoenix->AI()->AttackStart(target); } DoScriptText(SAY_PHOENIX, me); PhoenixTimer = 60000; } else PhoenixTimer -= diff; if (FlameStrikeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(target, SPELL_FLAMESTRIKE3, true); DoScriptText(SAY_FLAMESTRIKE, me); } FlameStrikeTimer = urand(15000, 25000); } else FlameStrikeTimer -= diff; // Below 50% if (HealthBelowPct(50)) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); me->StopMoving(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); GravityLapseTimer = 0; GravityLapsePhase = 0; Phase = 1; } DoMeleeAttackIfReady(); } break; case 1: { if (GravityLapseTimer <= diff) { switch (GravityLapsePhase) { case 0: if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { DoScriptText(SAY_GRAVITY_LAPSE, me); FirstGravityLapse = false; if (instance) { instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_LEFT), true); instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_RIGHT), true); } }else { DoScriptText(SAY_RECAST_GRAVITY, me); } DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; for (uint8 i = 0; i < 3; ++i) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Orb && target) { Orb->SetSpeed(MOVE_RUN, 0.5f); Orb->AddThreat(target, 1000000.0f); Orb->AI()->AttackStart(target); } } DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); break; case 4: me->InterruptNonMeleeSpells(false); DoScriptText(SAY_TIRED, me); DoCast(me, SPELL_POWER_FEEDBACK); RemoveGravityLapse(); GravityLapseTimer = 10000; GravityLapsePhase = 0; break; } } else GravityLapseTimer -= diff; } break; } }
void UpdateAI(const uint32 diff) { if (!Phase) return; // Reset if event is begun and we don't have a threatlist if (Phase && m_creature->getThreatManager().getThreatList().empty()) EnterEvadeMode(); if (Phase == 1) { if (AnimationTimer < diff) { // Release the cube m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); AnimationTimer = 8300; }else AnimationTimer -= diff; if (SummonEssenceTimer < diff) { // Ribs: open m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,373); Creature* EssenceSuffering = NULL; EssenceSuffering = m_creature->SummonCreature(23418, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 1.57f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if (EssenceSuffering) { DoScriptText(SUFF_SAY_FREED, EssenceSuffering); if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0)) { EssenceSuffering->AddThreat(target); EssenceSuffering->AI()->AttackStart(target); } SufferingGUID = EssenceSuffering->GetGUID(); } EndingPhase = false; Phase = 2; }else SummonEssenceTimer -= diff; } if (Phase == 2) { if (SufferingGUID) { Creature* EssenceSuffering = NULL; EssenceSuffering = ((Creature*)Unit::GetUnit((*m_creature), SufferingGUID)); if (!EssenceSuffering || (!EssenceSuffering->isAlive())) EnterEvadeMode(); if (!EndingPhase) { if (EssenceSuffering) { if (EssenceSuffering->GetHealthPercent() < 10.0f) { DoScriptText(SUFF_SAY_RECAP, EssenceSuffering); MergeThreatList(EssenceSuffering); EssenceSuffering->RemoveAllAuras(); EssenceSuffering->DeleteThreatList(); EssenceSuffering->GetMotionMaster()->MoveFollow(m_creature,0.0f,0.0f); EssenceSuffering->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DespawnEssenceTimer = 4000; AnimationTimer = 2200; EndingPhase = true; } } } if ((EndingPhase) && (EssenceSuffering) && (EssenceSuffering->isAlive())) { if (AnimationTimer < diff) { // Return EssenceSuffering->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); AnimationTimer = 10000; }else AnimationTimer -= diff; if (DespawnEssenceTimer < diff) { DoScriptText(SUFF_SAY_AFTER, EssenceSuffering); EssenceSuffering->DeleteThreatList(); EssenceSuffering->SetDisplayId(11686); EssenceSuffering->setFaction(35); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); SummonEssenceTimer = 20000; //60000; AnimationTimer = 18200; //58100; SoulDeathCount = 0; SoulCount = 0; SummonSoulTimer = 1000; EndingPhase = false; Phase = 3; SufferingGUID = 0; }else DespawnEssenceTimer -= diff; } } } if (Phase == 3) { if (SoulCount < 36) { if (SummonSoulTimer < diff) { SummonSoul(); SummonSoulTimer = 500; }else SummonSoulTimer -= diff; } if (SoulDeathCount >= SoulCount) { if (AnimationTimer < diff) { // Release the cube m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); AnimationTimer = 10000; }else AnimationTimer -= diff; if (SummonEssenceTimer < diff) { // Ribs: open m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,373); Creature* EssenceDesire = NULL; EssenceDesire = m_creature->SummonCreature(23419, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 1.57f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if (EssenceDesire) { DoScriptText(DESI_SAY_FREED, EssenceDesire); if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { EssenceDesire->AddThreat(target); EssenceDesire->AI()->AttackStart(target); } DesireGUID = EssenceDesire->GetGUID(); SoulDeathCount = 0; } Phase = 4; }else SummonEssenceTimer -= diff; } } if (Phase == 4) { if (DesireGUID) { Creature* EssenceDesire = NULL; EssenceDesire = ((Creature*)Unit::GetUnit((*m_creature), DesireGUID)); if (!EssenceDesire || !EssenceDesire->isAlive()) EnterEvadeMode(); if (!EndingPhase && EssenceDesire) { if (EssenceDesire->GetHealthPercent() < 10.0f) { MergeThreatList(EssenceDesire); EssenceDesire->GetMotionMaster()->MoveFollow(m_creature,0.0f,0.0f); EssenceDesire->RemoveAllAuras(); EssenceDesire->DeleteThreatList(); DoScriptText(DESI_SAY_RECAP, EssenceDesire); EssenceDesire->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DespawnEssenceTimer = 4000; AnimationTimer = 2200; EndingPhase = true; } } if (EndingPhase && EssenceDesire) { if (EssenceDesire->isAlive()) { if (AnimationTimer < diff) { // Return EssenceDesire->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); AnimationTimer = 10000; }else AnimationTimer -= diff; if (DespawnEssenceTimer < diff) { EssenceDesire->DeleteThreatList(); EssenceDesire->setFaction(35); DoScriptText(DESI_SAY_AFTER, EssenceDesire); EssenceDesire->SetDisplayId(11686); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); SummonEssenceTimer = 20000; AnimationTimer = 18200; SoulDeathCount = 0; SoulCount = 0; SummonSoulTimer = 1000; EndingPhase = false; Phase = 5; DesireGUID = 0; }else DespawnEssenceTimer -= diff; } } } } if (Phase == 5) { if (SoulCount < 36) { if (SummonSoulTimer < diff) { SummonSoul(); SummonSoulTimer = 500; }else SummonSoulTimer -= diff; } if (SoulDeathCount >= SoulCount) { if (AnimationTimer < diff) { // Release the cube m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); AnimationTimer = 10000; }else AnimationTimer -= diff; if (SummonEssenceTimer < diff) { // Ribs: open m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,373); Creature* EssenceAnger = NULL; EssenceAnger = m_creature->SummonCreature(23420, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 1.57f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 45000); if (EssenceAnger) { if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0)) { EssenceAnger->AddThreat(target); EssenceAnger->AI()->AttackStart(target); } AngerGUID = EssenceAnger->GetGUID(); DoScriptText(ANGER_SAY_FREED, EssenceAnger); SoulDeathCount = 0; } Phase = 6; }else SummonEssenceTimer -= diff; } } if (Phase == 6) { if (AngerGUID) { Creature* EssenceAnger = NULL; EssenceAnger = ((Creature*)Unit::GetUnit((*m_creature), AngerGUID)); if (!EssenceAnger) EnterEvadeMode(); if (m_creature->isAlive() && EssenceAnger) { if (!EssenceAnger->isAlive()) { AngerGUID = 0; m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } } } }