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]
[/HIDE]
Changelog
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)));
}
}
}
}
Changelog
Version 1.0.1:
- Optimized.
- Swagged up groundcast method.
Attachments
Last edited: