Add map and deathscreen files, add exports to variable file.

This commit is contained in:
Raktbastr 2025-02-22 10:31:14 -06:00
parent ef3035f944
commit 455a867719
4 changed files with 90 additions and 8 deletions

29
files/deathscreens.js Normal file
View file

@ -0,0 +1,29 @@
// Deathscreens, they should be the fallout 1 screens
module.exports = {
deathScreen,
timeDeath
};
function deathScreen() {
let random = Math.random(1,3);
if (random = 1) { death1(); }
if (random = 2) { death2(); }
if (random = 3) { death3(); }
}
function death1() {
}
function death2() {
}
function death3() {
}
function timeDeath() { // The death screen for passing the time limit
}

View file

@ -1,14 +1,13 @@
// Program is started from here, runs functions from other files. // Program is started from here, runs functions from other files.
const huntingGame = require("./huntinggame.js");
const variables = require("./variables.js"); const variables = require("./variables.js");
console.clear(); console.clear();
console.log("__________________________________________________________________________________________________________________________________"); console.log("__________________________________________________________________________________________________________________________________");
console.log("    _____                                          _                                                    ____                      "); console.log(" _____ _ ____ ");
console.log("    /    '         /   /                           /                                                    /    )                   /"); console.log(" / ' / / / / ) /");
console.log("---/__-------__---/---/----__---------_/_---------/-------__----__----__---__----__---_--_----__-------/___ /----__----__----__-/-"); console.log("---/__-------__---/---/----__---------_/_---------/-------__----__----__---__----__---_--_----__-------/___ /----__----__----__-/-");
console.log("  /        /   ) /   /   /   ) /   /  /   o      /      /   ) /   ) /___) (_ ` /   ) / /  ) /___)     /    |   /   ) /   ) /   /  "); console.log(" / / ) / / / ) / / / o / / ) / ) /___) (_ ` / ) / / ) /___) / | / ) / ) / / ");
console.log("_/________(___(_/___/___(___/_(___(__(_ __o_____/____/_(___/_/___/_(___ _(__)_(___/_/_/__/_(___ _____/_____|__(___/_(___(_(___/___"); console.log("_/________(___(_/___/___(___/_(___(__(_ __o_____/____/_(___/_/___/_(___ _(__)_(___/_/_/__/_(___ _____/_____|__(___/_(___(_(___/___");
console.log("Credits: Bethesda Game Studio") console.log("Credits: Bethesda Game Studio")
variables.sleep(1000); variables.sleep(1000);

1
files/map.js Normal file
View file

@ -0,0 +1 @@
// Map Screen

View file

@ -1,11 +1,31 @@
// Holds the global variables, functions, and math operations such as the day counter and food eaten.. // Holds the global variables, functions, and math operations such as the day counter and food eaten..
const death = require("./deathscreens");
module.exports = { module.exports = {
sleep day,
location,
ammo,
food,
foodAmt,
health,
travelSpeed,
isRadiated,
radSeverity,
isSick,
sickSeverity,
inventory,
eatfood,
calcLocation,
calcSickPoints,
scavenge,
sleep,
checkLose,
}; };
var day = 0; // Should we add a definite end? 365 Days? var day = 0; // Should we add a definite end? 365 Days?
var location = 0; // Location in the world, 0 is Control Station Enclave, 200 is Raven rock.
var ammo = 0; // No cap :) var ammo = 0; // No cap :)
var food = 0; // Max: 200 var food = 0; // Max: 200
@ -27,8 +47,9 @@ var inventory = []; // Max of 5 items
var lootTables = [[],[],[],[],[]] // 5 Loot tables per scavenge score, 3 items in each, first is best var lootTables = [[],[],[],[],[]] // 5 Loot tables per scavenge score, 3 items in each, first is best
function eatfood() { function eatfood() {
if (food == 0) { health - 20 }
if (isSick == true) { food = food-((travelSpeed*foodAmt)+sickSeverity); } if (isSick == true) { food = food-((travelSpeed*foodAmt)+sickSeverity); }
else { food = food-(travelSpeed*3); } else { food = food-(travelSpeed*foodAmt); }
health = health+(5*foodAmt); health = health+(5*foodAmt);
} }
@ -67,3 +88,35 @@ function sleep(time) {
setTimeout(() => {}, time); setTimeout(() => {}, time);
} }
function checkLose() {
if (health <= 0 || sickPoints >= 50) {
deathScreen();
}
if (day >= 365) {
timeDeath();
}
}
function calcLocation() { // You move your move speed per day, but 3/4 of it if you are sick
if (travelSpeed == 1) {
if (isSick == true) {
location = location+0.75;
} else {
location++;
}
}
if (travelSpeed == 2) {
if (isSick == true) {
location = location+1.5;
} else {
location = location+2;
}
}
if (travelSpeed == 3) {
if (isSick == true) {
location = location+2.25;
} else {
location = location+3;
}
}
}