private static Composite PetBuffUnit(string name, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, params string[] myMutexBuffs) { return (new Decorator( ret => onUnit(ret) != null && (PartyBuffType.None != (onUnit(ret).GetMissingPartyBuffs() & GetPartyBuffForSpell(name))) && (myMutexBuffs == null || myMutexBuffs.Count() == 0 || !onUnit(ret).GetAllAuras().Any(a => a.CreatorGuid == StyxWoW.Me.Guid && myMutexBuffs.Contains(a.Name))), new Sequence( PetManager.Buff(name, onUnit, requirements, myMutexBuffs), new Wait(1, until => StyxWoW.Me.HasPartyBuff(name), new ActionAlwaysSucceed()), new Action(ret => { System.Diagnostics.Debug.Assert(PartyBuffType.None != GetPartyBuffForSpell(name)); if (PartyBuffType.None != GetPartyBuffForSpell(name)) { ResetReadyToPartyBuffTimer(); } else { Logger.WriteDebug("Programmer Error: should use Spell.Buff(\"{0}\") instead", name); } }) ) )); }
public static Composite PetBuffGroup(string name, SimpleBooleanDelegate requirements, params string[] myMutexBuffs) { return(new Decorator( ret => IsItTimeToBuff() && PetManager.CanCastPetAction("Qiraji Fortitude") && (!StyxWoW.Me.Mounted || !PVP.IsPrepPhase), new PrioritySelector( ctx => Unit.GroupMembers.FirstOrDefault(m => m.IsAlive && m.DistanceSqr < 30 * 30 && (PartyBuffType.None != (m.GetMissingPartyBuffs() & GetPartyBuffForSpell(name)))), PetManager.Buff(name, on => (WoWUnit)on, requirements, myMutexBuffs) ) )); }