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. 1
      IGP/Program.cs
  4. 11
      Model/Entity/Parts/EntityHarvestModel.cs
  5. 3
      Model/Hotkeys/HotkeyModel.cs
  6. 1
      Services/IServices.cs
  7. 3
      Services/Immortal/BuildOrderService.cs
  8. 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. 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>

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

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

1
IGP/Program.cs

@ -78,4 +78,3 @@ builder.Services.AddMudServices();
await builder.Build().RunAsync(); 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 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
Model/Hotkeys/HotkeyModel.cs

@ -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
Services/IServices.cs

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

3
Services/Immortal/BuildOrderService.cs

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

9
Services/Immortal/EconomyService.cs

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

Loading…
Cancel
Save