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 ; CreateCastRule() .IfCanCastSkill(100, 200, 500).ThenContinueElseNoCast() .IfInTown().ThenNoCastElseContinue() .IfCastingIdentify().ThenNoCastElseContinue() .IfCastingPortal().ThenNoCastElseContinue() .IfOnCooldown().ThenNoCastElseContinue() .IfRunning().ThenNoCastElseContinue() .IfIdle().ThenNoCastElseContinue() .IfTrue(ctx => {//水相幻身1 return ctx.Skill.Rune == 1 && ctx.Skill.Player.GetSetItemCount(742942) >= 6 && ctx.Skill.Player.Density.GetDensity(20) > 5;//殷娜6件时施放 }).ThenCastElseContinue() .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) && getCurrentMysticAlly() >= getMaxMysticAlly(); }).ThenCastElseContinue() ; } private int getCurrentMysticAlly() { return Hud.Game.Actors.Where(x => x.SummonerAcdDynamicId == Hud.Game.Me.SummonerId && (x.SnoActor.Sno == ActorSnoEnum._monk_female_mystically_crimson || x.SnoActor.Sno == ActorSnoEnum._monk_male_mystically_crimson)).Count(); } private int getMaxMysticAlly() { if (Hud.Game.Me.GetSetItemCount(1) >= 6) return 10; if (Hud.Game.Me.Powers.BuffIsActive(409811)) return 2; return 1; } } }