Fixed bugs
This commit is contained in:
@@ -224,21 +224,21 @@ else
|
|||||||
var economyAtSecond = economyOverTime[interval];
|
var economyAtSecond = economyOverTime[interval];
|
||||||
|
|
||||||
var alloyWorkerHarvesters = from harvester in economyAtSecond.HarvestPoints
|
var alloyWorkerHarvesters = from harvester in economyAtSecond.HarvestPoints
|
||||||
where harvester.Harvest() != null
|
where harvester.Harvester() != null
|
||||||
where harvester.Harvest().RequiresWorker
|
where harvester.Harvester().RequiresWorker
|
||||||
where harvester.Harvest().Resource == ResourceType.Alloy
|
where harvester.Harvester().Resource == ResourceType.Alloy
|
||||||
select harvester;
|
select harvester;
|
||||||
|
|
||||||
var alloyAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
var alloyAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
||||||
where harvester.Harvest() != null
|
where harvester.Harvester() != null
|
||||||
where harvester.Harvest().RequiresWorker == false
|
where harvester.Harvester().RequiresWorker == false
|
||||||
where harvester.Harvest().Resource == ResourceType.Alloy
|
where harvester.Harvester().Resource == ResourceType.Alloy
|
||||||
select harvester;
|
select harvester;
|
||||||
|
|
||||||
var etherAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
var etherAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
||||||
where harvester.Harvest() != null
|
where harvester.Harvester() != null
|
||||||
where harvester.Harvest().RequiresWorker == false
|
where harvester.Harvester().RequiresWorker == false
|
||||||
where harvester.Harvest().Resource == ResourceType.Ether
|
where harvester.Harvester().Resource == ResourceType.Ether
|
||||||
select harvester;
|
select harvester;
|
||||||
|
|
||||||
float autoAlloy = 0;
|
float autoAlloy = 0;
|
||||||
@@ -250,7 +250,7 @@ else
|
|||||||
|
|
||||||
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters)
|
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters)
|
||||||
{
|
{
|
||||||
autoAlloy += alloyAutoHarvester.Harvest().Slots * alloyAutoHarvester.Harvest().HarvestedPerInterval;
|
autoAlloy += alloyAutoHarvester.Harvester().Slots * alloyAutoHarvester.Harvester().HarvestedPerInterval;
|
||||||
var production = alloyAutoHarvester.Production();
|
var production = alloyAutoHarvester.Production();
|
||||||
if (production != null)
|
if (production != null)
|
||||||
{
|
{
|
||||||
@@ -260,7 +260,7 @@ else
|
|||||||
|
|
||||||
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters)
|
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters)
|
||||||
{
|
{
|
||||||
workerSlots += alloyWorkerHarvester.Harvest().Slots;
|
workerSlots += alloyWorkerHarvester.Harvester().Slots;
|
||||||
var production = alloyWorkerHarvester.Production();
|
var production = alloyWorkerHarvester.Production();
|
||||||
if (production != null)
|
if (production != null)
|
||||||
{
|
{
|
||||||
@@ -270,7 +270,7 @@ else
|
|||||||
|
|
||||||
foreach (var etherWorkerHarvester in etherAutomaticHarvesters)
|
foreach (var etherWorkerHarvester in etherAutomaticHarvesters)
|
||||||
{
|
{
|
||||||
autoEther += etherWorkerHarvester.Harvest().Slots * etherWorkerHarvester.Harvest().HarvestedPerInterval;
|
autoEther += etherWorkerHarvester.Harvester().Slots * etherWorkerHarvester.Harvester().HarvestedPerInterval;
|
||||||
var production = etherWorkerHarvester.Production();
|
var production = etherWorkerHarvester.Production();
|
||||||
if (production != null)
|
if (production != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,15 +132,15 @@
|
|||||||
var economyAtSecond = economyOverTime[interval];
|
var economyAtSecond = economyOverTime[interval];
|
||||||
|
|
||||||
var alloyWorkerHarvesters = from harvester in economyAtSecond.HarvestPoints
|
var alloyWorkerHarvesters = from harvester in economyAtSecond.HarvestPoints
|
||||||
where harvester.Harvest() != null
|
where harvester.Harvester() != null
|
||||||
where harvester.Harvest().RequiresWorker
|
where harvester.Harvester().RequiresWorker
|
||||||
where harvester.Harvest().Resource == ResourceType.Alloy
|
where harvester.Harvester().Resource == ResourceType.Alloy
|
||||||
select harvester;
|
select harvester;
|
||||||
|
|
||||||
var alloyAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
var alloyAutomaticHarvesters = from harvester in economyAtSecond.HarvestPoints
|
||||||
where harvester.Harvest() != null
|
where harvester.Harvester() != null
|
||||||
where harvester.Harvest().RequiresWorker == false
|
where harvester.Harvester().RequiresWorker == false
|
||||||
where harvester.Harvest().Resource == ResourceType.Alloy
|
where harvester.Harvester().Resource == ResourceType.Alloy
|
||||||
select harvester;
|
select harvester;
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
|
|
||||||
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters)
|
foreach (var alloyAutoHarvester in alloyAutomaticHarvesters)
|
||||||
{
|
{
|
||||||
autoAlloy += alloyAutoHarvester.Harvest().Slots * alloyAutoHarvester.Harvest().HarvestedPerInterval;
|
autoAlloy += alloyAutoHarvester.Harvester().Slots * alloyAutoHarvester.Harvester().HarvestedPerInterval;
|
||||||
var production = alloyAutoHarvester.Production();
|
var production = alloyAutoHarvester.Production();
|
||||||
if (production != null)
|
if (production != null)
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
|
|
||||||
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters)
|
foreach (var alloyWorkerHarvester in alloyWorkerHarvesters)
|
||||||
{
|
{
|
||||||
workerSlots += alloyWorkerHarvester.Harvest().Slots;
|
workerSlots += alloyWorkerHarvester.Harvester().Slots;
|
||||||
var production = alloyWorkerHarvester.Production();
|
var production = alloyWorkerHarvester.Production();
|
||||||
if (production != null)
|
if (production != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class BuildOrderModel
|
|||||||
return (from ordersAtTime in StartedOrders
|
return (from ordersAtTime in StartedOrders
|
||||||
from orders in ordersAtTime.Value
|
from orders in ordersAtTime.Value
|
||||||
where ordersAtTime.Key + (orders.Production() == null ? 0 : orders.Production().BuildTime) <= interval
|
where ordersAtTime.Key + (orders.Production() == null ? 0 : orders.Production().BuildTime) <= interval
|
||||||
where orders.Harvest() != null
|
where orders.Harvester() != null
|
||||||
select orders).ToList();
|
select orders).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ public class EntityModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EntityHarvesterModel Harvest()
|
public EntityHarvesterModel? Harvester()
|
||||||
{
|
{
|
||||||
return (EntityHarvesterModel)EntityParts.Find(x => x.GetType() == typeof(EntityHarvesterModel))!;
|
return (EntityHarvesterModel)EntityParts.Find(x => x.GetType() == typeof(EntityHarvesterModel))!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
namespace Model.Entity.Parts;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Model.Entity.Parts;
|
||||||
|
|
||||||
public class IEntityPartInterface
|
public class IEntityPartInterface
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
public EntityModel Parent { get; set; }
|
public EntityModel Parent { get; set; }
|
||||||
}
|
}
|
||||||
@@ -290,15 +290,9 @@ public class BuildOrderService : IBuildOrderService
|
|||||||
{
|
{
|
||||||
return (from ordersAtTime in _buildOrder.StartedOrders
|
return (from ordersAtTime in _buildOrder.StartedOrders
|
||||||
from orders in ordersAtTime.Value
|
from orders in ordersAtTime.Value
|
||||||
where ordersAtTime.Key + (orders.Production() == null
|
where orders.Harvester() != null
|
||||||
? 0
|
&& ordersAtTime.Key + (orders.Production()?.BuildTime ?? 0) <= interval
|
||||||
: orders.Production().BuildTime) <= interval
|
&& !orders.Harvester()!.IsDepleted(interval,ordersAtTime.Key + (orders.Production()?.BuildTime ?? 0))
|
||||||
&& !orders.Harvest().IsDepleted(
|
|
||||||
interval,
|
|
||||||
ordersAtTime.Key + (orders.Production() == null
|
|
||||||
? 0
|
|
||||||
: orders.Production().BuildTime))
|
|
||||||
where orders.Harvest() != null
|
|
||||||
select orders).ToList();
|
select orders).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class EconomyComparisionService : IEconomyComparisonService
|
|||||||
// Add funds
|
// Add funds
|
||||||
foreach (var entity in economyAtSecond.HarvestPoints)
|
foreach (var entity in economyAtSecond.HarvestPoints)
|
||||||
{
|
{
|
||||||
var harvester = entity.Harvest();
|
var harvester = entity.Harvester();
|
||||||
if (harvester.RequiresWorker)
|
if (harvester.RequiresWorker)
|
||||||
if (harvester.Resource == ResourceType.Alloy)
|
if (harvester.Resource == ResourceType.Alloy)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public class EconomyService : IEconomyService
|
|||||||
|
|
||||||
|
|
||||||
foreach (var harvesterPoint in
|
foreach (var harvesterPoint in
|
||||||
economyAtSecond.HarvestPoints.Select(entity => entity.Harvest()))
|
economyAtSecond.HarvestPoints.Select(entity => entity.Harvester()))
|
||||||
//if (harvesterPoint.IsDepleted(economyAtSecond.Interval))
|
//if (harvesterPoint.IsDepleted(economyAtSecond.Interval))
|
||||||
// continue;
|
// continue;
|
||||||
switch (harvesterPoint.RequiresWorker)
|
switch (harvesterPoint.RequiresWorker)
|
||||||
|
|||||||
Reference in New Issue
Block a user