Ejemplo n.º 1
0
        void UpdateAI(const uint32 /*diff*/)
        {
            if (!me->isInCombat())
            {
                if (Unit* owner = me->GetOwner())
                {
                    Player* plrOwner = owner->ToPlayer();
                    if (plrOwner && plrOwner->isInCombat())
                    {
                        if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == GHOSTS)
                            AttackStart(plrOwner->getAttackerForHelper());
                        else
                            FindMinions(owner);
                    }
                }
            }

            if (!UpdateVictim())
                return;

            //ScriptedAI::UpdateAI(diff);
            //Check if we have a current target
            if (me->getVictim()->GetEntry() == GHOSTS)
            {
                if (me->isAttackReady())
                {
                    //If we are within range melee the target
                    if (me->IsWithinMeleeRange(me->getVictim()))
                    {
                        me->AttackerStateUpdate(me->getVictim());
                        me->resetAttackTimer();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void UpdateAI(const uint32 /*diff*/) {
            if (!me->isInCombat()) {
                if (Unit *owner = me->GetOwner()) {
                    if (owner->GetTypeId() == TYPEID_PLAYER
                            && CAST_PLR(owner)->isInCombat()) {
                        if (CAST_PLR(owner)->getAttackerForHelper()
                                && CAST_PLR(owner)->getAttackerForHelper()->GetEntry()
                                        == GHOSTS) {
                            AttackStart(
                                    CAST_PLR(owner)->getAttackerForHelper());
                        } else {
                            FindMinions(owner);
                        }
                    }
                }
            }

            if (!UpdateVictim())
                return;

            //ScriptedAI::UpdateAI(diff);
            //Check if we have a current target
            if (me->getVictim()->GetEntry() == GHOSTS) {
                if (me->isAttackReady()) {
                    //If we are within range melee the target
                    if (me->IsWithinMeleeRange(me->getVictim())) {
                        me->AttackerStateUpdate(me->getVictim());
                        me->resetAttackTimer();
                    }
                }
            }
        }