diff --git a/files/inventory.js b/files/inventory.js new file mode 100644 index 0000000..970e930 --- /dev/null +++ b/files/inventory.js @@ -0,0 +1,53 @@ +const variables = require("./variables"); +const main = require("./main"); + +module.exports = { + inventoryMenuM, +}; + +//Builds the main menu inventory +function inventoryMenuM(){ + console.clear(); + console.log("INVENTORY"); + console.log("---------"); + console.log("1) Supplies"); + console.log("2) Equipment"); + console.log("[spacebar to exit]"); + var userInput = variables.userInput("Enter: "); + switch(userInput){ + case "1": + supplyInventory(); + break; + case "2": + equipmentInventory(); + break; + } +} + +//Builds the supply inventory +function supplyInventory(){ + console.clear(); + console.log("SUPPLIES"); + console.log("---------"); + for(var a = 0; a < variables.inventory[0].length;){ + console.log((a + 1) + ") " + variables.inventory[0][a].name); + a++; + } + variables.userInput("[Enter to return]"); + console.clear(); + inventoryMenuM(); +} + +//Builds the equipment inventory +function equipmentInventory(){ + console.clear(); + console.log("EQUIPMENT"); + console.log("---------"); + for(var a = 0; a < variables.inventory[1].length;){ + console.log((a + 1) + ") " + variables.inventory[1][a].name); + a++; + } + variables.userInput("[Enter to return]"); + console.clear(); + inventoryMenuM(); +} \ No newline at end of file diff --git a/files/main.js b/files/main.js index 9af4a95..acc27db 100644 --- a/files/main.js +++ b/files/main.js @@ -1,12 +1,10 @@ -//For testing purposes -const moreTestingShite = require("./poiscreens.js"); - // Program is started from here, runs functions from other files. const variables = require("./variables.js"); const game = require("./game.js"); const shops = require("./shops"); const readline = require('node:readline'); const encounterMenus = require("./poiscreens.js"); +const inventoryStuff = require("./inventory.js"); console.clear(); console.log("__________________________________________________________________________________________________________________________________"); @@ -23,6 +21,7 @@ console.log("--------------------------"); console.log("1) Start new game"); console.log("2) Learn How to play"); console.log("3) Quit Game"); +console.log("4) Dev stuff for testing"); var mainMenuInput = variables.userInput("Enter: ") @@ -31,7 +30,6 @@ switch(mainMenuInput) { startGame(); break; case "2": - moreTestingShite.beginTesting(); console.log("Follow the link below for a game manual.") console.log("[ENTER LINK HERE]") break; @@ -39,6 +37,9 @@ switch(mainMenuInput) { console.log("Quitting Game..."); variables.sleep(1000); break; + case "4": + inventoryStuff.inventoryMenuM(); + break; } function startGame() { // So far what I have is filler and testing, feel free to change. @@ -49,9 +50,9 @@ function startGame() { // So far what I have is filler and testing, feel free to variables.sleep(2000); 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.\n\nDear "+variables.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. \n\n Signed, President John Henry Eden\n\n"); + 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.\n\nDear "+variables.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. \n\n Signed, President John Henry Eden\n\n"); - variables.userInput("[Enter to open shop]") + variables.userInput("[Enter to open shop]"); console.clear(); variables.prewarmoney = 500; diff --git a/files/poiscreens.js b/files/poiscreens.js index 6d6c74b..becc8ae 100644 --- a/files/poiscreens.js +++ b/files/poiscreens.js @@ -1,16 +1,31 @@ -const testingShite = require("./main.js"); const variables = require("./variables.js"); module.exports = { encounterMenuMaker, - beginTesting, + initializeEncounter, } -function beginTesting(){ - console.log(encounterMenuMaker("abomination", 1)); +function initializeEncounter(reqFaction, diffWeighting, fight, flee){ + var encounter = encounterMenuMaker(reqFaction, diffWeighting); + console.clear(); + console.log("You come across a " + encounter.name); + var encounterHealth = variables.randomNumber(encounter.minHealth, encounter.maxHealth); + console.log("Health: " + encounterHealth); + console.log("What would you like to do?"); + console.log("--------------------------"); + var playerOptions = 1; + if(fight == true){ + console.log(playerOptions + ") Fight"); + playerOptions++; + } + if(flee == true){ + console.log(playerOptions + ") Flee"); + playerOptions++; + } + console.log(playerOptions + ") Inventory"); } -//Editor's note: abomination, raider, settler, BOS, NCR, Legion +//Add any new encounter ideas to their required faction and difficulty var encounterDiffOne = [ //NCR [], @@ -31,6 +46,7 @@ var encounterDiffOne = [ {name: "radroach", minHealth: 1, maxHealth: 10, lootTable: "food", numEnemies: 1}, {name: "weak ghoul", minHealth: 10, maxHealth: 15, lootTable: "junk", numEnemies: 1}, {name: "bloatfly swarm", minHealth: 1, maxHealth: 5, lootTable: "food", numEnemies: 5}, + {name: "wolf", minHealth: 5, maxHealth: 10, lootTable: "food", numEnemies: 1}, ] ]; var encounterDiffTwo = [ diff --git a/files/variables.js b/files/variables.js index 501a8b3..5112ac7 100644 --- a/files/variables.js +++ b/files/variables.js @@ -50,7 +50,15 @@ var isSick = false; var sickPoints = 0; // If you accumulate 50 sick points you lose var sickSeverity = 0; // 3 levls, starting at 1 -var inventory = []; // Max of 5 items +//Player inventory +//Record all items in the player's inventory as objects with a name, item category, value, and boolean properties. Example below. +//{name: "example", category: "testItems", value: 300, use: true, eat: false, drop: true, equip: true} +var inventory = [ + //Supplies + [], + //Equipment + [] +]; var lootTables = [[],[],[],[],[]] // Only small things like food and ammo, 5 Loot tables per scavenge score, 3 items in each, first is best