internal override float GetTacticWeight() { if (!this.team.TeamAI.IsDefenseApplicable || this.Formations.All <Formation>((Func <Formation, bool>)(f => !f.QuerySystem.IsInfantryFormation))) { return(0.0f); } Formation formation = this._mainInfantry ?? this.Formations.Where <Formation>((Func <Formation, bool>)(f => f.QuerySystem.IsInfantryFormation)).MaxBy <Formation, int>((Func <Formation, int>)(f => f.CountOfUnits)); if (formation == null) { return(0.0f); } if (this._mainInfantry == null) { this._mainInfantry = formation; } double num1 = (double)this.team.QuerySystem.InfantryRatio + (double)this.team.QuerySystem.RangedRatio; float num2 = MBMath.Lerp(0.7f, 1f, (float)((150.0 - (double)MBMath.ClampFloat(this._mainInfantry.QuerySystem.AveragePosition.Distance(this._mainInfantry.QuerySystem.HighGroundCloseToForeseenBattleGround), 50f, 150f)) / 100.0)); return((float)(num1 * 1.10000002384186) * TacticComponent.CalculateNotEngagingTacticalAdvantage(this.team.QuerySystem) * num2 / (float)Math.Sqrt((double)this.team.QuerySystem.OverallPowerRatio)); }
internal override float GetTacticWeight() { if (!this.team.TeamAI.IsDefenseApplicable || !this.CheckAndDetermineFormation(ref this._mainInfantry, (Func <Formation, bool>)(f => f.QuerySystem.IsInfantryFormation))) { return(0.0f); } if (!this.team.TeamAI.IsCurrentTactic((TacticComponent)this) || this._chokePointTacticalPosition == null || !this.IsTacticalPositionEligible(this._chokePointTacticalPosition)) { this.DetermineChokePoints(); } if (this._chokePointTacticalPosition == null) { return(0.0f); } double infantryRatio = (double)this.team.QuerySystem.InfantryRatio; return((float)((infantryRatio + (double)Math.Min((float)infantryRatio, this.team.QuerySystem.RangedRatio)) * (double)MBMath.ClampFloat((float)this.team.QuerySystem.EnemyUnitCount / (float)this.team.QuerySystem.MemberCount, 0.33f, 3f) * (double)this.GetTacticalPositionScore(this._chokePointTacticalPosition) * (double)TacticComponent.CalculateNotEngagingTacticalAdvantage(this.team.QuerySystem) * 1.29999995231628) / (float)Math.Sqrt((double)this.team.QuerySystem.OverallPowerRatio)); }
internal override float GetTacticWeight() { if (!this.team.TeamAI.IsDefenseApplicable || !this.CheckAndDetermineFormation(ref this._mainInfantry, (Func <Formation, bool>)(f => f.QuerySystem.IsInfantryFormation))) { return(0.0f); } if (!this.team.TeamAI.IsCurrentTactic((TacticComponent)this) || this._mainDefensiveLineObject == null || !this.IsTacticalPositionEligible(this._mainDefensiveLineObject)) { this.DetermineMainDefensiveLine(); } return(this._mainDefensiveLineObject == null ? 0.0f : (float)(((double)this.team.QuerySystem.InfantryRatio + (double)this.team.QuerySystem.RangedRatio) * 1.20000004768372) * this.GetTacticalPositionScore(this._mainDefensiveLineObject) * TacticComponent.CalculateNotEngagingTacticalAdvantage(this.team.QuerySystem) / (float)Math.Sqrt((double)this.team.QuerySystem.OverallPowerRatio)); }
internal override float GetTacticWeight() { if (!this.team.TeamAI.IsDefenseApplicable || !this.CheckAndDetermineFormation(ref this._mainInfantry, (Func <Formation, bool>)(f => f.QuerySystem.IsInfantryFormation)) || !this.CheckAndDetermineFormation(ref this._archers, (Func <Formation, bool>)(f => f.QuerySystem.IsRangedFormation))) { return(0.0f); } double num1 = (double)Math.Max(0, this._mainInfantry.CountOfUnits - 1) * ((double)this._mainInfantry.MaximumInterval + (double)this._mainInfantry.UnitDiameter) * 0.5 / Math.PI; double num2 = Math.Sqrt((double)this._archers.CountOfUnits); double num3 = (double)this._archers.UnitDiameter * num2 + (double)this._archers.Interval * (num2 - 1.0); if (num1 < num3) { return(0.0f); } if (!this.team.TeamAI.IsCurrentTactic((TacticComponent)this) || this._mainRingPosition == null || !this.IsTacticalPositionEligible(this._mainRingPosition)) { this.DetermineRingPosition(); } return(this._mainRingPosition == null ? 0.0f : (float)((double)Math.Min(this.team.QuerySystem.InfantryRatio, this.team.QuerySystem.RangedRatio) * 2.0 * 1.5) * this.GetTacticalPositionScore(this._mainRingPosition) * TacticComponent.CalculateNotEngagingTacticalAdvantage(this.team.QuerySystem) / (float)Math.Sqrt((double)this.team.QuerySystem.OverallPowerRatio)); }