namespace Turbo.Plugins.LightningMod { using System.Linq; public class BarbarianThreateningShoutPlugin : AbstractSkillHandler, ISkillHandler { public int ActivationRange { get; set; } public int DensityLimit { get; set; } public BarbarianThreateningShoutPlugin() : base(CastType.BuffSkill, CastPhase.AutoCast, CastPhase.Move, CastPhase.PreAttack) { Enabled = false; ActivationRange = 25; DensityLimit = 5; } public override void Load(IController hud) { base.Load(hud); AssignedSnoPower = Hud.Sno.SnoPowers.Barbarian_ThreateningShout; CreateCastRule() .IfTrue(ctx => ctx.Skill.Rune == 2 && ctx.Hud.Game.NumberOfPlayersInGame > 1).ThenNoCastElseContinue()//恐怖收割符文在组队时不使用此规则 .IfInTown().ThenNoCastElseContinue() .IfCastingIdentify().ThenNoCastElseContinue() .IfCastingPortal().ThenNoCastElseContinue() .IfOnCooldown().ThenNoCastElseContinue() .IfCanCastBuff().ThenContinueElseNoCast() .IfCanCastSimple().ThenContinueElseNoCast() .IfEliteOrBossIsNearby(ctx => ActivationRange).ThenCastElseContinue() .IfEnoughMonstersNearby(ctx => ActivationRange, ctx => DensityLimit).ThenCastElseContinue(); CreateCastRule() .IfTrue(ctx => ctx.Skill.Rune == 2 && ctx.Hud.Game.NumberOfPlayersInGame > 1).ThenContinueElseNoCast()//恐怖收割符文在组队时使用此规则 .IfInTown().ThenNoCastElseContinue() .IfCastingIdentify().ThenNoCastElseContinue() .IfCastingPortal().ThenNoCastElseContinue() .IfOnCooldown().ThenNoCastElseContinue() .IfCanCastBuff().ThenContinueElseNoCast() .IfCanCastSimple().ThenContinueElseNoCast() .IfBossIsNearby(ctx => ActivationRange).ThenCastElseContinue() .IfTrue(ctx => { bool playIsNearby = hud.Game.Players.Any(p => p.CentralXyDistanceToMe < ActivationRange);//靠近任意玩家25码 var monsterWithHighestMonsterDensity = Hud.Game.AliveMonsters.Where(x => x.IsOnScreen).OrderByDescending(x => x.GetMonsterDensity(ActivationRange)).FirstOrDefault(); return (playIsNearby && monsterWithHighestMonsterDensity!=null && monsterWithHighestMonsterDensity.CentralXyDistanceToMe <= ActivationRange);//靠近密度最高怪物25码 }).ThenCastElseContinue(); } } }