Beispiel #1
0
    void SummonedCreatureDespawn(Creature* pSummoned) override
    {
        // Used only after evade
        if (SelectHostileTarget())
            return;

        // Despawn the tentacle portal - this applies to all the summoned tentacles for evade case (which is handled by creature linking)
        if (Creature* pPortal = GetClosestCreatureWithEntry(pSummoned, NPC_TENTACLE_PORTAL, 5.0f))
            pPortal->ForcedDespawn();
    }
Beispiel #2
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!SelectHostileTarget())
            return;

        switch (m_Phase)
        {
            case PHASE_TRANSITION:

                if (m_uiPhaseTimer < uiDiff)
                {
                    // Note: we need to set the display id before casting the transform spell, in order to get the proper animation
                    m_creature->SetDisplayId(DISPLAY_ID_CTHUN_BODY);

                    // Transform and start C'thun phase
                    if (DoCastSpellIfCan(m_creature, SPELL_TRANSFORM) == CAST_OK)
                    {
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        DoSpawnFleshTentacles();

                        m_Phase        = PHASE_CTHUN;
                        m_uiPhaseTimer = 0;
                    }
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            case PHASE_CTHUN:

                if (m_uiMouthTentacleTimer < uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, uint32(0), SELECT_FLAG_IN_LOS))
                    {
                        // Cast the spell using the target as source
                        pTarget->InterruptNonMeleeSpells(false);
                        pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
                        m_stomachEnterTargetGuid = pTarget->GetObjectGuid();

                        m_uiStomachEnterTimer  = 3800;
                        m_uiMouthTentacleTimer = urand(13000, 15000);
                    }
                }
                else
                    m_uiMouthTentacleTimer -= uiDiff;

                // Teleport the target to the stomach after a few seconds
                if (m_uiStomachEnterTimer)
                {
                    if (m_uiStomachEnterTimer <= uiDiff)
                    {
                        // Check for valid player
                        if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_stomachEnterTargetGuid))
                        {
                            DoTeleportPlayer(pPlayer, afCthunLocations[2][0], afCthunLocations[2][1], afCthunLocations[2][2], afCthunLocations[2][3]);
                            m_lPlayersInStomachList.push_back(pPlayer->GetObjectGuid());
                        }

                        m_stomachEnterTargetGuid.Clear();
                        m_uiStomachEnterTimer = 0;
                    }
                    else
                        m_uiStomachEnterTimer -= uiDiff;
                }

                break;
            case PHASE_CTHUN_WEAKENED:

                // Handle Flesh Tentacles respawn when the vulnerability spell expires
                if (m_uiPhaseTimer < uiDiff)
                {
                    DoSpawnFleshTentacles();

                    m_uiPhaseTimer = 0;
                    m_Phase        = PHASE_CTHUN;
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            default:
                break;
        }

        if (m_uiGiantClawTentacleTimer < uiDiff)
        {
            // Summon 1 Giant Claw Tentacle every 60 seconds
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, uint32(0), SELECT_FLAG_IN_LOS))
                m_creature->SummonCreature(NPC_GIANT_CLAW_TENTACLE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_DEAD_DESPAWN, 0);

            m_uiGiantClawTentacleTimer = 60000;
        }
        else
            m_uiGiantClawTentacleTimer -= uiDiff;

        if (m_uiGiantEyeTentacleTimer < uiDiff)
        {
            // Summon 1 Giant Eye Tentacle every 60 seconds
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, uint32(0), SELECT_FLAG_IN_LOS))
                m_creature->SummonCreature(NPC_GIANT_EYE_TENTACLE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_DEAD_DESPAWN, 0);

            m_uiGiantEyeTentacleTimer = 60000;
        }
        else
            m_uiGiantEyeTentacleTimer -= uiDiff;

        if (m_uiEyeTentacleTimer < uiDiff)
        {
            DoDespawnEyeTentacles();

            // Spawn 8 Eye Tentacles every 30 seconds
            float fX, fY, fZ;
            for (uint8 i = 0; i < MAX_EYE_TENTACLES; ++i)
            {
                m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, 30.0f, M_PI_F / 4 * i);
                m_creature->SummonCreature(NPC_EYE_TENTACLE, fX, fY, fZ, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
            }

            m_uiEyeTentacleTimer = 30000;
        }
        else
            m_uiEyeTentacleTimer -= uiDiff;

        // Note: this should be handled by the maps
        if (m_uiDigestiveAcidTimer < uiDiff)
        {
            // Iterate the Stomach players list and apply the Digesti acid debuff on them every 4 sec
            for (GuidList::const_iterator itr = m_lPlayersInStomachList.begin(); itr != m_lPlayersInStomachList.end(); ++itr)
            {
                if (Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr))
                    pPlayer->CastSpell(pPlayer, SPELL_DIGESTIVE_ACID, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
            }
            m_uiDigestiveAcidTimer = 4000;
        }
        else
            m_uiDigestiveAcidTimer -= uiDiff;
    }
Beispiel #3
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!SelectHostileTarget())
            return;

        switch (m_Phase)
        {
            case PHASE_EYE_NORMAL:

                if (m_uiBeamTimer < uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    {
                        if (DoCastSpellIfCan(pTarget, SPELL_EYE_BEAM) == CAST_OK)
                        {
                            m_creature->SetTargetGuid(pTarget->GetObjectGuid());
                            m_uiBeamTimer = 3000;
                        }
                    }
                }
                else
                    m_uiBeamTimer -= uiDiff;

                if (m_uiDarkGlareTimer < uiDiff)
                {
                    // Cast the rotation spell
                    if (DoCastSpellIfCan(m_creature, SPELL_ROTATE_TRIGGER) == CAST_OK)
                    {
                        // Remove the target focus but allow the boss to face the current victim
                        m_creature->SetTargetGuid(ObjectGuid());
                        m_creature->SetFacingToObject(m_creature->getVictim());

                        // Switch to Dark Glare phase
                        m_uiDarkGlareTimer    = 45000;
                        m_Phase               = PHASE_EYE_DARK_GLARE;
                    }
                }
                else
                    m_uiDarkGlareTimer -= uiDiff;

                break;
            case PHASE_EYE_DARK_GLARE:

                if (m_uiDarkGlareEndTimer < uiDiff)
                {
                    // Remove rotation auras
                    m_creature->RemoveAurasDueToSpell(SPELL_ROTATE_360_LEFT);
                    m_creature->RemoveAurasDueToSpell(SPELL_ROTATE_360_RIGHT);

                    // Switch to Eye Beam
                    m_uiDarkGlareEndTimer = 40000;
                    m_uiBeamTimer         = 1000;
                    m_Phase               = PHASE_EYE_NORMAL;
                }
                else
                    m_uiDarkGlareEndTimer -= uiDiff;

                break;
            default:
                break;
        }

        if (m_uiClawTentacleTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                // Spawn claw tentacle on the random target on both phases
                m_creature->SummonCreature(NPC_CLAW_TENTACLE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_DEAD_DESPAWN, 0);
                m_uiClawTentacleTimer = urand(7000, 13000);
            }
        }
        else
            m_uiClawTentacleTimer -= uiDiff;

        if (m_uiEyeTentacleTimer <= uiDiff)
        {
            // Despawn the eye tentacles if necessary
            DoDespawnEyeTentacles();

            // Spawn 8 Eye Tentacles
            float fX, fY, fZ;
            for (uint8 i = 0; i < MAX_EYE_TENTACLES; ++i)
            {
                m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, 30.0f, M_PI_F / 4 * i);
                m_creature->SummonCreature(NPC_EYE_TENTACLE, fX, fY, fZ, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
            }

            m_uiEyeTentacleTimer = 45000;
        }
        else
            m_uiEyeTentacleTimer -= uiDiff;
    }
Beispiel #4
0
	void UpdateAI(const uint32 uiDiff) override
	{
		// Intro timer
		if (m_uiDrainNordrassilTimer)
		{
			if (m_uiDrainNordrassilTimer <= uiDiff)
			{
				if (DoCastSpellIfCan(m_creature, SPELL_DRAIN_TREE) == CAST_OK)
				{
					if (!m_bHasIntro)
					{
						DoScriptText(SAY_INTRO, m_creature);
						m_bHasIntro = true;
					}
					m_uiDrainNordrassilTimer = 0;
				}
			}
			else
				m_uiDrainNordrassilTimer -= uiDiff;
		}

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

		// Start epilogue - fight was won!
		if (m_creature->GetHealthPercent() < 10.0f)
		{
			if (!m_bIsEpilogue)
			{
				DoScriptText(SAY_EPILOGUE, m_creature);

				// move at home position and start outro
				m_creature->GetMotionMaster()->MoveTargetedHome();
				SetCombatMovement(false);
				m_bIsEpilogue = true;
			}

			if (m_bStartEpilogue)
			{
				// Spam Finger of Death on players and Wisps
				if (m_uiFingerOfDeathTimer < uiDiff)
				{
					if (DoCastSpellIfCan(m_creature, urand(0, 1) ? SPELL_FINGER_DEATH_DUMMY : SPELL_FINGER_DEATH_SCRIPT) == CAST_OK)
						m_uiFingerOfDeathTimer = 1000;
				}
				else
					m_uiFingerOfDeathTimer -= uiDiff;

				if (m_uiSummonWispTimer < uiDiff)
				{
					float fX, fY, fZ;
					m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, 75.0f, urand(0, 1) ? frand(0, 2.8f) : frand(4.3f, M_PI_F * 2));
					m_creature->SummonCreature(NPC_ANCIENT_WISP, fX, fY, fZ, 0, TEMPSUMMON_TIMED_OOC_DESPAWN, 15000);
					m_uiSummonWispTimer = urand(1000, 1500);
				}
				else
					m_uiSummonWispTimer -= uiDiff;
			}

			// Stop using the other spells
			return;
		}

		if (m_uiEnrageTimer)
		{
			if (m_uiEnrageTimer <= uiDiff)
			{
				if (DoCastSpellIfCan(m_creature, SPELL_HAND_OF_DEATH) == CAST_OK)
				{
					DoScriptText(SAY_ENRAGE, m_creature);
					m_uiEnrageTimer = 0;
				}
			}
			else
				m_uiEnrageTimer -= uiDiff;
		}

		if (m_uiGripOfTheLegionTimer < uiDiff)
		{
			if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
			{
				if (DoCastSpellIfCan(pTarget, SPELL_GRIP_OF_THE_LEGION) == CAST_OK)
					m_uiGripOfTheLegionTimer = urand(5000, 10000);
			}
		}
		else
			m_uiGripOfTheLegionTimer -= uiDiff;

		if (m_uiAirBurstTimer < uiDiff)
		{
			if(Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_AIR_BURST, SELECT_FLAG_PLAYER))
			{
				if (DoCastSpellIfCan(pTarget, SPELL_AIR_BURST) == CAST_OK)
				{
					DoScriptText(urand(0, 1) ? SAY_AIR_BURST1 : SAY_AIR_BURST2, m_creature);
					m_uiAirBurstTimer = urand(10000, 20000);

					if(m_uiFearTimer <= 6000)
						m_uiFearTimer = 6000;
				}
			}
		}
		else
			m_uiAirBurstTimer -= uiDiff;

		if (m_uiFearTimer < uiDiff)
		{
			if (DoCastSpellIfCan(m_creature, SPELL_FEAR) == CAST_OK)
			{
				m_uiFearTimer = urand(40000, 50000);
				m_uiCheckRangeTimer = 5000;
			}

		}
		else
			m_uiFearTimer -= uiDiff;


		if (m_uiDoomfireTimer < uiDiff)
		{
			if (DoCastSpellIfCan(m_creature, SPELL_DOOMFIRE_STRIKE) == CAST_OK)
			{
				DoScriptText(urand(0, 1) ? SAY_DOOMFIRE1 : SAY_DOOMFIRE2, m_creature);
				m_uiDoomfireTimer = urand(8000, 12000);
			}
		}
		else
			m_uiDoomfireTimer -= uiDiff;

		if(m_uiCheckRangeTimer < uiDiff)
		{
			if (!m_creature->IsWithinDistInMap(m_creature->getVictim(), 10.0f))
			{
				if (!m_creature->IsNonMeleeSpellCasted(false))
					if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_FINGER_DEATH, SELECT_FLAG_PLAYER))
						DoCastSpellIfCan(pTarget, SPELL_FINGER_DEATH);
			}
			m_uiCheckRangeTimer = 3500;
		}else
			m_uiCheckRangeTimer -= uiDiff;

		DoMeleeAttackIfReady();
	}
    void UpdateAI(const uint32 uiDiff) override
    {
        // Banish the boss before combat
        if (m_uiBanishTimer)
        {
            if (m_uiBanishTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_LEOTHERAS_BANISH) == CAST_OK)
                    m_uiBanishTimer = 0;
            }
            else
                m_uiBanishTimer -= uiDiff;
        }

        // Return since we have no target
        if (!SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiFinalFormTimer)
        {
            if (m_uiFinalFormTimer <= uiDiff)
            {
                DoSpawnCreature(NPC_SHADOW_LEO, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());
                m_uiFinalFormTimer = 0;
            }
            else
                m_uiFinalFormTimer -= uiDiff;

            // Wait until we finish the transition
            return;
        }

        // Human form spells
        if (!m_bDemonForm)
        {
            if (m_uiWhirlwindTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_WHIRLWIND) == CAST_OK)
                    m_uiWhirlwindTimer = 32000;
            }
            else
                m_uiWhirlwindTimer -= uiDiff;

            if (!m_bIsFinalForm)
            {
                if (m_uiSwitchTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_METAMORPHOSIS) == CAST_OK)
                    {
                        DoScriptText(SAY_SWITCH_TO_DEMON, m_creature);

                        SetCombatMovement(false);
                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MoveIdle();
                        DoResetThreat();
                        m_bDemonForm = true;

                        m_uiInnerDemonTimer = 27500;
                        m_uiSwitchTimer = 60000;
                    }
                }
                else
                    m_uiSwitchTimer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
        // Demon form spells
        else
        {
            if (m_uiInnerDemonTimer)
            {
                if (m_uiInnerDemonTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_INSIDIOUS_WHISPER, CAST_INTERRUPT_PREVIOUS) == CAST_OK)
                    {
                        DoScriptText(SAY_INNER_DEMONS, m_creature);
                        m_uiInnerDemonTimer = 0;
                    }
                }
                else
                    m_uiInnerDemonTimer -= uiDiff;
            }

            if (m_uiChaosBlastTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAOS_BLAST) == CAST_OK)
                    m_uiChaosBlastTimer = urand(2000, 3000);
            }
            else
                m_uiChaosBlastTimer -= uiDiff;

            if (m_uiSwitchTimer < uiDiff)
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    m_creature->InterruptNonMeleeSpells(false);

                // switch to nightelf form
                m_creature->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS);

                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());

                DoResetThreat();
                m_bDemonForm = false;

                m_uiWhirlwindTimer = 18500;
                m_uiSwitchTimer = 45000;
            }
            else
                m_uiSwitchTimer -= uiDiff;
        }

        // Prepare to summon the Shadow of Leotheras
        if (!m_bIsFinalForm && m_creature->GetHealthPercent() < 15.0f)
        {
            DoScriptText(SAY_FINAL_FORM, m_creature);
            m_uiFinalFormTimer = 10000;

            // reset him to human form if necessary
            if (m_bDemonForm)
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    m_creature->InterruptNonMeleeSpells(false);

                // switch to nightelf form
                m_creature->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS);

                DoResetThreat();
                m_bDemonForm = false;
            }

            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            m_creature->HandleEmote(EMOTE_ONESHOT_KNEEL);

            SetCombatMovement(false);
            m_creature->GetMotionMaster()->Clear();
            m_creature->GetMotionMaster()->MoveIdle();

            m_bIsFinalForm = true;
        }

        // Hard enrage timer
        if (m_uiEnrageTimer)
        {
            if (m_uiEnrageTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
                    m_uiEnrageTimer = 0;
            }
            else
                m_uiEnrageTimer -= uiDiff;
        }
    }
Beispiel #6
0
    void UpdateAI(const uint32 uiDiff) override
    {
        // Intro timer
        if (m_uiDrainNordrassilTimer)
        {
            if (m_uiDrainNordrassilTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_DRAIN_TREE) == CAST_OK)
                {
                    if (!m_bHasIntro)
                    {
                        DoScriptText(SAY_INTRO, m_creature);
                        m_bHasIntro = true;
                    }
                    m_uiDrainNordrassilTimer = 0;
                }
            }
            else
                m_uiDrainNordrassilTimer -= uiDiff;
        }

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

        // Start epilogue - fight was won!
        if (m_creature->GetHealthPercent() < 10.0f)
        {
            if (!m_bIsEpilogue)
            {
                DoScriptText(SAY_EPILOGUE, m_creature);

                // move at home position and start outro
                m_creature->GetMotionMaster()->MoveTargetedHome();
                SetCombatMovement(false);
                m_bIsEpilogue = true;
            }

            if (m_bStartEpilogue)
            {
                // Spam Finger of Death on players and Wisps
                if (m_uiFingerOfDeathTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, urand(0, 1) ? SPELL_FINGER_DEATH_DUMMY : SPELL_FINGER_DEATH_SCRIPT) == CAST_OK)
                        m_uiFingerOfDeathTimer = 1000;
                }
                else
                    m_uiFingerOfDeathTimer -= uiDiff;

                if (m_uiSummonWispTimer < uiDiff)
                {
                    float fX, fY, fZ;
                    m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, 75.0f, urand(0, 1) ? frand(0, 2.8f) : frand(4.3f, M_PI_F * 2));
                    m_creature->SummonCreature(NPC_ANCIENT_WISP, fX, fY, fZ, 0, TEMPSUMMON_TIMED_OOC_DESPAWN, 15000);
                    m_uiSummonWispTimer = urand(1000, 1500);
                }
                else
                    m_uiSummonWispTimer -= uiDiff;
            }

            // Stop using the other spells
            return;
        }

        if (m_uiEnrageTimer)
        {
            if (m_uiEnrageTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_HAND_OF_DEATH) == CAST_OK)
                {
                    DoScriptText(SAY_ENRAGE, m_creature);
                    m_uiEnrageTimer = 0;
                }
            }
            else
                m_uiEnrageTimer -= uiDiff;
        }

        if (m_uiGripOfTheLegionTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_GRIP_OF_THE_LEGION) == CAST_OK)
                    m_uiGripOfTheLegionTimer = urand(5000, 25000);
            }
        }
        else
            m_uiGripOfTheLegionTimer -= uiDiff;

        if (m_uiAirBurstTimer < uiDiff)
        {
            if(Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_AIR_BURST, SELECT_FLAG_PLAYER))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_AIR_BURST) == CAST_OK)
                {
                    DoScriptText(urand(0, 1) ? SAY_AIR_BURST1 : SAY_AIR_BURST2, m_creature);
                    m_uiAirBurstTimer = urand(20000, 30000);
                }
            }
        }
        else
            m_uiAirBurstTimer -= uiDiff;

        if (m_uiFearTimer < uiDiff)
        {
            // Set CanFear by default
            m_bCanFear = true;
            //Check if nobody in the air
            std::vector<Unit*> suitableTargets;
            ThreatList const& threatList = m_creature->getThreatManager().getThreatList();
            for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
            {
                if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
                {
                    if (pTarget->GetTypeId() == TYPEID_PLAYER && (pTarget->GetPositionZ() - m_creature->GetMap()->GetHeight(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()) > 0.1f ))
                    {
                        m_bCanFear = false;
                        break;
                    }
                }
            }

            //Can fear? just do it !
            if(m_bCanFear)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_FEAR) == CAST_OK)
                {
                    m_uiFearTimer = 40000;
                    m_uiCheckRangeTimer = 3000;
                }
            } else
                m_uiFearTimer = 1000;
        }
        else
            m_uiFearTimer -= uiDiff;


        if (m_uiDoomfireTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_DOOMFIRE_STRIKE) == CAST_OK)
            {
                DoScriptText(urand(0, 1) ? SAY_DOOMFIRE1 : SAY_DOOMFIRE2, m_creature);
                m_uiDoomfireTimer = urand(10000, 15000);
            }
        }
        else
            m_uiDoomfireTimer -= uiDiff;

        if(m_uiCheckRangeTimer < uiDiff)
        {
            if (!m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
            {
                if (!m_creature->IsNonMeleeSpellCasted(false))
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_FINGER_DEATH, SELECT_FLAG_PLAYER))
                        if(DoCastSpellIfCan(pTarget, SPELL_FINGER_DEATH) == CAST_OK)
                            m_uiCheckRangeTimer = 1000;
            } else
                m_uiCheckRangeTimer = 3000;
        } else
            m_uiCheckRangeTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }