void DamageTaken(Unit* who, uint32& /*damage*/) { if (Creature* Helper = ObjectAccessor::GetCreature(*me, targetGUID)) { Helper->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED); if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) { if (!Hodir->isInCombat()) { Hodir->SetReactState(REACT_AGGRESSIVE); Hodir->AI()->DoZoneInCombat(); Hodir->AI()->AttackStart(who); } Helper->AI()->AttackStart(Hodir); } } }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; /*START ACID-AI*/ if (uiTrashTimer <= uiDiff) { if (bCheckChances()) DoCast(me, SPELL_TRASH); uiTrashTimer = urand(6000, 15500); } else uiTrashTimer -= uiDiff; if (uiSlamTimer <= uiDiff) { if (bCheckChances()) DoCast(me->getVictim(), SPELL_SMITE_SLAM); uiSlamTimer = 11000; } else uiSlamTimer -= uiDiff; if (uiNimbleReflexesTimer <= uiDiff) { if (bCheckChances()) DoCast(me, SPELL_NIMBLE_REFLEXES); uiNimbleReflexesTimer = urand(27300, 60100); } else uiNimbleReflexesTimer -= uiDiff; /*END ACID-AI*/ if ((uiHealth == 0 && !HealthAbovePct(66)) || (uiHealth == 1 && !HealthAbovePct(33))) { ++uiHealth; DoCastAOE(SPELL_SMITE_STOMP, false); SetCombatMovement(false); if (instance) if (GameObject* go = GameObject::GetGameObject((*me), instance->GetData64(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ()); } } if (uiPhase) { if (uiTimer <= uiDiff) { switch (uiPhase) { case 1: me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? uiTimer = 1000; uiPhase = 2; break; case 2: if (uiHealth == 1) SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); else SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); uiTimer = 500; uiPhase = 3; break; case 3: SetCombatMovement(true); me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); uiPhase = 0; break; } } else uiTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (currentPhase == PHASE_NONE) return; if (SummonTimer <= diff) { if (currentPhase<5&¤tPhase >= 0) { Creature* pNext = NULL; switch (currentPhase) { case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; default: break; } if (pNext) { pNext->RemoveAurasDueToSpell(SPELL_FREEZE); pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); pNext->SetStandState(UNIT_STAND_STATE_STAND); pNext->SetInCombatWithZone(); pNext->Attack(pNext->SelectNearestTarget(100), true); } currentPhase = PHASE_NONE; } } else SummonTimer -= diff; }
void UpdateAI(const uint32 uiDiff) { if (!bDone && GrandChampionsOutVehicle(me)) { bDone = true; if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); if (pInstance) pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); EnterEvadeMode(); bHome = true; } if (uiPhaseTimer <= uiDiff) { if (uiPhase == 1) { AggroAllPlayers(me); uiPhase = 0; } }else uiPhaseTimer -= uiDiff; if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) return; if (uiLightningArrowsTimer <= uiDiff) { DoCastAOE(SPELL_LIGHTNING_ARROWS, false); uiLightningArrowsTimer = 7000; } else uiLightningArrowsTimer -= uiDiff; if (uiShootTimer <= uiDiff) { if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f)) { uiTargetGUID = target->GetGUID(); DoCast(target, SPELL_SHOOT); } uiShootTimer = 12000; uiMultiShotTimer = 3000; bShoot = true; } else uiShootTimer -= uiDiff; if (bShoot && uiMultiShotTimer <= uiDiff) { me->InterruptNonMeleeSpells(true); Unit* target = Unit::GetUnit(*me, uiTargetGUID); if (target && me->IsInRange(target, 5.0f, 30.0f, false)) { DoCast(target, SPELL_MULTI_SHOT); } else { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* player = itr->getSource(); if (player && !player->isGameMaster() && me->IsInRange(player, 5.0f, 30.0f, false)) { DoCast(target, SPELL_MULTI_SHOT); break; } } } } bShoot = false; } else uiMultiShotTimer -= uiDiff; DoMeleeAttackIfReady(); }
void WaypointReached(uint32 i) { if (!pInstance) return; switch(i) { case 8: SetRun(false); me->SummonCreature(18764,2181.87f,112.46f,89.45f,0.26f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 9: DoScriptText(SAY_TH_ARMORY, me); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL); //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL); //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO); //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038); break; case 10: me->SetDisplayId(THRALL_MODEL_EQUIPPED); break; case 11: SetRun(); break; case 15: me->SummonCreature(MOB_ENTRY_RIFLE,2200.28f,137.37f,87.93f,5.07f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_WARDEN,2197.44f,131.83f,87.93f,0.78f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2203.62f,135.40f,87.93f,3.70f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2200.75f,130.13f,87.93f,1.48f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 21: me->SummonCreature(MOB_ENTRY_RIFLE,2135.80f,154.01f,67.45f,4.98f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_WARDEN,2144.36f,151.87f,67.74f,4.46f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2142.12f,154.41f,67.12f,4.56f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2138.08f,155.38f,67.24f,4.60f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 25: me->SummonCreature(MOB_ENTRY_RIFLE,2102.98f,192.17f,65.24f,6.02f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_WARDEN,2108.48f,198.75f,65.18f,5.15f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2106.11f,197.29f,65.18f,5.63f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_VETERAN,2104.18f,194.82f,65.18f,5.75f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 29: DoScriptText(SAY_TH_SKARLOC_MEET, me); me->SummonCreature(ENTRY_SCARLOC,2036.48f,271.22f,63.43f,5.27f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); //temporary,skarloc should rather be triggered to walk up to thrall break; case 30: SetEscortPaused(true); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); SetRun(false); break; case 31: DoScriptText(SAY_TH_MOUNTS_UP, me); DoMount(); SetRun(); break; case 37: //possibly regular patrollers? If so, remove this and let database handle them me->SummonCreature(MOB_ENTRY_WATCHMAN,2124.26f,522.16f,56.87f,3.99f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_WATCHMAN,2121.69f,525.37f,57.11f,4.01f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_SENTRY,2124.65f,524.55f,56.63f,3.98f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 59: me->SummonCreature(SKARLOC_MOUNT,2488.64f,625.77f,58.26f,4.71f,TEMPSUMMON_TIMED_DESPAWN,10000); DoUnmount(); HadMount = false; SetRun(false); break; case 60: me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); //make horsie run off SetEscortPaused(true); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); pInstance->SetData(TYPE_THRALL_PART2, DONE); SetRun(); break; case 64: SetRun(false); break; case 68: me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22f,692.60f,55.50f,2.84f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT,2500.13f,696.55f,55.51f,3.38f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.55f,693.64f,55.50f,3.14f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94f,695.81f,55.50f,3.14f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 71: SetRun(); break; case 81: SetRun(false); break; case 83: me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33f,646.82f,56.03f,4.28f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT,2624.14f,648.03f,56.03f,4.50f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2625.32f,649.60f,56.03f,4.38f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2627.22f,649.00f,56.03f,4.34f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); break; case 84: DoScriptText(SAY_TH_CHURCH_END, me); SetRun(); break; case 91: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); SetRun(false); break; case 93: me->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71f,660.31f,61.93f,1.67f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96f,662.59f,61.93f,0.79f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2657.36f,662.34f,61.93f,2.68f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39f,659.77f,61.93f,2.61f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); break; case 94: if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) { if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) DoScriptText(SAY_TA_ESCAPED, Taretha, me); } break; case 95: DoScriptText(SAY_TH_MEET_TARETHA, me); pInstance->SetData(TYPE_THRALL_PART3,DONE); SetEscortPaused(true); break; case 96: DoScriptText(SAY_TH_EPOCH_WONDER, me); break; case 97: DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me); SetRun(); break; case 98: //trigger epoch Yell("Thrall! Come outside and face your fate! ....") //from here, thrall should not never be allowed to move to point 106 which he currently does. break; case 106: { //trigger taretha to run down outside if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) { if (Player* pPlayer = GetPlayerForEscort()) CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); } //kill credit Creature for quest Map* pMap = me->GetMap(); Map::PlayerList const& players = pMap->GetPlayers(); if (!players.isEmpty() && pMap->IsDungeon()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { if (Player* pPlayer = itr->getSource()) pPlayer->KilledMonsterCredit(20156, 0); } } //alot will happen here, thrall and taretha talk, erozion appear at spot to explain me->SummonCreature(EROZION_ENTRY,2646.47f,680.416f,55.38f,4.16f,TEMPSUMMON_TIMED_DESPAWN,120000); } break; case 108: //last waypoint, just set Thrall invisible, respawn is turned off me->SetVisible(false); break; } }
void UpdateAI(const uint32 diff) { if (IntroStepCounter < 9) { if (IntroYellTimer <= diff) { IntroYellTimer = IntroStep(++IntroStepCounter); } else IntroYellTimer -= diff; } if (!SisterDeath) { if (pInstance) { Unit* Temp = NULL; Temp = Unit::GetUnit((*me), pInstance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isDead()) { DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; } } } if (!me->getVictim()) { if (pInstance) { Creature* sisiter = Unit::GetCreature((*me), pInstance->GetData64(DATA_SACROLASH)); if (sisiter && !sisiter->isDead() && sisiter->getVictim()) { me->AddThreat(sisiter->getVictim(), 0.0f); DoStartNoMovement(sisiter->getVictim()); me->Attack(sisiter->getVictim(), false); } } } if (!UpdateVictim()) return; if (SisterDeath) { if (ShadownovaTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_SHADOW_NOVA); ShadownovaTimer = 30000 + (rand() % 5000); } } else ShadownovaTimer -= diff; } else { if (ConflagrationTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_CONFLAGRATION); ConflagrationTimer = 30000 + (rand() % 5000); if (!SisterDeath) { if (pTarget) DoScriptText(EMOTE_CONFLAGRATION, me, pTarget); DoScriptText(YELL_CANFLAGRATION, me); } BlazeTimer = 4000; } } else ConflagrationTimer -= diff; } if (FlamesearTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, SPELL_FLAME_SEAR); FlamesearTimer = 15000; } } else FlamesearTimer -= diff; if (PyrogenicsTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, SPELL_PYROGENICS, true); PyrogenicsTimer = 15000; } } else PyrogenicsTimer -= diff; if (BlazeTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me->getVictim(), SPELL_BLAZE); BlazeTimer = 3800; } } else BlazeTimer -= diff; if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); DoScriptText(YELL_BERSERK, me); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; }
void UpdateAI(const uint32 uiDiff) { if (!bDone && GrandChampionsOutVehicle(me)) { bDone = true; if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); if (pInstance) pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); EnterEvadeMode(); bHome = true; } if (uiPhaseTimer <= uiDiff) { if (uiPhase == 1) { AggroAllPlayers(me); uiPhase = 0; } }else uiPhaseTimer -= uiDiff; if (uiFireBallTimer <= uiDiff) { if (me->getVictim()) DoCastVictim(SPELL_FIREBALL); uiFireBallTimer = 5000; } else uiFireBallTimer -= uiDiff; if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) return; if (uiFireBallTimer <= uiDiff) { DoCastVictim(SPELL_FIREBALL); uiFireBallTimer = 5000; } else uiFireBallTimer -= uiDiff; if (uiPolymorphTimer <= uiDiff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_POLYMORPH); uiPolymorphTimer = 8000; } else uiPolymorphTimer -= uiDiff; if (uiBlastWaveTimer <= uiDiff) { DoCastAOE(SPELL_BLAST_WAVE, false); uiBlastWaveTimer = 13000; } else uiBlastWaveTimer -= uiDiff; if (uiHasteTimer <= uiDiff) { me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_HASTE); uiHasteTimer = 22000; } else uiHasteTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { AttackStart(target); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (instance && !instance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } if (!me->HasAura(SPELL_WINDFURY_WEAPON)) { DoCast(me, SPELL_WINDFURY_WEAPON); } //FrostShock_Timer if (FrostShock_Timer <= diff) { DoCast(me->getVictim(), SPELL_FROST_SHOCK); FrostShock_Timer = 25000+rand()%5000; } else FrostShock_Timer -= diff; //Spitfire_Timer if (Spitfire_Timer <= diff) { DoCast(me, SPELL_SPITFIRE_TOTEM); Unit* SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM); if (SpitfireTotem) { CAST_CRE(SpitfireTotem)->AI()->AttackStart(me->getVictim()); } Spitfire_Timer = 60000; } else Spitfire_Timer -= diff; //PoisonCleansing_Timer if (PoisonCleansing_Timer <= diff) { DoCast(me, SPELL_POISON_CLEANSING_TOTEM); PoisonCleansing_Timer = 30000; } else PoisonCleansing_Timer -= diff; //Earthbind_Timer if (Earthbind_Timer <= diff) { DoCast(me, SPELL_EARTHBIND_TOTEM); Earthbind_Timer = 45000; } else Earthbind_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { AttackStart(target); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (instance && !instance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } //WaterBoltVolley_Timer if (WaterBoltVolley_Timer <= diff) { DoCast(me->getVictim(), SPELL_WATER_BOLT_VOLLEY); WaterBoltVolley_Timer = 30000; } else WaterBoltVolley_Timer -= diff; //TidalSurge_Timer if (TidalSurge_Timer <= diff) { DoCast(me->getVictim(), SPELL_TIDAL_SURGE); // Hacky way to do it - won't trigger elseways me->getVictim()->CastSpell(me->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true); TidalSurge_Timer = 15000+rand()%5000; } else TidalSurge_Timer -= diff; //Cyclone_Timer if (Cyclone_Timer <= diff) { //DoCast(me, SPELL_SUMMON_CYCLONE); // Doesn't work Cyclone_Timer = 30000+rand()%10000; Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); if (Cyclone) { CAST_CRE(Cyclone)->SetObjectScale(3.0f); Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Cyclone->setFaction(me->getFaction()); Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { Cyclone->AI()->AttackStart(target); } } } else Cyclone_Timer -= diff; //Heal_Timer if (Heal_Timer <= diff) { // It can be cast on any of the mobs Unit* unit = NULL; while (unit == NULL || !unit->isAlive()) { unit = selectAdvisorUnit(); } if (unit && unit->isAlive()) DoCast(unit, SPELL_HEAL); Heal_Timer = 60000; } else Heal_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { AttackStart(target); GetAdvisors(); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (instance && !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) { DoCast(me->getVictim(), SPELL_SEAR_NOVA); SearNova_Timer = 20000+rand()%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; Creature* Advisor; for (uint8 i = 0; i < MAX_ADVISORS; ++i) if (Advisors[i]) { Advisor = (Unit::GetCreature(*me, Advisors[i])); if (Advisor && Advisor->isAlive()) { continueTriggering = true; break; } } if (continueTriggering) { DoCast(me, SPELL_BLESSING_OF_THE_TIDES); me->MonsterYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES); } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT)) { Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (target) { AttackStart(target); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (instance && !instance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } //LeechingThrow_Timer if (LeechingThrow_Timer <= diff) { DoCast(me->getVictim(), SPELL_LEECHING_THROW); LeechingThrow_Timer = 20000; } else LeechingThrow_Timer -= diff; //Multishot_Timer if (Multishot_Timer <= diff) { DoCast(me->getVictim(), SPELL_MULTISHOT); Multishot_Timer = 20000; } else Multishot_Timer -= diff; //TheBeastWithin_Timer if (TheBeastWithin_Timer <= diff) { DoCast(me, SPELL_THE_BEAST_WITHIN); Creature* Pet = Unit::GetCreature(*me, SummonedPet); if (Pet && Pet->isAlive()) { Pet->CastSpell(Pet, SPELL_PET_ENRAGE, true); } TheBeastWithin_Timer = 30000; } else TheBeastWithin_Timer -= diff; //Pet_Timer if (Pet_Timer < diff && pet == false) { pet = true; //uint32 spell_id; uint32 pet_id; if (!urand(0, 1)) { //spell_id = SPELL_SUMMON_FATHOM_LURKER; pet_id = CREATURE_FATHOM_LURKER; } else { //spell_id = SPELL_SUMMON_FATHOM_SPOREBAT; pet_id = CREATURE_FATHOM_SPOREBAT; } //DoCast(me, spell_id, true); Creature* Pet = DoSpawnCreature(pet_id, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (Pet && target) { Pet->AI()->AttackStart(target); SummonedPet = Pet->GetGUID(); } } else Pet_Timer -= diff; DoMeleeAttackIfReady(); }
void JustDied(Unit* /*unit*/) { if (pInstance) if (Creature* portal = ObjectAccessor::GetCreature((*me), pInstance->GetData64(DATA_TELEPORTATION_PORTAL_GUID))) CAST_AI(npc_vh_teleportation_portal::npc_vh_teleportation_portalAI, portal->AI())->SummonedMobDied(me); }
void ClearDoorSealAura() { if (pInstance) if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DOOR_SEAL_GUID))) c->RemoveAura(SPELL_DESTROY_DOOR_SEAL, me->GetGUID()); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; switch (Phase) { case 0: { // *Heroic mode only: if (IsHeroic()) { if (PyroblastTimer <= diff) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(me, SPELL_SHOCK_BARRIER, true); DoCast(me->getVictim(), SPELL_PYROBLAST); PyroblastTimer = 60000; } else PyroblastTimer -= diff; } if (FireballTimer <= diff) { DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); FireballTimer = urand(2000, 6000); } else FireballTimer -= diff; if (PhoenixTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); uint8 random = urand(1, 2); float x = KaelLocations[random][0]; float y = KaelLocations[random][1]; Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); if (Phoenix) { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); Phoenix->AI()->AttackStart(target); } DoScriptText(SAY_PHOENIX, me); PhoenixTimer = 60000; } else PhoenixTimer -= diff; if (FlameStrikeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { me->InterruptSpell(CURRENT_CHANNELED_SPELL); me->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(target, SPELL_FLAMESTRIKE3, true); DoScriptText(SAY_FLAMESTRIKE, me); } FlameStrikeTimer = urand(15000, 25000); } else FlameStrikeTimer -= diff; // Below 50% if (HealthBelowPct(50)) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); me->StopMoving(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); GravityLapseTimer = 0; GravityLapsePhase = 0; Phase = 1; } DoMeleeAttackIfReady(); } break; case 1: { if (GravityLapseTimer <= diff) { switch (GravityLapsePhase) { case 0: if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { DoScriptText(SAY_GRAVITY_LAPSE, me); FirstGravityLapse = false; if (instance) { instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_LEFT), true); instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_RIGHT), true); } } else { DoScriptText(SAY_RECAST_GRAVITY, me); } DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; break; case 1: TeleportPlayersToSelf(); GravityLapseTimer = 1000; GravityLapsePhase = 2; break; case 2: CastGravityLapseKnockUp(); GravityLapseTimer = 1000; GravityLapsePhase = 3; break; case 3: CastGravityLapseFly(); GravityLapseTimer = 30000; GravityLapsePhase = 4; for (uint8 i = 0; i < 3; ++i) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if (Orb && target) { Orb->SetSpeed(MOVE_RUN, 0.5f); Orb->AddThreat(target, 1000000.0f); Orb->AI()->AttackStart(target); } } DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); break; case 4: me->InterruptNonMeleeSpells(false); DoScriptText(SAY_TIRED, me); DoCast(me, SPELL_POWER_FEEDBACK); RemoveGravityLapse(); GravityLapseTimer = 10000; GravityLapsePhase = 0; break; } } else GravityLapseTimer -= diff; } break; } }
void UpdateAI(uint32 diff) { events2.Update(diff); switch (events2.ExecuteEvent()) { case EVENT_SVALA_START: Talk(TALK_INTRO_S1); events2.ScheduleEvent(EVENT_SVALA_TALK1, 8000); break; case EVENT_SVALA_TALK1: if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) Arthas->AI()->Talk(TALK_INTRO_A1); events2.ScheduleEvent(EVENT_SVALA_TALK2, 9000); break; case EVENT_SVALA_TALK2: if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) Arthas->CastSpell(me, SPELL_ARTHAS_TRANSFORMING_SVALA, false); me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, true); events2.ScheduleEvent(EVENT_SVALA_TALK3, 3000); break; case EVENT_SVALA_TALK3: me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); me->SetHover(true); me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); events2.ScheduleEvent(30, 1000); events2.ScheduleEvent(EVENT_SVALA_TALK4, 9000); break; case 30: { WorldPacket data(SMSG_SPLINE_MOVE_SET_HOVER, 9); data.append(me->GetPackGUID()); me->SendMessageToSet(&data, false); break; } case EVENT_SVALA_TALK4: { me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, true); me->UpdateEntry(NPC_SVALA_SORROWGRAVE); me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) Arthas->InterruptNonMeleeSpells(false); me->RemoveAllAuras(); me->SetWalk(false); events2.ScheduleEvent(EVENT_SVALA_TALK5, 2000); std::list<Creature*> creatureList; me->GetCreaturesWithEntryInRange(creatureList, 100.0f, NPC_DRAGONFLAYER_SPECTATOR); for (std::list<Creature*>::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) (*itr)->AI()->SetData(1, 2); break; } case EVENT_SVALA_TALK5: Talk(TALK_INTRO_S2); events2.ScheduleEvent(EVENT_SVALA_TALK6, 12000); break; case EVENT_SVALA_TALK6: if (Creature *Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) Arthas->AI()->Talk(TALK_INTRO_A2); events2.ScheduleEvent(EVENT_SVALA_TALK7, 9000); break; case EVENT_SVALA_TALK7: me->SetFacingTo(M_PI/2.0f); Talk(TALK_INTRO_S3); if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR))) mirror->SetGoState(GO_STATE_ACTIVE); events2.ScheduleEvent(EVENT_SVALA_TALK8, 13000); break; case EVENT_SVALA_TALK8: me->GetMotionMaster()->MoveFall(0, true); events2.ScheduleEvent(EVENT_SVALA_TALK9, 2000); break; case EVENT_SVALA_TALK9: me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); me->LoadEquipment(1, true); me->setActive(false); if (Player* target = SelectTargetFromPlayerList(100.0f)) AttackStart(target); return; } if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.ExecuteEvent()) { case EVENT_SORROWGRAVE_SS: me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SINSTER_STRIKE_H : SPELL_SINSTER_STRIKE_N, false); events.ScheduleEvent(EVENT_SORROWGRAVE_SS, urand(3000, 5000)); break; case EVENT_SORROWGRAVE_FLAMES: summons.DespawnAll(); me->CastSpell(me, SPELL_CALL_FLAMES, false); events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 500); events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 1000); events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, urand(8000, 12000)); break; case EVENT_SORROWGRAVE_FLAMES2: { std::list<Creature*> braziers; me->GetCreaturesWithEntryInRange(braziers, 100.0f, NPC_FLAME_BRAZIER); if (!braziers.empty()) { for (std::list<Creature*>::const_iterator itr = braziers.begin(); itr != braziers.end(); ++itr) (*itr)->CastCustomSpell(SPELL_BALL_OF_FLAME, SPELLVALUE_MAX_TARGETS, 1, (*itr), true); } break; } case EVENT_SORROWGRAVE_RITUAL: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { Talk(SAY_SACRIFICE_PLAYER); for (uint8 i = 0; i < 3; ++i) if (Creature* cr = me->SummonCreature(NPC_RITUAL_CHANNELER, RitualChannelerLoc[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) cr->AI()->AttackStart(target); me->GetMotionMaster()->MoveIdle(); DoTeleportPlayer(target, 296.632f, -346.075f, 90.63f, 4.6f); me->NearTeleportTo(296.632f, -346.075f, 110.0f, 4.6f, false); me->SetControlled(true, UNIT_STATE_ROOT); me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE); me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } events.DelayEvents(25001); // +1 just to be sure events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL_SPELLS, 0); events.ScheduleEvent(EVENT_SORROWGRAVE_FINISH_RITUAL, 25000); return; case EVENT_SORROWGRAVE_RITUAL_SPELLS: //me->CastSpell(me, SPELL_RITUAL_OF_THE_SWORD, false); me->CastSpell(me, SPELL_RITUAL_STRIKE, true); return; case EVENT_SORROWGRAVE_FINISH_RITUAL: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetControlled(false, UNIT_STATE_ROOT); AttackStart(me->GetVictim()); me->GetMotionMaster()->MoveFall(0, true); summons.DespawnAll(); break; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (ghost) { if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } if (!UpdateVictim()) return; if (AggroYell_Timer) { if (AggroYell_Timer <= diff) { Talk(YELL_DALRONN_AGGRO); AggroYell_Timer = 0; } else AggroYell_Timer -= diff; } if (!ghost) { if (Check_Timer) { if (Check_Timer <= diff) { Check_Timer = 5000; Unit* skarvald = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SKARVALD) : 0); if (skarvald && skarvald->isDead()) { Skarvald_isDead = true; Response_Timer = 2000; Check_Timer = 0; } } else Check_Timer -= diff; } if (Response_Timer && Skarvald_isDead) { if (Response_Timer <= diff) { Talk(YELL_DALRONN_SKA_DIEDFIRST); Response_Timer = 0; } else Response_Timer -= diff; } } if (ShadowBolt_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells } } else ShadowBolt_Timer -= diff; if (Debilitate_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); Debilitate_Timer = 5000+rand()%5000; } } else Debilitate_Timer -= diff; if (IsHeroic()) { if (Summon_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, H_SPELL_SUMMON_SKELETONS); Summon_Timer = (rand()%10000) + 20000; } } else Summon_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!SisterDeath) { if (pInstance) { Unit* Temp = NULL; Temp = Unit::GetUnit((*me), pInstance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; } } } if (!UpdateVictim()) return; if (SisterDeath) { if (ConflagrationTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_CONFLAGRATION); ConflagrationTimer = 30000 + (rand() % 5000); } } else ConflagrationTimer -= diff; } else { if (ShadownovaTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_SHADOW_NOVA); if (!SisterDeath) { if (pTarget) DoScriptText(EMOTE_SHADOW_NOVA, me, pTarget); DoScriptText(YELL_SHADOW_NOVA, me); } ShadownovaTimer = 30000 + (rand() % 5000); } } else ShadownovaTimer -= diff; } if (ConfoundingblowTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) DoCast(pTarget, SPELL_CONFOUNDING_BLOW); ConfoundingblowTimer = 20000 + (rand() % 5000); } } else ConfoundingblowTimer -= diff; if (ShadowimageTimer <= diff) { Unit *pTarget = NULL; Creature* temp = NULL; for (uint8 i = 0; i < 3; ++i) { pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); temp = DoSpawnCreature(MOB_SHADOW_IMAGE, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 10000); if (temp && pTarget) { temp->AddThreat(pTarget, 1000000); //don't change target(healers) temp->AI()->AttackStart(pTarget); } } ShadowimageTimer = 20000; } else ShadowimageTimer -= diff; if (ShadowbladesTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { DoCast(me, SPELL_SHADOW_BLADES); ShadowbladesTimer = 10000; } } else ShadowbladesTimer -= diff; if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); DoScriptText(YELL_ENRAGE, me); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) { //If we are within range melee the target if (me->IsWithinMeleeRange(me->getVictim())) { HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED); me->AttackerStateUpdate(me->getVictim()); me->resetAttackTimer(); } } }
bool CheckPlayerOnTransport() { Transport * pTransport = NULL; if (!pInstance) return false; if (IsFriendlyCommander) return false; // Le commandant ami ne doit pas check les joueurs sur le transport pTransport = GetTransportByGUID(me, pInstance->GetData64(DATA_GUNSHIP_TRANSPORT_SECOND)); if (!pTransport) return false; std::set<Player*> pSet = pTransport->GetPassengers(); if(pSet.empty()) // Stop l'attaque si personne sur le transport { if (me->isInCombat()) EnterEvadeMode(); return false; } bool checkPassed = true; if (!me->isInCombat()) // Débute l'attaque si un joueur arrive sur le transport { checkPassed = false; } else { if (Unit * victim = me->getVictim()) { if (victim->GetTypeId() != TYPEID_PLAYER) { checkPassed = false; } else if (victim->GetTransport()) { if (victim->GetTransport()->GetGUID() != pInstance->GetData64(DATA_GUNSHIP_TRANSPORT_SECOND)) checkPassed = false; if (victim->GetVehicle()) checkPassed = false; if (!victim->isAlive()) checkPassed = false; } else checkPassed = false; } else checkPassed = false; } if (!checkPassed) { Player * pPassenger = MistCore::Containers::SelectRandomContainerElement(pSet); if (!pPassenger) if (me->isInCombat()) EnterEvadeMode(); if(!pPassenger->IsHostileTo(me)) if (me->isInCombat()) EnterEvadeMode(); me->CombatStop(); AttackStart(pPassenger); return false; } return true; }
void UpdateAI(const uint32 uiDiff) { if (!bDone && GrandChampionsOutVehicle(me)) { bDone = true; if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); EnterEvadeMode(); bHome = true; } if (uiPhaseTimer <= uiDiff) { if (uiPhase == 1) { AggroAllPlayers(me); uiPhase = 0; } }else uiPhaseTimer -= uiDiff; if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) return; if (uiInterceptTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) { for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* player = itr->getSource(); if (player && !player->isGameMaster() && me->IsInRange(player, 8.0f, 25.0f, false)) { DoResetThreat(); me->AddThreat(player, 5.0f); DoCast(player, SPELL_INTERCEPT); break; } } } uiInterceptTimer = 7000; } else uiInterceptTimer -= uiDiff; if (uiBladeStormTimer <= uiDiff) { DoCastVictim(SPELL_BLADESTORM); uiBladeStormTimer = urand(15000, 20000); } else uiBladeStormTimer -= uiDiff; if (uiMortalStrikeTimer <= uiDiff) { DoCastVictim(SPELL_MORTAL_STRIKE); uiMortalStrikeTimer = urand(8000, 12000); } else uiMortalStrikeTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { switch (Phase) { case COMBAT: //Return since we have no target if (!UpdateVictim()) return; if (!bYelled && HealthBelowPct(30)) { Talk(SAY_30HEALTH); bYelled = true; } if (!bYelled2 && HealthBelowPct(15)) { Talk(SAY_15HEALTH); bYelled2 = true; } if (HealthBelowPct(1)) { //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); uiOutroStep = 1; Phase = OUTRO; return; } if (Creature* pArthas = me->GetCreature(*me, instance ? instance->GetData64(DATA_ARTHAS) : 0)) if (pArthas->isDead()) { EnterEvadeMode(); me->DisappearAndDie(); if (instance) instance->SetData(DATA_MAL_GANIS_EVENT, FAIL); } if (uiCarrionSwarmTimer < diff) { DoCastVictim(SPELL_CARRION_SWARM); uiCarrionSwarmTimer = 7000; } else uiCarrionSwarmTimer -= diff; if (uiMindBlastTimer < diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_MIND_BLAST); uiMindBlastTimer = 6000; } else uiMindBlastTimer -= diff; if (uiVampiricTouchTimer < diff) { DoCast(me, SPELL_VAMPIRIC_TOUCH); uiVampiricTouchTimer = 32000; } else uiVampiricTouchTimer -= diff; if (uiSleepTimer < diff) { Talk(SAY_SLEEP); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_SLEEP); uiSleepTimer = urand(15000, 20000); } else uiSleepTimer -= diff; DoMeleeAttackIfReady(); break; case OUTRO: if (uiOutroTimer < diff) { switch (uiOutroStep) { case 1: Talk(SAY_ESCAPE_SPEECH_1); me->GetMotionMaster()->MoveTargetedHome(); ++uiOutroStep; uiOutroTimer = 8000; break; case 2: me->SetTarget(instance ? instance->GetData64(DATA_ARTHAS) : 0); me->HandleEmoteCommand(29); Talk(SAY_ESCAPE_SPEECH_2); ++uiOutroStep; uiOutroTimer = 9000; break; case 3: Talk(SAY_OUTRO); ++uiOutroStep; uiOutroTimer = 16000; break; case 4: me->HandleEmoteCommand(33); ++uiOutroStep; uiOutroTimer = 500; break; case 5: me->SetVisible(false); me->Kill(me); break; } } else uiOutroTimer -= diff; break; } }
void UpdateAI(const uint32 uiDiff) { if (!bDone && GrandChampionsOutVehicle(me)) { bDone = true; if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); if (pInstance) pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); EnterEvadeMode(); bHome = true; } if (uiPhaseTimer <= uiDiff) { if (uiPhase == 1) { AggroAllPlayers(me); uiPhase = 0; } }else uiPhaseTimer -= uiDiff; if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) return; if (uiChainLightningTimer <= uiDiff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); uiChainLightningTimer = 16000; } else uiChainLightningTimer -= uiDiff; if (uiHealingWaveTimer <= uiDiff) { bool bChance = urand(0, 1); if (!bChance) { if (Unit* pFriend = DoSelectLowestHpFriendly(40)) DoCast(pFriend, SPELL_HEALING_WAVE); } else DoCast(me, SPELL_HEALING_WAVE); uiHealingWaveTimer = 12000; } else uiHealingWaveTimer -= uiDiff; if (uiEartShieldTimer <= uiDiff) { DoCast(me, SPELL_EARTH_SHIELD); uiEartShieldTimer = urand(30000, 35000); } else uiEartShieldTimer -= uiDiff; if (uiHexMendingTimer <= uiDiff) { DoCastVictim(SPELL_HEX_OF_MENDING, true); uiHexMendingTimer = urand(20000, 25000); } else uiHexMendingTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); if (pTarget) { AttackStart(pTarget); GetCouncil(); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } //ArcingSmash_Timer if (ArcingSmash_Timer <= diff) { DoCast(me->getVictim(), SPELL_ARCING_SMASH); ArcingSmash_Timer = 10000; } else ArcingSmash_Timer -= diff; //Whirlwind_Timer if (Whirlwind_Timer <= diff) { DoCast(me->getVictim(), SPELL_WHIRLWIND); Whirlwind_Timer = 55000; } else Whirlwind_Timer -= diff; //MightyBlow_Timer if (MightyBlow_Timer <= diff) { DoCast(me->getVictim(), SPELL_MIGHTY_BLOW); MightyBlow_Timer = 30000+rand()%10000; } else MightyBlow_Timer -= diff; //Entering Phase 2 if (!Phase2 && HealthBelowPct(50)) { Phase2 = true; DoScriptText(SAY_ENRAGE, me); DoCast(me, SPELL_DUAL_WIELD, true); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); } if (Phase2) { //Charging_Timer if (Charging_Timer <= diff) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) { AttackStart(pTarget); DoCast(pTarget, SPELL_BERSERKER_C); } Charging_Timer = 20000; } else Charging_Timer -= diff; //Intimidating Roar if (Roar_Timer <= diff) { DoCast(me, SPELL_ROAR); Roar_Timer = 40000+(rand()%10000); } else Roar_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const Diff) { if (AttackStartTimer <= Diff) { switch (Phase) { case 1: instance->SetBossState(BOSS_RAZORSCALE, IN_PROGRESS); summons.clear(); AttackStartTimer = 1000; Phase = 2; break; case 2: for (uint8 n = 0; n < RAID_MODE(2, 4); n++) { Engineer[n] = me->SummonCreature(NPC_ENGINEER, PosEngSpawn, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); Engineer[n]->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); Engineer[n]->SetSpeed(MOVE_RUN, 0.5f); Engineer[n]->SetHomePosition(PosEngRepair[n]); Engineer[n]->GetMotionMaster()->MoveTargetedHome(); } Engineer[0]->MonsterYell(SAY_AGGRO_3, LANG_UNIVERSAL, 0); Phase = 3; AttackStartTimer = 14000; break; case 3: for (uint8 n = 0; n < 4; n++) { Defender[n] = me->SummonCreature(NPC_DEFENDER, PosDefSpawn[n], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); Defender[n]->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); Defender[n]->SetHomePosition(PosDefCombat[n]); Defender[n]->GetMotionMaster()->MoveTargetedHome(); } Phase = 4; break; case 4: for (uint8 n = 0; n < RAID_MODE(2, 4); n++) Engineer[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); for (uint8 n = 0; n < 4; ++n) Defender[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); me->MonsterYell(SAY_AGGRO_2, LANG_UNIVERSAL, 0); AttackStartTimer = 16000; Phase = 5; break; case 5: if (Creature* Razorscale = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_RAZORSCALE) : 0)) { Razorscale->AI()->DoAction(ACTION_EVENT_START); me->SetInCombatWith(Razorscale); } Engineer[0]->MonsterYell(SAY_AGGRO_1, LANG_UNIVERSAL, 0); Phase = 6; break; } } else AttackStartTimer -= Diff; }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); if (pTarget) { AttackStart(pTarget); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } //GreaterFireball_Timer if (GreaterFireball_Timer < diff || me->IsWithinDist(me->getVictim(), 30)) { DoCast(me->getVictim(), SPELL_GREATER_FIREBALL); GreaterFireball_Timer = 2000; } else GreaterFireball_Timer -= diff; //SpellShield_Timer if (SpellShield_Timer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me->getVictim(), SPELL_SPELLSHIELD); SpellShield_Timer = 30000; } else SpellShield_Timer -= diff; //BlastWave_Timer if (BlastWave_Timer <= diff) { Unit *pTarget = NULL; std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); std::vector<Unit *> target_list; for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); //15 yard radius minimum if (pTarget && pTarget->IsWithinDist(me, 15, false)) target_list.push_back(pTarget); pTarget = NULL; } if (target_list.size()) pTarget = *(target_list.begin()+rand()%target_list.size()); me->InterruptNonMeleeSpells(false); DoCast(pTarget, SPELL_BLAST_WAVE); BlastWave_Timer = 60000; } else BlastWave_Timer -= diff; }
void UpdateAI(const uint32 diff) { events.Update(diff); switch(events.ExecuteEvent()) { case EVENT_START_INTRO: me->GetMotionMaster()->MovePoint(0, MoveThronePos); // Begining of intro is differents between factions as the speech sequence and timers are differents. if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) events.ScheduleEvent(EVENT_INTRO_A2_1, 0); else events.ScheduleEvent(EVENT_INTRO_H2_1, 0); break; // A2 Intro Events case EVENT_INTRO_A2_1: DoScriptText(SAY_JAINA_INTRO_3, me); events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); break; case EVENT_INTRO_A2_2: DoScriptText(SAY_JAINA_INTRO_4, me); events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); break; case EVENT_INTRO_A2_3: // TODO: she's doing some kind of spell casting emote pInstance->HandleGameObject(pInstance->GetData64(DATA_FROSTMOURNE), true); events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); break; case EVENT_INTRO_A2_4: // spawn UTHER during speach 2 if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) { pUther->GetMotionMaster()->MoveIdle(); pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas uiUther = pUther->GetGUID(); } events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); break; case EVENT_INTRO_A2_5: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_1, pUther); events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); break; case EVENT_INTRO_A2_6: DoScriptText(SAY_JAINA_INTRO_5, me); events.ScheduleEvent(EVENT_INTRO_A2_7, 6000); break; case EVENT_INTRO_A2_7: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_2, pUther); events.ScheduleEvent(EVENT_INTRO_A2_8, 6500); break; case EVENT_INTRO_A2_8: DoScriptText(SAY_JAINA_INTRO_6, me); events.ScheduleEvent(EVENT_INTRO_A2_9, 2000); break; case EVENT_INTRO_A2_9: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_3, pUther); events.ScheduleEvent(EVENT_INTRO_A2_10, 9000); break; case EVENT_INTRO_A2_10: DoScriptText(SAY_JAINA_INTRO_7, me); events.ScheduleEvent(EVENT_INTRO_A2_11, 5000); break; case EVENT_INTRO_A2_11: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_4, pUther); events.ScheduleEvent(EVENT_INTRO_A2_12, 11000); break; case EVENT_INTRO_A2_12: DoScriptText(SAY_JAINA_INTRO_8, me); events.ScheduleEvent(EVENT_INTRO_A2_13, 4000); break; case EVENT_INTRO_A2_13: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_5, pUther); events.ScheduleEvent(EVENT_INTRO_A2_14, 12500); break; case EVENT_INTRO_A2_14: DoScriptText(SAY_JAINA_INTRO_9, me); events.ScheduleEvent(EVENT_INTRO_A2_15, 10000); break; case EVENT_INTRO_A2_15: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_6, pUther); events.ScheduleEvent(EVENT_INTRO_A2_16, 22000); break; case EVENT_INTRO_A2_16: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_A2_7, pUther); events.ScheduleEvent(EVENT_INTRO_A2_17, 4000); break; case EVENT_INTRO_A2_17: DoScriptText(SAY_JAINA_INTRO_10, me); events.ScheduleEvent(EVENT_INTRO_A2_18, 2000); break; case EVENT_INTRO_A2_18: if (Creature* pUther = me->GetCreature(*me, uiUther)) { pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); DoScriptText(SAY_UTHER_INTRO_A2_8, pUther); } events.ScheduleEvent(EVENT_INTRO_A2_19, 11000); break; case EVENT_INTRO_A2_19: DoScriptText(SAY_JAINA_INTRO_11, me); events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); break; // H2 Intro Events case EVENT_INTRO_H2_1: DoScriptText(SAY_SYLVANAS_INTRO_1, me); events.ScheduleEvent(EVENT_INTRO_H2_2, 8000); break; case EVENT_INTRO_H2_2: DoScriptText(SAY_SYLVANAS_INTRO_2, me); events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); break; case EVENT_INTRO_H2_3: DoScriptText(SAY_SYLVANAS_INTRO_3, me); // TODO: she's doing some kind of spell casting emote events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); break; case EVENT_INTRO_H2_4: // spawn UTHER during speach 2 if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) { pUther->GetMotionMaster()->MoveIdle(); pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas uiUther = pUther->GetGUID(); } events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); break; case EVENT_INTRO_H2_5: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_H2_1, pUther); events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); break; case EVENT_INTRO_H2_6: DoScriptText(SAY_SYLVANAS_INTRO_4, me); events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); break; case EVENT_INTRO_H2_7: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_H2_2, pUther); events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); break; case EVENT_INTRO_H2_8: DoScriptText(SAY_SYLVANAS_INTRO_5, me); events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); break; case EVENT_INTRO_H2_9: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_H2_3, pUther); events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); break; case EVENT_INTRO_H2_10: DoScriptText(SAY_SYLVANAS_INTRO_6, me); events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); break; case EVENT_INTRO_H2_11: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_H2_4, pUther); events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); break; case EVENT_INTRO_H2_12: DoScriptText(SAY_SYLVANAS_INTRO_7, me); events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); break; case EVENT_INTRO_H2_13: if (Creature* pUther = me->GetCreature(*me, uiUther)) { pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); DoScriptText(SAY_UTHER_INTRO_H2_5, pUther); } events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); break; case EVENT_INTRO_H2_14: if (Creature* pUther = me->GetCreature(*me, uiUther)) DoScriptText(SAY_UTHER_INTRO_H2_6, pUther); events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); break; case EVENT_INTRO_H2_15: DoScriptText(SAY_SYLVANAS_INTRO_8, me); events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); break; // Remaining Intro Events common for both faction case EVENT_INTRO_LK_1: // Spawn LK in front of door, and make him move to the sword. if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) { pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos); pLichKing->SetReactState(REACT_PASSIVE); uiLichKing = pLichKing->GetGUID(); } if (Creature* pUther = me->GetCreature(*me, uiUther)) { if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) DoScriptText(SAY_UTHER_INTRO_A2_9, pUther); else DoScriptText(SAY_UTHER_INTRO_H2_7, pUther); } events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); break; case EVENT_INTRO_LK_2: if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) DoScriptText(SAY_LK_INTRO_1, pLichKing); events.ScheduleEvent(EVENT_INTRO_LK_3, 2000); break; case EVENT_INTRO_LK_3: // The Lich King banishes Uther to the abyss. if (Creature* pUther = me->GetCreature(*me, uiUther)) { pUther->DisappearAndDie(); uiUther = 0; } // He steps forward and removes the runeblade from the heap of skulls. events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); break; case EVENT_INTRO_LK_4: if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) DoScriptText(SAY_LK_INTRO_2, pLichKing); events.ScheduleEvent(EVENT_INTRO_LK_5, 10000); break; case EVENT_INTRO_LK_5: // summon Falric and Marwyn. then go back to the door if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) pFalric->SetVisible(true); if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) pMarwyn->SetVisible(true); if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) { pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); DoScriptText(SAY_LK_INTRO_3, pLichKing); } events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); break; case EVENT_INTRO_LK_6: if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) DoScriptText(SAY_FALRIC_INTRO_1, pFalric); events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); break; case EVENT_INTRO_LK_7: if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn); events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); break; case EVENT_INTRO_LK_8: if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) DoScriptText(SAY_FALRIC_INTRO_2, pFalric); events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); break; case EVENT_INTRO_LK_9: if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) DoScriptText(SAY_JAINA_INTRO_END, me); else DoScriptText(SAY_SYLVANAS_INTRO_END, me); me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); // TODO: Loralen/Koreln shall run also events.ScheduleEvent(EVENT_INTRO_END, 10000); break; case EVENT_INTRO_END: if (pInstance) pInstance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave // Loralen or Koreln disappearAndDie() me->DisappearAndDie(); break; case EVENT_SKIP_INTRO: // TODO: implement if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) pFalric->SetVisible(true); if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) pMarwyn->SetVisible(true); me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); // TODO: Loralen/Koreln shall run also events.ScheduleEvent(EVENT_INTRO_END, 15000); break; } }
void switchFactionIfAlive(InstanceScript* instance, uint32 entry) { if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry))) if (crew->isAlive()) crew->setFaction(FACTION_HOSTILE); }
void JustDied(Unit* /*who*/) { if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); }
void UpdateAI(const uint32 diff) { if (currentEvent != TYPE_NARALEX_PART3) npc_escortAI::UpdateAI(diff); if (!instance) return; if (eventTimer <= diff) { eventTimer = 0; if (instance->GetData(currentEvent) == IN_PROGRESS) { switch (currentEvent) { case TYPE_NARALEX_PART1: if (eventProgress == 1) { ++eventProgress; DoScriptText(SAY_TEMPLE_OF_PROMISE, me); me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763f, 227.874f, -93.3233f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); } break; case TYPE_NARALEX_PART2: if (eventProgress == 1) { ++eventProgress; DoScriptText(SAY_BANISH_THE_SPIRITS, me); DoCast(me, SPELL_SERPENTINE_CLEANSING); //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); eventTimer = 30000; me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261f, 273.676f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658f, 280.799f, -92.8393f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); me->SummonCreature(NPC_DEVIATE_VIPER, -50.002f, 278.578f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); } else if (eventProgress == 2) { //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true); DoScriptText(SAY_CAVERNS_PURIFIED, me); instance->SetData(TYPE_NARALEX_PART2, DONE); if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) me->RemoveAura(SPELL_SERPENTINE_CLEANSING); } break; case TYPE_NARALEX_PART3: if (eventProgress == 1) { ++eventProgress; eventTimer = 4000; me->SetStandState(UNIT_STAND_STATE_KNEEL); DoScriptText(SAY_EMERALD_DREAM, me); } else if (eventProgress == 2) { ++eventProgress; eventTimer = 15000; //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); DoScriptText(EMOTE_AWAKENING_RITUAL, me); } else if (eventProgress == 3) { ++eventProgress; eventTimer = 15000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) DoScriptText(EMOTE_TROUBLED_SLEEP, naralex); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007f, 227.428f, -97.421f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); } else if (eventProgress == 4) { ++eventProgress; eventTimer = 30000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372f, 235.149f, -102.826f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524f, 251.113f, -102.558f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208f, 266.466f, -102.977f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167f, 274.759f, -102.962f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); } else if (eventProgress == 5) { ++eventProgress; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) DoScriptText(EMOTE_HORRENDOUS_VISION, naralex); me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); DoScriptText(SAY_MUTANUS_THE_DEVOURER, me); instance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); } else if (eventProgress == 6 && instance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) { ++eventProgress; eventTimer = 3000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) { AchievementEntry const* AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); if (AchievWC) { Map* map = me->GetMap(); if (map && map->IsDungeon()) { Map::PlayerList const &players = map->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) itr->getSource()->CompletedAchievement(AchievWC); } } if (me->HasAura(SPELL_NARALEXS_AWAKENING)) me->RemoveAura(SPELL_NARALEXS_AWAKENING); naralex->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_I_AM_AWAKE, naralex); } DoScriptText(SAY_NARALEX_AWAKES, me); } else if (eventProgress == 7) { ++eventProgress; eventTimer = 6000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) DoScriptText(SAY_THANK_YOU, naralex); } else if (eventProgress == 8) { ++eventProgress; eventTimer = 8000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) { DoScriptText(SAY_FAREWELL, naralex); naralex->AddAura(SPELL_FLIGHT_FORM, naralex); } SetRun(); me->SetStandState(UNIT_STAND_STATE_STAND); me->AddAura(SPELL_FLIGHT_FORM, me); } else if (eventProgress == 9) { ++eventProgress; eventTimer = 1500; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); } else if (eventProgress == 10) { ++eventProgress; eventTimer = 2500; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) { naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f); naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f); } me->GetMotionMaster()->MovePoint(26, 117.095512f, 247.107971f, -96.167870f); me->GetMotionMaster()->MovePoint(27, 144.375443f, 281.045837f, -82.477135f); } else if (eventProgress == 11) { if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) naralex->SetVisible(false); me->SetVisible(false); instance->SetData(TYPE_NARALEX_PART3, DONE); } break; } } } else eventTimer -= diff; }
void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) return; if (id > 4) return; Creature* pNext = NULL; switch (id) { case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; default: break; } if (pNext) DoCast(pNext, SPELL_ORB_CHANNEL, false); currentPhase = (Phase)id; SummonTimer = 5000; }
void IsSummonedBy(Unit* summoner) { targetGUID = summoner->GetGUID(); me->SetInCombatWith(summoner); me->AddThreat(summoner, 250.0f); if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID)) { DoCast(target, SPELL_BLOCK_OF_ICE, true); // Prevents to have Ice Block on other place than target is me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation()); if (target->GetTypeId() == TYPEID_PLAYER) if (Creature* Hodir = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(BOSS_HODIR) : 0)) Hodir->AI()->DoAction(ACTION_CHEESE_THE_FREEZE); } }