Skip to content

Commit

Permalink
Funding of 0 now no longer ends the game
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Jamrozik committed Jun 30, 2024
1 parent 685f16f commit e6db776
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/game-lib/Controller/TimeAdvancementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ public TimeAdvancementController(
int intelChange = Ruleset.ComputeIntelChange(state.Assets, successfulMissions);
int fundingChange = Ruleset.ComputeFundingChange(successfulMissions, failedMissions, expiredMissionSites);
int supportChange = Ruleset.ComputeSupportChange(successfulMissions, failedMissions, expiredMissionSites);

state.Assets.Money += moneyChange;
state.Assets.Intel += intelChange;
// Note: this funding change will get taken into account when computing money change this turn,
// as money change is computed downstream.
state.Assets.Funding += fundingChange;
state.Assets.Support += supportChange;
state.Assets.Intel = Math.Max(0, state.Assets.Intel + intelChange);
state.Assets.Funding = Math.Max(0, state.Assets.Funding + fundingChange);
state.Assets.Support = Math.Max(0, state.Assets.Support + supportChange);

// Each turn all transport capacity gets freed up.
state.Assets.CurrentTransportCapacity = state.Assets.MaxTransportCapacity;
Expand Down
2 changes: 0 additions & 2 deletions src/game-lib/State/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ public void ToJsonFile(File file)
// This condition is here to protect against infinite loops.
|| Timeline.CurrentTurn > MaxTurnLimit;

// kja game should not be lost if funding is less than zero. Funding should never be less than zero.
public bool IsGameLost => Assets.Money < 0
|| Assets.Funding < 0
|| Assets.Support <= 0;

public bool IsGameWon => Factions.AllDefeated;
Expand Down

0 comments on commit e6db776

Please sign in to comment.