Example #1
0
    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
    {
        if ( pPlayer->GetTeamId() == TEAM_ALLIANCE)
            return false;

        InstanceScript* pInstance = pCreature->GetInstanceScript();
        if (pInstance && pInstance->GetBossState(DATA_GUNSHIP_BATTLE_EVENT) == NOT_STARTED)
        {
            pPlayer->ADD_GOSSIP_ITEM(0, "Ready for battle", 631, HORDE_GOSSIP_ACTION_START);
            pPlayer->ADD_GOSSIP_ITEM(0, "Return Later", 631, HORDE_GOSSIP_ACTION_CANCEL);
            pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());

            return true;
        }

        if (pInstance && pInstance->GetBossState(DATA_GUNSHIP_BATTLE_EVENT) == DONE)
        {
            pPlayer->ADD_GOSSIP_ITEM(0, "Go to the top of the Deathbringer", 631, HORDE_GOSSIP_ACTION_TP);
            pPlayer->ADD_GOSSIP_ITEM(0, "Return Later", 631, HORDE_GOSSIP_ACTION_CANCEL);
            pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());

            return true;
        }
        return false;
    }
Example #2
0
    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
    {
        if ( pPlayer->GetTeamId() == TEAM_HORDE)
            return false;

        InstanceScript* pInstance = pCreature->GetInstanceScript();
        if (pInstance && pInstance->GetBossState(DATA_GUNSHIP_BATTLE_EVENT) == NOT_STARTED)
        {
            pPlayer->ADD_GOSSIP_ITEM(0, "My allies are in good condition, Muradin, Forward", 10875, ALLIANCE_GOSSIP_ACTION_START);
            pPlayer->ADD_GOSSIP_ITEM(0, "Return Later", 631, ALLIANCE_GOSSIP_ACTION_CANCEL);
            pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());

            return true;
        }

        if (pInstance && pInstance->GetBossState(DATA_GUNSHIP_BATTLE_EVENT) == DONE)
        {
            pPlayer->ADD_GOSSIP_ITEM(0, "Go to the top of the Deathbringer", 10876, ALLIANCE_GOSSIP_ACTION_TP);
            pPlayer->ADD_GOSSIP_ITEM(0, "Return Later", 631, ALLIANCE_GOSSIP_ACTION_CANCEL);
            pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());

            return true;
        }
        return false;
    }
        bool OnGossipHello(Player* player, Creature* creature)
        {
            InstanceScript* instance = creature->GetInstanceScript();
            if (!instance)
                return true;

            char const* _message = "We are ready!";

            if (player->IsInCombat() || instance->IsEncounterInProgress() || instance->GetData(TYPE_EVENT))
                return true;

            uint8 i = 0;
            for (; i < NUM_MESSAGES; ++i)
            {
                if ((!_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) != DONE)
                    || (_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) == DONE))
                {
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, _message, GOSSIP_SENDER_MAIN, _GossipMessage[i].id);
                    break;
                }
            }

            if (i >= NUM_MESSAGES)
                return false;

            player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID());
            return true;
        }
Example #4
0
        bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
        {
            InstanceScript* instance = player->GetInstanceScript();
            if (player->isGameMaster() || !instance)
                return false;

            if (instance->GetBossState(DATA_TYRANNUS) != IN_PROGRESS && instance->GetBossState(DATA_TYRANNUS) != DONE)
                if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_TYRANNUS)))
                {
                    tyrannus->AI()->DoAction(ACTION_START_INTRO);
                    return true;
                }

            return false;
        }
            void UpdateAI(const uint32 diff)
            {
                if (pInstance && pInstance->GetBossState(DATA_SILVERLAINE) != IN_PROGRESS)
                    me->DespawnOrUnsummon();

                DoMeleeAttackIfReady();
            }
        void UpdateAI(uint32 uiDiff) override
        {
            // Despawn if the encounter is not running
            if (instance->GetBossState(DATA_IONAR) != IN_PROGRESS)
            {
                me->DespawnOrUnsummon();
                return;
            }

            // Prevent them to follow players through the whole instance
            if (uiCheckTimer <= uiDiff)
            {
                Creature* ionar = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_IONAR));
                if (ionar && ionar->IsAlive())
                {
                    if (me->GetDistance(ionar) > DATA_MAX_SPARK_DISTANCE)
                    {
                        Position pos = ionar->GetPosition();

                        me->SetSpeedRate(MOVE_RUN, 2.0f);
                        me->GetMotionMaster()->Clear();
                        me->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos);
                    }
                }
                else
                    me->DespawnOrUnsummon();
                uiCheckTimer = 2*IN_MILLISECONDS;
            }
            else
                uiCheckTimer -= uiDiff;

            // No melee attack at all!
        }
        void AttackStart(Unit* who) override
        {
            if (instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED)
                return;

            ScriptedAI::AttackStart(who);
        }
        void UpdateAI(uint32 diff) override
        {
            if (Repair_Timer <= diff)
            {
                if (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == IN_PROGRESS)
                {
                    if (Creature* mekgineer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MEKGINEER_STEAMRIGGER)))
                    {
                        if (me->IsWithinDistInMap(mekgineer, MAX_REPAIR_RANGE))
                        {
                            //are we already channeling? Doesn't work very well, find better check?
                            if (!me->GetUInt32Value(UNIT_CHANNEL_SPELL))
                            {
                                //me->GetMotionMaster()->MovementExpired();
                                //me->GetMotionMaster()->MoveIdle();

                                DoCast(me, SPELL_REPAIR, true);
                            }
                            Repair_Timer = 5000;
                        }
                        else
                        {
                            //me->GetMotionMaster()->MovementExpired();
                            //me->GetMotionMaster()->MoveFollow(pMekgineer, 0, 0);
                        }
                    }
                } else Repair_Timer = 5000;
            } else Repair_Timer -= diff;

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #9
0
    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
    {
        InstanceScript *data = pPlayer->GetInstanceScript();
        InstanceScript *pInstance = (InstanceScript *) pCreature->GetInstanceScript();

        if (pInstance && pPlayer)
            if (data->GetBossState(BOSS_LEVIATHAN) != DONE)
                if (data->GetBossState(BOSS_LEVIATHAN) != SPECIAL)
                {
                    pPlayer->PrepareQuestMenu(pCreature->GetGUID());
                    pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF);
                    pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID());
                }
                else pPlayer->SEND_GOSSIP_MENU(1, pCreature->GetGUID());

        return true;
    }
 void Reset()
 {
     bPhase = false;
     events.Reset();
     summons.DespawnAll();
     if (pInstance)
         if (pInstance->GetBossState(DATA_MINDBENDER_GHURSHA) == DONE || bPhase)
             me->setFaction(35);
 }
Example #11
0
    bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/)
    {
        if (pPlayer->isGameMaster())
            return false;

        InstanceScript* pInstance = pPlayer->GetInstanceScript();
        if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE)
            return false;

        Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD)));
        if (!pKelthuzad)
            return false;

        boss_kelthuzad::boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzad::boss_kelthuzadAI, pKelthuzad->AI());
        if (!pKelthuzadAI)
            return false;

        pKelthuzadAI->AttackStart(pPlayer);
        if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER)))
        {
            if (trigger->getLootState() == GO_READY)
                trigger->UseDoorOrButton();

            // Note: summon must be done by trigger and not by KT.
            // Otherwise, they attack immediately as KT is in combat.
            for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i)
            {
                if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i]))
                {
                    pKelthuzadAI->spawns.Summon(sum);
                    sum->GetMotionMaster()->MoveRandom(9.0f);
                    sum->SetReactState(REACT_DEFENSIVE);
                }
            }
            for (uint8 i = 0; i <= MAX_WASTES; ++i)
            {
                if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i]))
                {
                    pKelthuzadAI->spawns.Summon(sum);
                    sum->GetMotionMaster()->MoveRandom(5.0f);
                    sum->SetReactState(REACT_DEFENSIVE);
                }
            }
            for (uint8 i = 0; i <= MAX_WEAVERS; ++i)
            {
                if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i]))
                {
                    pKelthuzadAI->spawns.Summon(sum);
                    sum->GetMotionMaster()->MoveRandom(9.0f);
                    sum->SetReactState(REACT_DEFENSIVE);
                }
            }
        }

        return true;
    }
        bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/, bool /*entered*/) override
        {
            InstanceScript* instance = player->GetInstanceScript();
            if (!instance || instance->GetData(DATA_HAD_ANUBREKHAN_GREET) || instance->GetBossState(BOSS_ANUBREKHAN) != NOT_STARTED)
                return true;

            if (Creature* anub = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_ANUBREKHAN)))
                anub->AI()->Talk(SAY_GREET);
            instance->SetData(DATA_HAD_ANUBREKHAN_GREET, 1u);

            return true;
        }
            void Reset()
            {
                if (instance->GetBossState(DATA_SHADE_OF_AKAMA) == DONE)
                {
                    me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    return;
                }

                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                me->CastSpell(me, SPELL_STEALTH, true);
                events.Reset();
                events2.Reset();
            }
    bool OnGossipHello(Player* player, GameObject* /*go*/)
    {
        InstanceScript* Instance = player->GetInstanceScript();
        if (!Instance)
            return false;

        Creature* Ossirian = player->FindNearestCreature(NPC_OSSIRIAN, 30.0f);
        if (!Ossirian || Instance->GetBossState(DATA_OSSIRIAN) != IN_PROGRESS)
            return false;

        Ossirian->AI()->DoAction(ACTION_TRIGGER_WEAKNESS);
        return true;
    }
Example #15
0
    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
    {
        InstanceScript* pInstance = pCreature->GetInstanceScript();
        if (pInstance && pInstance->GetBossState(TYPE_RAZORSCALE) == NOT_STARTED && pPlayer)
        {
            pPlayer->PrepareGossipMenu(pCreature);

            pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF);
            pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID());
        }
        else pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID());

        return true;
    }
Example #16
0
    bool OnGossipHello(Player* player, Creature* creature)
    {
        InstanceScript* instance = creature->GetInstanceScript();
        if (instance && instance->GetBossState(BOSS_RAZORSCALE) == NOT_STARTED)
        {
            player->PrepareGossipMenu(creature);

            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
            player->SEND_GOSSIP_MENU(13853, creature->GetGUID());
        }
        else
            player->SEND_GOSSIP_MENU(13910, creature->GetGUID());

        return true;
    }
Example #17
0
        void UpdateAI(uint32 diff) override
        {
            if (!SummonSentinel)
            {
                if (InAction && instance->GetBossState(DATA_MURU) == NOT_STARTED)
                    Reset();
                return;
            }

            if (SummonTimer <= diff)
            {
                DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false);
                SummonTimer = 5000;
                SummonSentinel = false;
            } else SummonTimer -= diff;
        }
Example #18
0
 bool OnGossipHello(Player* pPlayer, Creature* pCreature)
 {
     InstanceScript* pInstance = pCreature->GetInstanceScript();
     if (!pInstance)
         return false;
     if (pInstance->GetBossState(DATA_ATRAMEDES) != IN_PROGRESS)
         return true;
     if (Creature* atramedes = pCreature->FindNearestCreature(NPC_ATRAMEDES, 200.0f))
     {
         pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
         atramedesShield = pCreature;
         atramedesTarget = pPlayer;
         atramedes->AI()->DoAction(ACTION_SHIELD);
     }
     return true;
 }
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim())
                return;

            if (_bHasDied && !_bHeal && instance->GetBossState(DATA_MOGRAINE_AND_WHITE_EVENT) == SPECIAL)
            {
                //On resurrection, stop fake death and heal whitemane and resume fight
                if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE)))
                {
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetStandState(UNIT_STAND_STATE_STAND);
                    DoCast(Whitemane, SPELL_LAYONHANDS);

                    CrusaderStrike_Timer = 10000;
                    HammerOfJustice_Timer = 10000;

                    if (me->GetVictim())
                        me->GetMotionMaster()->MoveChase(me->GetVictim());

                    _bHeal = true;
                }
            }

            //This if-check to make sure mograine does not attack while fake death
            if (_bFakeDeath)
                return;

            //CrusaderStrike_Timer
            if (CrusaderStrike_Timer <= diff)
            {
                DoCastVictim(SPELL_CRUSADERSTRIKE);
                CrusaderStrike_Timer = 10000;
            }
            else CrusaderStrike_Timer -= diff;

            //HammerOfJustice_Timer
            if (HammerOfJustice_Timer <= diff)
            {
                DoCastVictim(SPELL_HAMMEROFJUSTICE);
                HammerOfJustice_Timer = 60000;
            }
            else HammerOfJustice_Timer -= diff;

            DoMeleeAttackIfReady();
        }
        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                me->DespawnOrUnsummon();

            if (pInstance && pInstance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
                me->DespawnOrUnsummon();

            if (PounceTimer <= uiDiff)
            {
                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 60, true))
                {
                    me->AddThreat(pTarget, 100.0f);
                    me->AI()->AttackStart(pTarget);
                    DoCast(pTarget, SPELL_FERAL_POUNCE);
                }
                PounceTimer = urand(15000, 20000);
            }
            else PounceTimer -= uiDiff;

            if (RushTimer <= uiDiff)
            {
                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 60, true))
                {
                    me->AddThreat(pTarget, 100.0f);
                    me->AI()->AttackStart(pTarget);
                    DoCast(pTarget, SPELL_FERAL_RUSH);
                }
                RushTimer = urand(15000, 20000);
            }
            else RushTimer -= uiDiff;

            if (RessTimer <= uiDiff)
            {
                me->SetStandState(UNIT_STAND_STATE_STAND);
                for (uint8 i = 0; i < Lifes; ++i)
                    DoCast(me, SPELL_FERAL_ESSENCE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
                me->SetReactState(REACT_AGGRESSIVE);
                RessTimer = 999999;
                DoZoneInCombat();
            }
            else RessTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
        void Reset() override
        {
            me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 9.0f);
            me->SetFloatValue(UNIT_FIELD_COMBATREACH, 9.0f);

            uiAcidTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS);
            uiLeechTimer = urand(3*IN_MILLISECONDS, 9*IN_MILLISECONDS);
            uiPierceTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS);
            uiGrabTimer = urand(15*IN_MILLISECONDS, 19*IN_MILLISECONDS);
            uiDoorsTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS);
            uiCheckDistanceTimer = 2*IN_MILLISECONDS;

            if (instance->GetBossState(DATA_HADRONOX) != DONE && !bFirstTime)
                instance->SetBossState(DATA_HADRONOX, FAIL);

            bFirstTime = false;
        }
Example #22
0
            void UpdateAI(const uint32 diff)
            {
                if (pInstance && pInstance->GetBossState(DATA_MAGMAW) != IN_PROGRESS)
                    me->DespawnOrUnsummon();

                if (me->GetVictim())
                {
                    if ((me->GetDistance(me->GetVictim()) <= 4.0f))
                    {
                        if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER)
                        {
                            me->GetVictim()->CastSpell(me->GetVictim(), SPELL_PARASITIC_INFECTION, true);
                            me->DespawnOrUnsummon();
                        }
                    }
                }
                DoMeleeAttackIfReady();
            }
Example #23
0
 void HandlePeriodic(AuraEffect const* /*eff*/)
 {
     Unit* caster = GetCaster();
     if (!caster)
         return;
     InstanceScript* instance = caster->GetInstanceScript();
     if (!instance)
         return;
     if (instance->GetBossState(DATA_HADRONOX) == DONE)
         GetAura()->Remove();
     else
     {
         if (caster->GetPositionZ() >= 750.0f)
             caster->CastSpell(caster, _topSpellId, true);
         else
             caster->CastSpell(caster, _bottomSpellId, true);
     }
 }
Example #24
0
            void UpdateAI(uint32 diff)
            {
                if (!UpdateVictim() || me->GetVictim()->HasAura(SPELL_BLOCK_OF_ICE) || me->GetVictim()->HasAura(SPELL_FLASH_FREEZE_HELPER))
                    return;

                if (me->GetVictim()->GetGUID() != targetGUID || instance->GetBossState(DATA_HODIR) != IN_PROGRESS)
                    me->DespawnOrUnsummon();

                if (checkDespawnTimer <= diff)
                {
                    if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
                        if (!target->IsAlive())
                            me->DisappearAndDie();
                    checkDespawnTimer = 2500;
                }
                else
                    checkDespawnTimer -= diff;
            }
Example #25
0
        void Reset()
        {
            _Reset();

            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
            me->SetPower(POWER_ENERGY, 0);
            me->SetInt32Value(UNIT_FIELD_POWER1, 0);
            me->SetMaxPower(POWER_ENERGY, 100);
            me->SetInt32Value(UNIT_FIELD_MAXPOWER1, 100);
            me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
            me->CastSpell(me, SPELL_ENERGY_TO_ZERO, true);

            summons.DespawnAll();

            events.Reset();

            events.ScheduleEvent(EVENT_CHECK_MELEE, 1000);
            events.ScheduleEvent(EVENT_EERIE_SKULL, 5000);
            events.ScheduleEvent(EVENT_CHECK_ENERGY, 1000);
            events.ScheduleEvent(EVENT_FIRST_TERRORS, 30000);

            attacksCounter = 0;
            terrorCounter  = 0;

            if (pInstance)
            {
                if (pInstance->GetBossState(DATA_PROTECTORS) == DONE)
                {
                    me->setFaction(14);
                    me->HandleEmote(0);
                    pInstance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);

                    if (pInstance->GetData(SPELL_RITUAL_OF_PURIFICATION))
                        me->AddAura(SPELL_RITUAL_OF_PURIFICATION, me);
                }
                else
                {
                    me->setFaction(35);
                    me->HandleEmote(35);
                }
            }
        }
Example #26
0
 void DamageTaken(Unit* killer, uint32& damage) override
 {
     if (damage >= me->GetHealth() && killer != me && !toDie)
     {
         damage = 0;
         DoCast(me, SPELL_EMBER_BLAST, true);
         me->SetDisplayId(11686);
         me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
         if (instance->GetBossState(DATA_ALAR) == IN_PROGRESS)
         {
             if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ALAR)))
             {
                 int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3));
                 if (AlarHealth > 0)
                     Alar->SetHealth(AlarHealth);
                 else
                     Alar->SetHealth(1);
             }
         }
         toDie = true;
     }
 }
        bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/)
        {
            player->PlayerTalkClass->ClearMenus();
            player->CLOSE_GOSSIP_MENU();
            InstanceScript* instance = creature->GetInstanceScript();
            if (!instance)
                return true;

            if (instance->GetBossState(BOSS_BEASTS) != DONE)
            {
                instance->SetData(TYPE_EVENT, 110);
                instance->SetData(TYPE_NORTHREND_BEASTS, NOT_STARTED);
                instance->SetBossState(BOSS_BEASTS, NOT_STARTED);
            }
            else if (instance->GetBossState(BOSS_JARAXXUS) != DONE)
            {
                // if Jaraxxus is spawned, but the raid wiped
                if (Creature* jaraxxus = Unit::GetCreature(*player, instance->GetData64(NPC_JARAXXUS)))
                {
                    jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
                    jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    jaraxxus->SetReactState(REACT_DEFENSIVE);
                    jaraxxus->SetInCombatWithZone();
                }
                else
                {
                    instance->SetData(TYPE_EVENT, 1010);
                    instance->SetBossState(BOSS_JARAXXUS, NOT_STARTED);
                }
            }
            else if (instance->GetBossState(BOSS_CRUSADERS) != DONE)
            {
                if (player->GetTeam() == ALLIANCE)
                    instance->SetData(TYPE_EVENT, 3000);
                else
                    instance->SetData(TYPE_EVENT, 3001);
                instance->SetBossState(BOSS_CRUSADERS, NOT_STARTED);
            }
            else if (instance->GetBossState(BOSS_VALKIRIES) != DONE)
            {
                instance->SetData(TYPE_EVENT, 4000);
                instance->SetBossState(BOSS_VALKIRIES, NOT_STARTED);
            }
            else if (instance->GetBossState(BOSS_LICH_KING) != DONE)
            {
                if (GameObject* floor = GameObject::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
                    floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);

                creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false);
                creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false);

                Creature* anubArak = Unit::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK));
                if (!anubArak || !anubArak->IsAlive())
                    anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);

                instance->SetBossState(BOSS_ANUBARAK, NOT_STARTED);

                if (creature->IsVisible())
                    creature->SetVisible(false);
            }
            creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            return true;
        }
 void UpdateAI(const uint32 uiDiff)
 {
     if (pInstance && pInstance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
         me->DespawnOrUnsummon();
 }
Example #29
0
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim())
                return;

            if (Phase == 3)
            {
                if (Timer[TIMER_PHASE] <= diff)
                {
                    switch (instance->GetBossState(DATA_MURU))
                    {
                        case NOT_STARTED:
                            Reset();
                            break;
                        case DONE:
                            Phase = 4;
                            me->DisappearAndDie();
                            break;
                        default:
                            break;
                    }
                    Timer[TIMER_PHASE] = 3000;
                } else Timer[TIMER_PHASE] -= diff;
                return;
            }

            if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0))
            {
                DoCast(me, SPELL_ENRAGE, false);
            } else EnrageTimer -= diff;

            for (uint8 i = 0; i < 4; ++i)
            {
                if (Timer[i] <= diff)
                {
                    switch (i)
                    {
                        case TIMER_DARKNESS:
                            if (!DarkFiend)
                            {
                                DoCastAOE(SPELL_DARKNESS, false);
                                Timer[TIMER_DARKNESS] = 3000;
                                DarkFiend = true;
                            }
                            else
                            {
                                DarkFiend = false;
                                for (uint8 j = 0; j < 8; ++j)
                                    me->SummonCreature(NPC_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
                                Timer[TIMER_DARKNESS] = 42000;
                            }
                            break;
                        case TIMER_HUMANOIDES:
                            for (uint8 j = 0; j < 6; ++j)
                                me->SummonCreature(uint32(Humanoides[j][0]), Humanoides[j][1], Humanoides[j][2], Humanoides[j][3], Humanoides[j][4], TEMPSUMMON_CORPSE_DESPAWN, 0);
                            Timer[TIMER_HUMANOIDES] = 60000;
                            break;
                        case TIMER_PHASE:
                            me->RemoveAllAuras();
                            DoCast(me, SPELL_SUMMON_ENTROPIUS, false);
                            Timer[TIMER_PHASE] = 3000;
                            Phase = 3;
                            return;
                        case TIMER_SENTINEL:
                            DoCastAOE(SPELL_OPEN_PORTAL_2, false);
                            Timer[TIMER_SENTINEL] = 30000;
                            break;
                    }
                    break;
                }
            }

            // Timer
            for (uint8 i = 0; i < 4; ++i)
            {
                if (i != TIMER_PHASE)
                    Timer[i] -= diff;
                else if (Phase == 2)
                    Timer[i] -= diff;
            }
        }
Example #30
0
            void UpdateAI(uint32 diff)
            {
                if (!UpdateVictim())
                    return;

                //SweepingStrikes_Timer
                if (SweepingStrikes_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_SWEEPINGSTRIKES);
                    SweepingStrikes_Timer = 22000+rand()%4000;
                } else SweepingStrikes_Timer -= diff;

                //SinisterStrike_Timer
                if (SinisterStrike_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_SINISTERSTRIKE);
                    SinisterStrike_Timer = 8000+rand()%8000;
                } else SinisterStrike_Timer -= diff;

                //Gouge_Timer
                if (Gouge_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_GOUGE);

                    if (DoGetThreat(me->getVictim()))
                        DoModifyThreatPercent(me->getVictim(), -100);

                    Gouge_Timer = 17000+rand()%10000;
                } else Gouge_Timer -= diff;

                //Kick_Timer
                if (Kick_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_KICK);
                    Kick_Timer = 15000+rand()%10000;
                } else Kick_Timer -= diff;

                //Blind_Timer
                if (Blind_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_BLIND);
                    Blind_Timer = 10000+rand()%10000;
                } else Blind_Timer -= diff;

                //Check_Timer for the death of LorKhan and Zath.
                if (!FakeDeath && Check_Timer <= diff)
                {
                    if (instance)
                    {
                        if (instance->GetBossState(DATA_LORKHAN) == SPECIAL)
                        {
                            //Resurrect LorKhan
                            if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN)))
                            {
                                pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                pLorKhan->setFaction(14);
                                pLorKhan->SetFullHealth();
                            }
                        }

                        if (instance->GetBossState(DATA_THEKAL) == SPECIAL)
                        {
                            //Resurrect Thekal
                            if (Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL)))
                            {
                                pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                pThekal->setFaction(14);
                                pThekal->SetFullHealth();
                            }
                        }
                    }

                    Check_Timer = 5000;
                } else Check_Timer -= diff;

                if (!HealthAbovePct(5))
                {
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetStandState(UNIT_STAND_STATE_SLEEP);
                    me->setFaction(35);
                    me->AttackStop();

                    if (instance)
                        instance->SetBossState(DATA_ZATH, SPECIAL);

                    FakeDeath = true;
                }

                DoMeleeAttackIfReady();
            }