Spelling and phase reset

master
j 2024-04-26 01:45:41 -04:00
parent 3ae3f152ad
commit 203cba4a3e
1 changed files with 5 additions and 2 deletions

View File

@ -6,7 +6,7 @@ export class RidersPhase {
gameState.lastPrompt = responseMessage; gameState.lastPrompt = responseMessage;
switch (gameState.subPhase) { switch (gameState.subPhase) {
case 0: // Initial Logic case 0: // Initial Logic
await RidersPhase.initalLogic(gameState, gameFlow); await RidersPhase.initialLogic(gameState, gameFlow);
break; break;
case 1: // Choice Logic case 1: // Choice Logic
await RidersPhase.choiceLogic(gameState, gameFlow, userInput); await RidersPhase.choiceLogic(gameState, gameFlow, userInput);
@ -38,6 +38,7 @@ export class RidersPhase {
} }
gameState.lastPrompt = responseMessage; gameState.lastPrompt = responseMessage;
gameState.phase = PHASE_ENUM.EVENT; gameState.phase = PHASE_ENUM.EVENT;
gameState.subPhase = 0
await gameState.save(); await gameState.save();
await gameFlow.executeCurrentPhase(); await gameFlow.executeCurrentPhase();
return; return;
@ -61,13 +62,14 @@ export class RidersPhase {
gameState.totalMileageWholeTrip -= 25 gameState.totalMileageWholeTrip -= 25
gameState.lastPrompt = responseMessage; gameState.lastPrompt = responseMessage;
gameState.phase = PHASE_ENUM.EVENT; gameState.phase = PHASE_ENUM.EVENT;
gameState.subPhase = 0
await gameState.save(); await gameState.save();
await gameFlow.executeCurrentPhase(); await gameFlow.executeCurrentPhase();
return; return;
} }
} }
static async initalLogic(gameState: GameState, gameFlow: GameFlow): Promise<void> { static async initialLogic(gameState: GameState, gameFlow: GameFlow): Promise<void> {
let responseMessage = ''; let responseMessage = '';
gameState.lastPrompt = responseMessage; gameState.lastPrompt = responseMessage;
// Check for random encounter // Check for random encounter
@ -83,6 +85,7 @@ export class RidersPhase {
// If the random factor exceeds the encounter chance, skip to the next phase. // If the random factor exceeds the encounter chance, skip to the next phase.
if (randomFactor > encounterChance) { if (randomFactor > encounterChance) {
gameState.phase = PHASE_ENUM.EVENT; gameState.phase = PHASE_ENUM.EVENT;
gameState.subPhase = 0
gameState.save(); gameState.save();
return gameFlow.executeCurrentPhase(); return gameFlow.executeCurrentPhase();
} }