diff --git a/src/game/gameFlow.ts b/src/game/gameFlow.ts index 5ddb9b2..e0a8c52 100644 --- a/src/game/gameFlow.ts +++ b/src/game/gameFlow.ts @@ -114,12 +114,13 @@ class GameFlow { } private async handleSetupPhase(userInput?: string): Promise { + userInput = userInput?.toLowerCase() let responseMessage = ""; // Logic to handle initial setup switch (this.gameState.subPhase) { case 0: // Weapons Purchase Subphase - if (!userInput) { + if (!userInput || userInput === 'start') { // Send instructions to the user for the current subphase responseMessage = `${MessageService.getRandomMessage( MessageFileName.Oregon_WeaponPurchase, @@ -136,6 +137,10 @@ class GameFlow { } else { // If there was an error, include the error message in responseMessage responseMessage = `${purchaseResult.errorMessage}`; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_WeaponPurchase, + {} + )}` // Do not advance subphase; possibly prompt the same instructions with an error message } } @@ -154,6 +159,10 @@ class GameFlow { return this.handleSetupPhase(); // Call setup phase again for next subphase } else { responseMessage = purchaseResult.errorMessage || ''; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_OxenPurchase, + {} + )}` } } break; @@ -171,6 +180,10 @@ class GameFlow { return this.handleSetupPhase(); // Call setup phase again for next subphase } else { responseMessage = purchaseResult.errorMessage || ''; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_FoodPurchase, + {} + )}` } } break; @@ -188,6 +201,10 @@ class GameFlow { return this.handleSetupPhase(); // Call setup phase again for next subphase } else { responseMessage = purchaseResult.errorMessage || ''; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_AmmoPurchase, + {} + )}` } } break; @@ -205,6 +222,10 @@ class GameFlow { return this.handleSetupPhase(); // Call setup phase again for next subphase } else { responseMessage = purchaseResult.errorMessage || ''; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_ClothingPurchase, + {} + )}` } } break; @@ -222,6 +243,10 @@ class GameFlow { return this.handleSetupPhase(); // Call setup phase again for next subphase } else { responseMessage = purchaseResult.errorMessage || ''; + responseMessage += `\n\n${MessageService.getRandomMessage( + MessageFileName.Oregon_MiscSuppliesPurchase, + {} + )}` } } break;