From e6db7762440f93b6730f9ba76e4858538e525ea1 Mon Sep 17 00:00:00 2001 From: Konrad Jamrozik Date: Sat, 29 Jun 2024 17:47:20 -0700 Subject: [PATCH] Funding of 0 now no longer ends the game --- src/game-lib/Controller/TimeAdvancementController.cs | 10 ++++------ src/game-lib/State/GameState.cs | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/game-lib/Controller/TimeAdvancementController.cs b/src/game-lib/Controller/TimeAdvancementController.cs index 0fa45a1a..068b0194 100644 --- a/src/game-lib/Controller/TimeAdvancementController.cs +++ b/src/game-lib/Controller/TimeAdvancementController.cs @@ -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; diff --git a/src/game-lib/State/GameState.cs b/src/game-lib/State/GameState.cs index cd6210df..18e25c2d 100644 --- a/src/game-lib/State/GameState.cs +++ b/src/game-lib/State/GameState.cs @@ -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;