void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (Channeling == true) { for(int ind = 0 ; ind < 4; ind++) m_creature->CastSpell(m_creature->getVictim(),SPELL_SUMMON_CARRION_BEETLES,true); Channeling = false; } if (Phase == 1) { if (SPELL_IMPALE_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) m_creature->CastSpell(target, HEROIC(SPELL_IMPALE,H_SPELL_IMPALE), true); SPELL_IMPALE_Timer = 9000; }else SPELL_IMPALE_Timer -= diff; if(!Summoned_Guardian) { Creature* Guardian; for(uint8 i=0; i < 2; ++i) { Guardian = m_creature->SummonCreature(CREATURE_GUARDIAN,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Guardian) { Guardian->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Guardian); } } Summoned_Guardian = true; } if(!Summoned_Venomancer) { if(VENOMANCER_Timer < diff) { if(Phase_Time > 1) { Creature* Venomancer; for(uint8 i=0; i < 2; ++i) { Venomancer = m_creature->SummonCreature(CREATURE_VENOMANCER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Venomancer) { Venomancer->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Venomancer); } } Summoned_Venomancer = true; } }else VENOMANCER_Timer -= diff; } if(!Summoned_Datter) { if(DATTER_Timer < diff) { if(Phase_Time > 2) { Creature* Datter; for(uint8 i=0; i < 2; ++i) { Datter = m_creature->SummonCreature(CREATURE_DATTER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0); if(Datter) { Datter->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Datter); } } Summoned_Datter = true; } }else DATTER_Timer -= diff; } if (UNDERGROUND_Timer < diff) { m_creature->RemoveAura(SPELL_SUBMERGE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Phase = 0; }else UNDERGROUND_Timer -= diff; } if (Phase == 0) { if (SPELL_LEECHING_SWARM_Timer < diff) { m_creature->CastSpell(m_creature,SPELL_LEECHING_SWARM,true); SPELL_LEECHING_SWARM_Timer = 19000; }else SPELL_LEECHING_SWARM_Timer -= diff; if (SPELL_CARRION_BEETLES_Timer < diff) { Channeling = true; m_creature->CastSpell(m_creature->getVictim(),SPELL_CARRION_BEETLES,false); SPELL_CARRION_BEETLES_Timer = 25000; }else SPELL_CARRION_BEETLES_Timer -= diff; if (SPELL_POUND_Timer < diff) { DoCast(m_creature->getVictim(), HEROIC(SPELL_POUND,H_SPELL_POUND)); SPELL_POUND_Timer = 16500; }else SPELL_POUND_Timer -= diff; } if ((Phase_Time == 0 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75) || (Phase_Time == 1 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50) || (Phase_Time == 2 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 25)) { ++Phase_Time; Summoned_Guardian = false; Summoned_Venomancer = false; Summoned_Datter = false; UNDERGROUND_Timer = 40000; VENOMANCER_Timer = 25000; DATTER_Timer = 32000; m_creature->CastSpell(m_creature,SPELL_SUBMERGE,false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Phase = 1; } if (!Phase == 1) { DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if (!CanStartEvent)//boss is invisible, don't attack { if (CheckCanStart()) { if (Submerged) { me->SetVisible(true); Submerged = false; WaitTimer2 = 500; } if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim { me->RemoveAllAuras(); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); DoCast(me, SPELL_EMERGE, false); WaitTimer2 = 60000;//never reached WaitTimer = 3000; } else WaitTimer2 -= diff; if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack { WaitTimer = 3000; CanStartEvent = true;//fresh fished from pool me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } else WaitTimer -= diff; } return; } if (me->getThreatManager().getThreatList().empty())//check if should evade { if (me->isInCombat()) EnterEvadeMode(); return; } if (!Submerged) { if (PhaseTimer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_SUBMERGE); PhaseTimer = 60000;//60secs submerged Submerged = true; } else PhaseTimer-=diff; if (SpoutTimer <= diff) { me->MonsterTextEmote(EMOTE_SPOUT,0,true); me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); SpoutTimer = 45000; WhirlTimer = 20000;//whirl directly after spout RotTimer = 20000; return; } else SpoutTimer -= diff; //Whirl directly after a Spout and at random times if (WhirlTimer <= diff) { WhirlTimer = 18000; DoCast(me, SPELL_WHIRL); } else WhirlTimer -= diff; if (CheckTimer <= diff)//check if there are players in melee range { InRange = false; Map* pMap = me->GetMap(); Map::PlayerList const &PlayerList = pMap->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (me->IsWithinMeleeRange(i->getSource())) InRange = true; } } CheckTimer = 2000; } else CheckTimer -= diff; if (RotTimer) { Map* pMap = me->GetMap(); if (pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource() && i->getSource()->isAlive() && me->HasInArc(float(diff/20000*M_PI*2),i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater()) DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water } } if (SpoutAnimTimer <= diff) { DoCast(me, SPELL_SPOUT_ANIM, true); SpoutAnimTimer = 1000; } else SpoutAnimTimer -= diff; if (RotTimer <= diff) { RotTimer = 0; } else RotTimer -= diff; return; } if (GeyserTimer <= diff) { Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); if (!pTarget && me->getVictim()) pTarget = me->getVictim(); if (pTarget) DoCast(pTarget, SPELL_GEYSER, true); GeyserTimer = rand()%5000 + 15000; } else GeyserTimer -= diff; if (!InRange)//if on players in melee range cast Waterbolt { if (WaterboltTimer <= diff) { Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); if (!pTarget && me->getVictim()) pTarget = me->getVictim(); if (pTarget) DoCast(pTarget, SPELL_WATERBOLT, true); WaterboltTimer = 3000; } else WaterboltTimer -= diff; } if (!UpdateVictim()) return; DoMeleeAttackIfReady(); }else//submerged { if (PhaseTimer <= diff) { Submerged = false; me->InterruptNonMeleeSpells(false);//shouldn't be any me->RemoveAllAuras(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); DoCast(me, SPELL_EMERGE, true); Spawned = false; SpoutTimer = 3000; // directly cast Spout after emerging! PhaseTimer = 120000; return; } else PhaseTimer-=diff; if (me->getThreatManager().getThreatList().empty())//check if should evade { EnterEvadeMode(); return; } if (!me->isInCombat()) DoZoneInCombat(); if (!Spawned) { me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); //spawn adds for (uint8 i = 0; i < 9; ++i) { Creature* Summoned; if (i < 6) Summoned = me->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); else Summoned = me->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); if (Summoned) Summons.Summon(Summoned); } Spawned = true; } } }
void EnterCombat(Unit* /*who*/) { DoCast(me, ENSLAVED_SOUL_PASSIVE, true); DoZoneInCombat(); }
void EnterCombat(Unit* /*who*/) override { DoZoneInCombat(); }
void BossAI::JustSummoned(Creature* summon) { summons.Summon(summon); if (me->isInCombat()) DoZoneInCombat(summon); }
void EnterCombat(Unit* /*who*/) { DoScriptText(SAY_AGGRO, me); DoZoneInCombat(); }
void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); //DoCast(me, SPELL_VAPOR_FORCE, true); core bug }
void Reset() override { me->RemoveAllAuras(); DoZoneInCombat(); events.ScheduleEvent(EVENT_FADE_ARMOR, 1000); }
void JustSummoned(Creature* summon) { if (me->isInCombat()) DoZoneInCombat(summon); }
void JustSummoned(Creature* summon) { Summons.push_back(summon->GetGUID()); DoZoneInCombat(summon); }
void JustSummoned(Creature* who) override { DoZoneInCombat(who); }
void EnterCombat(Unit * /*who*/) { DoCast(me, SPELL_ESSENCEOFTHERED); DoZoneInCombat(); me->SetHealth(me->CountPctFromMaxHealth(30)); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!me->HasAura(SPELL_BERSERK, 0)) { if (BerserkTimer <= diff) DoCast(me, SPELL_BERSERK); else BerserkTimer -= diff; } if (SummonFlameTimer <= diff) { DoCast(me, SPELL_MOLTEN_PUNCH); SummonFlameTimer = 10000; } else SummonFlameTimer -= diff; if (Phase1) { if (HatefulStrikeTimer <= diff) { if (Unit* pTarget = CalculateHatefulStrikeTarget()) { DoCast(pTarget, SPELL_HATEFUL_STRIKE); HatefulStrikeTimer = 5000; } } else HatefulStrikeTimer -= diff; } if (!Phase1) { if (SwitchTargetTimer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { if (me->GetDistance2d(me->GetVictim()) < 40) me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); DoResetThreat(); me->AddThreat(pTarget, 5000000.0f); DoScriptText(EMOTE_NEW_TARGET, me); SwitchTargetTimer = 10000; } } else SwitchTargetTimer -= diff; if (SummonVolcanoTimer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true)) { DoCast(pTarget, SPELL_VOLCANIC_SUMMON); DoScriptText(EMOTE_GROUND_CRACK, me); SummonVolcanoTimer = 10000; } } else SummonVolcanoTimer -= diff; } if (PhaseSwitchTimer <= diff) { if (!Phase1) { Phase1 = true; DoResetThreat(); PhaseSwitchTimer = 60000; me->SetSpeed(MOVE_RUN, 1.2f); DoZoneInCombat(); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); } else { Phase1 = false; DoResetThreat(); SwitchTargetTimer = 10000; SummonVolcanoTimer = 2000; PhaseSwitchTimer = 60000; me->SetSpeed(MOVE_RUN, 0.9f); DoZoneInCombat(); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); } } else PhaseSwitchTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim() && !events.IsInPhase(PHASE_EVENT)) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { // PHASE ONE case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN); break; case EVENT_STAGGERING_ROAR: DoCast(me, SPELL_STAGGERING_ROAR); events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_HUMAN); break; case EVENT_ENRAGE: DoCast(me, SPELL_ENRAGE); events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN); break; case EVENT_SMASH: DoCastAOE(SPELL_SMASH); events.ScheduleEvent(EVENT_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_HUMAN); break; case EVENT_JUST_TRANSFORMED: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); DoZoneInCombat(); ScheduleSecondPhase(); return; case EVENT_SUMMON_BANSHEE: DoCast(me, SPELL_SUMMON_BANSHEE); return; // PHASE TWO case EVENT_DARK_SMASH: DoCastVictim(SPELL_DARK_SMASH); events.ScheduleEvent(EVENT_DARK_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; case EVENT_DREADFUL_ROAR: DoCast(me, SPELL_DREADFUL_ROAR); events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; case EVENT_WOE_STRIKE: DoCastVictim(SPELL_WOE_STRIKE); events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; case EVENT_SHADOW_AXE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) DoCast(target, SPELL_SHADOW_AXE_SUMMON); events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; default: break; } } if (!events.IsInPhase(PHASE_EVENT)) DoMeleeAttackIfReady(); }
void EnterCombat(Unit* who) { DoZoneInCombat(); }
void UpdateAI(const uint32 diff) { if(InciteChaos) { if(InciteChaosWait_Timer < diff) { InciteChaos = false; DoZoneInCombat(); DoResetThreat(); Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true); if(target) AttackStart(target); } else InciteChaosWait_Timer -= diff; return; } if (!UpdateVictim()) return; else TrashAggro(); if(InciteChaos_Timer < diff) { DoCast(me, SPELL_INCITE_CHAOS); Map *map = me->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); if(PlayerList.isEmpty()) return; for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { Player *plr = i->getSource(); Player *target = (Player*)SelectUnit(SELECT_TARGET_RANDOM, 0, 100, true, plr->GetGUID()); if(plr && plr->IsAIEnabled && target) plr->AI()->AttackStart(target); } //DoResetThreat(); InciteChaos = true; InciteChaos_Timer = 40000; InciteChaosWait_Timer = 16000; return; } else InciteChaos_Timer -= diff; //Charge_Timer if (Charge_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true)) DoCast(target, SPELL_CHARGE); Charge_Timer = 25000; } else Charge_Timer -= diff; //Knockback_Timer if (Knockback_Timer < diff) { DoCast(me, SPELL_WAR_STOMP); Knockback_Timer = 20000; } else Knockback_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (CheckTimer < diff) { if (!m_creature->IsWithinDistInMap(&wLoc, 50.0f)) EnterEvadeMode(); else DoZoneInCombat(); CheckTimer = 3000; } else CheckTimer -= diff; switch (Phase) { case 1: { if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95) { Phase = 2; Creature *pAttumen = m_creature->SummonCreature(SUMMON_ATTUMEN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); //DoSpawnCreature(SUMMON_ATTUMEN, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); if (pAttumen) { Attumen = pAttumen->GetGUID(); pAttumen->AI()->AttackStart(m_creature->getVictim()); SetMidnight(pAttumen, m_creature->GetGUID()); DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen); } } break; } case 2: { if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25) if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen)) Mount(pAttumen); break; } case 3: { if (Mount_Timer) { if (Mount_Timer <= diff) { Mount_Timer = 0; m_creature->SetVisibility(VISIBILITY_OFF); m_creature->GetMotionMaster()->MoveIdle(); if (Creature *pAttumen = Unit::GetCreature(*m_creature, Attumen)) { pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID); pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (pAttumen->getVictim()) { pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); pAttumen->SetSelection(pAttumen->getVictimGUID()); } pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); } } else Mount_Timer -= diff; } return; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_INTRO))) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_INTRO_1: //DoScriptText(SAY_GORKUN_INTRO_2, pGorkunOrVictus); break; case EVENT_INTRO_2: DoScriptText(SAY_TYRANNUS_INTRO_3, me); break; case EVENT_INTRO_3: me->ExitVehicle(); me->GetMotionMaster()->MovePoint(0, miscPos); break; case EVENT_COMBAT_START: if (Creature* rimefang = me->GetCreature(*me, instance->GetData64(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight events.SetPhase(PHASE_COMBAT); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); DoCast(me, SPELL_FULL_HEAL); DoZoneInCombat(); events.ScheduleEvent(EVENT_OVERLORD_BRAND, urand(5000, 7000)); events.ScheduleEvent(EVENT_FORCEFUL_SMASH, urand(14000, 16000)); events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, urand(25000, 27000)); break; case EVENT_OVERLORD_BRAND: if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) DoCast(target, SPELL_OVERLORD_BRAND); events.ScheduleEvent(EVENT_OVERLORD_BRAND, urand(11000, 12000)); break; case EVENT_FORCEFUL_SMASH: DoCastVictim(SPELL_FORCEFUL_SMASH); events.ScheduleEvent(EVENT_UNHOLY_POWER, 1000); break; case EVENT_UNHOLY_POWER: DoScriptText(SAY_DARK_MIGHT_1, me); DoScriptText(SAY_DARK_MIGHT_2, me); DoCast(me, SPELL_UNHOLY_POWER); events.ScheduleEvent(EVENT_FORCEFUL_SMASH, urand(40000, 48000)); break; case EVENT_MARK_OF_RIMEFANG: DoScriptText(SAY_MARK_RIMEFANG_1, me); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) { DoScriptText(SAY_MARK_RIMEFANG_2, me, target); DoCast(target, SPELL_MARK_OF_RIMEFANG); } events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, urand(24000, 26000)); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (DelayTimer && DelayTimer > 5000) DelayEventStart(); else DelayTimer+=diff; switch (Phase) { case PHASE_UNDERGROUND: if (ImpaleTimer <= diff) { switch (ImpalePhase) { case IMPALE_PHASE_TARGET: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { if (Creature* impaleTarget = DoSummonImpaleTarget(target)) impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SHAKEGROUND, true); ImpaleTimer = 3*IN_MILLISECONDS; ImpalePhase = IMPALE_PHASE_ATTACK; } break; case IMPALE_PHASE_ATTACK: if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget)) { impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SPIKE, false); impaleTarget->RemoveAurasDueToSpell(SPELL_IMPALE_SHAKEGROUND); } ImpalePhase = IMPALE_PHASE_DMG; ImpaleTimer = 1*IN_MILLISECONDS; break; case IMPALE_PHASE_DMG: if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget)) me->CastSpell(impaleTarget, DUNGEON_MODE(SPELL_IMPALE_DMG, SPELL_IMPALE_DMG_H), true); ImpalePhase = IMPALE_PHASE_TARGET; ImpaleTimer = 9*IN_MILLISECONDS; break; } } else ImpaleTimer -= diff; if (!GuardianSummoned) { for (uint8 i = 0; i < 2; ++i) { if (Creature* Guardian = me->SummonCreature(CREATURE_GUARDIAN, SpawnPointGuardian[i], TEMPSUMMON_CORPSE_DESPAWN, 0)) { Guardian->AddThreat(me->getVictim(), 0.0f); DoZoneInCombat(Guardian); } } GuardianSummoned = true; } if (!VenomancerSummoned) { if (VenomancerTimer <= diff) { if (UndergroundPhase > 1) { for (uint8 i = 0; i < 2; ++i) { if (Creature* Venomancer = me->SummonCreature(CREATURE_VENOMANCER, SpawnPoint[i], TEMPSUMMON_CORPSE_DESPAWN, 0)) { Venomancer->AddThreat(me->getVictim(), 0.0f); DoZoneInCombat(Venomancer); } } VenomancerSummoned = true; } } else VenomancerTimer -= diff; } if (!DatterSummoned) { if (DatterTimer <= diff) { if (UndergroundPhase > 2) { for (uint8 i = 0; i < 2; ++i) { if (Creature* Datter = me->SummonCreature(CREATURE_DATTER, SpawnPoint[i], TEMPSUMMON_CORPSE_DESPAWN, 0)) { Datter->AddThreat(me->getVictim(), 0.0f); DoZoneInCombat(Datter); } } DatterSummoned = true; } } else DatterTimer -= diff; if (me->HasAura(SPELL_LEECHING_SWARM)) me->RemoveAurasDueToSpell(SPELL_LEECHING_SWARM); } if (UndergroundTimer <= diff) { me->RemoveAura(SPELL_SUBMERGE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); Phase = PHASE_MELEE; } else UndergroundTimer -= diff; break; case PHASE_MELEE: if (((UndergroundPhase == 0 && HealthBelowPct(75)) || (UndergroundPhase == 1 && HealthBelowPct(50)) || (UndergroundPhase == 2 && HealthBelowPct(25))) && !me->HasUnitState(UNIT_STATE_CASTING)) { GuardianSummoned = false; VenomancerSummoned = false; DatterSummoned = false; UndergroundTimer = 40*IN_MILLISECONDS; VenomancerTimer = 25*IN_MILLISECONDS; DatterTimer = 32*IN_MILLISECONDS; ImpalePhase = 0; ImpaleTimer = 9*IN_MILLISECONDS; DoCast(me, SPELL_SUBMERGE, false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); Phase = PHASE_UNDERGROUND; ++UndergroundPhase; } if (Channeling == true) { for (uint8 i = 0; i < 8; ++i) DoCast(me->getVictim(), SPELL_SUMMON_CARRION_BEETLES, true); Channeling = false; } else if (CarrionBeetlesTimer <= diff) { Channeling = true; DoCastVictim(SPELL_CARRION_BEETLES); CarrionBeetlesTimer = 25*IN_MILLISECONDS; } else CarrionBeetlesTimer -= diff; if (LeechingSwarmTimer <= diff) { DoCast(me, SPELL_LEECHING_SWARM, true); LeechingSwarmTimer = 19*IN_MILLISECONDS; } else LeechingSwarmTimer -= diff; if (PoundTimer <= diff) { if (Unit* target = me->getVictim()) { if (Creature* pImpaleTarget = DoSummonImpaleTarget(target)) me->CastSpell(pImpaleTarget, DUNGEON_MODE(SPELL_POUND, SPELL_POUND_H), false); } PoundTimer = 16500; } else PoundTimer -= diff; DoMeleeAttackIfReady(); break; } }
void UpdateAI(const uint32 diff) { if (Intro && !Done) { if (AggroTimer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoScriptText(SAY_AGGRO, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Done = true; if (AggroTargetGUID) { Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID); if (pUnit) AttackStart(pUnit); DoZoneInCombat(); } else { EnterEvadeMode(); return; } } else AggroTimer -= diff; } if (!UpdateVictim() || !Done) return; if (SummonShadowsTimer <= diff) { //MindControlGhost(); for (uint8 i = 0; i < 2; ++i) { Creature* Shadow = NULL; float X = CalculateRandomLocation(me->GetPositionX(), 10); Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); if (Shadow) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->getVictim(); if (pTarget) Shadow->AI()->AttackStart(pTarget); } } SummonShadowsTimer = 60000; } else SummonShadowsTimer -= diff; if (SummonDoomBlossomTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) { float X = CalculateRandomLocation(pTarget->GetPositionX(), 20); float Y = CalculateRandomLocation(pTarget->GetPositionY(), 20); float Z = pTarget->GetPositionZ(); Z = me->GetMap()->GetHeight(X, Y, Z); Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); if (DoomBlossom) { DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoomBlossom->setFaction(me->getFaction()); DoomBlossom->AddThreat(pTarget, 1.0f); CAST_AI(mob_doom_blossom::mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); pTarget->CombatStart(DoomBlossom); SetThreatList(DoomBlossom); SummonDoomBlossomTimer = 35000; } } } else SummonDoomBlossomTimer -= diff; if (IncinerateTimer <= diff) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->getVictim(); if (pTarget) { DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me); DoCast(pTarget, SPELL_INCINERATE); IncinerateTimer = 20000 + rand()%31 * 1000; } } else IncinerateTimer -= diff; if (CrushingShadowsTimer <= diff) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if (pTarget && pTarget->isAlive()) DoCast(pTarget, SPELL_CRUSHING_SHADOWS); CrushingShadowsTimer = 10000 + rand()%16 * 1000; } else CrushingShadowsTimer -= diff; /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/ /*if (ShadowOfDeathTimer <= diff) { Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!pTarget) pTarget = me->getVictim(); if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) { DoCast(pTarget, SPELL_SHADOW_OF_DEATH); GhostGUID = pTarget->GetGUID(); ShadowOfDeathTimer = 30000; SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player } } else ShadowOfDeathTimer -= diff;*/ if (RandomYellTimer <= diff) { DoScriptText(RAND(SAY_SPELL1, SAY_SPELL2), me); RandomYellTimer = 50000 + rand()%51 * 1000; } else RandomYellTimer -= diff; if (!me->HasAura(SPELL_BERSERK)) { if (EnrageTimer <= diff) { DoCast(me, SPELL_BERSERK); DoScriptText(SAY_ENRAGE, me); } else EnrageTimer -= diff; } DoMeleeAttackIfReady(); }
void EnterCombat(Unit* /*who*/) { DoCast(me, SPELL_ESSENCEOFTHERED); DoZoneInCombat(); me->SetHealth(int(me->GetMaxHealth()*.3)); }
void EnterCombat(Unit* /*who*/) override { Talk(DESI_SAY_FREED); DoZoneInCombat(); DoCast(me, AURA_OF_DESIRE, true); }
void UpdateAI(const uint32 diff) { if(Intro) { if(AggroTimer < diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoScriptText(SAY_AGGRO, me); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Intro = false; if(AggroTargetGUID) { Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID); if(pUnit) AttackStart(pUnit); DoZoneInCombat(); } else { EnterEvadeMode(); return; } }else AggroTimer -= diff; } if(!UpdateVictim() || Intro) return; if(pulse_Timer < diff) { DoAttackerAreaInCombat(me->getVictim(),50); pulse_Timer = 10000; }else pulse_Timer -= diff; //if(SummonShadowsTimer < diff) //{ // MindControlGhost(); // for(uint8 i = 0; i < 2; ++i) // { // Creature* Shadow = NULL; // float X = CalculateRandomLocation(me->GetPositionX(), 10); // //Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); // if(Shadow) // { // Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 1); // if(!ptarget) // ptarget = me->getVictim(); // if(ptarget) // Shadow->AI()->AttackStart(ptarget); // } // } // SummonShadowsTimer = 60000; //}else SummonShadowsTimer -= diff; if(SummonDoomBlossomTimer < diff) { if (Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) { if(TryDoCast(ptarget,SPELL_SUMMON_DOOM_BLOSSOM)) SummonDoomBlossomTimer = 35000; } }else SummonDoomBlossomTimer -= diff; if(IncinerateTimer < diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 300, true); if(!target) target = me->getVictim(); if(target) { if(TryDoCast(target, SPELL_INCINERATE)) { switch(rand()%2) { case 0: DoScriptText(SAY_SPECIAL1, me); break; case 1: DoScriptText(SAY_SPECIAL2, me); break; } IncinerateTimer = 10000 + (rand()%10) * 1000; } } }else IncinerateTimer -= diff; if(CrushingShadowsTimer < diff) { if(!me->IsNonMeleeSpellCasted(false)) { SpellEntry *spellInfo; spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CRUSHING_SHADOWS); if(spellInfo) { spellInfo->MaxAffectedTargets = 5; me->CastSpell(me,spellInfo,false); } CrushingShadowsTimer = 10000 + rand()%5000; } }else CrushingShadowsTimer -= diff; if(ShadowOfDeathTimer < diff) { if(!me->IsNonMeleeSpellCasted(false)) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 300, true); if(!target) target = me->getVictim(); if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER && !target->HasAura(SPELL_SHADOW_OF_DEATH,1) ) { // Custom ... becaus Effekt is not needed SpellEntry *spellInfo; spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SHADOW_OF_DEATH); if(spellInfo) { spellInfo->Effect[0] = 0; me->CastSpell(target,spellInfo,false); } //DoCast(target, SPELL_SHADOW_OF_DEATH); //me->CastCustomSpell(target,SPELL_SHADOW_OF_DEATH,NULL,NULL,NULL,false); /*GhostGUID = target->GetGUID();*/ ShadowOfDeathTimer = 30000; //SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player } } }else ShadowOfDeathTimer -= diff; if(SummonShadowsTimer < diff) { if(!shadowtargets.empty()) { std::list<uint64> del_player; del_player.clear(); for(std::list<uint64>::iterator itr = shadowtargets.begin(); itr != shadowtargets.end(); ++itr) { Player* temp = Unit::GetPlayer(*me,*itr); if(temp) { if(temp->isDead() || !temp->HasAuraEffect(SPELL_SHADOW_OF_DEATH,1)) { float x,y,z; temp->GetPosition(x,y,z); Unit *ptarget; Creature* c_temp; c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x+3 ,y+3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if(!ptarget) ptarget = me->getVictim(); if(ptarget) c_temp->Attack(ptarget,true); c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x-3 ,y+3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if(!ptarget) ptarget = me->getVictim(); if(ptarget) c_temp->Attack(ptarget,true); c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x+3 ,y-3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if(!ptarget) ptarget = me->getVictim(); if(ptarget) c_temp->Attack(ptarget,true); c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x-3 ,y-3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0); if(!ptarget) ptarget = me->getVictim(); if(ptarget) c_temp->Attack(ptarget,true); del_player.push_back(*itr); } }/*else del_player.push_back(*itr);*/ //Auskommentieren fixt ALT+F4 Exploit } for(std::list<uint64>::iterator itr = del_player.begin(); itr != del_player.end(); ++itr) { shadowtargets.remove(*itr); Player* sacrifice = Unit::GetPlayer(*me,*itr); if(sacrifice && sacrifice->isAlive()) { me->DealDamage(sacrifice,sacrifice->GetHealth()); } } } SummonShadowsTimer = 1000; }else SummonShadowsTimer -= diff; if(RandomYellTimer < diff) { switch(rand()%2) { case 0: DoScriptText(SAY_SPELL1, me); break; case 1: DoScriptText(SAY_SPELL2, me); break; } RandomYellTimer = 50000 + rand()%51 * 1000; }else RandomYellTimer -= diff; if(!me->HasAura(SPELL_BERSERK, 0)) { if(EnrageTimer < diff) { DoCast(me, SPELL_BERSERK); DoScriptText(SAY_ENRAGE, me); }else EnrageTimer -= diff; } DoMeleeAttackIfReady(); }
void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); DoZoneInCombat(); }
void EnterCombat(Unit * /*who*/) { DoZoneInCombat(); }
void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); if (instance) instance->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->hasUnitState(UNIT_STAT_CASTING) || me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) return; while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case 0: break; case EVENT_PURSUE: DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); { DoZoneInCombat(); Unit* pTarget; std::vector<Unit *> target_list; std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (!pTarget) continue; if (pTarget->GetEntry() == VEHICLE_SIEGE || pTarget->GetEntry() == VEHICLE_DEMOLISHER) target_list.push_back(pTarget); pTarget = NULL; } if (!target_list.empty()) pTarget = *(target_list.begin()+rand()%target_list.size()); else pTarget = me->getVictim(); if (pTarget && pTarget->isAlive()) { DoResetThreat(); me->AddThreat(pTarget, 5000000.0f); me->AddAura(SPELL_PURSUED, pTarget); me->MonsterTextEmote(EMOTE_PURSUE, pTarget->GetGUID(), true); } } events.RescheduleEvent(EVENT_PURSUE, 35000); break; case EVENT_MISSILE: DoCastAOE(SPELL_MISSILE_BARRAGE); events.RescheduleEvent(EVENT_MISSILE, 1500); break; case EVENT_VENT: DoCastAOE(SPELL_FLAME_VENTS); events.RescheduleEvent(EVENT_VENT, urand(15000, 20000)); break; case EVENT_SPEED: DoCastAOE(SPELL_GATHERING_SPEED); events.RescheduleEvent(EVENT_SPEED, 10000); break; case EVENT_SUMMON: if(summons.size() < 15) // 4seat+1turret+10lift if(Creature *lift = DoSummonFlyer(MOB_MECHANOLIFT, me, float(rand()%20 + 20), 50, 0)) lift->GetMotionMaster()->MoveRandom(100); events.RescheduleEvent(EVENT_SUMMON, 2000); break; case EVENT_SHUTDOWN: DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); DoCast(SPELL_SYSTEMS_SHUTDOWN); me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); me->MonsterTextEmote(EMOTE_REPAIR, 0, true); events.RescheduleEvent(EVENT_SHUTDOWN, 90000); break; default: events.PopEvent(); break; } } if (me->IsWithinMeleeRange(me->getVictim())) DoSpellAttackIfReady(SPELL_BATTERING_RAM); }
void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) { //No target so we'll use this section to do our random wispers instance wide //WisperTimer if (WisperTimer <= diff) { Map* map = me->GetMap(); if (!map->IsDungeon()) return; //Play random sound to the zone Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* pPlr = itr->getSource()) pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr); } } //One random wisper every 90 - 300 seconds WisperTimer = urand(90000, 300000); } else WisperTimer -= diff; return; } me->SetTarget(0); //No instance if (!instance) return; uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE); if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) { // EyeTentacleTimer if (EyeTentacleTimer <= diff) { //Spawn the 8 Eye Tentacles in the corret spots SpawnEyeTentacle(0, 20); //south SpawnEyeTentacle(10, 10); //south west SpawnEyeTentacle(20, 0); //west SpawnEyeTentacle(10, -10); //north west SpawnEyeTentacle(0, -20); //north SpawnEyeTentacle(-10, -10); //north east SpawnEyeTentacle(-20, 0); // east SpawnEyeTentacle(-10, 10); // south east EyeTentacleTimer = 30000; // every 30sec in phase 2 } else EyeTentacleTimer -= diff; } switch (currentPhase) { //Transition phase case PHASE_CTHUN_TRANSITION: //PhaseTimer if (PhaseTimer <= diff) { //Switch instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Switch to c'thun model me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_TRANSFORM, false); me->SetFullHealth(); me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach Stomach_Map.clear(); for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; //Body Phase case PHASE_CTHUN_STOMACH: //Remove Target field me->SetTarget(0); //Weaken if (FleshTentaclesKilled > 1) { instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); DoScriptText(EMOTE_WEAKENED, me); PhaseTimer = 45000; DoCast(me, SPELL_PURPLE_COLORATION, true); UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* unit = Unit::GetUnit(*me, i->first); //Only move units in stomach if (unit && i->second == true) { //Teleport each player out DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } ++i; } return; } //Stomach acid if (StomachAcidTimer <= diff) { //Apply aura to all players in stomach UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { //Check for valid player Unit* unit = Unit::GetUnit(*me, i->first); //Only apply to units in stomach if (unit && i->second == true) { //Cast digestive acid on them DoCast(unit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach if (unit->IsWithinDist3d(&KickPos, 15.0f)) { //Teleport each player out DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } } ++i; } StomachAcidTimer = 4000; } else StomachAcidTimer -= diff; //Stomach Enter Timer if (StomachEnterTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Set target in stomach Stomach_Map[target->GetGUID()] = true; target->InterruptNonMeleeSpells(false); target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } StomachEnterTimer = 13800; } else StomachEnterTimer -= diff; if (StomachEnterVisTimer && StomachEnterTarget) { if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* unit = Unit::GetUnit(*me, StomachEnterTarget); if (unit) { DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget = 0; StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; } //GientClawTentacleTimer if (GiantClawTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; } else GiantClawTentacleTimer -= diff; //GiantEyeTentacleTimer if (GiantEyeTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; } else GiantEyeTentacleTimer -= diff; break; //Weakened state case PHASE_CTHUN_WEAK: //PhaseTimer if (PhaseTimer <= diff) { //Switch instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Remove purple coloration me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; } }
void EnterCombat(Unit * /*who*/) { DoScriptText(DESI_SAY_FREED, me); DoZoneInCombat(); DoCast(me, AURA_OF_DESIRE, true); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; if (bChanneling == true) { for (uint8 i = 0; i < 4; ++i) DoCast(m_creature->getVictim(), SPELL_SUMMON_CARRION_BEETLES, true); bChanneling = false; } if (uiPhase == 1) { if (uiImpaleTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) m_creature->CastSpell(pTarget, DUNGEON_MODE(SPELL_IMPALE,H_SPELL_IMPALE), true); uiImpaleTimer = 9*IN_MILISECONDS; } else uiImpaleTimer -= diff; if (!bGuardianSummoned) { for (uint8 i = 0; i < 2; ++i) { if (Creature *Guardian = m_creature->SummonCreature(CREATURE_GUARDIAN,SpawnPoint[i],TEMPSUMMON_CORPSE_DESPAWN,0)) { Guardian->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Guardian); } } bGuardianSummoned = true; } if (!bVenomancerSummoned) { if (uiVenomancerTimer <= diff) { if (uiPhaseTimer > 1) { for (uint8 i = 0; i < 2; ++i) { if (Creature *Venomancer = m_creature->SummonCreature(CREATURE_VENOMANCER,SpawnPoint[i],TEMPSUMMON_CORPSE_DESPAWN,0)) { Venomancer->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Venomancer); } } bVenomancerSummoned = true; } } else uiVenomancerTimer -= diff; } if (!bDatterSummoned) { if (uiDatterTimer <= diff) { if (uiPhaseTimer > 2) { for (uint8 i = 0; i < 2; ++i) { if (Creature *Datter = m_creature->SummonCreature(CREATURE_DATTER,SpawnPoint[i],TEMPSUMMON_CORPSE_DESPAWN,0)) { Datter->AddThreat(m_creature->getVictim(), 0.0f); DoZoneInCombat(Datter); } } bDatterSummoned = true; } } else uiDatterTimer -= diff; } if (uiUndergroundTimer <= diff) { m_creature->RemoveAura(SPELL_SUBMERGE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); uiPhase = 0; } else uiUndergroundTimer -= diff; } if (uiPhase == 0) { if (uiLeechingSwarmTimer <= diff) { DoCast(m_creature, SPELL_LEECHING_SWARM, true); uiLeechingSwarmTimer = 19*IN_MILISECONDS; } else uiLeechingSwarmTimer -= diff; if (uiCarrionBeetlesTimer <= diff) { bChanneling = true; DoCastVictim(SPELL_CARRION_BEETLES); uiCarrionBeetlesTimer = 25*IN_MILISECONDS; } else uiCarrionBeetlesTimer -= diff; if (uiPoundTimer <= diff) { DoCastVictim(SPELL_POUND); uiPoundTimer = 16.5*IN_MILISECONDS; } else uiPoundTimer -= diff; } if ((uiPhaseTimer == 0 && HealthBelowPct(75)) || (uiPhaseTimer == 1 && HealthBelowPct(50)) || (uiPhaseTimer == 2 && HealthBelowPct(25))) { ++uiPhaseTimer; bGuardianSummoned = false; bVenomancerSummoned = false; bDatterSummoned = false; uiUndergroundTimer = 40*IN_MILISECONDS; uiVenomancerTimer = 25*IN_MILISECONDS; uiDatterTimer = 32*IN_MILISECONDS; DoCast(m_creature, SPELL_SUBMERGE, false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); uiPhase = 1; } if (uiPhase != 1) DoMeleeAttackIfReady(); }