private void ApplyEconomicGrowth(DeltaMetadata deltaMetadata, EmpireSystemsView empire)
        {
            var growthValues = empire.StarSystems
                               .SelectMany(x => _developmentCalculator.GrowthFromSystem(x, empire))
                               .ToArray();
            var deltas = GetDeltasFromGrowthValues(growthValues, deltaMetadata);

            _starSystemRepository.ApplyDevelopment(deltas);
            ApplyDeltas(empire.StarSystems, deltas);
        }
Exemple #2
0
        private double ProductionForEmpireCapped(EmpireSystemsView empire)
        {
            var totalDevelopment  = empire.StarSystems.Sum(x => x.Development);
            var expansionCapacity = (totalDevelopment * Parameters.MilitaryCapDevelopmentProportion) - empire.Empire.Military;
            var expansion         = totalDevelopment * empire.Empire.Alignment.Power;

            if (expansion > expansionCapacity)
            {
                return(expansionCapacity);
            }
            else
            {
                return(expansion);
            }
        }
        private void ApplyMilitaryProduction(DeltaMetadata deltaMetadata, EmpireSystemsView empire)
        {
            var production = _militaryCalculator.ProductionForEmpire(empire);

            _empireRepository.ApplyMilitaryProduction(deltaMetadata, empire.Empire.Id, production);
        }
        public IEnumerable <GrowthFromSystemResult> GrowthFromSystem(StarSystem starSystem, EmpireSystemsView empireView)
        {
            var connectedSystems = empireView.StarSystems.Where(x => starSystem.ConnectedSystemIds.Contains(x.Id));
            var income           = starSystem.Development * Parameters.IncomeRate * empireView.Empire.Alignment.Prosperity;

            if (income == 0)
            {
                return(new GrowthFromSystemResult[0]);
            }

            return(_connectedSystemsOnlyDelegate(starSystem, connectedSystems, income));
        }
Exemple #5
0
        private double ProductionForEmpireUncapped(EmpireSystemsView empire)
        {
            var totalDevelopment = empire.StarSystems.Sum(x => x.Development);

            return(totalDevelopment * empire.Empire.Alignment.Power);
        }
Exemple #6
0
 public double ProductionForEmpire(EmpireSystemsView empire) => _productionForEmpire(empire);