using System.Linq; namespace Turbo.Plugins.LightningMod { public class MonkMysticAllyPlugin : AbstractSkillHandler, ISkillHandler { public MonkMysticAllyPlugin() : base(CastType.BuffSkill, CastPhase.AutoCast, CastPhase.Attack) { Enabled = false; } public override void Load(IController hud) { base.Load(hud); AssignedSnoPower = Hud.Sno.SnoPowers.Monk_MysticAlly; CreateCastRule() .IfCanCastSkill(150, 200, 500).ThenContinueElseNoCast() .IfInTown().ThenNoCastElseContinue() .IfCastingIdentify().ThenNoCastElseContinue() .IfCastingPortal().ThenNoCastElseContinue() .IfOnCooldown().ThenNoCastElseContinue() .IfTrue(ctx => ctx.Skill.Rune == 3 && ctx.Skill.Player.Stats.ResourcePctSpirit < 50).ThenCastElseContinue()//风相幻身3 .IfTrue(ctx => ctx.Skill.Rune == 4 && ctx.Skill.Player.Defense.HealthPct < 30).ThenCastElseContinue()//坚毅幻身4 .IfTrue(ctx => {//水相幻身1 return ctx.Skill.Rune == 1 && ctx.Skill.Player.Density.GetDensity(20) > 5; }).ThenCastElseContinue() ; CreateCastRule() .IfCanCastSkill(100, 200, 500).ThenContinueElseNoCast() .IfInTown().ThenNoCastElseContinue() .IfCastingIdentify().ThenNoCastElseContinue() .IfCastingPortal().ThenNoCastElseContinue() .IfRunning().ThenNoCastElseContinue() .IfIdle().ThenNoCastElseContinue() .IfTrue(ctx => {//火相幻身0 bool isCOE = ctx.Hud.Game.Me.Powers.BuffIsActive(ctx.Hud.Sno.SnoPowers.ConventionOfElements.Sno); bool isLesserGods = ctx.Hud.Game.Me.Powers.BuffIsActive(485725); //蒙尘者绑腕 bool isBossOrEliteNearby = ctx.Hud.Game.ActorQuery.IsEliteOrBossCloserThan(20, false) || ctx.Hud.Game.ActorQuery.NearestGoblin?.NormalizedXyDistanceToMe < 20 || ctx.Hud.Game.ActorQuery.NearestKeywarden?.NormalizedXyDistanceToMe < 20; bool isLesserGodsDebuff = ctx.Hud.Game.AliveMonsters.Any(x => (isBossOrEliteNearby ? (x.Rarity == ActorRarity.Boss || x.Rarity == ActorRarity.Champion || x.Rarity == ActorRarity.Rare || x.Rarity == ActorRarity.Unique) : true) && x.NormalizedXyDistanceToMe < 20 && x.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, 485725) == 1); return isLesserGods && isLesserGodsDebuff && (isCOE ? ctx.Skill.Player.Powers.BuffIsActive(ctx.Hud.Sno.SnoPowers.ConventionOfElements.Sno, 3) : true); }).ThenCastElseContinue() ; } } }