feat(EconomyComparison) Added new WIP Feature
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Model.Economy;
|
||||
using Model.BuildOrders;
|
||||
using Model.Economy;
|
||||
using Model.Entity;
|
||||
using Model.Types;
|
||||
|
||||
@@ -6,12 +7,13 @@ namespace Services.Immortal;
|
||||
|
||||
public class EconomyService : IEconomyService
|
||||
{
|
||||
private List<EconomyModel> economyOverTime = null!;
|
||||
|
||||
private List<EconomyModel> buildEconomyOverTime = null!;
|
||||
|
||||
private Dictionary<string, List<EconomyModel>> specficEconomiesOverTime = null!;
|
||||
|
||||
public List<EconomyModel> GetOverTime()
|
||||
{
|
||||
return economyOverTime;
|
||||
return buildEconomyOverTime;
|
||||
}
|
||||
|
||||
public void Subscribe(Action action)
|
||||
@@ -27,33 +29,33 @@ public class EconomyService : IEconomyService
|
||||
public void Calculate(IBuildOrderService buildOrder, ITimingService timing, int fromInterval)
|
||||
{
|
||||
//TODO Break all this up
|
||||
if (economyOverTime == null)
|
||||
if (buildEconomyOverTime == null)
|
||||
{
|
||||
economyOverTime = new List<EconomyModel>();
|
||||
buildEconomyOverTime = new List<EconomyModel>();
|
||||
for (var interval = 0; interval < timing.GetAttackTime(); interval++)
|
||||
economyOverTime.Add(new EconomyModel { Interval = interval });
|
||||
buildEconomyOverTime.Add(new EconomyModel { Interval = interval });
|
||||
}
|
||||
|
||||
|
||||
if (economyOverTime.Count > timing.GetAttackTime())
|
||||
economyOverTime.RemoveRange(timing.GetAttackTime(), economyOverTime.Count - timing.GetAttackTime());
|
||||
if (buildEconomyOverTime.Count > timing.GetAttackTime())
|
||||
buildEconomyOverTime.RemoveRange(timing.GetAttackTime(), buildEconomyOverTime.Count - timing.GetAttackTime());
|
||||
|
||||
while (economyOverTime.Count < timing.GetAttackTime())
|
||||
economyOverTime.Add(new EconomyModel { Interval = economyOverTime.Count - 1 });
|
||||
while (buildEconomyOverTime.Count < timing.GetAttackTime())
|
||||
buildEconomyOverTime.Add(new EconomyModel { Interval = buildEconomyOverTime.Count - 1 });
|
||||
|
||||
for (var interval = fromInterval; interval < timing.GetAttackTime(); interval++)
|
||||
{
|
||||
var economyAtSecond = economyOverTime[interval];
|
||||
var economyAtSecond = buildEconomyOverTime[interval];
|
||||
if (interval > 0)
|
||||
{
|
||||
economyAtSecond.Alloy = economyOverTime[interval - 1].Alloy;
|
||||
economyAtSecond.Ether = economyOverTime[interval - 1].Ether;
|
||||
economyAtSecond.Pyre = economyOverTime[interval - 1].Pyre;
|
||||
economyAtSecond.WorkerCount = economyOverTime[interval - 1].WorkerCount;
|
||||
economyAtSecond.BusyWorkerCount = economyOverTime[interval - 1].BusyWorkerCount;
|
||||
economyAtSecond.CreatingWorkerCount = economyOverTime[interval - 1].CreatingWorkerCount;
|
||||
economyAtSecond.Harvesters = economyOverTime[interval - 1].Harvesters.ToList();
|
||||
economyAtSecond.CreatingWorkerDelays = economyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||
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.Harvesters = buildEconomyOverTime[interval - 1].Harvesters.ToList();
|
||||
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||
}
|
||||
|
||||
economyAtSecond.Interval = interval;
|
||||
@@ -155,11 +157,13 @@ public class EconomyService : IEconomyService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public EconomyModel GetEconomy(int atInterval)
|
||||
{
|
||||
if (atInterval >= economyOverTime.Count) return economyOverTime.Last();
|
||||
if (atInterval >= buildEconomyOverTime.Count) return buildEconomyOverTime.Last();
|
||||
|
||||
return economyOverTime[atInterval];
|
||||
return buildEconomyOverTime[atInterval];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user