void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;
        
        //run on aggro
        if (m_creature->getVictim() && Move_Check)
        {
            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            m_creature->GetMotionMaster()->MovePoint(0, WALKX_BLAU, WALKY_BLAU, WALKZ_BLAU);
            Move_Check = false;
        }
        
        // Cast
        if (Cast_Timer < uiDiff)
        {
            Unit *nearu = PickNearestPlayer();
            Cast(nearu);
        }else Cast_Timer -= uiDiff;

        // Mark of Blaumeux
        if (Mark_Timer < uiDiff)
        {
            DoCast(m_creature->getVictim(),SPELL_MARK_OF_BLAUMEUX);
            Mark_Timer = 12000;
        }else Mark_Timer -= uiDiff;

        // Shield Wall - All 4 horsemen will shield wall at 50% hp and 20% hp for 20 seconds
        if (ShieldWall1 && m_creature->GetHealthPercent() < 50.0f)
        {
            if (ShieldWall1)
            {
                DoCast(m_creature,SPELL_SHIELDWALL);
                ShieldWall1 = false;
            }
        }
        if (ShieldWall2 && m_creature->GetHealthPercent() < 20.0f)
        {
            if (ShieldWall2)
            {
                DoCast(m_creature,SPELL_SHIELDWALL);
                ShieldWall2 = false;
            }
        }

        // Void Zone
        if (VoidZone_Timer < uiDiff)
        {
            DoCast(m_creature->getVictim(),SPELL_VOIDZONE);
            VoidZone_Timer = 12000;
        }else VoidZone_Timer -= uiDiff;
    }
Esempio n. 2
0
    bool TryActivateAfterTTelep(uint32 diff)
    {
        if (AfterTeleport)
        {
            if (!tspellcasted)
            {
                m_creature->RemoveAurasDueToSpell(25900);       
                //m_creature->clearUnitState(UNIT_STAT_STUNNED);
                m_creature->CastSpell(m_creature, SPELL_TWIN_TELEPORT, false);
                //m_creature->addUnitState(UNIT_STAT_STUNNED);
                m_creature->CastSpell(m_creature, SPELL_STUN, true);
            }

            tspellcasted = true;

            m_creature->GetMotionMaster()->MoveIdle();
            m_creature->StopMoving();
            
            if (AfterTeleportTimer < diff)
            {
                AfterTeleport = false;
                //m_creature->clearUnitState(UNIT_STAT_STUNNED);
                m_creature->RemoveAurasDueToSpell(25900);  
                Unit *nearu = PickNearestPlayer();
                //DoYell(nearu->GetName(), LANG_UNIVERSAL, 0);
                AttackStart(nearu);
                m_creature->getThreatManager().addThreat(nearu, 1000);
                m_creature->GetMotionMaster()->MoveChase(nearu);
                return true;
            }
            else
            {
                AfterTeleportTimer -= diff;
                // update important timers which would otherwise get skipped
                if (EnrageTimer > diff)
                    EnrageTimer -= diff;
                else
                    EnrageTimer = 0;
                if (Teleport_Timer > diff)
                    Teleport_Timer -= diff;
                else
                    Teleport_Timer = 0;
                return false;
            }
        }
        else
        {
            return true;
        }
    }