All pastes #470598 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-04 11:28 UTC
rendered paste body
; Immolator's OpenBot Frost Mage Routine
; 
; History:
; 	Legend: E = Enhancement, F = Fix
; 	v0.1.0
; 		E: First version, put up a skeleton for all the necessary functions
;		E: Faces mob while casting
;		E: Eats, drinks and buffs
;		E: Combat added, pulls and fights
;		E: Uses Ice Barrier
; 		E: Uses Evocation
;
; Todo:
; 	Better combat sequence
;	Bandages
;	Potions
;	Scrolls
;	Polymorph
;	Better Water Elemental
;	Better Evocation
;	Fix  buggy downtime sequence

objectdef oClass inherits oBase
{
	; Customize these variables to suit your needs:
	; The distance at which the PullSpell is used
	variable int PullRange = 34
	; The spell used to pull mobs
	variable string PullSpell = "Frostbolt"
	; The armour spell used (Ice Armour, Frost Armour, Mage Armour)
	variable string ArmourBuff = "Ice Armor"
	; Whether to use Dampen Magic or not
	variable bool UseDampen = TRUE
	; Whether to use Polymorph or not
	variable bool UsePoly = TRUE
	; Stop resting when above this amount of mana
	variable int FullMana = 95
	; Stop resting when above this amount of health
	variable int FullHealth = 95
	
	method Initialize()
	{
	}
	
	method CastingPulse()
	{
		if ${Target.GUID.NotEqual[${Me.GUID}]} && ${Target(exists)}
		{
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
		}
	}
	
	method RestPulse()
	{
		Move -stop
		if (${Me.PctMana} > ${This.FullMana}) && (${Me.PctHPs} > ${This.FullHealth})
		{
			This:Output[Stand up!]
			Toon:Standup
		}
		if ${Me.Buff[Drink](exists)} || ${Me.Buff[Eat](exists)}
		{
			return
		}
		if !${Consumable.HasDrink}
		{
			if ${Toon.CastSpellGUID[${Me.GUID},Conjure Water]}
			{
				return
			}
		}
		if !${Consumable.HasFood}
		{
			if ${Toon.CastSpellGUID[${Me.GUID},Conjure Food]}
			{
				return
			}
		}
		if ${Toon.EnsureBuff[${Me.GUID},${This.ArmourBuff}]} 
		{
			return
		}
		if ${Toon.EnsureBuff[${Me.GUID},Arcane Intellect]} 
		{
			return
		}
		if ${This.UseDampen} 
		{
			if ${Toon.EnsureBuff[${Me.GUID},Dampen Magic]}
			{
				return
			}
		}
		if ${Consumable.HasDrink} && !${Me.Buff[Drink](exists)} && (${Me.PctMana} < ${This.FullMana})
		{
			Consumable:useDrink
			return
		}
		if ${Consumable.HasFood} && !${Me.Buff[Food](exists)} && (${Me.PctHPs} < ${This.FullHealth})
		{
			Consumable:useFood
			return
		}

	}
	
	member NeedRest()
	{
		if (${Me.PctMana} < ${This.FullMana}) || (${Me.PctHPs} < ${This.FullHealth})
		{
			return TRUE
		}
		if ${Toon.NeedBuff[${Me.GUID},${This.ArmourBuff}]}
		{
			return TRUE
		}
		if ${Toon.NeedBuff[${Me.GUID},Arcane Intellect]}
		{
			return TRUE
		}
		if ${This.UseDampen} && ${Toon.NeedBuff[${Me.GUID},Dampen Magic]}
		{
			return TRUE
		}
		return FALSE
	}
	
	method PullPulse()
	{
		Move -stop
		if ${Toon.CastSpellGUID[${Target.GUID},Ice Barrier]}
		{
			return
		}
		if ${Toon.CastSpellGUID[${Target.GUID},Summon Water Elemental]}
		{
			return
		}
		if ${Toon.CastSpellGUID[${Targeting.TargetCollection.Get[1]},${PullSpell}]}
		{
			return
		}
	}	
	
	method AttackPulse()
	{
		if !${Target(exists)} || ${Target.GUID.Equal[${Me.GUID}]} || ${Target.Dead}
		{
			Toon:NeedTarget[1]
		}
		if (${Target.Distance} < 10) &&  (${Me.PctMana} < 5)
		{
			if ${Toon.CastSpellGUID[${Target.GUID},"Frost Nova"]}
			{
				if (${Target.Buff[Frost Nova](exists)} || ${Target.Buff[Frostbite](exists)}) && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < 10
				{
					Move Backward
					if ${Toon.CastSpellGUID[${Target.GUID},Evocation]}
					{
						return
					}
				}
			}
		}
		if (${Target.Distance} < 10) 
		{
			if ${Toon.CastSpellGUID[${Target.GUID},"Frost Nova"]}
			{
				return
			}
		}
		if (${Target.Distance} > 34)
		{
			Navigator:FaceXYZ[${Target.X},${Target.Y},${Target.Z}]
			Move Forward
			return
		}
		if (${Target.Buff[Frost Nova](exists)} || ${Target.Buff[Frostbite](exists)}) && ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${Target.X},${Target.Y},${Target.Z}]} < 10
		{
			Move Backward
			return
		}

		if !${Me.Buff[Ice Barrier](exists)}
		{
	 		if ${Toon.CastSpellGUID[${Target.GUID},Ice Barrier]}
			{
				return
			}
		}
		if ${Me.PctMana}<5 || ${Target.PctHPs}<10
		{
			if ${Toon.CastSpellGUID[${Target.GUID},Shoot]}
			{
				return
			}
		}
		if (${Target.Distance} < 8)
		{
			if ${Toon.CastSpellGUID[${Target.GUID},Cone of Cold]}
			{
				return
			}
		}
		if (${Target.Distance} < 20)
		{
			if ${Toon.CastSpellGUID[${Target.GUID},Fire Blast]}
			{
				return
			}
		}
		if ${Toon.CastSpellGUID[${Target.GUID},Frostbolt]}
		{
			return
		}
	}
	
}