void JustReachedHome() { Summons.DespawnAll(); Reset(); }
void JustDied(Unit* /*killer*/) { Talk(SAY_DEAD); summons.DespawnAll(); }
void JustDied(Unit* /*Killer*/) { DoScriptText(SAY_DEATH, me); summons.DespawnAll(); }
void JustDied(Unit* /*killer*/) { DoSendQuantumText(SAY_DEATH, me); Summons.DespawnAll(); }
void Reset() { summons.DespawnAll(); textCounter = SAY_DS_DOWN_1; }
void Reset() { summons.DespawnAll(); }
void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); Summons.DespawnAll(); instance->SetBossState(DATA_SKADI_THE_RUTHLESS, DONE); }
void EnterEvadeMode() { me->GetMotionMaster()->MoveTargetedHome(); Summons.DespawnAll(); }
void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if( me->HasUnitState(UNIT_STATE_CASTING) ) return; switch( events.GetEvent() ) { case 0: break; case EVENT_YELL_DEAD_1: Talk(YELL_DEAD_1); events.PopEvent(); break; case EVENT_START_RESURRECTION: me->CastSpell(me, SPELL_SUMMON_VALKYR, true); events.PopEvent(); events.RescheduleEvent(EVENT_VALKYR_BEAM, 7000); events.RescheduleEvent(EVENT_VALKYR_MOVE, 1); events.RescheduleEvent(EVENT_ANNHYLDE_YELL, 3000); break; case EVENT_VALKYR_MOVE: if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) s->GetMotionMaster()->MovePoint(1, s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()-15.0f); events.PopEvent(); break; case EVENT_ANNHYLDE_YELL: if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) s->AI()->Talk(YELL_ANHYLDE_2); events.PopEvent(); break; case EVENT_VALKYR_BEAM: me->RemoveAura(SPELL_SUMMON_VALKYR); if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) c->CastSpell(me, SPELL_RESURRECTION_BEAM, false); events.PopEvent(); events.RescheduleEvent(EVENT_RESURRECTION_BALL, 4000); break; case EVENT_RESURRECTION_BALL: me->CastSpell(me, SPELL_RESURRECTION_BALL, true); events.PopEvent(); events.RescheduleEvent(EVENT_RESURRECTION_HEAL, 4000); break; case EVENT_RESURRECTION_HEAL: me->RemoveAura(SPELL_RESURRECTION_BALL); me->CastSpell(me, SPELL_RESURRECTION_HEAL, true); FeignDeath(false); events.PopEvent(); events.RescheduleEvent(EVENT_MORPH_TO_UNDEAD, 3000); break; case EVENT_MORPH_TO_UNDEAD: me->CastSpell(me, SPELL_INGVAR_TRANSFORM, true); events.PopEvent(); events.RescheduleEvent(EVENT_START_PHASE_2, 1000); break; case EVENT_START_PHASE_2: if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) { c->DespawnOrUnsummon(); summons.DespawnAll(); } events.PopEvent(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); AttackStart(me->GetVictim()); me->GetMotionMaster()->MoveChase(me->GetVictim()); Talk(YELL_AGGRO_2); // schedule Phase 2 abilities events.RescheduleEvent(EVENT_SPELL_ROAR, 15000); events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000); events.RescheduleEvent(EVENT_SPELL_SMASH, 5000); events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000); break; // ABILITIES HERE: case EVENT_UNROOT: me->SetControlled(false, UNIT_STATE_ROOT); me->DisableRotate(false); events.PopEvent(); break; case EVENT_SPELL_ROAR: Talk(EMOTE_ROAR); me->_AddCreatureSpellCooldown(SPELL_STAGGERING_ROAR, 0); me->_AddCreatureSpellCooldown(SPELL_DREADFUL_ROAR, 0); if (me->GetDisplayId() == DISPLAYID_DEFAULT) me->CastSpell((Unit*)NULL, SPELL_STAGGERING_ROAR, false); else me->CastSpell((Unit*)NULL, SPELL_DREADFUL_ROAR, false); events.RepeatEvent(urand(15000,20000)); break; case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE: if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) { events.RepeatEvent(3000); break; } if (me->GetDisplayId() == DISPLAYID_DEFAULT) me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); else me->CastSpell(me->GetVictim(), SPELL_WOE_STRIKE, false); events.RepeatEvent(urand(0,4000)+3000); break; case EVENT_SPELL_SMASH: if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) { events.RepeatEvent(3000); break; } me->SetControlled(true, UNIT_STATE_ROOT); me->DisableRotate(true); me->SendMovementFlagUpdate(); if (me->GetDisplayId() == DISPLAYID_DEFAULT) me->CastSpell((Unit*)NULL, SPELL_SMASH, false); else me->CastSpell((Unit*)NULL, SPELL_DARK_SMASH, false); events.RepeatEvent(urand(9000,11000)); events.RescheduleEvent(EVENT_UNROOT, 3750); break; case EVENT_SPELL_ENRAGE_OR_SHADOW_AXE: if (me->GetDisplayId() == DISPLAYID_DEFAULT) { me->CastSpell(me, SPELL_ENRAGE, false); events.RepeatEvent(10000); } else { me->CastSpell((Unit*)NULL, SPELL_SHADOW_AXE, true); SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); events.RepeatEvent(35000); events.RescheduleEvent(EVENT_AXE_RETURN, 10000); } break; case EVENT_AXE_RETURN: if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) c->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+0.5f); events.PopEvent(); events.RescheduleEvent(EVENT_AXE_PICKUP, 1500); break; case EVENT_AXE_PICKUP: if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) { c->DestroyForNearbyPlayers(); c->DespawnOrUnsummon(); summons.DespawnAll(); } ThrowGUID = 0; SetEquipmentSlots(true); events.PopEvent(); break; } if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) DoMeleeAttackIfReady(); }
void JustDied(Unit* /*killer*/) { Summons.DespawnAll(); if (pInstance) pInstance->SetData(DATA_MURU_EVENT, DONE); }
void Reset() { me->RemoveAurasDueToSpell(SPELL_PERIODIC_SPAWN_SWARMER); me->RemoveAurasDueToSpell(SPELL_PERIODIC_SPAWN_SABOTEUR); summons.DespawnAll(); }
void Reset() { pInstance->SetData(DATA_WYRMBREAKER_EVENT,NOT_STARTED); Summons.DespawnAll(); }
void JustDied(Unit* /*Kill*/) { Summons.DespawnAll(); if (instance) instance->SetData(DATA_LOCKMAW_EVENT, DONE); }
void JustDied() { Summons.DespawnAll(); }
void JustDied(Unit *u) { Summons.DespawnAll(); }
void Reset() override { Initialize(); summons.DespawnAll(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (Phase == 1) { while (uint32 eventId = events.GetEvent()) { switch (eventId) { case EVENT_WASTE: DoSummon(NPC_WASTE, Pos[RAND(0, 3, 6, 9)]); events.RepeatEvent(urand(2000, 5000)); break; case EVENT_ABOMIN: if (nAbomination < 8) { DoSummon(NPC_ABOMINATION, Pos[RAND(1, 4, 7, 10)]); nAbomination++; events.RepeatEvent(20000); } else events.PopEvent(); break; case EVENT_WEAVER: if (nWeaver < 8) { DoSummon(NPC_WEAVER, Pos[RAND(0, 3, 6, 9)]); nWeaver++; events.RepeatEvent(25000); } else events.PopEvent(); break; case EVENT_TRIGGER: if (GameObject* pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) pKTTrigger->SetPhaseMask(2, true); events.PopEvent(); break; case EVENT_PHASE: events.Reset(); DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me); spawns.DespawnAll(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->CastStop(); DoStartMovement(me->getVictim()); events.ScheduleEvent(EVENT_BOLT, urand(5000, 10000)); events.ScheduleEvent(EVENT_NOVA, 15000); events.ScheduleEvent(EVENT_DETONATE, urand(30000, 40000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000, 30000)); events.ScheduleEvent(EVENT_BLAST, urand(60000, 120000)); if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_CHAIN, urand(30000, 60000)); Phase = 2; break; default: events.PopEvent(); break; } } } else { //start phase 3 when we are 45% health if (Phase != 3) { if (HealthBelowPct(45)) { Phase = 3; DoScriptText(SAY_REQUEST_AID, me); //here Lich King should respond to KelThuzad but I don't know which Creature to make talk //so for now just make Kelthuzad says it. DoScriptText(SAY_ANSWER_REQUEST, me); for (uint8 i = 0; i <= 3; ++i) { if (GameObject* pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) { if (pPortal->getLootState() == GO_READY) pPortal->UseDoorOrButton(); } } } } else if (nGuardiansOfIcecrownCount < RAID_MODE(2, 4)) { if (uiGuardiansOfIcecrownTimer <= diff) { // TODO : Add missing text if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)])) pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); ++nGuardiansOfIcecrownCount; uiGuardiansOfIcecrownTimer = 5000; } else uiGuardiansOfIcecrownTimer -= diff; } if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 eventId = events.GetEvent()) { switch (eventId) { case EVENT_BOLT: DoCastVictim(RAID_MODE(SPELL_FROST_BOLT, H_SPELL_FROST_BOLT)); events.RepeatEvent(urand(5000, 10000)); break; case EVENT_NOVA: DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE, H_SPELL_FROST_BOLT_AOE)); events.RepeatEvent(urand(15000, 30000)); break; case EVENT_CHAIN: { uint32 count = urand(1, 3); for (uint8 i = 1; i <= count; i++) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (target && !target->isCharmed() && (chained.find(target->GetGUID()) == chained.end())) { DoCast(target, SPELL_CHAINS_OF_KELTHUZAD); float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(target->GetGUID(), scale)); target->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } if (!chained.empty()) DoScriptText(RAND(SAY_CHAIN_1, SAY_CHAIN_2), me); events.RepeatEvent(urand(100000, 180000)); break; } case EVENT_CHAINED_SPELL: { std::map<uint64, float>::iterator itr; for (itr = chained.begin(); itr != chained.end();) { if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) { if (!player->isCharmed()) { player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; continue; } if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { switch (player->getClass()) { case CLASS_DRUID: if (urand(0, 1)) player->CastSpell(target, SPELL_MOONFIRE, false); else player->CastSpell(me, SPELL_LIFEBLOOM, false); break; case CLASS_HUNTER: player->CastSpell(target, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); break; case CLASS_MAGE: player->CastSpell(target, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); break; case CLASS_WARLOCK: player->CastSpell(target, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); break; case CLASS_WARRIOR: player->CastSpell(target, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); break; case CLASS_PALADIN: if (urand(0, 1)) player->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); else player->CastSpell(me, SPELL_HOLY_SHOCK, false); break; case CLASS_PRIEST: if (urand(0, 1)) player->CastSpell(target, SPELL_VAMPIRIC_TOUCH, false); else player->CastSpell(me, SPELL_RENEW, false); break; case CLASS_SHAMAN: if (urand(0, 1)) player->CastSpell(target, SPELL_EARTH_SHOCK, false); else player->CastSpell(me, SPELL_HEALING_WAVE, false); break; case CLASS_ROGUE: player->CastSpell(target, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); break; case CLASS_DEATH_KNIGHT: if (urand(0, 1)) player->CastSpell(target, SPELL_PLAGUE_STRIKE, true); else player->CastSpell(target, SPELL_HOWLING_BLAST, true); break; } } } ++itr; } if (chained.empty()) events.PopEvent(); else events.RepeatEvent(5000); break; } case EVENT_DETONATE: { std::vector<Unit*> unitList; std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA && (*itr)->getTarget()->GetPower(POWER_MANA)) unitList.push_back((*itr)->getTarget()); } if (!unitList.empty()) { std::vector<Unit*>::const_iterator itr = unitList.begin(); advance(itr, rand()%unitList.size()); DoCast(*itr, SPELL_MANA_DETONATION); DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2, SAY_SPECIAL_3), me); } events.RepeatEvent(urand(20000, 50000)); break; } case EVENT_FISSURE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_FISURE); events.RepeatEvent(urand(10000, 45000)); break; case EVENT_BLAST: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true)) DoCast(target, SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, me); events.RepeatEvent(urand(30000, 90000)); break; default: events.PopEvent(); break; } } DoMeleeAttackIfReady(); } }
void UpdateAI(uint32 Diff) override { if (AttackStartTimer <= Diff) { switch (Phase) { case 1: instance->SetBossState(BOSS_RAZORSCALE, IN_PROGRESS); summons.DespawnAll(); AttackStartTimer = 1000; Phase = 2; break; case 2: for (uint8 n = 0; n < RAID_MODE(2, 4); n++) { if (Creature* summonedEngineer = me->SummonCreature(NPC_ENGINEER, PosEngSpawn, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) { summonedEngineer->SetWalk(false); summonedEngineer->SetSpeedRate(MOVE_RUN, 0.5f); summonedEngineer->SetHomePosition(PosEngRepair[n]); summonedEngineer->GetMotionMaster()->MoveTargetedHome(); Engineer[n] = summonedEngineer->GetGUID(); } } if (Creature* firstSummon = ObjectAccessor::GetCreature(*me, Engineer[0])) firstSummon->AI()->Talk(SAY_AGGRO_3); Phase = 3; AttackStartTimer = 14000; break; case 3: for (uint8 n = 0; n < 4; n++) { if (Creature* summonedDefender = me->SummonCreature(NPC_DEFENDER, PosDefSpawn[n], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000)) { summonedDefender->SetWalk(false); summonedDefender->SetHomePosition(PosDefCombat[n]); summonedDefender->GetMotionMaster()->MoveTargetedHome(); Defender[n] = summonedDefender->GetGUID(); } } Phase = 4; break; case 4: for (uint8 n = 0; n < RAID_MODE(2, 4); n++) if (Creature* summonedEngineer = ObjectAccessor::GetCreature(*me, Engineer[n])) summonedEngineer->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); for (uint8 n = 0; n < 4; ++n) if (Creature* summonedDefender = ObjectAccessor::GetCreature(*me, Defender[n])) summonedDefender->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); Talk(SAY_AGGRO_2); AttackStartTimer = 16000; Phase = 5; break; case 5: if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance->GetGuidData(BOSS_RAZORSCALE))) { Razorscale->AI()->DoAction(ACTION_EVENT_START); me->SetInCombatWith(Razorscale); } if (Creature* firstEngineer = ObjectAccessor::GetCreature(*me, Engineer[0])) firstEngineer->AI()->Talk(SAY_AGGRO_1); Phase = 6; break; } } else AttackStartTimer -= Diff; }
void DespawnAllImp() { summons.DespawnAll(); }
void JustDied(Unit* /*killer*/) override { Summons.DespawnAll(); instance->SetBossState(DATA_MURU, DONE); }
void JustDied(Unit* killer) { _JustDied(); summons.DespawnAll(); }
void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); summons.DespawnAll(); }
void JustDied(Unit* /*killer*/) { summons.DespawnAll(); }
void Reset() { events.Reset(); summons.DespawnAll(); lTarget = 0; }
void EnterEvadeMode() { summons.DespawnAll(); ScriptedAI::EnterEvadeMode(); }
void JustDied(Unit*) { summons.DespawnAll(); }
void JustDied(Unit* /*Killer*/) { Summons.DespawnAll(); }
void JustDied(Unit* /*pKiller*/) { Summons.DespawnAll(); DoScriptText(SAY_DEATH, me); if (m_pInstance) m_pInstance->SetData(TYPE_ANUBARAK, DONE); }
void DespawnWaterElements() { m_waterElements.DespawnAll(); }
void Reset() override { Initialize(); Striders.DespawnAll(); }