Add other files and some variables/functions.
This commit is contained in:
parent
891d93be65
commit
cc6aaedc32
7 changed files with 66 additions and 0 deletions
1
files/huntinggame.js
Normal file
1
files/huntinggame.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
// Hunting Game, if we even decide to do it.
|
||||
1
files/main.js
Normal file
1
files/main.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
// Program is started from here, runs functions from other files.
|
||||
1
files/poiscreens.js
Normal file
1
files/poiscreens.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
// Holds the screens for every POI including thier menus.
|
||||
1
files/rivercrossing.js
Normal file
1
files/rivercrossing.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
// River crossing screens and options.
|
||||
1
files/stoptravelmenu.js
Normal file
1
files/stoptravelmenu.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
// Halt travel screen and menu.
|
||||
60
files/variables.js
Normal file
60
files/variables.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
// Holds the global variables, functions, and math operations such as the day counter and food eaten..
|
||||
|
||||
var day = 0; // Should we add a definite end? 365 Days?
|
||||
|
||||
var ammo = 0; // 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; // 3 levels, starting at 1
|
||||
|
||||
var isRadiated = false;
|
||||
var radSeverity = 0; // 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 inventory = []; // Max of 5 items
|
||||
|
||||
var lootTables = [[],[],[],[],[]] // 5 Loot tables per scavenge score, 3 items in each, first is best
|
||||
|
||||
function eatfood() {
|
||||
if (isSick == true) { food = food-((travelSpeed*foodAmt)+sickSeverity); }
|
||||
else { food = food-(travelSpeed*3); }
|
||||
health = health+(5*foodAmt);
|
||||
}
|
||||
|
||||
function calcSickPoints() {
|
||||
if (isSick = true) {
|
||||
sickPoints = sickPoints+((sickSeverity-(0.5*foodAmt))+(0.5*(travelSpeed+radSeverity)));
|
||||
}
|
||||
}
|
||||
|
||||
function scavenge() {
|
||||
let luck = Math.random(1,100);
|
||||
if (luck <= 20) {
|
||||
let group = 0;
|
||||
let random = Math.random(lootTables[group][0], lootTables[group][3]);
|
||||
inventory.push(random);
|
||||
} else if (luck <= 40) {
|
||||
let group = 1;
|
||||
let random = Math.random(lootTables[group][0], lootTables[group][3]);
|
||||
inventory.push(random);
|
||||
} else if (luck <= 60) {
|
||||
let group = 2;
|
||||
let random = Math.random(lootTables[group][0], lootTables[group][3]);
|
||||
inventory.push(random);
|
||||
} else if (luck <= 80) {
|
||||
let group = 3;
|
||||
let random = Math.random(lootTables[group][0], lootTables[group][3]);
|
||||
inventory.push(random);
|
||||
} else if (luck <= 100) {
|
||||
let group = 4;
|
||||
let random = Math.random(lootTables[group][0], lootTables[group][3]);
|
||||
inventory.push(random);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue