|
|
|
|
@ -72,11 +72,15 @@ public class EconomyService : IEconomyService
|
|
|
|
|
: buildEconomyOverTime[atInterval]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void SetupCurrentInterval(IBuildOrderService buildOrder, EconomyModel economyAtSecond, int interval) |
|
|
|
|
private static void SetupCurrentInterval( |
|
|
|
|
IBuildOrderService buildOrder, |
|
|
|
|
EconomyModel economyAtSecond, |
|
|
|
|
int interval) |
|
|
|
|
{ |
|
|
|
|
economyAtSecond.Interval = interval; |
|
|
|
|
economyAtSecond.HarvestPoints = |
|
|
|
|
(from harvester in buildOrder.GetHarvestPointsCompletedBefore(interval) |
|
|
|
|
(from harvester |
|
|
|
|
in buildOrder.GetUndepletedHarvestPointsCompletedBefore(interval + 1) // One second into the future for completed harvest points |
|
|
|
|
select harvester).ToList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -88,7 +92,7 @@ public class EconomyService : IEconomyService
|
|
|
|
|
foreach (var newEntity in completedAtInterval) |
|
|
|
|
{ |
|
|
|
|
var entity = newEntity.Clone(); |
|
|
|
|
entity.Harvest().StartedAt = interval; |
|
|
|
|
//entity.Harvest().StartedAt = interval; |
|
|
|
|
economyAtSecond.HarvestPoints.Add(entity); |
|
|
|
|
|
|
|
|
|
var production = newEntity.Production(); |
|
|
|
|
@ -163,8 +167,8 @@ public class EconomyService : IEconomyService
|
|
|
|
|
foreach (var harvesterPoint in |
|
|
|
|
economyAtSecond.HarvestPoints.Select(entity => entity.Harvest())) |
|
|
|
|
{ |
|
|
|
|
if (harvesterPoint.IsDepleted(economyAtSecond.Interval)) |
|
|
|
|
continue; |
|
|
|
|
//if (harvesterPoint.IsDepleted(economyAtSecond.Interval)) |
|
|
|
|
// continue; |
|
|
|
|
|
|
|
|
|
switch (harvesterPoint.RequiresWorker) |
|
|
|
|
{ |
|
|
|
|
@ -215,17 +219,16 @@ public class EconomyService : IEconomyService
|
|
|
|
|
|
|
|
|
|
private void CarryOverEconomyFromPreviousInterval(int interval, EconomyModel economyAtSecond) |
|
|
|
|
{ |
|
|
|
|
if (interval > 0) |
|
|
|
|
{ |
|
|
|
|
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy; |
|
|
|
|
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether; |
|
|
|
|
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre; |
|
|
|
|
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount; |
|
|
|
|
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount; |
|
|
|
|
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount; |
|
|
|
|
economyAtSecond.HarvestPoints = buildEconomyOverTime[interval - 1].HarvestPoints.ToList(); |
|
|
|
|
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList(); |
|
|
|
|
} |
|
|
|
|
if (interval <= 0) return; |
|
|
|
|
|
|
|
|
|
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy; |
|
|
|
|
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether; |
|
|
|
|
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre; |
|
|
|
|
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount; |
|
|
|
|
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount; |
|
|
|
|
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount; |
|
|
|
|
economyAtSecond.HarvestPoints = buildEconomyOverTime[interval - 1].HarvestPoints.ToList(); |
|
|
|
|
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|