Mess around with the POI menu stuff

This commit is contained in:
Caroline Foy 2025-02-27 13:44:22 -06:00
parent 0dfc20e470
commit 0c36b89ff6
2 changed files with 76 additions and 43 deletions

View file

@ -1,3 +1,6 @@
//For testing purposes
const moreTestingShite = require("./poiscreens.js");
// Program is started from here, runs functions from other files. // Program is started from here, runs functions from other files.
const variables = require("./variables.js"); const variables = require("./variables.js");
const game = require("./game.js"); const game = require("./game.js");
@ -28,9 +31,7 @@ switch(mainMenuInput) {
startGame(); startGame();
break; break;
case "2": case "2":
var array = [1, 2, 3, 4, 5]; moreTestingShite.beginTesting();
console.log(array);
console.log(encounterMenus.filterFaction(encounterDiffOne, "abomination"));
console.log("Follow the link below for a game manual.") console.log("Follow the link below for a game manual.")
console.log("[ENTER LINK HERE]") console.log("[ENTER LINK HERE]")
break; break;

View file

@ -1,73 +1,105 @@
const testingShite = require("./main.js");
module.exports = { module.exports = {
masterDiffArray,
encounterMenuMaker, encounterMenuMaker,
poiMenuMaker, beginTesting,
filterFaction, }
encounterDiffOne,
function beginTesting(){
console.log(encounterMenuMaker("abomination", 1));
} }
const variables = require("./variables.js"); const variables = require("./variables.js");
//Assign every possible encounter type to a difficulty 1-5 //abomination, raider, settler, BOS, NCR, Legion
var encounterDiffOne = [
{name: "radroach", faction: "abomination", minHealth: 1, maxHealth: 10, lootTable: "food", numEnemies: 1}, //Declare all faction arrays and difficulties
{name: "weak ghoul", faction: "abomination", minHealth: 10, maxHealth: 15, lootTable: "junk", numEnemies: 1}, const legion1 = [];
{name: "raider aspirant", faction: "raider", minHealth: 30, maxHealth: 50, lootTable: "teir1A&W", numEnemies: 1}, const BOS1 = [];
{name: "bloatfly swarm", faction: "abomination", minHealth: 1, maxHealth: 5, lootTable: "food", numEnemies: 5}, const settler1 = [
{name: "drunk", faction: "settler", minHealth: 15, maxHealth: 25, lootTable: "junk", numEnemies: 1}, {name: "drunk", faction: "settler", minHealth: 15, maxHealth: 25, lootTable: "junk", numEnemies: 1},
]; ];
var encounterDiffTwo = [ const NCR1 = [];
const raider1 = [
{name: "raider aspirant", faction: "raider", minHealth: 30, maxHealth: 50, lootTable: "teir1A&W", numEnemies: 1},
]; ];
var encounterDiffThree = [ const abomination1 = [
{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: "bloatfly swarm", faction: "abomination", minHealth: 1, maxHealth: 5, lootTable: "food", numEnemies: 5},
]; ];
var encounterDiffFour = [
]; const legion2 = [];
var encounterDiffFive = [ const BOS2 = [];
{name: "deathclaw", faction: "abomination", minHealth: 750, maxHealth: 1000, lootTable: "food", numEnemies: 1}, const settler2 = [];
const NCR2 = [];
const raider2 = [];
const abomination2 = [];
]; const legion3 = [];
var masterDiffArray = [encounterDiffOne, encounterDiffTwo, encounterDiffThree, encounterDiffFour, encounterDiffFive]; const BOS3 = [];
const settler3 = [];
const NCR3 = [];
const raider3 = [];
const abomination3 = [];
function poiMenuMaker(){ const legion4 = [];
const BOS4 = [];
} const settler4 = [];
const NCR4 = [];
const raider4 = [];
const abomination4 = [];
function filterFaction(diff, factionLook) { const legion5 = [];
var THEFACTION = []; const BOS5 = [];
for (var i = 0; i < diff.length; i++) { const settler5 = [];
if (diff[0].faction == factionLook) { const NCR5 = [];
THEFACTION.push(diff[0]); const raider5 = [];
} const abomination5 = [];
}
THEFACTION.push(diff[1]);
return THEFACTION;
}
//RIP the filterFactionFunction :(
//Creates the menu for an encounter. "faction" represents the faction for the encounter, "diffWeighting" changes the odds for //Creates the menu for an encounter. "faction" represents the faction for the encounter, "diffWeighting" changes the odds for
//an encounter's difficulty (1-5) //an encounter's difficulty (1-5)
//IGNORE THE VARIABLE COMMENTS IN THE NESTED SWITCH STATEMENT, they're placeholders for me
function encounterMenuMaker(reqFaction, diffWeighting){ function encounterMenuMaker(reqFaction, diffWeighting){
let encounterDifficulty = diffWeighting*(variables.randomNumber(1, 20)); var encounterDifficulty = diffWeighting*(variables.randomNumber(1, 20));
switch(encounterDifficulty){ switch(encounterDifficulty){
case(encounterDifficulty <= 20): case(encounterDifficulty <= 20):
//var encounterDiffActual = 1; //var encounterDiffActual = 1;
const encountered = []; switch(reqFaction){
filterFaction(encounterDiffOne, reqFaction); case "legion":
var encountered = legion1[variables.randomNumber(0, legion1.length)];
break;
case "BOS":
var encountered = BOS1[variables.randomNumber(0, BOS1.length)];
break;
case "NCR":
var encountered = NCR1[variables.randomNumber(0, NCR1.length)];
break;
case "raider":
var encountered = raider1[variables.randomNumber(0, raider1.length)];
break;
case "settler":
var encountered = settler1[variables.randomNumber(0, settler1.length)];
break;
case "abomination":
var encountered = abomination1[variables.randomNumber(0, abomination1.length)];
break;
}
break; break;
case(21 <= encounterDifficulty <= 40): case(21 <= encounterDifficulty <= 40):
var encounterDiffActual = 2; //var encounterDiffActual = 2;
break; break;
case(41 <= encounterDifficulty <= 60): case(41 <= encounterDifficulty <= 60):
var encounterDiffActual = 3; //var encounterDiffActual = 3;
break; break;
case(61 <= encounterDifficulty <= 80): case(61 <= encounterDifficulty <= 80):
var encounterDiffActual = 4; //var encounterDiffActual = 4;
break; break;
case(81 <= encounterDifficulty): case(81 <= encounterDifficulty):
var encounterDiffActual = 5; //var encounterDiffActual = 5;
break; break;
} }
return encountered;
} }