Temp is depleted logic
This commit is contained in:
@@ -42,27 +42,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<div>Depleted</div>
|
|
||||||
//TODO WIP
|
|
||||||
|
|
||||||
@foreach (var ordersAtTime in buildOrderService.CompletedOrders.Reverse())
|
|
||||||
{
|
|
||||||
foreach (var order in ordersAtTime.Value)
|
|
||||||
{
|
|
||||||
<div>
|
|
||||||
|
|
||||||
@ordersAtTime.Key | T @Interval.ToTime(ordersAtTime.Key)
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
@order.Info().Name
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -3863,16 +3863,16 @@ public abstract class DATA
|
|||||||
Description = "Gain 100 Ether over 50 seconds"
|
Description = "Gain 100 Ether over 50 seconds"
|
||||||
})
|
})
|
||||||
.AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "CONTROL" })
|
.AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "CONTROL" })
|
||||||
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_QRath })
|
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_Aru })
|
||||||
.AddPart(new EntityRequirementModel
|
.AddPart(new EntityRequirementModel
|
||||||
{
|
{
|
||||||
Id = DataType.BUILDING_Acropolis,
|
Id = DataType.STARTING_TownHall_Aru,
|
||||||
Requirement = RequirementType.Morph
|
Requirement = RequirementType.Morph
|
||||||
})
|
})
|
||||||
.AddPart(new EntityProductionModel { Alloy = 50, Cooldown = 50, RequiresWorker = false })
|
.AddPart(new EntityProductionModel { Alloy = 50, Cooldown = 50, RequiresWorker = false })
|
||||||
.AddPart(new EntityHarvestModel
|
.AddPart(new EntityHarvestModel
|
||||||
{
|
{
|
||||||
HarvestedPerInterval = 5, RequiresWorker = false, Resource = ResourceType.Ether, Slots = 1,
|
HarvestedPerInterval = 2, RequiresWorker = false, Resource = ResourceType.Ether, Slots = 1,
|
||||||
TotalAmount = 100
|
TotalAmount = 100
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -3888,13 +3888,13 @@ public abstract class DATA
|
|||||||
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_QRath })
|
.AddPart(new EntityFactionModel { Faction = DataType.FACTION_QRath })
|
||||||
.AddPart(new EntityRequirementModel
|
.AddPart(new EntityRequirementModel
|
||||||
{
|
{
|
||||||
Id = DataType.BUILDING_Acropolis,
|
Id = DataType.STARTING_TownHall_QRath,
|
||||||
Requirement = RequirementType.Morph
|
Requirement = RequirementType.Morph
|
||||||
})
|
})
|
||||||
.AddPart(new EntityProductionModel { Alloy = 50, Cooldown = 50, RequiresWorker = false })
|
.AddPart(new EntityProductionModel { Alloy = 50, Cooldown = 50, RequiresWorker = false })
|
||||||
.AddPart(new EntityHarvestModel
|
.AddPart(new EntityHarvestModel
|
||||||
{
|
{
|
||||||
HarvestedPerInterval = 5, RequiresWorker = false, Resource = ResourceType.Ether, Slots = 1,
|
HarvestedPerInterval = 2, RequiresWorker = false, Resource = ResourceType.Ether, Slots = 1,
|
||||||
TotalAmount = 100
|
TotalAmount = 100
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,13 +12,12 @@ public class EntityHarvestModel : IEntityPartInterface
|
|||||||
public int TotalAmount { get; set; }
|
public int TotalAmount { get; set; }
|
||||||
public bool RequiresWorker { get; set; }
|
public bool RequiresWorker { get; set; }
|
||||||
|
|
||||||
public float StartedAt { get; set; }
|
|
||||||
|
|
||||||
public bool IsDepleted(float interval)
|
public bool IsDepleted(float interval, float startedAt)
|
||||||
{
|
{
|
||||||
var lifeTime = interval - StartedAt;
|
var lifeTime = interval - startedAt;
|
||||||
|
|
||||||
var totalHarvested = (lifeTime - 1) * HarvestedPerInterval;
|
var totalHarvested = lifeTime * HarvestedPerInterval;
|
||||||
|
|
||||||
return totalHarvested > TotalAmount;
|
return totalHarvested > TotalAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public interface IBuildOrderService
|
|||||||
public int? WillMeetSupply(EntityModel entity);
|
public int? WillMeetSupply(EntityModel entity);
|
||||||
public Dictionary<int, List<EntityModel>> GetOrders();
|
public Dictionary<int, List<EntityModel>> GetOrders();
|
||||||
public List<EntityModel> GetCompletedBefore(int interval);
|
public List<EntityModel> GetCompletedBefore(int interval);
|
||||||
public List<EntityModel> GetHarvestPointsCompletedBefore(int interval);
|
public List<EntityModel> GetUndepletedHarvestPointsCompletedBefore(int interval);
|
||||||
|
|
||||||
public void RemoveLast();
|
public void RemoveLast();
|
||||||
public void Reset();
|
public void Reset();
|
||||||
|
|||||||
@@ -286,11 +286,18 @@ public class BuildOrderService : IBuildOrderService
|
|||||||
select orders).ToList();
|
select orders).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EntityModel> GetHarvestPointsCompletedBefore(int interval)
|
public List<EntityModel> GetUndepletedHarvestPointsCompletedBefore(int interval)
|
||||||
{
|
{
|
||||||
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 ? 0 : orders.Production().BuildTime) <= interval
|
where ordersAtTime.Key + (orders.Production() == null
|
||||||
|
? 0
|
||||||
|
: orders.Production().BuildTime) <= interval
|
||||||
|
&& !orders.Harvest().IsDepleted(
|
||||||
|
interval,
|
||||||
|
ordersAtTime.Key + (orders.Production() == null
|
||||||
|
? 0
|
||||||
|
: orders.Production().BuildTime))
|
||||||
where orders.Harvest() != null
|
where orders.Harvest() != null
|
||||||
select orders).ToList();
|
select orders).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,11 +72,15 @@ public class EconomyService : IEconomyService
|
|||||||
: buildEconomyOverTime[atInterval];
|
: 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.Interval = interval;
|
||||||
economyAtSecond.HarvestPoints =
|
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();
|
select harvester).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +92,7 @@ public class EconomyService : IEconomyService
|
|||||||
foreach (var newEntity in completedAtInterval)
|
foreach (var newEntity in completedAtInterval)
|
||||||
{
|
{
|
||||||
var entity = newEntity.Clone();
|
var entity = newEntity.Clone();
|
||||||
entity.Harvest().StartedAt = interval;
|
//entity.Harvest().StartedAt = interval;
|
||||||
economyAtSecond.HarvestPoints.Add(entity);
|
economyAtSecond.HarvestPoints.Add(entity);
|
||||||
|
|
||||||
var production = newEntity.Production();
|
var production = newEntity.Production();
|
||||||
@@ -163,8 +167,8 @@ public class EconomyService : IEconomyService
|
|||||||
foreach (var harvesterPoint in
|
foreach (var harvesterPoint in
|
||||||
economyAtSecond.HarvestPoints.Select(entity => entity.Harvest()))
|
economyAtSecond.HarvestPoints.Select(entity => entity.Harvest()))
|
||||||
{
|
{
|
||||||
if (harvesterPoint.IsDepleted(economyAtSecond.Interval))
|
//if (harvesterPoint.IsDepleted(economyAtSecond.Interval))
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
switch (harvesterPoint.RequiresWorker)
|
switch (harvesterPoint.RequiresWorker)
|
||||||
{
|
{
|
||||||
@@ -215,17 +219,16 @@ public class EconomyService : IEconomyService
|
|||||||
|
|
||||||
private void CarryOverEconomyFromPreviousInterval(int interval, EconomyModel economyAtSecond)
|
private void CarryOverEconomyFromPreviousInterval(int interval, EconomyModel economyAtSecond)
|
||||||
{
|
{
|
||||||
if (interval > 0)
|
if (interval <= 0) return;
|
||||||
{
|
|
||||||
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy;
|
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy;
|
||||||
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether;
|
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether;
|
||||||
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre;
|
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre;
|
||||||
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount;
|
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount;
|
||||||
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount;
|
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount;
|
||||||
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount;
|
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount;
|
||||||
economyAtSecond.HarvestPoints = buildEconomyOverTime[interval - 1].HarvestPoints.ToList();
|
economyAtSecond.HarvestPoints = buildEconomyOverTime[interval - 1].HarvestPoints.ToList();
|
||||||
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user