void UpdateAI(uint32 diff)
        {
            ReduceCD(diff);
            if (IAmDead()) return;
            if (!me->GetVictim())
                Evade();
            if (clearcast && !me->IsNonMeleeSpellCast(false))
            {
                if (Aura* potency = me->GetAura(ARCANE_POTENCY_BUFF))
                {
                    if (potency->GetCharges() == 1)
                        clearcast = false;

                    potency->DropCharge(AURA_REMOVE_BY_EXPIRE);

                    if (me->HasAura(CLEARCASTBUFF))
                    {
                        me->ModifyPower(POWER_MANA, cost);
                        me->RemoveAurasDueToSpell(CLEARCASTBUFF, me->GetGUID(), 0, AURA_REMOVE_BY_EXPIRE);
                    }
                }
            }
            CheckAuras();
            if (wait == 0)
                wait = GetWait();
            else
                return;
            BreakCC(diff);
            if (CCed(me) && (!ICEBLOCK || !me->HasAura(ICEBLOCK))) return;//TODO

            CheckBlink(diff);
            CheckPoly(diff);
            CheckPots(diff);
            //CureTarget(master, REMOVE_CURSE, diff);
            //CureTarget(me, REMOVE_CURSE, diff);
            CureGroup(master, REMOVE_CURSE, diff);

            FocusMagic(diff);
            BuffAndHealGroup(master, diff);

            if (!me->IsInCombat())
                DoNonCombatActions(diff);

            if (!CheckAttackTarget(CLASS_MAGE))
                return;

            CheckPoly2();//this should go AFTER getting opponent

            Counter();
            CheckSpellSteal(diff);
            DoNormalAttack(diff);
        }
        void UpdateAI(uint32 diff)
        {
            ReduceCD(diff);
            if (!GlobalUpdate(diff))
                return;
            CheckAttackState();
            CheckAuras();
            if (wait == 0)
                wait = GetWait();
            else
                return;
            BreakCC(diff);
            if (CCed(me)) return;

            ////if pet is dead or unreachable
            //Creature* m_botsPet = me->GetBotsPet();
            //if (!m_botsPet || m_botsPet->FindMap() != master->GetMap() || (me->GetDistance2d(m_botsPet) > sWorld->GetMaxVisibleDistanceOnContinents() - 20.f))
            //    if (master->getLevel() >= 10 && !me->IsInCombat() && !IsCasting() && !me->IsMounted())
            //        SummonBotsPet(PET_VOIDWALKER);

            //TODO: implement healthstone
            if (Potion_cd <= diff && GetHealthPCT(me) < 67)
            {
                temptimer = GC_Timer;
                if (doCast(me, HEALINGPOTION))
                {
                    Potion_cd = POTION_CD;
                    GC_Timer = temptimer;
                }
            }
            if (Potion_cd <= diff && GetManaPCT(me) < 50)
            {
                temptimer = GC_Timer;
                if (doCast(me, MANAPOTION))
                {
                    Potion_cd = POTION_CD;
                    GC_Timer = temptimer;
                }
            }
            if (!me->IsInCombat())
                DoNonCombatActions();

            if (!CheckAttackTarget(BOT_CLASS_WARLOCK))
                return;

            DoNormalAttack(diff);
        }
Example #3
0
            void UpdateAI(const uint32 diff)
            {
                DoMeleeAttackIfReady();

                if (IAmDead())
                    return;

                ReduceCD(diff);

                opponent = me->getVictim();

                if (!opponent )
                {
                    ResetOrGetNextTarget();
                    DoNonCombatActions();
                    return;
                }

                me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
                me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);

                if (me->GetHealth() < me->GetMaxHealth()*0.5 && isTimerReady(uiPotion_Timer))
                {
                    doCast(me, SPELL_HEALING_POTION);
                    uiPotion_Timer = 60000;
                }

                oom_spam = false;

                //buff and heal master's group
                if (master->GetGroup())
                {
                    BuffAndHealGroup(master);
                    CureGroup(master);
                }

                // Heal myself
                HealTarget (me, me->GetHealth() * 100 / me->GetMaxHealth());
                DoNormalAttack(diff);
                Counter(diff);

                ScriptedAI::UpdateAI(diff);
            }
        void UpdateAI(uint32 diff)
        {
            ReduceCD(diff);
            if (IAmDead()) return;
            CheckAttackState();
            CheckAuras();
            if (wait == 0)
                wait = GetWait();
            else
                return;
            if (CCed(me)) return;

            //TODO: add checks to help owner

            if (!me->IsInCombat())
                DoNonCombatActions();

            if (!CheckAttackTarget(PET_TYPE_VOIDWALKER))
                return;

            DoNormalAttack(diff);
        }
Example #5
0
        void UpdateAI(uint32 const diff)
        {
            ReduceCD(diff);

            if (IAmDead()) return;

            if (!me->isInCombat())
                DoNonCombatActions(diff);

            //if (pet && pet != NULL && pet->isDead())
            //{
            //    me->SetBotsPetDied();
            //    pet = NULL;
            //}

            //if we think we have a pet, but master doesn't, it means we teleported
            //if (pet && !me->getBotsPet())
            //{
            //    me->SetBotsPetDied();
            //    pet = NULL;
            //}

            DoNormalAttack(diff);
            ScriptedAI::UpdateAI(diff);

            //if low on health, drink a potion
            if (GetHealthPCT(me) < 65)
            {
                if (doCast(me, HEALINGPOTION))
                    Potion_cd = POTION_CD;
            }

            //if low on mana, drink a potion
            if (GetManaPCT(me) < 65 && Potion_cd <= diff)
            {
                if (doCast(me, MANAPOTION))
                    Potion_cd = POTION_CD;
            }

            opponent = SelectTarget(SELECT_TARGET_TOPAGGRO, 0);
            if (!opponent && !me->getVictim())
            {
                me->CombatStop();
                //ResetOrGetNextTarget();

                //to reduce the number of crashes, remove pet whenever we are not in combat
                //if (pet != NULL && pet->isAlive())
                //{
                //    me->SetBotsPetDied();
                //    pet = NULL;
                //}
                return;
            }

            //if (pet == NULL)
            //    CreatePet();

            //if (pet && pet->isAlive() &&
            //    !pet->isInCombat() &&
            //    me->getVictim())
            //{
            //    pet->Attack (me->getVictim(), true);
            //    pet->GetMotionMaster()->MoveChase(me->getVictim(), 1, 0);
            //}
        }
		void UpdateAI(const uint32 diff)
		{

			ReduceCD(diff);

			if(IAmDead()) return;

			if(!m_creature->isInCombat())
			{
				DoNonCombatActions();
			}

			if(pet && pet != NULL && pet->isDead())
			{
				master->SetBotsPetDied();
				pet = NULL;
			}

			//if we think we have a pet, but master doesn't, it means we teleported
			if(pet && master->m_botHasPet == false)
			{
				master->SetBotsPetDied();
				pet = NULL;
			}

			DoNormalAttack(diff);
			ScriptedAI::UpdateAI(diff);

			//if low on health, drink a potion
			if(m_creature->GetHealth() < m_creature->GetMaxHealth()*0.6 && isTimerReady(Potion_cd))
			{
				doCast(m_creature, HEALINGPOTION);
				Potion_cd = 1500;
			}

			//if low on mana, drink a potion
			 if(m_creature->GetPower(POWER_MANA) < m_creature->GetMaxPower(POWER_MANA)*0.2)
			{
				if(isTimerReady(Potion_cd))
				{
					doCast(m_creature, MANAPOTION);
					//MonsterSay("MANA POTION", LANG_UNIVERSAL, NULL);
					Potion_cd = 1500;
				}
			 }

			opponent = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
			if(!opponent && !m_creature->getVictim())
			{
				ResetOrGetNextTarget();

				//to reduce the number of crashes, remove pet whenever we are not in combat
				if(pet != NULL && pet->isAlive())
				{
					master->SetBotsPetDied();
					pet = NULL;
				}
				return;
			}


			if(pet == NULL)
				CreatePet();

			if (pet && pet->isAlive() &&
				!pet->isInCombat() &&
				m_creature->getVictim()) {
				pet->Attack (m_creature->getVictim(), true);
				pet->GetMotionMaster()->MoveChase(m_creature->getVictim(), 1, 0);

			}
		}
Example #7
0
    void UpdateAI(const uint32 diff)
    {

        ReduceCD();

        if(IAmDead()) return;

        if(pet && pet != NULL && pet->isDead())
        {
            master->SetBotsPetDied();
            pet = NULL;
        }

        //if we think we have a pet, but master doesn't, it means we teleported
        if(pet && master->m_botHasPet == false)
        {
            master->SetBotsPetDied();
            pet = NULL;
        }

        m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
        m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);

        if(m_creature->GetHealth() < m_creature->GetMaxHealth()*0.3 && isTimerReady(Potion_cd))
        {
            doCast(m_creature, HEALINGPOTION);
            Potion_cd = Potion_cd;
        }
        if(m_creature->GetPower(POWER_MANA) < m_creature->GetMaxPower(POWER_MANA)*0.2)
        {
            if(isTimerReady(Potion_cd))
            {
                doCast(m_creature, MANAPOTION);
                //MonsterSay("MANA POTION", LANG_UNIVERSAL, NULL);
                Potion_cd = Potion_cd;
            } else {
                if(oom_spam == false)
                {
                    //MonsterSay("OOM", LANG_UNIVERSAL, NULL);
                    oom_spam = true;
                }
                ScriptedAI::UpdateAI(diff);
                //return; //can't do anything without mana
           }
        }
        oom_spam = false;

        ScriptedAI::UpdateAI(diff);

        opponent = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
        if(!opponent && !m_creature->getVictim())
        {
            ResetOrGetNextTarget();

            //to reduce the number of crashes, remove pet whenever we are not in combat
            if(pet != NULL && pet->isAlive())
            {
                master->SetBotsPetDied();
                pet = NULL;
            }

            return;
        }

        if(pet == NULL)
            CreatePet();

        if (pet && pet->isAlive() && 
            !pet->isInCombat() &&
            m_creature->getVictim()) {
            pet->Attack (m_creature->getVictim(), true);
            pet->GetMotionMaster()->MoveChase(m_creature->getVictim(), 1, 0);
        }

        if(m_creature->hasUnitState(UNIT_STAT_CASTING))
            return;
 
        DoNormalAttack(diff);
    }