private Composite PoleCombat() { return(new PrioritySelector( // Pick a target, if we don't have one... new Decorator(context => !IsMonkPersuable(SelectedMonk), new Action(context => { SelectedMonk = FindMonk(); })), // Make certain target stays selected... new Decorator(context => Me.CurrentTarget != SelectedMonk, new ActionFail(context => { SelectedMonk.Target(); })), // If we are within melee range of target, spank it... new Decorator(r => SelectedMonk.IsWithinMeleeRange, new ActionRunCoroutine(context => UtilityCoroutine.MiniCombatRoutine())), // If we are out of range of target, move closer... new Decorator(r => !SelectedMonk.IsWithinMeleeRange, new CompositeThrottle(TimeSpan.FromMilliseconds(500), new Action(delegate { var bestPole = (from pole in FindPoles() where pole.WithinInteractRange orderby pole.Location.DistanceSqr(SelectedMonk.Location) select pole) .FirstOrDefault(); // If we "can't get there from here", then jump own and start over... if (bestPole == null) { Utility.ExitVehicle(); } // Otherwise, move to the next best pole... else { bestPole.Interact(true); // Reset the stuck handler so it doesn't false positive... Navigator.NavigationProvider.StuckHandler.Reset(); } }))) )); }