void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(Phase)
        {
            case 0:
            {
                // *Heroic mode only:
                if (!m_bIsRegularMode)
                {
                    if (PyroblastTimer < diff)
                    {
                        m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
                        m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
                        DoCastSpellIfCan(m_creature, SPELL_SHOCK_BARRIER, CAST_TRIGGERED);
                        DoCastSpellIfCan(m_creature->getVictim(), SPELL_PYROBLAST);
                        PyroblastTimer = 60000;
						FireballTimer += 6000;
						FlameStrikeTimer += 6000;
                    }else PyroblastTimer -= diff;
                }

                if (FireballTimer < diff)
                {
                    DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_FIREBALL_NORMAL : SPELL_FIREBALL_HEROIC);
                    FireballTimer = urand(2000, 6000);
                }else FireballTimer -= diff;

                if (PhoenixTimer < diff)
                {

                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,1))
                    {
                        uint32 random = urand(1, 2);
                        float x = KaelLocations[random][0];
                        float y = KaelLocations[random][1];

                        if (Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
                        {
                            Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
                            SetThreatList(Phoenix);
                            Phoenix->AI()->AttackStart(pTarget);
                            DoScriptText(SAY_PHOENIX, m_creature);
                        }
                    }

                    PhoenixTimer = 60000;
                }else PhoenixTimer -= diff;

                if (FlameStrikeTimer < diff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    {
                        if (m_creature->IsNonMeleeSpellCasted(false))
                            m_creature->InterruptNonMeleeSpells(false);

                        DoCastSpellIfCan(pTarget, SPELL_FLAME_STRIKE);
                        DoScriptText(SAY_FLAMESTRIKE, m_creature);
                    }
                    FlameStrikeTimer = urand(15000, 25000);
                }else FlameStrikeTimer -= diff;

                // Below 50%
                if (m_creature->GetHealth() * 2 < m_creature->GetMaxHealth())
                {
                    m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                    m_creature->StopMoving();
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();
                    GravityLapseTimer = 0;
                    GravityLapsePhase = 0;
                    Phase = 1;
                }

                DoMeleeAttackIfReady();
            }
            break;

            case 1:
            {
                if (GravityLapseTimer < diff)
                {
                    switch(GravityLapsePhase)
                    {
                        case 0:
                            if (FirstGravityLapse)          // Different yells at 50%, and at every following Gravity Lapse
                            {
                                DoScriptText(SAY_GRAVITY_LAPSE, m_creature);
                                FirstGravityLapse = false;

                                if (m_pInstance)
                                {
                                    if (GameObject* pKaelLeft = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_KAEL_STATUE_LEFT)))
                                        pKaelLeft->SetGoState(GO_STATE_ACTIVE);

                                    if (GameObject* pKaelRight = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_KAEL_STATUE_RIGHT)))
                                        pKaelRight->SetGoState(GO_STATE_ACTIVE);
                                }
                            }
                            else
                            {
                                DoScriptText(SAY_RECAST_GRAVITY, m_creature);
                            }

                            DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE_INITIAL);
                            GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
                            GravityLapsePhase = 1;
                            break;

                        case 1:
                            TeleportPlayersToSelf();
                            GravityLapseTimer = 1000;
                            GravityLapsePhase = 2;
                            break;

                        case 2:
                            CastGravityLapseKnockUp();
                            GravityLapseTimer = 1000;
                            GravityLapsePhase = 3;
                            break;

                        case 3:
                            CastGravityLapseFly();
                            GravityLapseTimer = 30000;
                            GravityLapsePhase = 4;


                            for(uint8 i = 0; i < 3; ++i)
                            {
                                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
                                {
                                    if (Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000))
                                        Orb->AI()->AttackStart(pTarget);
                                }
                            }

                            DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL);
                            break;

                        case 4:
                            m_creature->InterruptNonMeleeSpells(false);
                            DoScriptText(SAY_TIRED, m_creature);
                            DoCastSpellIfCan(m_creature, SPELL_POWER_FEEDBACK);
                            RemoveGravityLapse();
                            GravityLapseTimer = 10000;
                            GravityLapsePhase = 0;
                            break;
                    }
                }else GravityLapseTimer -= diff;
            }
            break;
        }
    }
Пример #2
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (m_uiPhase)
        {
            case 0:
            {
                // *Heroic mode only:
                if (!m_bIsRegularMode)
                {
                    if (m_uiPyroblastTimer < uiDiff)
                    {
                        m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
                        m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
                        DoCastSpellIfCan(m_creature, SPELL_SHOCK_BARRIER, CAST_TRIGGERED);
                        DoCastSpellIfCan(m_creature->getVictim(), SPELL_PYROBLAST);
                        m_uiPyroblastTimer = 60000;
                    }
                    else
                        m_uiPyroblastTimer -= uiDiff;
                }

                if (m_uiFireballTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_FIREBALL : SPELL_FIREBALL_H) == CAST_OK)
                        m_uiFireballTimer = urand(2000, 6000);
                }
                else
                    m_uiFireballTimer -= uiDiff;

                if (m_uiPhoenixTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_PHOENIX) == CAST_OK)
                    {
                        DoScriptText(SAY_PHOENIX, m_creature);
                        m_uiPhoenixTimer = 60000;
                    }
                }
                else
                    m_uiPhoenixTimer -= uiDiff;

                if (m_uiFlameStrikeTimer < uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    {
                        DoCastSpellIfCan(pTarget, SPELL_FLAME_STRIKE, CAST_INTERRUPT_PREVIOUS);
                        DoScriptText(SAY_FLAMESTRIKE, m_creature);
                    }
                    m_uiFlameStrikeTimer = urand(15000, 25000);
                }
                else
                    m_uiFlameStrikeTimer -= uiDiff;

                // Below 50%
                if (m_creature->GetHealthPercent() < 50.0f)
                {
                    m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                    m_creature->StopMoving();
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();
                    m_uiGravityLapseTimer = 0;
                    m_uiGravityLapsePhase = 0;
                    m_uiPhase = 1;

                    return;
                }

                DoMeleeAttackIfReady();

                break;
            }
            case 1:
            {
                if (m_uiGravityLapseTimer < uiDiff)
                {
                    switch (m_uiGravityLapsePhase)
                    {
                        case 0:
                            if (m_bFirstGravityLapse)       // Different yells at 50%, and at every following Gravity Lapse
                            {
                                DoScriptText(SAY_GRAVITY_LAPSE, m_creature);
                                m_bFirstGravityLapse = false;

                                if (m_pInstance)
                                {
                                    if (GameObject* pKaelLeft = m_pInstance->GetSingleGameObjectFromStorage(GO_KAEL_STATUE_LEFT))
                                        pKaelLeft->SetGoState(GO_STATE_ACTIVE);

                                    if (GameObject* pKaelRight =  m_pInstance->GetSingleGameObjectFromStorage(GO_KAEL_STATUE_RIGHT))
                                        pKaelRight->SetGoState(GO_STATE_ACTIVE);
                                }
                            }
                            else
                            {
                                DoScriptText(SAY_RECAST_GRAVITY, m_creature);
                            }

                            DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE_INITIAL);
                            m_uiGravityLapseTimer = 2000 + uiDiff;// Don't interrupt the visual spell
                            m_uiGravityLapsePhase = 1;
                            break;

                        case 1:
                            TeleportPlayersToSelf();
                            m_uiGravityLapseTimer = 1000;
                            m_uiGravityLapsePhase = 2;
                            break;

                        case 2:
                            CastGravityLapseKnockUp();
                            m_uiGravityLapseTimer = 1000;
                            m_uiGravityLapsePhase = 3;
                            break;

                        case 3:
                            CastGravityLapseFly();
                            m_uiGravityLapseTimer = 30000;
                            m_uiGravityLapsePhase = 4;

                            for(uint8 i = 0; i < 3; ++i)
                            {
                                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
                                {
                                    if (Creature* Orb = DoSpawnCreature(NPC_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000))
                                        Orb->AI()->AttackStart(pTarget);
                                }
                            }

                            DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL);
                            break;

                        case 4:
                            m_creature->InterruptNonMeleeSpells(false);
                            DoScriptText(SAY_TIRED, m_creature);
                            DoCastSpellIfCan(m_creature, SPELL_POWER_FEEDBACK);
                            RemoveGravityLapse();
                            m_uiGravityLapseTimer = 10000;
                            m_uiGravityLapsePhase = 0;
                            break;
                    }
                }
                else
                    m_uiGravityLapseTimer -= uiDiff;

                break;
            }
        }
    }
Пример #3
0
        void UpdateAI(uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            switch (Phase)
            {
                case 0:
                {
                    // *Heroic mode only:
                    if (IsHeroic())
                    {
                        if (PyroblastTimer <= diff)
                        {
                            me->InterruptSpell(CURRENT_CHANNELED_SPELL);
                            me->InterruptSpell(CURRENT_GENERIC_SPELL);
                            DoCast(me, SPELL_SHOCK_BARRIER, true);
                            DoCast(me->getVictim(), SPELL_PYROBLAST);
                            PyroblastTimer = 60000;
                        } else PyroblastTimer -= diff;
                    }

                    if (FireballTimer <= diff)
                    {
                        DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL);
                        FireballTimer = urand(2000, 6000);
                    } else FireballTimer -= diff;

                    if (PhoenixTimer <= diff)
                    {
                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);

                        uint8 random = urand(1, 2);
                        float x = KaelLocations[random][0];
                        float y = KaelLocations[random][1];

                        Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
                        if (Phoenix)
                        {
                            Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
                            SetThreatList(Phoenix);
                            Phoenix->AI()->AttackStart(target);
                        }

                        Talk(SAY_PHOENIX);

                        PhoenixTimer = 60000;
                    } else PhoenixTimer -= diff;

                    if (FlameStrikeTimer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        {
                            me->InterruptSpell(CURRENT_CHANNELED_SPELL);
                            me->InterruptSpell(CURRENT_GENERIC_SPELL);
                            DoCast(target, SPELL_FLAMESTRIKE3, true);
                            Talk(SAY_FLAMESTRIKE);
                        }
                        FlameStrikeTimer = urand(15000, 25000);
                    } else FlameStrikeTimer -= diff;

                    // Below 50%
                    if (HealthBelowPct(50))
                    {
                        me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                        me->StopMoving();
                        me->GetMotionMaster()->Clear();
                        me->GetMotionMaster()->MoveIdle();
                        GravityLapseTimer = 0;
                        GravityLapsePhase = 0;
                        Phase = 1;
                    }

                    DoMeleeAttackIfReady();
                }
                break;

                case 1:
                {
                    if (GravityLapseTimer <= diff)
                    {
                        switch (GravityLapsePhase)
                        {
                            case 0:
                                if (FirstGravityLapse)          // Different yells at 50%, and at every following Gravity Lapse
                                {
                                    Talk(SAY_GRAVITY_LAPSE);
                                    FirstGravityLapse = false;

                                    if (instance)
                                        instance->SetData(DATA_KAELTHAS_STATUES, 1);
                                }
                                else
                                    Talk(SAY_RECAST_GRAVITY);

                                DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL);
                                GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
                                GravityLapsePhase = 1;
                                break;

                            case 1:
                                TeleportPlayersToSelf();
                                GravityLapseTimer = 1000;
                                GravityLapsePhase = 2;
                                break;

                            case 2:
                                CastGravityLapseKnockUp();
                                GravityLapseTimer = 1000;
                                GravityLapsePhase = 3;
                                break;

                            case 3:
                                CastGravityLapseFly();
                                GravityLapseTimer = 30000;
                                GravityLapsePhase = 4;

                                for (uint8 i = 0; i < 3; ++i)
                                {
                                    Unit* target = NULL;
                                    target = SelectTarget(SELECT_TARGET_RANDOM, 0);

                                    Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
                                    if (Orb && target)
                                    {
                                        Orb->SetSpeed(MOVE_RUN, 0.5f);
                                        Orb->AddThreat(target, 1000000.0f);
                                        Orb->AI()->AttackStart(target);
                                    }
                                }

                                DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL);
                                break;

                            case 4:
                                me->InterruptNonMeleeSpells(false);
                                Talk(SAY_TIRED);
                                DoCast(me, SPELL_POWER_FEEDBACK);
                                RemoveGravityLapse();
                                GravityLapseTimer = 10000;
                                GravityLapsePhase = 0;
                                break;
                        }
                    } else GravityLapseTimer -= diff;
                }
                break;
            }
        }
Пример #4
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        switch(Phase)
        {
            case 0:
            {
                // *Heroic mode only:
                if (Heroic)
                {
                    if (PyroblastTimer < diff)
                    {
                        DoCast(m_creature, SPELL_SHOCK_BARRIER, true);
                        DoCast(m_creature->getVictim(), SPELL_PYROBLAST);
                        PyroblastTimer = 60000;
                    }else PyroblastTimer -= diff;
                }

                if (FireballTimer < diff)
                {
                    DoCast(m_creature->getVictim(), Heroic ? SPELL_FIREBALL_HEROIC : SPELL_FIREBALL_NORMAL);
                    FireballTimer = 2000 + rand()%4000;
                }else FireballTimer -= diff;

                if (PhoenixTimer < diff)
                {

                    Unit* target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM,1);

                    uint32 random = rand()%2 + 1;
                    float x = KaelLocations[random][0];
                    float y = KaelLocations[random][1];

                    Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
                    if (Phoenix)
                    {
                        Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
                        SetThreatList(Phoenix);
                        Phoenix->AI()->AttackStart(target);
                    }

                    DoScriptText(SAY_PHOENIX, m_creature);

                    PhoenixTimer = 60000;
                }else PhoenixTimer -= diff;

                if (FlameStrikeTimer < diff)
                {
                    if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    {
                        DoCast(target, SPELL_FLAMESTRIKE3, true);
                        DoScriptText(SAY_FLAMESTRIKE, m_creature);
                    }
                    FlameStrikeTimer = 15000 + rand()%10000;
                }else FlameStrikeTimer -= diff;

                // Below 50%
                if (m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth())
                {
                    m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                    m_creature->StopMoving();
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();
                    GravityLapseTimer = 0;
                    GravityLapsePhase = 0;
                    Phase = 1;
                }

                DoMeleeAttackIfReady();
            }
            break;

            case 1:
            {
                if (GravityLapseTimer < diff)
                {
                    switch(GravityLapsePhase)
                    {
                        case 0:
                            if (FirstGravityLapse)          // Different yells at 50%, and at every following Gravity Lapse
                            {
                                DoScriptText(SAY_GRAVITY_LAPSE, m_creature);
                                FirstGravityLapse = false;

                                if (pInstance)
                                {
                                    GameObject* KaelLeft = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_LEFT));
                                    if (KaelLeft) KaelLeft->SetGoState(GO_STATE_ACTIVE);
                                    GameObject* KaelRight = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_KAEL_STATUE_RIGHT));
                                    if (KaelRight) KaelRight->SetGoState(GO_STATE_ACTIVE);
                                }
                            }else
                            {
                                DoScriptText(SAY_RECAST_GRAVITY, m_creature);
                            }

                            DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL);
                            GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
                            GravityLapsePhase = 1;
                            break;

                        case 1:
                            TeleportPlayersToSelf();
                            GravityLapseTimer = 1000;
                            GravityLapsePhase = 2;
                            break;

                        case 2:
                            CastGravityLapseKnockUp();
                            GravityLapseTimer = 1000;
                            GravityLapsePhase = 3;
                            break;

                        case 3:
                            CastGravityLapseFly();
                            GravityLapseTimer = 30000;
                            GravityLapsePhase = 4;


                            for(uint8 i = 0; i < 3; ++i)
                            {
                                Unit* target = NULL;
                                target = SelectUnit(SELECT_TARGET_RANDOM,0);

                                Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
                                if (Orb && target)
                                {
                                    //SetThreatList(Orb);
                                    Orb->AddThreat(target, 1.0f);
                                    Orb->AI()->AttackStart(target);
                                }

                            }

                            DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL);
                            break;

                        case 4:
                            m_creature->InterruptNonMeleeSpells(false);
                            DoScriptText(SAY_TIRED, m_creature);
                            DoCast(m_creature, SPELL_POWER_FEEDBACK);
                            RemoveGravityLapse();
                            GravityLapseTimer = 10000;
                            GravityLapsePhase = 0;
                            break;
                    }
                }else GravityLapseTimer -= diff;
            }
            break;
        }
    }