97 lines
4 KiB
JavaScript
Executable file
97 lines
4 KiB
JavaScript
Executable file
//Created by student A and B collaobratively
|
|
|
|
// Program is started from here, runs functions from other files.
|
|
|
|
// In order to use variables and functions from other files we must import them as shown below
|
|
|
|
// To import functions we use the syntax below
|
|
import { userInput, sleep, disableRawMode, walkPathMain, randomNumber } from './functions.js';
|
|
import { ravenRockStore } from './shops.js';
|
|
|
|
// To import variables from a file you must mark them as global (done in file) and import the file they are in like shown below.
|
|
import './variables.js';
|
|
|
|
disableRawMode();
|
|
console.clear();
|
|
console.log("__________________________________________________________________________________________________________________________________");
|
|
console.log(" _____ _ ____ ");
|
|
console.log(" / ' / / / / ) /");
|
|
console.log("---/__-------__---/---/----__---------_/_---------/-------__----__----__---__----__---_--_----__-------/___ /----__----__----__-/-");
|
|
console.log(" / / ) / / / ) / / / o / / ) / ) /___) (_ ` / ) / / ) /___) / | / ) / ) / / ");
|
|
console.log("_/________(___(_/___/___(___/_(___(__(_ __o_____/____/_(___/_/___/_(___ _(__)_(___/_/_/__/_(___ _____/_____|__(___/_(___(_(___/___\n\n");
|
|
await sleep(1);
|
|
|
|
// Collects player input for menus
|
|
var mainMenuInput;
|
|
while (true) {
|
|
console.log("What would you like to do?");
|
|
console.log("--------------------------");
|
|
console.log("1) Start new game");
|
|
console.log("2) Learn How to play");
|
|
console.log("3) Quit Game");
|
|
console.log("4) Credits\n");
|
|
mainMenuInput = userInput("Enter: ");
|
|
|
|
// Input validation
|
|
if (mainMenuInput != "1" && mainMenuInput != "2" && mainMenuInput != "3" && mainMenuInput != "4") {
|
|
console.log("Invalid input. Please enter 1, 2, or 3.");
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
|
|
switch(mainMenuInput) {
|
|
case "1":
|
|
startGame();
|
|
break;
|
|
case "2":
|
|
console.log(food);
|
|
break;
|
|
case "3":
|
|
console.log("Quitting Game...");
|
|
await sleep(1);
|
|
exit(0);
|
|
case "4":
|
|
console.log("Credits:");
|
|
console.log("Bethesda Game Studios - The Fallout IP and related characters/lore");
|
|
console.log("Readline-sync - NPM package used for async collection of user input");
|
|
break;
|
|
}
|
|
|
|
|
|
// startGame() function
|
|
// Walks player through character creation, story, and sets starting stats. Then opens up ravenRockStore() before
|
|
// runing the walkPath() function loop.
|
|
function startGame() {
|
|
console.clear();
|
|
name = userInput("What is your name? ");
|
|
console.log(name+" Is now your name...")
|
|
console.clear();
|
|
console.log("Intro:");
|
|
console.log("You are an ordinary loyal Enclave Soldier working at Raven Rock. \nYou are typing away at your terminal, entering reports of recovered materials when a message flashes on it");
|
|
console.log("|||||||")
|
|
console.log("|| Enclave Intranet Messager");
|
|
console.log("|||||||")
|
|
console.log("|| Message From: potus");
|
|
console.log("|||||||\n\n")
|
|
console.log("Dear "+name+",\n\n This is a direct order from the Enclave High Command. \nIgnore all previous directives. Proceed to Camp Navarro immediately. \nSeek safe passage through the Brotherhood and NCR territories. \nDo not disclose your mission to anyone but Enclave Personel with \nsecurity clearance 5 or higher. Reqisition supplies before departure. \nYou have been given 1 YEAR to complete this mission or face discharge.\n\n Signed, President John Henry Eden\n\n");
|
|
|
|
userInput("[Enter to open shop]");
|
|
console.clear();
|
|
|
|
preWarMoney = 500;
|
|
caps = 0;
|
|
level = 1;
|
|
health = 100;
|
|
healthCap = 100;
|
|
walkRate = 1;
|
|
foodRate = 1;
|
|
food = 0;
|
|
radPoints = 0;
|
|
path = 0;
|
|
location = 0;
|
|
locationA = 0;
|
|
locationB = 0;
|
|
ravenRockStore();
|
|
walkPathMain(0);
|
|
}
|