From 0dfc20e470404e7598147009ff9e03f4c30baecc Mon Sep 17 00:00:00 2001 From: Caroline Foy Date: Wed, 26 Feb 2025 15:38:51 -0600 Subject: [PATCH] Hi --- files/game.js | 2 +- files/main.js | 4 +++ files/poiscreens.js | 73 ++++++++++++++++++++++++++++++++++++++++++++- files/shops.js | 2 +- 4 files changed, 78 insertions(+), 3 deletions(-) diff --git a/files/game.js b/files/game.js index c793cf3..355bcca 100644 --- a/files/game.js +++ b/files/game.js @@ -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) { diff --git a/files/main.js b/files/main.js index 8d43160..44f73cb 100644 --- a/files/main.js +++ b/files/main.js @@ -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; diff --git a/files/poiscreens.js b/files/poiscreens.js index 5f3ccdf..b6d07f7 100644 --- a/files/poiscreens.js +++ b/files/poiscreens.js @@ -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; + } +} \ No newline at end of file diff --git a/files/shops.js b/files/shops.js index fd7f663..98c7559 100644 --- a/files/shops.js +++ b/files/shops.js @@ -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