void JustDied(Unit* /*Killer*/) { Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID); Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID); if (!pLeftHead || !pRightHead) return; DoScriptText(YELL_DIE_L, pLeftHead); CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell(); if (instance) instance->SetData(TYPE_OMROGG, DONE); }
void JustDied(Unit* /*killer*/) { Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID); Creature* pRightHead = Creature::GetCreature(*me, RightHeadGUID); if (!pLeftHead || !pRightHead) return; pLeftHead->AI()->Talk(YELL_DIE_L); CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell(); if (instance) instance->SetData(TYPE_OMROGG, DONE); }
void MoveInLineOfSight(Unit* who) { ScriptedAI::MoveInLineOfSight(who); if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) { if (Unit* owner = who->GetOwner()) { if (owner->GetTypeId() == TYPEID_PLAYER) { if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) CAST_CRE(who)->CastSpell(owner, 52517, true); //Todo: Creatures must not be removed, but, must instead // stand next to Gothik and be commanded into the pit // and dig into the ground. CAST_CRE(who)->DespawnOrUnsummon(); if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) owner->RemoveAllMinionsByEntry(GHOULS); } } } }
void PassengerBoarded(Unit* who, int8 seatId, bool apply) { if (!me->GetVehicle()) return; if (seatId == SEAT_PLAYER) { if (!apply) return; else DoScriptText(SAY_PLAYER_RIDING,me); if (Creature* pTurret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) { pTurret->setFaction(me->GetVehicleBase()->getFaction()); pTurret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable pTurret->AI()->AttackStart(who); } if (Unit* pDevice = CAST_CRE(vehicle->GetPassenger(SEAT_DEVICE))) { pDevice->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); pDevice->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } //else //throw passenger bugged, when fixed uncomment this part. // if (seatId == SEAT_TURRET) // { // if (apply) // return; // if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) // { // device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); // device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable // } // } }
void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply) { if (who->GetTypeId() == TYPEID_UNIT) { if (who->GetEntry() == 32933) left = apply; else if (who->GetEntry() == 32934) right = apply; if (!apply && instance) instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); CAST_CRE(who)->SetReactState(REACT_PASSIVE); } }
void Reset() { Charge_Timer = 5000; StoneStrike_Timer = 10000; Dalronn_isDead = false; Check_Timer = 5000; ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); if (!ghost && instance) { Unit* dalronn = Unit::GetUnit((*me), instance->GetData64(DATA_DALRONN)); if (dalronn && dalronn->isDead()) CAST_CRE(dalronn)->Respawn(); instance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); } }
void JustDied(Unit* pKiller) { if (pKiller->GetTypeId() == TYPEID_PLAYER) { CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, CAST_PLR(pKiller)); CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, CAST_PLR(pKiller)); } for (uint8 i = 0; i < 2; ++i) DoCast(pKiller, SPELL_JORMUNGAR_SPAWN, true); if (m_creature->isSummon()) if (Creature* pSummoner = CAST_CRE(CAST_SUM(m_creature)->GetSummoner())) if (npc_gurgthockAI* pAI = CAST_AI(npc_gurgthockAI,pSummoner->AI())) pAI->bEventInProgress = false; }
void MovementInform(uint32 uiType, uint32 /*uiId*/) { if (uiType != POINT_MOTION_TYPE) return; if (me->isSummon()) { if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) { if (npc_lord_gregor_lescovarAI* pAI = CAST_AI(npc_lord_gregor_lescovarAI,pSummoner->AI())) { pAI->uiTimer = 2000; pAI->uiPhase = 5; } //me->ChangeOrient(0.0f, pSummoner); } } }
void JustDied(Unit* /*Killer*/) { if (LeftHead && RightHead) { Unit* Left = Unit::GetUnit(*me,LeftHead); Unit* Right = Unit::GetUnit(*me,RightHead); if (!Left || !Right) return; DoScriptText(YELL_DIE_L, Left); ((mob_omrogg_headsAI*)CAST_CRE(Right)->AI())->DoDeathYell(); } if (pInstance) pInstance->SetData(TYPE_WARBRINGER, DONE); }
void Reset() { ShadowBolt_Timer = 1000; Debilitate_Timer = 5000; Summon_Timer = 10000; Check_Timer = 5000; Skarvald_isDead = false; AggroYell_Timer = 0; ghost = me->GetEntry() == MOB_DALRONN_GHOST; if (!ghost && pInstance) { Unit* skarvald = Unit::GetUnit((*me), pInstance->GetData64(DATA_SKARVALD)); if (skarvald && skarvald->isDead()) CAST_CRE(skarvald)->Respawn(); pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); } }
void EnterCombat(Unit* /*who*/) { if (pInstance) pInstance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS); DoZoneInCombat(); me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(me, SOUND_YELL_AGGRO); for (uint8 i = 0; i < 4; ++i) { Unit* Temp = Unit::GetUnit((*me), AddGUID[i]); if (Temp && Temp->isAlive()) CAST_CRE(Temp)->AI()->AttackStart(me->getVictim()); else { EnterEvadeMode(); break; } } }
void Reset() { if (instance) { //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { //Unit* unit = Unit::GetUnit(*me, FelCrystals[i]); Unit* unit = Unit::GetUnit(*me, *itr); if (unit) { if (!unit->isAlive()) CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc. // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) // Small door opened after event are expected to be closed by default // Set Inst data for encounter instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); } else sLog->outError(ERROR_INST_DATA); DrainLifeTimer = urand(3000, 7000); DrainManaTimer = DrainLifeTimer + 5000; FelExplosionTimer = 2100; if (IsHeroic()) DrainCrystalTimer = urand(10000, 15000); else DrainCrystalTimer = urand(20000, 25000); EmpowerTimer = 10000; IsDraining = false; DrainingCrystal = false; CrystalGUID = 0; }
void MoveInLineOfSight(Unit *who) { ScriptedAI::MoveInLineOfSight(who); if (who->GetEntry() == NPC_DRAKOS && me->IsWithinDistInMap(who, 10.0f)) { if (Unit *owner = who->GetOwner()) { if (owner->GetTypeId() == TYPEID_PLAYER) { if ((CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS1) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS2) == QUEST_STATUS_INCOMPLETE)) { CAST_PLR(owner)->KilledMonsterCredit(NPC_DRAKOS, me->GetGUID()); } CAST_CRE(who)->ForcedDespawn(); if ((CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS1) == QUEST_STATUS_COMPLETE) && (CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS2) == QUEST_STATUS_INCOMPLETE)) owner->RemoveAllMinionsByEntry(NPC_DRAKOS); } } } }
void Reset() { if (pInstance) { //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); Unit* pUnit = Unit::GetUnit(*me, *itr); if (pUnit) { if (!pUnit->isAlive()) CAST_CRE(pUnit)->Respawn(); // Let MaNGOS handle setting death state, etc. // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } GameObject* Door = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR)); if (Door) Door->SetGoState(GO_STATE_ACTIVE); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) // Small door opened after event are expected to be closed by default // Set Inst data for encounter if (me->isDead()) pInstance->SetData(DATA_SELIN_EVENT, DONE); else pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); } else error_log(ERROR_INST_DATA); DrainLifeTimer = 3000 + rand()%4000; DrainManaTimer = DrainLifeTimer + 5000; FelExplosionTimer = 2100; DrainCrystalTimer = 10000 + rand()%5000; DrainCrystalTimer = 20000 + rand()%5000; CheckTimer = 1000; IsDraining = false; DrainingCrystal = false; CrystalGUID = 0; }
bool ItemUse_item_yehkinyas_bramble(Player* player, Item* _Item, SpellCastTargets const& targets) { if (player->GetQuestStatus(3520) == QUEST_STATUS_INCOMPLETE) { Unit* unit_target = targets.getUnitTarget(); if (unit_target && unit_target->GetTypeId() == TYPEID_UNIT && unit_target->isDead() && // cast only on corpse 5307 or 5308 (unit_target->GetEntry() == 5307 || unit_target->GetEntry() == 5308)) { CAST_CRE(unit_target)->RemoveCorpse(); // remove corpse for cancelling second use return false; // all ok } } WorldPacket data(SMSG_CAST_FAILED, (4 + 2)); // prepare packet error message data << uint32(10699); // itemId data << uint8(SPELL_FAILED_BAD_TARGETS); // reason player->GetSession()->SendPacket(&data); // send message: Bad target player->SendEquipError(EQUIP_ERR_NONE, _Item, NULL); // break spell return true; }
void Reset() { Enraged = false; if (pInstance) { Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); if (Temp) { if (Temp->isDead()) { CAST_CRE(Temp)->Respawn(); } else { if (Temp->getVictim()) { me->getThreatManager().addThreat(Temp->getVictim(),0.0f); } } } } if (!me->isInCombat()) { ConflagrationTimer = 45000; BlazeTimer = 100; PyrogenicsTimer = 15000; ShadownovaTimer = 40000; EnrageTimer = 360000; FlamesearTimer = 15000; IntroYellTimer = 10000; SisterDeath = false; } if (pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); }
void Reset() { InCombat = false; Enraged = false; if(pInstance) { Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); if (Temp) if (Temp->isDead()) { CAST_CRE(Temp)->Respawn(); }else { if(Temp->getVictim()) { me->getThreatManager().addThreat(Temp->getVictim(),0.0f); InCombat = true; } } } if(!InCombat) { ShadowbladesTimer = 10000; ShadownovaTimer = 30000; ConfoundingblowTimer = 25000; ShadowimageTimer = 20000; ConflagrationTimer = 30000; EnrageTimer = 360000; SisterDeath = false; } if(pInstance) pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (Event) SayTimer = NextStep(++Step); } else SayTimer -= diff; if (Attack) { Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); me->SetFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (pPlayer) { Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { Creepjack->Attack(pPlayer, true); Creepjack->SetFaction(14); Creepjack->GetMotionMaster()->MoveChase(pPlayer); Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { Malone->Attack(pPlayer, true); Malone->SetFaction(14); Malone->GetMotionMaster()->MoveChase(pPlayer); Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } DoStartMovement(pPlayer); AttackStart(pPlayer); } Attack = false; } if ((me->GetHealth() * 100) / me->GetMaxHealth() < 15 && !Done) { Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); Creepjack->SetFaction(1194); Creepjack->GetMotionMaster()->MoveTargetedHome(); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { CAST_CRE(Malone)->AI()->EnterEvadeMode(); Malone->SetFaction(1194); Malone->GetMotionMaster()->MoveTargetedHome(); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFaction(1194); Done = true; DoScriptText(SAY_GIVEUP, me, NULL); me->DeleteThreatList(); me->CombatStop(); me->GetMotionMaster()->MoveTargetedHome(); Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) player->GroupEventHappens(QUEST_WBI, me); reset_timer = 30000; } if (Done == true && reset_timer <= diff) { Reset(); } else reset_timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (pTarget) { AttackStart(pTarget); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->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() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (pTarget) { AttackStart(pTarget); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->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)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Cyclone->setFaction(me->getFaction()); Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) { Cyclone->AI()->AttackStart(pTarget); } } } else Cyclone_Timer -= diff; //Heal_Timer if (Heal_Timer <= diff) { // It can be cast on any of the mobs Unit *pUnit = NULL; while (pUnit == NULL || !pUnit->isAlive()) { pUnit = selectAdvisorUnit(); } if (pUnit && pUnit->isAlive()) DoCast(pUnit, SPELL_HEAL); Heal_Timer = 60000; } else Heal_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI (const uint32 diff) { //Random movement if (movement_timer <= diff) { uint32 rndpos = rand()%8; me->GetMotionMaster()->MovePoint(1, SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); movement_timer = 6000; } else movement_timer -= diff; //toxic spores if (bolt_timer <= diff) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); if (trig) { trig->setFaction(14); trig->CastSpell(trig, SPELL_TOXIC_SPORES, true); } } bolt_timer = 10000+rand()%5000; } else bolt_timer -= diff; //Check_Timer if (Check_Timer <= diff) { if (instance) { //check if vashj is death Unit* Vashj = NULL; Vashj = Unit::GetUnit((*me), instance->GetData64(DATA_LADYVASHJ)); if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashj::boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) { //remove me->setDeathState(DEAD); me->RemoveCorpse(); me->setFaction(35); } } Check_Timer = 1000; } else Check_Timer -= diff; }
void KilledUnit(Unit* who) { Unit* pMalchezaar = Unit::GetUnit(*me, malchezaar); if (pMalchezaar) CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); }
void JustDied(Unit*) { if (Creature* Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100)) ((boss_nexusprince_shaffarAI*)(CAST_CRE(Shaffar)->AI()))->RemoveBeaconFromList(me); }
bool OnQuestAccept(Player* plr, GameObject* go, Quest const* quest) { if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) { if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) { Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378, -8034.535f, 1535.14f, 2.61f, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379, -8032.767f, 1533.148f, 2.61f, 1.5f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380, -8034.52f, 1537.843f, 2.61f, 5.7f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382, -8028.462f, 1535.843f, 2.61f, 3.141592f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381, -8028.75f, 1538.795f, 2.61f, 4, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000); if (Merithra) { Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15420); Merithra->setFaction(35); } if (Caelestrasz) { Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15419); Caelestrasz->setFaction(35); } if (Arygos) { Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15418); Arygos->setFaction(35); } if (Anachronos) { CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID(); CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = plr->GetGUID(); CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; } } } return true; }
uint32 NextStep(uint32 Step) { Unit* arca = Unit::GetUnit(*me, ArcanagosGUID); Map* map = me->GetMap(); switch (Step) { case 0: return 9999999; case 1: me->MonsterYell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL, 0); return 10000; case 2: if (arca) CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL, 0); return 20000; case 3: me->MonsterYell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL, 0); return 10000; case 4: if (arca) CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, 0); return 20000; case 5: me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, 0); return 20000; case 6: if (arca) CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, 0); return 10000; case 7: FireArcanagosTimer = 500; return 5000; case 8: FireMedivhTimer = 500; DoCast(me, SPELL_MANA_SHIELD); return 10000; case 9: me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); return 10000; case 10: if (arca) DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); return 1000; case 11: if (arca) CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, 0); return 5000; case 12: arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f); arca->setActive(true); arca->InterruptNonMeleeSpells(true); arca->SetSpeed(MOVE_FLIGHT, 2.0f); return 10000; case 13: me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, 0); return 10000; case 14: me->SetVisible(false); me->ClearInCombat(); if (map->IsDungeon()) { InstanceMap::PlayerList const &PlayerList = map->GetPlayers(); for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive()) { if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) i->getSource()->CompleteQuest(9645); } } } return 50000; case 15: arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return 5000; default : return 9999999; } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->HasUnitState(UNIT_STAT_CASTING)) return; if (Spell_FrostBreath_Timer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_FROST_BREATH); Spell_FrostBreath_Timer = urand(15000, 16500); } else Spell_FrostBreath_Timer -=diff; if (Spell_WingBuffet_Timer <= diff) { DoCast(me, SPELL_WING_BUFFET); Spell_WingBuffet_Timer = urand(4000, 6500); } else Spell_WingBuffet_Timer -= diff; if (!Pasajero_1 && (me->GetHealth() < me->GetMaxHealth() * 0.70)) { if (Creature *Bombardier1 = CAST_CRE(vehicle->GetPassenger(BOMBARDIER_1))) { Bombardier1->ExitVehicle(); Bombardier1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Bombardier1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Bombardier1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); Bombardier1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } Pasajero_1 = true; } if (!Pasajero_2 && (me->GetHealth() < me->GetMaxHealth() * 0.50)) { if (Creature *Bombardier2 = CAST_CRE(vehicle->GetPassenger(BOMBARDIER_2))) { Bombardier2->ExitVehicle(); Bombardier2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Bombardier2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Bombardier2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); Bombardier2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } Pasajero_2 = true; } if (!Pasajero_3 && (me->GetHealth() < me->GetMaxHealth() * 0.25)) { if (Creature *Bombardier3 = CAST_CRE(vehicle->GetPassenger(BOMBARDIER_3))) { Bombardier3->ExitVehicle(); Bombardier3->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Bombardier3->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Bombardier3->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); Bombardier3->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } Pasajero_3 = true; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->hasUnitState(UNIT_STAT_CASTING)) return; if (events.GetTimer() > 15000 && !IsInRange()) DoCastAOE(SPELL_PETRIFY_BREATH, true); if (!left && !right) DoCast(me, SPELL_STONE_SHOUT, true); switch(events.GetEvent()) { case EVENT_NONE: break; case EVENT_SMASH: if (left && right) if (me->IsWithinMeleeRange(me->getVictim())) DoCastVictim(SPELL_TWO_ARM_SMASH, true); else if(left || right) if (me->IsWithinMeleeRange(me->getVictim())) DoCastVictim(SPELL_ONE_ARM_SMASH, true); events.RescheduleEvent(EVENT_SMASH, 15000); break; case EVENT_SWEEP: if (left) DoCastAOE(SPELL_ARM_SWEEP, true); events.RescheduleEvent(EVENT_SWEEP, 15000); break; case EVENT_GRIP: if (right) { me->MonsterTextEmote(EMOTE_STONE, 0, true); DoScriptText(SAY_GRAB_PLAYER, me); for (uint32 n = 0; n < (uint32)RAID_MODE(1, 3); ++n) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) GripTargetGUID[n] = pTarget->GetGUID(); } if (pInstance) { if (Creature* RightArm = CAST_CRE(vehicle->GetPassenger(1))) if (RightArm->AI()) RightArm->AI()->DoAction(ACTION_GRIP); } } events.RescheduleEvent(EVENT_GRIP, 40000); break; case EVENT_SHOCKWAVE: if (left) { DoScriptText(SAY_SHOCKWAVE, me); DoCastAOE(SPELL_SHOCKWAVE, true); DoCastAOE(SPELL_SHOCKWAVE_VISUAL, true); } events.RescheduleEvent(EVENT_SHOCKWAVE, urand(15000, 25000)); break; case EVENT_EYEBEAM: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { if (EyeBeam[0] = me->SummonCreature(NPC_EYEBEAM_1, pTarget->GetPositionX(), pTarget->GetPositionY() + 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) { EyeBeam[0]->CastSpell(me, SPELL_EYEBEAM_VISUAL_1, true); EyeBeam[0]->AI()->AttackStart(pTarget); } if (EyeBeam[1] = me->SummonCreature(NPC_EYEBEAM_2, pTarget->GetPositionX(), pTarget->GetPositionY() - 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) { EyeBeam[1]->CastSpell(me, SPELL_EYEBEAM_VISUAL_2, true); EyeBeam[1]->AI()->AttackStart(pTarget); } } events.RescheduleEvent(EVENT_EYEBEAM, 20000); break; case EVENT_LEFT: if (Creature* LeftArm = me->SummonCreature(NPC_LEFT_ARM, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) { LeftArm->EnterVehicle(vehicle, 0); DoCast(me, SPELL_ARM_RESPAWN, true); me->MonsterTextEmote(EMOTE_LEFT, 0, true); } events.CancelEvent(EVENT_LEFT); break; case EVENT_RIGHT: if (Creature* RightArm = me->SummonCreature(NPC_RIGHT_ARM, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) { RightArm->EnterVehicle(vehicle, 1); DoCast(me, SPELL_ARM_RESPAWN, true); me->MonsterTextEmote(EMOTE_RIGHT, 0, true); } events.CancelEvent(EVENT_RIGHT); break; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (Event) SayTimer = NextStep(++Step); } else SayTimer -= diff; if (Attack) { Player* player = Unit::GetPlayer(*me, PlayerGUID); me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (player) { Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { Creepjack->Attack(player, true); Creepjack->setFaction(14); Creepjack->GetMotionMaster()->MoveChase(player); Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { Malone->Attack(player, true); Malone->setFaction(14); Malone->GetMotionMaster()->MoveChase(player); Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } DoStartMovement(player); AttackStart(player); } Attack = false; } if (HealthBelowPct(5) && !Done) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveAllAuras(); Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); Creepjack->GetMotionMaster()->MoveTargetedHome(); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { CAST_CRE(Malone)->AI()->EnterEvadeMode(); Malone->setFaction(1194); Malone->GetMotionMaster()->MoveTargetedHome(); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } me->setFaction(1194); Done = true; Talk(SAY_GIVEUP); me->DeleteThreatList(); me->CombatStop(); me->GetMotionMaster()->MoveTargetedHome(); Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player) CAST_PLR(player)->GroupEventHappens(QUEST_WBI, me); } DoMeleeAttackIfReady(); }
bool DoEncounterAction(Unit *who, bool attack, bool reset, bool checkAllDead) { if (!instance) return false; Creature *Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); Creature *Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); Creature *Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); Creature *Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); if (Thane && Lady && Baron && Sir) { if (attack && who) { CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->AttackStart( who); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->AttackStart( who); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->AttackStart( who); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->AttackStart( who); } if (reset) { if (instance->GetBossState(BOSS_HORSEMEN) != NOT_STARTED) { if (!Thane->isAlive()) Thane->Respawn(); if (!Lady->isAlive()) Lady->Respawn(); if (!Baron->isAlive()) Baron->Respawn(); if (!Sir->isAlive()) Sir->Respawn(); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); } } if (checkAllDead) return !Thane->isAlive() && !Lady->isAlive() && !Baron->isAlive() && !Sir->isAlive(); } return false; }