//*** HANDLED FUNCTION *** //Attack Start is called whenever someone hits us. void EnterCombat(Unit* /*who*/) { //Say some stuff me->MonsterSay(SAY_AGGRO,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8280); }
void KilledUnit(Unit *victim) { m_creature->MonsterYell(SAY_KILL,LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_KILL); }
void KilledUnit(Unit* /*victim*/) { me->MonsterYell(SAY_KILL, LANGUAGE_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_KILL); }
void KilledUnit(Unit* /*victim*/) { if (!(rand()%3)) DoPlaySoundToSet(me, SOUND_SLAY); }
void KilledUnit(Unit* /*victim*/) { DoPlaySoundToSet(me, IAmVeklor() ? SOUND_VL_KILL : SOUND_VN_KILL); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (StormCount) { Unit* pTarget = Unit::GetUnit(*me, CloudGUID); if (!pTarget || !pTarget->isAlive()) { EnterEvadeMode(); return; } else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID)) Cyclone->CastSpell(pTarget, 25160, true); // keep casting or... if (StormSequenceTimer <= diff) HandleStormSequence(pTarget); 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* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->getVictim(); TargetGUID = pTarget->GetGUID(); DoCast(pTarget, SPELL_STATIC_DISRUPTION, false); me->SetInFront(me->getVictim()); StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s /*if (float dist = me->IsWithinDist3d(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 5.0f) dist = 5.0f; SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ } else StaticDisruption_Timer -= diff; if (GustOfWind_Timer <= diff) { Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->getVictim(); DoCast(pTarget, SPELL_GUST_OF_WIND); GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) } else GustOfWind_Timer -= diff; if (CallLighting_Timer <= diff) { DoCast(me->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 + urand(0,5000)) { SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); isRaining = true; } if (ElectricalStorm_Timer <= diff) { Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); if (!pTarget) { EnterEvadeMode(); return; } pTarget->CastSpell(pTarget, 44007, true);//cloud visual DoCast(pTarget, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual float x,y,z; pTarget->GetPosition(x,y,z); if (pTarget) { pTarget->SetUnitMovementFlags(MOVEFLAG_LEVITATING); pTarget->SendMonsterMove(x,y,me->GetPositionZ()+15,0); } Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) { CloudGUID = Cloud->GetGUID(); Cloud->SetUnitMovementFlags(MOVEFLAG_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* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { x = pTarget->GetPositionX() + irand(-10,10); y = pTarget->GetPositionY() + irand(-10,10); z = pTarget->GetPositionZ() + urand(16,20); if (z > 95) z = 95 - urand(0,5); } Creature* pCreature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (pCreature) { pCreature->AddThreat(me->getVictim(), 1.0f); pCreature->AI()->AttackStart(me->getVictim()); BirdGUIDs[i] = pCreature->GetGUID(); } } } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (waitTimer) { if (inMove) { if (waitTimer <= diff) { (*me).GetMotionMaster()->MovementExpired(); (*me).GetMotionMaster()->MovePoint(MovePhase,NalorakkWay[MovePhase][0],NalorakkWay[MovePhase][1],NalorakkWay[MovePhase][2]); waitTimer = 0; } else waitTimer -= diff; } } if (!UpdateVictim()) return; if (Berserk_Timer <= diff) { DoCast(me, SPELL_BERSERK, true); me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_YELL_BERSERK); Berserk_Timer = 600000; } else Berserk_Timer -= diff; if (ShapeShift_Timer <= diff) { if (inBearForm) { me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + 1, 5122); me->MonsterYell(YELL_SHIFTEDTOTROLL, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_YELL_TOTROLL); me->RemoveAurasDueToSpell(SPELL_BEARFORM); Surge_Timer = 15000 + rand()%5000; BrutalSwipe_Timer = 7000 + rand()%5000; Mangle_Timer = 10000 + rand()%5000; ShapeShift_Timer = 45000 + rand()%5000; inBearForm = false; } else { me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + 1, 0); me->MonsterYell(YELL_SHIFTEDTOBEAR, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_YELL_TOBEAR); DoCast(me, SPELL_BEARFORM, true); LaceratingSlash_Timer = 2000; // dur 18s RendFlesh_Timer = 3000; // dur 5s DeafeningRoar_Timer = 5000 + rand()%5000; // dur 2s ShapeShift_Timer = 20000 + rand()%5000; // dur 30s inBearForm = true; } } else ShapeShift_Timer -= diff; if (!inBearForm) { if (BrutalSwipe_Timer <= diff) { DoCast(me->getVictim(), SPELL_BRUTALSWIPE); BrutalSwipe_Timer = 7000 + rand()%5000; } else BrutalSwipe_Timer -= diff; if (Mangle_Timer <= diff) { if (me->getVictim() && !me->getVictim()->HasAura(SPELL_MANGLEEFFECT, 0)) { DoCast(me->getVictim(), SPELL_MANGLE); Mangle_Timer = 1000; } else Mangle_Timer = 10000 + rand()%5000; } else Mangle_Timer -= diff; if (Surge_Timer <= diff) { me->MonsterYell(YELL_SURGE, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_YELL_SURGE); Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true); if (pTarget) DoCast(pTarget, SPELL_SURGE); Surge_Timer = 15000 + rand()%5000; } else Surge_Timer -= diff; } else { if (LaceratingSlash_Timer <= diff) { DoCast(me->getVictim(), SPELL_LACERATINGSLASH); LaceratingSlash_Timer = 18000 + rand()%5000; } else LaceratingSlash_Timer -= diff; if (RendFlesh_Timer <= diff) { DoCast(me->getVictim(), SPELL_RENDFLESH); RendFlesh_Timer = 5000 + rand()%5000; } else RendFlesh_Timer -= diff; if (DeafeningRoar_Timer <= diff) { DoCast(me->getVictim(), SPELL_DEAFENINGROAR); DeafeningRoar_Timer = 15000 + rand()%5000; } else DeafeningRoar_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!TankGUID) { if (!UpdateVictim()) return; if (me->GetHealth() < health_20 * (4 - Phase)) EnterPhase(Phase + 1); } if (Berserk_Timer <= diff) { DoCast(me, SPELL_BERSERK, true); me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_BERSERK); Berserk_Timer = 60000; } else Berserk_Timer -= diff; switch (Phase) { case 0: if (Intro_Timer) { if (Intro_Timer <= diff) { me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_AGGRO); Intro_Timer = 0; } else Intro_Timer -= diff; } if (Whirlwind_Timer <= diff) { DoCast(me, SPELL_WHIRLWIND); Whirlwind_Timer = 15000 + rand() % 5000; } else Whirlwind_Timer -= diff; if (Grievous_Throw_Timer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_GRIEVOUS_THROW, false); Grievous_Throw_Timer = 10000; } else Grievous_Throw_Timer -= diff; break; case 1: if (Creeping_Paralysis_Timer <= diff) { DoCast(me, SPELL_CREEPING_PARALYSIS); Creeping_Paralysis_Timer = 20000; } else Creeping_Paralysis_Timer -= diff; if (Overpower_Timer <= diff) { // implemented in DoMeleeAttackIfReady() Overpower_Timer = 0; } else Overpower_Timer -= diff; break; case 2: return; case 3: if (Claw_Rage_Timer <= diff) { if (!TankGUID) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { TankGUID = me->GetVictim()->GetGUID(); me->SetSpeed(MOVE_RUN, 5.0f); AttackStart(pTarget); // change victim Claw_Rage_Timer = 0; Claw_Loop_Timer = 500; Claw_Counter = 0; } } else if (!Claw_Rage_Timer) // do not do this when Lynx_Rush { if (Claw_Loop_Timer <= diff) { Unit* pTarget = me->GetVictim(); if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = Unit::GetUnit(*me, TankGUID); if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) { AttackStart(pTarget); if (me->IsWithinMeleeRange(pTarget)) { DoCast(pTarget, SPELL_CLAW_RAGE_DAMAGE, true); ++Claw_Counter; if (Claw_Counter == 12) { Claw_Rage_Timer = 15000 + rand() % 5000; me->SetSpeed(MOVE_RUN, 1.2f); AttackStart(Unit::GetUnit(*me, TankGUID)); TankGUID = 0; return; } else Claw_Loop_Timer = 500; } } else { EnterEvadeMode(); // if (pTarget) return; } } else Claw_Loop_Timer -= diff; } //if (TankGUID) } else Claw_Rage_Timer -= diff; if (Lynx_Rush_Timer <= diff) { if (!TankGUID) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { TankGUID = me->GetVictim()->GetGUID(); me->SetSpeed(MOVE_RUN, 5.0f); AttackStart(pTarget); // change victim Lynx_Rush_Timer = 0; Claw_Counter = 0; } } else if (!Lynx_Rush_Timer) { Unit* pTarget = me->GetVictim(); if (!pTarget || !pTarget->isTargetableForAttack()) { pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); AttackStart(pTarget); } if (pTarget) { if (me->IsWithinMeleeRange(pTarget)) { DoCast(pTarget, SPELL_LYNX_RUSH_DAMAGE, true); ++Claw_Counter; if (Claw_Counter == 9) { Lynx_Rush_Timer = 15000 + rand() % 5000; me->SetSpeed(MOVE_RUN, 1.2f); AttackStart(Unit::GetUnit(*me, TankGUID)); TankGUID = 0; } else AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } } else { EnterEvadeMode(); // if (pTarget) return; } } //if (TankGUID) } else Lynx_Rush_Timer -= diff; break; case 4: if (Flame_Whirl_Timer <= diff) { DoCast(me, SPELL_FLAME_WHIRL); Flame_Whirl_Timer = 12000; } Flame_Whirl_Timer -= diff; if (Pillar_Of_Fire_Timer <= diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SUMMON_PILLAR); Pillar_Of_Fire_Timer = 10000; } else Pillar_Of_Fire_Timer -= diff; if (Flame_Breath_Timer <= diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) me->SetInFront(pTarget); DoCast(me, SPELL_FLAME_BREATH); Flame_Breath_Timer = 10000; } else Flame_Breath_Timer -= diff; break; default: break; } if (!TankGUID) DoMeleeAttackIfReady(); }
void JustDied(Unit* Killer) { DoPlaySoundToSet(m_creature, SOUND_DEATH); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) return; if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11) { Enraged = true; } if(!Enraged) { //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(SpawnAddInterval*(AlreadySpawnedAmount+1)))) { DoYell(SAY_ENERGY, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_ENERGY); Creature* PureEnergyCreature = NULL; PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, 10, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (PureEnergyCreature && target) PureEnergyCreature->AI()->AttackStart(target); if(Heroic) // *Heroic mode only - he summons two instead of one. { PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, -10, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); target = SelectUnit(SELECT_TARGET_RANDOM, 0); if (PureEnergyCreature && target) PureEnergyCreature->AI()->AttackStart(target); } ++AlreadySpawnedAmount; }; if(ChainLightningTimer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightningTimer = 10000; }else ChainLightningTimer -= diff; if(ArcaneShockTimer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); DoCast(target, SPELL_ARCANE_SHOCK); ArcaneShockTimer = 8000; }else ArcaneShockTimer -= diff; }else { if(OverloadTimer < diff) { Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); DoCast(target, SPELL_OVERLOAD); OverloadTimer = 2200; }else OverloadTimer -= diff; } DoMeleeAttackIfReady(); }
void KilledUnit(Unit *victim) { DoYell(SAY_KILL, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(victim, SOUND_KILL); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(m_uiIntroTimer < uiDiff) { if(m_bIsIntroNow) { m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); switch(m_uiIntroCount) { case 0: DoPlaySoundToSet(m_creature, SOUND_MADR_ICE_BARRIER); m_uiIntroTimer = 6000; break; case 1: DoPlaySoundToSet(m_creature, SOUND_MADR_INTRO); m_uiIntroTimer = 5000; break; case 2: DoPlaySoundToSet(m_creature, SOUND_INTRO); m_uiIntroTimer = 6000; break; case 3: DoPlaySoundToSet(m_creature, SOUND_MADR_ICE_BLOCK); m_uiIntroTimer = 4000; break; case 4: DoPlaySoundToSet(m_creature, SOUND_INTRO_BREAK_ICE); m_uiIntroTimer = 5000; break; case 5: DoPlaySoundToSet(m_creature, SOUND_MADR_TRAP); m_uiIntroTimer = 5000; break; case 6: DoPlaySoundToSet(m_creature, SOUND_INTRO_CHARGE); m_uiIntroTimer = 5000; break; case 7: DoPlaySoundToSet(m_creature, SOUND_MADR_DEATH); m_uiIntroTimer = 5000; break; case 8: DoPlaySoundToSet(m_creature, SOUND_INTRO_KILL_MADRIGOSA); m_uiIntroTimer = 6000; break; case 9: DoPlaySoundToSet(m_creature, SOUND_INTRO_TAUNT); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiBerserkTimer = 360000; m_bIsIntroNow = false; break; } ++m_uiIntroCount; } }else m_uiIntroTimer -= uiDiff; if(m_bIsIntroNow) return; if (m_uiBurnCheckTimer < 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 *BurnedPlayer = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (BurnedPlayer && BurnedPlayer->GetTypeId() == TYPEID_PLAYER && BurnedPlayer->HasAura(SPELL_BURN_AURA)) { 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->IsWithinDistInMap(BurnedPlayer, 6) && !TargetedPlayer->HasAura(SPELL_BURN_AURA)) TargetedPlayer->CastSpell(TargetedPlayer,SPELL_BURN_AURA,true); } } } m_uiBurnCheckTimer = 1000; }else m_uiBurnCheckTimer -= uiDiff; if (m_uiLoveTimer < uiDiff) { switch(urand(0, 2)) { case 0: DoScriptText(YELL_LOVE1, m_creature); break; case 1: DoScriptText(YELL_LOVE2, m_creature); break; case 2: DoScriptText(YELL_LOVE3, m_creature); break; } m_uiLoveTimer = urand(15000, 23000); } else m_uiLoveTimer -= uiDiff; if (m_uiSlashTimer < uiDiff) { if (Unit* pTarget = m_creature->getVictim()) DoCast(pTarget,SPELL_METEOR_SLASH); m_uiSlashTimer = 11000; }else m_uiSlashTimer -= uiDiff; if (m_uiStompTimer < uiDiff) { if (Unit* pTarget = m_creature->getVictim()) { DoCast(pTarget,SPELL_STOMP); if (pTarget->HasAura(SPELL_BURN_AURA,0)) pTarget->RemoveAurasDueToSpell(SPELL_BURN_AURA); } m_uiStompTimer = 30000; } else m_uiStompTimer -= uiDiff; if (m_uiBurnTimer < uiDiff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoCast(target,SPELL_BURN); target->CastSpell(target,SPELL_BURN_AURA, true); } m_uiBurnTimer = 60000; } else m_uiBurnTimer -= uiDiff; if (m_uiBerserkTimer < uiDiff) { DoScriptText(YELL_BERSERK, m_creature); DoCast(m_creature,SPELL_BERSERK); m_uiBerserkTimer = 20000; } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(m_uiEnrageTimer < diff) { DoCastSpellIfCan(m_creature, SPELL_ENRAGE, true); m_uiEnrageTimer = 30000; }m_uiEnrageTimer -= diff; if(!m_bIsFlyPhase) //ground phase { if(m_uiFlyPhaseTimer < diff) // fly phase start { //Go Fly m_creature->GetMap()->CreatureRelocation(m_creature, 1469, 596, m_creature->GetPositionZ()+20, m_creature->GetOrientation()); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); //FlyPhase Timers Start m_uiLandPhaseTimer = 80000; m_uiDemonicVaporTimer = 2000; m_uiFogOfCorruptionTimer = 20000; m_uiFogTimer = 500; m_uiMaxBreathCount = 0; m_uiFogCount = 0; m_uiCycle = 0; m_bIsFlyPhase = true; m_bToStartPos = false; m_bToLineStartPos = false; m_bFlyOver = false; m_bFog = false; m_bNextCycle = false; return; }else m_uiFlyPhaseTimer -= diff; if(m_uiCorrosionTimer < diff) { DoScriptText(YELL_CORROSION, m_creature); if(m_creature->getVictim()) DoCastSpellIfCan(m_creature->getVictim(), SPELL_CORROSION); m_uiCorrosionTimer = 72000; }else m_uiCorrosionTimer -= diff; if(m_uiNoxiousFumesTimer < diff && !m_bIsCastedNoxiousFumes) { DoScriptText(YELL_NOXIOUSFUMES, m_creature); DoPlaySoundToSet(m_creature, 12478); DoCastSpellIfCan(m_creature, SPELL_NOXIOUSFUMES_AURA); m_bIsCastedNoxiousFumes = true; }else m_uiNoxiousFumesTimer -= diff; if(m_uiGasNovaTimer < diff) { DoCastSpellIfCan(m_creature, SPELL_GASNOVA); m_uiGasNovaTimer = 35000; }else m_uiGasNovaTimer -= diff; if(m_uiEncapsulateTimer < diff) { if(Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { m_uiEncapsulateGUID = target->GetGUID(); DoCastSpellIfCan(target, SPELL_ENCAPSULATE_CHANNEL); } m_uiEncapsulateTimer = 30000; }else m_uiEncapsulateTimer -= diff; if(m_uiCleaveTimer < diff) { DoScriptText(YELL_CLEAVE, m_creature); if(m_creature->getVictim()) DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 28000; }else m_uiCleaveTimer -= diff; DoMeleeAttackIfReady(); } else // fly phase { if(m_uiLandPhaseTimer < diff) //fly phase -> ground phase { m_creature->GetMap()->CreatureRelocation(m_creature, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()-20, m_creature->GetOrientation()); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); m_uiFlyPhaseTimer = 60000; m_bIsFlyPhase = false; m_uiCorrosionTimer = 20000; m_uiCleaveTimer = 10000; m_uiEncapsulateTimer = 10000; m_uiGasNovaTimer = 15000; m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); }else m_uiLandPhaseTimer -= diff; //start demonic vapor if(m_uiDemonicVaporTimer < diff && m_uiMaxBreathCount <= 2) { m_bDemonicVapor = true; if (m_uiMaxBreathCount < 2) DoCast(m_creature, SPELL_DEMONIC_VAPOR); if (m_uiMaxBreathCount++ == 2) { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_bDemonicVapor = false; m_bIsFogOfCorruption = true; m_bToStartPos = true; m_creature->GetMotionMaster()->Clear(); } else m_uiDemonicVaporTimer=12000; } else m_uiDemonicVaporTimer -=diff; if(m_bDemonicVapor) { m_creature->StopMoving(); } // fog of corruption phase if(m_bIsFogOfCorruption) { if(m_bToStartPos) // move felmyst to fog of corruption start position { ++m_uiCycle; m_bToStartPos = false; // go to Line Start Position m_uiOnStartPosTimer = 7000; m_bToLineStartPos = true; switch(m_uiCycle) { //move felmyst to west or east start position case 1: m_creature->GetMotionMaster()->MovePoint(0,WESTSTART[0],WESTSTART[1],WESTSTART[2]);break; case 2: m_creature->GetMotionMaster()->MovePoint(0,EASTSTART[0],EASTSTART[1],EASTSTART[2]);break; case 3: m_creature->GetMotionMaster()->MovePoint(0,WESTSTART[0],WESTSTART[1],WESTSTART[2]);break; case 4: m_bIsFogOfCorruption = false; m_bToLineStartPos = false;break; } } // felmyst should be on start position now. if(m_bToLineStartPos) if(m_uiOnStartPosTimer < diff) { m_creature->GetMotionMaster()->Clear(); //go to random Line startposition m_uiLine = urand(0,2); //west if(m_uiCycle==1||m_uiCycle==3) switch(m_uiLine) { case NORTH: m_creature->GetMotionMaster()->MovePoint(0,WESTNORTH[0],WESTNORTH[1],WESTNORTH[2]);break; case MIDDLE: m_creature->GetMotionMaster()->MovePoint(0,WESTMID[0],WESTMID[1],WESTMID[2]);break; case SOUTH: m_creature->GetMotionMaster()->MovePoint(0,WESTSOUTH[0],WESTSOUTH[1],WESTSOUTH[2]);break; } else //east switch(m_uiLine) { case NORTH: m_creature->GetMotionMaster()->MovePoint(0,EASTNORTH[0],EASTNORTH[1],EASTNORTH[2]);break; case MIDDLE: m_creature->GetMotionMaster()->MovePoint(0,EASTMID[0],EASTMID[1],EASTMID[2]);break; case SOUTH: m_creature->GetMotionMaster()->MovePoint(0,EASTSOUTH[0],EASTSOUTH[1],EASTSOUTH[2]);break; } m_bToLineStartPos = false; //go fly over m_uiFlyOverTimer = 3500; m_bFlyOver = true; }else m_uiOnStartPosTimer -=diff; // let felmyst fly over the battlefield if(m_bFlyOver) if(m_uiFlyOverTimer < diff) { m_creature->GetMotionMaster()->Clear(); m_creature->SetSpeedRate(MOVE_FLIGHT,4.0,true); m_creature->SetSpeedRate(MOVE_RUN,4.0,true); if(m_uiCycle==1||m_uiCycle==3) switch(m_uiLine) { case NORTH: m_creature->GetMotionMaster()->MovePoint(0,EASTNORTH[0],EASTNORTH[1],EASTNORTH[2]);break; case MIDDLE: m_creature->GetMotionMaster()->MovePoint(0,EASTMID[0],EASTMID[1],EASTMID[2]);break; case SOUTH: m_creature->GetMotionMaster()->MovePoint(0,EASTSOUTH[0],EASTSOUTH[1],EASTSOUTH[2]);break; } else switch(m_uiLine) { case NORTH: m_creature->GetMotionMaster()->MovePoint(0,WESTNORTH[0],WESTNORTH[1],WESTNORTH[2]);break; case MIDDLE: m_creature->GetMotionMaster()->MovePoint(0,WESTMID[0],WESTMID[1],WESTMID[2]);break; case SOUTH: m_creature->GetMotionMaster()->MovePoint(0,WESTSOUTH[0],WESTSOUTH[1],WESTSOUTH[2]);break; } m_bFlyOver = false; //spawn fog of corruption m_uiFogCount = 0; m_bFog = true; //next cycle m_uiNextCycleTimer = 4000; m_bNextCycle = true; } else m_uiFlyOverTimer -=diff; if(m_bNextCycle) if(m_uiNextCycleTimer < diff) { m_creature->SetSpeedRate(MOVE_FLIGHT,1.0,true); m_creature->SetSpeedRate(MOVE_RUN,1.0,true); m_bNextCycle = false; //next cycle m_bToStartPos = true; }else m_uiNextCycleTimer -=diff; if(m_bFog)// spawn fog of corruption if(m_uiFogTimer < diff) { if(m_uiLine==NORTH) { // north breath if(m_uiCycle==1||m_uiCycle==3) switch(m_uiFogCount) { // fog from west to east case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1496.38f,679.56f,21.43f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1499.99f,659.77f,24.17f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1506.29f,638.52f,25.90f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1510.55f,617.70f,28.65f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 4: m_creature->SummonCreature(MOB_DEATH_CLOUD,1510.78f,598.80f,28.50f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 5: m_creature->SummonCreature(MOB_DEATH_CLOUD,1521.04f,583.18f,30.23f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 6: m_creature->SummonCreature(MOB_DEATH_CLOUD,1523.43f,562.92f,32.49f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 7: m_creature->SummonCreature(MOB_DEATH_CLOUD,1535.54f,542.88f,31.96f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 8: m_creature->SummonCreature(MOB_DEATH_CLOUD,1520.65f,530.94f,28.09f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } else switch(m_uiFogCount) { // fog from east to west case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1520.65f,530.94f,28.09f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1535.54f,542.88f,31.96f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1523.43f,562.92f,32.49f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1521.04f,583.18f,30.23f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 4: m_creature->SummonCreature(MOB_DEATH_CLOUD,1510.78f,598.80f,28.50f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 5: m_creature->SummonCreature(MOB_DEATH_CLOUD,1510.55f,617.70f,28.65f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 6: m_creature->SummonCreature(MOB_DEATH_CLOUD,1506.29f,638.52f,25.90f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 7: m_creature->SummonCreature(MOB_DEATH_CLOUD,1499.99f,659.77f,24.17f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 8: m_creature->SummonCreature(MOB_DEATH_CLOUD,1496.38f,679.56f,21.43f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } } else if(m_uiLine==MIDDLE) { // middle breath if(m_uiCycle==1||m_uiCycle==3) switch(m_uiFogCount) { // fog from west to east case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1458.84f,655.56f,19.10f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1463.73f,637.36f,20.41f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1467.05f,618.97f,21.55f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1471.25f,600.90f,23.22f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 4: m_creature->SummonCreature(MOB_DEATH_CLOUD,1478.99f,581.63f,23.23f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 5: m_creature->SummonCreature(MOB_DEATH_CLOUD,1484.60f,559.09f,23.98f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 6: m_creature->SummonCreature(MOB_DEATH_CLOUD,1491.58f,542.94f,25.15f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } else switch(m_uiFogCount) { // fog from east to west case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1491.58f,542.94f,25.15f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1484.60f,559.09f,23.98f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1478.99f,581.63f,23.23f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1471.25f,600.90f,23.22f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 4: m_creature->SummonCreature(MOB_DEATH_CLOUD,1467.05f,618.97f,21.55f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 5: m_creature->SummonCreature(MOB_DEATH_CLOUD,1463.73f,637.36f,20.41f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 6: m_creature->SummonCreature(MOB_DEATH_CLOUD,1458.84f,655.56f,19.10f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } } else if(m_uiLine=SOUTH) { // south breath if(m_uiCycle==1||m_uiCycle==3) switch(m_uiFogCount) { // fog from west to east case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1435.02f,609.98f,18.11f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1438.65f,588.12f,19.21f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1445.03f,572.22f,20.72f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1452.80f,554.16f,21.17f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } else switch(m_uiFogCount) { // fog from east to west case 0: m_creature->SummonCreature(MOB_DEATH_CLOUD,1452.80f,554.16f,21.17f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 1: m_creature->SummonCreature(MOB_DEATH_CLOUD,1445.03f,572.22f,20.72f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 2: m_creature->SummonCreature(MOB_DEATH_CLOUD,1438.65f,588.12f,19.21f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); break; case 3: m_creature->SummonCreature(MOB_DEATH_CLOUD,1435.02f,609.98f,18.11f,0,TEMPSUMMON_TIMED_DESPAWN, 15000); m_bFog=false; break; } } ++m_uiFogCount; m_uiFogTimer = 500; } else m_uiFogTimer -=diff; } } }
//*** HANDLED FUNCTION *** //Update AI is called Every single map update (roughly once every 100ms if a player is within the grid) void UpdateAI(const uint32 diff) { //Out of combat timers if (!me->getVictim()) { //Random Say timer if (Say_Timer <= diff) { //Random switch between 5 outcomes switch (rand()%5) { case 0: me->MonsterYell(SAY_RANDOM_0,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8831); //8831 is the index of the sound we are playing. You find these numbers in SoundEntries.dbc break; case 1: me->MonsterYell(SAY_RANDOM_1,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8818); break; case 2: me->MonsterYell(SAY_RANDOM_2,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8041); break; case 3: me->MonsterYell(SAY_RANDOM_3,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8581); break; case 4: me->MonsterYell(SAY_RANDOM_4,LANG_UNIVERSAL,0); DoPlaySoundToSet(me,8791); break; } Say_Timer = 45000; //Say something agian in 45 seconds } else Say_Timer -= diff; //Rebuff timer if (Rebuff_Timer <= diff) { DoCast(me,SPELL_BUFF); Rebuff_Timer = 900000; //Rebuff agian in 15 minutes } else Rebuff_Timer -= diff; } //Return since we have no target if (!UpdateVictim()) return; //Spell 1 timer if (Spell_1_Timer <= diff) { //Cast spell one on our current target. if (rand()%50 > 10) DoCast(me->getVictim(),SPELL_ONE_ALT); else if (me->GetDistance(me->getVictim()) < 25) DoCast(me->getVictim(),SPELL_ONE); Spell_1_Timer = 5000; } else Spell_1_Timer -= diff; //Spell 2 timer if (Spell_2_Timer <= diff) { //Cast spell one on our current target. DoCast(me->getVictim(),SPELL_TWO); Spell_2_Timer = 37000; } else Spell_2_Timer -= diff; //Spell 3 timer if (Phase > 1) { if (Spell_3_Timer <= diff) { //Cast spell one on our current target. DoCast(me->getVictim(),SPELL_THREE); Spell_3_Timer = 19000; } else Spell_3_Timer -= diff; } //Beserk timer if (Phase > 1) { if (Beserk_Timer <= diff) { //Say our line then cast uber death spell DoPlaySoundToSet(me,8588); me->MonsterYell(SAY_BESERK,LANG_UNIVERSAL,me->getVictim()->GetGUID()); DoCast(me->getVictim(),SPELL_BESERK); //Cast our beserk spell agian in 12 seconds if we didn't kill everyone Beserk_Timer = 12000; } else Beserk_Timer -= diff; } //Phase timer if (Phase == 1) { if (Phase_Timer <= diff) { //Go to next phase Phase++; me->MonsterYell(SAY_PHASE,LANG_UNIVERSAL,0); DoCast(me,SPELL_ENRAGE); } else Phase_Timer -= diff; } DoMeleeAttackIfReady(); }
void JustDied(Unit* Killer) { me->MonsterYell(SAY_DEATH,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(me, SOUND_DEATH); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (ResetTimer <= diff) { if (me->IsWithinDist3d(119.223f, 1035.45f, 29.4481f, 10)) { EnterEvadeMode(); return; } ResetTimer = 5000; } else ResetTimer -= diff; if (CheckAddState_Timer <= diff) { for (uint8 i = 0; i < 4; ++i) if (Creature *pTemp = Unit::GetCreature(*me, AddGUID[i])) if (pTemp->isAlive() && !pTemp->getVictim()) pTemp->AI()->AttackStart(me->getVictim()); CheckAddState_Timer = 5000; } else CheckAddState_Timer -= diff; if (DrainPower_Timer <= diff) { DoCast(me, SPELL_DRAIN_POWER, true); Map *map = me->GetMap(); if (!map->IsDungeon()) return; Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* i_pl = i->getSource()) if (i_pl->isAlive())me->AddAura(44132, me); //+1% Damage for each active player on boss (+ActivePlayer_Stack) } //me->AddAura(44132, me); me->MonsterYell(YELL_DRAIN_POWER, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(me, SOUND_YELL_DRAIN_POWER); DrainPower_Timer = urand(40000,55000); // must cast in 60 sec, or buff/debuff will disappear } else DrainPower_Timer -= diff; if (SpiritBolts_Timer <= diff) { if (DrainPower_Timer < 12000) // channel 10 sec SpiritBolts_Timer = 13000; // cast drain power first else { DoCast(me, SPELL_SPIRIT_BOLTS, true); me->MonsterYell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(me, SOUND_YELL_SPIRIT_BOLTS); SpiritBolts_Timer = 40000; SiphonSoul_Timer = 10000; // ready to drain PlayerAbility_Timer = 99999; } } else SpiritBolts_Timer -= diff; if (SiphonSoul_Timer <= diff) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true); Unit *trigger = DoSpawnCreature(MOB_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); if (!pTarget || !trigger) { EnterEvadeMode(); return; } else { trigger->SetDisplayId(11686); trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); trigger->CastSpell(pTarget, SPELL_SIPHON_SOUL, true); trigger->GetMotionMaster()->MoveChase(me); //DoCast(pTarget, SPELL_SIPHON_SOUL, true); //me->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pTarget->GetGUID()); //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL); PlayerGUID = pTarget->GetGUID(); PlayerAbility_Timer = urand(8000,10000); PlayerClass = pTarget->getClass() - 1; if (PlayerClass == 10) PlayerClass = 9; // druid else if (PlayerClass == 4 && pTarget->HasSpell(15473)) PlayerClass = 5; // shadow priest SiphonSoul_Timer = 99999; // buff lasts 30 sec } } else SiphonSoul_Timer -= diff; if (PlayerAbility_Timer <= diff) { //Unit *pTarget = Unit::GetUnit(*me, PlayerGUID); //if (pTarget && pTarget->isAlive()) //{ UseAbility(); PlayerAbility_Timer = urand(8000,10000); //} } else PlayerAbility_Timer -= diff; DoMeleeAttackIfReady(); }
void EnterCombat(Unit *who) { DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature,SOUND_AGGRO); }
void UpdateAI(uint32 diff) override { //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_KARATHRESSEVENT_STARTER))) { AttackStart(target); GetAdvisors(); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (!instance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } //CataclysmicBolt_Timer if (CataclysmicBolt_Timer <= diff) { //select a random unit other than the main tank Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); //if there aren't other units, cast on the tank if (!target) target = me->GetVictim(); if (target) DoCast(target, SPELL_CATACLYSMIC_BOLT); CataclysmicBolt_Timer = 10000; } else CataclysmicBolt_Timer -= diff; //SearNova_Timer if (SearNova_Timer <= diff) { DoCastVictim(SPELL_SEAR_NOVA); SearNova_Timer = 20000 + rand32() % 40000; } else SearNova_Timer -= diff; //Enrage_Timer if (Enrage_Timer <= diff) { DoCast(me, SPELL_ENRAGE); Enrage_Timer = 90000; } else Enrage_Timer -= diff; //Blessing of Tides Trigger if (!HealthAbovePct(75) && !BlessingOfTides) { BlessingOfTides = true; bool continueTriggering = false; for (uint8 i = 0; i < MAX_ADVISORS; ++i) if (Advisors[i]) { Creature* advisor = ObjectAccessor::GetCreature(*me, Advisors[i]); if (advisor && advisor->IsAlive()) { continueTriggering = true; break; } } if (continueTriggering) { DoCast(me, SPELL_BLESSING_OF_THE_TIDES); me->Yell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL); DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES); } } DoMeleeAttackIfReady(); }
void MoveInLineOfSight(Unit* who) { if (!MoveEvent) { ScriptedAI::MoveInLineOfSight(who); } else { if (me->IsHostileTo(who)) { if (!inMove) { switch (MovePhase) { case 0: if (me->IsWithinDistInMap(who, 50)) { me->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE1); (*me).GetMotionMaster()->MovePoint(1,NalorakkWay[1][0],NalorakkWay[1][1],NalorakkWay[1][2]); MovePhase ++; inMove = true; SendAttacker(who); } break; case 2: if (me->IsWithinDistInMap(who, 40)) { me->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE2); (*me).GetMotionMaster()->MovePoint(3,NalorakkWay[3][0],NalorakkWay[3][1],NalorakkWay[3][2]); MovePhase ++; inMove = true; SendAttacker(who); } break; case 5: if (me->IsWithinDistInMap(who, 40)) { me->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE3); (*me).GetMotionMaster()->MovePoint(6,NalorakkWay[6][0],NalorakkWay[6][1],NalorakkWay[6][2]); MovePhase ++; inMove = true; SendAttacker(who); } break; case 7: if (me->IsWithinDistInMap(who, 50)) { SendAttacker(who); me->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE4); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); MoveEvent = false; } break; } } } } }
void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; if(m_creature->GetPositionX() < 308) { if(!m_creature->HasAura(SPELL_BERSERK,0)) { m_creature->CastSpell(m_creature,SPELL_BERSERK,true); if(pInstance) pInstance->SetData(DATA_TIMERDELETE, SPECIAL); } } if(BerserkTimer < diff) { DoYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_BERSERK); DoCast(m_creature, SPELL_BERSERK, true); BerserkTimer = 60000; }else BerserkTimer -= diff; if(Phase == PHASE_LYNX || Phase == PHASE_ENRAGE) { if(SaberlashTimer < diff) { // A tank with more than 490 defense skills should receive no critical hit //m_creature->CastSpell(m_creature, 41296, true); m_creature->CastSpell(m_creature->getVictim(), SPELL_SABER_LASH, true); //m_creature->RemoveAurasDueToSpell(41296); SaberlashTimer = 30000; }else SaberlashTimer -= diff; if(FrenzyTimer < diff) { DoCast(m_creature, SPELL_FRENZY); FrenzyTimer = (10+rand()%5)*1000; }else FrenzyTimer -= diff; if(Phase == PHASE_LYNX) if(CheckTimer < diff) { if(m_creature->GetHealth() * 4 < m_creature->GetMaxHealth() * (3 - TransformCount)) EnterPhase(PHASE_SPLIT); CheckTimer = 1000; }else CheckTimer -= diff; } if(Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE) { if(TotemTimer < diff) { DoCast(m_creature, SPELL_SUMMON_TOTEM); TotemTimer = 20000; }else TotemTimer -= diff; if(ShockTimer < diff) { if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { if(target->IsNonMeleeSpellCasted(false)) DoCast(target,SPELL_EARTHSHOCK); else DoCast(target,SPELL_FLAMESHOCK); ShockTimer = 10000 + rand()%5000; } }else ShockTimer -= diff; if(Phase == PHASE_HUMAN) if(CheckTimer < diff) { if( ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 20)/*m_creature->GetHealth() * 10 < m_creature->GetMaxHealth()*/) EnterPhase(PHASE_MERGE); else { Unit *Lynx = Unit::GetUnit(*m_creature, LynxGUID); if(Lynx && ((Lynx->GetHealth()*100) / Lynx->GetMaxHealth() <= 20)/*Lynx->GetHealth() * 10 < Lynx->GetMaxHealth()*/) EnterPhase(PHASE_MERGE); } CheckTimer = 1000; }else CheckTimer -= diff; } if(Phase == PHASE_MERGE) { if(CheckTimer < diff) { Unit *Lynx = Unit::GetUnit(*m_creature, LynxGUID); if(Lynx) { Lynx->GetMotionMaster()->MoveFollow(m_creature, 0, 0); m_creature->GetMotionMaster()->MoveFollow(Lynx, 0, 0); if(m_creature->IsWithinDistInMap(Lynx, 6.0f)) { if(TransformCount < 3) EnterPhase(PHASE_LYNX); else EnterPhase(PHASE_ENRAGE); } } CheckTimer = 1000; }else CheckTimer -= diff; } DoMeleeAttackIfReady(); }
void SimpleAI::UpdateAI(const uint32 diff) { //Return since we have no target if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; //Spells for (uint32 i = 0; i < 10; ++i) { //Spell not valid if (!Spell[i].Enabled || !Spell[i].Spell_Id) continue; if (Spell_Timer[i] < diff) { //Check if this is a percentage based if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > -Spell[i].First_Cast) continue; //Check Current spell if (!(Spell[i].InterruptPreviousCast && m_creature->IsNonMeleeSpellCasted(false))) { Unit* target = NULL; switch (Spell[i].Cast_Target_Type) { case CAST_SELF: target = m_creature; break; case CAST_HOSTILE_TARGET: target = m_creature->getVictim(); break; case CAST_HOSTILE_SECOND_AGGRO: target = SelectUnit(SELECT_TARGET_TOPAGGRO,1); break; case CAST_HOSTILE_LAST_AGGRO: target = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0); break; case CAST_HOSTILE_RANDOM: target = SelectUnit(SELECT_TARGET_RANDOM,0); break; } //Target is ok, cast a spell on it and then do our random yell if (target) { if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); DoCast(target, Spell[i].Spell_Id); //Yell and sound use the same number so that you can make //the creature yell with the correct sound effect attached uint32 random_text = rand()%3; //Random yell if (Spell[i].TextId[random_text]) DoScriptText(Spell[i].TextId[random_text], m_creature, target); //Random sound if (Spell[i].Text_Sound[random_text]) DoPlaySoundToSet(m_creature, Spell[i].Text_Sound[random_text]); } } //Spell will cast agian when the cooldown is up if (Spell[i].CooldownRandomAddition) Spell_Timer[i] = Spell[i].Cooldown + (rand() % Spell[i].CooldownRandomAddition); else Spell_Timer[i] = Spell[i].Cooldown; }else Spell_Timer[i] -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (IsEvent) { //Must update npc_escortAI npc_escortAI::UpdateAI(diff); if (!pGo) { pGo = true; if (pInstance) { AddWaypoint(0, 5492.91f, -2404.61f, 1462.63f); AddWaypoint(1, 5531.76f, -2460.87f, 1469.55f); AddWaypoint(2, 5554.58f, -2514.66f, 1476.12f); AddWaypoint(3, 5554.16f, -2567.23f, 1479.90f); AddWaypoint(4, 5540.67f, -2625.99f, 1480.89f); AddWaypoint(5, 5508.16f, -2659.2f, 1480.15f); AddWaypoint(6, 5489.62f, -2704.05f, 1482.18f); AddWaypoint(7, 5457.04f, -2726.26f, 1485.10f); Start(false, true); SetDespawnAtEnd(false); } } } //Return since we have no target if (!UpdateVictim()) return; if (CleaveTimer <= diff) { DoCast(me, SPELL_CLEAVE); CleaveTimer = 6000+rand()%15000; } else CleaveTimer -= diff; if (WarStompTimer <= diff) { DoCast(me, SPELL_WARSTOMP); WarStompTimer = 60000; } else WarStompTimer -= diff; if (me->HasAura(SPELL_MARK)) me->RemoveAurasDueToSpell(SPELL_MARK); if (MarkTimer <= diff) { //cast dummy, useful for bos addons me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) { pTarget->CastSpell(pTarget, SPELL_MARK, true);//only cast on mana users } } MarkTimerBase -= 5000; if (MarkTimerBase < 5500) MarkTimerBase = 5500; MarkTimer = MarkTimerBase; switch (urand(0, 2)) { case 0: DoPlaySoundToSet(me, SOUND_MARK1); me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, 0); break; case 1: DoPlaySoundToSet(me, SOUND_MARK2); me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, 0); break; } } else MarkTimer -= diff; DoMeleeAttackIfReady(); }
void JustDied(Unit* /*killer*/) { _JustDied(); DoPlaySoundToSet(me, SOUND_DEATH); me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures }
void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; if (BerserkTimer <= diff) { me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_BERSERK); DoCast(me, SPELL_BERSERK, true); BerserkTimer = 60000; } else BerserkTimer -= diff; if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE) { if (SaberlashTimer <= diff) { // A tank with more than 490 defense skills should receive no critical hit //DoCast(me, 41296, true); DoCast(me->getVictim(), SPELL_SABER_LASH, true); //me->RemoveAurasDueToSpell(41296); SaberlashTimer = 30000; } else SaberlashTimer -= diff; if (FrenzyTimer <= diff) { DoCast(me, SPELL_FRENZY); FrenzyTimer = urand(10000, 15000); } else FrenzyTimer -= diff; if (Phase == PHASE_LYNX) { if (CheckTimer <= diff) { if (HealthBelowPct(25 * (3 - TransformCount))) EnterPhase(PHASE_SPLIT); CheckTimer = 1000; } else CheckTimer -= diff; } } if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE) { if (TotemTimer <= diff) { DoCast(me, SPELL_SUMMON_TOTEM); TotemTimer = 20000; } else TotemTimer -= diff; if (ShockTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { if (target->IsNonMeleeSpellCasted(false)) DoCast(target, SPELL_EARTHSHOCK); else DoCast(target, SPELL_FLAMESHOCK); ShockTimer = urand(10000, 15000); } } else ShockTimer -= diff; if (Phase == PHASE_HUMAN) { if (CheckTimer <= diff) { if (!HealthAbovePct(20) /*HealthBelowPct(10)*/) EnterPhase(PHASE_MERGE); else { Unit* Lynx = Unit::GetUnit(*me, LynxGUID); if (Lynx && !Lynx->HealthAbovePct(20) /*Lynx->HealthBelowPct(10)*/) EnterPhase(PHASE_MERGE); } CheckTimer = 1000; } else CheckTimer -= diff; } } if (Phase == PHASE_MERGE) { if (CheckTimer <= diff) { Unit* Lynx = Unit::GetUnit(*me, LynxGUID); if (Lynx) { Lynx->GetMotionMaster()->MoveFollow(me, 0, 0); me->GetMotionMaster()->MoveFollow(Lynx, 0, 0); if (me->IsWithinDistInMap(Lynx, 6.0f)) { if (TransformCount < 3) EnterPhase(PHASE_LYNX); else EnterPhase(PHASE_ENRAGE); } } CheckTimer = 1000; } else CheckTimer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (IsEvent) { //Must update npc_escortAI npc_escortAI::UpdateAI(diff); if (!pGo) { pGo = true; if (pInstance) { AddWaypoint(0, 4896.08f, -1576.35f, 1333.65f); AddWaypoint(1, 4898.68f, -1615.02f, 1329.48f); AddWaypoint(2, 4907.12f, -1667.08f, 1321.00f); AddWaypoint(3, 4963.18f, -1699.35f, 1340.51f); AddWaypoint(4, 4989.16f, -1716.67f, 1335.74f); AddWaypoint(5, 5026.27f, -1736.89f, 1323.02f); AddWaypoint(6, 5037.77f, -1770.56f, 1324.36f); AddWaypoint(7, 5067.23f, -1789.95f, 1321.17f); Start(false, true); SetDespawnAtEnd(false); } } } //Return since we have no target if (!UpdateVictim()) return; if (SwarmTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_CARRION_SWARM); SwarmTimer = urand(45000,60000); switch (urand(0,1)) { case 0: DoPlaySoundToSet(me, SOUND_SWARM1); me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); break; case 1: DoPlaySoundToSet(me, SOUND_SWARM2); me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); break; } } else SwarmTimer -= diff; if (SleepTimer <= diff) { for (uint8 i = 0; i < 3; ++i) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) pTarget->CastSpell(pTarget,SPELL_SLEEP,true); } SleepTimer = 60000; switch (urand(0,1)) { case 0: DoPlaySoundToSet(me, SOUND_SLEEP1); me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); break; case 1: DoPlaySoundToSet(me, SOUND_SLEEP2); me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); break; } } else SleepTimer -= diff; if (AuraTimer <= diff) { DoCast(me, SPELL_VAMPIRIC_AURA, true); AuraTimer = urand(10000,20000); } else AuraTimer -= diff; if (InfernoTimer <= diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); InfernoTimer = 45000; switch (urand(0,1)) { case 0: DoPlaySoundToSet(me, SOUND_INFERNO1); me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); break; case 1: DoPlaySoundToSet(me, SOUND_INFERNO2); me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); break; } } else InfernoTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (IsEvent) { //Must update npc_escortAI npc_escortAI::UpdateAI(diff); if (!pGo) { pGo = true; if (pInstance) { AddWaypoint(0, 4896.08f, -1576.35f, 1333.65f); AddWaypoint(1, 4898.68f, -1615.02f, 1329.48f); AddWaypoint(2, 4907.12f, -1667.08f, 1321.00f); AddWaypoint(3, 4963.18f, -1699.35f, 1340.51f); AddWaypoint(4, 4989.16f, -1716.67f, 1335.74f); AddWaypoint(5, 5026.27f, -1736.89f, 1323.02f); AddWaypoint(6, 5037.77f, -1770.56f, 1324.36f); AddWaypoint(7, 5067.23f, -1789.95f, 1321.17f); Start(false, true); SetDespawnAtEnd(false); } } } //Return since we have no target if (!UpdateVictim()) return; if (FrostArmorTimer <= diff) { DoCast(me, SPELL_FROST_ARMOR); FrostArmorTimer = 40000+rand()%20000; } else FrostArmorTimer -= diff; if (DecayTimer <= diff) { DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); DecayTimer = 60000+rand()%20000; switch (urand(0, 1)) { case 0: DoPlaySoundToSet(me, SOUND_DECAY1); me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, NULL); break; case 1: DoPlaySoundToSet(me, SOUND_DECAY2); me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, NULL); break; } } else DecayTimer -= diff; if (NovaTimer <= diff) { DoCast(me->getVictim(), SPELL_FROST_NOVA); NovaTimer = 30000+rand()%15000; switch (urand(0, 1)) { case 0: DoPlaySoundToSet(me, SOUND_NOVA1); me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, NULL); break; case 1: DoPlaySoundToSet(me, SOUND_NOVA2); me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, NULL); break; } } else NovaTimer -= diff; if (IceboltTimer <= diff) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true), SPELL_ICEBOLT); IceboltTimer = 11000+rand()%20000; } else IceboltTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!pInstance) return; // we're still doing awaken animation if (wakingUp && Awaken_Timer >= 0) { Awaken_Timer -= diff; return; // dont do anything until we are done } else if (wakingUp && Awaken_Timer <= 0) { wakingUp = false; AttackStart(Unit::GetUnit(*m_creature, pInstance->GetData64(0))); return; // dont want to continue until we finish the AttackStart method } //Return since we have no target if (!UpdateVictim()) return; // wake a wall minion if (WallMinionTimer < diff) { pInstance->SetData (NULL, 2); WallMinionTimer = 10000; } else WallMinionTimer -= diff; //If we are <66 summon the guardians if (!guardiansAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 66) { ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1 ActivateMinion(pInstance->GetData64(6),true); // EarthenGuardian2 ActivateMinion(pInstance->GetData64(7),true); // EarthenGuardian3 ActivateMinion(pInstance->GetData64(8),true); // EarthenGuardian4 ActivateMinion(pInstance->GetData64(9),true); // EarthenGuardian5 ActivateMinion(pInstance->GetData64(10),false); // EarthenGuardian6 m_creature->MonsterYell(SAY_SUMMON,LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_SUMMON); guardiansAwake = true; } //If we are <33 summon the vault walkers if (!vaultWalkersAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 33) { ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1 ActivateMinion(pInstance->GetData64(2),true); // VaultWalker2 ActivateMinion(pInstance->GetData64(3),true); // VaultWalker3 ActivateMinion(pInstance->GetData64(4),false); // VaultWalker4 m_creature->MonsterYell(SAY_SUMMON2, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_SUMMON2); vaultWalkersAwake = true; } if (Tremor_Timer < diff) { //Cast DoCast(m_creature->getVictim(),SPELL_GROUND_TREMOR); //45 seconds until we should cast this agian Tremor_Timer = 45000; }else Tremor_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(EnrageTimer < diff) { m_creature->CastSpell(m_creature, ENRAGE, true); EnrageTimer = 60000; }else EnrageTimer -= diff; if(Phase1) { m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); if((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 42) { m_creature->SetDisplayId(23428); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); DoPlaySoundToSet(m_creature, SOUND_CHANGE_PHASE); DoCast(m_creature, ENTROPIUS_EFFECT, true); TargetsCount = 1; TargetsCountTimer = 10000; SingularityTimer = 50000; Phase1 = false; } if(NegativeEnergyTimer < diff) { for(uint8 i=0; i<2; ++i) { if(Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) m_creature->CastSpell(target, SPELL_NEGATIVE, false); } NegativeEnergyTimer = 1000; }else NegativeEnergyTimer -= diff; //Spawns Shadow portals and then one Void Sentinel if(SummonVoidTimer < diff) { //Shadow Portals not implemented yet :X uint8 x = rand()%5; Creature* VoidSentinel = m_creature->SummonCreature(ID_VOID_SENTINEL, ShadowPortalSpawn[x][0], ShadowPortalSpawn[x][1], m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(VoidSentinel) VoidSentinel->AI()->AttackStart(m_creature->getVictim()); SummonVoidTimer = 30000; }else SummonVoidTimer -= diff; //Summon 6 humanoids every 1min (1mage & 2berserkers) if(SummonTrashTimer < diff) { for(uint8 i = 0; i < 6; i++) { uint32 ID; if((i == 1) | (i == 2)) ID = ID_SWB; else ID = ID_SWM; Creature* sTrash = m_creature->SummonCreature(ID, Trash[i][0], Trash[i][1], m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Unit* sTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) if(sTrash) sTrash->AI()->AttackStart(sTarget); } SummonTrashTimer = 60000; }else SummonTrashTimer -= diff; } else // else Entropius phase { // +1 target every 10 seconds if(TargetsCountTimer < diff) { ++TargetsCount; TargetsCountTimer = 10000; }else TargetsCountTimer -= diff; //Utrudnienie -> chain negative energy nie dziala wiec sa 3 beamy full dmg if(NegativeEnergyTimer < diff) { for(uint8 i=0; i<TargetsCount; ++i) { if(Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) m_creature->CastSpell(target, SPELL_NEGATIVE, false); } NegativeEnergyTimer = 1000; }else NegativeEnergyTimer -= diff; //Summon Singularity if(SingularityTimer < diff) { if(Unit* sTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { Creature* Singularity = m_creature->SummonCreature(ID_SINGULARITY, sTarget->GetPositionX(), sTarget->GetPositionY(), sTarget->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 20000); if(Singularity) Singularity->AI()->AttackStart(sTarget); } SingularityTimer = 50000; }else SingularityTimer -= diff; DoMeleeAttackIfReady(); } //Cast Darkness if(DarknessTimer < diff) { m_fDarkPosX = m_creature->GetPositionX(); m_fDarkPosY = m_creature->GetPositionY(); // Creature* Darkness = m_creature->SummonCreature(25879, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000); m_creature->CastSpell(m_creature, DARKNESS, true); Darkness = true; DarkFiendTimer = 3000; DarknessTimer = 45000; }else DarknessTimer -= diff; if(DarkFiendTimer < diff && Darkness) { // Phase2 1 dark fiend : Phase1 8 dark fiend uint8 i=1; if(Phase1) i=8; for(uint8 j=0; j<i; ++j) { //Using Instance Data to stop exploding after first explode if(pInstance) pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); Creature* sTrash = m_creature->SummonCreature(ID_DARK_FIEND, m_fDarkPosX, m_fDarkPosY, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 60000); if(Unit* sTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) if(sTrash) sTrash->AI()->AttackStart(sTarget); } Darkness = false; DarkFiendTimer = 45000; }else DarkFiendTimer -= diff; }
void UpdateAI(const uint32 Diff) { if (!instance) return; // we're still doing awaken animation if (bWakingUp && iAwakenTimer >= 0) { iAwakenTimer -= Diff; return; // dont do anything until we are done } else if (bWakingUp && iAwakenTimer <= 0) { bWakingUp = false; AttackStart(Unit::GetUnit(*me, instance->GetData64(0))); return; // dont want to continue until we finish the AttackStart method } //Return since we have no target if (!UpdateVictim()) return; // wake a wall minion if (WallMinionTimer <= Diff) { instance->SetData (DATA_MINIONS, IN_PROGRESS); WallMinionTimer = 10000; } else WallMinionTimer -= Diff; //If we are <66 summon the guardians if (!bGuardiansAwake && !HealthAbovePct(66)) { ActivateMinion(instance->GetData64(5), true); // EarthenGuardian1 ActivateMinion(instance->GetData64(6), true); // EarthenGuardian2 ActivateMinion(instance->GetData64(7), true); // EarthenGuardian3 ActivateMinion(instance->GetData64(8), true); // EarthenGuardian4 ActivateMinion(instance->GetData64(9), true); // EarthenGuardian5 ActivateMinion(instance->GetData64(10), false); // EarthenGuardian6 me->MonsterYell(SAY_SUMMON, LANGUAGE_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_SUMMON); bGuardiansAwake = true; } //If we are <33 summon the vault walkers if (!bVaultWalkersAwake && !HealthAbovePct(33)) { ActivateMinion(instance->GetData64(1), true); // VaultWalker1 ActivateMinion(instance->GetData64(2), true); // VaultWalker2 ActivateMinion(instance->GetData64(3), true); // VaultWalker3 ActivateMinion(instance->GetData64(4), false); // VaultWalker4 me->MonsterYell(SAY_SUMMON2, LANGUAGE_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_SUMMON2); bVaultWalkersAwake = true; } if (TremorTimer <= Diff) { //Cast DoCast(me->getVictim(), SPELL_GROUND_TREMOR); //45 seconds until we should cast this agian TremorTimer = 45000; } else TremorTimer -= Diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //to prevent abuses during phase 2 if(Phase == 2 && !m_creature->getVictim() && InCombat) EnterEvadeMode(); //Return since we have no target if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) return; if(Phase == 1 || Phase == 3) { //ShockBlast_Timer if (ShockBlast_Timer < diff) { //Shock Burst //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. DoCast(m_creature->getVictim(), SPELL_SHOCK_BLAST); m_creature->TauntApply(m_creature->getVictim()); ShockBlast_Timer = 1000+rand()%14000; //random cooldown }else ShockBlast_Timer -= diff; //StaticCharge_Timer if(StaticCharge_Timer < diff) { //Static Charge //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER, 0)) //cast Static Charge every 2 seconds for 20 seconds DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); StaticCharge_Timer = 10000+rand()%20000; //blizzlike }else StaticCharge_Timer -= diff; //Entangle_Timer if (Entangle_Timer < diff) { if(!Entangle) { //Entangle //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. DoCast(m_creature->getVictim(), SPELL_ENTANGLE); Entangle = true; Entangle_Timer = 10000; } else { CastShootOrMultishot(); Entangle = false; Entangle_Timer = 20000+rand()%5000; } }else Entangle_Timer -= diff; //Phase 1 if(Phase == 1) { //Start phase 2 if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 70) { //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. Phase = 2; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->GetMotionMaster()->Clear(); m_creature->Relocate(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); m_creature->SendMonsterMove(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 0, 0, 0); m_creature->RemoveAllAuras(); // This needs an entry in spell_script_target DoCast(m_creature, SPELL_MAGIC_BARRIER, true); Creature *pCreature; for(uint8 i = 0; i < 4; i++) { pCreature = m_creature->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); if (pCreature) ShieldGeneratorChannel[i] = pCreature->GetGUID(); } DoPlaySoundToSet(m_creature, SOUND_PHASE2); DoYell(SAY_PHASE2, LANG_UNIVERSAL, NULL); } } //Phase 3 else { //SummonSporebat_Timer if(SummonSporebat_Timer < diff) { Creature *Sporebat = NULL; Sporebat = m_creature->SummonCreature(FATHOM_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if(Sporebat) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) Sporebat->AI()->AttackStart(target); } //summon sporebats faster and faster if(SummonSporebat_StaticTimer > 1000) SummonSporebat_StaticTimer -= 1000; SummonSporebat_Timer = SummonSporebat_StaticTimer; }else SummonSporebat_Timer -= diff; } //Melee attack DoMeleeAttackIfReady(); //Check_Timer - used to check if somebody is in melee range if(Check_Timer < diff) { bool InMeleeRange = false; Unit *target; std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //if in melee range if(target && target->IsWithinDistInMap(m_creature, 5)) { InMeleeRange = true; break; } } //if nobody is in melee range if(!InMeleeRange) CastShootOrMultishot(); Check_Timer = 1000; }else Check_Timer -= diff; } //Phase 2 else { //ForkedLightning_Timer if(ForkedLightning_Timer < diff) { //Forked Lightning //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(!target) target = m_creature->getVictim(); DoCast(target, SPELL_FORKED_LIGHTNING); ForkedLightning_Timer = 2000+rand()%6000; //blizzlike }else ForkedLightning_Timer -= diff; //EnchantedElemental_Timer if(EnchantedElemental_Timer < diff) { Creature *Elemental; Elemental = m_creature->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if(Elemental) Elemental->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); if(EnchantedElemental_Pos == 7) EnchantedElemental_Pos = 0; else EnchantedElemental_Pos++; EnchantedElemental_Timer = 10000+rand()%5000; }else EnchantedElemental_Timer -= diff; //TaintedElemental_Timer if(TaintedElemental_Timer < diff) { Creature *Tain_Elemental; uint32 pos = rand()%8; Tain_Elemental = m_creature->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); if(Tain_Elemental) { Tain_Elemental->GetMotionMaster()->Clear(); Tain_Elemental->GetMotionMaster()->MoveIdle(); } TaintedElemental_Timer = 120000; }else TaintedElemental_Timer -= diff; //CoilfangElite_Timer if(CoilfangElite_Timer < diff) { Creature *CoilfangElite; uint32 pos = rand()%3; CoilfangElite = m_creature->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 45000); if(CoilfangElite) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) CoilfangElite->AI()->AttackStart(target); } CoilfangElite_Timer = 45000+rand()%5000; //wowwiki says 50 seconds, bosskillers says 45 }else CoilfangElite_Timer -= diff; //CoilfangStrider_Timer if(CoilfangStrider_Timer < diff) { Creature *CoilfangStrider; uint32 pos = rand()%3; CoilfangStrider = m_creature->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if(CoilfangStrider) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) CoilfangStrider->AI()->AttackStart(target); } CoilfangStrider_Timer = 60000+rand()%10000; //wowwiki says 60 seconds, bosskillers says 60-70 }else CoilfangStrider_Timer -= diff; //Check_Timer if(Check_Timer < diff) { //Start Phase 3 if(pInstance && pInstance->GetData(DATA_CANSTARTPHASE3)) { //set life 50% m_creature->SetHealth(m_creature->GetMaxHealth()/2); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); DoPlaySoundToSet(m_creature, SOUND_PHASE3); DoYell(SAY_PHASE3, LANG_UNIVERSAL, NULL); Phase = 3; //return to the tank m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } Check_Timer = 1000; }else Check_Timer -= diff; } }