Harvest points can now be depleted
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
Currently not considering running out of alloy and ether to harvest.
|
||||
<br/>
|
||||
<br/>
|
||||
Build Calculator was built based on a much older version of the game and was only quickly modified for the June 2025 Playtest version, so the above disclaimer is only more true.
|
||||
Build Calculator was built based on a much older version of the game and was only quickly modified for the
|
||||
June 2025 Playtest version, so the above disclaimer is only more true.
|
||||
<br/>
|
||||
Expect even more oddities and invalid data then the above warning implies.
|
||||
</Message>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
}
|
||||
@if (FilterService.GetFaction() == DataType.FACTION_Aru)
|
||||
{
|
||||
|
||||
<option value="@DataType.IMMORTAL_Atzlan"
|
||||
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Atzlan))">
|
||||
Atzlan
|
||||
|
||||
@@ -343,7 +343,7 @@
|
||||
{
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
|
||||
if(hotkey is "`")
|
||||
if (hotkey is "`")
|
||||
HandleCancelEntity();
|
||||
|
||||
if (EntityFromKey(hotkey, out var entity))
|
||||
|
||||
@@ -78,4 +78,3 @@ builder.Services.AddMudServices();
|
||||
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
|
||||
|
||||
@@ -11,4 +11,15 @@ public class EntityHarvestModel : IEntityPartInterface
|
||||
public float HarvestDelay { get; set; } = 1;
|
||||
public int TotalAmount { get; set; }
|
||||
public bool RequiresWorker { get; set; }
|
||||
|
||||
public float StartedAt { get; set; }
|
||||
|
||||
public bool IsDepleted(float interval)
|
||||
{
|
||||
var lifeTime = interval - StartedAt;
|
||||
|
||||
var totalHarvested = (lifeTime - 1) * HarvestedPerInterval;
|
||||
|
||||
return totalHarvested > TotalAmount;
|
||||
}
|
||||
}
|
||||
@@ -19,16 +19,13 @@ public class HotkeyModel
|
||||
return KeyType == KeyType.Action ? "#404146"
|
||||
: KeyType == KeyType.Cancel ? "#621b1b"
|
||||
: KeyType == KeyType.ControlGroup ? "#443512"
|
||||
|
||||
: KeyType == KeyType.Army ? "#443512"
|
||||
: KeyType == KeyType.Train ? "#124443"
|
||||
: KeyType == KeyType.Research ? "#221244"
|
||||
: KeyType == KeyType.Construct ? "#122844"
|
||||
: KeyType == KeyType.Pyre ? "#441212"
|
||||
|
||||
: KeyType == KeyType.Advance ? "#23262c"
|
||||
: KeyType == KeyType.Economy ? "#262c23"
|
||||
|
||||
: "#37393F";
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,6 @@ public interface IWebsiteService
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
|
||||
public interface INoteService
|
||||
{
|
||||
public List<NoteContentModel> NoteContentModels { get; set; }
|
||||
|
||||
@@ -359,7 +359,8 @@ public class BuildOrderService : IBuildOrderService
|
||||
var usedSlots = 0;
|
||||
foreach (var used in
|
||||
_buildOrder.TrainingCapacityUsed
|
||||
.Where(used => checkedInterval >= used.StartingUsageTime && checkedInterval < used.StopUsageTime))
|
||||
.Where(used =>
|
||||
checkedInterval >= used.StartingUsageTime && checkedInterval < used.StopUsageTime))
|
||||
{
|
||||
usedSlots += used.UsedSlots;
|
||||
var duration = used.StopUsageTime - used.StartingUsageTime;
|
||||
|
||||
@@ -87,7 +87,9 @@ public class EconomyService : IEconomyService
|
||||
|
||||
foreach (var newEntity in completedAtInterval)
|
||||
{
|
||||
economyAtSecond.HarvestPoints.Add(newEntity);
|
||||
var entity = newEntity.Clone();
|
||||
entity.Harvest().StartedAt = interval;
|
||||
economyAtSecond.HarvestPoints.Add(entity);
|
||||
|
||||
var production = newEntity.Production();
|
||||
if (production is { RequiresWorker: true }) economyAtSecond.BusyWorkerCount -= 1;
|
||||
@@ -157,9 +159,13 @@ public class EconomyService : IEconomyService
|
||||
{
|
||||
var workersNeeded = 0;
|
||||
|
||||
|
||||
foreach (var harvesterPoint in
|
||||
economyAtSecond.HarvestPoints.Select(entity => entity.Harvest()))
|
||||
{
|
||||
if (harvesterPoint.IsDepleted(economyAtSecond.Interval))
|
||||
continue;
|
||||
|
||||
switch (harvesterPoint.RequiresWorker)
|
||||
{
|
||||
case true:
|
||||
@@ -167,6 +173,7 @@ public class EconomyService : IEconomyService
|
||||
if (harvesterPoint.Resource == ResourceType.Alloy)
|
||||
{
|
||||
var usedWorkers = Math.Min(harvesterPoint.Slots, freeWorkers);
|
||||
|
||||
economyAtSecond.Alloy += harvesterPoint.HarvestedPerInterval * usedWorkers;
|
||||
economyAtSecond.AlloyIncome += harvesterPoint.HarvestedPerInterval * usedWorkers;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user