void MovementInform(uint32 uiType, uint32 uiPointId) override
    {
        if (!m_pInstance)
            return;

        if (uiType == WAYPOINT_MOTION_TYPE)
        {
            if (m_uiMovementTimer || m_bIsEventInProgress)
                return;

            if (m_pInstance->GetData(TYPE_NAZAN) == SPECIAL)
            {
                m_creature->SetCombatStartPosition(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
                m_uiMovementTimer = 1000;
                m_bIsEventInProgress = true;
            }
        }

        if (uiType == POINT_MOTION_TYPE)
        {
            switch (uiPointId)
            {
                case POINT_ID_CENTER:
                    DoSplit();
                    break;
                case POINT_ID_COMBAT:
                {
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    m_pInstance->SetData(TYPE_NAZAN, IN_PROGRESS);

                    // Landing
                    // undo flying
                    m_creature->SetByteValue(UNIT_FIELD_BYTES_1, 3, 0);
                    m_creature->SetLevitate(false);

                    Player* pPlayer = m_creature->GetMap()->GetPlayer(m_lastSeenPlayerGuid);
                    if (pPlayer && pPlayer->isAlive())
                        AttackStart(pPlayer);

                    // Initialize for combat
                    m_uiFireballTimer = urand(5200, 16500);

                    break;
                }
                case POINT_ID_FLYING:
                    if (m_bIsEventInProgress)               // Additional check for wipe case, while nazan is flying to this point
                        m_uiFireballTimer = 1;
                    break;
            }
        }
    }
示例#2
0
        void UpdateAI(const uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            //ArcaneExplosion_Timer
            if (ArcaneExplosion_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
                ArcaneExplosion_Timer = 8000 + rand()%10000;
            } else ArcaneExplosion_Timer -= diff;

            //If we are within range melee the target
            if (me->IsWithinMeleeRange(me->getVictim()))
            {
                //Make sure our attack is ready and we arn't currently casting
                if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
                {
                    me->AttackerStateUpdate(me->getVictim());
                    me->resetAttackTimer();
                }
            } else
            {
                //EarthShock_Timer
                if (EarthShock_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_EARTH_SHOCK);
                    EarthShock_Timer = 1000;
                } else EarthShock_Timer -= diff;
            }

            //Blink_Timer
            if (Blink_Timer <= diff)
            {
                //DoCast(me, SPELL_BLINK);
                switch (urand(0, 2))
                {
                case 0:
                    me->GetMap()->CreatureRelocation(me, -8340.782227f, 2083.814453f, 125.648788f, 0.0f);
                    DoResetThreat();
                    break;
                case 1:
                    me->GetMap()->CreatureRelocation(me, -8341.546875f, 2118.504639f, 133.058151f, 0.0f);
                    DoResetThreat();
                    break;
                case 2:
                    me->GetMap()->CreatureRelocation(me, -8318.822266f, 2058.231201f, 133.058151f, 0.0f);
                    DoResetThreat();
                    break;
                }
                DoStopAttack();

                Blink_Timer= 20000 + rand()%20000;
            } else Blink_Timer -= diff;

            int procent = (int) (me->GetHealthPct() + 0.5f);

            //Summoning 2 Images and teleporting to a random position on 75% health
            if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
                DoSplit(75);

            //Summoning 2 Images and teleporting to a random position on 50% health
            if ((!Images50 && !IsImage) && (procent <= 50 && procent > 45))
                DoSplit(50);

            //Summoning 2 Images and teleporting to a random position on 25% health
            if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20))
                DoSplit(25);

            //Invisible_Timer
            if (Invisible)
            {
                if (Invisible_Timer <= diff)
                {
                    //Making Skeram visible after telporting
                    me->SetVisible(true);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    Invisible_Timer = 2500;
                    Invisible = false;
                } else Invisible_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
    void UpdateAI(const uint32 diff)
    {
        if (!Intro && !m_creature->isInCombat())
        {
            if (!m_pInstance)
                return;

            if (Intro_Timer < diff)
            {
                switch(Intro_Phase)
                {
                case 1:
                    DoScriptText(SAY_INTRO, m_creature);
                    if (GameObject* pSphere = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_SPHERE_SHIELD)))
                        pSphere->SetGoState(GO_STATE_ACTIVE);
                    ++Intro_Phase;
                    Intro_Timer = 25000;
                    break;
                case 2:
                    DoScriptText(SAY_AGGRO, m_creature);
                    if (Unit *mellic = Unit::GetUnit(*m_creature, m_pInstance->GetData64(DATA_MELLICHAR)))
                    {
                        //should have a better way to do this. possibly spell exist.
                        mellic->setDeathState(JUST_DIED);
                        mellic->SetHealth(0);
                    }
                    ++Intro_Phase;
                    Intro_Timer = 3000;
                    break;
                case 3:
                    Intro = true;
                    break;
                }
            } else Intro_Timer -=diff;
        }

        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
            return;

        if (!IsImage66 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 66))
        {
            DoSplit(66);
            IsImage66 = true;
        }

        if (!IsImage33 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 33))
        {
            DoSplit(33);
            IsImage33 = true;
        }

        if (MindRend_Timer < diff)
        {
            if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1))
                DoCast(target, m_bIsHeroicMode ? H_SPELL_MIND_REND : SPELL_MIND_REND);
            else
                DoCast(m_creature->getVictim(), m_bIsHeroicMode ? H_SPELL_MIND_REND : SPELL_MIND_REND);

            MindRend_Timer = 8000;
        } else MindRend_Timer -=diff;

        if (Fear_Timer < diff)
        {
            if (m_creature->IsNonMeleeSpellCasted(false))
                return;

            switch(rand()%2)
            {
            case 0:
                DoScriptText(SAY_FEAR_1, m_creature);
                break;
            case 1:
                DoScriptText(SAY_FEAR_2, m_creature);
                break;
            }

            if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1))
                DoCast(target,SPELL_FEAR);
            else
                DoCast(m_creature->getVictim(),SPELL_FEAR);

            Fear_Timer = 25000;
        } else Fear_Timer -=diff;

        if (Domination_Timer < diff)
        {
            if (m_creature->IsNonMeleeSpellCasted(false))
                return;

            switch(rand()%2)
            {
            case 0:
                DoScriptText(SAY_MIND_1, m_creature);
                break;
            case 1:
                DoScriptText(SAY_MIND_2, m_creature);
                break;
            }

            if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1))
                DoCast(target, m_bIsHeroicMode ? H_SPELL_DOMINATION : SPELL_DOMINATION);
            else
                DoCast(m_creature->getVictim(), m_bIsHeroicMode ? H_SPELL_DOMINATION : SPELL_DOMINATION);

            Domination_Timer = 16000+rand()%16000;
        } else Domination_Timer -=diff;

        if (m_bIsHeroicMode)
        {
            if (ManaBurn_Timer < diff)
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    return;

                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1))
                    DoCast(target,H_SPELL_MANA_BURN);

                ManaBurn_Timer = 16000+rand()%16000;
            } else ManaBurn_Timer -=diff;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_bIntroFinished && !m_creature->isInCombat())
        {
            if (!m_pInstance)
                return;

            if (m_uiIntroTimer < uiDiff)
            {
                switch(m_uiIntroPhase)
                {
                    case 1:
                        DoScriptText(SAY_INTRO, m_creature);
                        if (GameObject* pSphere = m_pInstance->GetSingleGameObjectFromStorage(GO_SEAL_SPHERE))
                            pSphere->SetGoState(GO_STATE_ACTIVE);
                        ++m_uiIntroPhase;
                        m_uiIntroTimer = 25000;
                        break;
                    case 2:
                        DoScriptText(SAY_AGGRO, m_creature);
                        if (Creature* pMellic = m_pInstance->GetSingleCreatureFromStorage(NPC_MELLICHAR))
                        {
                            // should have a better way to do this. possibly spell exist.
                            pMellic->SetDeathState(JUST_DIED);
                            pMellic->SetHealth(0);
                        }
                        ++m_uiIntroPhase;
                        m_uiIntroTimer = 3000;
                        break;
                    case 3:
                        m_bIntroFinished = true;
                        // TODO - Let Attack here, or change Unit_flag
                        break;
                }
            }
            else
                m_uiIntroTimer -=uiDiff;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (!m_bDidSplitImage66 && m_creature->GetHealthPercent() <= 66.0f)
        {
            m_bDidSplitImage66 = true;
            DoSplit();
        }

        if (!m_bDidSplitImage33 && m_creature->GetHealthPercent() <= 33.0f)
        {
            m_bDidSplitImage33 = true;
            DoSplit();
        }

        if (m_uiMindRendTimer < uiDiff)
        {
            Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
            if (!pTarget)
                pTarget = m_creature->getVictim();

            if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_MIND_REND : SPELL_MIND_REND_H) == CAST_OK)
                m_uiMindRendTimer = 8000;
        }
        else
            m_uiMindRendTimer -=uiDiff;

        if (m_uiFearTimer < uiDiff)
        {
            Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
            if (!pTarget)
                pTarget = m_creature->getVictim();

            if (DoCastSpellIfCan(pTarget, SPELL_FEAR) == CAST_OK)
            {
                DoScriptText(urand(0, 1) ? SAY_FEAR_1 : SAY_FEAR_2, m_creature);
                m_uiFearTimer = 25000;
            }
        }
        else
            m_uiFearTimer -=uiDiff;

        if (m_uiDominationTimer < uiDiff)
        {
            Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
            if (!pTarget)
                pTarget = m_creature->getVictim();

            if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_DOMINATION : SPELL_DOMINATION_H) == CAST_OK)
            {
                DoScriptText(urand(0, 1) ? SAY_MIND_1 : SAY_MIND_2, m_creature);
                m_uiDominationTimer = urand(16000, 32000);
            }
        }
        else
            m_uiDominationTimer -=uiDiff;

        if (!m_bIsRegularMode)
        {
            if (m_uiManaBurnTimer < uiDiff)
            {
                Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1);
                if (!pTarget)
                    pTarget = m_creature->getVictim();

                if (DoCastSpellIfCan(pTarget, SPELL_MANA_BURN_H) == CAST_OK)
                    m_uiManaBurnTimer = urand(16000, 32000);
            }
            else
                m_uiManaBurnTimer -=uiDiff;
        }

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

                    if (Intro_Timer <= diff)
                    {
                        switch(Intro_Phase)
                        {
                        case 1:
                            DoScriptText(SAY_INTRO, me);
                            pInstance->HandleGameObject(pInstance->GetData64(DATA_SPHERE_SHIELD), true);
                            ++Intro_Phase;
                            Intro_Timer = 25000;
                            break;
                        case 2:
                            DoScriptText(SAY_AGGRO, me);
                            if (Unit* mellic = Unit::GetUnit(*me, pInstance->GetData64(DATA_MELLICHAR)))
                            {
                                //should have a better way to do this. possibly spell exist.
                                mellic->setDeathState(JUST_DIED);
                                mellic->SetHealth(0);
                                pInstance->SetData(TYPE_SHIELD_OPEN, IN_PROGRESS);
                            }
                            ++Intro_Phase;
                            Intro_Timer = 3000;
                            break;
                        case 3:
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
                            Intro = true;
                            break;
                        }
                    }
                    else
                        Intro_Timer -=diff;
                }
                if (!UpdateVictim())
                    return;

                if (!IsImage66 && !HealthAbovePct(66))
                {
                    DoSplit(66);
                    IsImage66 = true;
                }
                if (!IsImage33 && !HealthAbovePct(33))
                {
                    DoSplit(33);
                    IsImage33 = true;
                }

                if (MindRend_Timer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_MIND_REND);
                    else
                        DoCast(me->getVictim(), SPELL_MIND_REND);

                    MindRend_Timer = 8000;
                }
                else
                    MindRend_Timer -=diff;

                if (Fear_Timer <= diff)
                {
                    if (me->IsNonMeleeSpellCasted(false))
                        return;

                    DoScriptText(RAND(SAY_FEAR_1, SAY_FEAR_2), me);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_FEAR);
                    else
                        DoCast(me->getVictim(), SPELL_FEAR);

                    Fear_Timer = 25000;
                }
                else
                    Fear_Timer -=diff;

                if (Domination_Timer <= diff)
                {
                    if (me->IsNonMeleeSpellCasted(false))
                        return;

                    DoScriptText(RAND(SAY_MIND_1, SAY_MIND_2), me);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_DOMINATION);
                    else
                        DoCast(me->getVictim(), SPELL_DOMINATION);

                    Domination_Timer = 16000+rand()%16000;
                }
                else
                    Domination_Timer -=diff;

                if (IsHeroic())
                {
                    if (ManaBurn_Timer <= diff)
                    {
                        if (me->IsNonMeleeSpellCasted(false))
                            return;

                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                            DoCast(target, H_SPELL_MANA_BURN);

                        ManaBurn_Timer = 16000+rand()%16000;
                    }
                    else
                        ManaBurn_Timer -=diff;
                }
                DoMeleeAttackIfReady();
            }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        //ArcaneExplosion_Timer
        if (ArcaneExplosion_Timer < diff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION);
            ArcaneExplosion_Timer = urand(8000, 18000);
        }else ArcaneExplosion_Timer -= diff;

        //If we are within range melee the target
        if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
        {
            //Make sure our attack is ready and we arn't currently casting
            if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
            {
                m_creature->AttackerStateUpdate(m_creature->getVictim());
                m_creature->resetAttackTimer();
            }
        }else
        {
            //EarthShock_Timer
            if (EarthShock_Timer < diff)
            {
                DoCastSpellIfCan(m_creature->getVictim(),SPELL_EARTH_SHOCK);
                EarthShock_Timer = 1000;
            }else EarthShock_Timer -= diff;
        }

        //Blink_Timer
        if (Blink_Timer < diff)
        {
            //DoCastSpellIfCan(m_creature, SPELL_BLINK);
            switch(urand(0, 2))
            {
                case 0:
                    m_creature->GetMap()->CreatureRelocation(m_creature, -8340.782227f, 2083.814453f, 125.648788f, 0.0f);
                    DoResetThreat();
                    break;
                case 1:
                    m_creature->GetMap()->CreatureRelocation(m_creature, -8341.546875f, 2118.504639f, 133.058151f, 0.0f);
                    DoResetThreat();
                    break;
                case 2:
                    m_creature->GetMap()->CreatureRelocation(m_creature, -8318.822266f, 2058.231201f, 133.058151f, 0.0f);
                    DoResetThreat();
                    break;
            }
            DoStopAttack();

            Blink_Timer = urand(20000, 40000);
        }else Blink_Timer -= diff;

        float procent = m_creature->GetHealthPercent();

        //Summoning 2 Images and teleporting to a random position on 75% health
        if (!Images75 && !IsImage && procent <= 75.0f && procent > 70.0f)
            DoSplit(75);

        //Summoning 2 Images and teleporting to a random position on 50% health
        if (!Images50 && !IsImage && procent <= 50.0f && procent > 45.0f)
            DoSplit(50);

        //Summoning 2 Images and teleporting to a random position on 25% health
        if (!Images25 && !IsImage && procent <= 25.0f && procent > 20.0f)
            DoSplit(25);

        //Invisible_Timer
        if (Invisible)
        {
            if (Invisible_Timer < diff)
            {
                //Making Skeram visible after telporting
                m_creature->SetVisibility(VISIBILITY_ON);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                Invisible_Timer = 2500;
                Invisible = false;
            }else Invisible_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 diff)
    {
        if (!Intro && !m_creature->isInCombat())
        {
            if (!m_pInstance)
                return;

            if (Intro_Timer < diff)
            {
                switch(Intro_Phase)
                {
                case 1:
                    DoScriptText(SAY_INTRO, m_creature);
                    if (GameObject* pSphere = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_SPHERE_SHIELD)))
                        pSphere->SetGoState(GO_STATE_ACTIVE);
                    ++Intro_Phase;
                    Intro_Timer = 25000;
                    break;
                case 2:
                    DoScriptText(SAY_AGGRO, m_creature);
                    if (Creature *mellic = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(DATA_MELLICHAR)))
                    {
                        //should have a better way to do this. possibly spell exist.
                        mellic->SetDeathState(JUST_DIED);
                        mellic->SetHealth(0);
                    }
                    ++Intro_Phase;
                    Intro_Timer = 3000;
                    break;
                case 3:
                    Intro = true;
                    break;
                }
            } else Intro_Timer -=diff;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (!IsImage66 && m_creature->GetHealthPercent() <= 66.0f)
        {
            IsImage66 = true;
            DoSplit();
        }

        if (!IsImage33 && m_creature->GetHealthPercent() <= 33.0f)
        {
            IsImage33 = true;
            DoSplit();
        }

        if (MindRend_Timer < diff)
        {
            if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_MIND_REND : H_SPELL_MIND_REND);
            else
                DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_MIND_REND : H_SPELL_MIND_REND);

            MindRend_Timer = 8000;
        } else MindRend_Timer -=diff;

        if (Fear_Timer < diff)
        {
            if (m_creature->IsNonMeleeSpellCasted(false))
                return;

            DoScriptText(urand(0, 1) ? SAY_FEAR_1 : SAY_FEAR_2, m_creature);

            if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                DoCastSpellIfCan(target,SPELL_FEAR);
            else
                DoCastSpellIfCan(m_creature->getVictim(),SPELL_FEAR);

            Fear_Timer = 25000;
        } else Fear_Timer -=diff;

        if (Domination_Timer < diff)
        {
            if (m_creature->IsNonMeleeSpellCasted(false))
                return;

            DoScriptText(urand(0, 1) ? SAY_MIND_1 : SAY_MIND_2, m_creature);

            if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_DOMINATION : H_SPELL_DOMINATION);
            else
                DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_DOMINATION : H_SPELL_DOMINATION);

            Domination_Timer = urand(16000, 32000);
        } else Domination_Timer -=diff;

        if (!m_bIsRegularMode)
        {
            if (ManaBurn_Timer < diff)
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    return;

                if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                    DoCastSpellIfCan(target,H_SPELL_MANA_BURN);

                ManaBurn_Timer = urand(16000, 32000);
            } else ManaBurn_Timer -=diff;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 diff)
    {
        if( !Intro && !InCombat )
        {
            if( !pInstance )
                return;

            if( Intro_Timer < diff )
            {
                switch( Intro_Phase )
                {
                    case 1:
                        DoYell(SAY_INTRO, LANG_UNIVERSAL, NULL);
                        DoPlaySoundToSet(m_creature,SOUND_INTRO);
                        ++Intro_Phase;
                        Intro_Timer = 25000;
                        break;
                    case 2:
                        DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);
                        DoPlaySoundToSet(m_creature,SOUND_AGGRO);
                        if( Unit *mellic = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_MELLICHAR)) )
                        {
                            //should have a better way to do this. possibly spell exist.
                            mellic->setDeathState(JUST_DIED);
                            mellic->SetHealth(0);
							pInstance->SetData(TYPE_SHIELD_OPEN,IN_PROGRESS);
                        }
                        ++Intro_Phase;
                        Intro_Timer = 3000;
                        break;
                    case 3:
                        Intro = true;
                        break;
                }
            }else Intro_Timer -=diff;
        }

        if( !m_creature->SelectHostilTarget() || !m_creature->getVictim() )
            return;

        if( !IsImage66 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 66) )
        {
            DoSplit(66);
            IsImage66 = true;
        }
        if( !IsImage33 && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 33) )
        {
            DoSplit(33);
            IsImage33 = true;
        }

        if( MindRend_Timer < diff )
        {
            if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) )
                DoCast(target,HeroicMode ? H_SPELL_MIND_REND : SPELL_MIND_REND);
            else
                DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_MIND_REND : SPELL_MIND_REND);

            MindRend_Timer = 8000;
        }else MindRend_Timer -=diff;

        if( Fear_Timer < diff )
        {
            if( m_creature->IsNonMeleeSpellCasted(false) )
                return;

            switch(rand()%2)
            {
                case 0:
                    DoYell(SAY_FEAR_1, LANG_UNIVERSAL, NULL);
                    DoPlaySoundToSet(m_creature,SOUND_FEAR_1);
                    break;
                case 1:
                    DoYell(SAY_FEAR_2, LANG_UNIVERSAL, NULL);
                    DoPlaySoundToSet(m_creature,SOUND_FEAR_2);
                    break;
            }

            if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) )
                DoCast(target,SPELL_FEAR);
            else
                DoCast(m_creature->getVictim(),SPELL_FEAR);

            Fear_Timer = 25000;
        }else Fear_Timer -=diff;

        if( Domination_Timer < diff )
        {
            if( m_creature->IsNonMeleeSpellCasted(false) )
                return;

            switch(rand()%2)
            {
                case 0:
                    DoYell(SAY_MIND_1, LANG_UNIVERSAL, NULL);
                    DoPlaySoundToSet(m_creature,SOUND_MIND_1);
                    break;
                case 1:
                    DoYell(SAY_MIND_2, LANG_UNIVERSAL, NULL);
                    DoPlaySoundToSet(m_creature,SOUND_MIND_2);
                    break;
            }

            if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) )
                DoCast(target,HeroicMode ? H_SPELL_DOMINATION : SPELL_DOMINATION);
            else
                DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_DOMINATION : SPELL_DOMINATION);

            Domination_Timer = 16000+rand()%16000;
        }else Domination_Timer -=diff;

        if( HeroicMode )
        {
            if( ManaBurn_Timer < diff )
            {
                if( m_creature->IsNonMeleeSpellCasted(false) )
                    return;

                if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) )
                    DoCast(target,H_SPELL_MANA_BURN);

                ManaBurn_Timer = 16000+rand()%16000;
            }else ManaBurn_Timer -=diff;
        }

        DoMeleeAttackIfReady();
    }
            void UpdateAI(uint32 diff) override
            {
                if (!Intro)
                {
                    if (Intro_Timer <= diff)
                    {
                        switch (Intro_Phase)
                        {
                        case 1:
                            Talk(SAY_INTRO);
                            instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), true);
                            ++Intro_Phase;
                            Intro_Timer = 25000;
                            break;
                        case 2:
                            Talk(SAY_AGGRO);
                            if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MELLICHAR)))
                            {
                                //should have a better way to do this. possibly spell exist.
                                mellic->setDeathState(JUST_DIED);
                                mellic->SetHealth(0);
                                instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false);
                            }
                            ++Intro_Phase;
                            Intro_Timer = 3000;
                            break;
                        case 3:
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
                            Intro = true;
                            break;
                        }
                    }
                    else
                        Intro_Timer -=diff;
                }
                if (!UpdateVictim())
                    return;

                if (!IsImage66 && !HealthAbovePct(66))
                {
                    DoSplit(66);
                    IsImage66 = true;
                }
                if (!IsImage33 && !HealthAbovePct(33))
                {
                    DoSplit(33);
                    IsImage33 = true;
                }

                if (MindRend_Timer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_MIND_REND);
                    else
                        DoCastVictim(SPELL_MIND_REND);

                    MindRend_Timer = 8000;
                }
                else
                    MindRend_Timer -=diff;

                if (Fear_Timer <= diff)
                {
                    if (me->IsNonMeleeSpellCast(false))
                        return;

                    Talk(SAY_FEAR);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_FEAR);
                    else
                        DoCastVictim(SPELL_FEAR);

                    Fear_Timer = 25000;
                }
                else
                    Fear_Timer -=diff;

                if (Domination_Timer <= diff)
                {
                    if (me->IsNonMeleeSpellCast(false))
                        return;

                    Talk(SAY_MIND);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                        DoCast(target, SPELL_DOMINATION);
                    else
                        DoCastVictim(SPELL_DOMINATION);

                    Domination_Timer = 16000 + rand32() % 16000;
                }
                else
                    Domination_Timer -=diff;

                if (IsHeroic())
                {
                    if (ManaBurn_Timer <= diff)
                    {
                        if (me->IsNonMeleeSpellCast(false))
                            return;

                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                            DoCast(target, H_SPELL_MANA_BURN);

                        ManaBurn_Timer = 16000 + rand32() % 16000;
                    }
                    else
                        ManaBurn_Timer -=diff;
                }
                DoMeleeAttackIfReady();
            }
示例#10
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

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

            if (ArcaneExplosionTimer <= diff)
            {
                DoCastAOE(SPELL_ARCANE_EXPLOSION);
                ArcaneExplosionTimer = urand(8000, 18000);
            }
			else ArcaneExplosionTimer -= diff;

			if (FullFillmentTimer <= diff)
            {
				if (Unit* target = SelectTarget(TARGET_RANDOM, 1, 45, true))
				{
					DoCast(target, SPELL_TRUE_FULFILLMENT);
					FullFillmentTimer = urand(20000, 22000);
				}
            }
			else FullFillmentTimer -= diff;

            if (me->IsWithinMeleeRange(me->GetVictim()))
            {
                if (me->IsAttackReady() && !me->IsNonMeleeSpellCasted(false))
                {
                    me->AttackerStateUpdate(me->GetVictim());
                    me->ResetAttackTimer();
                }
            }
			else
            {
                if (EarthShockTimer <= diff)
                {
                    DoCastVictim(SPELL_EARTH_SHOCK);
                    EarthShockTimer = 1000;
                }
				else EarthShockTimer -= diff;
            }

            if (BlinkTimer <= diff)
            {
                //DoCast(me, SPELL_BLINK);
                switch (urand(0, 2))
                {
                    case 0:
                        me->SetPosition(-8340.782227f, 2083.814453f, 125.648788f, 0.0f);
                        DoResetThreat();
                        break;
                    case 1:
                        me->SetPosition(-8341.546875f, 2118.504639f, 133.058151f, 0.0f);
                        DoResetThreat();
                        break;
                    case 2:
                        me->SetPosition(-8318.822266f, 2058.231201f, 133.058151f, 0.0f);
                        DoResetThreat();
                        break;
                }
                DoStopAttack();

                BlinkTimer= urand(20000, 40000);
            }
			else BlinkTimer -= diff;

            int procent = (int) (me->GetHealthPct() + 0.5f);

            if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
                DoSplit(75);

            if ((!Images50 && !IsImage) && (procent <= 50 && procent > 45))
                DoSplit(50);

            if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20))
                DoSplit(25);

            if (Invisible)
            {
                if (InvisibleTimer <= diff)
                {
                    me->SetVisible(true);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    InvisibleTimer = 2500;
                    Invisible = false;
                }
				else InvisibleTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }