Пример #1
0
        void UpdateAI(const uint32 diff)
        {
            npc_escortAI::UpdateAI(diff);

            if (!HasEscortState(STATE_ESCORT_ESCORTING))
            {
                Start(false,true,0,NULL,false,true);
            }
            else
            {
                if(infernoTimer <= diff)
                {
                    if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN))
                    {
                        pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true);
                        infernoTimer = 2000;
                    }
                }
                else
                    infernoTimer -= diff;

                if (!me->HasAura(AURA_DUMMY_YELLOW))
                    me->AddAura(AURA_DUMMY_YELLOW, me);
            }
        }
Пример #2
0
 void MoveInLineOfSight(Unit* who)
 {
     if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false))
     {
         if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN))
             pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true);
     }
 }
Пример #3
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

            if (me->hasUnitState(UNIT_STAT_CASTING) || me->HasAura(SPELL_SYSTEMS_SHUTDOWN))
                return;

            while(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                case 0: break;
                case EVENT_PURSUE:
                    DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me);
                    {
                        DoZoneInCombat();
                        Unit* pTarget;
                        std::vector<Unit *> target_list;
                        std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList();
                        for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
                        {
                            pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());

                            if (!pTarget)
                                continue;

                            if (pTarget->GetEntry() == VEHICLE_SIEGE || pTarget->GetEntry() == VEHICLE_DEMOLISHER)
                                target_list.push_back(pTarget);

                            pTarget = NULL;
                        }

                        if (!target_list.empty())
                            pTarget = *(target_list.begin()+rand()%target_list.size());
                        else
                            pTarget = me->getVictim();

                        if (pTarget && pTarget->isAlive())
                        {
                            DoResetThreat();
                            me->AddThreat(pTarget, 5000000.0f);
                            me->AddAura(SPELL_PURSUED, pTarget);
                            me->MonsterTextEmote(EMOTE_PURSUE, pTarget->GetGUID(), true);
                       }
                    }
                    events.RescheduleEvent(EVENT_PURSUE, 35000);
                    break;
                case EVENT_MISSILE:
                    DoCastAOE(SPELL_MISSILE_BARRAGE);
                    events.RescheduleEvent(EVENT_MISSILE, 1500);
                    break;
                case EVENT_VENT:
                    DoCastAOE(SPELL_FLAME_VENTS);
                    events.RescheduleEvent(EVENT_VENT, 20000);
                    break;
                case EVENT_SPEED:
                    DoCastAOE(SPELL_GATHERING_SPEED);
                    events.RescheduleEvent(EVENT_SPEED, 10000);
                    break;
                case EVENT_SUMMON:
                    if(summons.size() < 15) // 4seat+1turret+10lift
                        if(Creature *lift = DoSummonFlyer(MOB_MECHANOLIFT, me, rand()%20 + 20, 50, 0))
                            lift->GetMotionMaster()->MoveRandom(100);
                    events.RescheduleEvent(EVENT_SUMMON, 2000);
                    break;
                case EVENT_SHUTDOWN:
                    DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me);
                    me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
                    DoCast(SPELL_SYSTEMS_SHUTDOWN);
                    me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
                    me->MonsterTextEmote(EMOTE_REPAIR, 0, true);
                    events.RescheduleEvent(EVENT_SHUTDOWN, 80000);
                    break;
                default:
                    events.PopEvent();
                    break;
                }
            }
        
            if (me->IsWithinMeleeRange(me->getVictim()))
                DoSpellAttackIfReady(SPELL_BATTERING_RAM);
        }
Пример #4
0
    void UpdateAI(const uint32 diff)
    {
        if (!me->isInCombat())
            return;

        if (me->getThreatManager().isThreatListEmpty())
        {
            EnterEvadeMode();
            return;
        }

        events.Update(diff);

        if (me->hasUnitState(UNIT_STAT_CASTING))
            return;

        uint32 eventId = events.GetEvent();
        if (!me->getVictim())
            eventId = EVENT_PURSUE;

        switch(eventId)
        {
            case 0: break; // this is a must
            case EVENT_PURSUE:
                DoCastAOE(SPELL_PURSUED, true);
                //events.RepeatEvent(35000); // this should not be used because eventId may be overriden
                events.RescheduleEvent(EVENT_PURSUE, 35000);
                if(!me->getVictim()) // all siege engines and demolishers are dead
                    UpdateVictim(); // begin to kill other things
                return;
            case EVENT_MISSILE:
                //TODO: without unittarget no visual effect
                //DoCastAOE(SPELL_MISSILE_BARRAGE);
                DoCast(me->getVictim(), SPELL_MISSILE_BARRAGE);
                events.RepeatEvent(1500);
                return;
            case EVENT_VENT:
                DoCastAOE(SPELL_FLAME_VENTS);
                events.RepeatEvent(20000);
                return;
            case EVENT_SPEED:
                DoCastAOE(SPELL_GATHERING_SPEED);
                events.RepeatEvent(15000);
                return;
            case EVENT_SUMMON:
                if(summons.size() < 15) // 4seat+1turret+10lift
                    if(Creature *lift = DoSummonFlyer(MOB_MECHANOLIFT, me, rand()%20 + 20, 50, 0))
                        lift->GetMotionMaster()->MoveRandom(100);
                events.RepeatEvent(2000);
                return;
            case EVENT_MIMIRON_INFERNO: // Not Blizzlike
                DoCast(me->getVictim(), SPELL_MIMIRON_INFERNO);
                events.RepeatEvent(60000 + (rand()%60000));
                return;
            case EVENT_HODIR_FURY:      // Not Blizzlike
                DoCast(me->getVictim(), SPELL_HODIR_FURY);
                events.RepeatEvent(60000 + (rand()%60000));
            default:
                events.PopEvent();
                break;
        }

        DoSpellAttackIfReady(SPELL_BATTERING_RAM);
    }
Пример #5
0
        void UpdateAI(const uint32 diff)
        {
            if (!me->isInCombat())
                return;

            if (me->getThreatManager().isThreatListEmpty())
            {
                EnterEvadeMode();
                return;
            }

            if (uiShutdown == RAID_MODE(2,4))
            {
                uiShutdown = 0;
                events.ScheduleEvent(EVENT_SHUTDOWN, 0);
                events.ScheduleEvent(EVENT_REPAIR, 0);
                me->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT);
                me->InterruptNonMeleeSpells(true);
                return;
            }

            if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN))
            {
                me->SetReactState(REACT_PASSIVE);
                me->AddUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
                return;
            }

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN))
            {
                me->SetReactState(REACT_PASSIVE);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
                return;
            }
            else
            {
                me->SetReactState(REACT_AGGRESSIVE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
            }

            events.Update(diff);

            uint32 eventId = events.GetEvent();
            if (!me->getVictim())
                UpdateVictim();

            switch(eventId)
            {
            case 0: break; // this is a must
            case EVENT_PURSUE:
                DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me);
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                {
                    if (pTarget->GetTypeId() == TYPEID_PLAYER || pTarget->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE))
                    {
                        me->AddAura(SPELL_PURSUED, pTarget);
                        me->MonsterTextEmote(EMOTE_PURSUE, pTarget->GetGUID(), true);
                    }
                }
                events.RepeatEvent(30*IN_MILLISECONDS);
                break;
            case EVENT_MISSILE:
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                    DoCast(pTarget, SPELL_MISSILE_BARRAGE);
                events.RepeatEvent(1500);
                break;
            case EVENT_VENT:
                DoCastAOE(SPELL_FLAME_VENTS);
                events.RepeatEvent(20*IN_MILLISECONDS);
                break;
            case EVENT_SPEED:
                DoCastAOE(SPELL_GATHERING_SPEED);
                events.RepeatEvent(15*IN_MILLISECONDS);
                break;
            case EVENT_SUMMON:
                if (summons.size() < 15) // 4seat+1turret+10lift
                    if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, 30.0f, 50.0f, 0))
                        pLift->GetMotionMaster()->MoveRandom(100);
                events.RepeatEvent(2*IN_MILLISECONDS);
                break;
            case EVENT_SHUTDOWN:
                DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me);
                InstallAdds(true);
                me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
                me->AddAura(SPELL_SYSTEMS_SHUTDOWN, me);
                me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
                events.CancelEvent(EVENT_SHUTDOWN);
                break;
            case EVENT_REPAIR:
                me->MonsterTextEmote(EMOTE_REPAIR, 0, true);
                me->ClearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
                InstallAdds(false);
                events.CancelEvent(EVENT_REPAIR);
                break;
            case EVENT_THORIM_S_HAMMER: // Tower of Storms
                for (uint8 i = 0; i < 7; ++i)
                {
                    if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, float(urand(20,60)), 20000, TEMPSUMMON_TIMED_DESPAWN))
                        pThorim->GetMotionMaster()->MoveRandom(100);
                }
                DoScriptText(SAY_TOWER_STORM, me);
                events.CancelEvent(EVENT_THORIM_S_HAMMER);
                break;
            case EVENT_MIMIRON_S_INFERNO: // Tower of Flames
                me->SummonCreature(MOB_MIMIRON_BEACON, 390.93f, -13.91f, 409.81f);
                DoScriptText(SAY_TOWER_FLAME, me);
                events.CancelEvent(EVENT_MIMIRON_S_INFERNO);
                break;
            case EVENT_HODIR_S_FURY:      // Tower of Frost
                for (uint8 i = 0; i < 7; ++i)
                {
                    if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0))
                        pHodir->GetMotionMaster()->MoveRandom(100);
                }
                DoScriptText(SAY_TOWER_FROST, me);
                events.CancelEvent(EVENT_HODIR_S_FURY);
                break;
            case EVENT_FREYA_S_WARD:    // Tower of Nature
                DoScriptText(SAY_TOWER_NATURE, me);
                StartFreyaEvent();
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                    DoCast(pTarget, SPELL_FREYA_S_WARD);
                events.CancelEvent(EVENT_FREYA_S_WARD);
                break;
            default:
                events.PopEvent();
                break;
            }
            /*if (me->IsWithinMeleeRange(me->getVictim())) //bugged spell casts on units that are boarded on leviathan
            DoSpellAttackIfReady(SPELL_BATTERING_RAM);*/
            DoMeleeAttackIfReady();
        }