Ejemplo n.º 1
0
        void IsSummonedBy(Unit* owner)
        {
            if (owner->GetTypeId() != TYPEID_UNIT)
                return;

            Creature* creOwner = owner->ToCreature();
            Position pos;
            // random target case
            if (!owner->HasAura(SPELL_BONE_STORM))
            {
                // select any unit but not the tank (by owners threatlist)
                Unit* target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -owner->GetObjectSize(), true, -SPELL_IMPALED);
                if (!target)
                    target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // or the tank if its solo
                if (!target)
                {
                    me->DespawnOrUnsummon();
                    return;
                }

                me->SetOrientation(me->GetAngle(target));
                owner->GetNearPosition(pos, owner->GetObjectSize()/2.0f, 0.0f);
            }
            else
            {
                MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, creOwner->AI());
                Position const* ownerPos = marrowgarAI->GetLastColdflamePosition();
                float ang = me->GetAngle(ownerPos) - static_cast<float>(M_PI);
                MapManager::NormalizeOrientation(ang);
                me->SetOrientation(ang);
                owner->GetNearPosition(pos, 2.5f, 0.0f);
            }

            me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
            if(IsHeroic())
                events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, urand(5000,10000));
            else
                events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 1000);
        }
Ejemplo n.º 2
0
            void IsSummonedBy(Unit* owner)
            {
                if (owner->GetTypeId() != TYPEID_UNIT)
                    return;
                Creature* creOwner = owner->ToCreature();
                DoCast(me, SPELL_COLDFLAME_PASSIVE, true);
                float x, y, z;
                // random target case
                if (!owner->HasAura(SPELL_BONE_STORM))
                {
                    // select any unit but not the tank (by owners threatlist)
                    Unit* target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f, true);
                    if (!target)
                        target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true); // or the tank if its solo
                    if (!target)
                    {
                        me->ForcedDespawn();
                        return;
                    }

                    target->GetPosition(x, y, z);
                    float scale = 70.0f / me->GetExactDist2d(x, y);
                    x = me->GetPositionX() + (x - me->GetPositionX()) * scale;
                    y = me->GetPositionY() + (y - me->GetPositionY()) * scale;
                }
                else
                {
                    me->GetPosition(x, y, z);
                    MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, creOwner->AI());
                    Position const* ownerPos = marrowgarAI->GetLastColdflamePosition();
                    float ang = me->GetAngle(ownerPos) - static_cast<float>(M_PI);
                    MapManager::NormalizeOrientation(ang);
                    x += 50.0f * cosf(ang);
                    y += 50.0f * sinf(ang);
                }
                me->GetMotionMaster()->MovePoint(POINT_TARGET_COLDFLAME, x, y, z);
                events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 400);
            }