Shooting Subroutine
parent
04f3f8a0a7
commit
1eb158ac10
|
@ -477,6 +477,42 @@ class GameFlow {
|
|||
// Logic for traversing the mountains, may affect gameState
|
||||
}
|
||||
|
||||
// Shooting word variations
|
||||
private shootingWordVariations: string[] = [
|
||||
"BANG", "BLAM", "POW", "WHAM", "BOOM", "ZAP", "PEW", "BAM", "CRACK", "POP",
|
||||
"BOFF", "SMACK", "KABOOM", "ZOOM", "WHOOSH", "BLOOP", "SPLAT", "SPLASH", "CRASH", "BANG!"
|
||||
];
|
||||
|
||||
// Simulating the shooting subroutine
|
||||
private async handleShootingSubRoutine(userInput?: string): Promise<void> {
|
||||
|
||||
let responseMessage = ''
|
||||
|
||||
if (!userInput) {
|
||||
// Select a random shooting word
|
||||
const shootingWordSelector = Math.floor(Math.random() * this.shootingWordVariations.length);
|
||||
this.gameState.shootingWordSelector = this.shootingWordVariations[shootingWordSelector];
|
||||
this.gameState.clockTimeAtStartOfBang = Math.floor(new Date().getTime() / 1000);
|
||||
//prompt the user to type !!Oregon shootingWord
|
||||
responseMessage += `\nQuick! TYPE !!Oregon ${this.gameState.shootingWordSelector} within the next few minutes to hunt the animal. Hurry, time is ticking!\n`;
|
||||
await this.statusUpdate(responseMessage);
|
||||
} else {
|
||||
// Check user input against shooting word
|
||||
if (userInput.toUpperCase() === this.gameState.shootingWordSelector) {
|
||||
const clockTimeAtEndOfBang = this.gameState.comment.created_utc;
|
||||
let actualResponseTimeForBang = ((clockTimeAtEndOfBang - this.gameState.clockTimeAtStartOfBang) / 60000);
|
||||
actualResponseTimeForBang += (this.gameState.shootingExpertiseLevelChoice - 1)
|
||||
if (actualResponseTimeForBang < 0) {
|
||||
actualResponseTimeForBang = 0;
|
||||
}
|
||||
// Update the game state with the actual response time
|
||||
this.gameState.actualResponseTimeForBang = actualResponseTimeForBang;
|
||||
} else {
|
||||
this.gameState.actualResponseTimeForBang = 9; // Set a high time to indicate a miss
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private handleDoctor(): string {
|
||||
let responseMessage: string = ""
|
||||
// Handle illness and injury
|
||||
|
|
|
@ -13,7 +13,7 @@ class GameState {
|
|||
amountSpentOnAnimals: number = 0;
|
||||
amountSpentOnAmmunition: number = 0;
|
||||
actualResponseTimeForBang: number = 0;
|
||||
clockTimeAtStartOfBang: Date = new Date();
|
||||
clockTimeAtStartOfBang: number = 0;
|
||||
amountSpentOnClothing: number = 0;
|
||||
insufficientClothingFlag: boolean = false;
|
||||
yesNoResponseToQuestions: string = '';
|
||||
|
|
Loading…
Reference in New Issue