Merge branch 'Temp-main-for-fixing'

This commit is contained in:
Raktbastr 2025-04-28 13:33:28 -05:00
commit 2e68c920ff
2 changed files with 22 additions and 0 deletions

View file

@ -5,10 +5,16 @@ import './variables.js';
//5-50 abominations, 51-200 MWBOS, 201-255 legion, a5-a40 NCR, b0-b30 abomination, b40-b80 abomination, b90+ NCR, b80-b90 enclave //5-50 abominations, 51-200 MWBOS, 201-255 legion, a5-a40 NCR, b0-b30 abomination, b40-b80 abomination, b90+ NCR, b80-b90 enclave
//HLE = high level encounter, this is a filter that determines if the player can get, as the name implies, high level encounters //HLE = high level encounter, this is a filter that determines if the player can get, as the name implies, high level encounters
//This function, which is called whenever the player moves, runs a quick calculation to determine if the player encounters
//an enemy. If they do encounter an enemy, the function uses the player's location to determine which enemy they encounter.
//The farther the player goes, the more likely they are to encounter a high-level enemy. Enemies scale in health and damage with
//the player's level.
export function naturalEncounter(location){ export function naturalEncounter(location){
var HLE = false; var HLE = false;
var encounter = false; var encounter = false;
var encounterLuck = randomNumber(1, 100); var encounterLuck = randomNumber(1, 100);
//Checks if the player gets an encounter, and what enemy pool the encounter comes from.
if(location > 250){ if(location > 250){
HLE = true; HLE = true;
} }
@ -48,6 +54,7 @@ export function naturalEncounter(location){
} }
} }
//Draws the enemy/encounter from an array of different possible encounters.
if(encounter != false){ if(encounter != false){
switch(encounter){ switch(encounter){
case "abomination": case "abomination":
@ -133,6 +140,8 @@ export function naturalEncounter(location){
} }
}; };
//Used for when we need to ensure that the player encounters an enemy somewhere. Also used for combat testing.
//Function takes in the faction of the enemy, and if the enemy can be/has to be a high level encounter.
export function forcedEncounter(HLE, faction, forcedHLE){ export function forcedEncounter(HLE, faction, forcedHLE){
var HLEDeterminant = randomNumber(1, 2) var HLEDeterminant = randomNumber(1, 2)
if((HLE == true && HLEDeterminant == 1) || forcedHLE == true){ if((HLE == true && HLEDeterminant == 1) || forcedHLE == true){
@ -172,6 +181,7 @@ export function forcedEncounter(HLE, faction, forcedHLE){
} }
} }
//A list of arrays with every possible enemy encounter, as well as their stats and equipment.
var raiderEncounters = [ var raiderEncounters = [
{name: "Raider Aspirant", faction: "raider", minLevel: 1, maxLevel: 15, health: 10, weapon: equipmentList[2], armor: equipmentList[10]}, {name: "Raider Aspirant", faction: "raider", minLevel: 1, maxLevel: 15, health: 10, weapon: equipmentList[2], armor: equipmentList[10]},
{name: "Raider", faction: "raider", minLevel: 15, maxLevel: 25, health: 10, weapon: equipmentList[2], armor: equipmentList[10]}, {name: "Raider", faction: "raider", minLevel: 15, maxLevel: 25, health: 10, weapon: equipmentList[2], armor: equipmentList[10]},

View file

@ -4,6 +4,9 @@ import { userInput, pauseScreen, enableRawMode, disableRawMode, sleep } from "./
import './variables.js'; import './variables.js';
import { whitespringStore, trader, eurekaStore, newVegasStore, vaultZeroStore } from "./shops.js"; import { whitespringStore, trader, eurekaStore, newVegasStore, vaultZeroStore } from "./shops.js";
//This function uses a switch statement to determine the player's location within a given range. If said location IS
//within the given range, the statement will call a seperate function to declare that the player is in a point of interest,
//building the player's screen to match that.
export function checkPOI() { export function checkPOI() {
if (path == 0) { if (path == 0) {
if (location >= (pois[poiCounter].location)-3 && location <= pois[poiCounter].location && pois[poiCounter].visited == false) { if (location >= (pois[poiCounter].location)-3 && location <= pois[poiCounter].location && pois[poiCounter].visited == false) {
@ -92,6 +95,8 @@ export function checkPOI() {
} }
} }
//This array holds important information about every point of interest in the game, such as its name, locaiton on the
//player's path, and a boolean for if it has been visited by the player yet.
global.poiCounter = 0; global.poiCounter = 0;
global.pois = [ global.pois = [
{name: "Whitespring Bunker", location: 25, path: 0, visited: false}, {name: "Whitespring Bunker", location: 25, path: 0, visited: false},
@ -119,7 +124,12 @@ global.pois = [
{name: "Camp Navarro", location: 100, path: 2, visited: false}, {name: "Camp Navarro", location: 100, path: 2, visited: false},
] ]
//EVERY POI FUNCTION WORKS THE SAME, THE ONLY DIFFERENCE IS THAT THEY EACH CALL THEIR RESPECTIVE DIALOGUE AND
//SHOP FUNCTIONS.
//This function builds the POI the player has reached. In this instance, it builds the POI called "The Whitespring".
function whitespring() { function whitespring() {
//Basic introductory message, along with changing the game's basic functioning with the raw mode command.
disableRawMode(); disableRawMode();
console.clear(); console.clear();
sleep(1); sleep(1);
@ -131,6 +141,8 @@ function whitespring() {
console.log("3) Open your PIP-Boy"); console.log("3) Open your PIP-Boy");
console.log("4) Leave"); console.log("4) Leave");
let whitespringInput = userInput("Enter: "); let whitespringInput = userInput("Enter: ");
//Switch statement changes depending on the user's input, allowing them to explore the POI, talk or trade with the locals,
//check their stats, or leave if they wish to.
switch(whitespringInput) { switch(whitespringInput) {
case "1": case "1":
console.clear(); console.clear();