예제 #1
0
            void DoNonCombatActions()
            {
                //if eating or drinking don't do anything
                if (me->HasAura(10256) || me->HasAura(1137))
                    return;

                Feast();

                //buff master
                if (!HasAuraName(master, SPELL_PRAYER_OF_SHADOW, 0) && isTimerReady(uiGc_Timer))
                    doCast(master, SPELL_PRAYER_OF_SHADOW, true);

                if (!HasAuraName(master, SPELL_FEAR_WARD, 0) && isTimerReady(uiGc_Timer))
                    doCast(master, SPELL_FEAR_WARD, true);

                if (!HasAuraName(master, SPELL_DIVINE_SPIRIT, 0) && isTimerReady(uiGc_Timer))
                {
                    doCast(master, SPELL_DIVINE_SPIRIT, true);
                    GiveManaBack();
                }

                //buff myself
                if (!me->HasAura(SPELL_INNER_FIRE, 0) && isTimerReady(uiGc_Timer))
                    doCast(me, SPELL_INNER_FIRE, true);

                if (!me->HasAura(SPELL_PW_FORTITUDE, 0) && isTimerReady(uiGc_Timer))
                    doCast(me, SPELL_PW_FORTITUDE, true);

                //buff and heal master's group
                if (master->GetGroup())
                    RezGroup(SPELL_RESURRECTION, master);
            }
예제 #2
0
            void DoNonCombatActions()
            {
                if (me->HasAura(SPELL_DEVOTION_AURA))
                Aura = DevotionAura;
                else if (me->HasAura(SPELL_FIRE_RESISTANCE_AURA))
                    Aura = FireResistanceAura;
                else
                    Aura = NoAura;

                //buff myself
                if (!master->HasAura(SPELL_DEVOTION_AURA) && isTimerReady(uiGc_Timer))
                    doCast(me, SPELL_DEVOTION_AURA, true);
                else
                    // I already have devotion aura and its not mine, cast different aura
                    if (master->HasAura(SPELL_DEVOTION_AURA) && !master->HasAura(SPELL_DEVOTION_AURA, me->GetGUID()) && Aura == NoAura && isTimerReady(uiGc_Timer))
                    doCast(me, SPELL_FIRE_RESISTANCE_AURA, true);

                if (!me->HasAura(SPELL_SEAL_OF_LIGHT) && isTimerReady(uiGc_Timer))
                    doCast(me, SPELL_SEAL_OF_LIGHT, true);

                //buff and heal master's group
                if (master->GetGroup())
                {
                    RezGroup(SPELL_REDEMPTION, master);
                    BuffAndHealGroup(master);
                    CureGroup(master);
                }
            }
예제 #3
0
            bool HealTarget(Unit* target, uint8 hp)
            {
                if (!isTimerReady(uiGc_Timer))
                    return false;
        
                if (me->IsNonMeleeSpellCasted(true))
                    return false;
        
                if (!target || target->isDead())
                    return false;

                if (hp < 90 && uiLesserHealing_Timer <= 0)
                {
                    doCast(target, SPELL_LESSER_HEALING);
                    uiLesserHealing_Timer = 90;
                    uiHeal_Timer = uiHeal_Timer + 5; //wait 5 seconds before casting a real heal
                    return true;
                }
                else if (uiLesserHealing_Timer >= 0)
                    --uiLesserHealing_Timer;

                if (hp < 75 && isTimerReady(uiHeal_Timer))
                {
                    doCast(target, SPELL_CHAIN_HEAL);
                    uiHeal_Timer = 10;
                }

                return true;
            }
예제 #4
0
            bool HealTarget(Unit* target, uint8 hp)
            {
                if (!isTimerReady(uiGc_Timer))
                    return false;

                if (me->IsNonMeleeSpellCasted(true))
                    return false;

                if (!target || target->isDead())
                    return false;

                if (hp < 25 && isTimerReady(uiLayOfHands_Timer))
                {
                    // 33% to cast loh, else just do a fast heal
                    uint64 m_rand = urand(1, 3);

                    switch(m_rand)
                    {
                        case 1:
                        {
                            std::string loh = "Lay of Hands on ";
                            loh += target->GetName();
                            loh += ".";

                            me->MonsterSay(loh.c_str(), LANG_UNIVERSAL, NULL);

                            doCast(target, SPELL_LAY_OF_HANDS);
                            uiLayOfHands_Timer = 1600;
                            return true;
                        }
                        case 2:
                        case 3:
                            doCast(target, SPELL_FLASH_OF_LIGHT);
                            GiveManaBack(15);
                            return true;
                    }

                }

                if (hp < 60)
                {
                    doCast(target, SPELL_FLASH_OF_LIGHT);
                    GiveManaBack(15);
                    return true;
                }

                if (hp < 80)
                {
                    doCast(target, SPELL_HOLY_LIGHT);
                    GiveManaBack(20);
                    return true;
                }

                return true;
            }
예제 #5
0
            bool CureTarget(Unit* target)
            {
                if (!isTimerReady(uiGc_Timer))
                    return false;

                if (HasAuraName(target, "Withering Heat"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Ancient Dread"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Ancient Dread"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Arcane Buffet"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Shadow Buffet"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Flame Buffet"))
                    doCast(target, SPELL_CLEANSE);

                if (HasAuraName(target, "Frost Buffet"))
                doCast(target, SPELL_CLEANSE);

                return true;
            }
예제 #6
0
            bool HealTarget(Unit* target, uint8 hp)
            {
                if (!isTimerReady(uiGc_Timer))
                    return false;

                if (me->IsNonMeleeSpellCasted(true))
                    return false;

                if (!target || target->isDead())
                    return false;

                if ((hp < 50) && isTimerReady(uiPWS_Timer) && !target->isDead())
                {
                    doCast(target, SPELL_PW_SHIELD);
                    uiPWS_Timer = 120;
                }

                if ((hp < 90) && hp > 75 && isTimerReady(uiRenew_Timer))
                {
                    doCast(target, SPELL_RENEW, true);
                    GiveManaBack();
                    uiRenew_Timer = 90;
                    uiHeal_Timer = uiHeal_Timer + 5; //wait 5 seconds before casting a real heal
                    return true;
                }

                if (hp < 75 && hp > 5 && isTimerReady(uiHeal_Timer) && !target->isDead())
                {
                    doCast(target, SPELL_HEAL);
                    GiveManaBack();
                    uiHeal_Timer = 10;
                    return true;
                }

                if (hp < 5 && isTimerReady(uiGreater_Heal_Timer) && !target->isDead())
                {
                    doCast(target, SPELL_GREATER_HEAL);
                    GiveManaBack();
                    uiGreater_Heal_Timer = uiGreater_Heal_Timer + 900;
                    return true;
                }

                return true;
            }
예제 #7
0
파일: bot_ai.cpp 프로젝트: Rhyuk/Dev
void bot_ai::doCast(Unit *victim, uint32 spellId, bool triggered)
{
    if(spellId == 0) return;
    if (!isTimerReady(GC_Timer)) return;
    if (m_creature->IsNonMeleeSpellCasted(true)) return;
    
    m_creature->SetStandState(UNIT_STAND_STATE_STAND);
    GC_Timer = 20;
    DoCast(victim, spellId, triggered);
} //end doCast
    bool HealTarget(Unit *target, uint8 hp)
    {
        if (!isTimerReady(GC_Timer)) return false;
        if (m_creature->IsNonMeleeSpellCasted(true)) return false;
        if(!target || target->isDead()) return false;

        if(hp < 90 && Lesser_Healing_Timer <= 0)
        {
            doCast(target, SPELL_LESSER_HEALING);
            Lesser_Healing_Timer = 90;
            Heal_Timer = Heal_Timer + 5; //wait 5 seconds before casting a real heal
            //if(master->isInCombat()) && master->getVictim() == NULL) return;
            return true;
        } else if(Lesser_Healing_Timer >= 0) --Lesser_Healing_Timer;

        if(hp < 75 && isTimerReady(Heal_Timer))
        {
            doCast(target, SPELL_CHAIN_HEAL);
            Heal_Timer = 10;
        }
        return true;
    } //end HealTarget
예제 #9
0
            void Counter(const uint32 diff)
            {
                if (opponent  ==  NULL)
                    return;

                if (opponent->isDead())
                    return;

                if (opponent->IsNonMeleeSpellCasted(true) && isTimerReady(uiHammerOfJustice_Timer))
                {
                    doCast(opponent, SPELL_HAMMER_OF_JUSTICE);
                    uiHammerOfJustice_Timer = 600;
                }
            }
예제 #10
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);
            }
예제 #11
0
    void DoNormalAttack(const uint32 diff)
    {
        AttackerSet m_attackers = master->getAttackers();
        if(opponent == NULL) return;
        if(opponent->isDead()) return;

        //double check that pet didn't just die
        if(pet && pet != NULL && pet->isDead())
        {
            master->SetBotsPetDied();
            pet = NULL;
        }

        //send in the pet
        if(pet && pet != NULL && pet->isAlive() && !pet->isInCombat()) pet->AI()->AttackStart(opponent);

        if(!isTimerReady(GC_Timer)) return;

        if(opponent->HasUnitMovementFlag(UNIT_FLAG_FLEEING))
        {
            //MonsterSay("Mob is fleeing!", LANG_UNIVERSAL, NULL);
            return;
        }


        //if(RAIN_OF_FIRE && m_attackers.size() > 1)
        //{
            //doCast(opponent, RAIN_OF_FIRE);
            //return;
        //}
        if(CURSE_OF_THE_ELEMENTS && !HasAuraName(opponent, CURSE_OF_THE_ELEMENTS))
        {
            doCast(opponent, CURSE_OF_THE_ELEMENTS);
            GiveManaBack();
            //return;
        }

        if(CORRUPTION && !HasAuraName (opponent, CORRUPTION, m_creature->GetGUID()))
        {
            doCast(opponent, CORRUPTION);
            GiveManaBack();
            //return;
        }

        if(HAUNT && !HasAuraName (opponent, HAUNT, m_creature->GetGUID()))
        {
            doCast(opponent, HAUNT);
            GiveManaBack();
            return;
        }

        if(UNSTABLE_AFFLICTION && !HasAuraName (opponent, UNSTABLE_AFFLICTION, m_creature->GetGUID()))
        {
            doCast(opponent, UNSTABLE_AFFLICTION);
            GiveManaBack();
            return;
        }

        if(!HasAuraName(opponent, IMMOLATE, m_creature->GetGUID()))
        {
            doCast(opponent, IMMOLATE);
            GiveManaBack();
            return;
        } else if(CONFLAGRATE && isTimerReady(conflagarate_cd))
        {
            doCast(opponent, CONFLAGRATE);
            conflagarate_cd = CONFLAGRATE_CD;
            GiveManaBack();
            return;
        }

        if(CHAOS_BOLT && isTimerReady(chaos_bolt_cd))
        {
            doCast(opponent, CHAOS_BOLT);
            GiveManaBack();
            chaos_bolt_cd = CHAOS_BOLT_CD;
            return;
        } else
            doCast(opponent, SHADOW_BOLT);
        GiveManaBack();
    } //DoNormalAttack
예제 #12
0
            void DoNonCombatActions()
            {
                Feast();

                if (isTimerReady(uiGc_Timer) && !me->HasAura(SPELL_LIGHTNING_SHIELD, 0))
                doCast(me, SPELL_LIGHTNING_SHIELD);

                if (master->GetGroup())
                {
                    RezGroup(SPELL_ANCESTRAL_SPIRIT, master);
                    BuffAndHealGroup(master);
                }

                /* TESTING */
                Group::MemberSlotList const &a =((Player*)master)->GetGroup()->GetMemberSlots();

                for (Group::member_citerator itr = a.begin(); itr != a.end(); itr++)
                {
                    Player* tPlayer = ((Player *)master)->GetObjPlayer(itr->guid);
            
                    if (tPlayer == NULL)
                        continue;
            
                    //healing others
                    if (tPlayer->isAlive() && isTimerReady(uiOthersHeal_Timer) && tPlayer->GetGUID() != master->GetGUID() && tPlayer->GetHealth() * 100 / tPlayer->GetMaxHealth() < 75 && CanCast(tPlayer, GetSpellStore()->LookupEntry(SPELL_CHAIN_HEAL)))
                    {
                        doCast(tPlayer, SPELL_CHAIN_HEAL, false);
                        uiOthersHeal_Timer = 100;
                    }

                    //rezzes
                    if (tPlayer->isDead() && !me->isInCombat() && me->GetDistance(tPlayer) < 40 && isTimerReady(uiRez_Timer))
                    {
                        char* str = (char *)malloc(32);
                        sprintf(str, "Resucitando a %s", tPlayer->GetName());
                        me->MonsterSay(str, LANG_UNIVERSAL, NULL);
                        free(str);
                        doCast(tPlayer, SPELL_ANCESTRAL_SPIRIT, false);
                        uiRez_Timer = 160;
                    }
                }

                /* TESTING */
                if ((master->GetHealth() * 100 / master->GetMaxHealth() < 90) && uiLesserHealing_Timer <= 0)
                {
                    doCast(master, SPELL_LESSER_HEALING);
                    uiLesserHealing_Timer = 90;
                    uiHeal_Timer = uiHeal_Timer + 5; //wait 5 seconds before casting a real heal
                    return;
                }
                else if (uiLesserHealing_Timer >= 0)
                    --uiLesserHealing_Timer;

                if ((master->GetHealth() * 100 / master->GetMaxHealth() < 75) && isTimerReady(uiHeal_Timer))
                {
                    doCast(master, SPELL_CHAIN_HEAL);
                    uiHeal_Timer = 10;
                }

                if (me->GetHealth() * 100 / me->GetMaxHealth() < 90)
                {
                    if (uiSelfLesserHealing_Timer <= 0)
                    {
                        doCast(me, SPELL_LESSER_HEALING);
                        uiSelfLesserHealing_Timer = 90;
                        return;
                    }
                    else if (uiSelfLesserHealing_Timer >= 0)
                    --uiSelfLesserHealing_Timer;
                }
            }
예제 #13
0
            void UpdateAI(const uint32 diff)
            {
                DoMeleeAttackIfReady();

                decrementTimers();

                if (IAmDead())
                    return;

                if (me->GetPower(POWER_MANA) < 400 && isTimerReady(uiPotion_Timer))
                {
                    doCast(me, SPELL_MANA_POTION);
                    uiPotion_Timer = 150;
                }

                if (me->GetPower(POWER_MANA)/me->GetMaxPower(POWER_MANA) < 10)
                {
                    if (uiOom_Timer == 0)
                        uiOom_Timer = 1;
                }

                BuffAndHealGroup(master);

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

                //the rest are combat so return if not fighting
                opponent = SelectTarget(SELECT_TARGET_TOPAGGRO, 0);

                if (!opponent && !me->getVictim())
                {
                    DoNonCombatActions();
                    ResetOrGetNextTarget();
                    return;
                }

                //Cast totems.
                if (me->isInCombat() && isTimerReady(uiEarthTotem_Timer) && !master->HasAura(SPELL_STONE_SKIN_AURA, 0))
                {
                    doCast(me, SPELL_STONE_SKIN_TOTEM);
                    GiveManaBack();
                    uiEarthTotem_Timer = 90;
                    return;
                }

                if (me->isInCombat() && isTimerReady(uiFireTotem_Timer))
                {
                    doCast(me, SPELL_SEARING_TOTEM);
                    GiveManaBack();
                    uiFireTotem_Timer = 180;
                    return;
                }

                if (me->isInCombat() && isTimerReady(uiWindTotem_Timer))
                {
                    doCast(me, SPELL_WINDFURY_TOTEM);
                    GiveManaBack();
                    uiWindTotem_Timer = 180;
                    return;
                }

                if (me->isInCombat())
                {
                    switch(master->getClass())
                    {
                        case CLASS_WARRIOR:
                        case CLASS_DEATH_KNIGHT:
                        case CLASS_ROGUE:
                            if (isTimerReady(uiWaterTotem_Timer) && !master->HasAura(SPELL_HEALING_STREAM_AURA))
                            {
                                doCast(me, SPELL_HEALING_STREAM_TOTEM);
                                uiWaterTotem_Timer = 90;
                                GiveManaBack();
                                return;
                            }
                            break;
                        default: //everyone else gets a mana totem
                            if (isTimerReady (uiWaterTotem_Timer) && !master->HasAura(SPELL_MANA_SPRING_AURA, 0))
                            {
                                doCast(me, SPELL_MANA_SPRING_TOTEM);
                                uiWaterTotem_Timer = 90;
                                GiveManaBack();
                                return;
                            }
                    }
                }

                if (isTimerReady(uiFlameShock_Timer))
                {
                    doCast(opponent, SPELL_FLAME_SHOCK);
                    uiFlameShock_Timer = 120;
                    return;
                }

                if (isTimerReady(uiLightningBolt_Timer))
                {
                    doCast(opponent, SPELL_LIGHTNING_BOLT);
                    uiLightningBolt_Timer = 180;
                    return;
                }

                if (isTimerReady(uiEarthShock_Timer))
                {
                    doCast(opponent, SPELL_EARTH_SHOCK);
                    uiEarthShock_Timer = 250;
                    return;
                }

                //now try to heal bots and pets.  DoSelectLowestHpFriendly will get
                //everyone in group including bots and pets.  Unfortunately it can
                //not be triggered for % of lost HP, so we just set it to -1000.
                //This means low level players wont be healed because they wont have
                //enough HP.
                Unit* target = DoSelectLowestHpFriendly(40, 1000);

                if (target)
                {
                    if (CanCast(target, GetSpellStore()->LookupEntry (SPELL_CHAIN_HEAL)))
                    {
                        doCast(target, SPELL_CHAIN_HEAL, false);
                        uiOthersHeal_Timer = 50;
                    }
                }
                else
                {
                    target = DoSelectLowestHpFriendly(40, 500); //now try someone with less HP lost

                    if (target)
                    {
                        if (CanCast(target, GetSpellStore()->LookupEntry (SPELL_CHAIN_HEAL)))
                        {
                            doCast(target, SPELL_CHAIN_HEAL, false);
                            uiOthersHeal_Timer = 100;
                        }
                    }
                }

                ScriptedAI::UpdateAI(diff);
            }
예제 #14
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);

			}
		}
예제 #15
0
		void DoNormalAttack(const uint32 diff)
		{
			AttackerSet m_attackers = master->getAttackers();
			if(opponent == NULL) return;
			if(opponent->isDead()) return;


			// try to get rid of enrage
			if (TRANQ_SHOT && HasAuraName(opponent, "Enrage")) {
				m_creature->InterruptNonMeleeSpells(true, AUTO_SHOT);
			   // m_creature->MonsterSay("Tranquility shot!", LANG_UNIVERSAL, NULL);
				doCast(opponent, TRANQ_SHOT);
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}

			// silence it
			if(SILENCING_SHOT && opponent->IsNonMeleeSpellCasted(true) && isTimerReady(SilencingShot_Timer))
			{
				doCast(opponent, SILENCING_SHOT);
				SilencingShot_Timer = 200;
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}

			// mark it
			if (!HasAuraName(opponent, "Hunter's Mark")) {
				doCast(opponent, HUNTERS_MARK);
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}

			// sting it
			if (SCORPID_STING && !opponent->HasAura(SCORPID_STING, m_creature->GetGUID())) {
				m_creature->InterruptNonMeleeSpells(true, AUTO_SHOT);
				doCast(opponent, SCORPID_STING);
			   // m_creature->MonsterSay("Scorpid Sting!", LANG_UNIVERSAL, NULL);
				GiveManaBack();
			   // doCast(opponent, AUTO_SHOT);
			   // return;
			}

			 if (CHIMERA_SHOT && isTimerReady(ChimeraShot_Timer)) {
				m_creature->InterruptNonMeleeSpells(true, AUTO_SHOT);
				doCast(opponent, CHIMERA_SHOT);
				ChimeraShot_Timer = 100;
			   // m_creature->MonsterSay("Chimera Sting!", LANG_UNIVERSAL, NULL);
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}

			if(ARCANE_SHOT && isTimerReady(ArcaneShot_cd))
			{
				m_creature->InterruptNonMeleeSpells( true, AUTO_SHOT );
				doCast(opponent, ARCANE_SHOT);
			   // m_creature->MonsterSay("Arcane shot!", LANG_UNIVERSAL, NULL);
				ArcaneShot_cd = 60;
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}

			if(AIMED_SHOT && isTimerReady(AimedShot_Timer))
			{
				m_creature->InterruptNonMeleeSpells( true, AUTO_SHOT );
				doCast(opponent, AIMED_SHOT);
			   // m_creature->MonsterSay("Arcane shot!", LANG_UNIVERSAL, NULL);
				AimedShot_Timer = 100;
				GiveManaBack();
			  //  doCast(opponent, AUTO_SHOT);
			  //  return;
			}


			doCast(opponent, AUTO_SHOT);

		}
예제 #16
0
    void DoNonCombatActions()
    {
        Feast();

        if(isTimerReady(GC_Timer) && !m_creature->HasAura(SPELL_LIGHTNING_SHIELD, 0))
            doCast(m_creature, SPELL_LIGHTNING_SHIELD);

        //Casts buffs
       // if(!m_creature->isInCombat())
       // {
            //if(!m_creature->HasAura(SPELL_WINDFURY_WEAPON, 0)) doCast(m_creature, SPELL_WINDFURY_WEAPON);
 //           if(isTimerReady(GC_Timer) && !m_creature->HasAura(SPELL_LIGHTNING_SHIELD, 0))
   //             doCast(m_creature, SPELL_LIGHTNING_SHIELD);
       // }


        //Heal/rez others
        //
        //check group members, this doesn't check bots/pets.  They will be done later.  Preference
        //goes to real players first.
        //
        //buff and heal group
        if(master->GetGroup())
        {
            RezGroup(SPELL_SHAMAN_REZZ, master);
            BuffAndHealGroup(master);
           // CureGroup(master);
        }


        /* TESTING */
        Group::MemberSlotList const &a =((Player*)master)->GetGroup()->GetMemberSlots();
        for(Group::member_citerator itr = a.begin(); itr != a.end(); itr++)
        {
            Player *tPlayer = ((Player *)master)->GetObjPlayer(itr->guid);
            if(tPlayer == NULL) continue;
            //healing others
            if(tPlayer->isAlive() &&
            isTimerReady(Others_Heal_Timer) &&
            tPlayer->GetGUID() != master->GetGUID() &&
            tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth() < 75 &&
            CanCast(tPlayer, GetSpellStore()->LookupEntry (SPELL_CHAIN_HEAL)))
            {
                doCast(tPlayer, SPELL_CHAIN_HEAL, false);
                Others_Heal_Timer = 100;
            }

            //rezzes
            if(tPlayer->isDead() &&
            !m_creature->isInCombat() &&
            //CanCast(tPlayer, GetSpellStore()->LookupEntry (SPELL_SHAMAN_REZZ)) &&
            m_creature->GetDistance(tPlayer) < 40 &&
            isTimerReady(Rez_Timer))
            {
                char *str = (char *)malloc(32);
                sprintf(str, "Rezzing %s", tPlayer->GetName());
                m_creature->MonsterSay(str, LANG_UNIVERSAL, NULL);
                free(str);
                doCast(tPlayer, SPELL_SHAMAN_REZZ, false);
                Rez_Timer = 160;
            }
        }
        /* TESTING */



/* TESTING */
        if((master->GetHealth()*100 / master->GetMaxHealth() < 90) && Lesser_Healing_Timer <= 0)
        {
            doCast(master, SPELL_LESSER_HEALING);
            Lesser_Healing_Timer = 90;
            Heal_Timer = Heal_Timer + 5; //wait 5 seconds before casting a real heal
            //if(master->isInCombat()) && master->getVictim() == NULL) return;
            return;
        } else if(Lesser_Healing_Timer >= 0) --Lesser_Healing_Timer;

        if((master->GetHealth()*100 / master->GetMaxHealth() < 75) && isTimerReady(Heal_Timer))
        {
            doCast(master, SPELL_CHAIN_HEAL);
            Heal_Timer = 10;
        }

        if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 90)
        {
            if(Self_Lesser_Healing_Timer <= 0)
            {
                doCast(m_creature, SPELL_LESSER_HEALING);
                Self_Lesser_Healing_Timer = 90;
                return;
            } else if(Self_Lesser_Healing_Timer >= 0)
                --Self_Lesser_Healing_Timer;
        }
/* TESTING */
        }
예제 #17
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);
    }
예제 #18
0
            void UpdateAI(const uint32 diff)
            {
                decrementTimers();

                if (IAmDead())
                    return;

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

                //buff and heal master's group
                BuffAndHealGroup(master);

                //check group members
                Group::MemberSlotList const &a =((Player*)master)->GetGroup()->GetMemberSlots();
                for (Group::member_citerator itr = a.begin(); itr != a.end(); itr++)
                {
                    Player *tPlayer = ((Player *)master)->GetObjPlayer(itr->guid);
                    if (tPlayer == NULL)
                        continue;
                }

                //if low on mana, drink a potion
                if (me->GetPower(POWER_MANA) < 400 && isTimerReady(uiPotion_Timer))
                {
                    doCast(me, SPELL_MANA_POTION, true);
                    uiPotion_Timer = 1500;
                }
                //if after drinking a potion still low on mana
                //let everyone know that you are oom.
                if (me->GetPower(POWER_MANA)/me->GetMaxPower(POWER_MANA) < 10)
                {
                    if (uiOom_Timer == 0)
                        uiOom_Timer = 1;
                }

                // Heal myself
                if (me->GetHealth() * 100 / me->GetMaxHealth() < 90)
                {
                    if (uiFade_Timer <= 0 && me->isInCombat() && isTimerReady(uiFade_Timer))
                    {
                        doCast(me, SPELL_FADE);
                        uiFade_Timer = 30;
                        return;
                    }

                    HealTarget (me, me->GetHealth() * 100 / me->GetMaxHealth());
                }

                //now try to heal bots and pets.  DoSelectLowestHpFriendly will get
                //everyone in group including bots and pets.  Unfortunately it can
                //not be triggered for % of lost HP, so we just set it to -1000.
                //This means low level players wont be healed because they wont have
                //enough HP.
                if (isTimerReady(uiOthersHeal_Timer))
                {
                    Unit* target;

                    if (target = DoSelectLowestHpFriendly(40, 1000))
                    {
                        doCast(target, SPELL_HEAL, false);
                        GiveManaBack();
                        uiOthersHeal_Timer = 50;
                    }
                    else if (target = DoSelectLowestHpFriendly(40, 500))
                    {
                        if (!target->HasAura(SPELL_RENEW, 0))
                        {
                            doCast(target, SPELL_RENEW, false);
                            GiveManaBack();
                            uiOthersHeal_Timer = 100;
                        }
                    }
                }
            }
예제 #19
0
 void DoNormalAttack(const uint32 diff)
 {
     if (!opponent->HasAura(SPELL_JUDGEMENT_OF_LIGHT) && isTimerReady(uiGc_Timer))
         doCast(opponent, SPELL_JUDGEMENT_OF_LIGHT, true);
 }