void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!DrainingCrystal) { uint32 maxPowerMana = me->GetMaxPower(POWER_MANA); if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) { if (DrainLifeTimer <= diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); DrainLifeTimer = 10000; } else DrainLifeTimer -= diff; // Heroic only if (IsHeroic()) { if (DrainManaTimer <= diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); DrainManaTimer = 10000; } else DrainManaTimer -= diff; } } if (FelExplosionTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, SPELL_FEL_EXPLOSION); FelExplosionTimer = 2000; } } else FelExplosionTimer -= diff; // If below 10% mana, start recharging maxPowerMana = me->GetMaxPower(POWER_MANA); if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) { if (DrainCrystalTimer <= diff) { SelectNearestCrystal(); if (IsHeroic()) DrainCrystalTimer = urand(10000, 15000); else DrainCrystalTimer = urand(20000, 25000); } else DrainCrystalTimer -= diff; } }else { if (IsDraining) { if (EmpowerTimer <= diff) { IsDraining = false; DrainingCrystal = false; DoScriptText(SAY_EMPOWERED, me); Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); if (CrystalChosen && CrystalChosen->isAlive()) // Use Deal Damage to kill it, not setDeathState. CrystalChosen->Kill(CrystalChosen); CrystalGUID = 0; me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); } else EmpowerTimer -= diff; } } DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (Summon_Timer <= diff) { for (uint8 i = 0; i < 3; ++i) { Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); Creature* Wraith = me->SummonCreature(21062,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); if (pTarget && Wraith) Wraith->AI()->AttackStart(pTarget); } DoScriptText(SAY_SUMMON, me); Summon_Timer = 30000 + rand()%15000; } else Summon_Timer -= diff; if (ManaTap_Timer <= diff) { DoCast(me->getVictim(), SPELL_MANA_TAP); ManaTap_Timer = 14000 + rand()%8000; } else ManaTap_Timer -= diff; if (ArcaneTorrent_Timer <= diff) { DoCast(me->getVictim(), SPELL_ARCANE_TORRENT); ArcaneTorrent_Timer = 12000 + rand()%6000; } else ArcaneTorrent_Timer -= diff; if (Domination_Timer <= diff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) { DoScriptText(RAND(SAY_DOMINATION_1,SAY_DOMINATION_2), me); DoCast(pTarget, SPELL_DOMINATION); } Domination_Timer = 25000 + rand()%5000; } else Domination_Timer -= diff; //Only casting if Heroic Mode is used if (IsHeroic()) { if (ArcaneExplosion_Timer <= diff) { DoCast(me->getVictim(), H_SPELL_ARCANE_EXPLOSION); ArcaneExplosion_Timer = 10000 + rand()%4000; } else ArcaneExplosion_Timer -= diff; } if (!Enraged && HealthBelowPct(21)) { DoCast(me, SPELL_FRENZY); DoScriptText(SAY_ENRAGE, me); Enraged = true; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_pInstance || !UpdateVictim()) return; if (m_pInstance->GetData(DATA_HEALTH_TWIN_SHARED) != 0) me->SetHealth(m_pInstance->GetData(DATA_HEALTH_TWIN_SHARED)); else me->SetHealth(1); switch (m_uiStage) { case 0: break; case 1: // Vortex if (m_uiSpecialAbilityTimer <= uiDiff) { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_VORTEX); DoScriptText(m_uiVortexEmote, me); DoScriptText(m_uiVortexSay, me); DoCastAOE(m_uiVortexSpellId); m_uiStage = 0; m_uiSpecialAbilityTimer = MINUTE * IN_MILLISECONDS; } else m_uiSpecialAbilityTimer -= uiDiff; break; case 2: // Shield+Pact if (m_uiSpecialAbilityTimer <= uiDiff) { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_PACT); DoScriptText(EMOTE_SHIELD, me); DoScriptText(SAY_SHIELD, me); DoCast(me, m_uiShieldSpellId); DoCast(me, m_uiTwinPactSpellId); m_uiStage = 0; m_uiSpecialAbilityTimer = MINUTE * IN_MILLISECONDS; } m_uiSpecialAbilityTimer -= uiDiff; break; default: break; } if (m_uiSpikeTimer <= uiDiff) { DoCastVictim(m_uiSpikeSpellId); m_uiSpikeTimer = 20 * IN_MILLISECONDS; } m_uiSpikeTimer -= uiDiff; if (IsHeroic() && m_uiTouchTimer <= uiDiff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true, m_uiOtherEssenceSpellId)) DoCast(pTarget, m_uiTouchSpellId); m_uiTouchTimer = urand(10, 15) * IN_MILLISECONDS; } m_uiTouchTimer -= uiDiff; if (m_uiColorballsTimer <= uiDiff) { if (m_uiWaveCount >= 2) { SummonColorballs(12); m_uiWaveCount = 0; } else { SummonColorballs(2); m_uiWaveCount++; } m_uiColorballsTimer = 15 * IN_MILLISECONDS; } else m_uiColorballsTimer -= uiDiff; if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff) { DoCast(me, SPELL_BERSERK); DoScriptText(SAY_BERSERK, me); m_bIsBerserk = true; } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHECK_PLAYERS: instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TANK_MARKER); events.ScheduleEvent(EVENT_CHECK_PLAYERS,2000); break; case EVENT_BONE_SPIKE_GRAVEYARD: events.CancelEvent(EVENT_CHECK_PLAYERS); if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM)) DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD); events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_CHECK_PLAYERS,2000); break; case EVENT_COLDFLAME: _coldflameLastPos.Relocate(me); _coldflameTarget = 0LL; if (!me->HasAura(SPELL_BONE_STORM)) DoCastAOE(SPELL_COLDFLAME_NORMAL); else DoCast(me, SPELL_COLDFLAME_BONE_STORM); events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); break; case EVENT_WARN_BONE_STORM: _boneSlice = false; Talk(EMOTE_BONE_STORM); me->FinishSpell(CURRENT_MELEE_SPELL, false); DoCast(me, SPELL_BONE_STORM); events.DelayEvents(3000, EVENT_GROUP_SPECIAL); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050); events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(90000, 95000)); break; case EVENT_BONE_STORM_BEGIN: if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) pStorm->SetDuration(int32(_boneStormDuration)); me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true); Talk(SAY_BONE_STORM); events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1); // no break here case EVENT_BONE_STORM_MOVE: { if(me->GetMap()->IsHeroic()) events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/5); else events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/4); Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!unit || unit->isPet() || unit->isTotem()) unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (unit) if (unit->isPet() || unit->isTotem()) unit = SelectTarget(SELECT_TARGET_RANDOM, 1); else me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); break; } case EVENT_BONE_STORM_END: if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); DoStartMovement(me->getVictim()); me->SetSpeed(MOVE_RUN, _baseSpeed, true); events.CancelEvent(EVENT_BONE_STORM_MOVE); events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); if (!IsHeroic()) events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_ENABLE_BONE_SLICE: _boneSlice = true; break; case EVENT_ENRAGE: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } // We should not melee attack when storming if (me->HasAura(SPELL_BONE_STORM)) return; // 10 seconds since encounter start Bone Slice replaces melee attacks if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) DoCastVictim(SPELL_BONE_SLICE); DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!pInstance || !UpdateVictim()) return; if (IsHeroic() && me->HealthBelowPct(30) && !bShadowBreath) { bShadowBreath = true; if (Creature* pNefarius = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS_HEROIC, 200.0f)) pNefarius->AI()->DoAction(ACTION_SHADOW_BREATH); } events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { /*case EVENT_HEAD_START: SetGrounded(true, 0); if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD))) pMagmawhead->AI()->DoAction(ACTION_HEAD_START); events.ScheduleEvent(EVENT_HEAD_END, 20000); break; case EVENT_HEAD_END: if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD))) pMagmawhead->AI()->DoAction(ACTION_HEAD_END); SetGrounded(false, 0); events.ScheduleEvent(EVENT_MELEE_CHECK, 6000); events.ScheduleEvent(EVENT_LAVA_SPEW, urand(3000, 7000)); events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(10000, 15000)); events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000)); break;*/ case EVENT_BERSERK: DoCast(me, SPELL_BERSERK); break; case EVENT_MELEE_CHECK: if (!me->IsWithinMeleeRange(me->getVictim())) DoCast(me, SPELL_MAGMA_SPLIT_2); events.ScheduleEvent(EVENT_MELEE_CHECK, 1000); break; case EVENT_MAGMA_SPLIT: me->CastCustomSpell(SPELL_MAGMA_SPLIT_1, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8, 3, 8), 0, false); events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000)); break; case EVENT_LAVA_SPEW: DoCast (me, SPELL_LAVA_SPEW); events.ScheduleEvent(EVENT_LAVA_SPEW, 22000); break; case EVENT_PILLAR_OF_FLAME: Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 1, -20.0f, true); if (!target) target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (!target) break; me->SummonCreature(NPC_PILLAR_OF_FLAME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 8000); events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(35000, 45000)); break; case EVENT_MANGLE: DoCast(me->getVictim(), SPELL_MANGLE); //events.CancelEvent(EVENT_MELEE_CHECK); //events.CancelEvent(EVENT_LAVA_SPEW); //events.CancelEvent(EVENT_PILLAR_OF_FLAME); //events.CancelEvent(EVENT_MAGMA_SPLIT); events.ScheduleEvent(EVENT_MANGLE, 95000); //events.ScheduleEvent(EVENT_HEAD_START, 12000); break; } } if (me->getVictim()) if (!me->getVictim()->HasAura(SPELL_MANGLE) && !bGrounded) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; // Evade if too far if (check_Timer <= diff) { float x, y, z, o; me->GetHomePosition(x, y, z, o); if (!me->IsWithinDist3d(x, y, z, 60)) { EnterEvadeMode(); return; } check_Timer = 1000; } else check_Timer -= diff; // Spore Striders if (IsHeroic() && SporeStriders_Timer <= diff) { DoCast(me, SPELL_SUMMON_SPORE_STRIDER); SporeStriders_Timer = 10000 + rand32() % 5000; } else SporeStriders_Timer -= diff; // Levitate if (LevitatedTarget) { if (LevitatedTarget_Timer <= diff) { if (Unit* target = ObjectAccessor::GetUnit(*me, LevitatedTarget)) { if (!target->HasAura(SPELL_LEVITATE)) { LevitatedTarget = 0; return; } if (InAir) { target->AddAura(SPELL_SUSPENSION, target); LevitatedTarget = 0; } else { target->CastSpell(target, SPELL_MAGNETIC_PULL, true); InAir = true; LevitatedTarget_Timer = 1500; } } else LevitatedTarget = 0; } else LevitatedTarget_Timer -= diff; } if (Levitate_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) { DoCast(target, SPELL_LEVITATE); LevitatedTarget = target->GetGUID(); LevitatedTarget_Timer = 2000; InAir = false; } Levitate_Timer = 12000 + rand32() % 3000; } else Levitate_Timer -= diff; // Chain Lightning if (ChainLightning_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightning_Timer = 7000; } else ChainLightning_Timer -= diff; // Static Charge if (StaticCharge_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true)) DoCast(target, SPELL_STATIC_CHARGE); StaticCharge_Timer = 10000; } else StaticCharge_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!instance || !UpdateVictim()) return; if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (Stage) { case 0: break; case 1: // Vortex if (SpecialAbilityTimer <= diff) { if (Creature* pSister = GetSister()) pSister->AI()->DoAction(ACTION_VORTEX); Talk(VortexEmote); DoCastAOE(VortexSpellId); Stage = 0; SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS; } else SpecialAbilityTimer -= diff; break; case 2: // Shield + Pact if (SpecialAbilityTimer <= diff) { Talk(EMOTE_TWINK_PACT); Talk(SAY_TWINK_PACT); if (Creature* pSister = GetSister()) { pSister->AI()->DoAction(ACTION_PACT); pSister->CastSpell(pSister, SPELL_POWER_TWINS, false); } DoCast(me, ShieldSpellId); DoCast(me, TwinPactSpellId); Stage = 0; SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS; } else SpecialAbilityTimer -= diff; break; default: break; } if (SpikeTimer <= diff) { DoCastVictim(SpikeSpellId); SpikeTimer = 20*IN_MILLISECONDS; } else SpikeTimer -= diff; if (IsHeroic() && TouchTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, OtherEssenceSpellId)) me->CastCustomSpell(TouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false); TouchTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); } else TouchTimer -= diff; if (!IsBerserk && BerserkTimer <= diff) { DoCast(me, SPELL_BERSERK); Talk(SAY_BERSERK); IsBerserk = true; } else BerserkTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) { if (check_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) DoCast(me, SPELL_EVOCATION); check_Timer = 5000; } else check_Timer -= diff; return; } if (Firenova) { if (Firenova_Timer <= diff) { DoCast(me, SPELL_FIRE_NOVA, true); Firenova = false; ShadowVolley_Timer = 2000; } else Firenova_Timer -=diff; return; } if (ShadowVolley_Timer <= diff) { DoCast(me, SPELL_SHADOW_BOLT_VOLLEY); ShadowVolley_Timer = 5000+rand()%8000; } else ShadowVolley_Timer -=diff; if (Corruption_Timer <= diff) { DoCast(me, SPELL_CORRUPTION); Corruption_Timer = 30000+rand()%20000; } else Corruption_Timer -=diff; if (BurningNova_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(true); DoScriptText(SAY_NOVA, me); if (SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA)) { if (Aura * aura = Aura::TryCreate(nova, me, me)) aura->ApplyForTargets(); } if (IsHeroic()) DoTeleportAll(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); BurningNova_Timer = 20000+rand()%8000; Firenova_Timer= 5000; Firenova = true; } else BurningNova_Timer -=diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInArea(diff, 5764)) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHECK_HIGH: { //if (!me->getVictim() || !me->IsWithinMeleeRange(me->getVictim())) std::list<Player*> PlayerList; PlayerPositionCheck checker(true); MoPCore::PlayerListSearcher<PlayerPositionCheck> searcher(me, PlayerList, checker); me->VisitNearbyWorldObject(300.0f, searcher); if (PlayerList.size() == 0) DoCastAOE(SPELL_VENOM_RAIN); events.ScheduleEvent(EVENT_CHECK_HIGH, 5000); break; } case EVENT_EMBER_FLARE: if (uiPhase == 0) { std::list<Player*> PlayerList; PlayerPositionCheck checker(true); MoPCore::PlayerListSearcher<PlayerPositionCheck> searcher(me, PlayerList, checker); me->VisitNearbyWorldObject(300.0f, searcher); if (PlayerList.size() > 0) DoCastAOE(SPELL_EMBER_FLARE_1); } else { DoCastAOE(SPELL_EMBER_FLARE_2); } events.ScheduleEvent(EVENT_EMBER_FLARE, urand(6000, 7000)); break; case EVENT_FILAMENT: for (uint8 i = 0; i < RAID_MODE(2, 4, 2, 4); i++) if (Creature* pFilament = me->SummonCreature(NPC_SPIDERWEB_FILAMENT, addsPos[4].GetPositionX() + irand(-8, 8), addsPos[4].GetPositionY() + irand(-8, 8), addsPos[4].GetPositionZ(), 0.0f)) pFilament->SetCanFly(true); events.ScheduleEvent(EVENT_FILAMENT, urand(20000, 25000)); break; case EVENT_SUMMON_DRONE: if (Creature* pDrone = me->SummonCreature(NPC_CINDERWEB_DRONE, addsPos[3])) //pDrone->GetMotionMaster()->MovePoint(0, addsPos[5]); if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, PositionSelector(true, 0))) pDrone->GetMotionMaster()->MoveChase(pTarget); events.ScheduleEvent(EVENT_SUMMON_DRONE, 60000); break; case EVENT_SUMMON_SPIDERLING: uiSide = urand(0, 2); for (uint8 i = 0; i < 8; i++) events.ScheduleEvent(EVENT_SUMMON_SPIDERLING_1, i * 500); if (IsHeroic()) for (uint8 i = 0; i < RAID_MODE(1, 2, 1, 2); ++i) events.ScheduleEvent(EVENT_SUMMON_BROODLING_1, i * 1000); events.ScheduleEvent(EVENT_SUMMON_SPIDERLING, 30000); break; case EVENT_SUMMON_SPIDERLING_1: if (Creature* pSpiderling = me->SummonCreature(NPC_CINDERWEB_SPIDERLING, addsPos[uiSide])) pSpiderling->GetMotionMaster()->MovePoint(0, addsPos[5]); break; case EVENT_SUMMON_BROODLING_1: if (Creature* pBroodling = me->SummonCreature(NPC_ENGORGED_BROODLING, addsPos[uiSide])) if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, PositionSelector(true, 0))) { pBroodling->CastSpell(pTarget, SPELL_FIXATE_BROODLING, true); pBroodling->ClearUnitState(UNIT_STATE_CASTING); pBroodling->GetMotionMaster()->MoveFollow(pTarget, 0.0f, 0.0f); } break; case EVENT_ENERGY_2: //me->SetPower(POWER_MANA, 9000); break; case EVENT_ENERGY: { uint32 energy = me->GetPower(POWER_MANA); if (energy > 0) me->SetPower(POWER_MANA, energy - 100); if ((energy - 100) == 0) { uiCount++; if (uiCount < 3) { events.RescheduleEvent(EVENT_FILAMENT, 23000); events.RescheduleEvent(EVENT_CHECK_HIGH, 12000); events.RescheduleEvent(EVENT_EMBER_FLARE, 14000); events.ScheduleEvent(EVENT_ENERGY, 10000); events.ScheduleEvent(EVENT_ENERGY_2, 8000); } else { events.CancelEvent(EVENT_ENERGY); events.CancelEvent(EVENT_FILAMENT); events.CancelEvent(EVENT_CHECK_HIGH); events.CancelEvent(EVENT_SUMMON_DRONE); events.CancelEvent(EVENT_SUMMON_SPIDERLING); events.RescheduleEvent(EVENT_EMBER_FLARE, 15000); events.ScheduleEvent(EVENT_GO_DOWN, 10000); } DoCastAOE(SPELL_SMOLDERING_DEVASTATION); } else events.ScheduleEvent(EVENT_ENERGY, 1000); break; } case EVENT_GO_DOWN: { uiPhase = 1; me->GetMotionMaster()->MoveJump(addsPos[5].GetPositionX(), addsPos[5].GetPositionY(), addsPos[5].GetPositionZ(), 40.0f, 40.0f); events.ScheduleEvent(EVENT_FRENZY, 10000); events.ScheduleEvent(EVENT_THE_WIDOW_KISS, 32000); Map::PlayerList const &PlayerList = instance->instance->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* player = i->getSource()) if (player->GetPositionZ() > 100.0f) player->NearTeleportTo(addsPos[5].GetPositionX(), addsPos[5].GetPositionY(), addsPos[5].GetPositionZ(), 0.0f); } break; } case EVENT_FRENZY: DoCast(me, SPELL_FRENZY); events.ScheduleEvent(EVENT_FRENZY, 7000); break; case EVENT_THE_WIDOW_KISS: DoCastVictim(SPELL_THE_WIDOW_KISS); events.ScheduleEvent(EVENT_THE_WIDOW_KISS, 34000); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (Phase == NORMAL) { if (!bMove && uiMoveTimer > diff) { uiMoveTimer -= diff; return; } else if (!bMove) { DoStartMovement(me->getVictim()); pSacrificeTarget = NULL; bMove = true; } //Return since we have no target if (!UpdateVictim()) return; if (uiSinsterStrikeTimer <= diff) { DoCast(me->getVictim(), DUNGEON_MODE(SPELL_SINISTER_STRIKE, H_SPELL_SINISTER_STRIKE)); uiSinsterStrikeTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS); } else uiSinsterStrikeTimer -= diff; if (uiCallFlamesTimer <= diff) //move to send event scripts? { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { if (!bFlames) { DoCast(pTarget, SPELL_CALL_FLAMES); bFlames = true; } if (uiFlamesCount < 3) { if (Creature* pBrazier = Creature::GetCreature(*me, RAND(uiFlameBrazier_1, uiFlameBrazier_2))) { if (IsHeroic()) // find correct spell { int dmg = 3825 + rand()%1350; pBrazier->CastCustomSpell(pBrazier, SPELL_BALL_OF_FLAME, &dmg, 0, 0, true); } else pBrazier->CastSpell(pBrazier, SPELL_BALL_OF_FLAME, true); } uiCallFlamesTimer = 1*IN_MILLISECONDS; ++uiFlamesCount; } else { bFlames = false; uiCallFlamesTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS); uiFlamesCount = 0; } } } else uiCallFlamesTimer -= diff; if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*uiHealthAmountModifier))) { ++uiHealthAmountModifier; pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (pSacrificeTarget) { DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1, SAY_SACRIFICE_PLAYER_2, SAY_SACRIFICE_PLAYER_3, SAY_SACRIFICE_PLAYER_4, SAY_SACRIFICE_PLAYER_5), me); me->GetMotionMaster()->Clear(); DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); DoTeleportPlayer(pSacrificeTarget, 296.632f, -346.075f, 90.63f, 4.6f); Phase = SACRIFICING; for (uint8 i = 0; i < 3; ++i) if (Creature* pRitualChanneler = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 100*HOUR)) if (pRitualChanneler->AI()) pRitualChanneler->AI()->SetGUID(pSacrificeTarget->GetGUID()); } } DoMeleeAttackIfReady(); } else //SACRIFICING { if (uiSacrificeTimer <= diff) { Creature* pTarget = Creature::GetCreature(*me, uiRitualTarget); if (pTarget) { DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); DoCast(me, SPELL_RITUAL_OF_THE_SWORD_DISARM, true); } bMove = false; Phase = NORMAL; uiMoveTimer = 23*IN_MILLISECONDS; uiSacrificeTimer = 2*IN_MILLISECONDS; uiSinsterStrikeTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); uiCallFlamesTimer = urand(13*IN_MILLISECONDS, 18*IN_MILLISECONDS); } else uiSacrificeTimer -= diff; } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (Fireball_Timer <= diff) { if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(victim, SPELL_FIREBALL, true); Fireball_Timer = urand(4000, 7000); } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; me->SetDisableGravity(false); me->SetWalk(true); me->GetMotionMaster()->Clear(); if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0)) AttackStart(victim); DoStartMovement(me->GetVictim()); Talk(EMOTE); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(me, SPELL_CONE_OF_FIRE); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (IsHeroic()) { if (BellowingRoar_Timer <= diff) { DoCast(me, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; } DoMeleeAttackIfReady(); } }
void KilledUnit(Unit* who) { DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me); if (IsHeroic() && who->GetEntry() == CREATURE_SCOURGE_HULK) pInstance->DoCompleteAchievement(ACHIEV_INCREDIBLE_HULK); }
void Reset() { if (IsHeroic()) DoCast(me, SPELL_SHADOWS_IN_THE_DARK); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FEL_EXPLOSION: DoCastAOE(SPELL_FEL_EXPLOSION); events.ScheduleEvent(EVENT_FEL_EXPLOSION, 2000, 0, PHASE_NORMAL); break; case EVENT_DRAIN_CRYSTAL: SelectNearestCrystal(); _scheduledEvents = false; break; case EVENT_DRAIN_MANA: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) DoCast(target, SPELL_DRAIN_MANA); events.ScheduleEvent(EVENT_DRAIN_MANA, 10000, 0, PHASE_NORMAL); break; case EVENT_DRAIN_LIFE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true)) DoCast(target, SPELL_DRAIN_LIFE); events.ScheduleEvent(EVENT_DRAIN_LIFE, 10000, 0, PHASE_NORMAL); break; case EVENT_EMPOWER: { Talk(SAY_EMPOWERED); Creature* CrystalChosen = ObjectAccessor::GetCreature(*me, CrystalGUID); if (CrystalChosen && CrystalChosen->IsAlive()) CrystalChosen->Kill(CrystalChosen); CrystalGUID.Clear(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->GetVictim()); break; } default: break; } } if (me->GetPowerPct(POWER_MANA) < 10.f) { if (events.IsInPhase(PHASE_NORMAL) && !_scheduledEvents) { _scheduledEvents = true; uint32 timer = urand(3000, 7000); events.ScheduleEvent(EVENT_DRAIN_LIFE, timer, 0, PHASE_NORMAL); if (IsHeroic()) { events.ScheduleEvent(EVENT_DRAIN_CRYSTAL, urand(10000, 15000), 0, PHASE_NORMAL); events.ScheduleEvent(EVENT_DRAIN_MANA, timer + 5000, 0, PHASE_NORMAL); } else events.ScheduleEvent(EVENT_DRAIN_CRYSTAL, urand(20000, 25000), 0, PHASE_NORMAL); } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (Fireball_Timer <= diff) { if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(victim, DUNGEON_MODE(SPELL_FIREBALL, SPELL_FIREBALL_H), true); Fireball_Timer = urand(4000, 7000); } else Fireball_Timer -= diff; if (flight) // phase 1 - the flight { Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && Vazruden->HealthAbovePct(20))) { flight = false; BellowingRoar_Timer = 6000; ConeOfFire_Timer = 12000; me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); me->GetMotionMaster()->Clear(); if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0)) me->AI()->AttackStart(victim); DoStartMovement(me->getVictim()); DoScriptText(EMOTE, me); return; } else Fly_Timer -= diff; if (Turn_Timer <= diff) { uint32 waypoint = (Fly_Timer/10000)%2; if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5)) me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); Turn_Timer = 10000; } else Turn_Timer -= diff; } else // phase 2 - land fight { if (ConeOfFire_Timer <= diff) { DoCast(me, DUNGEON_MODE(SPELL_CONE_OF_FIRE, SPELL_CONE_OF_FIRE_H)); ConeOfFire_Timer = 12000; Fireball_Timer = 4000; } else ConeOfFire_Timer -= diff; if (IsHeroic()) { if (BellowingRoar_Timer <= diff) { DoCast(me, SPELL_BELLOWING_ROAR); BellowingRoar_Timer = 45000; } else BellowingRoar_Timer -= diff; } DoMeleeAttackIfReady(); } }
void EnterCombat(Unit* who) { events.ScheduleEvent(EVENT_BURNING_ACID, urand(7000, 15000)); if (IsHeroic()) events.ScheduleEvent(EVENT_FIERY_WEB_SPIN, urand(5000, 15000)); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (uiPhaseTimer <= diff) { switch (Phase) { case CASTING_FLAME_SPHERES: //DoCast(m_creature, SPELL_FLAME_SPHERE_SUMMON_1); pSpheres[0] = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); pSphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (pSphereTarget && pSpheres[0]) { float angle,x,y; angle = pSpheres[0]->GetAngle(pSphereTarget); x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle); y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle); pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ()); } if (IsHeroic()) { //DoCast(m_creature, H_SPELL_FLAME_SPHERE_SUMMON_1); pSpheres[1] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); //DoCast(m_creature, H_SPELL_FLAME_SPHERE_SUMMON_2); pSpheres[2] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); if (pSphereTarget && pSpheres[1] && pSpheres[2]) { float angle,x,y; angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET; x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ()); angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET; x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ()); } } Phase = NORMAL; uiPhaseTimer = 0; break; case JUST_VANISHED: if(pEmbraceTarget) { m_creature->GetMotionMaster()->Clear(); m_creature->SetSpeed(MOVE_WALK, 2.0f, true); m_creature->GetMotionMaster()->MoveChase(pEmbraceTarget); } Phase = VANISHED; uiPhaseTimer = 1300; break; case VANISHED: if(pEmbraceTarget) DoCast(pEmbraceTarget, DUNGEON_MODE(SPELL_EMBRACE_OF_THE_VAMPYR, H_SPELL_EMBRACE_OF_THE_VAMPYR)); m_creature->GetMotionMaster()->Clear(); m_creature->SetSpeed(MOVE_WALK, 1.0f, true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); Phase = FEEDING; uiPhaseTimer = 20000; break; case FEEDING: Phase = NORMAL; uiPhaseTimer = 0; pEmbraceTarget = NULL; break; case NORMAL: if (uiBloodthirstTimer <= diff) { DoCast(m_creature->getVictim(), SPELL_BLOODTHIRST); uiBloodthirstTimer = 10000; } else uiBloodthirstTimer -= diff; if (uiFlamesphereTimer <= diff) { DoCast(m_creature, SPELL_CONJURE_FLAME_SPHERE); Phase = CASTING_FLAME_SPHERES; uiPhaseTimer = 3000 + diff; uiFlamesphereTimer = 15000; } else uiFlamesphereTimer -= diff; if (uiVanishTimer <= diff) { //Count alive players Unit *pTarget = NULL; std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> target_list; for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); // exclude pets & totems if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) target_list.push_back(pTarget); pTarget = NULL; } //He only vanishes if there are 3 or more alive players if (target_list.size() > 2) { DoScriptText(RAND(SAY_VANISH_1,SAY_VANISH_2), m_creature); DoCast(m_creature, SPELL_VANISH); Phase = JUST_VANISHED; uiPhaseTimer = 500; pEmbraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); } uiVanishTimer = urand(25000,35000); } else uiVanishTimer -= diff; DoMeleeAttackIfReady(); break; } } else uiPhaseTimer -= diff; }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (m_uiStage) { case 0: if (m_uiFreezeSlashTimer <= uiDiff) { DoCastVictim(SPELL_FREEZE_SLASH); m_uiFreezeSlashTimer = 15*IN_MILLISECONDS; } else m_uiFreezeSlashTimer -= uiDiff; if (m_uiPenetratingColdTimer <= uiDiff) { me->CastCustomSpell(RAID_MODE(SPELL_PENETRATING_COLD_10_N, SPELL_PENETRATING_COLD_25_N, SPELL_PENETRATING_COLD_10_H, SPELL_PENETRATING_COLD_25_H) , SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5)); m_uiPenetratingColdTimer = 20*IN_MILLISECONDS; } else m_uiPenetratingColdTimer -= uiDiff; if (m_uiSummonNerubianTimer <= uiDiff && (IsHeroic() || !m_bReachedPhase3)) { me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4)); m_uiSummonNerubianTimer = 45*IN_MILLISECONDS; } else m_uiSummonNerubianTimer -= uiDiff; if (IsHeroic() && m_uiNerubianShadowStrikeTimer <= uiDiff) { Summons.DoAction(NPC_BURROWER, ACTION_SHADOW_STRIKE); m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; } else m_uiNerubianShadowStrikeTimer -= uiDiff; if (m_uiSubmergeTimer <= uiDiff && !m_bReachedPhase3 && !me->HasAura(SPELL_BERSERK)) { m_uiStage = 1; m_uiSubmergeTimer = 60*IN_MILLISECONDS; } else m_uiSubmergeTimer -= uiDiff; break; case 1: DoCast(me, SPELL_SUBMERGE_ANUBARAK); DoCast(me, SPELL_CLEAR_ALL_DEBUFFS); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoScriptText(SAY_BURROWER, me); m_uiScarabSummoned = 0; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; m_uiStage = 2; break; case 2: if (m_uiPursuingSpikeTimer <= uiDiff) { DoCast(SPELL_SPIKE_CALL); // Just to make sure it won't happen again in this phase m_uiPursuingSpikeTimer = 90*IN_MILLISECONDS; } else m_uiPursuingSpikeTimer -= uiDiff; if (m_uiSummonScarabTimer <= uiDiff) { /* WORKAROUND * - The correct implementation is more likely the comment below but it needs spell knowledge */ std::list<uint64>::iterator i = m_vBurrowGUID.begin(); uint32 at = urand(0, m_vBurrowGUID.size()-1); for (uint32 k = 0; k < at; k++) ++i; if (Creature* pBurrow = Unit::GetCreature(*me, *i)) pBurrow->CastSpell(pBurrow, 66340, false); m_uiScarabSummoned++; m_uiSummonScarabTimer = 4*IN_MILLISECONDS; if (m_uiScarabSummoned == 4) m_uiSummonScarabTimer = RAID_MODE(4, 20)*IN_MILLISECONDS; /*It seems that this spell have something more that needs to be taken into account //Need more sniff info DoCast(SPELL_SUMMON_BEATLES); // Just to make sure it won't happen again in this phase m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/ } else m_uiSummonScarabTimer -= uiDiff; if (m_uiSubmergeTimer <= uiDiff) { m_uiStage = 3; m_uiSubmergeTimer = 80*IN_MILLISECONDS; } else m_uiSubmergeTimer -= uiDiff; break; case 3: m_uiStage = 0; DoCast(SPELL_SPIKE_TELE); if (Creature* pSpike = Unit::GetCreature(*me, m_uiSpikeGUID)) me->NearTeleportTo(pSpike->GetPositionX(), pSpike->GetPositionY(), pSpike->GetPositionZ(), pSpike->GetOrientation()); Summons.DespawnEntry(NPC_SPIKE); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_EMERGE_ANUBARAK); me->GetMotionMaster()->MoveChase(me->getVictim()); m_uiSummonNerubianTimer = 10*IN_MILLISECONDS; m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS; m_uiSummonScarabTimer = 2*IN_MILLISECONDS; break; } if (!IsHeroic()) { if (m_uiSummonFrostSphereTimer <= uiDiff) { uint8 startAt = urand(0, 5); uint8 i = startAt; do { if (Unit* pSphere = Unit::GetCreature(*me, m_aSphereGUID[i])) { if (!pSphere->HasAura(SPELL_FROST_SPHERE)) { if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i])) m_aSphereGUID[i] = summon->GetGUID(); break; } } i = (i+1)%6; } while (i != startAt); m_uiSummonFrostSphereTimer = urand(20, 30)*IN_MILLISECONDS; } else m_uiSummonFrostSphereTimer -= uiDiff; } if (HealthBelowPct(30) && m_uiStage == 0 && !m_bReachedPhase3) { m_bReachedPhase3 = true; DoCastAOE(RAID_MODE(SPELL_LEECHING_SWARM_10_N, SPELL_LEECHING_SWARM_25_N, SPELL_LEECHING_SWARM_10_H, SPELL_LEECHING_SWARM_25_H)); DoScriptText(EMOTE_LEECHING_SWARM, me); DoScriptText(SAY_LEECHING_SWARM, me); } if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK)) { DoCast(me, SPELL_BERSERK); } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target or casting if (!UpdateVictim() || me->IsNonMeleeSpellCasted(false)) return; // Sonic Boom if (SonicBoom) { DoCast(me, SPELL_SONIC_BOOM_EFFECT, true); SonicBoomEffect(); SonicBoom = false; Resonance_Timer = 1500; } if (SonicBoom_Timer <= diff) { DoScriptText(EMOTE_SONIC_BOOM, me); DoCast(me, SPELL_SONIC_BOOM_CAST); SonicBoom_Timer = 30000; SonicBoom = true; return; } else SonicBoom_Timer -= diff; // Murmur's Touch if (MurmursTouch_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true)) DoCast(target, SPELL_MURMURS_TOUCH); MurmursTouch_Timer = urand(25000, 35000); } else MurmursTouch_Timer -= diff; // Resonance if (!SonicBoom && !(me->IsWithinMeleeRange(me->getVictim()))) { if (Resonance_Timer <= diff) { DoCast(me, SPELL_RESONANCE); Resonance_Timer = 5000; } else Resonance_Timer -= diff; } // Magnetic Pull if (MagneticPull_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) { DoCast(target, SPELL_MAGNETIC_PULL); MagneticPull_Timer = 15000+rand()%15000; return; } MagneticPull_Timer = 500; } else MagneticPull_Timer -= diff; if (IsHeroic()) { // Thundering Storm if (ThunderingStorm_Timer <= diff) { std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) if (target->isAlive() && !me->IsWithinDist(target, 35, false)) DoCast(target, SPELL_THUNDERING_STORM, true); ThunderingStorm_Timer = 15000; } else ThunderingStorm_Timer -= diff; // Sonic Shock if (SonicShock_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20, false)) if (target->isAlive()) DoCast(target, SPELL_SONIC_SHOCK); SonicShock_Timer = 10000+rand()%10000; } else SonicShock_Timer -= diff; } // Select nearest most aggro target if top aggro too far if (!me->isAttackReady()) return; if (!me->IsWithinMeleeRange(me->getVictim())) { std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) if (target->isAlive() && me->IsWithinMeleeRange(target)) { me->TauntApply(target); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BONE_SPIKE_GRAVEYARD: if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM)) DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD); events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_COLDFLAME: _coldflameLastPos.Relocate(me); _coldflameTarget.Clear(); if (!me->HasAura(SPELL_BONE_STORM)) DoCastAOE(SPELL_COLDFLAME_NORMAL); else DoCast(me, SPELL_COLDFLAME_BONE_STORM); events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); break; case EVENT_WARN_BONE_STORM: _boneSlice = false; Talk(EMOTE_BONE_STORM); me->FinishSpell(CURRENT_MELEE_SPELL, false); DoCast(me, SPELL_BONE_STORM); events.DelayEvents(3000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050); events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(90000, 95000)); break; case EVENT_BONE_STORM_BEGIN: me->SetReactState(REACT_PASSIVE); if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) pStorm->SetDuration(int32(_boneStormDuration)); me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true); Talk(SAY_BONE_STORM); events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1); // no break here case EVENT_BONE_STORM_MOVE: { events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/3); Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)); if (!unit) unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (unit) me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, *unit); break; } case EVENT_BONE_STORM_END: me->SetReactState(REACT_AGGRESSIVE); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->GetVictim()); me->SetSpeed(MOVE_RUN, _baseSpeed, true); events.CancelEvent(EVENT_BONE_STORM_MOVE); events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); if (!IsHeroic()) events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 15000, EVENT_GROUP_SPECIAL); break; case EVENT_ENABLE_BONE_SLICE: _boneSlice = true; break; case EVENT_ENRAGE: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } // We should not melee attack when storming if (me->HasAura(SPELL_BONE_STORM)) return; // 10 seconds since encounter start Bone Slice replaces melee attacks if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) DoCastVictim(SPELL_BONE_SLICE); 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 (!Intro) { if (!pInstance) return; if (Intro_Timer <= diff) { switch (Intro_Phase) { case 1: DoScriptText(SAY_INTRO, me); pInstance->HandleGameObject(pInstance->GetData64(DATA_SPHERE_SHIELD), true); ++Intro_Phase; Intro_Timer = 25000; break; case 2: DoScriptText(SAY_AGGRO, me); if (Unit* mellic = Unit::GetUnit(*me, pInstance->GetData64(DATA_MELLICHAR))) { //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); pInstance->SetData(TYPE_SHIELD_OPEN, IN_PROGRESS); } ++Intro_Phase; Intro_Timer = 3000; break; case 3: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); Intro = true; break; } } else Intro_Timer -=diff; } if (!UpdateVictim()) return; if (!IsImage66 && !HealthAbovePct(66)) { DoSplit(66); IsImage66 = true; } if (!IsImage33 && !HealthAbovePct(33)) { DoSplit(33); IsImage33 = true; } if (MindRend_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_MIND_REND); else DoCast(me->getVictim(), SPELL_MIND_REND); MindRend_Timer = 8000; } else MindRend_Timer -=diff; if (Fear_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) return; DoScriptText(RAND(SAY_FEAR_1, SAY_FEAR_2), me); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_FEAR); else DoCast(me->getVictim(), SPELL_FEAR); Fear_Timer = 25000; } else Fear_Timer -=diff; if (Domination_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) return; DoScriptText(RAND(SAY_MIND_1, SAY_MIND_2), me); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_DOMINATION); else DoCast(me->getVictim(), SPELL_DOMINATION); Domination_Timer = 16000+rand()%16000; } else Domination_Timer -=diff; if (IsHeroic()) { if (ManaBurn_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) return; if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, H_SPELL_MANA_BURN); ManaBurn_Timer = 16000+rand()%16000; } else ManaBurn_Timer -=diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (Assassins_Timer) if (Assassins_Timer <= diff) { SpawnAssassin(); Assassins_Timer = 0; } else Assassins_Timer -= diff; if (InBlade) { if (Wait_Timer) if (Wait_Timer <= diff) { if (target_num <= 0) { // stop bladedance InBlade = false; m_creature->SetSpeed(MOVE_RUN,2); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); Blade_Dance_Timer = 30000; Wait_Timer = 0; if (IsHeroic()) Charge_timer = 5000; } else { //move in bladedance float x,y,randx,randy; randx = (rand()%40); randy = (rand()%40); x = 210+ randx ; y = -60- randy ; m_creature->GetMotionMaster()->MovePoint(1,x,y,m_creature->GetPositionZ()); Wait_Timer = 0; } } else Wait_Timer -= diff; } else { if (Blade_Dance_Timer) if (Blade_Dance_Timer <= diff) { target_num = TARGET_NUM; Wait_Timer = 1; InBlade = true; Blade_Dance_Timer = 0; m_creature->SetSpeed(MOVE_RUN,4); return; } else Blade_Dance_Timer -= diff; if (Charge_timer) if (Charge_timer <= diff) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), H_SPELL_CHARGE); Charge_timer = 0; } else Charge_timer -= diff; if (Summon_Assistant_Timer <= diff) { Unit *pTarget = NULL; for (uint8 i = 0; i < summoned; ++i) { switch (urand(0,2)) { case 0: m_creature->SummonCreature(MOB_HEARTHEN_GUARD,AddsEntrance[0],AddsEntrance[1], AddsEntrance[2], 0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); break; case 1: m_creature->SummonCreature(MOB_SHARPSHOOTER_GUARD,AddsEntrance[0],AddsEntrance[1], AddsEntrance[2], 0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); break; case 2: m_creature->SummonCreature(MOB_REAVER_GUARD,AddsEntrance[0],AddsEntrance[1], AddsEntrance[2], 0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); break; } } if (urand(0,9) < 2) ++summoned; Summon_Assistant_Timer = urand(25000,35000); } else Summon_Assistant_Timer -= diff; DoMeleeAttackIfReady(); } if (resetcheck_timer <= diff) { uint32 tempx,tempy; tempx = uint32(m_creature->GetPositionX()); tempy = uint32(m_creature->GetPositionY()); if (tempx > 255 || tempx < 205) { EnterEvadeMode(); return; } resetcheck_timer = 5000; } else resetcheck_timer -= diff; }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; if (uiPlagueTimer <= diff) { DoCastVictim(SPELL_BROOD_PLAGUE); uiPlagueTimer = 15000; } else uiPlagueTimer -= diff; if (IsHeroic()) { if (uiRagueTimer <= diff) { if (Creature* Swarmer = me->FindNearestCreature(MOB_AHNKAHAR_SWARMER, 35.0f)) { DoCast(Swarmer, H_SPELL_BROOD_RAGE, true); uiRagueTimer = 15000; } } else uiRagueTimer -= diff; } if (uiSwarmerSpawnTimer <= diff) { DoCast(me, SPELL_SUMMON_SWARMERS, true); DoCast(me, SPELL_SUMMON_SWARMERS); if (urand(1, 3) == 3) // 33% chance of dialog Talk(SAY_EGG_SAC); uiSwarmerSpawnTimer = 10000; } else uiSwarmerSpawnTimer -= diff; if (!bGuardSpawned && uiGuardSpawnTimer <= diff) { Talk(EMOTE_HATCHES, me->GetGUID()); DoCast(me, SPELL_SUMMON_SWARM_GUARD); bGuardSpawned = true; } else uiGuardSpawnTimer -= diff; if (uiEnrageTimer <= diff) { if (me->HasAura(SPELL_ENRAGE, 0)) return; float x, y, z, o; me->GetHomePosition(x, y, z, o); if (z < 24) if (!me->IsNonMeleeSpellCasted(false)) DoCast(me, SPELL_ENRAGE, true); uiEnrageTimer = 5000; } else uiEnrageTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (ghost) { if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } if (!UpdateVictim()) return; if (AggroYell_Timer) { if (AggroYell_Timer <= diff) { DoScriptText(YELL_DALRONN_AGGRO, me); AggroYell_Timer = 0; } else AggroYell_Timer -= diff; } if (!ghost) { if (Check_Timer) { if (Check_Timer <= diff) { Check_Timer = 5000; Unit* skarvald = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SKARVALD) : 0); if (skarvald && skarvald->isDead()) { Skarvald_isDead = true; Response_Timer = 2000; Check_Timer = 0; } } else Check_Timer -= diff; } if (Response_Timer && Skarvald_isDead) { if (Response_Timer <= diff) { DoScriptText(YELL_DALRONN_SKA_DIEDFIRST, me); Response_Timer = 0; } else Response_Timer -= diff; } } if (ShadowBolt_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells } } else ShadowBolt_Timer -= diff; if (Debilitate_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); Debilitate_Timer = 5000+rand()%5000; } } else Debilitate_Timer -= diff; if (IsHeroic()) { if (Summon_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, H_SPELL_SUMMON_SKELETONS); Summon_Timer = (rand()%10000) + 20000; } } else Summon_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.GetEvent()) { case EVENT_YMIRON_HEALTH_CHECK: { if (me->GetHealth() < std::max(0.0f, float(me->GetMaxHealth()*(1.0f-(IsHeroic() ? 0.2f : 0.334f)*float(BoatNum+1))))) { events.DelayEvents(12000); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->InterruptNonMeleeSpells(true); me->CastSpell(me, SPELL_SCREAMS_OF_THE_DEAD, true); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, BoatStructure[BoatOrder[BoatNum]].MoveX, BoatStructure[BoatOrder[BoatNum]].MoveY, BoatStructure[BoatOrder[BoatNum]].MoveZ); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); summons.DespawnAll(); // Spawn flames in previous boat if any if (BoatNum) // different than 0 if (Creature *cr = me->SummonTrigger(BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, 0, 1800000)) { cr->AddAura(SPELL_FLAMES, cr); summons2.Summon(cr); } BoatNum++; } events.RepeatEvent(1000); break; } case EVENT_YMIRON_BANE: { me->CastSpell(me, IsHeroic() ? SPELL_BANE_H : SPELL_BANE_N, false); events.RepeatEvent(20000+rand()%5000); break; } case EVENT_YMIRON_FETID_ROT: { me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_FETID_ROT_H : SPELL_FETID_ROT_N, false); events.RepeatEvent(10000+rand()%3000); break; } case EVENT_YMIRON_DARK_SLASH: { int32 dmg = me->GetVictim()->GetHealth() / 2; me->CastCustomSpell(me->GetVictim(), SPELL_DARK_SLASH, &dmg, 0, 0, false); events.RepeatEvent(30000+rand()%5000); break; } case EVENT_YMIRON_ACTIVATE_BOAT: { // Spawn it! if (Creature* king = me->SummonCreature(BoatStructure[BoatOrder[BoatNum-1]].npc, BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, BoatStructure[BoatOrder[BoatNum-1]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); king->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); summons.Summon(king); king->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); king->SetDisableGravity(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->GetMotionMaster()->MoveChase(me->GetVictim()); switch(BoatOrder[BoatNum-1]) { case 0: events.ScheduleEvent(EVENT_YMIRON_RANULF_ABILITY, 3000, 1); break; case 1: events.ScheduleEvent(EVENT_YMIRON_TORGYN_ABILITY, 3000, 1); break; case 2: events.ScheduleEvent(EVENT_YMIRON_BJORN_ABILITY, 3000, 1); break; case 3: events.ScheduleEvent(EVENT_YMIRON_HALDOR_ABILITY, 3000, 1); break; } } events.PopEvent(); break; } case EVENT_YMIRON_BJORN_ABILITY: { if (Creature* sf = me->SummonCreature(NPC_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) { summons.Summon(sf); sf->SetSpeed(MOVE_RUN, 0.4f); sf->AddAura(IsHeroic() ? SPELL_SPIRIT_FOUNT_H : SPELL_SPIRIT_FOUNT_N, sf); sf->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); sf->GetMotionMaster()->MoveFollow(me->GetVictim(), 0, rand_norm()*M_PI*2); } events.PopEvent(); break; } case EVENT_YMIRON_HALDOR_ABILITY: { me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SPIRIT_STRIKE_H : SPELL_SPIRIT_STRIKE_N, false); events.RepeatEvent(5000); break; } case EVENT_YMIRON_RANULF_ABILITY: { me->CastSpell(me, IsHeroic() ? SPELL_SPIRIT_BURST_H : SPELL_SPIRIT_BURST_N, false); events.RepeatEvent(10000); break; } case EVENT_YMIRON_TORGYN_ABILITY: { for(uint8 i = 0; i < 4; ++i) { if (Creature* as = me->SummonCreature(NPC_AVENGING_SPIRIT, me->GetPositionX()+rand()%10, me->GetPositionY()+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { summons.Summon(as); as->SetInCombatWithZone(); } } events.RepeatEvent(15000); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (bIsWaitingToAppear) { me->StopMoving(); me->AttackStop(); if (uiIsWaitingToAppearTimer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); bIsWaitingToAppear = false; } else uiIsWaitingToAppearTimer -= diff; return; } if ((Phase == 1) ||(Phase == 3)) { if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) { for (uint8 n = 0; n < 3; ++n) time[n] = 0; me->GetMotionMaster()->Clear(); me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); DoCast(me, SPELL_TELESTRA_BACK); me->SetVisible(true); if (Phase == 1) Phase = 2; if (Phase == 3) Phase = 4; uiFireMagusGUID = 0; uiFrostMagusGUID = 0; uiArcaneMagusGUID = 0; bIsWaitingToAppear = true; uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; DoScriptText(SAY_MERGE, me); } else return; } if ((Phase == 0) && HealthBelowPct(50)) { Phase = 1; me->CastStop(); me->RemoveAllAuras(); me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); bFireMagusDead = false; bFrostMagusDead = false; bArcaneMagusDead = false; DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me); return; } if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) { Phase = 3; me->CastStop(); me->RemoveAllAuras(); me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); bFireMagusDead = false; bFrostMagusDead = false; bArcaneMagusDead = false; DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me); return; } if (uiCooldown) { if (uiCooldown <= diff) uiCooldown = 0; else { uiCooldown -= diff; return; } } if (uiIceNovaTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_ICE_NOVA, false); uiCooldown = 1500; } uiIceNovaTimer = 15*IN_MILLISECONDS; } else uiIceNovaTimer -= diff; if (uiGravityWellTimer <= diff) { if (Unit* target = me->getVictim()) { DoCast(target, SPELL_GRAVITY_WELL); uiCooldown = 6*IN_MILLISECONDS; } uiGravityWellTimer = 15*IN_MILLISECONDS; } else uiGravityWellTimer -= diff; if (uiFireBombTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_FIREBOMB, false); uiCooldown = 2*IN_MILLISECONDS; } uiFireBombTimer = 2*IN_MILLISECONDS; } else uiFireBombTimer -=diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (Blink) { DoCast(me, SPELL_ARCANE_EXPLOSION); DoCast(me, SPELL_ARCANE_BUBBLE, true); Blink = false; } if (ArcaneVolley_Timer <= diff) { DoCast(me, SPELL_ARCANE_VOLLEY); ArcaneVolley_Timer = 7000+rand()%5000; } else ArcaneVolley_Timer -= diff; if (Sheep_Timer <= diff) { Unit *pTarget; //second top aggro target in normal, random target in heroic correct? if (IsHeroic()) pTarget = SelectTarget(SELECT_TARGET_RANDOM,0); else pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO,1); if (pTarget) DoCast(pTarget, SPELL_POLYMORPH); Sheep_Timer = 15000+rand()%2500; } else Sheep_Timer -= diff; //may not be correct time to cast if (!ManaShield && HealthBelowPct(20)) { DoCast(me, SPELL_MANA_SHIELD); ManaShield = true; } if (IsHeroic()) { if (Slow_Timer <= diff) { DoCast(me, H_SPELL_SLOW); Slow_Timer = 15000+rand()%25000; } else Slow_Timer -= diff; } if (Blink_Timer <= diff) { DoScriptText(EMOTE_ARCANE_EXP, me); if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0)) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); //Spell doesn't work, but we use for visual effect at least DoCast(pTarget, SPELL_BLINK); float X = pTarget->GetPositionX(); float Y = pTarget->GetPositionY(); float Z = pTarget->GetPositionZ(); DoTeleportTo(X,Y,Z); DoCast(pTarget, SPELL_BLINK_TELEPORT); Blink = true; } Blink_Timer = 35000+rand()%5000; } else Blink_Timer -= diff; if (!Blink) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 uiDiff) override { if (!_instance) return; if (_instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) return; uint32 _updateTimer = _instance->GetData(TYPE_EVENT_TIMER); if (_updateTimer <= uiDiff) { switch (_instance->GetData(TYPE_EVENT)) { case 110: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_01); _updateTimer = 22*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 120); break; case 140: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK); Talk(SAY_STAGE_0_02); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 150); break; case 150: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } } _updateTimer = 3*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 155); break; case 155: // keep the raid in combat for the whole encounter, pauses included me->SetInCombatWithZone(); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 160); break; case 200: Talk(SAY_STAGE_0_04); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } } _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 220); break; case 220: _instance->SetData(TYPE_EVENT, 230); break; case 300: Talk(SAY_STAGE_0_05); if (_instance->GetBossState(BOSS_BEASTS) != DONE) { _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); } } _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 315); break; case 315: _instance->SetData(TYPE_EVENT, 320); break; case 400: Talk(SAY_STAGE_0_06); me->getThreatManager().clearReferences(); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 666: Talk(SAY_STAGE_0_WIPE); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 1010: Talk(SAY_STAGE_1_01); _updateTimer = 7*IN_MILLISECONDS; _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); _instance->SetData(TYPE_EVENT, 0); break; case 1180: Talk(SAY_STAGE_1_07); _updateTimer = 3*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 2000: Talk(SAY_STAGE_1_08); _updateTimer = 18*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 2010); break; case 2030: Talk(SAY_STAGE_1_11); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 3000: Talk(SAY_STAGE_2_01); _updateTimer = 12*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3050); break; case 3001: Talk(SAY_STAGE_2_01); _updateTimer = 10*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3051); break; case 3060: Talk(SAY_STAGE_2_03); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3070); break; case 3061: Talk(SAY_STAGE_2_03); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3071); break; //Summoning crusaders case 3091: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, HORDE); _updateTimer = 3*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3092); break; //Summoning crusaders case 3090: if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, ALLIANCE); _updateTimer = 3*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 3092); break; case 3092: if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(1, NOT_STARTED); _instance->SetData(TYPE_EVENT, 3095); break; //Crusaders battle end case 3100: Talk(SAY_STAGE_2_06); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 4000: Talk(SAY_STAGE_3_01); _updateTimer = 13*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 4010); break; case 4010: Talk(SAY_STAGE_3_02); if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetVisible(false); temp->SetReactState(REACT_PASSIVE); temp->SummonCreature(NPC_LIGHT_ESSENCE, TwinValkyrsLoc[0].GetPositionX(), TwinValkyrsLoc[0].GetPositionY(), TwinValkyrsLoc[0].GetPositionZ()); temp->SummonCreature(NPC_LIGHT_ESSENCE, TwinValkyrsLoc[1].GetPositionX(), TwinValkyrsLoc[1].GetPositionY(), TwinValkyrsLoc[1].GetPositionZ()); } if (Creature* temp = me->SummonCreature(NPC_DARKBANE, ToCSpawnLoc[2].GetPositionX(), ToCSpawnLoc[2].GetPositionY(), ToCSpawnLoc[2].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { temp->SetVisible(false); temp->SetReactState(REACT_PASSIVE); temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[2].GetPositionX(), TwinValkyrsLoc[2].GetPositionY(), TwinValkyrsLoc[2].GetPositionZ()); temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[3].GetPositionX(), TwinValkyrsLoc[3].GetPositionY(), TwinValkyrsLoc[3].GetPositionZ()); } _updateTimer = 3*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 4015); break; case 4015: _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_LIGHTBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); temp->SetVisible(true); } if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_DARKBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); temp->SetVisible(true); } _updateTimer = 10*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 4016); break; case 4016: _instance->DoUseDoorOrButton(_instance->GetGuidData(GO_MAIN_GATE_DOOR)); _instance->SetData(TYPE_EVENT, 4017); break; case 4040: _updateTimer = 1*MINUTE*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 5000); break; case 5000: Talk(SAY_STAGE_4_01); _updateTimer = 10*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 5005); break; case 5005: _updateTimer = 8*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 5010); me->SummonCreature(NPC_LICH_KING, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5); break; case 5020: Talk(SAY_STAGE_4_03); _updateTimer = 1*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 0); break; case 6000: me->SummonCreature(NPC_TIRION_FORDRING, EndSpawnLoc[0].GetPositionX(), EndSpawnLoc[0].GetPositionY(), EndSpawnLoc[0].GetPositionZ()); me->SummonCreature(NPC_ARGENT_MAGE, EndSpawnLoc[1].GetPositionX(), EndSpawnLoc[1].GetPositionY(), EndSpawnLoc[1].GetPositionZ()); me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2].GetPositionX(), EndSpawnLoc[2].GetPositionY(), EndSpawnLoc[2].GetPositionZ(), 5, 0, 0, 0, 0, 0); _updateTimer = 20*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 6005); break; case 6005: if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_06); _updateTimer = 20*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 6010); break; case 6010: if (IsHeroic()) { if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetGuidData(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_07); _updateTimer = 1*MINUTE*IN_MILLISECONDS; _instance->SetBossState(BOSS_ANUBARAK, SPECIAL); _instance->SetData(TYPE_EVENT, 6020); } else _instance->SetData(TYPE_EVENT, 6030); break; case 6020: me->DespawnOrUnsummon(); _updateTimer = 5*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 6030); break; default: break; } } else _updateTimer -= uiDiff; _instance->SetData(TYPE_EVENT_TIMER, _updateTimer); }
void Reset() { DoCast(me, IsHeroic() ? SPELL_DARK_FISSURE_AURA_H : SPELL_DARK_FISSURE_AURA, true); }