Reviewed and adjusted Logic

master
j 2024-04-26 00:45:00 -04:00
parent 6371945969
commit 3ae3f152ad
1 changed files with 11 additions and 5 deletions

View File

@ -36,6 +36,7 @@ export class RidersPhase {
responseMessage += `LOUSY SHOT---YOU GOT KNIFED\nYOU HAVE TO SEE OL' DOC GARY CHESS\n\n`
gameState.injuryFlag = true
}
gameState.lastPrompt = responseMessage;
gameState.phase = PHASE_ENUM.EVENT;
await gameState.save();
await gameFlow.executeCurrentPhase();
@ -58,6 +59,7 @@ export class RidersPhase {
responseMessage += gameFlow.handleShooting(userInput.toString());
gameState.amountSpentOnAmmunition -= gameState.shootResponseTime * 30 - 80
gameState.totalMileageWholeTrip -= 25
gameState.lastPrompt = responseMessage;
gameState.phase = PHASE_ENUM.EVENT;
await gameState.save();
await gameFlow.executeCurrentPhase();
@ -101,7 +103,6 @@ export class RidersPhase {
static async choiceLogic(gameState: GameState, gameFlow: GameFlow, userInput?: string): Promise<void> {
let responseMessage = '';
gameState.lastPrompt = responseMessage;
if (!userInput || isNaN(Number(userInput)) || +userInput < 1 && +userInput > 4) {
responseMessage = "Invalid input. Please enter a number between 1-4.\n\n";
@ -120,8 +121,10 @@ export class RidersPhase {
}
static async hostileRidersLogic(gameState: GameState, gameFlow: GameFlow): Promise<void> {
gameState.lastPrompt = "";
switch (gameState.tacticsChoiceWhenAttacked) {
case 1: // RUN
case 1: // RUN away
gameState.lastPrompt = `You decided to run away from the hostile riders. While you escaped unharmed, the riders stole some of your supplies. \n\n`
gameState.totalMileageWholeTrip += 20
gameState.amountSpentOnAnimals -= 40
gameState.amountSpentOnMiscellaneousSupplies -= 15
@ -132,6 +135,7 @@ export class RidersPhase {
gameState.save();
return gameFlow.executeCurrentPhase();
case 2: // ATTACK
gameState.lastPrompt = "You decide to attack the hostile riders.\n\n";
gameState.subPhase = 2;
gameState.save()
return gameFlow.executeCurrentPhase()
@ -156,8 +160,10 @@ export class RidersPhase {
}
static async friendlyRidersLogic(gameState: GameState, gameFlow: GameFlow): Promise<void> {
gameState.lastPrompt = "";
switch (gameState.tacticsChoiceWhenAttacked) {
case 1: // RUN
case 1: // RUN Away
gameState.lastPrompt = "You run away from the friendly riders. They watch you go, confused but unharmed.\n\n";
gameState.totalMileageWholeTrip += 15;
gameState.amountSpentOnAnimals -= 10;
gameState.amountSpentOnMiscellaneousSupplies -= 0;
@ -168,12 +174,12 @@ export class RidersPhase {
gameState.save();
return gameFlow.executeCurrentPhase();
case 2: // ATTACK
gameState.lastPrompt = "You decide to attack the friendly riders. They flee in confusion\n\n";
gameState.subPhase = 2;
gameState.save()
return gameFlow.executeCurrentPhase()
case 3: // CONTINUE
gameState.lastPrompt = "The riders continue on their way without incident.\n\n";
gameState.lastPrompt = "The riders share news from up ahead and wish you safe travels. Your party continues on.\n\n";
gameState.phase = PHASE_ENUM.EVENT;
gameState.subPhase = 0;
gameState.save();