;Stealthy's Mage Routine ;Designing Stages 0.0 ;Designed for use with WoWBot 15b. ;notes: WORK ON AOES! ex adds and superaoeing, work on hilly targeting ;notes: Totem code, add code to deal with pets (NPC warlocks, hunters) ;notes: add user set-able var for 5/5 arc missiles, same for pyro pulling if sitting, stand if no water elemental out and spell exists, summon water elemental check for targets, if none grab one check to see if they're allied/enemy handle any elites that may have aggroed attack define frostspec check if we're in pull range and -haven't- pulled and have hp/mana combatprep if not enough hp/mana, downtime if yes, if fire mage, and you have no adds attacking you, pop off pyro if firemage and you have adds or you don't have pyro, use fireball if frostmage, open with frostbolt if spell finishes casting, set pulled flag. else repull if not, get closer and pull else start nukes if target under 30yrds and firespec and target not fire immune, fireball if target under 30yrds and firespec and target fire immune, frostbolt if target under 30 yrds and frostspec and target not frost immune, frostbolt if target under 30yrds and frostspec and target frost immune, firebolt if target under 30yrds and immune to frost and fire, arcane missiles if one extra aggroed exist, resheep, run to safe loc, if mana under x%, evocate if target is casting a spell, counterspell if targe tunder 20yrds and not cooldown, fireblast if under 25%hp, pop mana shield manastone/pots if target in melee range and not frost immune, frostnova find save point to right or left, strafe to it, face target if one add, target it and poly it if one add and can't poly, pick safe point and run if two adds and >1 lvl under you, aoe, might have to set flag and make function if two adds and <2 lvl under you, pick safe point and run if arc power exists, and my mana >50%, pop it if clearcast exists, and cold spec, cone of cold if clearcast exists, and not cold, blast wave if target frostbitten, frostnovad, or frozen, ice lance if pom exists and isn't cooldown, pop it if firespec and target not fire immune and pyro exists, pyroblast if firespec and target not fire immune and no pyro, fireball if firespec and target fire immune, frostbolt if frostspec and target not frost immune, frsotbolt if frostspec and target frost immune, fireball manastone/pots if exists and range <10yrds, use dragon's breath if me > 75% hp and target under10%hp, wand if me > 50% hp and target under5%+ignited, wand if target under 10%hp, scorch if target under 4% hp, wand if me < 40%hp and target > 60%hp, instacasts blastwave cone of cold fireblast if me < 25% hp and < 25% mp, evocate if me < 25%hp and bandages exist, and not recently bandaged, use bandage if target dead and no adds, reset pulled if target dead and adds, work on adds when adds dead, reset pulled downtime downtime check to see if I'm in combat, if yes, wait 5 and recheck if no, proceed check to see if I'm buffed, if yes, and >x hp/mp, don't bother if not buffed, and if have >x hp/mp, call buff if (variable food) doesn't exist, call make food if (variable water) doesn't exist, call make water if under X hp, and (variable food) exists, call eat if under x mp, and (variable water) exists, call drink if sitting, wowpress sitorstand if combatprep var, enter attack phase summonwater same as food, but needs to be done first summonfood check what level you are, summon food based on your level use a switch/class to do so based on this, set food variable to your level food cast twice usewater/food if safe, and if have food + water, use if just food or just water, use wait til HP/MP full, use again if needed pots check for hp pots from highest to lowest potency, use if exist and if under certain HP in fight, and can use same for mp pots manastonesummon check for highest mana stone conjure that exists set variable for it summon based on variable manastoneuse use manastone based on variable if in combat and under %mp bandageset check for existing bandages, set var based on highest existing usable combatprep if arc int is gone, pop it. if frost/ice armor is gone, pop it. if mob is a caster, pop dampen magic. if mob uses frost/fire, use frostward/fireward. if combustion exists and isn't cooldown or on me, pop it. if ice barrier exists and isn't cooldown or on me, pop it. if ice barrier exists and is cooldown but isn't on me, and coldsnap exists pop coldsnap pop ice barrier if my mana's now low and evocate exists and isn't cooldown, use it if my mana's now low and no evocate/evocate but cooldown, set special downtime var and trigger downtime if my mana's fine, proceed to attack function Attack(string AttackGUID) { ;will assume either fire or fire/arcane if false, set it according to your spec declare frostspec bool local false declare Pyropull bool global true declare arcmissiletalent bool global false ;don't touch these, they're autoset declare Pulled bool local false declare UseFrostWard bool global false declare UseFireWard bool global false declare Immune-Frost bool global false declare Immune-Fire bool global false declare Dampen bool global false declare Ranged bool local true declare hastarget bool global false declare testx float global 0 declare testy float global 0 declare safex float global 0 declare safey float global 0 declare angle float global 0 declare NoSafeSpot bool global false declare testfail int global 0 SavedWaypointX:Set[${Me.X}] SavedWaypointY:Set[${Me.Y}] if ${AttackGUID[NULL]}||${AttackGUID.Equal[NOTARGET]} { call UpdateHudStatus "No Target." Return } ;elites code borrowed from eqjoe, not much improvement to make. RLG is getting improved, however. if ${Unit[${AttackGUID}].Classification.Equal[Elite]} { if !${Me.InCombat} { call UpdateHudStatus "Target is an elite, don't bother attacking them" GUIDBlacklist:Set[${AttackGUID},AVOID] TargetGUID:Set[NOTARGET] Return } else { call UpdateHudStatus "Aggrod an elite RUN after we sheep!!" if !${Spell[Polymorph].Cooldown}&&${Spell[Polymorph](exists)} { call CastSpell Polymorph ${AttackGUID} } RLG:Set[TRUE] GUIDBlacklist:Set[${AttackGUID},AVOID] TargetGUID:Set[NOTARGET] return } } call UpdateHudStatus "Attacking ${Object[${AttackGUID}].Name}" if ${Unit[${AttackGUID}].Distance}<${PullingRange}&&!${HavePulled} { move -stop Target ${AttackGUID} } do { ;If already pulled, just nuke. if ${pulled} { call Nukes } ;save XYZ for stuck dist checking later, that's getting improved as well DistX:Set[${Me.X}] DistY:Set[${Me.Y}] DistZ:Set[${Me.Z}] ;Do we still have a target? if !${Unit[${AttackGUID}](exists) { echo "Target disappeared :(" call UpdateHudStatus "Target is gone." TargetGUID:Set[NOTARGET] Return } ;Check to see if it's been tapped if ${Unit[${AttackGUID}].Tapped} { echo "Target stolen, stopping casting if I was casting." call UpdateHudStatus "Target stolen; tapped." if ${Me.Casting} wowpress JUMP TargetGUID:Set[NOTARGET] Return } ;Check to see if it's not tapped yet, but has a target if ${Unit[${AttackGUID}](exists) { Target ${AttackGUID} call checkassist wowpress ASSIST call removecheckassist if ${hastarget} { echo "Ignoring target from assistcheck" call UpdateHudStatus "It's got a target; ignore." TargetGUID:Set[NOTARGET] Return } } ;If our target's in range and not targetted, target him. if (!${Target.GUID.Equal[${AttackGUID}]) && (${Unit[${AttackGUID}].Distance<${TargettingRange}) { echo "Targeting our target" call UpdateHudStatus "Targetting ${AttackGUID}" Target ${AttackGUID} } ;Do the combat prep if (Target.GUID.Equal[${AttackGUID}]) && (${Unit[${AttackGUID}].Distance<${TargettingRange}) { echo "doing combatprep" call UpdateHudStatus "Doing CombatPrep for fight with ${AttackGUID}" call combatprep } ;All should be well, start the pull. echo "Pulling" if (${Unit[${AttackGUID}].Distance<${PullingRange}) && (${Unit[${AttackGUID}].Distance}>25) && (${Unit[${AttackGUID}].Distance}<${TargettingRange}) { ;Attach atom for pullcheck Event[UNIT_SPELLCAST_SUCCEEDED]:AttachAtom[pullcheck] ;Check for what spell would be best to pull with and use it. ;If you're fire and got pyro, use it. if !${frostspec} && ${Pyropull} ${Spell[Pyroblast](exists)} && !{Immune-Fire} { echo "pyroblast pulling" call UpdateHudStatus "Pulling with Pyroblast" call castspell "Pyroblast" ${AttackGUID} } ;Pull with a fireball if pyro doesn't exist if !${frostspec} && !${Spell[Pyroblast](exists)}||!${Pyropull} && !{Immune-Fire} { echo "fireball pulling" call UpdateHudStatus "Pulling with Fireball" call castspell "Fireball" ${AttackGUID} } ;Frost spec? Frostbolt! if ${frostspec} && !{Immune-Frost} { echo "Frostbolt pulling" call UpdateHudStatus "Pulling with Frostbolt" call castspell "Frostbolt" ${AttackGUID} } ;If you're a frosty and it's frost immune, you can't exactly frostbolt it... if ${frostspec} && {Immune-Frost} { echo "firebolt pulling - frost immune" call UpdateHudStatus "Pulling with Fireball" call castspell "Fireball" ${AttackGUID} } ;Likewise, if you're fire and it's fire immune, can't use fire. { echo "Frostbolt pulling - fire immune" call UpdateHudStatus "Pulling with Frostbolt" call castspell "Frostbolt" ${AttackGUID} } ;Just in case it's an add we're starting to fight, add a 'pulled' check for it. 5 yard pyroblasts annoy me. if (${Unit.Distance["${AttackGUID}"]<5) { declare pulled bool global TRUE } } ;If the target's dead, go ahead and reset pulled flag if (${Unit.PctHPs["${AttackGUID}"]}=0) { declare pulled bool global FALSE } ;If we're good on pull, start the nukes! if ${pulled} { echo "Pulled good, starting nukes" call UpdateHudStatus "Starting Nukes" call Nukes } } } function Nukes() { ;Make sure it's in casting range... this should fit any spec with at least rank 3 fireball/frostbolt if (${Unit.Distance["${AttackGUID}"]>36) { ; move -stop wait 3 return } ;What better way to start than with clearcast? if ${Me.Buff["Clearcasting"](exists)} { if ${arcmissletalent} { echo "Clearcast one rack 'o Missiles" call UpdateHudStatus "Casting Arcane Missiles" call castspell "Arcane Missiles" ${AttackGUID} } if ${frostspec} && !${Immune-Frost} { echo "Clearcasting me a frostbolt" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } ;Aww crap... clearcast and it's frost immune. No free lolcrit for you. if ${frostspec} && ${Immune-Frost} { echo "Poor frostmage clearcasting a fireball" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } ;Firespec? Good man (or woman)! if !${frostspec} && !${Immune-Fire} { echo "Clearcast cooking: One fireball" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } ;Fire mage fighting lava elementals? Shame on you. if !${frostspec} && ${Immune-Fire} { echo "Clearcasting a frostbolt because I'm a bad fire mage" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } } ;Well, that's great. What about arc power? if ${Spell["Arcane Power"](exists)} && !${Spell["Arcane Power"].Cooldown} { echo "I have the power!" call UpdateHudStatus "Casting Arcane Power" call castspell "Arcane Power" ${Me.GUID} } ;Ain't that nifty? You know, I'm pretty sure that if we have arc power, we have something else... if ${Spell["Presence of Mind"](exists)} && !${Spell["Presence of Mind"].Cooldown} { echo "One cruise missile coming up" call UpdateHudStatus "Casting Presence of Mind" call castspell "Presence of Mind" ${Me.GUID} } ;Now then, what are we going to do with this newfound power? You know what. if ${Me.Buff["Presence of Mind"](exists)} { ;We gotta pick our poison. if !${frostspec} && ${Spell["Pyroblast"](exists)} && !${Immune-Fire} { echo "FIRIN MAH LAZAR CANNON!" call UpdateHudStatus "Casting Pyroblast" call castspell "Pyroblast" ${AttackGUID} } if !${frostspec} && !${Spell["Pyroblast"](exists)} && !${Immune-Fire} { echo "Firin mah...mini... lazar cannon!" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } ;Unfortunately, there's -always- a frosty. if ${frostspec} && !${Immune-Frost} { echo "Pew pew frostbolt" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } ;That's fine and dandy, but what if we're a naughty mage fighting something immune to our spec? if ${Immune-Frost} { echo ":'( It's immune, fireBALLIN'" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } if ${Immune-Fire} { echo ":'( It's immune, frostLAMIN'" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } } ;Ok, ok, I know what you're saying. What if we're too new for this nice stuff? ;Well... you get the basic nukes + the rest of the routine. if !${Immune-Fire} && !${frostspec} { echo "Nuking Fireball" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } if !${Immune-Frost} && ${frostspec} { echo "Nuking Frostbolt" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } if ${Immune-Fire} && !${frostspec} { echo "Seminuking Frostbolt" call UpdateHudStatus "Casting Frostbolt" call castspell "Frostbolt" ${AttackGUID} } if ${Immune-Frost} && ${frostspec} { echo "Seminuking Fire" call UpdateHudStatus "Casting Fireball" call castspell "Fireball" ${AttackGUID} } ;By now, mob should be on you. So, we're going to want to get away from it. { if !${Spell["Blink"].Cooldown} && !${Spell["Frost Nova"].Cooldown} && !${Immune-Frost} { call GetSafePoint(${Me.Heading}) if !${NoSafeSpot} { echo "Entrapping and getting away" face ${safex} ${safey} call castspell "Frost Nova" ${AttackGUID} echo "Blinking" call castspell "Blink" ${Me.GUID} moveto ${safex} ${safey} 2 face ${Target.X} ${Target.Y} } } ;Sometimes trap and get away won't work... so just get away. if !${Spell["Blink"].Cooldown} && (${Spell["Frost Nova"].Cooldown} || ${Immune-Frost}) { call GetSafePoint(${Me.Heading}) if !${NoSafeSpot} { echo "Can't entrap, just getting away" face ${safex} ${safey} echo "Blinking" call castspell "Blink" ${Me.GUID} moveto ${safex} ${safey} 2 face ${Target.X} ${Target.Y} } } ;And sometimes, you just can't get away. if ${Spell["Blink"].Cooldown} || ${NoSafeSpot} { if !${Spell["Frost Nova"].Cooldown} && !${Immune-Frost} { echo "Can't get away, FN'ing for the hell of it" call UpdateHudStatus "Casting Frost Nova" call castspell "Frost Nova" ${AttackGUID} } } } ;And there's your nukes. But wait! Ice lance, anyone? if ${Unit[${AttackGUID}].Buff["Frostbite"](exists)}||${Unit[${AttackGUID}].Buff["Frozen"](exists)}||${Unit[${AttackGUID}].Buff["Frost Nova"](exists)} && !${Immune-Frost} { echo "Icelance!" call UpdateHudStatus "Casting Ice Lance" call castspell "Ice Lance" ${AttackGUID} } } function Downtime() { } function summonfood() { } function eatfood() { } function summonwater() { } function pots() { } function combatprep() { } function buffs() { } function manastone() { } function GetSafeSpot(angle) { if ${testfail}=8 { NoSafeSpot:set TRUE } if ${testfail}<8 { testx:Set[${Math.Calc[[12/[${Math.Cos[${angle}]]]+${Me.X}] testy:Set[${Math.Calc[[12/[${Math.Sin[${angle}]]]+${Me.Y}] Mobs:Search[-units,-origin ${textx},${testy},${Me.Z},-alive,-range 0-10 if ${Mobs.Count}=0 { echo "Safe spot good." safex:Set{$testx} safey:Set{$testy} testfail:Set[0] } if ${Mobs.Count}>0 { echo "Our spot sucks, trying to get another..." testfail:Set[${Math.Calc[${testfail}+1]}] angle:Set[${Math.Calc[${Me.heading}+45]}] call GetSafeSpot(${Math.Calc[${angle}+45]}) } } } function events() { Event[PLAYER_TARGET_CHANGED]:AttachAtom[assistcheck] } atom checkassist() { Event[PLAYER_TARGET_CHANGED]:AttachAtom[assistcheck] } atom removecheckassist() { Event[PLAYER_TARGET_CHANGED]:DetachAtom[assistcheck] } atom(script) assistcheck() { if !${Target.GUID.Equal[${Me.GUID}]} { declare hastarget bool global TRUE } else { declare hastarget bool global FALSE } } atom(script) immunechecks(string eventid , text, Message) { if ${Message.Find["Chilled"]}||${Message.Find["Frostbolt"]}||${Message.Find["Cone of Cold"]}||${Message.Find["Frost Nova"]}&&${Message.Find["failed"]}&&${Message.Find["immune"]} { declare Immune-Frost bool global TRUE } if ${Message.Find["afflicted by Chilled"]}||${Message.Find["Frostbolt hits"]}||${Message.Find["Cone of Cold hits"]}||${Message.Find["Frost Nova hits"]} { declare Immune-Frost bool global FALSE } if ${Message.Find["Pyroblast"]}||${Message.Find["Fireball"]}||${Message.Find["Fireblast"]}||${Message.Find["Scorch"]}&&${Message.Find["failed"]}&&${Message.Find["immune"]} { declare Immune-Fire bool global TRUE } if ${Message.Find["Pyroblast"]}||${Message.Find["Fireball"]}||${Message.Find["Fireblast"]}||${Message.Find["Scorch"]}&&!${Message.Find["immune"]} { declare Immune-Fire bool global FALSE } if ${Message.Find["hits you for"]}&&${Message.Find["Nature damage"]}||${Message.Find["Shadow damage"]}||${Message.Find["Holy damage"]}||${Message.Find["Fire damage"]}||${Message.Find["Frost damage"]} { declare DampenMagic bool global TRUE } } atom(script) damagecheck(string eventid , text, Message) { if ${Message.Find["hits you"]}&&${Message.Find["Frost damage"]} { declare UseFrostWard bool global TRUE } if ${Message.Find["hits you"]}&&${Message.Find["Fire damage"]} { declare UseFireWard bool global TURE } } atom(script) pullcheck(string eventid , text, Message) { if ${ text.Find["player"]} && (${Message.Find["Fireball"]}||${Message.Find["Frostbolt"]}||${Message.Find["Pyroblast"]}) { echo "Pullcheck passed" declare pulled bool global TRUE Event[UNIT_SPELLCAST_SUCCEEDED]:DetachAtom[pullcheck] } }