82 lines
No EOL
2.3 KiB
JavaScript
82 lines
No EOL
2.3 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,
|
|
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
|
|
|
|
//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;
|
|
} |