What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Wartastic [Protection - Tanking]

Speks

Community Developer
Joined
Jan 20, 2015
Messages
83
This is a Simplistic smooth warrior routine for use with Enyo. (168 lines of code)
It has no targeting or movement functions.

It supports all talents except Gladiator Stance, beacuse well its intended use is tanking. I can add it if its requested however.

Defensives & Self-healing is used based on your current health.
Offensives is used on cooldown. (Saves Bladestorm for AoE)
Single Target & AoE Rotation is based on Simulationcraft priorities and as such should maintain SimDPS.
DTPS however is a diferent story since it will used defensives based on your own health, not taking into account pre-pooling rage for upcoming encounter abilities and such.
This routine only has a Automatic mode, feel free to change HP% values as you see fit.
The usage of taunt is left upto you.
I just made this for learning purposes & trying to get a grasp on C#.
Thanks to Apoc for beautiful code & thanks to Niklasgs for answering questions & providing valuable input.

If you encounter an issue let me know and i'll attempt to bossmode it.

Code:
[HIDE]
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using Styx;
using Styx.CommonBot;
using Styx.CommonBot.Routines;
using Styx.Helpers;
using Styx.TreeSharp;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

// Made by Speks - Big thanks to Apoc (for code) and Niklasgs for the help.

using Action = Styx.TreeSharp.Action;


namespace Wartastic
{
    public class Routine : CombatRoutine
    {

        public override string Name { get { return "Wartastic"; } }
        public override WoWClass Class { get { return WoWClass.Warrior; } }
        private Composite _combat, _buffs;
        public override Composite CombatBehavior { get { return _combat; } }
        public override Composite PreCombatBuffBehavior { get { return _buffs; } }
        public override Composite CombatBuffBehavior { get { return _buffs; } }
        public override void Initialize()
        
        {
            _combat = CreateCombat();
            _buffs = CreateBuffs();
        }


        Composite CreateBuffs()
        {
            return Cast("Battle Shout", ret => !StyxWoW.Me.HasAura("Battle Shout"));
        }

        Composite CreateCombat()
        {
            return new PrioritySelector(

                // Interrupt
                // Cast("Pummel", ret => StyxWoW.Me.CurrentTarget.IsCasting && StyxWoW.Me.CurrentTarget.CanInterruptCurrentSpellCast),

                new Decorator(ret => UnfriendlyUnits.Count() >= 2,
                    CreateAoe()),

                new Decorator(ret => StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.HealthPercent <= 20,
                    CreateExecuteRange()),
                new Decorator(ret => StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.HealthPercent > 20,
                    new PrioritySelector(

                        Cast("Bloodbath"),
                        Cast("Berserker Rage"),
                        Cast("Demoralizing Shout", ret => StyxWoW.Me.HealthPercent <= 80),
                        Cast("Shield Wall", ret => StyxWoW.Me.HealthPercent <= 20),
                        Cast("Shield Block", ret => StyxWoW.Me.RagePercent >= 60),
                        Cast("Shield Barrier", ret => StyxWoW.Me.RagePercent >= 85),
                        Cast("Last Stand", ret => StyxWoW.Me.HealthPercent <= 30),
                        Cast("Enraged Regeneration", ret => StyxWoW.Me.HealthPercent <= 30),
                        Cast("Heroic Strike", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Ultimatum") && StyxWoW.Me.CurrentTarget.IsWithinMeleeRange),
                        Cast("Shield Slam", ret => StyxWoW.Me.CurrentTarget.IsWithinMeleeRange),
                        Cast("Revenge", ret => StyxWoW.Me.CurrentTarget.IsWithinMeleeRange),
                        GCast("Ravager"),
                        Cast("Victory Rush", ret => StyxWoW.Me.HealthPercent <= 80 && StyxWoW.Me.CurrentTarget.IsWithinMeleeRange),
                        Cast("Execute", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Sudden Death") && StyxWoW.Me.CurrentTarget.IsWithinMeleeRange),
                        Cast("Avatar"),
                        Cast("Dragon Roar"),
                        Cast("Shockwave"),
                        Cast("Devastate", ret => StyxWoW.Me.CurrentTarget.IsWithinMeleeRange))));
                   
        }
        Composite CreateAoe()
        {
            return new PrioritySelector(
                Cast("Dragon Roar"),
                Cast("Shockwave"),
                Cast("Bladestorm", ret => UnfriendlyUnits.Count() >= 2),
                Cast("Thunder Clap", ret => UnfriendlyUnits.Count() >=2)

                );
        }
        Composite CreateExecuteRange()
        {
            return new PrioritySelector(
 
                new Action(ret => { UseTrinkets(); return RunStatus.Failure; }),
 
               Cast("Shield Wall")
 
               // Execute inget värde
 
               
                );
        }
        Composite GCast(string spell)
        {
            return new Decorator(ret => SpellManager.CanCast(spell) && StyxWoW.Me.CurrentTarget != null,
                new Action(ret =>
                {
                    SpellManager.Cast(spell);
                    SpellManager.ClickRemoteLocation(StyxWoW.Me.CurrentTarget.Location);
                }));
        }
        

        void UseTrinkets()
        {
            var firstTrinket = StyxWoW.Me.Inventory.Equipped.Trinket1;
            var secondTrinket = StyxWoW.Me.Inventory.Equipped.Trinket2;


            if (firstTrinket != null && CanUseEquippedItem(firstTrinket))
                firstTrinket.Use();


            if (secondTrinket != null && CanUseEquippedItem(secondTrinket))
                secondTrinket.Use();

        }
        private static bool CanUseEquippedItem(WoWItem item)
        {
            // Tinkerkoll
            string itemSpell = Lua.GetReturnVal<string>("return GetItemSpell(" + item.Entry + ")", 0);
            if (string.IsNullOrEmpty(itemSpell))
                return false;


            return item.Usable && item.Cooldown <= 0;
        }
        
        IEnumerable<WoWUnit> UnfriendlyUnits
        {
            get { return ObjectManager.GetObjectsOfType<WoWUnit>(true, false).Where(u => !u.IsDead && u.CanSelect && u.Attackable && !u.IsFriendly && u.IsWithinMeleeRange); }
        }


        private delegate T Selection<out T>(object context);
        Composite Cast(string spell, Selection<bool> reqs = null)
        {
            return
                new Decorator(
                    ret => ((reqs != null && reqs(ret)) || (reqs == null)) && SpellManager.CanCast(spell) && StyxWoW.Me.CurrentTarget != null,
                    new Action(ret => SpellManager.Cast(spell)));
        }
    }
}
}
[/HIDE]
Changelog
Version 1.0.1:
  • Optimized.
  • Swagged up groundcast method.
 

Attachments

Last edited:
Thanks for the upload, will try this out shortly and let you know how it turns out in comparison to quite a few other solutions i use presently :)

You know, Apoc (i think) used to have an arms warrior routine that was SUPER simple, no gui.. very very lightweight and it outperformed just about everything. Heck maybe everything tbh. Would be really cool if this barked up that tree.
 
Works quite well, ran 2 heroics dungeons on my warrior yesterday and saw no major issues right off.
 
I am seasoned with HB been using it since 2010 off and on.... mainly for farming and leveling... But i want to get into the botting for dungeons etc... My only question is where do I put this routine? In the routine section or bc its a ".cs" do I put it in the Quest Behaviors folder?

Also anything special upon booting up beside running in in enyo?

thanks!!!
 
Back
Top