void UpdateAI(const uint32 diff) { if (CheckTimer <= diff) { uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS); Creature* Supremus = (Unit::GetCreature((*me), SupremusGUID)); if (!Eruption && Supremus && !((boss_supremusAI*)Supremus->AI())->Phase1) { Eruption = true; DoCast(me, SPELL_VOLCANIC_ERUPTION); } else if ((Eruption && Supremus && ((boss_supremusAI*)Supremus->AI())->Phase1) || !Supremus) { if (me->HasAura(SPELL_VOLCANIC_ERUPTION, 0)) me->RemoveAura(SPELL_VOLCANIC_ERUPTION, 0); } CheckTimer = 1500; } else CheckTimer -= diff; }
void MovementInform(uint32 uiType, uint32 uiPointId) { if (uiType != POINT_MOTION_TYPE || !pInstance) return; switch(uiPointId) { case 1: { Creature* boss = m_creature->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); if (boss) { CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true; CAST_AI(boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = false; m_creature->Kill(m_creature); } } break; } }
void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiRangeCheck_Timer < uiDiff) { if (m_pInstance) { if (Creature* pXevozz = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_XEVOZZ)))) { float fDistance = m_creature->GetDistance2d(pXevozz); if (fDistance <= 3) DoCast(pXevozz, m_bIsRegularMode ? SPELL_ARCANE_POWER_H : SPELL_ARCANE_POWER); else DoCast(m_creature, 35845); } } m_uiRangeCheck_Timer = 1000; } else m_uiRangeCheck_Timer -= uiDiff; if (m_uiSummonPlayers_Timer < uiDiff) { DoCast(m_creature, SPELL_SUMMON_PLAYERS); // not working right Map* pMap = m_creature->GetMap(); if (pMap && pMap->IsDungeon()) { Map::PlayerList const &PlayerList = pMap->GetPlayers(); if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (i->getSource()->isAlive()) DoTeleportPlayer(i->getSource(), m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), i->getSource()->GetOrientation()); } m_uiSummonPlayers_Timer = urand(33000, 35000); } else m_uiSummonPlayers_Timer -= uiDiff; }
void Aggro(Unit* pWho) { if (!m_pInstance) return; m_creature->InterruptNonMeleeSpells(false); if (Creature* pMagtheridon = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_MAGTHERIDON))) { if (!pMagtheridon->isAlive()) return; if (m_pInstance->GetData(TYPE_CHANNELER_EVENT) == NOT_STARTED) DoScriptText(EMOTE_BEGIN, pMagtheridon); } m_pInstance->SetData(TYPE_CHANNELER_EVENT, IN_PROGRESS); m_creature->SetInCombatWithZone(); }
void UpdateTarget(uint32 diff) { if(ChangeTarget < diff) { DoZoneInCombat(); if(Creature* pTeron = pInstance->GetCreature(pInstance->GetData64(DATA_TERONGOREFIEND))) { if(Unit* pTarget = ((ScriptedAI*)pTeron->AI())->SelectUnit(SELECT_TARGET_RANDOM, 1, 100, true)) AttackStart(pTarget); } if(!UpdateVictim()) { if(Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1, 200, true)) AttackStart(pTarget); } } else ChangeTarget -= diff; }
void WaypointReached(uint32 i) { switch(i) { case 20: SetEscortPaused(true); Finish = true; DoCast(me, SPELL_LICH_KING_CAST); m_pInstance->SetData(TYPE_LICH_KING, SPECIAL); DoScriptText(SAY_LICH_KING_END_DUN, me); if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER)))) { pLider->CastSpell(pLider, SPELL_SILENCE, false); //pLider->RemoveFlag(SPLINEFLAG_WALKING, MOVEMENTFLAG_WALKING); //Questionible pLider->SendMonsterMove(pLider->GetPositionX(), pLider->GetPositionY(), pLider->GetPositionZ() + 4, VICTIMSTATE_NORMAL, pLider->isInCombat(), 3000); } me->setActive(false); break; } }
void WaypointReached(uint32 i) { switch (i) { case 20: SetEscortPaused(true); Finish = true; DoCast(m_creature, SPELL_LICH_KING_CAST); m_pInstance->SetData(TYPE_LICH_KING, SPECIAL); DoScriptText(SAY_LICH_KING_END_DUN, m_creature); if (Creature* pLider = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ESCAPE_LIDER)))) { pLider->CastSpell(pLider, SPELL_SILENCE, false); pLider->AddSplineFlag(SPLINEFLAG_FLYING); pLider->SendMonsterMove(pLider->GetPositionX(), pLider->GetPositionY(), pLider->GetPositionZ() + 4, SPLINETYPE_NORMAL , pLider->GetSplineFlags(), 3000); } m_creature->SetActiveObjectState(false); break; } }
void UpdateAI(const uint32 diff) { if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) { if (me->GetDistance2d(pXT002) <= 0.5) { me->MonsterTextEmote(EMOTE_REPAIR, 0, true); // Increase health with 1 percent pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01); // Disable Nerf Engineering Achievement if (pXT002->AI()) pXT002->AI()->DoAction(ACTION_DISABLE_NERF_ACHI); // Despawns the scrapbot me->ForcedDespawn(); } } }
void UpdateAI(const uint32 diff) { // we're still in the awaken animation if (wakingUp && Awaken_Timer >= 0) { Awaken_Timer -= diff; return; // dont do anything until we are done } else if (wakingUp && Awaken_Timer <= 0) { wakingUp = false; amIAwake = true; AttackStart(me->GetCreature(pInstance->GetData64(0))->getVictim()); return; // dont want to continue until we finish the AttackStart method } //Return since we have no target if (!UpdateVictim()) return; DoMeleeAttackIfReady(); }
void Reset() { AcidSpray_Timer = 10000; PoisonSpawn_Timer = 13000; PoisonBolt_Timer = 7000; checkTimer = 3000; summons.DespawnAll(); prisoners.clear(); if (pInstance) pInstance->SetData(DATA_BROGGOKEVENT, NOT_STARTED); me->SetReactState(REACT_PASSIVE); phase = EVENT_NULL; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); for (int i = 1; i <= 5; i++) pInstance->HandleGameObject(pInstance->GetData64(i), false, NULL); for (int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { if (Creature *pPrisoner = me->SummonCreature(17429, CellLocation[i].x +frand(-2.0, 2.0), CellLocation[i].y +frand(-2.0, 2.0), CellLocation[i].z, CellLocation[i].o, TEMPSUMMON_DEAD_DESPAWN, 2000)) { pPrisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pPrisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pPrisoner->SetReactState(REACT_PASSIVE); pPrisoner->SetDisplayId(16332); summons.Summon(pPrisoner); prisoners[pPrisoner->GetGUID()] = i+1; } } } }
void MoveDown() { if (!pInstance) return; bOpFerokFail = false; pInstance->SetData(DATA_JEDOGA_TRIGGER_SWITCH, 0); m_creature->GetMotionMaster()->MovePoint(1, JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2]); m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); m_creature->SendMonsterMove(JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2], 0, MOVEFLAG_JUMP, 0); m_creature->Relocate(JEDOGA_POS[1][0], JEDOGA_POS[1][1], JEDOGA_POS[1][2], JEDOGA_POS[1][3]); m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, false); m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, false); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); bOnGround = true; if (UpdateVictim()) { AttackStart(m_creature->getVictim()); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } else { if (Unit* pTarget = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_PL_JEDOGA_TARGET))) { AttackStart(pTarget); pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS) EnterCombat(pTarget); } else if (!m_creature->isInCombat()) EnterEvadeMode(); } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (healTimer <= diff) { Unit* pTarget = NULL; switch(rand()%2) { case 0: if (pInstance) pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_ASTROMANCER)); break; case 1: pTarget = me; break; } if (pTarget) { DoCast(pTarget,SOLARIUM_HEAL); healTimer = 9000; } } else healTimer -= diff; if (holysmiteTimer <= diff) { DoCast(me->getVictim(), SOLARIUM_SMITE); holysmiteTimer = 4000; } else holysmiteTimer -= diff; if (aoesilenceTimer <= diff) { DoCast(me->getVictim(), SOLARIUM_SILENCE); aoesilenceTimer = 13000; } else aoesilenceTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (SpellTimer <= diff) { Unit* Victim = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); switch (NeedForAHack) { case 0: me->clearUnitState(UNIT_STAT_STUNNED); DoCastAOE(SPELL_BLACKHOLE_GROW, false); if (Victim) AttackStart(Victim); SpellTimer = 700; NeedForAHack = 2; break; case 1: me->AddAura(SPELL_BLACKHOLE_GROW, me); NeedForAHack = 2; SpellTimer = 600; break; case 2: SpellTimer = 400; NeedForAHack = 3; me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); break; case 3: SpellTimer = urand(400,900); NeedForAHack = 1; if (Unit* Temp = me->getVictim()) { if (Temp->GetPositionZ() > 73 && Victim) AttackStart(Victim); } else return; } } else SpellTimer -= diff; if (DespawnTimer <= diff) me->DisappearAndDie(); else DespawnTimer -= diff; }
void Reset() { TimerIsDeactivated[TIMER_SPEECH] = false; Timer[TIMER_SPEECH] = 0; //Phase 2 Timer Timer[TIMER_SOUL_FLAY] = 11000; Timer[TIMER_LEGION_LIGHTNING] = 30000; Timer[TIMER_FIRE_BLOOM] = 20000; Timer[TIMER_SUMMON_SHILEDORB] = 35000; //Phase 3 Timer Timer[TIMER_SHADOW_SPIKE] = 4000; Timer[TIMER_FLAME_DART] = 3000; Timer[TIMER_DARKNESS] = 45000; Timer[TIMER_ORBS_EMPOWER] = 35000; //Phase 4 Timer Timer[TIMER_ARMAGEDDON] = 2000; ActiveTimers = 5; WaitTimer = 0; speechCount = 0; SpeechTimer = 0; Phase = PHASE_NORMAL; IsInDarkness = false; IsWaiting = false; OrbActivated = false; SpeechBegins = true; if (pInstance) { if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); } me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); ChangeTimers(false, 0); summons.DespawnAll(); }
bool GOHello_prince_taldaram_sphere(Player *pPlayer, GameObject *pGO) { ScriptedInstance *pInstance = pGO->GetInstanceData(); Creature *pPrinceTaldaram = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_PRINCE_TALDARAM) : 0); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) { // maybe these are hacks :( pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); pGO->SetGoState(GO_STATE_ACTIVE); switch(pGO->GetEntry()) { case 193093: pInstance->SetData(DATA_SPHERE1_EVENT,IN_PROGRESS); break; case 193094: pInstance->SetData(DATA_SPHERE2_EVENT,IN_PROGRESS); break; } CAST_AI(boss_taldaramAI, pPrinceTaldaram->AI())->CheckSpheres(); } return true; }
void Reset() { m_uiPhase = PHASE_SINGLE; // reset phase m_uiPhaseCounter = 3; m_uiCheckTimer = IN_MILLISECONDS; m_uiFrenzyTimer = 16*IN_MILLISECONDS; m_uiSaberLashTimer = 20*IN_MILLISECONDS; m_uiShockTimer = 10*IN_MILLISECONDS; m_uiTotemTimer = 12*IN_MILLISECONDS; m_uiBerserkTimer = 10*MINUTE*IN_MILLISECONDS; m_bIsBerserk = false; m_creature->SetMaxHealth(m_creature->GetCreatureInfo()->maxhealth); if (m_pInstance) { if (Creature* pSpiritLynx = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SPIRIT_LYNX))) pSpiritLynx->ForcedDespawn(); } }
void UpdateAI(const uint32 diff) { if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(DATA_XT002))) { if (!repaired && me->GetDistance2d(pXT002) <= 0.5) { me->MonsterTextEmote(EMOTE_REPAIR, 0, true); // Increase health with 1 percent pXT002->CastSpell(me, SPELL_REPAIR, true); repaired = true; // Disable Nerf Engineering Achievement if (pXT002->AI()) pXT002->AI()->DoAction(ACTION_DISABLE_NERF_ACHI); // Despawns the scrapbot me->ForcedDespawn(500); } } }
void WaypointReached(uint32 i) { Player* player = GetPlayerForEscort(); if (!player) return; switch(i) { case 0: me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, player->GetGUID()); break; case 2: if (pInstance) { if (Creature* reginald = Unit::GetCreature(*me, pInstance->GetData64(DATA_REGINALD))) reginald->AI()->DoAction(); } break; } }
void SummonedCreatureJustDied(Creature* pSummoned) override { m_lSummonedAddGuids.remove(pSummoned->GetObjectGuid()); if (!m_pInstance) return; m_pInstance->SetData64(DATA64_GOTH_RIGHT_ANCHOR, pSummoned->GetObjectGuid().GetRawValue()); if (Creature* pAnchor = m_creature->GetMap()->GetCreature(ObjectGuid(m_pInstance->GetData64(DATA64_GOTH_RIGHT_ANCHOR)))) { switch (pSummoned->GetEntry()) { // Wrong caster, it expected to be pSummoned. // Mangos deletes the spell event at caster death, so for delayed spell like this // it's just a workaround. Does not affect other than the visual though (+ spell takes longer to "travel") case NPC_UNREL_TRAINEE: m_creature->CastSpell(pAnchor, SPELL_A_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break; case NPC_UNREL_DEATH_KNIGHT: m_creature->CastSpell(pAnchor, SPELL_B_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break; case NPC_UNREL_RIDER: m_creature->CastSpell(pAnchor, SPELL_C_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break; } } }
void Reset() { if (m_bDoubled_Health) { me->SetMaxHealth(me->GetMaxHealth() / 2); m_bDoubled_Health = false; } FakeDeath = false; DelayRes_Timer = 0; DelayRes_Target = 0; me->SetStandState(UNIT_STAND_STATE_STAND); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //reset encounter if (m_pInstance && (m_pInstance->GetData(DATA_KAELTHASEVENT) == 1 || m_pInstance->GetData(DATA_KAELTHASEVENT) == 3)) if (Creature *Kaelthas = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_KAELTHAS))) Kaelthas->AI()->EnterEvadeMode(); }
void PhaseEquipStart() { ScriptedInstance* pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); if (!pInstance) return; GameObject* pChest = pInstance->instance->GetGameObject(pInstance->GetData64(GO_SMITE_CHEST)); if (!pChest) return; m_uiPhase = PHASE_EQUIP_NULL; float fX, fY, fZ; pChest->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE); m_creature->GetMotionMaster()->Clear(); m_creature->SetFacingToObject(pChest); m_creature->GetMotionMaster()->MovePoint(0, fX, fY, fZ); }
void SetData(uint32 uiType, uint32 uiData) { switch (uiType) { case DATA_START: DoSummonGrandChampion(uiFirstBoss); NextStep(10000,false,1); break; case DATA_IN_POSITION: //movement done. m_creature->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); if (GameObject* pGO = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_MAIN_GATE))) pInstance->HandleGameObject(pGO->GetGUID(),false); NextStep(10000,false,3); break; case DATA_LESSER_CHAMPIONS_DEFEATED: { ++uiLesserChampions; std::list<uint64> TempList; if (uiLesserChampions == 3 || uiLesserChampions == 6) { switch(uiLesserChampions) { case 3: TempList = Champion2List; break; case 6: TempList = Champion3List; break; } for(std::list<uint64>::iterator itr = TempList.begin(); itr != TempList.end(); ++itr) if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr)) AggroAllPlayers(pSummon); }else if (uiLesserChampions == 9) StartGrandChampionsAttack(); break; } } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //immolateTimer if (immolateTimer <= diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_IMMOLATE); immolateTimer = urand(5000, 10000); } else immolateTimer -= diff; //seperationCheckTimer if (seperationCheckTimer <= diff) { if (instance) return; Creature* Garr = Creature::GetCreature(*me, instance->GetData64(DATA_GARR)); if (Garr && Garr->IsAlive() && !me->IsWithinDist2d(Garr->GetPositionX(), Garr->GetPositionY(), 50.0f)) DoCast(me, SPELL_SEPARATION_ANXIETY, true); seperationCheckTimer = 5000; } else seperationCheckTimer -= diff; //Cast Erruption and let them die if (me->GetHealthPct() <= 10.0f) { DoCastVictim(SPELL_ERUPTION); me->setDeathState(JUST_DIED); me->RemoveCorpse(); } 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); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { EnterEvadeMode(); return; } //GreaterPowerWordShield_Timer if (GreaterPowerWordShield_Timer <= diff) { DoCast(me, SPELL_GREATER_PW_SHIELD); GreaterPowerWordShield_Timer = 40000; } else GreaterPowerWordShield_Timer -= diff; //Heal_Timer if (Heal_Timer <= diff) { DoCast(me, SPELL_HEAL); Heal_Timer = 60000; } else Heal_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!pInstance) return; if (BreakKeg_Timer) { if (BreakKeg_Timer <= diff) { DoGo(DATA_GO_BAR_KEG,0); BreakKeg_Timer = 0; BreakDoor_Timer = 1000; } else BreakKeg_Timer -= diff; } if (BreakDoor_Timer) { if (BreakDoor_Timer <= diff) { DoGo(DATA_GO_BAR_DOOR,2); DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future //spell by trap has effect61, this indicate the bar go hostile if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX))) tmp->setFaction(14); //for later, this event(s) has alot more to it. //optionally, DONE can trigger bar to go hostile. pInstance->SetData(TYPE_BAR,DONE); BreakDoor_Timer = 0; } else BreakDoor_Timer -= diff; } npc_escortAI::UpdateAI(diff); }
void UpdateAI(const uint32 diff) { if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) { if (me->GetDistance2d(pXT002) <= 0.5) { //Explosion DoCast(me, SPELL_BOOM); //Despawns the boombot me->ForcedDespawn(); } } if (HealthBelowPct(50)) { //Explosion DoCast(me, SPELL_BOOM); //Despawns the boombot me->ForcedDespawn(); } }
void UpdateAI (const uint32 diff) { if (!pInstance) return; if (Check_Timer <= diff) { Unit *Vashj = NULL; Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); if (Vashj && Vashj->isAlive()) { //start visual channel if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER)) { DoCast(Vashj, SPELL_MAGIC_BARRIER, true); Casted = true; } } Check_Timer = 1000; } else Check_Timer -= diff; }
void DamageTaken(Unit* pKiller, uint32 &damage) { if (damage >= m_creature->GetHealth() && pKiller != m_creature && !toDie) { damage = 0; DoCast(m_creature, SPELL_EMBER_BLAST, true); m_creature->SetDisplayId(11686); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (pInstance && pInstance->GetData(DATA_ALAREVENT) == 2) { if (Unit* Alar = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ALAR))) { int AlarHealth = Alar->GetHealth() - Alar->GetMaxHealth()*0.03; if (AlarHealth > 0) Alar->SetHealth(AlarHealth); else Alar->SetHealth(1); } } toDie = true; } }
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; }
void EnterCombat(Unit* who) { if (pInstance) { Creature* Controller = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ILLIDARICOUNCIL))); if (Controller) CAST_AI(mob_illidari_councilAI, Controller->AI())->StartEvent(who); } else { error_log(ERROR_INST_DATA); EnterEvadeMode(); return; } DoZoneInCombat(); // Load GUIDs on first aggro because the creature guids are only set as the creatures are created in world- // this means that for each creature, it will attempt to LoadGUIDs even though some of the other creatures are // not in world, and thus have no GUID set in the instance data system. Putting it in aggro ensures that all the creatures // have been loaded and have their GUIDs set in the instance data system. if (!LoadedGUIDs) LoadGUIDs(); }