Ejemplo n.º 1
0
        void UpdateAI(uint32 diff) override
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            //spam stormstrike in hc mode if spawns are dead
            if (IsHeroic())
            {
                if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1)))
                {
                    if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2)))
                    {
                        if (!pGuard1->IsAlive() && !pGuard2->IsAlive())
                            DoCastVictim(SPELL_STORMSTRIKE);
                    }
                }
            }

            if (uiEarthShieldTimer <= diff)
            {
                DoCast(me, SPELL_EARTH_SHIELD);
                uiEarthShieldTimer = 20000;
            } else uiEarthShieldTimer -= diff;

            if (uiChainHealTimer <= diff)
            {
                if (uint64 TargetGUID = GetChainHealTargetGUID())
                {
                    if (Creature* target = ObjectAccessor::GetCreature(*me, TargetGUID))
                        DoCast(target, SPELL_CHAIN_HEAL);

                    //If one of the adds is dead spawn heals faster
                    Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1));
                    Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2));
                    uiChainHealTimer = ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()) ? 3000 : 8000) + rand()%3000;
                }
            } else uiChainHealTimer -= diff;

            if (uiBloodlustTimer <= diff)
            {
                DoCast(me, SPELL_BLOODLUST);
                uiBloodlustTimer = urand(35000, 45000);
            } else uiBloodlustTimer -= diff;

            if (uiEarthShockTimer <= diff)
            {
                DoCastVictim(SPELL_EARTH_SHOCK);
                uiEarthShockTimer = urand(8000, 13000);
            } else uiEarthShockTimer -= diff;

            if (uiLightningBoltTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(target, SPELL_LIGHTNING_BOLT);
                uiLightningBoltTimer = urand(18000, 24000);
            } else uiLightningBoltTimer -= diff;

            DoMeleeAttackIfReady();
        }
Ejemplo n.º 2
0
        void UpdateAI(const uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            //spam stormstrike in hc mode if spawns are dead
            if (IsHeroic())
            {
                if (Creature* pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0))
                {
                    if (Creature* pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0))
                    {
                        if (!pGuard1->isAlive() && !pGuard2->isAlive())
                            DoCast(me->getVictim(), SPELL_STORMSTRIKE);
                    }
                }
            }

            if (uiEarthShieldTimer <= diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, DUNGEON_MODE(SPELL_EARTH_SHIELD,H_SPELL_EARTH_SHIELD));
                    uiEarthShieldTimer = 20000;
                }
            } else uiEarthShieldTimer -= diff;

            if (uiChainHealTimer <= diff)
            {
                if (uint64 TargetGUID = GetChainHealTargetGUID())
                {
                    if (Creature* target = Unit::GetCreature(*me, TargetGUID))
                        DoCast(target, DUNGEON_MODE(SPELL_CHAIN_HEAL,H_SPELL_CHAIN_HEAL));

                    //If one of the adds is dead spawn heals faster
                    Creature* pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0);
                    Creature* pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0);
                    uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000+6000;
                }
            } else uiChainHealTimer -= diff;

            if (uiBloodlustTimer <= diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_BLOODLUST);
                    uiBloodlustTimer = urand(35000,45000);
                }
            } else uiBloodlustTimer -= diff;

            if (uiEarthShockTimer <= diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me->getVictim(), SPELL_EARTH_SHOCK );
                    uiEarthShockTimer = urand(8000,13000);
                }
            } else uiEarthShockTimer -= diff;

            if (uiLightningBoltTimer <= diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(pTarget, SPELL_LIGHTNING_BOLT);
                    uiLightningBoltTimer = urand(18000,24000);
                }
            } else uiLightningBoltTimer -= diff;

            if (uiBreakBoundsTimer <= diff)
            {
                if(!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_BREAK_BONDS);
                    uiBreakBoundsTimer = urand(10000,20000);
                }
            } else uiBreakBoundsTimer -= diff;

            DoMeleeAttackIfReady();
        }
Ejemplo n.º 3
0
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
                return;

            events.Update(diff);

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

            switch(events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_SPELL_BLOODLUST:
                    me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, false);
                    events.RepeatEvent(urand(35000,45000));
                    break;
                case EVENT_SPELL_BREAK_BONDS:
                    me->CastSpell((Unit*)NULL, SPELL_BREAK_BONDS, false);
                    events.RepeatEvent(urand(16000,22000));
                    break;
                case EVENT_SPELL_CHAIN_HEAL:
                    if (uint64 TargetGUID = GetChainHealTargetGUID())
                        if (pInstance)
                        {
                            if (Creature* target = pInstance->instance->GetCreature(TargetGUID))
                                me->CastSpell(target, SPELL_CHAIN_HEAL, false);

                            Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID));
                            Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID));
                            if ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()))
                            {
                                events.RepeatEvent(urand(3000,6000));
                                break;
                            }
                        }
                    events.RepeatEvent(urand(8000,11000));
                    break;
                case EVENT_SPELL_EARTH_SHIELD:
                    me->CastSpell(me, SPELL_EARTH_SHIELD, false);
                    events.RepeatEvent(20000);
                    break;
                case EVENT_SPELL_EARTH_SHOCK:
                    me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false);
                    events.RepeatEvent(urand(8000,13000));
                    break;
                case EVENT_SPELL_LIGHTNING_BOLT:
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true))
                        me->CastSpell(target, SPELL_LIGHTNING_BOLT, false);
                    events.RepeatEvent(urand(15000,25000));
                    break;
                case EVENT_SPELL_STORMSTRIKE:
                    {
                        Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID));
                        Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID));
                        if (pGuard1 && !pGuard1->IsAlive() && pGuard2 && !pGuard2->IsAlive()) // both dead
                            me->CastSpell(me->GetVictim(), SPELL_STORMSTRIKE, false);
                        events.RepeatEvent(3000);
                    }
                    break;
            }

            DoMeleeAttackIfReady();
        }