private Composite CreateHealBehavior() { return(new PrioritySelector( // Choose best target ctx => ChooseBestHealTarget(HealerManager.Instance.FirstUnit), // Are we casting soothing mist on the wrong target? new Decorator(ret => ret != null && StyxWoW.Me.ChanneledCastingSpellId == SOOTHING_MIST && StyxWoW.Me.ChannelObject != null && StyxWoW.Me.ChannelObject.Guid != ((WoWObject)ret).Guid, new Sequence( new Styx.TreeSharp.Action(ret => SpellManager.StopCasting()), new WaitContinue(TimeSpan.FromMilliseconds(250), ret => StyxWoW.Me.ChanneledCastingSpellId != SOOTHING_MIST, new ActionAlwaysSucceed()) ) ), // Are we casting something other than soothing mist? new Decorator(ret => StyxWoW.Me.IsCasting && (StyxWoW.Me.ChanneledSpell == null || StyxWoW.Me.ChanneledSpell.Id != SOOTHING_MIST), new ActionAlwaysSucceed()), // Are we casting soothing mist but target is full health? new Decorator(ret => StyxWoW.Me.ChanneledCastingSpellId == SOOTHING_MIST && StyxWoW.Me.ChannelObject != null && StyxWoW.Me.ChannelObject.ToUnit().HealthPercent > MistweaverSettings.Instance.IgnorePercent, new Sequence( new Styx.TreeSharp.Action(ret => SpellManager.StopCasting()), new WaitContinue(TimeSpan.FromMilliseconds(250), ret => StyxWoW.Me.ChanneledCastingSpellId != SOOTHING_MIST, new ActionAlwaysSucceed()) ) ), // Don't lose mana SelfCast("Mana Tea", ret => StyxWoW.Me.ManaPercent < 85 && StyxWoW.Me.HasAura("Mana Tea", 2)), // Cast Renewing Mist, keep up the buff RenewingMist(), // Self Cast Expel Harm SelfCast("Expel Harm", ret => ((ret != null && ((WoWUnit)ret).Guid != StyxWoW.Me.Guid && ((WoWUnit)ret).HealthPercent > 50) || StyxWoW.Me.HealthPercent < 100) && StyxWoW.Me.CurrentChi < 4), // For Spinning Crane Kick Cast("Rushing Jade Wind", ret => MistweaverSettings.Instance.RushingJadeWind && !StyxWoW.Me.ActiveAuras.ContainsKey("Rushing Jade Wind") && MistweaverSettings.Instance.SpinningCraneKick && Unit.NearbyGroupMembersDistance(8f).Count(u => u.HealthPercent < MistweaverSettings.Instance.SpinningCraneKickPercent) >= MistweaverSettings.Instance.SpinningCraneKickCount && StyxWoW.Me.CurrentChi >= 2), // AoE, Monk's shouldn't be single target priority CastLikeMonk("Uplift", ret => StyxWoW.Me, ret => MistweaverSettings.Instance.Uplift && FetchRenewingMistTargets().Count(u => u.HealthPercent < MistweaverSettings.Instance.UpliftPercent) >= MistweaverSettings.Instance.UpliftCount && StyxWoW.Me.CurrentChi >= 2), // Chi Burst new PrioritySelector(ret => Clusters.GetBestUnitForCluster(GetChiBurstUnits(), ClusterType.Path, 10f), new Decorator(ctx => MistweaverSettings.Instance.ChiBurst && Clusters.GetClusterCount((WoWUnit)ctx, GetChiBurstUnits(), ClusterType.Path, 10f) >= MistweaverSettings.Instance.ChiBurstCount && StyxWoW.Me.CurrentChi >= 2, CastLikeMonk("Chi Burst", ret => (WoWUnit)ret, ret => true) ) ), CastLikeMonk("Spinning Crane Kick", ret => StyxWoW.Me, ret => MistweaverSettings.Instance.SpinningCraneKick && Unit.NearbyGroupMembersDistance(8f).Count(u => u.HealthPercent < MistweaverSettings.Instance.SpinningCraneKickPercent) >= MistweaverSettings.Instance.SpinningCraneKickCount), // Single Target - only if heal list = 1 or cannot jab new Decorator(ret => !MistweaverSettings.Instance.Jab || HealerManager.Instance.HealList.Count(u => u.HealthPercent < MistweaverSettings.Instance.SoothingMistPercent) <= 1, new PrioritySelector( CastLikeMonk("Soothing Mist", ret => (WoWUnit)ret, ret => ret != null && MistweaverSettings.Instance.SoothingMist && ((WoWUnit)ret).HealthPercent < MistweaverSettings.Instance.SoothingMistPercent && StyxWoW.Me.ChanneledSpell == null), CastLikeMonk("Enveloping Mist", ret => (WoWUnit)ret, ret => ret != null && MistweaverSettings.Instance.EnvelopingMist && ((WoWUnit)ret).HealthPercent < MistweaverSettings.Instance.EnvelopingMistPercent && StyxWoW.Me.CurrentChi >= 3 && !((WoWUnit)ret).HasMyAura("Enveloping Mist")), CastLikeMonk("Surging Mist", ret => (WoWUnit)ret, ret => ret != null && MistweaverSettings.Instance.SurgingMist && ((WoWUnit)ret).HealthPercent < MistweaverSettings.Instance.SurgingMistPercent) ) ), // Melee Cast("Jab", ret => MistweaverSettings.Instance.Jab && StyxWoW.Me.CurrentChi < MistweaverSettings.Instance.JabCount && StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.Attackable), Cast("Blackout Kick", ret => MistweaverSettings.Instance.BlackoutKick && StyxWoW.Me.CurrentChi >= 2 && (BuffTimeRemaining("Serpent's Zeal").TotalSeconds <= 5 || !HasBuffStacks("Serpent's Zeal", 2)) && StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.Attackable), Cast("Tiger Palm", ret => MistweaverSettings.Instance.TigerPalm && StyxWoW.Me.CurrentChi >= 1 && StyxWoW.Me.CurrentTarget != null && StyxWoW.Me.CurrentTarget.Attackable && (BuffTimeRemaining("Tiger Power").TotalSeconds <= 5 || !HasBuffStacks("Tiger Power", MistweaverSettings.Instance.TigerPalmCount))) )); }