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,100 +1,39 @@
// Holds the global variables and useful functions such as userInput
const readline = require('readline-sync');
// Now holds only variables
module.exports = { // Lets variables and functions be used in other files
day,
location,
ammo,
food,
foodAmt,
health,
travelSpeed,
isRadiated,
radSeverity,
isSick,
sickSeverity,
inventory,
name,
prewarmoney,
caps,
locationA,
locationB,
sleep,
userInput,
randomNumber,
};
// Player Currency
export var prewarmoney = 0; // Used with enclave vendors
export var caps = 0; // Used with all other vendors
var name = '';
var prewarmoney = 0; // Used in Enclave Stores
var caps = 0; // Used everywhere
var day = 0; // Should we add a definite end? 365 Days?
var location = 0; // Location in the world, 0 is Raven Rock, 255 is New Vegas
var locationA = 0; // Location on path A,
var locationB = 0; // Location on path B, 225 is Navarro
var ammo = 0; // Used in encounters and hunting, No cap :)
var food = 0; // Max: 200
var foodAmt = 0; // Amt of food eaten per day, 3 levels, starting at 1
var health = 0; // Max: 100
var travelSpeed = 0; // Location points per day, 3 levels, starting at 1
var isRadiated = false;
var radSeverity = 0; // Modifies many things, 3 levels, starting at 1
var isSick = false;
var sickPoints = 0; // If you accumulate 50 sick points you lose
var sickSeverity = 0; // 3 levls, starting at 1
var sleepVar = 0; // Placeholder variable that allows sleep() to run a command without changing/printing somthing
/*
1 - Villified - Will attack you at all POIs and encounters
2 - Hated - Will only attack you in major POIs
3 - Disliked - Will not engage in combat and will not allow you to trade
4 - Neutral - Can trade
5 - Good - Will offer assistance and minor discounts when trading
6 - Liked - Better discounts and assistance, faction bonus
7 - Idolized - Gives faction bonus and severe discounts when trading, underarmor
Faction bonuses
* MW BOS - X-01 PA
* Legion - The Mark of Caesar, show to frumentari in locations to recieve gear
* NCR - NCR Emergency 2-Way radio, recieve supply drop when in NCR territory. Useable 3 times
* BOS - X-01 upgrade to tesla
* Enclave - X-01 upgrade to APA
*/
var reputation = {mwbos: 4, legion: 4, ncr: 2, bos: 1, enclave: 10, abomination: 0, raider: 0} //Number between 0(worst) and 10(best), 5 is neutral
//Player inventory
//Record all items in the player's inventory as objects with a name, item category, value, and boolean properties. Example below.
//{name: "example", category: "testItems", value: 300, use: true, eat: false, drop: true, equip: true}
var inventory = [
//Supplies
// Player Stats
export var healthCap = 0; // Maximum health, raises each level
export var health = 0; // Players current HP
export var food = 0; // Amount of food player has
export var isRadiated = false;
export var radSeverity = 0; // Modifies healthCapCalc. 3 Levels
export var radPoints = 0; // If the player reaches 100 rad points the game ends
export var xpPerLevel = 10; // Amount of XP needed per level. Raises 50% each level
export var level = 0; // Level of player. Modifies enemy scaling
export var inventory = [ // Inventory of player, holds all items
// Supplies: chems, aid
[],
//Equipment
// Equipment: weapons, armor, tools
[]
];
]
var lootTables = [[],[],[],[],[]] // Only small things like food and ammo, 5 Loot tables per scavenge score, 3 items in each, first is best
// Game Mechanics
export var walkRate = 0; // Units the player walks per day, affects foodRateCalc and radPointsCalc
export var foodRate = 0; // Amount of food player eats per day, affects radPointsCalc
var daysSinceScav = 0; // Days since your last scavenge, you must wait 15 days before scavenging again.
export var path = 0; // Path player is currently on, 0 = Main, 1 = A, 2 = B
export var location = 0; // Location on main path, 0-255 = main, 500-1000 = A, 1500-2000 = B
export var locationA = 0; // Location on path A
export var locationB =0; // Location on path B
export var reputation = {mwbos: 4, legion: 4, ncr: 2, bos: 1, enclave: 10, abomination: 0, raider: 0}
// Rep for each faction. Number between 0(worst) and 10(best), 5 is neutral
export var daysSinceScav = 0; // Days since player last scavenged. Must be >= 15 to scavenge again.
export var name = "placeholder"; // Player name, changed when the game starts
function userInput(question) { // Basic user input functions, takes in the question to be asked.
let answer = readline.question(question);
return(answer);
}
function randomNumber(min, max) { // Takes in two parameters, min and max, and returns a random number between those boundries.
while (true) {
var randNum = Math.floor(Math.random() * (max+1))
if (randNum >= min) { break; }
}
return randNum;
}