Browse Source

Harvest points can now be depleted

main
Jonathan 11 months ago
parent
commit
826717c47f
  1. 3
      IGP/Pages/BuildCalculator/BuildCalculatorPage.razor
  2. 1
      IGP/Pages/BuildCalculator/Parts/FilterComponent.razor
  3. 2
      IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor
  4. 1
      IGP/Program.cs
  5. 11
      Model/Entity/Parts/EntityHarvestModel.cs
  6. 3
      Model/Hotkeys/HotkeyModel.cs
  7. 1
      Services/IServices.cs
  8. 3
      Services/Immortal/BuildOrderService.cs
  9. 9
      Services/Immortal/EconomyService.cs

3
IGP/Pages/BuildCalculator/BuildCalculatorPage.razor

@ -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>

1
IGP/Pages/BuildCalculator/Parts/FilterComponent.razor

@ -32,7 +32,6 @@
}
@if (FilterService.GetFaction() == DataType.FACTION_Aru)
{
<option value="@DataType.IMMORTAL_Atzlan"
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Atzlan))">
Atzlan

2
IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor

@ -343,7 +343,7 @@
{
var hotkey = KeyService.GetHotkey();
if(hotkey is "`")
if (hotkey is "`")
HandleCancelEntity();
if (EntityFromKey(hotkey, out var entity))

1
IGP/Program.cs

@ -78,4 +78,3 @@ builder.Services.AddMudServices();
await builder.Build().RunAsync();

11
Model/Entity/Parts/EntityHarvestModel.cs

@ -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;
}
}

3
Model/Hotkeys/HotkeyModel.cs

@ -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";
}

1
Services/IServices.cs

@ -136,7 +136,6 @@ public interface IWebsiteService
public bool IsLoaded();
}
public interface INoteService
{
public List<NoteContentModel> NoteContentModels { get; set; }

3
Services/Immortal/BuildOrderService.cs

@ -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;

9
Services/Immortal/EconomyService.cs

@ -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;

Loading…
Cancel
Save