예제 #1
0
        public Design DesignUpgrade(Design oldDesign, StaticsDB statics, StatesDB states)
        {
            var techLevels = states.DevelopmentAdvances.Of[Player].ToDictionary(x => x.Topic.IdCode, x => (double)x.Level);

            var hull     = statics.Hulls[oldDesign.Hull.TypeInfo.IdCode].MakeHull(techLevels);
            var specials = oldDesign.SpecialEquipment.Select(
                x => statics.SpecialEquipment[x.TypeInfo.IdCode].MakeBest(techLevels, x.Quantity)
                ).ToList();

            var armor   = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor = ReactorType.MakeBest(techLevels, hull, specials, statics);
            var isDrive = oldDesign.IsDrive != null?IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null;

            var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield    = oldDesign.Shield != null ? statics.Shields[oldDesign.Shield.TypeInfo.IdCode].MakeBest(techLevels) : null;
            var equipment = oldDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.TypeInfo.IdCode].MakeBest(techLevels, x.Quantity)
                ).ToList();

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                states.MakeDesignId(), Player, false, oldDesign.IsVirtual, oldDesign.Name, oldDesign.ImageIndex,
                armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                );

            design.CalcHash(statics);

            return(design);
        }
예제 #2
0
        private Design makeDesign(StaticsDB statics, StatesDB states, PredefinedDesign predefDesign, Dictionary <string, double> techLevels, bool isVirtual)
        {
            var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
            var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var armor     = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor   = ReactorType.MakeBest(techLevels, hull, specials, statics);
            var isDrive   = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null;
            var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield    = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;
            var equipment = predefDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                states.MakeDesignId(), Player, false, isVirtual, predefDesign.Name, predefDesign.HullImageIndex,
                armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                );

            design.CalcHash(statics);

            if (!states.Designs.Contains(design))
            {
                states.Designs.Add(design);
                this.Analyze(design, statics);
                return(design);
            }

            return(states.Designs.First(x => x == design));
        }
예제 #3
0
        private void makeDesign(StaticsDB statics, StatesDB states, DesignTemplate predefDesign, Dictionary <string, double> techLevels)
        {
            var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
            var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();
            var equipment = predefDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var armor   = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor = ReactorType.MakeBest(techLevels, hull, specials, equipment, statics);
            var isDrive = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, equipment, statics) : null;
            var sensor  = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield  = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                this.Player, predefDesign.Name, predefDesign.HullImageIndex, true,
                armor, hull, isDrive, reactor, sensor, thruster, shield, equipment, specials
                );

            if (!states.Designs.Contains(design))
            {
                states.Designs.Add(design);
                this.Analyze(design, statics);
            }
        }
예제 #4
0
        private ThrusterInfo bestThruster()
        {
            var thruster = AComponentType.MakeBest(
                game.Statics.Thrusters.Values,
                playersTechLevels
                );

            return(thruster != null ? new ThrusterInfo(thruster.TypeInfo, thruster.Level) : null);
        }
예제 #5
0
        private SensorInfo bestSensor()
        {
            var sensor = AComponentType.MakeBest(
                game.Statics.Sensors.Values,
                playersTechLevels
                );

            return(sensor != null ? new SensorInfo(sensor.TypeInfo, sensor.Level) : null);
        }
예제 #6
0
        private ArmorInfo bestArmor()
        {
            var armor = AComponentType.MakeBest(
                game.Statics.Armors.Values,
                playersTechLevels
                );

            return(armor != null ? new ArmorInfo(armor.TypeInfo, armor.Level) : null);
        }
예제 #7
0
        public static AbilityStats Create(AAbilityType type, AComponentType provider, int level, int quantity, StaticsDB statics)
        {
            var factory = new AbilityStatsFactory(level, statics);

            type.Accept(factory);

            return(new AbilityStats(type, provider, level, quantity, factory.range, factory.isInstantDamage, factory.isProjectile,
                                    factory.targetColony, factory.targetShips, factory.targetStar,
                                    factory.firePower, factory.accuracy, factory.energyCost, factory.ammo,
                                    factory.accuracyRangePenalty, factory.armorEfficiency, factory.shieldEfficiency, factory.planetEfficiency,
                                    factory.appliesTrait, factory.projectileImage, factory.speed, factory.splashMaxTargets,
                                    factory.splashFirePower, factory.splashShieldEfficiency, factory.splashArmorEfficiency));
        }
예제 #8
0
        public AbilityStats(AAbilityType type, AComponentType provider, int level, int quantity,
                            int range, bool isInstantDamage, bool isProjectile,
                            bool targetColony, bool targetShips, bool targetStar,
                            double firePower, double accuracy, double energyCost, double ammo,
                            double accuracyRangePenalty, double armorEfficiency, double shieldEfficiency, double planetEfficiency,
                            StarTraitType appliesTrait, string projectileImage, double speed, double splashMaxTargets,
                            double splashFirePower, double splashShieldEfficiency, double splashArmorEfficiency)
        {
            this.Type     = type;
            this.Provider = provider;
            this.Level    = level;
            this.Quantity = quantity;

            this.Range           = range;
            this.IsInstantDamage = isInstantDamage;
            this.IsProjectile    = isProjectile;
            this.TargetColony    = targetColony;
            this.TargetShips     = targetShips;
            this.TargetStar      = targetStar;

            this.FirePower            = firePower;
            this.Accuracy             = accuracy;
            this.EnergyCost           = energyCost;
            this.AccuracyRangePenalty = accuracyRangePenalty;
            this.Ammo             = ammo;
            this.ArmorEfficiency  = armorEfficiency;
            this.ShieldEfficiency = shieldEfficiency;
            this.PlanetEfficiency = planetEfficiency;

            this.AppliesTrait = appliesTrait;

            this.ProjectileImage        = projectileImage;
            this.Speed                  = speed;
            this.SplashMaxTargets       = splashMaxTargets;
            this.SplashFirePower        = splashFirePower;
            this.SplashShieldEfficiency = splashShieldEfficiency;
            this.SplashArmorEfficiency  = splashArmorEfficiency;
        }
예제 #9
0
        private void makeDesign(StaticsDB statics, StatesDB states, string id, PredefinedDesign predefDesign, PlayerProcessor playerProc)
        {
            var design = states.Designs.FirstOrDefault(x => x.IdCode == id);

            if (design == null)
            {
                var techLevels = new Var().
                                 Init(statics.DevelopmentTopics.Select(x => x.IdCode), false).
                                 Init(statics.ResearchTopics.Select(x => x.IdCode), false).Get;

                var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
                var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                    x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                    ).ToList();

                var armor     = AComponentType.MakeBest(statics.Armors.Values, techLevels);                                          //TODO(0.5) get id from template
                var reactor   = ReactorType.MakeBest(techLevels, hull, specials, statics);                                           //TODO(0.5) get id from template
                var isDrive   = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null; //TODO(0.5) get id from template
                var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);                                         //TODO(0.5) get id from template
                var shield    = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;
                var equipment = predefDesign.MissionEquipment.Select(
                    x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                    ).ToList();

                var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);                 //TODO(0.5) get id from template

                design = new Design(
                    id, playerProc.Player, false, true, predefDesign.Name, predefDesign.HullImageIndex,
                    armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                    );

                design.CalcHash(statics);
                states.Designs.Add(design);
            }

            playerProc.Analyze(design, statics);
        }
예제 #10
0
 private Component <ThrusterType> bestThruster() => AComponentType.MakeBest(game.Statics.Thrusters.Values, playersTechLevels);
예제 #11
0
 private Component <SensorType> bestSensor() => AComponentType.MakeBest(game.Statics.Sensors.Values, playersTechLevels);
예제 #12
0
 internal ShipComponentGeneralInfo(AComponentType data, string langContext, string imagePath)
 {
     this.Data        = data;
     this.langContext = langContext;
     this.imagePath   = imagePath;
 }