This commit is contained in:
Raktbastr 2025-04-03 11:10:35 -05:00
parent 8871c644fb
commit e5fe71ce46
16 changed files with 573 additions and 638 deletions

View file

@ -1,249 +1,218 @@
const variables = require("./variables.js");
const combat = require("./combat.js");
// Holds poi code, seperate from encounters.js
module.exports = {
encounterMenuMaker,
initializeEncounter,
poiCounter,
pois,
import { userInput } from "./functions.js";
import { location, locationA, locationB, path } from "./variables.js";
export function checkPOI() {
if (path == 0) {
if (location >= (pois[poiCounter].location)-3 && location <= pois[poiCounter].location && pois[poiCounter].visited == false) {
switch(pois[poiCounter].name) {
case "Whitespring Bunker":
whitespring();
break;
case "BOS Bunker Gamma":
bosGamma();
break;
case "BOS Bunker Delta":
bosDelta();
break;
case "BOS Bunker Epsilon":
bosEpsilon();
break;
case "Vault 0":
vault0();
break;
case "Tibbets Prison":
tibbets();
break;
case "Flagstaff":
flagstaff();
break;
case "New Vegas":
newVegas();
}
}
}
if (path == 1) {
if (locationA >= (pois[poiCounter].location)-3 && locationA <= pois[poiCounter].location && pois[poiCounter].visited == false) {
switch(pois[poiCounter].name) {
case "Mojave Outpost":
mojaveOutpost();
break;
case "Necropolis":
necropolis();
break;
case "The Hub":
hub();
break;
case "Lost Hills":
lostHills();
break;
case "Mariposa MB":
mariposa();
break;
case "San Francisco":
sanFrancisco();
break;
case "Camp Navarro":
navarro();
break;
}
}
}
if (path == 2) {
if (locationB >= (pois[poiCounter].location)-3 && locationB <= pois[poiCounter].location && pois[poiCounter].visited == false) {
switch(pois[poiCounter].name) {
case "Canyon Wreckage":
canyonWreck();
break;
case "Hopeville & Ashton":
hopeville();
break;
case "The Sierra Madre":
sierraMadre();
break;
case "Shady Sands":
shadySands();
break;
case "New Reno":
newReno();
break;
case "Redding":
redding();
break;
case "Eureka":
eureka();
break;
case "Camp Navarro":
navarro();
}
}
}
}
function initializeEncounter(reqFaction, diffWeighting, fight, flee, forceFaction){
var encounter = encounterMenuMaker(reqFaction, diffWeighting, forceFaction);
export var poiCounter = 0;
export var pois = [
{name: "Whitespring Bunker", location: 25, path: 0, visited: false},
{name: "BOS Bunker Gamma", location: 100, path: 0, visited: false},
{name: "BOS Bunker Delta", location: 125, path: 0, visited: false},
{name: "BOS Bunker Epsilon", location: 175, path: 0, visited: false},
{name: "Vault 0", location: 200, path: 0, visited: false},
{name: "Tibbets Prison", location: 250, path: 0, visited: false},
{name: "Flagstaff", location: 275, path: 0, visited: false},
{name: "New Vegas", location: 300, path: 0, visited: false},
{name: "Mojave Outpost", location: 5, path: 1, visited: false},
{name: "Necropolis", location: 10, path: 1, visited: false},
{name: "The Hub", location: 15, path: 1, visited: false},
{name: "Lost Hills", location: 20, path: 1, visited: false},
{name: "Mariposa MB", location: 30, path: 1, visited: false},
{name: "San Franciso", location: 35, path: 1, visited: false},
{name: "Camp Navarro", location: 45, path: 1, visited: false},
{name: "Canyon Wreckage", location: 5, path: 2, visited: false},
{name: "Hopeville & Ashton", location: 15, path: 2, visited: false},
{name: "The Sierra Madre", location: 25, path: 2, visited: false},
{name: "Shady Sands", location: 35, path: 2, visited: false},
{name: "New Reno", location: 55, path: 2, visited: false},
{name: "Redding", location: 75, path: 2, visited: false},
{name: "Eureka", location: 85, path: 2, visited: false},
{name: "Camp Navarro", location: 100, path: 2, visited: false},
]
function whitespring() {
}
function bosGamma() {
}
function bosDelta() {
}
function bosEpsilon() {
}
function vault0() {
}
function tibbets() {
}
function flagstaff() {
}
function newVegas() {
// The below is placeholder, once we add proper code delete this
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;
console.log(playerOptions + ") Inventory");
playerOptions++
if(fight == true){
console.log(playerOptions + ") Fight");
playerOptions++;
console.log("Ahead lies 2 routes to Navarro.");
console.log("The northern route passes through the Divide before going north through the mountains.\nIt offers a longer path with fewer possible enimies, but those you face will not back down.")
console.log("The southern route goes through the heart of the NCR along I-15.\nIt is shorter and more pleasant, however without proper reputation your many stops may become worrisome.")
var pathChoice = userInput("Which path would you like to follow, Northern or Southern? ");
if (pathChoice.toLowerCase == "northern") {
path = 2;
}
if(flee == true){
console.log(playerOptions + ") Flee");
playerOptions++;
}
while(true) {
let encounterInput = variables.userInput("Enter: ")
switch(mainMenuInput) {
case "1":
console.log(variables.inventory);
case "2":
combat.initCombat(encounter);
break;
case "3":
if (variables.reputation.reqFaction < 4) {
if (variables.randomNumber(1,100) < 40){
console.log("You tried to flee... but they noticed you.");
combat.initCombat(encounter);
}
}
}
if (pathChoice.toLowerCase == "southern") {
path = 1;
}
}
//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},
],
//MWBOS
[]
];
var encounterDiffTwo = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[],
//MWBOS
[]
];
var encounterDiffThree = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[],
//MWBOS
[]
];
var encounterDiffFour = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[],
//MWBOS
[]
];
var encounterDiffFive = [
//NCR
[],
//Legion
[],
//Raider
[],
//Settler
[],
//BOS
[],
//Abomination
[],
//MWBOS
[]
];
function mojaveOutpost() {
//RIP the filterFactionFunction :(
//Declaring some stuff to make them global variables
var faction = 0;
let encountered = [];
//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(reqFactionEMM, diffWeightingEMM, forceOptEMM){
switch(diffWeightingEMM){
case 1:
reqFactionEMM = encounterDiffOne
break;
case 2:
reqFactionEMM = encounterDiffTwo
break;
case 3:
reqFactionEMM = encounterDiffThree
break;
case 4:
reqFactionEMM = encounterDiffFour
break;
case 5:
reqFactionEMM = encounterDiffFive
break;
}
var encounterDifficulty = (diffWeightingEMM * variables.randomNumber(1, 20));
factionFailsafe = reqFactionEMM.toLowerCase();
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;
case "MWBOS":
faction = 6;
break;
}
if (forceOptEMM == true) {
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[encountered.length - 1];
} else {
let x = variables.randomNumber(0, 100)
if (x >= 75) {
if (x <=80) {
encountered.push(encounterDiffOne[raider][variables.randomNumber(0, encounterDiffOne[raider].length - 1)])
}
if (x <=90) {
encountered.push(encounterDiffOne[settler][variables.randomNumber(0, encounterDiffOne[settler].length - 1)])
}
if (x <=100) {
encountered.push(encounterDiffOne[abomination][variables.randomNumber(0, encounterDiffOne[abomination].length - 1)])
}
}
if (x < 75) {
encountered.push(encounterDiffOne[faction][variables.randomNumber(0, encounterDiffOne[faction].length - 1)])
}
}
}
var poiCounter = 0;
var pois = [
{name: "Whitespring Bunker", location: 25, path: 0},
{name: "BOS Bunker Gamma", location: 100, path: 0},
{name: "BOS Bunker Delta", location: 125, path: 0},
{name: "BOS Bunker Epsilon", location: 175, path: 0},
{name: "Vault 0", location: 200, path: 0},
{name: "Tibbets Prison", location: 250, path: 0},
{name: "Flagstaff", location: 275, path: 0},
{name: "New Vegas", location: 300, path: 0},
{name: "Mojave Outpost", location: 5, path: 1},
{name: "Necropolis", location: 10, path: 1},
{name: "The Hub", location: 15, path: 1},
{name: "Lost Hills", location: 20, path: 1},
{name: "Mariposa MB", location: 30, path: 1},
{name: "San Franciso", location: 35, path: 1},
{name: "Camp Navarro", location: 45, path: 1},
{name: "Canyon Wreckage", location: 5, path: 2},
{name: "Hopeville & Ashton", location: 15, path: 2},
{name: "The Sierra Madre", location: 25, path: 2},
{name: "Shady Sands", location: 35, path: 2},
{name: "New Reno", location: 55, path: 2},
{name: "Redding", location: 75, path: 2},
{name: "Eureka", location: 85, path: 2},
{name: "Camp Navarro", location: 100, path: 2},
]
function necropolis() {
}
function hub() {
}
function lostHills() {
}
function mariposa() {
}
function sanFrancisco() {
}
function canyonWreck() {
}
function hopeville() {
}
function sierraMadre() {
}
function shadySands() {
}
function newReno() {
}
function redding() {
}
function eureka() {
}
function navarro() {
}