public static Composite CreateHunterTrapBehavior(string trapName, bool useLauncher, UnitSelectionDelegate onUnit) { return(new PrioritySelector( new Decorator( ret => onUnit != null && onUnit(ret) != null && onUnit(ret).DistanceSqr < 40 * 40 && SpellManager.HasSpell(trapName) && !SpellManager.Spells[trapName].Cooldown, new PrioritySelector( Spell.BuffSelf(trapName, ret => !useLauncher), Spell.BuffSelf("Trap Launcher", ret => useLauncher), new Decorator( ret => StyxWoW.Me.HasAura("Trap Launcher"), new Sequence( new Switch <string>(ctx => trapName, new SwitchArgument <string>("Immolation Trap", new Action(ret => LegacySpellManager.CastSpellById(82945))), new SwitchArgument <string>("Freezing Trap", new Action(ret => LegacySpellManager.CastSpellById(60192))), new SwitchArgument <string>("Explosive Trap", new Action(ret => LegacySpellManager.CastSpellById(82939))), new SwitchArgument <string>("Ice Trap", new Action(ret => LegacySpellManager.CastSpellById(82941))), new SwitchArgument <string>("Snake Trap", new Action(ret => LegacySpellManager.CastSpellById(82948))) ), new ActionSleep(200), new Action(ret => LegacySpellManager.ClickRemoteLocation(onUnit(ret).Location)))))))); }
public static Composite CreateHunterTrapOnAddBehavior(string trapName) { return(new PrioritySelector( ctx => Unit.NearbyUnfriendlyUnits.OrderBy(u => u.DistanceSqr). FirstOrDefault( u => u.Combat && u != StyxWoW.Me.CurrentTarget && (!u.IsMoving || u.IsPlayer) && u.DistanceSqr < 40 * 40), new Decorator( ret => ret != null && SpellManager.HasSpell(trapName) && !SpellManager.Spells[trapName].Cooldown, new PrioritySelector( Spell.BuffSelf("Trap Launcher"), new Decorator( ret => StyxWoW.Me.HasAura("Trap Launcher"), new Sequence( new Switch <string>(ctx => trapName, new SwitchArgument <string>("Immolation Trap", new Action(ret => LegacySpellManager.CastSpellById(82945))), new SwitchArgument <string>("Freezing Trap", new Action(ret => LegacySpellManager.CastSpellById(60192))), new SwitchArgument <string>("Explosive Trap", new Action(ret => LegacySpellManager.CastSpellById(82939))), new SwitchArgument <string>("Ice Trap", new Action(ret => LegacySpellManager.CastSpellById(82941))), new SwitchArgument <string>("Snake Trap", new Action(ret => LegacySpellManager.CastSpellById(82948))) ), new ActionSleep(200), new Action(ret => LegacySpellManager.ClickRemoteLocation(((WoWUnit)ret).Location)))))))); }