More changes to menuing, added a basic inventory

system
This commit is contained in:
Caroline Foy 2025-03-10 12:05:17 -05:00
parent f732586c24
commit 6ca88b7c6f
4 changed files with 90 additions and 12 deletions

53
files/inventory.js Normal file
View file

@ -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();
}

View file

@ -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;

View file

@ -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 = [

View file

@ -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