Merge remote-tracking branch 'origin/Finishing-Menuing'

This commit is contained in:
Raktbastr 2025-03-12 11:09:10 -05:00
commit 42bf2a484a
6 changed files with 228 additions and 6 deletions

View file

@ -10,7 +10,7 @@ module.exports = {
calcLocation, calcLocation,
} }
function eatfood() { function eatFood() {
if (variables.food == 0) { if (variables.food == 0) {
variables.health - 3*variables.travelSpeed variables.health - 3*variables.travelSpeed
} else if (variables.isSick == true) { } else if (variables.isSick == true) {

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

@ -3,6 +3,8 @@ const variables = require("./variables.js");
const game = require("./game.js"); const game = require("./game.js");
const shops = require("./shops"); const shops = require("./shops");
const readline = require('node:readline'); const readline = require('node:readline');
const encounterMenus = require("./poiscreens.js");
const inventoryStuff = require("./inventory.js");
console.clear(); console.clear();
console.log("__________________________________________________________________________________________________________________________________"); console.log("__________________________________________________________________________________________________________________________________");
@ -19,6 +21,7 @@ console.log("--------------------------");
console.log("1) Start new game"); console.log("1) Start new game");
console.log("2) Learn How to play"); console.log("2) Learn How to play");
console.log("3) Quit Game"); console.log("3) Quit Game");
console.log("4) Dev stuff for testing");
var mainMenuInput = variables.userInput("Enter: ") var mainMenuInput = variables.userInput("Enter: ")
@ -34,6 +37,9 @@ switch(mainMenuInput) {
console.log("Quitting Game..."); console.log("Quitting Game...");
variables.sleep(1000); variables.sleep(1000);
break; break;
case "4":
inventoryStuff.inventoryMenuM();
break;
} }
function startGame() { // So far what I have is filler and testing, feel free to change. function startGame() { // So far what I have is filler and testing, feel free to change.
@ -44,9 +50,9 @@ function startGame() { // So far what I have is filler and testing, feel free to
variables.sleep(2000); variables.sleep(2000);
console.clear(); console.clear();
console.log("Intro:"); 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(); console.clear();
variables.prewarmoney = 500; variables.prewarmoney = 500;

View file

@ -1,2 +1,157 @@
// Holds the screens for every POI including thier menus.
const variables = require("./variables.js"); const variables = require("./variables.js");
module.exports = {
encounterMenuMaker,
initializeEncounter,
}
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");
}
//Add any new encounter ideas to their required faction and difficulty
var encounterDiffOne = [
//NCR
[],
//Legion
[],
//Raider
[
{name: "raider aspirant", minHealth: 30, maxHealth: 50, lootTable: "teir1A&W", numEnemies: 1},
],
//Settler
[
{name: "drunk", minHealth: 15, maxHealth: 25, lootTable: "junk", numEnemies: 1},
],
//BOS
[],
//Abomination
[
{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 = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[]
];
var encounterDiffThree = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[]
];
var encounterDiffFour = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[]
];
var encounterDiffFive = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[]
];
//RIP the filterFactionFunction :(
//Declaring some stuff to make them global variables
var encountered = [];
var faction = 0;
//Creates the menu for an encounter. "faction" represents the faction for the encounter, "diffWeighting" changes the odds for
//an encounter's difficulty (1-5)
//IGNORE THE VARIABLE COMMENTS IN THE NESTED SWITCH STATEMENT, they're placeholders for me
function encounterMenuMaker(reqFaction, diffWeighting){
var encounterDifficulty = (diffWeighting * variables.randomNumber(1, 20));
if((reqFaction != "NCR") && (reqFaction != "BOS")){
factionFailsafe = reqFaction.toLowerCase();
} else {
factionFailsafe = reqFaction;
}
switch(factionFailsafe){
case "NCR":
faction = 0;
break;
case "legion":
faction = 1;
break;
case "raider":
faction = 2;
break;
case "settler":
faction = 3;
break;
case "BOS":
faction = 4;
break;
case "abomination":
faction = 5;
break;
}
if(encounterDifficulty <= 20){
encountered.push(encounterDiffOne[faction][variables.randomNumber(0, encounterDiffOne[faction].length - 1)]);
} else if(21 <= encounterDifficulty <= 40){
encountered.push(encounterDiffTwo[faction][variables.randomNumber(0, encounterDiffTwo[faction].length - 1)]);
} else if(41 <= encounterDifficulty <= 60){
encountered.push(encounterDiffThree[faction][variables.randomNumber(0, encounterDiffThree[faction].length - 1)]);
} else if(61 <= encounterDifficulty <= 80){
encountered.push(encounterDiffFour[faction][variables.randomNumber(0, encounterDiffFour[faction].length - 1)]);
} else {
encountered.push(encounterDiffFive[faction][variables.randomNumber(0, encounterDiffFive[faction].length - 1)]);
}
return encountered[0];
}

View file

@ -32,7 +32,7 @@ function eureka() {
// purchasing code // purchasing code
} }
function trader() { // One of the 3 trader inventories, chosen randomly function trader() { // Picks a selection of items from a global trader inventory
var tempTraderInv = []; var tempTraderInv = [];
for (var a = 0; a <= 2; a++) { for (var a = 0; a <= 2; a++) {
let randomPick = Math.m let randomPick = Math.m

View file

@ -50,7 +50,15 @@ var isSick = false;
var sickPoints = 0; // If you accumulate 50 sick points you lose var sickPoints = 0; // If you accumulate 50 sick points you lose
var sickSeverity = 0; // 3 levls, starting at 1 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 var lootTables = [[],[],[],[],[]] // Only small things like food and ammo, 5 Loot tables per scavenge score, 3 items in each, first is best