Action Choice Logic Update
parent
398465db02
commit
04f3f8a0a7
|
@ -18,7 +18,7 @@ class GameFlow {
|
||||||
await this.handleSetupPhase(userInput);
|
await this.handleSetupPhase(userInput);
|
||||||
break;
|
break;
|
||||||
case PHASE_ENUM.START_TURN:
|
case PHASE_ENUM.START_TURN:
|
||||||
this.startTurn();
|
await this.startTurn();
|
||||||
break;
|
break;
|
||||||
case PHASE_ENUM.ACTION_CHOICE:
|
case PHASE_ENUM.ACTION_CHOICE:
|
||||||
await this.actionChoice(userInput)
|
await this.actionChoice(userInput)
|
||||||
|
@ -261,6 +261,7 @@ class GameFlow {
|
||||||
//Advance Phase
|
//Advance Phase
|
||||||
this.gameState.subPhase = 0;
|
this.gameState.subPhase = 0;
|
||||||
this.gameState.phase = PHASE_ENUM.START_TURN
|
this.gameState.phase = PHASE_ENUM.START_TURN
|
||||||
|
await this.gameState.save()
|
||||||
this.executeCurrentPhase()
|
this.executeCurrentPhase()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -372,7 +373,7 @@ class GameFlow {
|
||||||
this.gameState.cashLeftAfterInitialPurchases = Math.floor(this.gameState.cashLeftAfterInitialPurchases * 100) / 100;
|
this.gameState.cashLeftAfterInitialPurchases = Math.floor(this.gameState.cashLeftAfterInitialPurchases * 100) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
private startTurn(): void {
|
private async startTurn(): Promise<void> {
|
||||||
// Update total mileage up through the previous turn
|
// Update total mileage up through the previous turn
|
||||||
this.gameState.totalMileageUpThroughPreviousTurn = this.gameState.totalMileageWholeTrip;
|
this.gameState.totalMileageUpThroughPreviousTurn = this.gameState.totalMileageWholeTrip;
|
||||||
|
|
||||||
|
@ -380,6 +381,7 @@ class GameFlow {
|
||||||
this.gameState.fortOptionFlag = !this.gameState.fortOptionFlag;
|
this.gameState.fortOptionFlag = !this.gameState.fortOptionFlag;
|
||||||
|
|
||||||
this.gameState.phase = PHASE_ENUM.ACTION_CHOICE;
|
this.gameState.phase = PHASE_ENUM.ACTION_CHOICE;
|
||||||
|
await this.gameState.save()
|
||||||
|
|
||||||
this.executeCurrentPhase()
|
this.executeCurrentPhase()
|
||||||
}
|
}
|
||||||
|
@ -390,17 +392,23 @@ class GameFlow {
|
||||||
console.log("userInput", userInput);
|
console.log("userInput", userInput);
|
||||||
switch (userInput) {
|
switch (userInput) {
|
||||||
case "1": // Hunt
|
case "1": // Hunt
|
||||||
responseMessage += "You have decided to hunt.\n\n";
|
|
||||||
this.gameState.phase = PHASE_ENUM.HUNT;
|
this.gameState.phase = PHASE_ENUM.HUNT;
|
||||||
|
await this.gameState.save()
|
||||||
|
this.executeCurrentPhase()
|
||||||
|
return;
|
||||||
break;
|
break;
|
||||||
case "2": // Continue
|
case "2": // Continue
|
||||||
responseMessage += "You have decided to continue on your journey.\n\n";
|
|
||||||
this.gameState.phase = PHASE_ENUM.TRAVEL;
|
this.gameState.phase = PHASE_ENUM.TRAVEL;
|
||||||
|
await this.gameState.save()
|
||||||
|
this.executeCurrentPhase()
|
||||||
|
return;
|
||||||
break;
|
break;
|
||||||
case "3": // Stop at the Next Fort (if applicable)
|
case "3": // Stop at the Next Fort (if applicable)
|
||||||
if (this.gameState.fortOptionFlag) {
|
if (this.gameState.fortOptionFlag) {
|
||||||
responseMessage += "You have decided to stop at the next fort.\n\n";
|
|
||||||
this.gameState.phase = PHASE_ENUM.FORT;
|
this.gameState.phase = PHASE_ENUM.FORT;
|
||||||
|
await this.gameState.save()
|
||||||
|
this.executeCurrentPhase()
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
responseMessage += "⚠️ There is no fort option available at this time.\n\n"
|
responseMessage += "⚠️ There is no fort option available at this time.\n\n"
|
||||||
responseMessage += `Do you want to:\n1. Hunt\n2. Continue\n\n`
|
responseMessage += `Do you want to:\n1. Hunt\n2. Continue\n\n`
|
||||||
|
@ -424,7 +432,7 @@ class GameFlow {
|
||||||
|
|
||||||
// Warn the player if food is low
|
// Warn the player if food is low
|
||||||
if (this.gameState.amountSpentOnFood < 13) {
|
if (this.gameState.amountSpentOnFood < 13) {
|
||||||
responseMessage += `YOU'D BETTER DO SOME HUNTING OR BUY FOOD AND SOON!!!!\n\n`;
|
responseMessage += `You only have ${this.gameState.amountSpentOnFood} pounds of food.\n\n YOU'D BETTER DO SOME HUNTING OR BUY FOOD AND SOON!!!!\n\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gameState.fortOptionFlag) {
|
if (this.gameState.fortOptionFlag) {
|
||||||
|
@ -432,11 +440,10 @@ class GameFlow {
|
||||||
} else {
|
} else {
|
||||||
responseMessage += `Do you want to:\n1. Hunt\n2. Continue\n\n`
|
responseMessage += `Do you want to:\n1. Hunt\n2. Continue\n\n`
|
||||||
}
|
}
|
||||||
|
await this.statusUpdate(responseMessage)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.statusUpdate(responseMessage)
|
|
||||||
this.executeCurrentPhase()
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue