Esempio n. 1
0
 private Var shipPoweredVars()
 {
     return(PlayerProcessor.DesignPoweredVars(
                new Component <HullType>(this.selectedHull.Type, this.selectedHull.Level),
                new Component <ReactorType>(this.reactorInfo.Type, this.reactorInfo.Level),
                this.selectedSpecialEquipment,
                this.game.Statics));
 }
Esempio n. 2
0
        private IsDriveInfo bestIsDrive()
        {
            var hull    = new Component <HullType>(this.selectedHull.Type, this.selectedHull.Level);
            var reactor = new Component <ReactorType>(this.reactorInfo.Type, this.reactorInfo.Level);

            var drive = IsDriveType.MakeBest(
                playersTechLevels,
                hull,
                reactor,
                this.selectedSpecialEquipment,
                game.Statics
                );

            return(drive != null ?
                   new IsDriveInfo(drive.TypeInfo, drive.Level, PlayerProcessor.DesignPoweredVars(hull, reactor, this.selectedSpecialEquipment, game.Statics).Get) :
                   null);
        }
Esempio n. 3
0
        public static Component <IsDriveType> MakeBest(IDictionary <string, double> playersTechLevels, Component <HullType> hull, Component <ReactorType> reactor, IEnumerable <Component <SpecialEquipmentType> > specialEquipment, StaticsDB statics)
        {
            var shipVars = PlayerProcessor.DesignPoweredVars(hull, reactor, specialEquipment, statics).Get;

            return(Methods.FindBestOrDefault(
                       statics.IsDrives.Values.Where(x => x.IsAvailable(playersTechLevels)).
                       Select(x => new Component <IsDriveType>(x, x.HighestLevel(playersTechLevels))).
                       Where(x =>
            {
                shipVars[AComponentType.LevelKey] = x.Level;
                return x.TypeInfo.MinSize.Evaluate(shipVars) <= shipVars[HullType.IsDriveSizeKey] && x.TypeInfo.CanPick;
            }),
                       x =>
            {
                shipVars[AComponentType.LevelKey] = x.Level;
                return x.TypeInfo.Speed.Evaluate(shipVars);
            }
                       ));
        }