Example #1
0
void Position::RelocateOffset(const Position & offset)
{
    m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
    m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
    m_positionZ = GetPositionZ() + offset.GetPositionZ();
    SetOrientation(GetOrientation() + offset.GetOrientation());
}
Example #2
0
bool Position::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const
{
    // rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
    // is-in-cube check and we have to calculate only one point instead of 4

    // 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
    double rotation = 2 * M_PI - center.GetOrientation();
    double sinVal = std::sin(rotation);
    double cosVal = std::cos(rotation);

    float BoxDistX = GetPositionX() - center.GetPositionX();
    float BoxDistY = GetPositionY() - center.GetPositionY();

    float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
    float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);

    // box edges are parallel to coordiante axis, so we can treat every dimension independently :D
    float dz = GetPositionZ() - center.GetPositionZ();
    float dx = rotX - center.GetPositionX();
    float dy = rotY - center.GetPositionY();
    if ((std::fabs(dx) > xradius) ||
        (std::fabs(dy) > yradius) ||
        (std::fabs(dz) > zradius))
        return false;

    return true;
}
Example #3
0
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
{
    float dx = endPos.GetPositionX() - GetPositionX();
    float dy = endPos.GetPositionY() - GetPositionY();

    retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
    retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
    retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
    retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
}
            void MovementInform(uint32 type, uint32 id)
            {
                if (type != POINT_MOTION_TYPE)
                    return;

                switch (id)
                {
                    case 1:
                        phase = PHASE_GROUND;
                        events.SetPhase(PHASE_GROUND);
                        events.ScheduleEvent(EVENT_LAND, 0, 0, PHASE_GROUND);
                        break;
                    case 2:
                        me->SetFacingTo(RazorFlight.GetOrientation());
                        break;
                }
            }
Example #5
0
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (_phase == PHASE_GLOB && summons.empty())
            {
                DoResetThreat();
                me->NearTeleportTo(ViscidusCoord.GetPositionX(),
                                   ViscidusCoord.GetPositionY(),
                                   ViscidusCoord.GetPositionZ(),
                                   ViscidusCoord.GetOrientation());

                _hitcounter = 0;
                _phase = PHASE_FROST;
                InitSpells();
                me->SetVisible(true);
            }

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_POISONBOLT_VOLLEY:
                    DoCast(me, SPELL_POISONBOLT_VOLLEY);
                    events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000));
                    break;
                case EVENT_POISON_SHOCK:
                    DoCast(me, SPELL_POISON_SHOCK);
                    events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000));
                    break;
                case EVENT_RESET_PHASE:
                    _hitcounter = 0;
                    _phase = PHASE_FROST;
                    break;
                default:
                    break;
                }
            }

            if (_phase != PHASE_GLOB)
                DoMeleeAttackIfReady();
        }
 void MovementInform(uint32 type, uint32 id) override
 {
     if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
         return;
     
     switch (id)
     {
         case POINT_SLABHIDE_INTRO:
             me->SetFacingTo(SlabhideIntroLandPos.GetOrientation());
             me->GetMotionMaster()->MoveLand(POINT_SLABHIDE_INTRO_LAND, SlabhideIntroLandPos);
             break;
         case POINT_SLABHIDE_INTRO_LAND:
             me->SetCanFly(false);
             me->SetDisableGravity(false);
             me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
             me->SetHover(false);
             me->SetHomePosition(SlabhideIntroLandPos);
             me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
             me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
             me->SetReactState(REACT_AGGRESSIVE);
             instance->SetData(DATA_SLABHIDE_INTRO, DONE);
             break;
         case POINT_SLABHIDE_MIDDLE:
             _isFlying = true;
             events.ScheduleEvent(EVENT_TAKEOFF, 100);
             break;
         case POINT_SLABHIDE_IN_AIR:
             events.ScheduleEvent(EVENT_STALACTITE, 400);
             break;
         case POINT_SLABHIDE_LAND:
             _isFlying = false;
             //DoCast(me, SPELL_COOLDOWN_5S); // unknown purpose
             events.ScheduleEvent(EVENT_ATTACK, 1200);
             break;
         default:
             break;
     }
 }
Example #7
0
void Vehicle::Relocate(Position pos)
{
    sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", me->GetEntry());

    std::set<Unit*> vehiclePlayers;
    for (int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin();
            itr != vehiclePlayers.end(); ++itr)
    {
        if (Unit* player = (*itr))
        {
            // relocate/setposition doesn't work for player
            player->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(),
                    pos.GetPositionZ(), pos.GetOrientation());
        }
    }

    me->UpdatePosition(pos, true);
}
Example #8
0
        void UpdateAI( const uint32 diff)
        {
            if( bDialog) {
                if( dialogTimer <= diff) {
                    switch( dialogID) {

                    // COMIENZA_EL_EVENTO
                    case 0 :
                        me->MonsterYell( YELL_EVENT_BEGIN_HORDE_HIGH_OVERLORD_SAURFANG_0, LANG_UNIVERSAL, 0);
                        dialogID = 1;
                        dialogTimer = 2000;
                        break;
                    case 1 :
                        me->MonsterYell( YELL_EVENT_BEGIN_HORDE_HIGH_OVERLORD_SAURFANG_1, LANG_UNIVERSAL, 0);
                        dialogID = 2;
                        dialogTimer = 2000;
                        break;
                    case 2 :
                        me->MonsterYell( YELL_EVENT_BEGIN_HORDE_HIGH_OVERLORD_SAURFANG_2, LANG_UNIVERSAL, 0);
                        dialogID = 3;
                        dialogTimer = 2000;
                        break;
                    case 3 :
                        if( Creature* pMuradinBronzebeard = Unit::GetCreature(*me, instance->GetData64( NPC_MURADIN_BRONZEBEARD))) {
                            pMuradinBronzebeard->MonsterYell( YELL_EVENT_BEGIN_HORDE_MURADIN_BRONZEBEARD_0, LANG_UNIVERSAL, 0);
                            dialogID = 4;
                            dialogTimer = 2000;
                        }
                        break;
                    case 4 :
                        me->MonsterYell( YELL_EVENT_BEGIN_HORDE_HIGH_OVERLORD_SAURFANG_3, LANG_UNIVERSAL, 0);
                        dialogID = 5;
                        dialogTimer = 2000;
                        break;
                    case 5 :
                    {
                        Position tp = PosHighOverlordVarokSaurfang[1];
                        Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
                        if( !PlayerList.isEmpty()) {
                            for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) {
                                if( Player *pCurrent = i->getSource()) {
                                    if( me->GetDistance(pCurrent) <= 100.0f)
                                        DoTeleportPlayer( pCurrent, tp.GetPositionX(), tp.GetPositionY(), tp.GetPositionZ(), tp.GetOrientation());
                                }
                            }
                        }

                        me->UpdatePosition( tp, true);
                        dialogID = 6;
                        dialogTimer = 10000;
                    }
                    break;

                    // EMBARQUE_EVENTO
                    case 6 :
                        if( Creature* pMuradinBronzebeard = Unit::GetCreature(*me, instance->GetData64( NPC_MURADIN_BRONZEBEARD))) {
                            pMuradinBronzebeard->MonsterYell( YELL_BOARDING_ORGRIM_S_HAMMER_MURADIN_BRONZEBEARD_0, LANG_UNIVERSAL, 0);
                            dialogID = 7;
                            dialogTimer = 2000;
                        }
                        break;
                    case 7 :
                        me->MonsterYell( YELL_BOARDING_ORGRIM_S_HAMMER_HIGH_OVERLORD_SAURFANG_0, LANG_UNIVERSAL, 0);
                        dialogID = 8;
                        dialogTimer = 2000;
                        break;
                    case 8 :
                        // ? COMIENZO DE LA BATALLA DE LOS CANONES !


                        break;
                    };
                } else dialogTimer -= diff;
            }

            if( bBattleStart) {
                if (!UpdateVictim())
                    return;

                if( ( me->GetHealth() / me->GetMaxHealth()) <= 0.4) {
                    if( timer_TasteOfBlood <= diff) {
                        DoCast( me, SPELL_TASTE_OF_BLOOD);
                        timer_TasteOfBlood = 120000;
                    } else timer_TasteOfBlood -= diff;
                }

                if( timer_Cleave <= diff) {
                    DoCastVictim( SPELL_CLEAVE);
                    timer_Cleave = urand( 8000, 10000);
                } else timer_Cleave -= diff;

                if( timer_RendingThrow <= diff) {
                    DoCastVictim( SPELL_RENDING_THROW);
                    timer_RendingThrow = urand( 10000, 12000);
                } else timer_RendingThrow -= diff;

                DoMeleeAttackIfReady();
            }
        }
Example #9
0
        void DoAction(const int32 param)
        {
            switch( param) {
            case DO_ACTION_START_GUNSHIP_BATTLE :
                health_theSkybreaker = RAID_MODE( 600000, 1200000);
                health_ogrimsHammer = RAID_MODE( 600000, 1200000);

                instance->SetBossState( DATA_GUNSHIP_BATTLE_EVENT, NOT_STARTED);
                instance->SetData( DATA_GUNSHIP_EVENT, PHASE_NOT_STARTED);

                bDialog = true;
                dialogID = 0;
                dialogTimer = 0;
                break;

            case DO_ACTION_FINISH_GUNSHIP_BATTLE :
                Position tp = DeathbringerRise;
                Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
                if( !PlayerList.isEmpty()) {
                    for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) {
                        if( Player *pCurrent = i->getSource()) {
                            if( me->GetDistance(pCurrent) <= 100.0f)
                                DoTeleportPlayer( pCurrent, tp.GetPositionX(), tp.GetPositionY(), tp.GetPositionZ(), tp.GetOrientation());
                        }
                    }
                }
                break;
            };
        }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        if (uiSpawnTimer <= diff)
        {
            for (uint8 i = 0; i < urand(2,HEROIC(3,5)); ++i)
                DoSpawnCreature(RAND(NPC_DRAKKARI_INVADER_1,NPC_DRAKKARI_INVADER_2), AddSpawnPoint.GetPositionX(), AddSpawnPoint.GetPositionY(), AddSpawnPoint.GetPositionZ(), AddSpawnPoint.GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
            uiSpawnTimer = urand(30000,40000);
        } else uiSpawnTimer -= diff;

        if (uiConsumeTimer <= diff)
        {
            DoScriptText(SAY_CONSUME, m_creature);
            DoCast(HEROIC(SPELL_CONSUME, H_SPELL_CONSUME));
            uiConsumeTimer = 15000;
        } else uiConsumeTimer -= diff;

        if (bAchiev)
        {
            if (uiAuraCountTimer <= diff)
            {
                if (m_creature->HasAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)))
                {
                    Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME));
                    if (pConsumeAura && pConsumeAura->GetStackAmount() > 9)
                        bAchiev = false;
                }
                uiAuraCountTimer = 16000;
            } else uiAuraCountTimer -= diff;
        }

        if (uiCrushTimer <= diff)
        {
            DoCastVictim(SPELL_CRUSH);
            uiCrushTimer = urand(10000,15000);
        } else uiCrushTimer -= diff;

        if (uiInfectedWoundTimer <= diff)
        {
            DoCastVictim(SPELL_INFECTED_WOUND);
            uiInfectedWoundTimer = urand(25000,35000);
        } else uiInfectedWoundTimer -= diff;

        if (uiExplodeCorpseTimer <= diff)
        {
            DoCast(HEROIC(SPELL_CORPSE_EXPLODE, H_SPELL_CORPSE_EXPLODE));
            DoScriptText(SAY_EXPLODE, m_creature);
            uiExplodeCorpseTimer = urand(15000,19000);
        } else uiExplodeCorpseTimer -= diff;

        DoMeleeAttackIfReady();
    }
Example #11
0
            void UpdateAI(uint32 diff) override
            {
                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SELECT_TARGET:
                        {
                            std::vector<Player*> PlayerInDalaranList;
                            GetPlayersInDalaran(PlayerInDalaranList);

                            // Increases chance of event based on player count in Dalaran (100 players or more = 100% else player count%)
                            if (PlayerInDalaranList.empty() || urand(1, 100) > PlayerInDalaranList.size())
                                me->AddObjectToRemoveList();

                            me->SetVisible(true);
                            DoCastSelf(SPELL_TELEPORT_VISUAL);
                            if (Player* player = SelectTargetInDalaran(PlayerInDalaranList))
                            {
                                playerGuid = player->GetGUID();
                                Position pos = player->GetPosition();
                                float dist = frand(10.0f, 30.0f);
                                float angle = frand(0.0f, 1.0f) * M_PI * 2.0f;
                                player->MovePositionToFirstCollision(pos, dist, angle);
                                me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
                            }
                            events.ScheduleEvent(EVENT_LAUGH_1, Seconds(2));
                            break;
                        }
                        case EVENT_LAUGH_1:
                            me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH_NO_SHEATHE);
                            events.ScheduleEvent(EVENT_WANDER, 3s);
                            break;
                        case EVENT_WANDER:
                            me->GetMotionMaster()->MoveRandom(8);
                            events.ScheduleEvent(EVENT_PAUSE, 1min);
                            break;
                        case EVENT_PAUSE:
                            me->GetMotionMaster()->MoveIdle();
                            events.ScheduleEvent(EVENT_CAST, 2s);
                            break;
                        case EVENT_CAST:
                            if (Player* player = me->GetMap()->GetPlayer(playerGuid))
                            {
                                DoCast(player, SPELL_MANABONKED);
                                SendMailToPlayer(player);
                            }
                            else
                                me->AddObjectToRemoveList();

                            events.ScheduleEvent(EVENT_LAUGH_2, Seconds(8));
                            break;
                        case EVENT_LAUGH_2:
                            me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH_NO_SHEATHE);
                            events.ScheduleEvent(EVENT_BLINK, 3s);
                            break;
                        case EVENT_BLINK:
                            DoCastSelf(SPELL_IMPROVED_BLINK);
                            events.ScheduleEvent(EVENT_DESPAWN, 4s);
                            break;
                        case EVENT_DESPAWN:
                            me->AddObjectToRemoveList();
                            break;
                        default:
                            break;
                    }
                }
            }
Example #12
0
        void UpdateAI(const uint32 p_Diff) override
        {
            events.Update(p_Diff);

            if (m_DownDraft)
            {
                if (m_DownDraftDiffCancel <= p_Diff)
                {
                    m_DownDraft = false;

                    m_DownDraftDiffCancel = 10000;
                }
                else
                    m_DownDraftDiffCancel -= p_Diff;

                if (m_DownDraftDiff <= p_Diff)
                {
                    std::list<Player*> l_PlayerListDown;
                    me->GetPlayerListInGrid(l_PlayerListDown, 50.0f);

                    if (l_PlayerListDown.empty())
                        return;

                    for (auto itr : l_PlayerListDown)
                    {
                        if (!itr->HasAura(133755))
                        itr->CastSpell(itr, 133331);
                        //itr->GetMotionMaster()->MoveKnockbackFrom(itr->GetPositionX(), itr->GetPositionY(), 6.0f, 3.0f);
                    }

                    m_DownDraftDiff = 3700;
                }
                else
                    m_DownDraftDiff -= p_Diff;
            }

            if (!UpdateVictim())
                return;

            if (me->HasUnitState(UnitState::UNIT_STATE_CASTING))
                return;

            switch (events.ExecuteEvent())
            {
                case eJiKunEvents::EventEnrage:
                    me->CastSpell(me, eJiKunSpells::SpellEnrage);
                    break;
                case eJiKunEvents::EventCaw:
                    InformPlayers("Ji Kun is casting Caw, SPREAD OUT!");

                    if (Unit * l_Random = SelectTarget(SelectAggroTarget::SELECT_TARGET_RANDOM, 0, 45.0f, true))
                        me->CastSpell(l_Random, eJiKunSpells::SpellCaw);

                    events.ScheduleEvent(eJiKunEvents::EventCaw, 25 * TimeConstants::IN_MILLISECONDS);
                    break;
                case eJiKunEvents::EventQuills:
                    me->CastSpell(me, eJiKunSpells::SpellQuills);

                    InformPlayers("Ji Kun sends her[Quils] flying in every direction");

                    events.ScheduleEvent(eJiKunEvents::EventQuills, 45 * TimeConstants::IN_MILLISECONDS);
                    break;
                case eJiKunEvents::EventInfectedTalon:
                    if (Unit * l_Random = SelectTarget(SelectAggroTarget::SELECT_TARGET_RANDOM, 0, 100.0f, true))
                        me->CastSpell(l_Random, eJiKunSpells::SpellInfectedTalonAura);

                    events.ScheduleEvent(eJiKunEvents::EventInfectedTalon, 10 * TimeConstants::IN_MILLISECONDS);
                    break;
                case eJiKunEvents::EventTalonRake:
                    if (Unit * l_Victim = me->getVictim())
                    {
                        me->CastSpell(l_Victim, eJiKunSpells::SpellInfectedTalonAura);
                        me->CastSpell(l_Victim, eJiKunSpells::SpellTalonRake);
                    }

                    events.ScheduleEvent(eJiKunEvents::EventTalonRake, 58 * TimeConstants::IN_MILLISECONDS);
                    break;
                case eJiKunEvents::EventDownDraft:
                    m_DownDraft = true;
                    m_DownDraftDiff = 3000;
                    m_DownDraftDiffCancel = 10000;
                    me->CastSpell(me, eJiKunSpells::SpellDownDraft);

 
                    InformPlayers("Ji Kun uses her wings to create a massive [Down Draft]!");
                    events.ScheduleEvent(eJiKunEvents::EventDownDraft, 80 * TimeConstants::IN_MILLISECONDS);
                    break;
                case eJiKunEvents::EventDownDraftDis:
                    m_DownDraft = false;
                    break;
                case eJiKunEvents::EventFeedPool:
                    me->CastSpell(me, eJiKunSpells::SpellFeedYoung);
              
                    events.ScheduleEvent(eJiKunEvents::EventFeedPool, 38 * TimeConstants::IN_MILLISECONDS);
                    break;
                    // Eggs
                case eJiKunEvents::EventYoungEgg:
                {                  
                    m_Count++;

                    GameObject* beacon = NULL;

                    if (m_Count == 8)
                        m_Count = 0;

                    switch (m_Count)
                    {
                        case 0:
                            beacon = me->SummonGameObject(148937, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionZ(), l_PositionLowBottom.GetOrientation(), 0,0,0,0,0);
                            
                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            for (int i = 0; i < 7; i++)
                            {
                                me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionLowBottom.GetPositionX() + i, l_PositionLowBottom.GetPositionY() + i, l_PositionLowBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            }
                            break;
                        case 1:
                            beacon = me->SummonGameObject(148937, l_PositionTopBottom.GetPositionX(), l_PositionTopBottom.GetPositionY(), l_PositionTopBottom.GetPositionZ(), l_PositionTopBottom.GetOrientation(), 0, 0, 0, 0, 0);

                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            for (int i = 0; i < 7; i++)
                            {
                                me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionTopBottom.GetPositionX() + i, l_PositionTopBottom.GetPositionY() + i, l_PositionTopBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            }
                            break;
                        case 2:
                            beacon = me->SummonGameObject(148937, l_PositionMidBottom.GetPositionX(), l_PositionMidBottom.GetPositionY(), l_PositionMidBottom.GetPositionZ(), l_PositionMidBottom.GetOrientation(), 0, 0, 0, 0, 0);

                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            for (int i = 0; i < 7; i++)
                            {
                                me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionMidBottom.GetPositionX() + i, l_PositionMidBottom.GetPositionY() + i, l_PositionMidBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            }
                            break;
                        case 3:
                            beacon = me->SummonGameObject(148937, l_PositionTopTop.GetPositionX(), l_PositionTopTop.GetPositionY(), l_PositionTopTop.GetPositionZ(), l_PositionTopTop.GetOrientation(), 0, 0, 0, 0, 0);
                            InformPlayers("Ji Kun spawn Hatchlings in the upper nests!");

                            me->SummonCreature(CreatureMatureEggOfJiKun, l_PositionTopTop.GetPositionX(), l_PositionTopTop.GetPositionY(), l_PositionTopTop.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            break;
                        case 4:
                            beacon = me->SummonGameObject(148937, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionZ(), l_PositionLowBottom.GetOrientation(), 0, 0, 0, 0, 0);

                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            for (int i = 0; i < 7; i++)
                            {
                                me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionLowBottom.GetPositionX() + i, l_PositionLowBottom.GetPositionY() + i, l_PositionLowBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            }
                            break;
                        case 5:
                            InformPlayers("Ji Kun spawn Hatchlings in the upper nests!");


                            beacon = me->SummonGameObject(148937, l_PositionMidTop.GetPositionX(), l_PositionMidTop.GetPositionY(), l_PositionMidTop.GetPositionZ(), l_PositionMidTop.GetOrientation(), 0, 0, 0, 0, 0);

                            me->SummonCreature(CreatureMatureEggOfJiKun, l_PositionMidTop.GetPositionX(), l_PositionMidTop.GetPositionY(), l_PositionMidTop.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            break;
                        case 6:
                            InformPlayers("Ji Kun spawn Hatchlings in the upper nests!");

                            beacon = me->SummonGameObject(148937, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionZ(), l_PositionLowBottom.GetOrientation(), 0, 0, 0, 0, 0);

                            me->SummonCreature(CreatureMatureEggOfJiKun, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionY(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            break;
                        case 7:
                            beacon = me->SummonGameObject(148937, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionZ(), l_PositionLowBottom.GetOrientation(), 0, 0, 0, 0, 0);

                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            for (int i = 0; i < 7; i++)
                            {
                                me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionLowBottom.GetPositionX() + i, l_PositionLowBottom.GetPositionY() + i, l_PositionLowBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            }
                            break;
                        case 8:
                            InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");

                            beacon = me->SummonGameObject(148937, l_PositionMidTop.GetPositionX(), l_PositionMidTop.GetPositionY(), l_PositionMidTop.GetPositionZ(), l_PositionMidTop.GetOrientation(), 0, 0, 0, 0, 0);

                            me->SummonCreature(CreatureMatureEggOfJiKun, l_PositionMidTop.GetPositionX(), l_PositionMidTop.GetPositionY(), l_PositionMidTop.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
                            break;                        
                    }

                    if (beacon)
                        me->m_Events.AddEvent(new ji_kun_delete_beacons(beacon, 0), me->m_Events.CalculateTime(7000));

                    events.ScheduleEvent(eJiKunEvents::EventYoungEgg, 40 * TimeConstants::IN_MILLISECONDS);
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
        /// @todo this should be handled in map, maybe add a summon function in map
        // There is no other way afaik...
        void SpawnGameObject(uint32 entry, Position const& pos)
        {
            GameObject* go = new GameObject();
            if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
                PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
                0, 0, 0, 0, 120, GO_STATE_READY))
            {
                delete go;
                return;
            }

            instance->AddToMap(go);
        }
Example #14
0
        void UpdateAI(const uint32 uiDiff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2)
                return;

            if (uiTeleportTimer <= uiDiff)
            {
                me->InterruptNonMeleeSpells(false);
                DoScriptText(SAY_TELEPORT, me);
                me->GetMotionMaster()->MoveIdle();
                DoCast(SPELL_TELEPORT);
                uiTeleportTimer = urand(30000, 35000);
            } else uiTeleportTimer -= uiDiff;

            if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
            {
                if (uiCastArcaneExplosionTimer <= uiDiff)
                {
                    bCanCast = false;
                    bCanGoBack = true;
                    DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
                    uiCastArcaneExplosionTimer = 2000;
                }else uiCastArcaneExplosionTimer -= uiDiff;
            }

            if (bCanGoBack)
            {
                if (uiArcaneExplosionTimer <= uiDiff)
                {
                    Position pPos;
                    me->getVictim()->GetPosition(&pPos);

                    me->NearTeleportTo(pPos.GetPositionX(), pPos.GetPositionY(), pPos.GetPositionZ(), pPos.GetOrientation());
                    me->GetMotionMaster()->MoveChase(me->getVictim(), 0, 0);
                    me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);

                    bCanCast = false;
                    bCanGoBack = false;
                    uiArcaneExplosionTimer = 9000;
                } else uiArcaneExplosionTimer -= uiDiff;
            }

            if (!me->IsNonMeleeSpellCasted(false, true, true))
            {
                if (uiFrostBombTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_FROSTBOMB);
                    uiFrostBombTimer = urand(5000, 8000);
                } else uiFrostBombTimer -= uiDiff;

                if (uiTimeBombTimer <= uiDiff)
                {
                    if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM))
                        DoCast(pUnit, SPELL_TIME_BOMB);

                    uiTimeBombTimer = urand(20000, 25000);
                } else uiTimeBombTimer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
Example #15
0
 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
 {
     player->PlayerTalkClass->ClearMenus();
     switch (action)
     {
         case GOSSIP_ACTION_INFO_DEF+1:
             player->CLOSE_GOSSIP_MENU();
             CAST_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1;
             if (InstanceScript* instance = creature->GetInstanceScript())
                 instance->SetData(DATA_MAIN_EVENT_PHASE, SPECIAL);
             break;
         case GOSSIP_ACTION_INFO_DEF+2:
             player->SEND_GOSSIP_MENU(13854, creature->GetGUID());
             break;
         case GOSSIP_ACTION_INFO_DEF+3:
             player->NearTeleportTo(playerTeleportPosition.GetPositionX(), playerTeleportPosition.GetPositionY(), playerTeleportPosition.GetPositionZ(), playerTeleportPosition.GetOrientation(), true);
             player->CLOSE_GOSSIP_MENU();
             break;
     }
     return true;
 }
Example #16
0
void AreaTrigger::UpdateCircularMovementPosition(uint32 /*diff*/)
{
    if (_circularMovementInfo->StartDelay > GetElapsedTimeForMovement())
        return;

    _circularMovementInfo->ElapsedTimeForMovement = GetElapsedTimeForMovement() - _circularMovementInfo->StartDelay;

    Position pos = CalculateCircularMovementPosition();

    GetMap()->AreaTriggerRelocation(this, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
#ifdef TRINITY_DEBUG
    DebugVisualizePosition();
#endif
}
        void UpdateAI(const uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (bIsWaitingToAppear)
            {
                me->StopMoving();
                me->AttackStop();
                if (uiIsWaitingToAppearTimer <= diff)
                {
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    bIsWaitingToAppear = false;
                } else uiIsWaitingToAppearTimer -= diff;
                return;
            }

            if ((Phase == 1) ||(Phase == 3))
            {
                if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
                {
                    for (uint8 n = 0; n < 3; ++n)
                        time[n] = 0;
                    me->GetMotionMaster()->Clear();
                    me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
                    DoCast(me, SPELL_TELESTRA_BACK);
                    me->SetVisible(true);
                    if (Phase == 1)
                        Phase = 2;
                    if (Phase == 3)
                        Phase = 4;
                    uiFireMagusGUID = 0;
                    uiFrostMagusGUID = 0;
                    uiArcaneMagusGUID = 0;
                    bIsWaitingToAppear = true;
                    uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
                    Talk(SAY_MERGE);
                }
                else
                    return;
            }

            if ((Phase == 0) && HealthBelowPct(50))
            {
                Phase = 1;
                me->CastStop();
                me->RemoveAllAuras();
                me->SetVisible(false);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
                uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
                uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
                bFireMagusDead = false;
                bFrostMagusDead = false;
                bArcaneMagusDead = false;
                Talk(SAY_SPLIT);
                return;
            }

            if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
            {
                Phase = 3;
                me->CastStop();
                me->RemoveAllAuras();
                me->SetVisible(false);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
                uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
                uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
                bFireMagusDead = false;
                bFrostMagusDead = false;
                bArcaneMagusDead = false;
                Talk(SAY_SPLIT);
                return;
            }

            if (uiCooldown)
            {
                if (uiCooldown <= diff)
                    uiCooldown = 0;
                else
                {
                    uiCooldown -= diff;
                    return;
                }
            }

            if (uiIceNovaTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                {
                    DoCast(target, SPELL_ICE_NOVA, false);
                    uiCooldown = 1500;
                }
                uiIceNovaTimer = 15*IN_MILLISECONDS;
            } else uiIceNovaTimer -= diff;

            if (uiGravityWellTimer <= diff)
            {
                if (Unit* target = me->GetVictim())
                {
                    DoCast(target, SPELL_GRAVITY_WELL);
                    uiCooldown = 6*IN_MILLISECONDS;
                }
                uiGravityWellTimer = 15*IN_MILLISECONDS;
            } else uiGravityWellTimer -= diff;

            if (uiFireBombTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                {
                    DoCast(target, SPELL_FIREBOMB, false);
                    uiCooldown = 2*IN_MILLISECONDS;
                }
                uiFireBombTimer = 2*IN_MILLISECONDS;
            } else uiFireBombTimer -=diff;

            DoMeleeAttackIfReady();
        }
            void UpdateAI(const uint32 diff)
            {
                if (!UpdateVictim())
                    return;

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

                events.Update(diff);

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

                if (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_CHECK_DISTANCE:
                            if (me->GetDistance(me->GetHomePosition()) > 150.0f)
                            {
                                events.Reset();
                                EnterEvadeMode();
                                return;
                            }
                            events.ScheduleEvent(EVENT_CHECK_DISTANCE, 5000);
                            break;
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK);
                            break;
                        case EVENT_FOCUSED_ANGER:
                            DoCast(me, SPELL_FOCUSED_ANGER);
                            events.ScheduleEvent(EVENT_FOCUSED_ANGER, 6500);
                            break;
                        case EVENT_PSYCHIC_DRAIN:
                            DoCastVictim(SPELL_PSYCHIC_DRAIN);
                            events.ScheduleEvent(EVENT_PSYCHIC_DRAIN, urand(20000, 25000));
                            break;
                        case EVENT_DISRUPTING_SHADOWS:
                            Talk(SAY_SHADOWS);
                            Talk(SAY_SHADOWS_1);
                            me->CastCustomSpell(SPELL_DISRUPTING_SHADOWS, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8, 3, 8), me);
                            events.ScheduleEvent(EVENT_DISRUPTING_SHADOWS, urand(25000, 30000));
                            break;
                        case EVENT_VOID_OF_THE_UNMAKING:
                            summons.DespawnEntry(NPC_VOID_OF_THE_UNMAKING_1);
                            Talk(SAY_VOID);
                            Talk(SAY_VOID_1);
                            DoCast(me, SPELL_VOID_OF_THE_UNMAKING_SUMMON_1);
                            events.ScheduleEvent(EVENT_VOID_OF_THE_UNMAKING, 90300);
                            break;
                        case EVENT_TANTRUM_1:
                            me->SetReactState(REACT_PASSIVE);
                            me->AttackStop();
                            me->NearTeleportTo(centerPos.GetPositionX(), centerPos.GetPositionY(), centerPos.GetPositionZ(), centerPos.GetOrientation());
                            events.ScheduleEvent(EVENT_TANTRUM_2, 3000);
                            break;
                        case EVENT_TANTRUM_2:
                            Talk(SAY_BLOOD);
                            Talk(SAY_BLOOD_1);
                            DoCast(me, SPELL_DARKNESS, true);
                            if (!IsHeroic())
                                DoCast(me, SPELL_BLACK_BLOOD_OF_GORATH_SELF, true);
                            DoCast(me, SPELL_TANTRUM);
                            switch (GetDifficulty())
                            {
                                case MAN10_DIFFICULTY:
                                    SpawnRandomTentacles(4, 0, 0);
                                    break;                                    
                                case MAN25_DIFFICULTY:
                                    SpawnRandomTentacles(8, 0, 0);
                                    break;
                                case MAN10_HEROIC_DIFFICULTY:
                                    SpawnRandomTentacles(4, 2, 1);
                                    break;
                                case MAN25_HEROIC_DIFFICULTY:
                                    SpawnRandomTentacles(8, 4, 2);
                                    break;
                                default:
                                    break;
                            }
                            events.ScheduleEvent(EVENT_END_TANTRUM_1, 11000);
                            events.ScheduleEvent(EVENT_END_TANTRUM_2, 30000);
                            break;
                        case EVENT_END_TANTRUM_1:
                            me->SetReactState(REACT_AGGRESSIVE);
                            AttackStart(me->getVictim());
                            break;
                        case EVENT_END_TANTRUM_2:
                            if (!IsHeroic())
                                summons.DespawnEntry(NPC_EYE_OF_GORATH);
                            me->RemoveAura(RAID_MODE(SPELL_VOID_OF_THE_UNMAKING_PREVENT, SPELL_VOID_OF_THE_UNMAKING_PREVENT_25, SPELL_VOID_OF_THE_UNMAKING_PREVENT_10H, SPELL_VOID_OF_THE_UNMAKING_PREVENT_25H));
                            events.ScheduleEvent(EVENT_VOID_OF_THE_UNMAKING, urand(13000, 14000));
                            events.ScheduleEvent(EVENT_FOCUSED_ANGER, 6000);
                            events.ScheduleEvent(EVENT_DISRUPTING_SHADOWS, 6000);
                            events.ScheduleEvent(EVENT_PSYCHIC_DRAIN, 21000);
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Example #19
0
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                if (platform < 3)
                    return;

                events.Update(diff);

                if (teleportTimer <= diff)
                {
                    me->InterruptNonMeleeSpells(false);
                    me->GetMotionMaster()->MoveIdle();
                    DoCast(SPELL_TELEPORT);
                    teleportTimer = urand(30000, 35000);
                }
                else
                    teleportTimer -= diff;

                if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
                {
                    if (castArcaneExplosionTimer <= diff)
                    {
                        canCast = false;
                        canGoBack = true;
                        DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
                        castArcaneExplosionTimer = 2000;
                    }
                    else
                        castArcaneExplosionTimer -= diff;
                }

                if (canGoBack)
                {
                    if (arcaneExplosionTimer <= diff)
                    {
                        if (me->GetVictim())
                        {
                            Position pos = me->EnsureVictim()->GetPosition();

                            me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
                            me->GetMotionMaster()->MoveChase(me->GetVictim());
                        }
                        me->SetWalk(true);

                        Talk(EMOTE_ARCANE_EXPLOSION);
                        Talk(SAY_ARCANE_EXPLOSION);

                        canCast = false;
                        canGoBack = false;
                        arcaneExplosionTimer = 9000;
                    }
                    else
                        arcaneExplosionTimer -= diff;
                }

                if (!me->IsNonMeleeSpellCast(false, true, true))
                {
                    if (frostBombTimer <= diff)
                    {
                        DoCastVictim(SPELL_FROSTBOMB);
                        frostBombTimer = urand(5000, 8000);
                    }
                    else
                        frostBombTimer -= diff;

                    if (timeBombTimer <= diff)
                    {
                        if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM))
                            DoCast(unit, SPELL_TIME_BOMB);

                        timeBombTimer = urand(20000, 25000);
                    }
                    else
                        timeBombTimer -= diff;
                }

                DoMeleeAttackIfReady();
            }
        bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/)
        {
            switch (_eventId)
			{
				case 1:
					_owner.UpdatePosition(5300.53f, 1987.80f, 707.70f, 3.89f, true);
					_owner.StopMovingOnCurrentPos();
					_owner.GetMotionMaster()->Clear();
					_owner.SetVisible(true);
					_owner.NearTeleportTo(5300.53f, 1987.80f, 707.70f, 3.89f);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 2), _owner.m_Events.CalculateTime(1000));
					break;
				case 2:
					_owner.AI()->Talk(SAY_BATTERED_HILT_HALT);
					break;
				case 3:
					_owner.CastSpell((Unit*)NULL, 69966, true);
					_owner.AI()->Talk(SAY_BATTERED_HILT_REALIZE);
					if (InstanceScript* instance = _owner.GetInstanceScript())
						instance->SetData(DATA_BATTERED_HILT, 4);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 4), _owner.m_Events.CalculateTime(3500));
					break;
				case 4:
					_owner.SetWalk(false);
					_owner.GetMotionMaster()->MovePoint(0, 5337.53f, 1981.21f, 709.32f);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 5), _owner.m_Events.CalculateTime(6000));
					break;
				case 5:
					_owner.SetFacingTo(2.82f);
					_owner.SetStandState(UNIT_STAND_STATE_KNEEL);
					break;
				case 6:
					if (InstanceScript* instance = _owner.GetInstanceScript())
						instance->SetData(DATA_BATTERED_HILT, 6);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 7), _owner.m_Events.CalculateTime(2000));
					break;
				case 7:
					if (InstanceScript* instance = _owner.GetInstanceScript())
						instance->SetData(DATA_BATTERED_HILT, 7);
					_owner.AI()->Talk(SAY_BATTERED_HILT_PREPARE);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 8), _owner.m_Events.CalculateTime(4000));
					break;
				case 8:
					_owner.SetReactState(REACT_AGGRESSIVE);
					_owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
					if (InstanceScript* instance = _owner.GetInstanceScript())
						instance->SetData(DATA_BATTERED_HILT, 8);
					break;
				case 9:
					_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO1);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(11000));
					break;
				case 10:
					_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO2);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(7500));
					break;
				case 11:
					_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO3);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(8000));
					break;
				case 12:
					_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO4);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(5000));
					break;
				case 13:
					_owner.CastSpell((Unit*)NULL, 73036, true);
					_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(3000));
					break;
				case 14:
					{
						Position homePos = _owner.GetHomePosition();
						_owner.SetReactState(REACT_PASSIVE);
						_owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
						_owner.SetVisible(false);
						_owner.UpdatePosition(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation(), true);
						_owner.StopMovingOnCurrentPos();
						_owner.GetMotionMaster()->Clear();
						if (InstanceScript* instance = _owner.GetInstanceScript())
							instance->SetData(DATA_BATTERED_HILT, 9);
					}
					break;
			}
            return true;
        }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        if (bIsWaitingToAppear)
        {
            me->StopMoving();
            me->AttackStop();
            if (uiIsWaitingToAppearTimer <= diff)
            {
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                bIsWaitingToAppear = false;
            } else uiIsWaitingToAppearTimer -= diff;
            return;
        }

        if ((Phase == 1) ||(Phase == 3))
        {
            if (bIsAchievementTimerRunning)
                uiAchievementTimer += diff;
            if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
            {
                if (uiAchievementTimer <= ACHIEV_TIMER)
                    uiAchievementProgress +=1;
                me->GetMotionMaster()->Clear();
                me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
                DoCast(me, SPELL_TELESTRA_BACK);
                me->SetVisibility(VISIBILITY_ON);
                if (Phase == 1)
                    Phase = 2;
                if (Phase == 3)
                    Phase = 4;
                uiFireMagusGUID = 0;
                uiFrostMagusGUID = 0;
                uiArcaneMagusGUID = 0;
                bIsWaitingToAppear = true;
                uiIsWaitingToAppearTimer = 4*IN_MILISECONDS;
                DoScriptText(SAY_MERGE, me);
                bIsAchievementTimerRunning = false;
                uiAchievementTimer = 0;
            }
            else
                return;
        }

        if ((Phase == 0) && HealthBelowPct(50))
        {
            Phase = 1;
            me->CastStop();
            me->RemoveAllAuras();
            me->SetVisibility(VISIBILITY_OFF);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
            uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
            uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
            bFireMagusDead = false;
            bFrostMagusDead = false;
            bArcaneMagusDead = false;
            DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me);
            return;
        }

        if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
        {
            Phase = 3;
            me->CastStop();
            me->RemoveAllAuras();
            me->SetVisibility(VISIBILITY_OFF);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
            uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
            uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
            bFireMagusDead = false;
            bFrostMagusDead = false;
            bArcaneMagusDead = false;
            DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me);
            return;
        }

        if (uiCooldown)
        {
            if (uiCooldown <= diff)
                uiCooldown = 0;
            else
            {
                uiCooldown -= diff;
                return;
            }
        }

        if (uiIceNovaTimer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                DoCast(pTarget, SPELL_ICE_NOVA, false);
                uiCooldown = 1.5*IN_MILISECONDS;
            }
            uiIceNovaTimer = 15*IN_MILISECONDS;
        } else uiIceNovaTimer -= diff;

        if (uiGravityWellTimer <= diff)
        {
            if (Unit *pTarget = me->getVictim())
            {
                DoCast(pTarget, SPELL_GRAVITY_WELL);
                uiCooldown = 6*IN_MILISECONDS;
            }
            uiGravityWellTimer = 15*IN_MILISECONDS;
        } else uiGravityWellTimer -= diff;

        if (uiFireBombTimer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                DoCast(pTarget, SPELL_FIREBOMB, false);
                uiCooldown = 2*IN_MILISECONDS;
            }
            uiFireBombTimer = 2*IN_MILISECONDS;
        } else uiFireBombTimer -=diff;

        DoMeleeAttackIfReady();
    }
    void SummonHiFirepawHelper(Player* summoner, uint32 entry)
    {
        uint32 phase = summoner->GetPhaseMask();
        uint32 team = summoner->GetTeam();
        Position pos;

        summoner->GetPosition(&pos);

        Guardian* summon = new Guardian(NULL, summoner, false);

        if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), summoner->GetMap(), phase, entry, 0, team, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()))
        {
            delete summon;
            return;
        }



        summon->SetHomePosition(pos);
        summon->InitStats(0);
        summoner->GetMap()->AddToMap(summon->ToCreature());
        summon->InitSummon();
        summon->InitStatsForLevel(10);
        summon->SetFollowAngle(summoner->GetAngle(summon));
        summon->SetReactState(REACT_AGGRESSIVE);

    }
Example #23
0
void MotionMaster::MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id/* = EVENT_JUMP*/, bool hasOrientation/* = false*/)
{
    MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), speedXY, speedZ, id, hasOrientation);
}
            void UpdateAI(uint32 diff)
            {
                if (!UpdateVictim())
                    return;

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

                events.Update(diff);

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

                if (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK);
                            break;
                        case EVENT_VOID_BOLT:
                            if (bShuma)
                                DoCastAOE(SPELL_VOID_BOLT_AOE);
                            else
                                DoCastVictim(SPELL_VOID_BOLT);

                            events.ScheduleEvent(EVENT_VOID_BOLT, (bShuma ? 5000 : 9000));
                            break;
                        case EVENT_CALL_BLOOD_1:
                            events.CancelEvent(EVENT_VOID_BOLT);
                            events.CancelEvent(EVENT_SEARING_BLOOD);
                            events.CancelEvent(EVENT_DIGESTIVE_ACID);
                            events.CancelEvent(EVENT_CORRUPTED_MINIONS);
                            events.CancelEvent(EVENT_DEEP_CORRUPTION);
                            events.CancelEvent(EVENT_MANA_VOID_1);
                            events.CancelEvent(EVENT_MANA_VOID_2);
                            me->RemoveAura(SPELL_CRIMSON_BLOOD_OF_SHUMA);
                            me->RemoveAura(SPELL_ACIDIC_BLOOD_OF_SHUMA);
                            me->RemoveAura(SPELL_GLOWING_BLOOD_OF_SHUMA);
                            me->RemoveAura(SPELL_BLACK_BLOOD_OF_SHUMA);
                            me->RemoveAura(SPELL_SHADOWED_BLOOD_OF_SHUMA);
                            me->RemoveAura(SPELL_COBALT_BLOOD_OF_SHUMA);

                            me->SetReactState(REACT_PASSIVE);
                            me->AttackStop();

                            bContinue = false;
                            bShuma = false;

                            events.ScheduleEvent(EVENT_CALL_BLOOD_2, 1000);

                            me->NearTeleportTo(centerPos.GetPositionX(), centerPos.GetPositionY(), centerPos.GetPositionZ(), centerPos.GetOrientation());
                            break;
                        case EVENT_CALL_BLOOD_2:
                        {
                            Talk(SAY_SPELL);
                            Talk(SAY_SPELL_1);
                            DoCastAOE(SPELL_YORSAHJ_WHISPER_SPELL, true);

                            std::list<uint32> globList;
                            _spellId = 0;
                            uint8 i = 0;
                            SelectRandomGlobules(_spellId, globList);
                            if (globList.empty() || !_spellId)
                                break;

                            for (std::list<uint32>::const_iterator itr = globList.begin(); itr != globList.end(); ++itr)
                            {
                                switch ((*itr))
                                {
                                    case NPC_CRIMSON_GLOBULE: i = 0; break;
                                    case NPC_ACIDIC_GLOBULE: i = 1; break;
                                    case NPC_GLOWING_GLOBULE: i = 2;break;
                                    case NPC_DARK_GLOBULE: i = 3; break;
                                    case NPC_SHADOWED_GLOBULE: i = 4; break;
                                    case NPC_COBALT_GLOBULE: i = 5; break;
                                    default: return;
                                }

                                if (Creature* pGlobule = me->SummonCreature((*itr), globulesPos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000))
                                {
                                    pGlobule->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                    pGlobule->SetDisplayId(11686);
                                }
                            }
                            events.ScheduleEvent(EVENT_CALL_BLOOD_3, 1000);
                            break;
                        }
                        case EVENT_CALL_BLOOD_3:
                            DoCast(me, _spellId);
                            break;
                        case EVENT_CONTINUE:
                        {
                            std::list<Creature*> creatures;
                            GlobulesCheck checker;
                            Trinity::CreatureListSearcher<GlobulesCheck> searcher(me, creatures, checker);
                            me->VisitNearbyObject(100.0f, searcher);

                            if (!creatures.empty())
                            {
                                for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
                                {
                                    switch ((*itr)->GetEntry())
                                    {
                                        case NPC_CRIMSON_GLOBULE: 
                                            DoCast(me, SPELL_CRIMSON_BLOOD_OF_SHUMA, true); 
                                            events.ScheduleEvent(EVENT_SEARING_BLOOD, urand(5000, 7000));
                                            break;
                                        case NPC_ACIDIC_GLOBULE: 
                                            me->SummonCreature(NPC_MAW_OF_SHUMA, mawofshumaPos, TEMPSUMMON_TIMED_DESPAWN, 60000);
                                            DoCast(me, SPELL_ACIDIC_BLOOD_OF_SHUMA, true);
                                            DoCast(me, SPELL_DIGESTIVE_ACID_DUMMY, true);
                                            events.ScheduleEvent(EVENT_DIGESTIVE_ACID, urand(7000, 9000));
                                            break;
                                        case NPC_GLOWING_GLOBULE: 
                                            bShuma = true;
                                            DoCast(me, SPELL_GLOWING_BLOOD_OF_SHUMA, true); 
                                            break;
                                        case NPC_DARK_GLOBULE: 
                                            DoCast(me, SPELL_BLACK_BLOOD_OF_SHUMA, true); 
                                            events.ScheduleEvent(EVENT_CORRUPTED_MINIONS, 1000);
                                            break;
                                        case NPC_SHADOWED_GLOBULE: 
                                            DoCast(me, SPELL_SHADOWED_BLOOD_OF_SHUMA, true);
                                            events.ScheduleEvent(EVENT_DEEP_CORRUPTION, urand(3000, 4000));
                                            break;
                                        case NPC_COBALT_GLOBULE: 
                                            DoCast(me, SPELL_COBALT_BLOOD_OF_SHUMA, true);
                                            events.ScheduleEvent(EVENT_MANA_VOID_1, urand(2000, 3000));
                                            break;
                                        default: break;
                                    }
                                    (*itr)->DespawnOrUnsummon();
                                }
                            }

                            if (me->HasAura(SPELL_BLACK_BLOOD_OF_SHUMA) && me->HasAura(SPELL_GLOWING_BLOOD_OF_SHUMA))
                                bAchieve[0] = true;
                            else if (me->HasAura(SPELL_CRIMSON_BLOOD_OF_SHUMA) && me->HasAura(SPELL_ACIDIC_BLOOD_OF_SHUMA))
                                bAchieve[1] = true;
                            else if (me->HasAura(SPELL_BLACK_BLOOD_OF_SHUMA) && me->HasAura(SPELL_COBALT_BLOOD_OF_SHUMA))
                                bAchieve[2] = true;
                            else if (me->HasAura(SPELL_SHADOWED_BLOOD_OF_SHUMA) && me->HasAura(SPELL_GLOWING_BLOOD_OF_SHUMA))
                                bAchieve[3] = true;

                            me->SetReactState(REACT_AGGRESSIVE);
                            AttackStart(me->GetVictim());
                            events.ScheduleEvent(EVENT_VOID_BOLT, urand(6000, 7000));
                            events.ScheduleEvent(EVENT_CALL_BLOOD_1, 62000);
                            break;
                        }
                        case EVENT_SEARING_BLOOD:
                            me->CastCustomSpell(SPELL_SEARING_BLOOD, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8), me);
                            events.ScheduleEvent(EVENT_SEARING_BLOOD, (bShuma ? 3500 : 6000));
                            break;
                        case EVENT_DIGESTIVE_ACID:
                            DoCast(me, SPELL_DIGESTIVE_ACID);
                            events.ScheduleEvent(EVENT_DIGESTIVE_ACID, (bShuma ? 3500 : 8300));
                            break;
                        case EVENT_CORRUPTED_MINIONS:
                            DoCast(me, SPELL_SPAWNING_POOL_1, true);
                            DoCast(me, SPELL_SPAWNING_POOL_2, true);
                            DoCast(me, SPELL_SPAWNING_POOL_3, true);
                            DoCast(me, SPELL_CORRUPTED_MINIONS_AURA);
                            if (bShuma)
                                events.ScheduleEvent(EVENT_CORRUPTED_MINIONS, 30000);
                            break;
                        case EVENT_DEEP_CORRUPTION:
                            DoCastAOE(SPELL_DEEP_CORRUPTION);
                            events.ScheduleEvent(EVENT_DEEP_CORRUPTION, 25000);
                            break;
                        case EVENT_MANA_VOID_1:
                            DoCastAOE(SPELL_MANA_VOID);
                            events.ScheduleEvent(EVENT_MANA_VOID_2, 5000);
                            break;
                        case EVENT_MANA_VOID_2:
                            DoCast(me, SPELL_MANA_VOID_SUMMON);
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
Example #25
0
void Vehicle::Relocate(Position pos)
{
    std::set<Unit*> vehiclePlayers;
    for(int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for(std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
    {
        if(Unit* plr = (*itr))
            plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
    }

    _me->SetPosition(pos, true);
}
Example #26
0
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BRAIN_WASH_TOTEM:
                            DoCast(me, SPELL_BRAIN_WASH_TOTEM);
                            events.ScheduleEvent(EVENT_BRAIN_WASH_TOTEM, urand(18000, 26000));
                            break;
                        case EVENT_POWERFULL_HEALING_WARD:
                            DoCast(me, SPELL_POWERFULL_HEALING_WARD);
                            events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, urand(14000, 20000));
                            break;
                        case EVENT_HEX:
                            if (Unit* target = me->GetVictim())
                            {
                                DoCast(target, SPELL_HEX, true);
                                if (DoGetThreat(target))
                                    DoModifyThreatPercent(target, -80);
                            }
                            events.ScheduleEvent(EVENT_HEX, urand(12000, 20000));
                            break;
                        case EVENT_DELUSIONS_OF_JINDO:
                            // Casting the delusion curse with a shade so shade will attack the same target with the curse.
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                            {
                                DoCast(target, SPELL_SHADE_OF_JINDO, true);
                                DoCast(target, SPELL_DELUSIONS_OF_JINDO);
                            }
                            events.ScheduleEvent(EVENT_DELUSIONS_OF_JINDO, urand(4000, 12000));
                            break;
                        case EVENT_TELEPORT:
                            // Teleports a random player and spawns 9 Sacrificed Trolls to attack player
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                            {
                                DoTeleportPlayer(target, TeleportLoc.GetPositionX(), TeleportLoc.GetPositionY(), TeleportLoc.GetPositionZ(), TeleportLoc.GetOrientation());
                                if (DoGetThreat(me->GetVictim()))
                                    DoModifyThreatPercent(target, -100);

                                // Summon a formation of trolls
                                for (uint8 i = 0; i < 10; ++i)
                                    if (Creature* SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, Formation[i].GetPositionX(), Formation[i].GetPositionY(), Formation[i].GetPositionZ(), Formation[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
                                        SacrificedTroll->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000));
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SHADOWBOLT_VOLLEY:
                            DoCast(me, SPELL_SHADOWBOLT_VOLLEY);
                            events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, urand(15000, 30000));
                            break;
                        case EVENT_BANISH:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, false))
                                 DoCast(target, SPELL_BANISH);
                            events.ScheduleEvent(EVENT_BANISH, 16000);
                            break;
                        case EVENT_DRAW_SHADOWS:
                            {
                                Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                    if (Player* i_pl = i->GetSource())
                                        if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
                                            i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);

                                me->SetPosition(VorpilPosition);
                                DoCast(me, SPELL_DRAW_SHADOWS, true);
                                DoCast(me, SPELL_RAIN_OF_FIRE);
                                events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000);
                                events.ScheduleEvent(EVENT_DRAW_SHADOWS, 30000);
                                break;
                            }
                        case EVENT_SUMMON_TRAVELER:
                            spawnVoidTraveler();
                            events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 10000);
                            // enrage at 20%
                            if (HealthBelowPct(20))
                                events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000);
                            break;
                    }

                    if (me->HasUnitState(UNIT_STATE_CASTING))
                        return;
                }

                DoMeleeAttackIfReady();
            }
Example #28
0
void Vehicle::Relocate(Position pos)
{
    sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", _me->GetEntry());

    std::set<Unit*> vehiclePlayers;
    for (int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
    {
        if (Unit* plr = (*itr))
        {
            // relocate/setposition doesn't work for player
            plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
            //plr->TeleportTo(pPlayer->GetMapId(), triggerPos.GetPositionX(), triggerPos.GetPositionY(), triggerPos.GetPositionZ(), triggerPos.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
        }
    }

    _me->UpdatePosition(pos, true);
    // problems, and impossible to do delayed enter
    //pPlayer->EnterVehicle(veh);
}
Example #29
0
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            events.Update(diff);

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_CURSE:
                        DoCastAOE(SPELL_CURSE_PLAGUEBRINGER);
                        events.ScheduleEvent(EVENT_CURSE, urand(50000, 60000));
                        return;
                    case EVENT_WARRIOR:
                        Talk(SAY_SUMMON);
                        SummonUndead(NPC_WARRIOR, RAID_MODE(2, 3));
                        events.ScheduleEvent(EVENT_WARRIOR, 30000);
                        return;
                    case EVENT_BLINK:
                        DoCastAOE(SPELL_CRIPPLE, true);
                        DoCastAOE(SPELL_BLINK);
                        DoResetThreat();
                        events.ScheduleEvent(EVENT_BLINK, 40000);
                        return;
                    case EVENT_BALCONY:
                        me->SetReactState(REACT_PASSIVE);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->AttackStop();
                        me->RemoveAllAuras();
                        me->NearTeleportTo(Teleport.GetPositionX(), Teleport.GetPositionY(), Teleport.GetPositionZ(), Teleport.GetOrientation());
                        events.Reset();
                        events.ScheduleEvent(EVENT_WAVE, urand(2000, 5000));
                        waveCount = 0;
                        return;
                    case EVENT_WAVE:
                        Talk(SAY_SUMMON);
                        switch (balconyCount)
                        {
                            case 0:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(2, 4));
                                break;
                            case 1:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(1, 2));
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(1, 2));
                                break;
                            case 2:
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(2, 4));
                                break;
                            default:
                                SummonUndead(NPC_CHAMPION, RAID_MODE(5, 10));
                                SummonUndead(NPC_GUARDIAN, RAID_MODE(5, 10));
                                break;
                        }
                        ++waveCount;
                        events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, urand(30000, 45000));
                        return;
                    case EVENT_GROUND:
                    {
                        ++balconyCount;
                        float x, y, z, o;
                        me->GetHomePosition(x, y, z, o);
                        me->NearTeleportTo(x, y, z, o);
                        events.ScheduleEvent(EVENT_BALCONY, 110000);
                        EnterPhaseGround();
                        return;
                    }
                }
            }

            if (me->HasReactState(REACT_AGGRESSIVE))
                DoMeleeAttackIfReady();
        }
Example #30
0
            void UpdateAI(uint32 const diff)
            {
                if (!me->IsNonMeleeSpellCasted(false) && !UpdateVictim())
                    return;

                //! TODO: TEST
                if (!instance || instance->GetData(DATA_UROM_PLATFORM) < 2)
                    return;

                if (teleportTimer <= diff)
                {
                    me->InterruptNonMeleeSpells(false);
                    if (frostBombTimer <= 8000)
                        frostBombTimer += 8000;
                    DoScriptText(SAY_TELEPORT, me);
                    me->GetMotionMaster()->MoveIdle();
                    DoCast(SPELL_TELEPORT);
                    teleportTimer = urand(30000, 35000);

                }
                else
                    teleportTimer -= diff;

                if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
                {
                    if (castArcaneExplosionTimer <= diff)
                    {
                        canCast = false;
                        canGoBack = true;
                        DoCastAOE(DUNGEON_MODE(SPELL_EMPOWERED_ARCANE_EXPLOSION, SPELL_EMPOWERED_ARCANE_EXPLOSION_H));
                        castArcaneExplosionTimer = 2000;
                    }
                    else
                        castArcaneExplosionTimer -= diff;
                }

                if (canGoBack)
                {
                    if (arcaneExplosionTimer <= diff)
                    {
                        Position pos;
                        me->getVictim()->GetPosition(&pos);

                        me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
                        me->GetMotionMaster()->MoveChase(me->getVictim(), 0, 0);
                        me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);

                        canCast = false;
                        canGoBack = false;
                        arcaneExplosionTimer = 9000;
                    }
                    else
                        arcaneExplosionTimer -= diff;
                }

                if (!me->IsNonMeleeSpellCasted(false, true, true))
                {
                    if (frostBombTimer <= diff)
                    {
                        DoCastVictim(SPELL_FROSTBOMB);
                        frostBombTimer = urand(5000, 8000);
                    }
                    else
                        frostBombTimer -= diff;

                    if (timeBombTimer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                            DoCast(target, DUNGEON_MODE(SPELL_TIME_BOMB, SPELL_TIME_BOMB_H));

                        timeBombTimer = urand(20000, 25000);
                    }
                    else
                        timeBombTimer -= diff;
                }

                DoMeleeAttackIfReady();
            }