private static Composite dropMethod(this int Spell, unitSelectionDelegate unitSelection, Selection<bool> reqs = null, bool waitForSpell = false) { return new Decorator(ret => unitSelection != null && reqs(ret) && SpellManager.CanCast(Spell) && (Me.Location.Distance(unitSelection(ret).Location) <= WoWSpell.FromId(Spell).MaxRange || WoWSpell.FromId(Spell).MaxRange == 0), new Sequence( new Action(ret => SpellManager.Cast(Spell)), new DecoratorContinue(ctx => waitForSpell, new WaitContinue(1, ret => Me.CurrentPendingCursorSpell != null && Me.CurrentPendingCursorSpell.Id == Spell, new ActionAlwaysSucceed())), new Action(ret => { SpellManager.ClickRemoteLocation(unitSelection(ret).Location); lastSpellCast = Spell; L.combatLog("Casting: " + WoWSpell.FromId(Spell).Name + " on " + unitSelection(ret).SafeName); }))); }
private static Composite castMethod(this int Spell, unitSelectionDelegate unitSelection, Selection<bool> reqs = null, bool gcdCast = false) { return new Decorator(ret => ((reqs != null && reqs(ret)) || (reqs == null)) && unitSelection != null && unitSelection(ret) != null && SpellManager.CanCast(Spell, unitSelection(ret)), new Action(ret => { if (SpellManager.Cast(Spell, unitSelection(ret))) { lastSpellCast = Spell; L.combatLog("Casting: " + WoWSpell.FromId(Spell).Name + " on " + unitSelection(ret).SafeName); if (!gcdCast) return RunStatus.Success; } return RunStatus.Failure; })); }
public static Composite dropCast(this int Spell, unitSelectionDelegate unitSelection, Selection<bool> reqs = null) { return dropMethod(Spell, unitSelection, reqs); }