void UpdateAI(uint32 diff)
        {
            moveTimer += diff;
            if (moveTimer >= 1000)
            {
                moveTimer = 0;
                Creature* Vorpil = ObjectAccessor::GetCreature(*me, VorpilGUID);
                if (!Vorpil)
                {
                    me->DespawnOrUnsummon();
                    return;
                }
                me->GetMotionMaster()->MoveFollow(Vorpil, 0.0f, 0.0f);

                if (sacrificed)
                {
                    me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS_N, SPELL_EMPOWERING_SHADOWS_H), Vorpil);
                    Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
                    me->CastSpell(me, SPELL_SHADOW_NOVA, true);
                    Unit::Kill(me, me);
                    return;
                }

                if (me->IsWithinDist(Vorpil, 3.0f))
                {
                    me->CastSpell(me, SPELL_SACRIFICE, false);
                    sacrificed = true;
                    moveTimer = 500;
                }
            }
        }
 void JustDied(Unit* /*who*/)
 {
     for (int ni=0; ni<3; ++ni)
     {
         Creature* sent = Unit::GetCreature(*me, NearbyGUID[ni]);
         if (!sent)
             continue;
         if (sent->isDead())
             continue;
         sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50)));
         CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
     }
 }
 void JustDied(Unit* /*killer*/) override
 {
     for (int ni = 0; ni < 3; ++ni)
     {
         Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]);
         if (!sent)
             continue;
         if (sent->isDead())
             continue;
         sent->ModifyHealth(int32(sent->CountPctFromMaxHealth(50)));
         ENSURE_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
     }
 }
 void Reset() {
     me->SetReactState(REACT_PASSIVE);
     if (oaf = (me->SummonCreature(NPC_LUMBERING_OAF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_MANUAL_DESPAWN)))
     {
       if (!me->GetVehicle() && oaf->IsVehicle() && oaf->GetVehicleKit()->HasEmptySeat(0))
       {
         me->EnterVehicle(oaf);
         oaf->SetReactState(REACT_AGGRESSIVE); 
         oaf->SetHealth(oaf->CountPctFromMaxHealth(100));
         oaf->GetMotionMaster()->MoveTargetedHome();
       }
     }
 }
        void UpdateAI(uint32 const diff)
        {
            if (!VorpilGUID)
            {
                me->Kill(me);
                return;
            }

            if (move <= diff)
            {
                Creature* Vorpil = Unit::GetCreature(*me, VorpilGUID);
                if (!Vorpil)
                {
                    VorpilGUID = 0;
                    return;
                }

                if (sacrificed)
                {
                    if (Vorpil->isAlive())
                    {
                        me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil);
                        Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
                    }
                    DoCast(me, SPELL_SHADOW_NOVA, true);
                    me->Kill(me);
                    return;
                }

                me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0);

                if (me->IsWithinDist(Vorpil, 3))
                {
                    DoCast(me, SPELL_SACRIFICE, false);
                    sacrificed = true;
                    move = 500;
                    return;
                }

                if (!Vorpil->isInCombat() || Vorpil->isDead())
                {
                    me->Kill(me);
                    return;
                }
                move = 1000;
            }
            else
                move -= diff;
        }
示例#6
0
        void UpdateAI(const uint32 diff)
        {
            if(!UpdateVictimWithGaze() || !CheckInRoom())
                return;

            if(me->GetDistance(me->GetHomePosition()) > 80.0f)
            {
                EnterEvadeMode();
                return;
            }

            events.Update(diff);

            while(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_WOUND:
                        DoCast(me->getVictim(), SPELL_MORTAL_WOUND);
                        events.ScheduleEvent(EVENT_WOUND, 10000);
                        break;
                    case EVENT_ENRAGE:
                        DoCast(me, SPELL_ENRAGE);
                        events.ScheduleEvent(EVENT_ENRAGE, 15000);
                        break;
                    case EVENT_DECIMATE:
                        DoCastAOE(SPELL_DECIMATE);
                        events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(120000,90000));

                        for(std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
                        {
                            Creature* minion = Unit::GetCreature(*me, *itr);
                            if(minion && minion->isAlive())
                            {
                                int32 damage = int32(minion->GetHealth()) - int32(minion->CountPctFromMaxHealth(5));
                                if(damage > 0)
                                    me->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, minion, true);

                                AttackGluth(minion);
                            }
                        }
                        break;
                    case EVENT_BERSERK:
                        if(!me->HasAura(SPELL_BERSERK))
                            DoCast(me, SPELL_BERSERK);
                        events.ScheduleEvent(EVENT_BERSERK, 1*60000);
                        break;
                    case EVENT_SUMMON:
                        for(int32 i = 0; i < RAID_MODE(1, 2); ++i)
                            DoSummon(MOB_ZOMBIE, PosSummon[rand() % RAID_MODE(1,3)]);
                        events.ScheduleEvent(EVENT_SUMMON, 10000);
                        break;
                }
            }

            if(me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE)
            {
                if(me->IsWithinMeleeRange(me->getVictim()))
                {
                    me->Kill(me->getVictim());
                    me->ModifyHealth(int32(me->CountPctFromMaxHealth(5)));
                }
            } else DoMeleeAttackIfReady();
        }