Create-Task/files/variables.js

102 lines
No EOL
3.2 KiB
JavaScript

// Holds the global variables and useful functions such as userInput
const readline = require('readline-sync');
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,
};
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
/*
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
[],
//Equipment
[]
];
var lootTables = [[],[],[],[],[]] // Only small things like food and ammo, 5 Loot tables per scavenge score, 3 items in each, first is best
var daysSinceScav = 0; // Days since your last scavenge, you must wait 15 days before scavenging again.
function sleep(time) { // Waits the inputed amt of miliseconds before proceeding
setTimeout(() => {}, time);
}
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;
}