All pastes #388784 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-10 08:47 UTC
rendered paste body
/*
* Paladin routine v0.4 for ByteBot 1.xx by Tempfire
*
* v0.4 - bugfixes
* v0.3 - Initial Development
* 	1. Uses HOJ (if it exists) on casters.
* 	2. Uses consecration (if it exists) when you have adds.
*	3. When it trouble, bubble (if it exists).
*	4. In emergencies, uses Lay on Hands (if it exists).
*	5. In cases where you need healing and have more than 1 agg then it'll use FOL instead of HL
*	6. Cures poision and disease with purify, or cleanse (if they exist)
*	7. When resting uses Holy Light instead of eating.
*	8. Uses HOW (if it exists) when target.hp% <= 20
*	9. Uses Exorcism and Holy shock on undead and demons.
*
* To Do:	
*
* Thanks To:  
*	Everone in #bbot especially mjc for all you guys' help.
*	Azeroth for letting me use your Cure code from your shaman routine.
*/

objectdef oToon inherits oToonBase
{
	/*
	  NOTE: All spell/skill usage first checks to see if
		you actually HAVE that spell/skill.  For example
		you can leave USE_HOW defined as true if you want
		to be able to use it WHEN you get the skill.  For now
		it will TRY to use it and see that you don't have the 
		skill yet and will skip that skill usage.
	*/
	variable bool USE_JUDGEMENT = TRUE ;judge mobs at the beginning of a fight?
	variable bool USE_HOJ = TRUE ;use hammer of justice on casters?
	variable bool USE_HOW = FALSE ;use hammer of wrath?
	variable bool USE_FINISH_JUDGEMENT = TRUE ;judges your combat seal on the mob at 30% hp
	variable bool NUKE_UNDEAD = TRUE ;uses Exorcism and Holy Shock against undead/demons IF you have them

	variable string SEAL_JUDGE = "Seal of Righteousness"
	variable string SEAL_COMBAT = "Seal of Righteousness"
	variable string JUDGEMENT = "Judgement of Righteousness"
	variable string AURA = "Devotion Aura"
	variable string BLESSING = "Blessing of Wisdom"

	variable int LastBuffCast = ${LavishScript.RunningTime}
	variable int BuffNum = 1 ;Counter variable used in checking for disease/poison/magic to cleanse/purify.
	variable int MinHPPct = 50;HP% at which you will heal yourself out of combat.
	variable int MinManaPct = 30 ;Mana% at which you will drink.
	variable int BubbleHPPct = 10 ;HP% at which you will shield.
	variable int HandsHpPct = 5 ;HP% at which you will use Lay on Hands to heal yourself.
	variable int NukeManaPct = 30 ;Mana% at which you will stop nuking undead and demons.

	member NeedBuff()
	{
		if !${Me.Buff["${This.AURA}"](exists)} && ${Me.Action["${This.AURA"}].Usable}
		{
			return TRUE
		}
		elseif !${Me.Buff["${This.BLESSING"}](exists)} && ${Me.Action["${This.BLESSING}"].Usable}
		{
			return TRUE
		}
		
		return FALSE
	}
	
	method BuffPulse()
	{

		if !${Me.Buff["${This.AURA}"](exists)} && ${Me.Action["${This.AURA}"].Usable}
		{
			cast "${This.AURA}"
			This:Echo["[Buff] Casting ${AURA}"]
		}
		elseif ${Me.Action["${This.BLESSING}"].Usable} && !${Me.Buff["${This.BLESSING}"](exists)}
		{
			cast "${This.BLESSING}"
			This:Echo["[Buff] Casting ${This.BLESSING}"]
		}
		
	}

	member NeedRest()
	{
		if ${Me.PctHPs} < ${This.MinHPPct} || ${Me.PctMana} < ${This.MinManaPct}
		{
			return TRUE
		}
		return FALSE
	}

	method RestPulse()
	{
		if ${This.NeedCure}
		{
			This:CurePulse
		}

		if ${Me.Action["Holy Light"].Usable} && ${Me.PctHPs} < "${This.MinHPPct}"
		{
			Cast "Holy Light"
			This:Echo["[Heal] Healing out of combat."]
			return
		}

		if !${Me.Buff[Drink](exists)} && ${Consumable.GotDrink} && "${Me.PctMana}" < ${This.MinManaPct}
		{
			Consumable:Drink
			return
		}
	}


	method Routine()
	{
		if !${Me.Attacking}
		{
			WoWScript AttackTarget()
		}
		
		/*
		 * Safety
		 */
		
		if ${Spell["Lay on Hands"](exists)}
		{
			if ${Me.PctHPs} <= ${This.HandsHpPct} && ${Me.Action["Lay on Hands"].Usable}
			{
				cast "Lay on Hands"
				This:Echo["[Heal] Emergency LOH Heal"]
			}
		}
		elseif ${Spell["Divine Protection"](exists)}
		{
			if ${Me.PctHPs} <= ${This.BubbleHPPct} && ${Me.Action["Divine Protection"].Usable} && !${Me.Buff["Forbearance"](exists)}
			{
				cast "Divine Protection"
				This:Echo["[OhNoes] Trouble Bubble"]
			}
		}
		elseif ${Spell["Blessing of Protection"](exists)}
		{
			if ${Me.PctHPs} <= ${This.BubbleHPPct} && ${Me.Action["Blessing of Protection"].Usable} && !${Me.Buff["Forbearance"](exists)}
			{
				cast "Blessing of Protection"
				This:Echo["[OhNoes] Trouble Bubble"]
			}
		}
		elseif ${Spell["Flash of Light"](exists)}
		{
			if (${Me.PctHPs} <= ${This.MinHPPct} && ${Environment.AggroCount} > 1) && ${Me.Action["Flash of Light"].Usable}
			{
				cast "Flash of Light"
				This:Echo["[Heal] FOL heal due to ADDS."]
			}
		}
		elseif ${Me.PctHPs} <= ${This.MinHPPct} && !${Me.Casting}
		{
			cast "Holy Light"
			This:Echo["[Heal] Casting Holy Light"]
		}
		elseif ${Spell["Hammer of Justice"](exists)}
		{
			if "${This.USE_HOJ}" && ${Target.Casting.ID(exists)} && ${Me.Action["Hammer of Justice"].Usable}
			{
				cast "Hammer of Justice"
				This:Echo["[Combat] Target is casting, interrupting."]
			}
		}

		/*
		 * Combat
		 */
		
		elseif !${Target.Buff["${This.JUDGEMENT}"](exists)} && !${Me.Buff["${This.SEAL_JUDGE}"](exists)}
		{
			cast "${This.SEAL_JUDGE}"
			This:Echo["[Combat] Casting ${This.SEAL_JUDGE}"]
		}
		elseif !${Target.Buff["${This.JUDGEMENT}"](exists)} && ${Me.Buff["${This.SEAL_JUDGE}"](exists)} && ${Me.Action["Judgement"].Usable} && ${Target.Distance} <= 10
		{
			cast "Judgement"
			This:Echo["[Combat] Casting Judgement"]
		}
		elseif ${Target.Buff["${This.JUDGEMENT}"](exists)} && !${Me.Buff["${This.SEAL_COMBAT}"](exists)}
		{
			cast "${This.SEAL_COMBAT}"
			This:Echo["[Combat] Casting ${This.SEAL_COMBAT}"]
		}
		elseif (${Me.PctMana} > 30 && ${Environment.AggroCount} > 1) && ${Me.Action["Consecration"].Usable}
		{
			cast "Consecration"
			This:Echo["[Combat] Casting Consecration on adds."]
		}
		elseif "${This.USE_FINISH_JUDGEMENT}" && ${Target.PctHPs} <= 30 && ${Me.Action["Judgement"].Usable} && ${Me.Buff["${This.SEAL_COMBAT}"](exists)}
		{
			cast "Judgement"
			This:Echo["[Combat] Casting finisher judgement."]
		}
		elseif ${Spell["Hammer of Wrath"](exists)}
		{
			if ${Target.PctHPs} <= 20 && "${USE_HOW}" && ${Me.Action["Hammer of Wrath"].Usable}
			{
				cast "Hammer of Wrath"
				This:Echo["[Combat] Casting Hammer of Wrath."]
			}
		}
		elseif "${This.NUKE_UNDEAD}" && (${Target.CreatureType.Equal[Undead]} || ${Target.CreatureType.Equal[Demon]}) && ${Me.PctMana} >= ${NukeManaPct}
		{
			if ${Spell["Exorcism"](exists)}
			{
				if ${Me.Action["Exorcism"].Usable}
				{
					cast "Exorcism"
					This:Echo["[Combat] Nuking ${Target.CreatureType} with Exorcism"]
				}

			}

			elseif ${Spell["Holy Shock"](exists)}
			{
				if ${Me.Action["Holy Shock"].Usable}
				{
					cast "Holy Shock"
					This:Echo["[Combat] Nuking ${Target.CreatureType} with Holy Shock"]
				}

			}
		}
		
	}
	
	member NeedCure()
	{
		BuffNum:Inc
		if ${BuffNum} > 56
		{
			buffNum:Set[1]
		}

		if !${Me.Buff[${BuffNum}](exists)}
		{
			return FALSE
		}

		if ${Me.Buff[${BuffNum}].Harmful}
		{
			if ${Me.Buff[${BuffNum}].DispelType.Equal[Poison]} && (${Spell["Cure Poison"](exists)})
			{
				return TRUE
			}
			elseif ${Me.Buff[${BuffNum}].DispelType.Equal[Curse]} && ${Spell["Remove Curse"](exists)}
			{
				return TRUE
			}
		}
		return FALSE
	}

	method CurePulse()
	{

		declare Cure string local

		Cure:Set[NULL]

		
		  ; If we've come to the end of the buff list then break.
		  if !${Me.Buff[${BuffNum}](exists)}
		  {
		     return
		  }
		
		  ; If this debuff is harmful, then see if it can be cured. 
		  if ${Me.Buff[${BuffNum}].Harmful}
		  {
		
		     if ${Me.Buff["${BuffNum}"].DispelType.Equal[Poison]} && ${Spell["Purify"](exists)}
		     {
				Cure:Set[Purify]
		     }
		     elseif ${Me.Buff["${BuffNum}"].DispelType.Equal[Poison]} && ${Spell["Cleanse"](exists)}
		     {
				Cure:Set[Cleanse]
		     }

		     if ${Me.Buff["${BuffNum}"].DispelType.Equal[Disease]} && ${Spell["Purify"](exists)}
		     {
				Cure:Set[Purify]
		     }
		     elseif ${Me.Buff["${BuffNum}].DispelType.Equal[Disease]} && ${Spell["Cleanse"](exists)}
		     {
				Cure:Set[Cleanse]
		     }

		     if ${Me.Buff["${BuffNum}"].DispelType.Equal[Magic]} && ${Spell["Cleanse"](exists)}
		     {
				Cure:Set[Cleanse]
		     }
		  }
		
		; Looks like the player needs to be cleansed, so cleanse them 
		if !${Cure.Equal[NULL]}
		{
			if ${Me.Action["${Cure}"].Usable}
		  	Cast "${Cure}"
		  	This:Echo["[DeBuff] Casting ${Cure}"]
		}
	}
}