Example #1
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if(Phase == 1 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95)
        {
            Phase = 2;
            Creature *pAttumen = DoSpawnCreature(SUMMON_ATTUMEN, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
            if(pAttumen)
            {
                Attumen = pAttumen->GetGUID();
                pAttumen->AI()->AttackStart(m_creature->getVictim());
                SetMidnight(pAttumen, m_creature->GetGUID());
                switch(rand()%3)
                {
                case 0: DoScriptText(SAY_APPEAR1, pAttumen); break;
                case 1: DoScriptText(SAY_APPEAR2, pAttumen); break;
                case 2: DoScriptText(SAY_APPEAR3, pAttumen); break;
                }
            }
        }
        else if(Phase == 2 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
        {
            if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
                Mount(pAttumen);
        }
        else if(Phase ==3)
        {
            if(Mount_Timer)
            {
                if(Mount_Timer <= diff)
                {
                    Mount_Timer = 0;
                    m_creature->SetVisibility(VISIBILITY_OFF);
                    m_creature->GetMotionMaster()->MoveIdle();
                    if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
                    {
                        pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID);
                        pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        if(pAttumen->getVictim())
                        {
                            pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
                            pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID());
                        }
                        pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
                        pAttumen->SetHealth(pAttumen->GetMaxHealth());
                    }
                } else Mount_Timer -= diff;
            }
        }

        if(Phase != 3)
            DoMeleeAttackIfReady();
    }
Example #2
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (Phase == 1 && HealthBelowPct(95))
            {
                Phase = 2;

				if (Creature* attumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
                {
					Attumen = attumen->GetGUID();
					attumen->AI()->AttackStart(me->GetVictim());
					SetMidnight(attumen, me->GetGUID());
					DoSendQuantumText(RAND(SAY_APPEAR_1, SAY_APPEAR_2, SAY_APPEAR_3), attumen);
                }
            }
            else if (Phase == 2 && HealthBelowPct(25))
            {
                if (Unit* pAttumen = Unit::GetUnit(*me, Attumen))
                    Mount(pAttumen);
            }
            else if (Phase == 3)
            {
                if (MountTimer)
                {
                    if (MountTimer <= diff)
                    {
                        MountTimer = 0;
                        me->SetVisible(false);
                        me->GetMotionMaster()->MoveIdle();
                        if (Unit* pAttumen = Unit::GetUnit(*me, Attumen))
                        {
                            pAttumen->SetDisplayId(MOUNTED_DISPLAY_ID);
                            pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            if (pAttumen->GetVictim())
                            {
                                pAttumen->GetMotionMaster()->MoveChase(pAttumen->GetVictim());
                                pAttumen->SetTarget(pAttumen->GetVictim()->GetGUID());
                            }
                            pAttumen->SetObjectScale(1.0f);
							pAttumen->SetHealth(pAttumen->GetMaxHealth());
                        }
                    }
					else MountTimer -= diff;
                }
            }

            if (Phase != 3)
                DoMeleeAttackIfReady();
        }
Example #3
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (Phase == 1 && HealthBelowPct(95))
            {
                Phase = 2;
                if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
                {
                    Attumen = pAttumen->GetGUID();
                    pAttumen->AI()->AttackStart(me->getVictim());
                    SetMidnight(pAttumen, me->GetGUID());
                    DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen);
                }
            }
            else if (Phase == 2 && HealthBelowPct(25))
            {
                if (Unit *pAttumen = Unit::GetUnit(*me, Attumen))
                    Mount(pAttumen);
            }
            else if (Phase == 3)
            {
                if (Mount_Timer)
                {
                    if (Mount_Timer <= diff)
                    {
                        Mount_Timer = 0;
                        me->SetVisible(false);
                        me->GetMotionMaster()->MoveIdle();
                        if (Unit *pAttumen = Unit::GetUnit(*me, Attumen))
                        {
                            pAttumen->SetDisplayId(MOUNTED_DISPLAYID);
                            pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            if (pAttumen->getVictim())
                            {
                                pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
                                pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID());
                            }
                            pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
                        }
                    } else Mount_Timer -= diff;
                }
            }

            if (Phase != 3)
                DoMeleeAttackIfReady();
        }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(m_uiPhase)
        {
            case 1:
                if (m_creature->GetHealthPercent() < 95.0f)
                {
                    m_uiPhase = 2;

                    if (Creature* pAttumen = m_creature->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0))
                    {
                        m_attumenGuid = pAttumen->GetObjectGuid();
                        pAttumen->AI()->AttackStart(m_creature->getVictim());
                        SetMidnight(pAttumen, m_creature->GetObjectGuid());

                        switch(urand(0, 2))
                        {
                            case 0: DoScriptText(SAY_APPEAR1, pAttumen); break;
                            case 1: DoScriptText(SAY_APPEAR2, pAttumen); break;
                            case 2: DoScriptText(SAY_APPEAR3, pAttumen); break;
                        }
                    }
                }
                break;
            case 2:
                if (m_creature->GetHealthPercent() < 25.0f)
                {
                    if (Creature* pAttumen = m_creature->GetMap()->GetCreature(m_attumenGuid))
                        Mount(pAttumen);
                }
                break;
            case 3:
                if (m_uiMount_Timer)
                {
                    if (m_uiMount_Timer <= uiDiff)
                    {
                        m_uiMount_Timer = 0;
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        m_creature->GetMotionMaster()->MoveIdle();

                        if (Creature *pAttumen = m_creature->GetMap()->GetCreature(m_attumenGuid))
                        {
                            pAttumen->SetDisplayId(MOUNTED_DISPLAYID);
                            pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                            if (pAttumen->getVictim())
                            {
                                pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
                                pAttumen->SetTargetGuid(pAttumen->getVictim()->GetObjectGuid());
                            }
                            pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
                        }
                    }
                    else
                        m_uiMount_Timer -= uiDiff;
                }
                break;
        }

        if (m_uiPhase != 3)
            DoMeleeAttackIfReady();
    }
Example #5
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (CheckTimer < diff)
        {
            if (!m_creature->IsWithinDistInMap(&wLoc, 50.0f))
                EnterEvadeMode();
            else
                DoZoneInCombat();

            CheckTimer = 3000;
        }
        else
            CheckTimer -= diff;

        switch (Phase)
        {
            case 1:
            {
                if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95)
                {
                    Phase = 2;
                    Creature *pAttumen = m_creature->SummonCreature(SUMMON_ATTUMEN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); //DoSpawnCreature(SUMMON_ATTUMEN, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
                    if (pAttumen)
                    {
                        Attumen = pAttumen->GetGUID();
                        pAttumen->AI()->AttackStart(m_creature->getVictim());
                        SetMidnight(pAttumen, m_creature->GetGUID());

                        DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen);
                    }
                }
                break;
            }
            case 2:
            {
                if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
                    if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
                        Mount(pAttumen);
                break;
            }
            case 3:
            {
                if (Mount_Timer)
                {
                    if (Mount_Timer <= diff)
                    {
                        Mount_Timer = 0;
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        m_creature->GetMotionMaster()->MoveIdle();
                        if (Creature *pAttumen = Unit::GetCreature(*m_creature, Attumen))
                        {
                            pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID);
                            pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            if (pAttumen->getVictim())
                            {
                                pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
                                pAttumen->SetSelection(pAttumen->getVictimGUID());
                            }
                            pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
                        }
                    }
                    else
                        Mount_Timer -= diff;
                }
                return;
            }
        }

        DoMeleeAttackIfReady();
    }
Example #6
0
    void UpdateAI(const uint32 diff)
    {
        if (!CanDoSomething())
            return;

        switch(m_uiPhase)
        {
        case 1:
            if ((me->GetHealth()*100)/me->GetMaxHealth() < 95)
            {
                m_uiPhase = 2;

                if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
                {
                    m_uiAttumenGUID = pAttumen->GetGUID();
                    pAttumen->AI()->AttackStart(me->getVictim());
                    SetMidnight(pAttumen, me->GetGUID());

                    switch(urand(0, 2))
                    {
                    case 0:
                        DoScriptText(SAY_APPEAR1, pAttumen);
                        break;
                    case 1:
                        DoScriptText(SAY_APPEAR2, pAttumen);
                        break;
                    case 2:
                        DoScriptText(SAY_APPEAR3, pAttumen);
                        break;
                    }
                }
            }
            break;
        case 2:
            if ((me->GetHealth()*100)/me->GetMaxHealth() < 25)
            {
                if (Unit *pAttumen = Unit::GetUnit(*me, m_uiAttumenGUID))
                    Mount(pAttumen);
            }
            break;
        case 3:
            if (m_uiMount_Timer)
            {
                if (m_uiMount_Timer <= diff)
                {
                    m_uiMount_Timer = 0;
                    me->SetVisibility(VISIBILITY_OFF);
                    me->GetMotionMaster()->MoveIdle();

                    if (Unit *pAttumen = Unit::GetUnit(*me, m_uiAttumenGUID))
                    {
                        pAttumen->SetDisplayId(MOUNTED_DISPLAYID);
                        pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                        if (pAttumen->getVictim())
                        {
                            pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
                            pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID());
                        }
                        pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
                    }
                }
                else
                    m_uiMount_Timer -= diff;
            }
            break;
        }

        if (m_uiPhase != 3)
            DoMeleeAttackIfReady();
    }