• Visit Rebornbuddy
  • Wartastic [Protection - Tanking]

    Discussion in 'Warrior' started by Speks, Jan 20, 2015.

    1. Speks

      Speks Community Developer

      Joined:
      Jan 20, 2015
      Messages:
      83
      Likes Received:
      2
      Trophy Points:
      8
      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<WoWUnitUnfriendlyUnits
              
      {
                  
      get { return ObjectManager.GetObjectsOfType<WoWUnit>(truefalse).Where(=> !u.IsDead && u.CanSelect && u.Attackable && !u.IsFriendly && u.IsWithinMeleeRange); }
              }


              private 
      delegate T Selection<out T>(object context);
              
      Composite Cast(string spellSelection<boolreqs 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
       

      Attached Files:

      Last edited: Mar 2, 2015
      abndrew82 likes this.
    2. klepp0906

      klepp0906 Banned

      Joined:
      Apr 25, 2013
      Messages:
      1,352
      Likes Received:
      8
      Trophy Points:
      38
      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.
       
    3. abndrew82

      abndrew82 New Member

      Joined:
      May 14, 2010
      Messages:
      323
      Likes Received:
      1
      Trophy Points:
      0
      Works quite well, ran 2 heroics dungeons on my warrior yesterday and saw no major issues right off.
       
    4. Day7

      Day7 Member

      Joined:
      Dec 14, 2014
      Messages:
      175
      Likes Received:
      2
      Trophy Points:
      18
      Does this work for low level characters or just 100?
       
    5. lostmyz

      lostmyz New Member

      Joined:
      Sep 3, 2010
      Messages:
      259
      Likes Received:
      0
      Trophy Points:
      0
      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!!!
       

    Share This Page