public StrategyEval EvaluateApplicability() { var enemies = SpaceTime.CurrentSpaceTime.Elements.WhereAs <Enemy>().OrderBy(e => e.CalculateDistanceTo(Me)).ToList(); if (enemies.Count == 0) { return(new StrategyEval() { Applicability = 0, Strategy = this }); } else { var closestDistance = Me.CalculateDistanceTo(enemies.First()); Me.Target = enemies.First(); var minThreatDistance = 15; if (closestDistance > minThreatDistance) { return(new StrategyEval() { Applicability = 0, Strategy = this }); } else { var delta = 15f - closestDistance; var threat = delta / 15f; return(new StrategyEval() { Applicability = threat, Strategy = this }); } } }
public StrategyEval EvaluateApplicability() { var ret = new StrategyEval() { Applicability = Me.Target != null && Me.CalculateDistanceTo(Me.Target) > 4 ? 1 : .25f, Strategy = this }; return(ret); }
public StrategyEval EvaluateApplicability() { var canFire = Me.Target != null && (Me.Inventory).PrimaryWeapon != null && (Me.Inventory).PrimaryWeapon.AmmoAmount > 0; if (canFire == false) return new StrategyEval() { Applicability = 0, Strategy = this }; var hasLineOfSight = Me.CalculateLineOfSight(Me.Target, 1).Obstacles.Where(o => (o as SpacialElement).HasSimpleTag("passthru") == false).Count() == 0; if(hasLineOfSight == false) { return new StrategyEval() { Applicability = 0, Strategy = this }; } var d = Me.CalculateDistanceTo(Me.Target); if (d > 20) return new StrategyEval() { Applicability = 0, Strategy = this }; else if(d > 15) return new StrategyEval() { Applicability = .2f, Strategy = this }; else if (d > 10) return new StrategyEval() { Applicability = .5f, Strategy = this }; else return new StrategyEval() { Applicability = 1f, Strategy = this }; }