Пример #1
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (EmpoweredSmiteTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCasted(false))
            {
                DoCast(me->getVictim(), SPELL_EMPOWERED_SMITE);
                EmpoweredSmiteTimer = 30000;
            }
        } else EmpoweredSmiteTimer -= diff;

        if (CircleOfHealingTimer <= diff)
        {
            if (TryDoCast(me, SPELL_CIRCLE_OF_HEALING))
                CircleOfHealingTimer = 30000;
        } else CircleOfHealingTimer -= diff;

        if (DivineWrathTimer <= diff)
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                if (TryDoCast(pTarget, SPELL_DIVINE_WRATH))
                    DivineWrathTimer = 20000 + rand()%20 * 1000;
            }
        } else DivineWrathTimer -= diff;

        if (ReflectiveShieldTimer <= diff)
        {
            if (TryDoCast(me, SPELL_REFLECTIVE_SHIELD))
                ReflectiveShieldTimer = 45000;
        } else ReflectiveShieldTimer -= diff;

        DoMeleeAttackIfReady();
    }
Пример #2
0
        void UpdateAI(const uint32 diff)
        {
            if(IntroStepCounter < 9)
            {
                if(IntroYellTimer <= diff)
                {
                    IntroYellTimer = IntroStep(++IntroStepCounter);
                }else IntroYellTimer -= diff;
            }

            CheckRadianceAura();

            if(!SisterDeath)
            {
                if (pInstance)
                {
                    Creature* Temp = Creature::GetCreature((*me),pInstance->GetData64(DATA_SACROLASH));
                    if (Temp && Temp->isDead())
                    {
                        DoScriptText(YELL_SISTER_SACROLASH_DEAD, me);
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);
                        if(TryDoCast(me, SPELL_EMPOWER))
                            SisterDeath = true;
                    }
                }
            }

            if (!UpdateVictim())
                return;

            DoAggroPuls(diff);

            if(SisterDeath)
            {
                if(ShadownovaTimer <= diff)
                {
                    me->InterruptSpell(CURRENT_GENERIC_SPELL);
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300, true);
                    if(TryDoCast(target, SPELL_SHADOW_NOVA))
                        ShadownovaTimer= 30000+(rand()%5000);

                }else ShadownovaTimer -=diff;
            }
            else
            {
                if(ConflagrationTimer <= diff)
                {
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);
                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300, true);
                        if(TryDoCast(target, SPELL_CONFLAGRATION))
                        {
                            ConflagrationTimer = 30000+(rand()%5000);

                            if(!SisterDeath)
                            {
                                DoScriptText(EMOTE_CONFLAGRATION, me, target);
                                DoScriptText(YELL_CANFLAGRATION, me);
                            }

                            BlazeTimer = 4000;
                        }
                }else ConflagrationTimer -= diff;
            }

            if(FlamesearTimer <= diff)
            {
                 if(TryDoCast(me, SPELL_FLAME_SEAR))
                    FlamesearTimer = 15000;
            }else FlamesearTimer -=diff;

            if (PyrogenicsTimer <= diff)
            {
                if(TryDoCast(me, SPELL_PYROGENICS,true))
                    PyrogenicsTimer = 15000;
            }else PyrogenicsTimer -= diff;

            if (BlazeTimer <= diff)
            {
                if(TryDoCast(me->getVictim(), SPELL_BLAZE))
                    BlazeTimer = 3800;
            }else BlazeTimer -= diff;

            if (EnrageTimer <= diff && !Enraged)
            {
                me->InterruptSpell(CURRENT_GENERIC_SPELL);
                DoScriptText(YELL_BERSERK, me);
                if(TryDoCast(me, SPELL_ENRAGE))
                    Enraged = true;
            }else EnrageTimer -= diff;
        }
Пример #3
0
        void UpdateAI(const uint32 diff)
        {
            CheckRadianceAura();

            if(!SisterDeath)
            {
                if (pInstance)
                {
                    Creature* Temp = Creature::GetCreature((*me),pInstance->GetData64(DATA_ALYTHESS));
                    if (Temp && Temp->isDead())
                    {
                        DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me);
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);
                        if(TryDoCast(me,SPELL_EMPOWER))
                            SisterDeath = true;
                    }
                }
            }

            if (!UpdateVictim())
                return;

            DoAggroPuls(diff);

            if(SisterDeath)
            {
                if (ConflagrationTimer <= diff)
                {
                    me->InterruptSpell(CURRENT_GENERIC_SPELL);
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300, true);
                    if(TryDoCast(target, SPELL_CONFLAGRATION))
                        ConflagrationTimer = 30000+(rand()%5000);
                }else ConflagrationTimer -= diff;
            }
            else
            {
                if(ShadownovaTimer <= diff)
                {
                    me->InterruptSpell(CURRENT_GENERIC_SPELL);
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300, true);
                    if(TryDoCast(target, SPELL_SHADOW_NOVA))
                    {
                        if(!SisterDeath)
                        {
                            DoScriptText(EMOTE_SHADOW_NOVA, me, target);
                            DoScriptText(YELL_SHADOW_NOVA, me);
                        }
                        ShadownovaTimer = 30000+(rand()%5000);
                    }
                }else ShadownovaTimer -=diff;
            }

            if(ConfoundingblowTimer <= diff)
            {
                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10, true);
                if(TryDoCast(target, SPELL_CONFOUNDING_BLOW))
                    ConfoundingblowTimer = 20000 + (rand()%5000);
            }else ConfoundingblowTimer -=diff;

            if(ShadowimageTimer <= diff)
            {
                Unit* ptarget = NULL;
                Creature* temp = NULL;
                for(int i = 0;i<3;i++)
                {
                    ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000);
                    if(temp && ptarget)
                    {
                        temp->AI()->AttackStart(ptarget);
                        temp->getThreatManager().addThreat(ptarget,500000.0f);
                    }
                }
                ShadowimageTimer = 20000;
            }else ShadowimageTimer -=diff;

            if(ShadowbladesTimer <= diff)
            {
                if(TryDoCast(me, SPELL_SHADOW_BLADES))
                    ShadowbladesTimer = 10000;
            }else ShadowbladesTimer -=diff;

            if (EnrageTimer <= diff && !Enraged)
            {
                me->InterruptSpell(CURRENT_GENERIC_SPELL);
                DoScriptText(YELL_ENRAGE, me);
                DoCast(me,SPELL_ENRAGE);
                if(me->HasAura(SPELL_ENRAGE,0))
                    Enraged = true;
            }else EnrageTimer -= diff;

            if( me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
            {
                //If we are within range melee the target
                if( me->IsWithinMeleeRange(me->getVictim()))
                {
                    HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED);
                    me->AttackerStateUpdate(me->getVictim());
                    me->resetAttackTimer();
                }
            }
        }
Пример #4
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if(pulse_Timer < diff)
            {
                DoAttackerAreaInCombat(me->getVictim(),50);
                pulse_Timer = 10000;
            }else pulse_Timer -= diff;

            if(TidalShieldTimer < diff)
            {
                if(TryDoCast(me, SPELL_TIDAL_SHIELD, true))
                {
                    ResetTimer(45000);
                    TidalShieldTimer = 60000;
                }
            }else TidalShieldTimer -= diff;

            if(!me->HasAura(SPELL_BERSERK,0))
            {
                if(EnrageTimer < diff)
                {
                    DoScriptText(SAY_ENRAGE2, me);
                    DoCast(me, SPELL_BERSERK, true);
                }else EnrageTimer -= diff;
            }

            if(SpecialYellTimer < diff)
            {
                switch(rand()%2)
                {
                case 0: DoScriptText(SAY_SPECIAL1, me); break;
                case 1: DoScriptText(SAY_SPECIAL2, me); break;
                }
                SpecialYellTimer = 25000 + (rand()%76)*1000;
            }else SpecialYellTimer -= diff;

            if(ImpalingSpineTimer < diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 80,true);
                    if(!target) target = me->getVictim();
                    if(target)
                    {
                        DoCast(target, SPELL_IMPALING_SPINE);
                        SpineTargetGUID = target->GetGUID();
                        //must let target summon, otherwise you cannot click the spine
                        target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 0);

                        switch(rand()%2)
                        {
                        case 0: DoScriptText(SAY_NEEDLE1, me); break;
                        case 1: DoScriptText(SAY_NEEDLE2, me); break;
                        }
                        ImpalingSpineTimer = 21000;
                    }
                }
            }else ImpalingSpineTimer -= diff;

            if(NeedleSpineTimer < diff)
            {
                if(TryDoCast(me, SPELL_NEEDLE_SPINE, true))
                {
                    //std::list<Unit*> target;
                    //SelectUnitList(target, 3, SELECT_TARGET_RANDOM, 100, true);
                    //for(std::list<Unit*>::iterator i = target.begin(); i != target.end(); ++i)
                    //    me->CastSpell(*i, 39835, true);
                    NeedleSpineTimer = 3000;
                }
            }else NeedleSpineTimer -= diff;


            DoMeleeAttackIfReady();
        }
Пример #5
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (((me->GetHealth() * 100 / me->GetMaxHealth()) < 10) && !Enraged)
        {
            Enraged = true;
            DoCast(me, SPELL_ENRAGE, true);
            DoScriptText(SAY_ENRAGE, me);
        }

        if (BeamTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCast(false))
            {
                switch (CurrentBeam)
                {
                case 0:
                    DoCast(me, SPELL_BEAM_SINISTER_TRIGGER);
                    break;
                case 1:
                    DoCast(me, SPELL_BEAM_VILE_TRIGGER);
                    break;
                case 2:
                    DoCast(me, SPELL_BEAM_WICKED_TRIGGER);
                    break;
                case 3:
                    DoCast(me, SPELL_BEAM_SINFUL_TRIGGER);
                    break;
                }
                uint32 Beam = CurrentBeam;
                while (CurrentBeam == Beam)
                    CurrentBeam = rand() % 4;

                BeamTimer = 30000;
            }
        }
        else BeamTimer -= diff;

        // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other.
        if (FatalAttractionTimer <= diff)
        {
            TeleportPlayers();

            DoScriptText(RAND(SAY_SPELL2, SAY_SPELL3), me);
            FatalAttractionExplodeTimer = 2000;
            FatalAttractionTimer = 30000;
        }
        else FatalAttractionTimer -= diff;

        if (FatalAttractionExplodeTimer <= diff)
        {
            Player* targets[3];
            for (uint8 i = 0; i < 3; ++i)
            {
                if (TargetGUID[i])
                    targets[i] = Player::GetPlayer(*me, TargetGUID[i]);
                else
                    targets[i] = NULL;
            }

            if (targets[0] && targets[0]->IsAlive())
            {
                bool isNear = false;
                if (targets[1] && targets[1]->IsAlive() && targets[0]->GetDistance2d(targets[1]) < 25)
                    isNear = true;

                if (!isNear)
                    if (targets[2] && targets[2]->IsAlive() && targets[0]->GetDistance2d(targets[2]) < 25)
                        isNear = true;

                if (isNear)
                    targets[0]->CastSpell(targets[0], SPELL_ATTRACTION, true);
                else
                {
                    targets[0]->RemoveAurasDueToSpell(SPELL_ATTRACTION_VIS);
                    TargetGUID[0] = 0;
                    targets[0] = NULL;
                }
            }


            if (targets[1] && targets[1]->IsAlive())
            {
                bool isNear = false;
                if (targets[0] && targets[0]->IsAlive() && targets[1]->GetDistance2d(targets[0]) < 25)
                    isNear = true;

                if (!isNear)
                    if (targets[2] && targets[2]->IsAlive() && targets[1]->GetDistance2d(targets[2]) < 25)
                        isNear = true;

                if (isNear)
                    targets[1]->CastSpell(targets[1], SPELL_ATTRACTION, true);
                else
                {
                    targets[1]->RemoveAurasDueToSpell(SPELL_ATTRACTION_VIS);
                    TargetGUID[1] = 0;
                    targets[1] = NULL;
                }
            }

            if (targets[2] && targets[2]->IsAlive())
            {
                bool isNear = false;
                if (targets[0] && targets[0]->IsAlive() && targets[2]->GetDistance2d(targets[0]) < 25)
                    isNear = true;

                if (!isNear)
                    if (targets[1] && targets[1]->IsAlive() && targets[2]->GetDistance2d(targets[1]) < 25)
                        isNear = true;

                if (isNear)
                    targets[2]->CastSpell(targets[1], SPELL_ATTRACTION, true);
                else
                {
                    targets[2]->RemoveAurasDueToSpell(SPELL_ATTRACTION_VIS);
                    TargetGUID[2] = 0;
                    targets[2] = NULL;
                }
            }

            bool allClear = true;
            for (uint8 i = 0; i < 3; i++)
            {
                if (TargetGUID[i] != 0)
                    allClear = false;
            }

            if (allClear)
                FatalAttractionExplodeTimer = 60000;
            else
                FatalAttractionExplodeTimer = 1000;

        }
        else FatalAttractionExplodeTimer -= diff;

        if (ShriekTimer <= diff)
        {
            if (TryDoCast(me->getVictim(), SPELL_SILENCING_SHRIEK))
                ShriekTimer = 20000;
        }
        else ShriekTimer -= diff;

        //Enrage
        if (!me->HasAura(SPELL_BERSERK, 0))
        {
            if (EnrageTimer <= diff)
            {
                DoCast(me, SPELL_BERSERK);
                DoScriptText(SAY_ENRAGE, me);
            }
            else EnrageTimer -= diff;
        }
        //Random taunts
        if (RandomYellTimer <= diff)
        {
            DoScriptText(RAND(SAY_TAUNT1, SAY_TAUNT2, SAY_TAUNT3), me);
            RandomYellTimer = 60000 + rand() % 91 * 1000;
        }
        else RandomYellTimer -= diff;

        DoMeleeAttackIfReady();
    }
Пример #6
0
    void boss_kalecgos::boss_kalecgosAI::UpdateAI(const uint32 diff)
    {
        if(TalkTimer)
        {
            if(!TalkSequence)
            {
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
                me->InterruptNonMeleeSpells(true);
                me->RemoveAllAuras();
                me->DeleteThreatList();
                me->CombatStop();
                TalkSequence++;

                if(pInstance)
                {
                    pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_FORECEFIELD_COLL_1),true);
                    pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_FORECEFIELD_COLL_2),true);
                }
            }
            if(TalkTimer <= diff)
            {
                if(isFriendly)
                    GoodEnding();
                else
                    BadEnding();
                TalkSequence++;
            }else TalkTimer -= diff;
        }
        else
        {
            if (!UpdateVictim())
                return;

            if(!doorClosed)
            {
                if(Close_Timer <= diff)
                {
                    if(pInstance)
                    {
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_FORECEFIELD_COLL_1),false);
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_FORECEFIELD_COLL_2),false);
                        doorClosed = true;
                    }
                    Close_Timer = 10000;
                }else Close_Timer -= diff;
            }

            if(ResetThreat <= diff)
            {
                if ( ( me->getVictim()->HasAuraEffect(AURA_SPECTRAL_REALM,0)) && (me->getVictim()->GetTypeId() == TYPEID_PLAYER) )
                {
                    for(std::list<HostileReference*>::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
                    {
                        if(((*itr)->getUnitGuid()) ==  (me->getVictim()->GetGUID()))
                        {
                            (*itr)->removeReference();
                            break;
                        }
                    }
                }

                if(me->getVictim() && (me->getVictim()->HasAuraEffect(AURA_SPECTRAL_REALM,0) || me->GetPositionZ() < DRAGON_REALM_Z-10))
                    me->getThreatManager().modifyThreatPercent(me->getVictim(), -100);

                ResetThreat = 1000;
            }else ResetThreat -= diff;

            if(CheckTimer <= diff)
                {
                    if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !isEnraged)
                    {
                        Unit* Sath = Unit::GetUnit(*me, SathGUID);
                        if(Sath)
                        {
                            Sath->CastSpell(Sath, SPELL_ENRAGE, true);
                            CAST_AI(boss_sathrovarr::boss_sathrovarrAI,((Creature*)Sath)->AI())->isEnraged = true;
                        }
                        DoCast(me, SPELL_ENRAGE, true);
                        isEnraged = true;
                    }

                    if(!isBanished && (me->GetHealth()*100)/me->GetMaxHealth() < 1)
                    {
                        if(Unit *Sath = Unit::GetUnit(*me, SathGUID))
                        {
                            if(CAST_AI(boss_sathrovarr::boss_sathrovarrAI,((Creature*)Sath)->AI())->isBanished)
                            {
                                Sath->DealDamage(Sath, Sath->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                                return;
                            }
                            else
                            {
                                DoCast(me, SPELL_BANISH);
                                isBanished = true;
                            }
                        }
                        else
                        {
                            sLog->outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted.");
                            EnterEvadeMode();
                            return;
                        }
                    }
                    CheckTimer = 1000;
            }else CheckTimer -= diff;

            if(ArcaneBuffetTimer <= diff)
            {
                if(TryDoCastAOE(SPELL_ARCANE_BUFFET))
                    ArcaneBuffetTimer = 8000;
            }else ArcaneBuffetTimer -= diff;

            if(FrostBreathTimer <= diff)
            {
                if(TryDoCastAOE(SPELL_FROST_BREATH))
                    FrostBreathTimer = 15000;
            }else FrostBreathTimer -= diff;

            if(TailLashTimer <= diff)
            {
                if(TryDoCastAOE(SPELL_TAIL_LASH))
                    TailLashTimer = 15000;
            }else TailLashTimer -= diff;

            if(WildMagicTimer <= diff)
            {
                if(TryDoCastAOE(WildMagic[rand()%6]))
                    WildMagicTimer = 20000;
            }else WildMagicTimer -= diff;

            if(SpectralBlastTimer <= diff)
            {
                //this is a hack. we need to find a victim without aura in core
                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
                if( target && target->isAlive() && !(target->HasAuraEffect(AURA_SPECTRAL_EXHAUSTION, 0)) )
                {
                    if(TryDoCast(target, SPELL_SPECTRAL_BLAST))
                        SpectralBlastTimer = 20000+(rand()%5000);
                }
                else
                {
                    SpectralBlastTimer = 1000;
                }
            }else SpectralBlastTimer -= diff;

            DoMeleeAttackIfReady();
        }
    };
Пример #7
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if(CheckTimer <= diff)
            {
                if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !isEnraged)
                {
                    Unit* Kalecgos = Unit::GetUnit(*me, KalecgosGUID);
                    if(Kalecgos)
                    {
                        Kalecgos->CastSpell(Kalecgos, SPELL_ENRAGE, true);
                        CAST_AI(boss_kalecgos::boss_kalecgosAI,((Creature*)Kalecgos)->AI())->isEnraged = true;
                    }
                    DoCast(me, SPELL_ENRAGE, true);
                    isEnraged = true;
                }

                if(!isBanished && (me->GetHealth()*100)/me->GetMaxHealth() < 1)
                {
                    if(Unit *Kalecgos = Unit::GetUnit(*me, KalecgosGUID))
                    {
                        if(CAST_AI(boss_kalecgos::boss_kalecgosAI,((Creature*)Kalecgos)->AI())->isBanished)
                        {
                            me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                            return;
                        }
                        else
                        {
                            DoCast(me, SPELL_BANISH);
                            isBanished = true;
                        }
                    }
                    else
                    {
                        sLog->outError("Sathrovarr is unable to find Kalecgos");
                        EnterEvadeMode();
                        return;
                    }
                }
                CheckTimer = 1000;
            }else CheckTimer -= diff;

            if(ResetThreat <= diff)
            {
                if ( ( me->getVictim()->HasAuraEffect(AURA_SPECTRAL_EXHAUSTION,0)) && (me->getVictim()->GetTypeId() == TYPEID_PLAYER) )
                {
                    for(std::list<HostileReference*>::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
                    {
                        if(((*itr)->getUnitGuid()) ==  (me->getVictim()->GetGUID()))
                        {
                            (*itr)->removeReference();
                            break;
                        }
                    }
                }
                ResetThreat = 1000;
            }else ResetThreat -= diff;

            if(ShadowBoltTimer <= diff)
            {
                if(TryDoCast(me, SPELL_SHADOW_BOLT))
                {
                    DoScriptText(SAY_SATH_SPELL1, me);
                    ShadowBoltTimer = 7000+(rand()%3000);
                }
            }else ShadowBoltTimer -= diff;

            if(AgonyCurseTimer <= diff)
            {
                Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                if(!ptarget) ptarget = me->getVictim();
                if(TryDoCast(ptarget, SPELL_AGONY_CURSE))
                    AgonyCurseTimer = 20000;
            }else AgonyCurseTimer -= diff;

            if(CorruptionStrikeTimer <= diff)
            {
                if(TryDoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE))
                {
                    DoScriptText(SAY_SATH_SPELL2, me);
                    CorruptionStrikeTimer = 13000;
                }
            }else CorruptionStrikeTimer -= diff;

            DoMeleeAttackIfReady();
        }
Пример #8
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (BlessingTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCasted(false))
            {
                if (Unit* pUnit = SelectCouncilMember())
                {

                    switch (rand()%2)
                    {
                        case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD);  break;
                        case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break;
                    }
                }
                BlessingTimer = 15000;
            }
        } else BlessingTimer -= diff;

        if (JudgeTimer <= diff)
        {
           if (!me->IsNonMeleeSpellCasted(false))
           {
                if (me->HasAura(SPELL_SEAL_OF_COMMAND,0))
                {
                    if (TryDoCast(me->getVictim(),SPELL_JUDGEMENT_OF_COMMAND))
                    {
                        me->RemoveAurasDueToSpell(SPELL_SEAL_OF_COMMAND);
                        JudgeTimer = 45000;
                    }
                }
                if (me->HasAura(SPELL_SEAL_OF_BLOOD,0))
                {
                    if (TryDoCast(me->getVictim(),SPELL_JUDGEMENT_OF_BLOOD))
                    {
                        me->RemoveAurasDueToSpell(SPELL_SEAL_OF_BLOOD);
                        JudgeTimer = 45000;
                    }
                }
                JudgeTimer = 15000;
           }
        } else JudgeTimer -= diff;

        if (ConsecrationTimer <= diff)
        {
            if (TryDoCast(me, SPELL_CONSECRATION))
                ConsecrationTimer = 30000;
        } else ConsecrationTimer -= diff;

        if (HammerOfJusticeTimer <= diff)
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                // is in ~10-40 yd range
                if (me->GetDistance2d(pTarget) > 10)
                {
                    if (TryDoCast(pTarget, SPELL_HAMMER_OF_JUSTICE))
                        HammerOfJusticeTimer = 20000;
                }
            }
        } else HammerOfJusticeTimer -= diff;

        if (SealTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCasted(false))
            {
                switch (rand()%2)
                {
                    case 0: DoCast(me, SPELL_SEAL_OF_COMMAND);  break;
                    case 1: DoCast(me, SPELL_SEAL_OF_BLOOD);    break;
                }
                SealTimer = 30000;
            }
        } else SealTimer -= diff;

        if (AuraTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCasted(false))
            {
                CastAuraOnCouncil();
                AuraTimer = 60000;
            }
        } else AuraTimer -= diff;

        DoMeleeAttackIfReady();
    }
        void UpdateAI(const uint32 diff)
        {
            if(Intro)
            {
                if(AggroTimer < diff)
                {
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    DoScriptText(SAY_AGGRO, me);
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
                    Intro = false;
                    if(AggroTargetGUID)
                    {
                        Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID);
                        if(pUnit)
                            AttackStart(pUnit);

                        DoZoneInCombat();
                    }
                    else
                    {
                        EnterEvadeMode();
                        return;
                    }
                }else AggroTimer -= diff;
            }

            if(!UpdateVictim() || Intro)
                return;

            if(pulse_Timer < diff)
            {
                DoAttackerAreaInCombat(me->getVictim(),50);
                pulse_Timer = 10000;
            }else pulse_Timer -= diff;

            //if(SummonShadowsTimer < diff)
            //{
            //    MindControlGhost();

            //    for(uint8 i = 0; i < 2; ++i)
            //    {
            //        Creature* Shadow = NULL;
            //        float X = CalculateRandomLocation(me->GetPositionX(), 10);
            //        //Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
            //        if(Shadow)
            //        {
            //            Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
            //            if(!ptarget)
            //                ptarget = me->getVictim();

            //            if(ptarget)
            //                Shadow->AI()->AttackStart(ptarget);
            //        }
            //    }
            //    SummonShadowsTimer = 60000;
            //}else SummonShadowsTimer -= diff;

            if(SummonDoomBlossomTimer < diff)
            {
                if (Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
                {
                    if(TryDoCast(ptarget,SPELL_SUMMON_DOOM_BLOSSOM))
                        SummonDoomBlossomTimer = 35000;
                }
            }else SummonDoomBlossomTimer -= diff;

            if(IncinerateTimer < diff)
            {
                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 300, true);
                if(!target)
                    target = me->getVictim();

                if(target)
                {
                    if(TryDoCast(target, SPELL_INCINERATE))
                    {
                        switch(rand()%2)
                        {
                        case 0: DoScriptText(SAY_SPECIAL1, me); break;
                        case 1: DoScriptText(SAY_SPECIAL2, me); break;
                        }
                        IncinerateTimer = 10000 + (rand()%10) * 1000;
                    }
                }
            }else IncinerateTimer -= diff;

            if(CrushingShadowsTimer < diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    SpellEntry *spellInfo;
                    spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CRUSHING_SHADOWS);
                    if(spellInfo)
                    {
                        spellInfo->MaxAffectedTargets = 5;
                        me->CastSpell(me,spellInfo,false);
                    }
                    CrushingShadowsTimer = 10000 + rand()%5000;
                }
            }else CrushingShadowsTimer -= diff;

            if(ShadowOfDeathTimer < diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 300, true);

                    if(!target)
                       target = me->getVictim();

                    if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER && !target->HasAura(SPELL_SHADOW_OF_DEATH,1) )
                    {
                        // Custom ... becaus Effekt is not needed
                        SpellEntry *spellInfo;
                        spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SHADOW_OF_DEATH);
                        if(spellInfo)
                        {
                            spellInfo->Effect[0] = 0;
                            me->CastSpell(target,spellInfo,false);
                        }

                        //DoCast(target, SPELL_SHADOW_OF_DEATH);
                    
                        //me->CastCustomSpell(target,SPELL_SHADOW_OF_DEATH,NULL,NULL,NULL,false);
                        /*GhostGUID = target->GetGUID();*/
                        ShadowOfDeathTimer = 30000;
                        //SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player
                    }
                }
            }else ShadowOfDeathTimer -= diff;

            if(SummonShadowsTimer < diff)
            {
                if(!shadowtargets.empty())
                {

                    std::list<uint64> del_player;
                    del_player.clear();
                    for(std::list<uint64>::iterator itr = shadowtargets.begin(); itr != shadowtargets.end(); ++itr)
                    {
                        Player* temp = Unit::GetPlayer(*me,*itr);
                        if(temp)
                        {
                            if(temp->isDead() || !temp->HasAuraEffect(SPELL_SHADOW_OF_DEATH,1))
                            {
                                float x,y,z;
                                temp->GetPosition(x,y,z);
                                Unit *ptarget;
                                Creature* c_temp;

                                c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x+3 ,y+3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
                                ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                                if(!ptarget) ptarget = me->getVictim();
                                if(ptarget) c_temp->Attack(ptarget,true);

                                c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x-3 ,y+3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
                                ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                                if(!ptarget) ptarget = me->getVictim();
                                if(ptarget) c_temp->Attack(ptarget,true);

                                c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x+3 ,y-3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
                                ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                                if(!ptarget) ptarget = me->getVictim();
                                if(ptarget) c_temp->Attack(ptarget,true);

                                c_temp = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, x-3 ,y-3 , z , 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
                                ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                                if(!ptarget) ptarget = me->getVictim();
                                if(ptarget) c_temp->Attack(ptarget,true);

                                del_player.push_back(*itr);
                            }
                        }/*else
                            del_player.push_back(*itr);*/
                        //Auskommentieren fixt ALT+F4 Exploit 
                    }
                    for(std::list<uint64>::iterator itr = del_player.begin(); itr != del_player.end(); ++itr)
                    {
                        shadowtargets.remove(*itr);
                        Player* sacrifice = Unit::GetPlayer(*me,*itr);
                        if(sacrifice && sacrifice->isAlive())
                        {
                            me->DealDamage(sacrifice,sacrifice->GetHealth());
                        }
                    }
                }
                SummonShadowsTimer = 1000;
            }else SummonShadowsTimer -= diff;

            if(RandomYellTimer < diff)
            {
                switch(rand()%2)
                {
                case 0: DoScriptText(SAY_SPELL1, me); break;
                case 1: DoScriptText(SAY_SPELL2, me); break;
                }
                RandomYellTimer = 50000 + rand()%51 * 1000;
            }else RandomYellTimer -= diff;

            if(!me->HasAura(SPELL_BERSERK, 0))
            {
                if(EnrageTimer < diff)
                {
                    DoCast(me, SPELL_BERSERK);
                    DoScriptText(SAY_ENRAGE, me);
                }else EnrageTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }