internal override float GetTacticWeight()
        {
            float  num1 = this.team.QuerySystem.PowerRatioIncludingCasualties / this.team.QuerySystem.OverallPowerRatio;
            double num2 = (double)MBMath.LinearExtrapolation(0.0f, Math.Max(this.team.QuerySystem.InfantryRatio, Math.Max(this.team.QuerySystem.RangedRatio, this.team.QuerySystem.CavalryRatio)), MBMath.ClampFloat(num1, 0.0f, 2.66f) / 2f);
            float  num3 = this.team.QuerySystem.EnemyTeams.Average <TeamQuerySystem>((Func <TeamQuerySystem, float>)(et => et.CavalryRatio)) + this.team.QuerySystem.EnemyTeams.Average <TeamQuerySystem>((Func <TeamQuerySystem, float>)(et => et.RangedCavalryRatio));
            double num4 = (double)num3 != 0.0 ? (double)MBMath.Lerp(0.8f, 1.2f, MBMath.ClampFloat((this.team.QuerySystem.CavalryRatio + this.team.QuerySystem.RangedCavalryRatio) / num3, 0.0f, 2f) / 2f) : 1.20000004768372;

            return((float)(num2 * num4) * (float)Math.Min(1.0, Math.Sqrt((double)this.team.QuerySystem.OverallPowerRatio)));
        }
Exemplo n.º 2
0
        internal override float GetTacticWeight()
        {
            float           num1            = this.team.QuerySystem.OverallPowerRatio / this.team.QuerySystem.PowerRatioIncludingCasualties;
            float           num2            = Math.Max(this.team.QuerySystem.InfantryRatio, Math.Max(this.team.QuerySystem.RangedRatio, this.team.QuerySystem.CavalryRatio)) + (this.team.Side == BattleSideEnum.Defender ? 0.33f : 0.0f);
            float           num3            = this.team.Side == BattleSideEnum.Defender ? 0.33f : 0.5f;
            double          num4            = (double)this.team.Formations.Sum <Formation>((Func <Formation, float>)(f => f.QuerySystem.FormationPower)) + (double)this.team.QuerySystem.EnemyTeams.SelectMany <TeamQuerySystem, Formation>((Func <TeamQuerySystem, IEnumerable <Formation> >)(t => t.Team.Formations)).Sum <Formation>((Func <Formation, float>)(f => f.QuerySystem.FormationPower));
            CasualtyHandler casualtyHandler = Mission.Current.GetMissionBehaviour <CasualtyHandler>();
            float           num5            = (float)num4 / ((float)num4 + (this.team.Formations.Sum <Formation>((Func <Formation, float>)(f => casualtyHandler.GetCasualtyPowerLossOfFormation(f))) + this.team.QuerySystem.EnemyTeams.SelectMany <TeamQuerySystem, Formation>((Func <TeamQuerySystem, IEnumerable <Formation> >)(t => t.Team.Formations)).Sum <Formation>((Func <Formation, float>)(f => casualtyHandler.GetCasualtyPowerLossOfFormation(f)))));

            return(Math.Max(this.team.Side != BattleSideEnum.Attacker || (double)num1 >= 0.5 ? MBMath.LinearExtrapolation(0.0f, 1.6f * num2, (float)((1.0 - (double)num5) / (1.0 - (double)num3))) : 0.0f, MBMath.LinearExtrapolation(0.0f, 1.6f * num2, (float)((double)this.team.QuerySystem.OverallPowerRatio * (double)num3 * 0.5))));
        }