Beispiel #1
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;
            }
Beispiel #2
0
            void BuffTarget(Unit* target)
            {
                if (!HasAuraName(target, GetSpellName(SPELL_PW_FORTITUDE)))
                {
                    doCast(target, SPELL_PW_FORTITUDE, false);
                    GiveManaBack();
                }

                if (!HasAuraName(target, GetSpellName(SPELL_PRAYER_OF_SHADOW)))
                {
                    doCast(target, SPELL_PRAYER_OF_SHADOW, false);
                    GiveManaBack();
                }
            }
Beispiel #3
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);
            }
Beispiel #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 < 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;
            }
Beispiel #5
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);
            }
		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);

		}
Beispiel #7
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;
                        }
                    }
                }
            }
Beispiel #8
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