diff --git a/files/main.js b/files/main.js index 44f73cb..9af4a95 100644 --- a/files/main.js +++ b/files/main.js @@ -1,3 +1,6 @@ +//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"); @@ -28,9 +31,7 @@ switch(mainMenuInput) { startGame(); break; case "2": - var array = [1, 2, 3, 4, 5]; - console.log(array); - console.log(encounterMenus.filterFaction(encounterDiffOne, "abomination")); + moreTestingShite.beginTesting(); 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 b6d07f7..64d53e3 100644 --- a/files/poiscreens.js +++ b/files/poiscreens.js @@ -1,73 +1,105 @@ +const testingShite = require("./main.js"); + module.exports = { - masterDiffArray, encounterMenuMaker, - poiMenuMaker, - filterFaction, - encounterDiffOne, + beginTesting, +} + +function beginTesting(){ + console.log(encounterMenuMaker("abomination", 1)); } 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}, +//abomination, raider, settler, BOS, NCR, Legion + +//Declare all faction arrays and difficulties +const legion1 = []; +const BOS1 = []; +const settler1 = [ {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 = [ -]; -var encounterDiffFive = [ - {name: "deathclaw", faction: "abomination", minHealth: 750, maxHealth: 1000, lootTable: "food", numEnemies: 1}, +const legion2 = []; +const BOS2 = []; +const settler2 = []; +const NCR2 = []; +const raider2 = []; +const abomination2 = []; -]; -var masterDiffArray = [encounterDiffOne, encounterDiffTwo, encounterDiffThree, encounterDiffFour, encounterDiffFive]; +const legion3 = []; +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) { - 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; -} +const legion5 = []; +const BOS5 = []; +const settler5 = []; +const NCR5 = []; +const raider5 = []; +const abomination5 = []; +//RIP the filterFactionFunction :( //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){ - let encounterDifficulty = diffWeighting*(variables.randomNumber(1, 20)); + var encounterDifficulty = diffWeighting*(variables.randomNumber(1, 20)); switch(encounterDifficulty){ case(encounterDifficulty <= 20): //var encounterDiffActual = 1; - const encountered = []; - filterFaction(encounterDiffOne, reqFaction); + switch(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; case(21 <= encounterDifficulty <= 40): - var encounterDiffActual = 2; + //var encounterDiffActual = 2; break; case(41 <= encounterDifficulty <= 60): - var encounterDiffActual = 3; + //var encounterDiffActual = 3; break; case(61 <= encounterDifficulty <= 80): - var encounterDiffActual = 4; + //var encounterDiffActual = 4; break; case(81 <= encounterDifficulty): - var encounterDiffActual = 5; + //var encounterDiffActual = 5; break; } + return encountered; } \ No newline at end of file