void JustDied(Unit* killer)
        {
            if (!ghost && instance)
            {
                Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD));
                if (skarvald)
                {
                    if (skarvald->isDead())
                    {
                        Talk(YELL_DALRONN_SKA_DIED);

                        if (instance)
                            instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
                    }
                    else
                    {
                        Talk(YELL_DALRONN_DAL_DIEDFIRST);

                        me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
                        //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true);
                        Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 5000);
                        if (temp)
                        {
                            temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            temp->AI()->AttackStart(killer);
                        }
                    }
                }
            }
        }
 void SummonBeams()
 {
     Creature* beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0);
     if (beamer)
     {
         beamer->CastSpell(me,SPELL_BLUE_BEAM,true);
         beamer->SetDisplayId(11686);  //invisible
         beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
         beams[0]=beamer->GetGUID();
     }
     beamer = beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-219.918,-371.308,22.0042,2.73072,TEMPSUMMON_CORPSE_DESPAWN,0);
     if (beamer)
     {
         beamer->CastSpell(me,SPELL_BLUE_BEAM,true);
         beamer->SetDisplayId(11686);  //invisible
         beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
         beams[1]=beamer->GetGUID();
     }
 }
        void MoveInLineOfSight(Unit* pWho)
        {
            if (!pWho)
                return;
            if (Phase == IDLE && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && me->IsWithinDistInMap(pWho, 20))
            {
                Phase = INTRO;
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                if (pTrall = me->SummonCreature(CREATURE_TRALL, 685.569f, 615.103f, 435.396f, 6.23544f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
                {
                    pTrall->SetReactState(REACT_PASSIVE);
                    pTrall->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                if (pGarrosh = me->SummonCreature(CREATURE_GARROSH, 685.7f, 621.134f, 435.396f, 6.259f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
                {
                    pGarrosh->SetReactState(REACT_PASSIVE);
                    pGarrosh->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                if (pKing = me->SummonCreature(CREATURE_KING, 807.724f, 617.9f, 435.396f, 3.18416f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
                {
                    pKing->SetReactState(REACT_PASSIVE);
                    pKing->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                if (pLady = me->SummonCreature(CREATURE_LADY, 807.401f, 613.667f, 435.397f, 3.0585f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
                {
                    pLady->SetReactState(REACT_PASSIVE);
                    pLady->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                if (pHighlord = me->SummonCreature(CREATURE_HIGHLORD, 746.482f, 556.857f, 435.396f, 1.5898f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
                {
                    pHighlord->SetReactState(REACT_PASSIVE);
                    pHighlord->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
            }
        }
Example #4
0
        void UpdateAI(const uint32 diff)
        {
            if (!me->isInCombat())
            {
                if (RandChat_Timer <= diff)
                {
                    DoScriptText(RandomTaunt[rand()%6].id, me);
                    RandChat_Timer = 90000;
                }
                else
                    RandChat_Timer -= diff;
            }

            if (!UpdateVictim())
                return;

            if (NeedCheckCube) NeedCheckCubeStatus();

            if (Berserk_Timer <= diff)
            {
                DoCast(me, SPELL_BERSERK, true);
                DoScriptText(EMOTE_BERSERK, me);
                Berserk_Timer = 60000;
            }
            else
                Berserk_Timer -= diff;

            if (Cleave_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_CLEAVE);
                Cleave_Timer = 10000;
            }
            else
                Cleave_Timer -= diff;

            if (BlastNova_Timer <= diff)
            {
                // to avoid earthquake interruption
                if (!me->HasUnitState(UNIT_STAT_STUNNED))
                {
                    DoScriptText(EMOTE_BLASTNOVA, me);
                    DoCast(me, SPELL_BLASTNOVA);
                    BlastNova_Timer = 60000;
                }
            }
            else
                BlastNova_Timer -= diff;

            if (Quake_Timer <= diff)
            {
                // to avoid blastnova interruption
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_QUAKE_TRIGGER, true);
                    Quake_Timer = 50000;
                }
            }
            else
                Quake_Timer -= diff;

            if (Blaze_Timer <= diff)
            {
                if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                {
                    float x, y, z;
                    pTarget->GetPosition(x, y, z);
                    Creature *summon = me->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                    if (summon)
                    {
                        CAST_AI(mob_abyssal::mob_abyssalAI, summon->AI())->SetTrigger(2);
                        DoCast(summon, SPELL_BLAZE_TARGET, true);
                        summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    }
                }
                Blaze_Timer = 20000 + rand()%20000;
            }
            else
                Blaze_Timer -= diff;

            if (!Phase3 && HealthBelowPct(30)
                    && !me->IsNonMeleeSpellCasted(false) // blast nova
                    && !me->HasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake
            {
                Phase3 = true;
                DoScriptText(SAY_CHAMBER_DESTROY, me);
                DoCast(me, SPELL_CAMERA_SHAKE, true);
                DoCast(me, SPELL_DEBRIS_KNOCKDOWN, true);

                if (pInstance)
                    pInstance->SetData(DATA_COLLAPSE, true);
            }

            if (Phase3)
            {
                if (Debris_Timer <= diff)
                {
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    {
                        float x, y, z;
                        pTarget->GetPosition(x, y, z);
                        Creature *summon = me->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                        if (summon)
                            CAST_AI(mob_abyssal::mob_abyssalAI, summon->AI())->SetTrigger(1);
                    }
                    Debris_Timer = 10000;
                }
                else
                    Debris_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }