Allow Penalized Looping choices to fort and to hunt. Utilized setup phase 2 + for penalized fort shopping.

master
j 2024-04-17 00:49:19 -04:00
parent 4982d2c80a
commit 46cfe43c75
1 changed files with 15 additions and 16 deletions

View File

@ -29,7 +29,7 @@ class GameFlow {
break; break;
case PHASE_ENUM.FORT: case PHASE_ENUM.FORT:
// Handle interactions at the fort // Handle interactions at the fort
await this.handleFort(); await this.handleSetupPhase(userInput);
break; break;
case PHASE_ENUM.HUNT: case PHASE_ENUM.HUNT:
// Handle hunting logic // Handle hunting logic
@ -258,7 +258,7 @@ class GameFlow {
case 6: case 6:
//Advance Phase //Advance Phase
this.gameState.subPhase = 0; this.gameState.subPhase = 0;
this.gameState.phase = PHASE_ENUM.START_TURN this.gameState.phase === PHASE_ENUM.SETUP ? this.gameState.phase = PHASE_ENUM.START_TURN : this.gameState.phase = PHASE_ENUM.ACTION_CHOICE;
await this.gameState.save() await this.gameState.save()
this.executeCurrentPhase() this.executeCurrentPhase()
break; break;
@ -325,23 +325,24 @@ class GameFlow {
errorMessage: `⚠️ You do not have enough money to purchase ${amount} units of ${itemType}. You have $${this.gameState.cashLeftAfterInitialPurchases} remaining.` errorMessage: `⚠️ You do not have enough money to purchase ${amount} units of ${itemType}. You have $${this.gameState.cashLeftAfterInitialPurchases} remaining.`
}; };
} }
let modifier: number
this.gameState.phase !== PHASE_ENUM.FORT ? modifier = 1 : modifier = 2 / 3;
// Update gameState based on itemType // Update gameState based on itemType
switch (itemType) { switch (itemType) {
case PurchaseOption.OXEN: case PurchaseOption.OXEN:
this.gameState.amountSpentOnAnimals += totalCost; this.gameState.amountSpentOnAnimals += totalCost * modifier;
break; break;
case PurchaseOption.FOOD: case PurchaseOption.FOOD:
this.gameState.amountSpentOnFood += totalCost; this.gameState.amountSpentOnFood += totalCost * modifier;
break; break;
case PurchaseOption.AMMO: case PurchaseOption.AMMO:
this.gameState.amountSpentOnAmmunition += totalCost * 50; this.gameState.amountSpentOnAmmunition += totalCost * 50 * modifier;
break; break;
case PurchaseOption.CLOTHING: case PurchaseOption.CLOTHING:
this.gameState.amountSpentOnClothing += totalCost; this.gameState.amountSpentOnClothing += totalCost * modifier;
break; break;
case PurchaseOption.MISC: case PurchaseOption.MISC:
this.gameState.amountSpentOnMiscellaneousSupplies += totalCost; this.gameState.amountSpentOnMiscellaneousSupplies += totalCost * modifier;
break; break;
// Add cases for other item types // Add cases for other item types
} }
@ -415,6 +416,8 @@ class GameFlow {
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) {
this.gameState.subPhase = 2
this.gameState.totalMileageWholeTrip -= 45;
this.gameState.phase = PHASE_ENUM.FORT; this.gameState.phase = PHASE_ENUM.FORT;
await this.gameState.save() await this.gameState.save()
this.executeCurrentPhase() this.executeCurrentPhase()
@ -457,19 +460,15 @@ class GameFlow {
return; return;
} }
private async handleTravel(): Promise<void> {
// Logic for handling the travel phase
}
private async handleRidersAttack(userInput?: string | number): Promise<void> { private async handleRidersAttack(userInput?: string | number): Promise<void> {
// Logic for handling a riders attack, may involve checking userInput for response to attack // Logic for handling a riders attack, may involve checking userInput for response to attack
} }
private async handleTravel(): Promise<void> {
// Logic for handling the travel phase
}
private async handleFort(): Promise<void> {
// Logic for interacting at the fort, such as purchasing supplies
}
private async handleHunt(userInput?: string | number): Promise<void> { private async handleHunt(userInput?: string | number): Promise<void> {
// Logic for the hunt phase, determining success based on gameState attributes // Logic for the hunt phase, determining success based on gameState attributes
@ -493,7 +492,7 @@ class GameFlow {
responseMessage += `Better luck next time! Maybe practice your aim some more.\n\n` responseMessage += `Better luck next time! Maybe practice your aim some more.\n\n`
this.gameState.amountSpentOnAmmunition -= 50 this.gameState.amountSpentOnAmmunition -= 50
} }
this.gameState.phase = PHASE_ENUM.TRAVEL; this.gameState.phase = PHASE_ENUM.ACTION_CHOICE;
await this.gameState.save(); await this.gameState.save();
await this.executeCurrentPhase(); await this.executeCurrentPhase();
return; return;