Harvest points can now be depleted

This commit is contained in:
Jonathan
2025-06-14 21:38:03 -04:00
parent a5964a68f8
commit 826717c47f
15 changed files with 52 additions and 38 deletions
@@ -27,7 +27,8 @@
Currently not considering running out of alloy and ether to harvest. Currently not considering running out of alloy and ether to harvest.
<br/> <br/>
<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/> <br/>
Expect even more oddities and invalid data then the above warning implies. Expect even more oddities and invalid data then the above warning implies.
</Message> </Message>
@@ -32,7 +32,6 @@
} }
@if (FilterService.GetFaction() == DataType.FACTION_Aru) @if (FilterService.GetFaction() == DataType.FACTION_Aru)
{ {
<option value="@DataType.IMMORTAL_Atzlan" <option value="@DataType.IMMORTAL_Atzlan"
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Atzlan))"> selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Atzlan))">
Atzlan Atzlan
@@ -343,7 +343,7 @@
{ {
var hotkey = KeyService.GetHotkey(); var hotkey = KeyService.GetHotkey();
if(hotkey is "`") if (hotkey is "`")
HandleCancelEntity(); HandleCancelEntity();
if (EntityFromKey(hotkey, out var entity)) if (EntityFromKey(hotkey, out var entity))
-1
View File
@@ -78,4 +78,3 @@ builder.Services.AddMudServices();
await builder.Build().RunAsync(); await builder.Build().RunAsync();
+11
View File
@@ -11,4 +11,15 @@ public class EntityHarvestModel : IEntityPartInterface
public float HarvestDelay { get; set; } = 1; public float HarvestDelay { get; set; } = 1;
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)
{
var lifeTime = interval - StartedAt;
var totalHarvested = (lifeTime - 1) * HarvestedPerInterval;
return totalHarvested > TotalAmount;
}
} }
-3
View File
@@ -19,16 +19,13 @@ public class HotkeyModel
return KeyType == KeyType.Action ? "#404146" return KeyType == KeyType.Action ? "#404146"
: KeyType == KeyType.Cancel ? "#621b1b" : KeyType == KeyType.Cancel ? "#621b1b"
: KeyType == KeyType.ControlGroup ? "#443512" : KeyType == KeyType.ControlGroup ? "#443512"
: KeyType == KeyType.Army ? "#443512" : KeyType == KeyType.Army ? "#443512"
: KeyType == KeyType.Train ? "#124443" : KeyType == KeyType.Train ? "#124443"
: KeyType == KeyType.Research ? "#221244" : KeyType == KeyType.Research ? "#221244"
: KeyType == KeyType.Construct ? "#122844" : KeyType == KeyType.Construct ? "#122844"
: KeyType == KeyType.Pyre ? "#441212" : KeyType == KeyType.Pyre ? "#441212"
: KeyType == KeyType.Advance ? "#23262c" : KeyType == KeyType.Advance ? "#23262c"
: KeyType == KeyType.Economy ? "#262c23" : KeyType == KeyType.Economy ? "#262c23"
: "#37393F"; : "#37393F";
} }
-1
View File
@@ -136,7 +136,6 @@ public interface IWebsiteService
public bool IsLoaded(); public bool IsLoaded();
} }
public interface INoteService public interface INoteService
{ {
public List<NoteContentModel> NoteContentModels { get; set; } public List<NoteContentModel> NoteContentModels { get; set; }
+2 -1
View File
@@ -359,7 +359,8 @@ public class BuildOrderService : IBuildOrderService
var usedSlots = 0; var usedSlots = 0;
foreach (var used in foreach (var used in
_buildOrder.TrainingCapacityUsed _buildOrder.TrainingCapacityUsed
.Where(used => checkedInterval >= used.StartingUsageTime && checkedInterval < used.StopUsageTime)) .Where(used =>
checkedInterval >= used.StartingUsageTime && checkedInterval < used.StopUsageTime))
{ {
usedSlots += used.UsedSlots; usedSlots += used.UsedSlots;
var duration = used.StopUsageTime - used.StartingUsageTime; var duration = used.StopUsageTime - used.StartingUsageTime;
+8 -1
View File
@@ -87,7 +87,9 @@ public class EconomyService : IEconomyService
foreach (var newEntity in completedAtInterval) 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(); var production = newEntity.Production();
if (production is { RequiresWorker: true }) economyAtSecond.BusyWorkerCount -= 1; if (production is { RequiresWorker: true }) economyAtSecond.BusyWorkerCount -= 1;
@@ -157,9 +159,13 @@ public class EconomyService : IEconomyService
{ {
var workersNeeded = 0; var workersNeeded = 0;
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))
continue;
switch (harvesterPoint.RequiresWorker) switch (harvesterPoint.RequiresWorker)
{ {
case true: case true:
@@ -167,6 +173,7 @@ public class EconomyService : IEconomyService
if (harvesterPoint.Resource == ResourceType.Alloy) if (harvesterPoint.Resource == ResourceType.Alloy)
{ {
var usedWorkers = Math.Min(harvesterPoint.Slots, freeWorkers); var usedWorkers = Math.Min(harvesterPoint.Slots, freeWorkers);
economyAtSecond.Alloy += harvesterPoint.HarvestedPerInterval * usedWorkers; economyAtSecond.Alloy += harvesterPoint.HarvestedPerInterval * usedWorkers;
economyAtSecond.AlloyIncome += harvesterPoint.HarvestedPerInterval * usedWorkers; economyAtSecond.AlloyIncome += harvesterPoint.HarvestedPerInterval * usedWorkers;