void Reset()
    {
        Mindblast_Timer  = 3000 + rand()%5000;
        Earthshock_Timer = 5000 + rand()%5000;

        if (pInstance)
        {
            pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0);
            Creature *leotheras = Unit::GetCreature(*me, leotherasGUID);
            if (leotheras && leotheras->isAlive())
                CAST_AI(boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/);
        }
    }
    void StartEvent(Unit* who)
    {
        if (!pInstance)
            return;

        GetAdvisors();

        DoScriptText(SAY_AGGRO, me);
        DoZoneInCombat();

        pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
        pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS);
    }
    void OpferRufen()
    {
        if (!pInstance)
            return;

        uint64 opfer = pInstance->GetData64(DATA_ADD_JEDOGA_INITIAND);

        if (opfer)
        {
            DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), me);
            pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
        } else
            bCanDown = true;
    }
    void StartEvent(Unit* who)
    {
        if (!pInstance)
            return;

        GetCouncil();

        DoScriptText(SAY_AGGRO, me);

        pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID());
        pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS);

        DoZoneInCombat();
    }
Example #5
0
    void Reset()
    {
        ArcanagosGUID = 0;

        if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
        {
            pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
            (*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
            Step = 0;
        } else
        {
            me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
            me->RemoveCorpse();
        }
    }
Example #6
0
bool GOHello_go_altar_of_archaedas(Player* pPlayer, GameObject* /*pGo*/)
{
    //bool alreadyUsed;
    //pGo->AddUse ();

    /*
    alreadyUsed = false;
    for (uint32 loop=0; loop<5; loop++) {
        if (altarOfArchaedasCount[loop] == pPlayer->GetGUID()) alreadyUsed = true;
    }
    if (!alreadyUsed)
        altarOfArchaedasCount[altarOfArchaedasCounter++] = pPlayer->GetGUID();
        */

    pPlayer->CastSpell (pPlayer, SPELL_BOSS_OBJECT_VISUAL, false);

    /*
    if (altarOfArchaedasCounter < NUMBER_NEEDED_TO_ACTIVATE)
        return false;        // not enough people yet

    // Check to make sure at least three people are still casting
    uint8 count = 0;
    Unit *pTarget;
    for (uint8 x = 0; x <= 5; ++x)
    {
        pTarget = Unit::GetUnit(*pPlayer, altarOfArchaedasCount[x]);
        if (!pTarget)
            continue;
        if (pTarget->IsNonMeleeSpellCasted(true))
            ++count;
        if (count >= NUMBER_NEEDED_TO_ACTIVATE)
            break;
    }

    if (count < NUMBER_NEEDED_TO_ACTIVATE)
        return false;            // not enough people
    */

    ScriptedInstance* pInstance = pPlayer->GetInstanceData();
    if (!pInstance)
        return false;

    pInstance->SetData(NULL,0);
    pInstance->SetData64(0,pPlayer->GetGUID());     // activate archaedas

    return false;
}
Example #7
0
bool GOHello_go_altar_of_archaedas(Player* player, GameObject* go)
{
    bool alreadyUsed;
    go->AddUse ();

    alreadyUsed = false;
    for (uint32 loop = 0; loop < 5; loop++)
    {
        if (altarOfArchaedasCount[loop] == player->GetGUID()) alreadyUsed = true;
    }
    if (!alreadyUsed)
        altarOfArchaedasCount[altarOfArchaedasCounter++] = player->GetGUID();

    player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false);

    if (altarOfArchaedasCounter < NUMBER_NEEDED_TO_ACTIVATE)
    {
        return false;        // not enough people yet
    }

    // Check to make sure at least three people are still casting
    uint32 count = 0;
    Unit* pTarget;
    for (uint32 x = 0; x < 5; x++)
    {
        pTarget = Unit::GetUnit(*player, altarOfArchaedasCount[x]);
        if (!pTarget) continue;
        if (pTarget->IsNonMeleeSpellCast(true)) count++;
        if (count >= NUMBER_NEEDED_TO_ACTIVATE) break;
    }

    if (count < NUMBER_NEEDED_TO_ACTIVATE)
    {
        return false;            // not enough people
    }

    ScriptedInstance* pInstance = (ScriptedInstance*)player->GetInstanceData();
    if (!pInstance) return false;
    pInstance->SetData64(0, player->GetGUID());    // activate archaedas

    return false;
}
Example #8
0
bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest const *quest)
{
    if (quest->GetQuestId() == QUEST_JAIL_BREAK)
    {
        ScriptedInstance *pInstance = (creature->GetInstanceData());

        if (!pInstance)
            return false;

        if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == NOT_STARTED)
        {
            ((npc_escortAI*)(creature->AI()))->SetMaxPlayerDistance(88.0f);
            CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
            pInstance->SetData64(Q_STARTER, player->GetGUID());
            pInstance->SetData(DATA_QUEST_JAIL_BREAK, IN_PROGRESS);
            creature->setFaction(11);
        }
    }
    return false;
}
bool GossipSelect_boss_doomrel(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
    switch (uiAction)
    {
        case GOSSIP_ACTION_INFO_DEF+1:
            pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
            pPlayer->SEND_GOSSIP_MENU(2605, pCreature->GetGUID());
            break;
        case GOSSIP_ACTION_INFO_DEF+2:
            pPlayer->CLOSE_GOSSIP_MENU();
            //start event here
            pCreature->setFaction(FACTION_HOSTILE);
            pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
            pCreature->AI()->AttackStart(pPlayer);
            ScriptedInstance* pInstance = pCreature->GetInstanceData();
            if (pInstance)
                pInstance->SetData64(DATA_EVENSTARTER,pPlayer->GetGUID());
            break;
    }
    return true;
}
Example #10
0
        void SummonedCreatureJustDied(Creature* pSummoned) override
        {
            m_lSummonedAddGuids.remove(pSummoned->GetObjectGuid());

            if (!m_pInstance)
                return;

            m_pInstance->SetData64(DATA64_GOTH_RIGHT_ANCHOR, pSummoned->GetObjectGuid().GetRawValue());
            if (Creature* pAnchor = m_creature->GetMap()->GetCreature(ObjectGuid(m_pInstance->GetData64(DATA64_GOTH_RIGHT_ANCHOR))))
            {
                switch (pSummoned->GetEntry())
                {
                    // Wrong caster, it expected to be pSummoned.
                    // Mangos deletes the spell event at caster death, so for delayed spell like this
                    // it's just a workaround. Does not affect other than the visual though (+ spell takes longer to "travel")
                case NPC_UNREL_TRAINEE:         m_creature->CastSpell(pAnchor, SPELL_A_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break;
                case NPC_UNREL_DEATH_KNIGHT:    m_creature->CastSpell(pAnchor, SPELL_B_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break;
                case NPC_UNREL_RIDER:           m_creature->CastSpell(pAnchor, SPELL_C_TO_ANCHOR_1, true, NULL, NULL, pSummoned->GetObjectGuid()); break;
                }
            }
        }
Example #11
0
    void Reset()
    {
        uiSinsterStrikeTimer = 7*IN_MILISECONDS;
        uiCallFlamesTimer = 10*IN_MILISECONDS;
        uiRitualOfSwordTimer = 20*IN_MILISECONDS;
        uiSacrificeTimer = 8*IN_MILISECONDS;

        bSacrificed = false;

        Phase = NORMAL;

        DoTeleportTo(296.632, -346.075, 90.6307);
        me->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);

        summons.DespawnAll();

        if (pInstance)
        {
            pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED);
            pInstance->SetData64(DATA_SACRIFICED_PLAYER,0);
        }
    }
Example #12
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!UpdateVictim())
            return;

        //Common to PHASE_START && PHASE_END
        if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END)
        {
            //Specific to PHASE_START || PHASE_END
            if (m_uiPhase == PHASE_START)
            {
                if (me->GetHealth()*100 / me->GetMaxHealth() < 60)
                {
                    m_uiPhase = PHASE_BREATH;
                    
                    if (m_pInstance)
                        m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);

                    SetCombatMovement(false);
                    me->GetMotionMaster()->Clear(false);
                    me->GetMotionMaster()->MoveIdle();
                    me->SetFlying(true);

                    DoScriptText(SAY_PHASE_2_TRANS, me);

                    if (m_pPointData)
                        me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ);

                    m_uiWhelpTimer = 1000;
                    return;
                }
            }
            else
            {
                if (m_uiBellowingRoarTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_BELLOWING_ROAR);
                    // Eruption
                    GameObject* pFloor = NULL;
                    Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
                    Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check);
                    me->VisitNearbyGridObject(30, searcher);
                    if (m_pInstance && pFloor)
                        m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID());
                    m_uiBellowingRoarTimer = 30000;
                }
                else
                    m_uiBellowingRoarTimer -= uiDiff;
            }

            if (m_uiFlameBreathTimer <= uiDiff)
            {
                DoCastVictim(SPELL_FLAME_BREATH);
                m_uiFlameBreathTimer = urand(10000, 20000);
            }
            else
                m_uiFlameBreathTimer -= uiDiff;

            if (m_uiTailSweepTimer <= uiDiff)
            {
                DoCastAOE(SPELL_TAIL_SWEEP);
                m_uiTailSweepTimer = urand(15000, 20000);
            }
            else
                m_uiTailSweepTimer -= uiDiff;

            if (m_uiCleaveTimer <= uiDiff)
            {
                DoCastVictim(SPELL_CLEAVE);
                m_uiCleaveTimer = urand(2000, 5000);
            }
            else
                m_uiCleaveTimer -= uiDiff;

            if (m_uiWingBuffetTimer <= uiDiff)
            {
                DoCastVictim(SPELL_WING_BUFFET);
                m_uiWingBuffetTimer = urand(15000, 30000);
            }
            else
                m_uiWingBuffetTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
        else
        {
            if (me->GetHealth()*100 / me->GetMaxHealth() < 40)
            {
                m_uiPhase = PHASE_END;
                if (m_pInstance)
                    m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);
                DoScriptText(SAY_PHASE_3_TRANS, me);

                SetCombatMovement(true);
                me->SetFlying(false);
                m_bIsMoving = false;
                me->GetMotionMaster()->MovePoint(9,me->GetHomePosition());
                return;
            }

            if (m_uiDeepBreathTimer <= uiDiff)
            {
                if (!m_bIsMoving) 
                {
                    if (me->IsNonMeleeSpellCasted(false))
                        me->InterruptNonMeleeSpells(false);

                    DoScriptText(EMOTE_BREATH, me);
                    DoCast(me, m_pPointData->uiSpellId);
                    m_uiDeepBreathTimer = 70000;
                }
            }
            else
                m_uiDeepBreathTimer -= uiDiff;

            if (m_uiMovementTimer <= uiDiff)
            {
                if (!m_bIsMoving) 
                {
                    SetNextRandomPoint();
                    m_pPointData = GetMoveData();

                    if (!m_pPointData)
                        return;

                    me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ);
                    m_bIsMoving = true;
                    m_uiMovementTimer = 25000;
                }
            }
            else
                m_uiMovementTimer -= uiDiff;

            if (m_uiFireballTimer <= uiDiff)
            {
                if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
                {
                    if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(pTarget, SPELL_FIREBALL);

                    m_uiFireballTimer = 8000;
                }
            }
            else
                m_uiFireballTimer -= uiDiff;

            if (m_uiLairGuardTimer <= uiDiff)            
            {
                me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                if (m_uiSummonLairGuardCount >= RAID_MODE(1,2))
                {
                    m_uiSummonLairGuardCount = 0;
                    m_uiLairGuardTimer = 30000;
                }
                else
                    m_uiLairGuardTimer = 2000;
            }
            else
                m_uiLairGuardTimer -= uiDiff;

            if (m_uiWhelpTimer <= uiDiff)
            {
                me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                if (m_uiSummonWhelpCount >= RAID_MODE(20,40))
                {
                    m_uiSummonWhelpCount = 0;
                    m_uiWhelpTimer = 90000;    
                } 
                else
                    m_uiWhelpTimer = 500;
            }
            else
                m_uiWhelpTimer -= uiDiff;
        }
    }
Example #13
0
    void Reset()
    {
        if (pInstance)
        {
            bool isCorrectSpawned = true;

            if (pInstance->GetData(TYPE_NIGHTBANE) != DONE)
            {
                uint64 NightbaneGUID = 0;
                NightbaneGUID = pInstance->GetData64(DATA_NIGHTBANE);

                if (NightbaneGUID)
                    if (Creature* Nightbane = Creature::GetCreature((*me),NightbaneGUID))
                        isCorrectSpawned = false;
            }
            else
                isCorrectSpawned = false;

            if (!isCorrectSpawned)
            {
                (*me).GetMotionMaster()->Clear(false);
                isReseted = true;
                me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                me->RemoveCorpse();
            }
            else
            {
                pInstance->SetData64(DATA_NIGHTBANE,me->GetGUID());
            }

            if (!Intro)
            {
                (*me).GetMotionMaster()->Clear(false);
                isReseted = true;
                pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED);
                me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                me->RemoveCorpse();
                return;
            } else
            {

                BellowingRoarTimer = 30000;
                CharredEarthTimer = 15000;
                DistractingAshTimer = 20000;
                SmolderingBreathTimer = 10000;
                TailSweepTimer = 12000;
                RainofBonesTimer = 10000;
                SmokingBlastTimer = 20000;
                FireballBarrageTimer = 13000;
                SearingCindersTimer = 14000;
                WaitTimer = 1000;

                Phase =1;
                FlyCount = 0;
                MovePhase = 0;

                me->SetSpeed(MOVE_RUN, 2.0f);
                me->AddUnitMovementFlag(MOVEFLAG_ONTRANSPORT | MOVEFLAG_LEVITATING);
                me->RemoveUnitMovementFlag(MOVEFLAG_WALK_MODE);
                me->setActive(true);

                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                HandleTerraceDoors(true);
                Flying = false;
                Movement = false;
            }
        }
    }
Example #14
0
 void EnterCombat(Unit * who)
 {
     me->InterruptNonMeleeSpells(false);
     if (pInstance)
         pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID());
 }
Example #15
0
 void SummonedMobDied(Creature *pSummoned)
 {
     listOfMobs.Despawn(pSummoned);
     if (pSummoned)
         pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID());
 }
Example #16
0
 void JustSummoned(Creature *pSummoned)
 {
     listOfMobs.Summon(pSummoned);
     if (pSummoned)
         pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID());
 }
    void DoSummonGrandChampion(uint32 uiBoss)
    {
        ++uiSummonTimes;
        uint32 VEHICLE_TO_SUMMON1 = 0;
        uint32 VEHICLE_TO_SUMMON2 = 0;
        switch(uiBoss)
        {
            case 0:
                VEHICLE_TO_SUMMON1 = VEHICLE_MOKRA_SKILLCRUSHER_MOUNT;
                VEHICLE_TO_SUMMON2 = VEHICLE_ORGRIMMAR_WOLF;
				break;
            case 1:
                VEHICLE_TO_SUMMON1 = VEHICLE_ERESSEA_DAWNSINGER_MOUNT;
                VEHICLE_TO_SUMMON2 = VEHICLE_SILVERMOON_HAWKSTRIDER;
				break;
            case 2:
                VEHICLE_TO_SUMMON1 = VEHICLE_RUNOK_WILDMANE_MOUNT;
                VEHICLE_TO_SUMMON2 = VEHICLE_THUNDER_BLUFF_KODO;
				break;
            case 3:
                VEHICLE_TO_SUMMON1 = VEHICLE_ZUL_TORE_MOUNT;
                VEHICLE_TO_SUMMON2 = VEHICLE_DARKSPEAR_RAPTOR;
			    break;
            case 4:
                VEHICLE_TO_SUMMON1 = VEHICLE_DEATHSTALKER_VESCERI_MOUNT;
                VEHICLE_TO_SUMMON2 = VEHICLE_FORSAKE_WARHORSE;
                break;
            default:
                return;
        }

        if (Creature* pBoss = me->SummonCreature(VEHICLE_TO_SUMMON1,SpawnPosition))
        {
            switch(uiSummonTimes)
            {
                case 1:
                {
                    uiVehicle1GUID = pBoss->GetGUID();
                    uint64 uiGrandChampionBoss1 = 0;
                    if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID))
                        if (Vehicle* pVehicle = pBoss->GetVehicleKit())
                            if (Unit* pUnit = pVehicle->GetPassenger(0))
                                uiGrandChampionBoss1 = pUnit->GetGUID();
                    if (pInstance)
                    {
                        pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1,uiVehicle1GUID);
                        pInstance->SetData64(DATA_GRAND_CHAMPION_1,uiGrandChampionBoss1);
                    }
                    pBoss->AI()->SetData(1,0);
                    break;
                }
                case 2:
                {
                    uiVehicle2GUID = pBoss->GetGUID();
                    uint64 uiGrandChampionBoss2 = 0;
                    if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID))
                        if (Vehicle* pVehicle = pBoss->GetVehicleKit())
                            if (Unit* pUnit = pVehicle->GetPassenger(0))
                                uiGrandChampionBoss2 = pUnit->GetGUID();
                    if (pInstance)
                    {
                        pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2,uiVehicle2GUID);
                        pInstance->SetData64(DATA_GRAND_CHAMPION_2,uiGrandChampionBoss2);
                    }
                    pBoss->AI()->SetData(2,0);
                    break;
                }
                case 3:					
                {
                    uiVehicle3GUID = pBoss->GetGUID();
                    uint64 uiGrandChampionBoss3 = 0;
                    if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID))
                        if (Vehicle* pVehicle = pBoss->GetVehicleKit())
                            if (Unit* pUnit = pVehicle->GetPassenger(0))
                                uiGrandChampionBoss3 = pUnit->GetGUID();
                    if (pInstance)
                    {
                        pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3,uiVehicle3GUID);
                        pInstance->SetData64(DATA_GRAND_CHAMPION_3,uiGrandChampionBoss3);
                    }
                    pBoss->AI()->SetData(3,0);
                    break;
                }
                default:
                    return;
            }

            for (uint8 i = 0; i < 3; ++i)
            {
                if (Creature* pAdd = me->SummonCreature(VEHICLE_TO_SUMMON2,SpawnPosition,TEMPSUMMON_CORPSE_DESPAWN))
                {			
                    switch(uiSummonTimes)
                    {
                        case 1:
                            Champion1List.push_back(pAdd->GetGUID());
                            break;
                        case 2:
                            Champion2List.push_back(pAdd->GetGUID());
                            break;
                        case 3:
                            Champion3List.push_back(pAdd->GetGUID());
                            break;
                    }

                    switch(i)
                    {
                        case 0:
                            pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI);
                            break;
                        case 1:
                            pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2);
                            break;
                        case 2:
                            pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2 + M_PI);
                            break;
                    }
                }

            }
        }
    }
Example #18
0
    void UpdateAI(const uint32 diff)
    {
        if (Phase == NORMAL)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (uiSinsterStrikeTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_SINSTER_STRIKE);
                uiSinsterStrikeTimer = urand(5*IN_MILISECONDS,9*IN_MILISECONDS);
            } else uiSinsterStrikeTimer -= diff;

            if (uiCallFlamesTimer <= diff)
            {
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                {
                    DoCast(pTarget, SPELL_CALL_FLAMES);
                    uiCallFlamesTimer = urand(8*IN_MILISECONDS,12*IN_MILISECONDS);
                }
            } else uiCallFlamesTimer -= diff;

            if (!bSacrificed)
                if (uiRitualOfSwordTimer <= diff)
                {
                    if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    {
                        DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),me);
                        DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD);
                        //Spell doesn't teleport
                        DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6);
                        me->SetUnitMovementFlags(MOVEMENTFLAG_FLY_MODE);
                        DoTeleportTo(296.632, -346.075, 120.85);
                        Phase = SACRIFICING;
                        if (pInstance)
                        {
                            pInstance->SetData64(DATA_SACRIFICED_PLAYER,pSacrificeTarget->GetGUID());

                            for (uint8 i = 0; i < 3; ++i)
                                if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000))
                                    pSummon->AI()->DoAction(0);
                        }

                        bSacrificed = true;
                    }
                } else uiRitualOfSwordTimer -= diff;

            DoMeleeAttackIfReady();
        }
        else  //SACRIFICING
        {
            if (uiSacrificeTimer <= diff)
            {
                Unit* pSacrificeTarget = pInstance ? Unit::GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER)) : NULL;
                if (pInstance && !summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive())
                    me->Kill(pSacrificeTarget, false); // durability damage?

                //go down
                Phase = NORMAL;
                pSacrificeTarget = NULL;
                me->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    me->GetMotionMaster()->MoveChase(pTarget);

                uiSacrificeTimer = 8*IN_MILISECONDS;
            }
            else uiSacrificeTimer -= diff;
        }
    }