npc_xt002_heartAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { SetCombatMovement(false); }
npc_devouring_flameAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); }
void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; switch(getStage()) { case 0: //GROUND if(m_uiFlameBreathTimer <= diff) { DoCast(SPELL_FLAME_BREATH); m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if(m_uiEnrage <= diff) { DoCast(SPELL_ENRAGE); m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS); DoScriptText(-1666405,me); } else m_uiEnrage -= diff; if( HealthBelowPct(81) ) setStage(1); break; case 1: //Air phase start SetCombatMovement(false); me->InterruptNonMeleeSpells(true); SetFly(true); doBeacon(true); StartMovement(1); setStage(2); break; case 2: // Wait for movement if(MovementStarted) return; DoCast(SPELL_CONFLAGATION); DoScriptText(-1666404,me); setStage(3); break; case 3: // Wait for cast finish if(!me->IsNonMeleeSpellCasted(false)) { doBeacon(false); setStage(4); } break; case 4: // Air phase if(m_uiFlameBreathTimer <= diff) { DoCast(SPELL_FLAME_BREATH); m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if(m_uiBeakonTimer <= diff) { doBeacon(true); DoCast(SPELL_CONFLAGATION); m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS); } else m_uiBeakonTimer -= diff; if(m_uiConflagrateTimer <= diff) { if(conflagated) { //DoCast(SPELL_CONFLAGATION_1); doBeacon(false); } m_uiConflagrateTimer = 5*IN_MILLISECONDS; } else m_uiConflagrateTimer -= diff; if( HealthBelowPct(61) ) setStage(5); break; case 5: //Air phase end StartMovement(0); setStage(6); break; case 6: // Wait for movement if(MovementStarted) return; SetFly(false); SetCombatMovement(true); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); setStage(7); break; case 7: //GROUND if(m_uiFlameBreathTimer <= diff) { DoCast(SPELL_FLAME_BREATH); m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if(m_uiEnrage <= diff) { DoCast(SPELL_ENRAGE); m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS); DoScriptText(-1666405,me); } else m_uiEnrage -= diff; if( HealthBelowPct(41) ) setStage(8); break; case 8: //Air phase start SetCombatMovement(false); me->InterruptNonMeleeSpells(true); SetFly(true); doBeacon(true); StartMovement(1); setStage(9); break; case 9: // Wait for movement if(MovementStarted) return; DoCast(SPELL_CONFLAGATION); DoScriptText(-1666404,me); setStage(10); break; case 10: // Wait for cast finish if(!me->IsNonMeleeSpellCasted(false)) { doBeacon(false); setStage(11); }; break; case 11: // Air phase if(m_uiFlameBreathTimer <= diff) { DoCast(SPELL_FLAME_BREATH); m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if(m_uiBeakonTimer <= diff) { doBeacon(true); DoCast(SPELL_CONFLAGATION); m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS); } else m_uiBeakonTimer -= diff; if(m_uiConflagrateTimer <= diff) { if(conflagated) { //DoCast(SPELL_CONFLAGATION_1); doBeacon(false); } m_uiConflagrateTimer = 5*IN_MILLISECONDS; } else m_uiConflagrateTimer -= diff; if( HealthBelowPct(21) ) setStage(12); break; case 12: //Air phase end StartMovement(0); setStage(13); break; case 13: // Wait for movement if(MovementStarted) return; SetFly(false); SetCombatMovement(true); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); setStage(14); break; case 14: //GROUND if(m_uiFlameBreathTimer <= diff) { DoCast(SPELL_FLAME_BREATH); m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if(m_uiEnrage <= diff) { DoCast(SPELL_ENRAGE); m_uiEnrage = urand(15*IN_MILLISECONDS,30*IN_MILLISECONDS); DoScriptText(-1666405,me); } else m_uiEnrage -= diff; break; default: break; } DoMeleeAttackIfReady(); }
npc_tribuna_controllerAI(Creature* creature) : ScriptedAI(creature) { Initialize(); instance = creature->GetInstanceScript(); SetCombatMovement(false); }
npc_mole_machine_triggerAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) { if (m_uiFlameBreathTimer <= uiDiff) { DoCast(me->getVictim(), SPELL_FLAMEBREATH); m_uiFlameBreathTimer = urand(10000, 20000); } else m_uiFlameBreathTimer -= uiDiff; if (m_uiTailSweepTimer <= uiDiff) { DoCast(me, SPELL_TAILSWEEP); m_uiTailSweepTimer = urand(15000, 20000); } else m_uiTailSweepTimer -= uiDiff; if (m_uiCleaveTimer <= uiDiff) { DoCast(me->getVictim(), SPELL_CLEAVE); m_uiCleaveTimer = urand(2000, 5000); } else m_uiCleaveTimer -= uiDiff; if (m_uiWingBuffetTimer <= uiDiff) { DoCast(me->getVictim(), SPELL_WINGBUFFET); m_uiWingBuffetTimer = urand(15000, 30000); } else m_uiWingBuffetTimer -= uiDiff; if (m_uiPhase == PHASE_END) { if (m_uiBellowingRoarTimer <= uiDiff) { DoCast(me->getVictim(), SPELL_BELLOWINGROAR); m_uiBellowingRoarTimer = 30000; } else m_uiBellowingRoarTimer -= uiDiff; } else { if (me->GetHealth()*100 / me->GetMaxHealth() < 60) { m_uiPhase = PHASE_BREATH; SetCombatMovement(false); me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); DoScriptText(SAY_PHASE_2_TRANS, me); if (m_pPointData) me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); SetNextRandomPoint(); return; } } DoMeleeAttackIfReady(); } else { if (me->GetHealth()*100 / me->GetMaxHealth() < 40) { m_uiPhase = PHASE_END; DoScriptText(SAY_PHASE_3_TRANS, me); SetCombatMovement(true); me->GetMotionMaster()->MoveChase(me->getVictim()); return; } if (m_uiMovementTimer <= uiDiff) { m_pPointData = GetMoveData(); SetNextRandomPoint(); m_uiMovementTimer = 25000; if (!m_pPointData) return; if (m_uiMovePoint == m_pPointData->uiLocIdEnd) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(false); DoScriptText(EMOTE_BREATH, me); DoCast(me, m_pPointData->uiSpellId); } else { me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); } } else m_uiMovementTimer -= uiDiff; if (m_uiEngulfingFlamesTimer <= uiDiff) { if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_FIREBALL); m_uiEngulfingFlamesTimer = 8000; } } else m_uiEngulfingFlamesTimer -= uiDiff; //engulfingflames is supposed to be activated by a fireball but haven't come by if (m_bIsSummoningWhelps) { if (m_uiSummonCount < MAX_WHELP) { if (m_uiWhelpTimer <= uiDiff) { me->SummonCreature(NPC_WHELP, afSpawnLocations[0][0], afSpawnLocations[0][1], afSpawnLocations[0][2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); me->SummonCreature(NPC_WHELP, afSpawnLocations[1][0], afSpawnLocations[1][1], afSpawnLocations[1][2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); m_uiWhelpTimer = 1000; } else m_uiWhelpTimer -= uiDiff; } else { m_bIsSummoningWhelps = false; m_uiSummonCount = 0; m_uiSummonWhelpsTimer = 30000; } } else { if (m_uiSummonWhelpsTimer <= uiDiff) m_bIsSummoningWhelps = true; else m_uiSummonWhelpsTimer -= uiDiff; } if (m_bIsSummoningLairGuards) { if (m_uiLairGuardTimer <= uiDiff) { me->SummonCreature(NPC_LAIRGUARD, afSpawnLocations[0][0], afSpawnLocations[0][1], afSpawnLocations[0][2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); me->SummonCreature(NPC_LAIRGUARD, afSpawnLocations[1][0], afSpawnLocations[1][1], afSpawnLocations[1][2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); m_uiLairGuardTimer = 30000; } else m_uiLairGuardTimer -= uiDiff; } else { if (m_uiLairGuardTimer <= uiDiff) m_bIsSummoningLairGuards = true; else m_uiLairGuardTimer -= uiDiff; } } }
npc_grobbulus_poison_cloudAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); creature->SetReactState(REACT_PASSIVE); }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (stage) { case 0: { bsw->timedCast(SPELL_FEROCIOUS_BUTT, uiDiff); bsw->timedCast(SPELL_ARCTIC_BREATH, uiDiff); bsw->timedCast(SPELL_WHIRL, uiDiff); if (bsw->timedQuery(SPELL_MASSIVE_CRASH, uiDiff)) stage = 1; bsw->timedCast(SPELL_FROTHING_RAGE, uiDiff); DoMeleeAttackIfReady(); break; } case 1: { if (bsw->doCast(SPELL_MASSIVE_CRASH) == CAST_OK) stage = 2; break; } case 2: { if (pTarget = bsw->SelectUnit()) { TrampleCasted = false; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); stage = 3; bsw->resetTimer(SPELL_TRAMPLE); DoScriptText(-1713506,me,pTarget); SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); } break; } case 3: { if (bsw->timedQuery(SPELL_TRAMPLE,uiDiff)) { pTarget->GetPosition(fPosX, fPosY, fPosZ); TrampleCasted = false; MovementStarted = true; me->GetMotionMaster()->MovePoint(1, fPosX, fPosY, fPosZ); DoScriptText(-1713508,me); bsw->doCast(SPELL_ADRENALINE); stage = 4; } break; } case 4: { if (MovementStarted) { Map* pMap = me->GetMap(); Map::PlayerList const &lPlayers = pMap->GetPlayers(); for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { Unit* pPlayer = itr->getSource(); if (!pPlayer) continue; if (pPlayer->isAlive() && pPlayer->IsWithinDistInMap(me, 5.0f)) { bsw->doCast(SPELL_TRAMPLE, pPlayer); TrampleCasted = true; MovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); } } } else stage = 5; if (TrampleCasted) stage = 5; break; } case 5: { if (!TrampleCasted) { bsw->doCast(SPELL_STAGGERED_DAZE); DoScriptText(-1713507,me); } MovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); SetCombatMovement(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); stage = 0; break; } } }
void UpdateAI(const uint32 uiDiff) { DialogueUpdate(uiDiff); if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Don't use spells during the epilogue if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) return; if (m_bIsFirstPhase) { // *Heroic mode only: if (!m_bIsRegularMode) { if (m_uiShockBarrierTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_SHOCK_BARRIER) == CAST_OK) { m_uiPyroblastTimer = 1000; m_uiShockBarrierTimer = 60000; } } else m_uiShockBarrierTimer -= uiDiff; if (m_uiPyroblastTimer) { if (m_uiPyroblastTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_PYROBLAST) == CAST_OK) m_uiPyroblastTimer = 0; } else m_uiPyroblastTimer -= uiDiff; } } if (m_uiFireballTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_FIREBALL : SPELL_FIREBALL_H) == CAST_OK) m_uiFireballTimer = urand(2000, 4000); } } else m_uiFireballTimer -= uiDiff; if (m_uiPhoenixTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_PHOENIX) == CAST_OK) { DoScriptText(SAY_PHOENIX, m_creature); m_uiPhoenixTimer = 45000; } } else m_uiPhoenixTimer -= uiDiff; if (m_uiFlameStrikeTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, SPELL_FLAME_STRIKE) == CAST_OK) { DoScriptText(SAY_FLAMESTRIKE, m_creature); m_uiFlameStrikeTimer = urand(15000, 25000); } } } else m_uiFlameStrikeTimer -= uiDiff; // Below 50% if (m_creature->GetHealthPercent() < 50.0f) { if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT_CENTER, CAST_INTERRUPT_PREVIOUS) == CAST_OK) { SetCombatMovement(false); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_bIsFirstPhase = false; } } DoMeleeAttackIfReady(); } else { if (m_uiGravityLapseTimer < uiDiff) { switch (m_uiGravityLapseStage) { case 0: // Cast Gravity Lapse on Players if (DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE) == CAST_OK) { if (m_bFirstGravityLapse) { DoScriptText(SAY_GRAVITY_LAPSE, m_creature); m_bFirstGravityLapse = false; } else DoScriptText(SAY_RECAST_GRAVITY, m_creature); m_uiGravityLapseTimer = 2000; m_uiGravityIndex = 0; ++m_uiGravityLapseStage; } break; case 1: // Summon spheres and apply the Gravity Lapse visual - upon visual expire, the gravity lapse is removed if (DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE_VISUAL) == CAST_OK) { for (uint8 i = 0; i < MAX_ARCANE_SPHERES; ++i) DoCastSpellIfCan(m_creature, SPELL_ARCANE_SPHERE_SUMMON, CAST_TRIGGERED); m_uiGravityLapseTimer = 30000; ++m_uiGravityLapseStage; } break; case 2: // Cast Power Feedback and stay stunned for 10 secs - also break the statues if they are not broken if (DoCastSpellIfCan(m_creature, SPELL_POWER_FEEDBACK) == CAST_OK) { DoScriptText(SAY_TIRED, m_creature); RemoveGravityLapse(); m_uiGravityLapseTimer = 10000; m_uiGravityLapseStage = 0; } break; } } else m_uiGravityLapseTimer -= uiDiff; } }
void UpdateAI(uint32 uiDiff) override { if (!UpdateVictim()) return; /*START ACID-AI*/ if (uiTrashTimer <= uiDiff) { if (bCheckChances()) DoCast(me, SPELL_TRASH); uiTrashTimer = urand(6000, 15500); } else uiTrashTimer -= uiDiff; if (uiSlamTimer <= uiDiff) { if (bCheckChances()) DoCastVictim(SPELL_SMITE_SLAM); uiSlamTimer = 11000; } else uiSlamTimer -= uiDiff; if (uiNimbleReflexesTimer <= uiDiff) { if (bCheckChances()) DoCast(me, SPELL_NIMBLE_REFLEXES); uiNimbleReflexesTimer = urand(27300, 60100); } else uiNimbleReflexesTimer -= uiDiff; /*END ACID-AI*/ if ((uiHealth == 0 && !HealthAbovePct(66)) || (uiHealth == 1 && !HealthAbovePct(33))) { ++uiHealth; DoCastAOE(SPELL_SMITE_STOMP, false); SetCombatMovement(false); if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ()); } } if (uiPhase) { if (uiTimer <= uiDiff) { switch (uiPhase) { case 1: me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? uiTimer = 1000; uiPhase = 2; break; case 2: if (uiHealth == 1) SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); else SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); uiTimer = 500; uiPhase = 3; break; case 3: SetCombatMovement(true); me->GetMotionMaster()->MoveChase(me->GetVictim(), me->m_CombatDistance); uiPhase = 0; break; } } else uiTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_creature->GetHealthPercent() < 66.6f && m_creature->GetHealthPercent() > 33.3f) { if (Phase == 0) { DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP); DoScriptText(SAY_PHASE_1, m_creature); m_creature->AttackStop(); Phase = 1; } } else if (m_creature->GetHealthPercent() < 33.3f) { if (Phase == 1 || Phase == 0) { DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP); DoCastSpellIfCan(m_creature, SPELL_SMITE_HAMMER); DoScriptText(SAY_PHASE_2, m_creature); m_creature->AttackStop(); WaitedOrNot = false; WentToChest = false; Phase = 2; } } if (Phase == 1) { if (WentToChest == false) { m_creature->GetMotionMaster()->MovePoint(0, 1.337549f, -780.446716f, 9.8376685f); SetCombatMovement(false); WentToChest = true; } if (m_creature->IsStopped() == true && m_creature->isAttackingPlayer() == false ) { // Only there so this part doesn't repeat a hundred times if (m_creature->IsStandState()) { m_creature->SetOrientation(1.337549f); m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetAttackTime(OFF_ATTACK, 2000); m_creature->setAttackTimer(OFF_ATTACK, 0); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg*0.6); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg*0.6); m_creature->UpdateDamagePhysical(OFF_ATTACK); // Should hit normal damage with one weapon, 60% with other one // If he still has the same speed, that's 160% of base damage, update to mindmg*1 when dual-wield m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg*1.6); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg*1.6); m_creature->UpdateDamagePhysical(BASE_ATTACK); m_creature->SetAttackTime(BASE_ATTACK, 2000); } if (WaitTimer < uiDiff && WaitedOrNot == false) { m_creature->SetStandState(UNIT_STAND_STATE_STAND); DoCastSpellIfCan(m_creature, SPELL_THRASH); SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); WaitedOrNot = true; WaitTimer = 3000; } else { WaitTimer -= uiDiff; } } } else if (Phase == 2) { if (WentToChest == false) { m_creature->RemoveAurasDueToSpell(SPELL_THRASH); m_creature->GetMotionMaster()->MovePoint(0, 1.337549f, -780.446716f, 9.8376685f); SetCombatMovement(false); WentToChest = true; } if (SlamTimer < uiDiff) { // Cast Slam in phase two handed, maybe timer a bit incorrect DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE_SLAM); SlamTimer = urand(8000, 15000); } else { SlamTimer -= uiDiff; } if (m_creature->IsStopped() == true && m_creature->isAttackingPlayer() == false ) { if (m_creature->IsStandState()) { m_creature->SetAttackTime(BASE_ATTACK, 3200); m_creature->SetSheath(SHEATH_STATE_UNARMED); SetEquipmentSlots(false, EQUIP_ID_HAMMER, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); m_creature->SetOrientation(1.337549f); m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, 0*cinfo->mindmg); m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, 0*cinfo->maxdmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 1.7*cinfo->mindmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 1.7*cinfo->maxdmg); m_creature->UpdateDamagePhysical(BASE_ATTACK); } if (WaitTimer < uiDiff && WaitedOrNot == false) { m_creature->SetStandState(UNIT_STAND_STATE_STAND); SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); WaitedOrNot = true; } else { WaitTimer -= uiDiff; } } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; int i; //PHASE 1 if(phase==1) { if(Phase_Timer < diff) { phase = 2; Phase_Timer = 60000; //phase 2 lasts 60 seconds } else Phase_Timer -= diff; //summon trainees if(Trainee_Timer < diff) { for(i=0; i<trainees; i++) { Unit *mob = m_creature->SummonCreature(CR_UN_TRAINEE, LiveX[i], LiveY[i], LiveZ[i], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(mob && target) mob->AddThreat(target, 1.0f); } Trainee_Timer = 15000; } else Trainee_Timer -= diff; //summon death knights if(DeathKnight_Timer < diff) { i = irand(0,2); Unit *mob = m_creature->SummonCreature(CR_UN_DEATHKNIGHT, LiveX[i], LiveY[i], LiveZ[i], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(mob && target) mob->AddThreat(target, 1.0f); DeathKnight_Timer = 30000; } else DeathKnight_Timer -= diff; //summon rider if(Rider_Timer < diff) { i = irand(0,2); Unit *mob = m_creature->SummonCreature(CR_UN_RIDER, LiveX[i], LiveY[i], LiveZ[i], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(mob && target) mob->AddThreat(target, 1.0f); Rider_Timer = 45000; } else Rider_Timer -= diff; } //PHASE 2 if(phase==2) { if(Phase_Timer < diff) { //teleport gothik down m_creature->NearTeleportTo(UNDEAD_X, UNDEAD_Y, UNDEAD_Z, 0); Phase_Timer = 15000; phase = 3; SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } else Phase_Timer -= diff; } //PHASE 3,4 if(phase==3 || phase==4) { if(Phase_Timer < diff) { //cast Harvest Soul (-10% stats to the raid) Unit* target = NULL; std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (i = m_creature->getThreatManager().getThreatList().begin(); i!=m_creature->getThreatManager().getThreatList().end(); ++i) { target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()); if(target && target->isAlive()) DoCast(target, SP_HARVEST_SOUL, true); } //teleport gothik to the other side if(phase==3) m_creature->NearTeleportTo(LIVE_X, LIVE_Y, LIVE_Z, 0); else m_creature->NearTeleportTo(UNDEAD_X, UNDEAD_Y, UNDEAD_Z, 0); Phase_Timer = 15000; phase = (phase==3) ? 4 : 3; } else Phase_Timer -= diff; //cast shadowbolts if(Shadowbolt_Timer < diff) { DoCast(m_creature->getVictim(), Heroic ? H_SP_SHADOWBOLT : SP_SHADOWBOLT); Shadowbolt_Timer = 1200; } else Shadowbolt_Timer -= diff; //if 30% left, stop teleporting if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 30) { phase=5; if(pInstance) pInstance->SetData(TYPE_GOTHIK, SPECIAL); } } //PHASE 5 if(phase==5) { if(Shadowbolt_Timer < diff) { DoCast(m_creature->getVictim(), Heroic ? H_SP_SHADOWBOLT : SP_SHADOWBOLT); Shadowbolt_Timer = 1200; } else Shadowbolt_Timer -= diff; } }