This commit is contained in:
Caroline Foy 2025-02-26 15:38:51 -06:00
parent 6e476dcf14
commit 0dfc20e470
4 changed files with 78 additions and 3 deletions

View file

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

View file

@ -3,6 +3,7 @@ const variables = require("./variables.js");
const game = require("./game.js");
const shops = require("./shops");
const readline = require('node:readline');
const encounterMenus = require("./poiscreens.js");
console.clear();
console.log("__________________________________________________________________________________________________________________________________");
@ -27,6 +28,9 @@ switch(mainMenuInput) {
startGame();
break;
case "2":
var array = [1, 2, 3, 4, 5];
console.log(array);
console.log(encounterMenus.filterFaction(encounterDiffOne, "abomination"));
console.log("Follow the link below for a game manual.")
console.log("[ENTER LINK HERE]")
break;

View file

@ -1,2 +1,73 @@
// Holds the screens for every POI including thier menus.
module.exports = {
masterDiffArray,
encounterMenuMaker,
poiMenuMaker,
filterFaction,
encounterDiffOne,
}
const variables = require("./variables.js");
//Assign every possible encounter type to a difficulty 1-5
var encounterDiffOne = [
{name: "radroach", faction: "abomination", minHealth: 1, maxHealth: 10, lootTable: "food", numEnemies: 1},
{name: "weak ghoul", faction: "abomination", minHealth: 10, maxHealth: 15, lootTable: "junk", numEnemies: 1},
{name: "raider aspirant", faction: "raider", minHealth: 30, maxHealth: 50, lootTable: "teir1A&W", numEnemies: 1},
{name: "bloatfly swarm", faction: "abomination", minHealth: 1, maxHealth: 5, lootTable: "food", numEnemies: 5},
{name: "drunk", faction: "settler", minHealth: 15, maxHealth: 25, lootTable: "junk", numEnemies: 1},
];
var encounterDiffTwo = [
];
var encounterDiffThree = [
];
var encounterDiffFour = [
];
var encounterDiffFive = [
{name: "deathclaw", faction: "abomination", minHealth: 750, maxHealth: 1000, lootTable: "food", numEnemies: 1},
];
var masterDiffArray = [encounterDiffOne, encounterDiffTwo, encounterDiffThree, encounterDiffFour, encounterDiffFive];
function poiMenuMaker(){
}
function filterFaction(diff, factionLook) {
var THEFACTION = [];
for (var i = 0; i < diff.length; i++) {
if (diff[0].faction == factionLook) {
THEFACTION.push(diff[0]);
}
}
THEFACTION.push(diff[1]);
return THEFACTION;
}
//Creates the menu for an encounter. "faction" represents the faction for the encounter, "diffWeighting" changes the odds for
//an encounter's difficulty (1-5)
function encounterMenuMaker(reqFaction, diffWeighting){
let encounterDifficulty = diffWeighting*(variables.randomNumber(1, 20));
switch(encounterDifficulty){
case(encounterDifficulty <= 20):
//var encounterDiffActual = 1;
const encountered = [];
filterFaction(encounterDiffOne, reqFaction);
break;
case(21 <= encounterDifficulty <= 40):
var encounterDiffActual = 2;
break;
case(41 <= encounterDifficulty <= 60):
var encounterDiffActual = 3;
break;
case(61 <= encounterDifficulty <= 80):
var encounterDiffActual = 4;
break;
case(81 <= encounterDifficulty):
var encounterDiffActual = 5;
break;
}
}

View file

@ -32,7 +32,7 @@ function eureka() {
// 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 = [];
for (var a = 0; a <= 2; a++) {
let randomPick = Math.m