コード例 #1
0
        public virtual Var LocalEffects(StaticsDB statics)
        {
            var vars = new Var();

            foreach (var building in statics.Buildings)
            {
                if (Site.Buildings.ContainsKey(building.Key))
                {
                    vars.And(building.Key.ToLower() + BuidingCountPrefix, Site.Buildings[building.Key]);
                }
                else
                {
                    vars.And(building.Key.ToLower() + BuidingCountPrefix, 0);
                }
            }

            return(vars);
        }
コード例 #2
0
        public static Var DesignBaseVars(Component <HullType> hull, IEnumerable <Component <SpecialEquipmentType> > specialEquipment, StaticsDB statics)
        {
            var hullVars = new Var(AComponentType.LevelKey, hull.Level).Get;

            var shipVars = new Var("hullHp", hull.TypeInfo.ArmorBase.Evaluate(hullVars)).
                           And("hullSensor", hull.TypeInfo.SensorsBase.Evaluate(hullVars)).
                           And("hullCloak", hull.TypeInfo.CloakingBase.Evaluate(hullVars)).
                           And("hullJamming", hull.TypeInfo.JammingBase.Evaluate(hullVars)).
                           And("hullInertia", hull.TypeInfo.InertiaBase.Evaluate(hullVars)).
                           And("hullReactor", hull.TypeInfo.SizeReactor.Evaluate(hullVars)).
                           And("hullShield", hull.TypeInfo.SizeShield.Evaluate(hullVars)).
                           And(HullType.IsDriveSizeKey, hull.TypeInfo.SizeIS.Evaluate(hullVars)).
                           And(HullType.ReactorSizeKey, hull.TypeInfo.SizeReactor.Evaluate(hullVars)).
                           Init(statics.SpecialEquipment.Keys, 0).
                           Init(statics.SpecialEquipment.Keys.Select(x => x + AComponentType.LevelSuffix), 0).
                           UnionWith(specialEquipment, x => x.TypeInfo.IdCode, x => x.Quantity).
                           UnionWith(specialEquipment, x => x.TypeInfo.IdCode + AComponentType.LevelSuffix, x => x.Level);

            shipVars.And("reactorSize", statics.ShipFormulas.ReactorSize.Evaluate(shipVars.Get));
            shipVars.And("shieldSize", statics.ShipFormulas.ShieldSize.Evaluate(shipVars.Get));

            return(shipVars);
        }
コード例 #3
0
        public static double DesirabilityOf(Planet planet, StaticsDB statics)
        {
            var formulas = statics.ColonyFormulas;
            var vars     = new Var(PopulationKey, 0).
                           And(PlanetSizeKey, planet.Size).
                           Init(statics.Buildings.Keys.Select(x => x.ToLower() + BuidingCountPrefix), 0).
                           Init(statics.DevelopmentTopics.Select(x => x.IdCode + PlayerProcessor.LevelSufix), 0).
                           Init(statics.DevelopmentTopics.Select(x => x.IdCode + PlayerProcessor.UpgradeSufix), DevelopmentProgress.NotStarted).
                           Init(statics.PlanetTraits.Keys, false).
                           UnionWith(planet.Traits.Select(x => x.IdCode)).
                           UnionWith(statics.PlanetForumlas[planet.Type].ImplicitTraits);

            vars.And(MaxPopulationKey, formulas.MaxPopulation.Evaluate(vars.Get));
            return(formulas.Desirability.Evaluate(vars.Get));
        }