The Final commit before turn-in (hopefully)
This commit is contained in:
parent
44a4cf65bd
commit
77cb3f4613
8 changed files with 265 additions and 148 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import './variables.js';
|
||||
import {userInput} from './functions.js';
|
||||
import { randomNumber, userInput } from './functions.js';
|
||||
import { inventoryMenuM } from './inventory.js';
|
||||
|
||||
function initCombat(enemy) {
|
||||
if (enemy.minLevel > level) {
|
||||
|
|
@ -23,53 +24,127 @@ function initCombat(enemy) {
|
|||
function combat(enemy) {
|
||||
console.clear();
|
||||
console.log("You enter combat with "+enemy.name+"...");
|
||||
let combatInput;
|
||||
while (true) {
|
||||
console.log("What would you like to do?");
|
||||
console.log("-----------------------");
|
||||
console.log("1) Attack");
|
||||
console.log("2) Check your Inventory");
|
||||
console.log("3) View Stats");
|
||||
var combatInput = userInput("Enter: ");
|
||||
combatInput = userInput("Enter: ");
|
||||
|
||||
if (combatInput != "1" && combatInput != "2" && combatInput != "3") {
|
||||
console.log("Invalid input. Please enter 1, 2, or 3.");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(combatInput) {
|
||||
case "1":
|
||||
console.log("You attack "+enemy.name+" with your "+equippedWeapon.name+"!");
|
||||
sleep(2);
|
||||
let attackRoll = randomNumber(1,100);
|
||||
if (attackRoll <= 10) {
|
||||
console.log("You critically hit "+enemy.name+" dealing "+damageCalc(player, true)+" damage!");
|
||||
sleep(2);
|
||||
} else if (attackRoll <= 50) {
|
||||
console.log("You hit "+enemy.name+" dealing "+damageCalc(player, false)+" damage!");
|
||||
sleep(2);
|
||||
} else if (attackRoll <= 90) {
|
||||
console.log("You miss "+enemy.name+"!");
|
||||
sleep(2);
|
||||
} else {
|
||||
console.log("You critically miss "+enemy.name+", dealing 3 damage to yourself!");
|
||||
health-3;
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
console.log(enemy.name+" Attacks you with thier "+enemyStats.weapon.name+"!");
|
||||
sleep(2);
|
||||
let enemyRoll = randomNumber(1,100);
|
||||
if (attackRoll <= 10) {
|
||||
console.log(enemy.name+" critically hit you dealing "+damageCalc(enemy, true)+" damage!");
|
||||
sleep(2);
|
||||
} else if (attackRoll <= 50) {
|
||||
console.log(enemy.name+" hit you dealing "+damageCalc(player, false)+" damage!");
|
||||
sleep(2);
|
||||
} else if (attackRoll <= 90) {
|
||||
console.log(enemy.name+" misses you!");
|
||||
sleep(2);
|
||||
} else {
|
||||
console.log(enemy.name+" critically misses, dealing 3 damage to themself!");
|
||||
enemyStats.health-3;
|
||||
sleep(2);
|
||||
}
|
||||
case "2":
|
||||
inventoryMenuM();
|
||||
break;
|
||||
case "3":
|
||||
console.clear();
|
||||
console.log("Player Stats");
|
||||
console.log("-------------");
|
||||
console.log("Name: "+name);
|
||||
console.log("Level: "+level);
|
||||
console.log("Current Health: "+health+"/"+healthCap);
|
||||
console.log("Radiation Points: "+radPoints);
|
||||
console.log("Radiation Severity: "+radSeverity);
|
||||
console.log("Walk Rate: "+walkRate);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Food Rate: "+foodRate);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Current Path: "+path);
|
||||
userInput("\n[Press Enter to return]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function damageCalc(attacker) {
|
||||
function damageCalc(attacker, crit) {
|
||||
if (attacker = player) {
|
||||
if (playerStats.chem == "psycho") {
|
||||
var damageOutput = playerStats.weapon.damage*1.5;
|
||||
} else {
|
||||
var damageOutput = playerStats.weapon.damage;
|
||||
}
|
||||
if (crit) {
|
||||
damageOutput+3;
|
||||
}
|
||||
|
||||
if (enemyStats.armorUnit == "dr"){
|
||||
enemyStats.health = enemyStats.health-(damageOutput-(enemyStats.armor.value/100));
|
||||
let drDamage = damageOutput-(enemyStats.armor.value/100);
|
||||
enemyStats.health = enemyStats.health-drDamage;
|
||||
return drDamage;
|
||||
}
|
||||
if (enemyStats.armorUnit == "dt") {
|
||||
let dtDamage = enemyStats.health-(damageOutput-armor);
|
||||
if (dtDamage < 0) {
|
||||
dtDamage = 0;
|
||||
}
|
||||
enemyStats.health - dtDamage
|
||||
enemyStats.health - dtDamage;
|
||||
return dtDamage;
|
||||
}
|
||||
} else {
|
||||
if (playerStats.chem == "medx") {
|
||||
var damageOutput = enemyStats.weapon.damage*(-1.5);
|
||||
} else {
|
||||
var damageOutput = enemyStats.weapon.damage;
|
||||
} if (playerStats.armorUnit == "dr"){
|
||||
playerStats.health = playerStats.health-(damageOutput-(playerStats.armor.value/100));
|
||||
}
|
||||
if (crit) {
|
||||
damageOutput+3;
|
||||
}
|
||||
if (playerStats.armorUnit == "dr"){
|
||||
let drDamage = damageOutput-(playerStats.armor.value/100)
|
||||
playerStats.health = playerStats.health-drDamage;
|
||||
return drDamage;
|
||||
}
|
||||
if (playerStats.armorUnit == "dt") {
|
||||
let dtDamage = playerStats.health-(damageOutput-armor);
|
||||
if (dtDamage < 0) {
|
||||
dtDamage = 0;
|
||||
}
|
||||
playerStats.health - dtDamage
|
||||
playerStats.health - dtDamage;
|
||||
return dtDamage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export function radPointsCalc() { // Calculates radPoints given walk/foodrate
|
|||
|
||||
export function eatFood() { // Calculates food amount after a day of eating
|
||||
if (food == 0) {
|
||||
health = health - 0.25*walkRate
|
||||
health = health - walkRate
|
||||
} else {
|
||||
food = food - walkRate * foodRate
|
||||
}
|
||||
|
|
@ -203,8 +203,6 @@ function timeDeath() { // The death screen for passing the time limit
|
|||
|
||||
var travelFrame = 0;
|
||||
|
||||
|
||||
|
||||
export function travelScreen() {
|
||||
if (travelFrame < 0 || travelFrame > 3) {
|
||||
travelFrame = 0;
|
||||
|
|
@ -228,7 +226,15 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
if (path == 0) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
}
|
||||
if (path == 1) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-locationA));
|
||||
}
|
||||
if (path == 2) {
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-locationB));
|
||||
}
|
||||
travelFrame++
|
||||
} else if (travelFrame == 1) {
|
||||
console.clear();
|
||||
|
|
@ -250,7 +256,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame++
|
||||
} else if (travelFrame == 2) {
|
||||
console.clear();
|
||||
|
|
@ -272,7 +278,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame++
|
||||
} else if (travelFrame == 3) {
|
||||
console.clear();
|
||||
|
|
@ -294,7 +300,7 @@ export function travelScreen() {
|
|||
console.log("Press [SPACE] to open Pip-Boy");
|
||||
console.log("Current Health: "+health);
|
||||
console.log("Food Amt: "+food);
|
||||
console.log("Distance to next POI: " + pois[poiCounter].location-location);
|
||||
console.log("Distance to next POI: " + (pois[poiCounter].location-location));
|
||||
travelFrame=0;
|
||||
}
|
||||
}
|
||||
|
|
@ -306,11 +312,6 @@ export async function walkPathMain() {
|
|||
pauseScreen();
|
||||
enableRawMode();
|
||||
}
|
||||
|
||||
if (location > 255) {
|
||||
disableRawMode();
|
||||
return;
|
||||
}
|
||||
calcLocation();
|
||||
radPointsCalc();
|
||||
healthCapCalc();
|
||||
|
|
@ -351,6 +352,8 @@ export function disableRawMode() {
|
|||
|
||||
var paused = false;
|
||||
export function pauseScreen() {
|
||||
let pauseInput
|
||||
while (true) {
|
||||
console.clear();
|
||||
console.log ("What would you like to do?");
|
||||
console.log ("--------------------------");
|
||||
|
|
@ -360,7 +363,14 @@ export function pauseScreen() {
|
|||
console.log ("4) View Stats");
|
||||
console.log ("5) Scavenge");
|
||||
console.log ("6) Change Speed/Food Rate");
|
||||
let pauseInput = userInput("Enter: ");
|
||||
pauseInput = userInput("Enter: ");
|
||||
|
||||
if (pauseInput != "1" && pauseInput != "2" && pauseInput != "3" && pauseInput != "4" && pauseInput != "5" && pauseInput != "6") {
|
||||
console.log("Invalid input. Please enter 1, 2, or 3.");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(pauseInput) {
|
||||
case "1":
|
||||
paused = false;
|
||||
|
|
|
|||
|
|
@ -6,43 +6,70 @@ export function inventoryMenuM(){
|
|||
console.clear();
|
||||
console.log("INVENTORY");
|
||||
console.log("---------");
|
||||
console.log("1) Supplies");
|
||||
console.log("2) Equipment");
|
||||
console.log("3) Exit");
|
||||
console.log("1) View");
|
||||
console.log("2) Equip Weapon");
|
||||
console.log("3) Equip Armor");
|
||||
console.log("4) Exit");
|
||||
let invChoice = userInput("Enter: ");
|
||||
switch(userInput){
|
||||
switch(invChoice){
|
||||
case "1":
|
||||
supplyInventory();
|
||||
viewInventory();
|
||||
break;
|
||||
case "2":
|
||||
equipmentInventory();
|
||||
break;
|
||||
console.log("Weapons");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory.length;){
|
||||
if (inventory[a].type == "weapon") {
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
while (true) {
|
||||
console.log("-----------------");
|
||||
let equipInput = userInput("What would you like to equip?");
|
||||
if (equipInput <= a) {
|
||||
equippedWeapon = inventory[equipInput - 1];
|
||||
console.log("You have equipped: " + equippedWeapon.name);
|
||||
return;
|
||||
} else {
|
||||
console.log("Invalid Input. Please enter a valid number.");
|
||||
}
|
||||
}
|
||||
}
|
||||
case "3":
|
||||
console.log("Armor");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[1].length;){
|
||||
if (inventory[a].type == "armor" || inventory[a].type == "parmor") {
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
while (true) {
|
||||
console.log("-----------------");
|
||||
let equipInput = parseInt(userInput("What would you like to equip?"), 10);
|
||||
if (equipInput <= a) {
|
||||
equippedArmor = inventory[equipInput - 1];
|
||||
console.log("You have equipped: " + equippedArmor.name);
|
||||
return;
|
||||
} else {
|
||||
console.log("Invalid Input. Please enter a valid number.");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "4":
|
||||
break;
|
||||
default:
|
||||
console.log("Invalid Input");
|
||||
}
|
||||
}
|
||||
|
||||
//Builds the supply inventory
|
||||
function supplyInventory(){
|
||||
function viewInventory(){
|
||||
console.clear();
|
||||
console.log("SUPPLIES");
|
||||
console.log("Inventory");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[0].length;){
|
||||
console.log((a + 1) + ") " + inventory[0][a].name);
|
||||
a++;
|
||||
}
|
||||
userInput("[Enter to return]");
|
||||
console.clear();
|
||||
inventoryMenuM();
|
||||
}
|
||||
|
||||
//Builds the equipment inventory
|
||||
function equipmentInventory(){
|
||||
console.clear();
|
||||
console.log("EQUIPMENT");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[1].length;){
|
||||
console.log((a + 1) + ") " + inventory[1][a].name);
|
||||
for(var a = 0; a < inventory.length;){
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
userInput("[Enter to return]");
|
||||
|
|
|
|||
|
|
@ -14,22 +14,29 @@ console.log(" / / ) / / / ) / / / o / / ) / )
|
|||
console.log("_/________(___(_/___/___(___/_(___(__(_ __o_____/____/_(___/_/___/_(___ _(__)_(___/_/_/__/_(___ _____/_____|__(___/_(___(_(___/___\n\n");
|
||||
await sleep(1);
|
||||
|
||||
var mainMenuInput;
|
||||
while (true) {
|
||||
console.log("What would you like to do?");
|
||||
console.log("--------------------------");
|
||||
console.log("1) Start new game");
|
||||
console.log("2) Learn How to play");
|
||||
console.log("3) Quit Game");
|
||||
console.log("4) Credits\n");
|
||||
mainMenuInput = userInput("Enter: ");
|
||||
|
||||
var mainMenuInput = userInput("Enter: ");
|
||||
if (mainMenuInput != "1" && mainMenuInput != "2" && mainMenuInput != "3" && mainMenuInput != "4") {
|
||||
console.log("Invalid input. Please enter 1, 2, or 3.");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(mainMenuInput) {
|
||||
case "1":
|
||||
startGame();
|
||||
break;
|
||||
case "2":
|
||||
console.log("Follow the link below for a game manual.")
|
||||
console.log("[ENTER LINK HERE]")
|
||||
console.log(food);
|
||||
break;
|
||||
case "3":
|
||||
console.log("Quitting Game...");
|
||||
|
|
@ -40,18 +47,6 @@ switch(mainMenuInput) {
|
|||
console.log("Bethesda Game Studios - The Fallout IP and related characters/lore");
|
||||
console.log("Readline-sync - NPM package used for async collection of user input");
|
||||
break;
|
||||
case "5":
|
||||
var thing1 = [1,2,3,4,5,6,7,8,9];
|
||||
var thing2 = [];
|
||||
var thing3 = [];
|
||||
thing2 = thing1
|
||||
while (thing3.length < 6) {
|
||||
let randomPick = randomNumber(1,thing2.length);
|
||||
thing3.push(thing2[randomPick]);
|
||||
thing2.pop(randomPick);
|
||||
}
|
||||
console.log(thing2);
|
||||
break;
|
||||
}
|
||||
|
||||
function startGame() { // So far what I have is filler and testing, feel free to change.
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
// Map Screen
|
||||
const variables = require("./variables.js");
|
||||
|
|
@ -187,9 +187,8 @@ function bosGamma() {
|
|||
sleep(1);
|
||||
console.log("What would you like to do?");
|
||||
console.log("1) Explore");
|
||||
console.log("2) Attempt to trade");
|
||||
console.log("3) Open your PIP-Boy");
|
||||
console.log("4) Leave");
|
||||
console.log("2) Open your PIP-Boy");
|
||||
console.log("3) Leave");
|
||||
let poiInput = userInput("Enter: ");
|
||||
switch(poiInput) {
|
||||
case "1":
|
||||
|
|
@ -221,12 +220,9 @@ function bosGamma() {
|
|||
userInput("[Enter to exit conversation]");
|
||||
break;
|
||||
case "2":
|
||||
genericBOSStore();
|
||||
break;
|
||||
case "3":
|
||||
pauseScreen();
|
||||
break;
|
||||
case "4":
|
||||
case "3":
|
||||
enableRawMode();
|
||||
console.clear();
|
||||
break;
|
||||
|
|
@ -241,9 +237,8 @@ function bosDelta() {
|
|||
sleep(1);
|
||||
console.log("What would you like to do?");
|
||||
console.log("1) Explore");
|
||||
console.log("2) Attempt to trade");
|
||||
console.log("3) Open your PIP-Boy");
|
||||
console.log("4) Leave");
|
||||
console.log("2) Open your PIP-Boy");
|
||||
console.log("3) Leave");
|
||||
let poiInput = userInput("Enter: ");
|
||||
switch(poiInput) {
|
||||
case "1":
|
||||
|
|
@ -269,12 +264,9 @@ function bosDelta() {
|
|||
userInput("[Enter to exit the conversation]");
|
||||
break;
|
||||
case "2":
|
||||
genericBOSStore();
|
||||
break;
|
||||
case "3":
|
||||
pauseScreen();
|
||||
break;
|
||||
case "4":
|
||||
case "3":
|
||||
enableRawMode();
|
||||
console.clear();
|
||||
break;
|
||||
|
|
@ -289,9 +281,8 @@ function bosEpsilon() {
|
|||
sleep(1);
|
||||
console.log("What would you like to do?");
|
||||
console.log("1) Explore");
|
||||
console.log("2) Attempt to trade");
|
||||
console.log("3) Open your PIP-Boy");
|
||||
console.log("4) Leave");
|
||||
console.log("2) Open your PIP-Boy");
|
||||
console.log("3) Leave");
|
||||
let poiInput = userInput("Enter: ");
|
||||
switch(poiInput) {
|
||||
case "1":
|
||||
|
|
@ -311,7 +302,7 @@ function bosEpsilon() {
|
|||
userInput(" \n[Enter to continue]\n");
|
||||
console.log(name + ": And you're mourning your sister? What happened to her, if you don't mind me asking...");
|
||||
userInput(" \n[Enter to continue]\n");
|
||||
console.log("Tiduk: She was a great warrior, though I did not recognize this until it was too late. We had fought a successful battle,\n and were returning to base camp when we were ambushed by robots. Some of us escaped, but my sister\n was not so lucky.");
|
||||
console.log("Tiduk: She was a great warrior, though I did not recognize this until it was too late. We had fought a successful battle, and were returning to base camp when we were ambushed by robots. Some of us escaped, but my sister was not so lucky.");
|
||||
userInput(" \n[Enter to continue]\n");
|
||||
console.log(name + ": Oh, I'm sorry for your loss.");
|
||||
userInput(" \n[Enter to continue]\n");
|
||||
|
|
@ -319,12 +310,9 @@ function bosEpsilon() {
|
|||
userInput("[Enter to exit the conversation]");
|
||||
break;
|
||||
case "2":
|
||||
genericBOSStore();
|
||||
break;
|
||||
case "3":
|
||||
pauseScreen();
|
||||
break;
|
||||
case "4":
|
||||
case "3":
|
||||
enableRawMode();
|
||||
console.clear();
|
||||
break;
|
||||
|
|
@ -437,12 +425,12 @@ function newVegas() {
|
|||
console.log("What would you like to do?");
|
||||
console.log("1) Explore");
|
||||
console.log("2) Open your PIP-Boy");
|
||||
console.log("3) Continue");
|
||||
console.log("3) Continue your journey");
|
||||
let poiInput = userInput("Enter: ");
|
||||
switch(poiInput) {
|
||||
case "1":
|
||||
console.clear();
|
||||
console.log("Vegas Dialogue here...")
|
||||
console.log("")
|
||||
break;
|
||||
case "2":
|
||||
pauseScreen();
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ export function ravenRockStore() {
|
|||
switch(rrInput) {
|
||||
case "1":
|
||||
console.log("What would you like to buy?");
|
||||
let itemNum = userInput("Enter item number: ");
|
||||
let itemAmt = userInput("Enter amount: ");
|
||||
var itemNum = userInput("Enter item number: ");
|
||||
var itemAmt = userInput("Enter amount: ");
|
||||
if (itemAmt > rrInv[itemNum].amount) {
|
||||
console.log("Not enough stock.");
|
||||
userInput("[Enter]");
|
||||
|
|
@ -164,7 +164,13 @@ export function ravenRockStore() {
|
|||
rrInv[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + rrInv[itemNum].name + "(s).");
|
||||
console.log("You have " + preWarMoney + " pre-war money left.");
|
||||
inventory.push(rrInv[itemNum]);
|
||||
if (rrInv[itemNum].name == "Food") {
|
||||
food =+ itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(rrInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
console.log("Press enter to continue...");
|
||||
userInput("[Enter]");
|
||||
}
|
||||
|
|
@ -172,7 +178,6 @@ export function ravenRockStore() {
|
|||
case "2":
|
||||
console.log("Leaving shop...");
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
console.log("Invalid input, try again.");
|
||||
}
|
||||
|
|
@ -207,10 +212,17 @@ export function vaultZeroStore() {
|
|||
break;
|
||||
} else {
|
||||
caps -= itemAmt * vt0Inv[itemNum].price;
|
||||
rrInv[itemNum].amount -= itemAmt;
|
||||
vt0Inv[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + vt0Inv[itemNum].item + "(s).");
|
||||
console.log("You have " + caps + " caps left.");
|
||||
console.log("Press enter to continue...");
|
||||
if (vt0Inv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(vt0Inv[itemNum].item);
|
||||
}
|
||||
}
|
||||
userInput("[Enter]");
|
||||
}
|
||||
break;
|
||||
|
|
@ -255,6 +267,13 @@ export function newVegasStore() {
|
|||
console.log("You bought " + itemAmt + " " + vegasInv[itemNum].item + "(s).");
|
||||
console.log("You have " + caps + " caps left.");
|
||||
console.log("Press enter to continue...");
|
||||
if (vegasInv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(vegasInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
userInput("[Enter]");
|
||||
}
|
||||
break;
|
||||
|
|
@ -299,6 +318,13 @@ export function eurekaStore() {
|
|||
eurInv[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + eurInv[itemNum].item + "(s).");
|
||||
console.log("You have " + preWarMoney + " pre-war money left.");
|
||||
if (eurInv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(eurInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
console.log("Press enter to continue...");
|
||||
userInput("[Enter]");
|
||||
}
|
||||
|
|
@ -343,6 +369,13 @@ export function lostHillsStore() {
|
|||
lostHillsInv[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + lostHillsInv[itemNum].item + "(s).");
|
||||
console.log("You have " + caps + " caps left.");
|
||||
if (lostHillsInv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(lostHillsInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
console.log("Press enter to continue...");
|
||||
userInput("[Enter]");
|
||||
}
|
||||
|
|
@ -387,6 +420,13 @@ export function whitespringStore() {
|
|||
whitespringInv[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + whitespringInv[itemNum].item + "(s).");
|
||||
console.log("You have " + caps + " caps left.");
|
||||
if (whitespringInv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(whitespringInvInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
console.log("Press enter to continue...");
|
||||
userInput("[Enter]");
|
||||
}
|
||||
|
|
@ -460,23 +500,30 @@ export function trader(tier, message) {
|
|||
console.log("What would you like to do?");
|
||||
console.log("1) Buy supplies");
|
||||
console.log("2) Leave shop");
|
||||
var rrInput = userInput("Enter: ");
|
||||
switch(rrInput) {
|
||||
var traderInput = userInput("Enter: ");
|
||||
switch(traderInput) {
|
||||
case "1":
|
||||
console.log("What would you like to buy?");
|
||||
let itemNum = userInput("Enter item number: ");
|
||||
let itemAmt = userInput("Enter amount: ");
|
||||
if (itemAmt > tempBOSStock[itemNum].amount) {
|
||||
if (itemAmt > tempTraderInv[itemNum].amount) {
|
||||
console.log("Not enough stock.");
|
||||
break;
|
||||
} else if (itemAmt * tempBOSStock[itemNum].price > caps) {
|
||||
} else if (itemAmt * tempTraderInv[itemNum].price > caps) {
|
||||
console.log("Not enough money.");
|
||||
break;
|
||||
} else {
|
||||
preWarMoney -= itemAmt * tempBOSStock[itemNum].price;
|
||||
preWarMoney -= itemAmt * tempTraderInv[itemNum].price;
|
||||
tempBOSStock[itemNum].amount -= itemAmt;
|
||||
console.log("You bought " + itemAmt + " " + tempBOSStock[itemNum].item + "(s).");
|
||||
console.log("You bought " + itemAmt + " " + tempTraderInv[itemNum].item + "(s).");
|
||||
console.log("You have " + caps + " caps left.");
|
||||
if (tempTraderInv[itemNum].name == "Food") {
|
||||
food = food+itemAmt;
|
||||
} else {
|
||||
for (var i = 0; i < itemAmt; i++) {
|
||||
inventory.push(tempTraderInv[itemNum].item);
|
||||
}
|
||||
}
|
||||
console.log("Press enter to continue...");
|
||||
userInput("[Enter]");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,42 +18,24 @@ global.equipmentList = [ // Equipment: weapons, armor, tools
|
|||
{name: "Laser Rifle", description: "A laser rifle, does 25 laser damage", type: "weapon", value: "25", unit: "laser",cost: 25, weight: 5},
|
||||
{name: "Plasma Pistol", description: "A plasma pistol, does 30 plasma damage", type: "weapon", value: "30", unit: "plasma",cost: 30, weight: 6},
|
||||
{name: "Plasma Rifle", description: "A plasma rifle, does 35 plasma damage", type: "weapon", value: "35", unit: "plasma",cost: 35, weight: 7},
|
||||
|
||||
// Energy Resistant Armor
|
||||
{name: "Leather Armor", description: "A set of leather armor, good protection from laser weapons.", type: "armor", resistances: {balistic: 2, slash: 2, laser: 5, plasma: 3}, unit: "dr", cost: 5, weight: 5},
|
||||
{name: "Sturdy Leather Armor", description: "A set of combat armor, better protection from laser and plasma weapons.", type: "armor", resistances: {balistic: 5, slash: 5, laser: 10, plasma: 10}, unit: "dr", cost: 5, weight: 5},
|
||||
|
||||
// Ballistic Resistant Armor
|
||||
{name: "Raider Armor", description: "A set of raider armor, good protection from balistic damage.", type: "armor", resistances: {balistic: 5, slash: 3, laser: 2, plasma: 2}, unit: "dr", cost: 5, weight: 5},
|
||||
{name: "Metal Armor" , description: "A set of raider armor, better protection from ballistic and slash damage.", type: "armor", resistances: {balistic: 10, slash: 10, laser: 5, plasma: 5}, unit: "dr", cost: 5, weight: 5},
|
||||
|
||||
// Tier 3 Armor
|
||||
{name: "Combat Armor", description: "A set of combat armor, better protection from all damage types.", type: "armor", resistances: {balistic: 10, slash: 10, laser: 10, plasma: 10}, unit: "dr", cost: 5, weight: 5},
|
||||
{name: "Centurion Armor", description: "A set of Centurion armor, great protection from ballistic damage.", type: "armor", value: "5", unit: "dr",cost: 25, weight: 25},
|
||||
{name: "NCR Ranger Armor" , description: "A set of NCR Ranger armor, great protection from laser and plasma weapons", type: "armor", value: "5", unit: "dr",cost: 30, weight: 30},
|
||||
|
||||
|
||||
// Non-specialized Power Armor
|
||||
{name: "T-45 Power Armor", description: "A set of T-45 Power Armor, protects against all damage types.", type: "parmor", resistances: {balistic: 15, slash: 15, laser: 15, plasma: 15}, unit: "dt", cost: 5, weight: 5},
|
||||
{name: "T-60 Power Armor", description: "A set of T-60 Power Armor, good protection from all damage types.", type: "parmor", resistances: {balistic: 25, slash: 25, laser: 25, plasma: 25}, unit: "dt", cost: 5, weight: 5},
|
||||
{name: "T-65 Power Armor", description: "A set of T-60 Power Armor, great protection from all damage types.", type: "parmor", resistances: {balistic: 35, slash: 35, laser: 35, plasma: 35}, unit: "dt", cost: 5, weight: 5},
|
||||
|
||||
// Energy Resistant Power Armor
|
||||
{name: "X-01 Power Armor", description: "X-01 Power Armor, good protection from energy damage.", type: "parmor", resistances: {balistic: 10, slash: 10, laser: 30, plasma: 30}, unit: "dt", cost: 5, weight: 5},,
|
||||
{name: "APA MkI Power Armor", description: "APA MkI Power Armor, great protection from energy damage.", type: "parmor", resistances: {balistic: 20, slash: 20, laser: 40, plasma: 40}, unit: "dt", cost: 5, weight: 5},
|
||||
{name: "APA MkII Power Armor", description: "APA MkII Power Armor, excellent protection from energy damage.", type: "parmor", resistances: {balistic: 30, slash: 30, laser: 50, plasma: 50}, unit: "dt", cost: 5, weight: 5},
|
||||
|
||||
// Ballistic Resistant Power Armor
|
||||
{name: "Raider Power Armor", description: "Raider Power Armor, good protection from ballistic damage.", type: "parmor", resistances: {balistic: 30, slash: 30, laser: 10, plasma: 10}, unit: "dt", cost: 5, weight: 5},
|
||||
{name: "Ultracite Power Armor", description: "Ultracite Power Armor, great protection from ballistic damage.", type: "parmor", resistances: {balistic: 40, slash: 40, laser: 20, plasma: 20}, unit: "dt", cost: 5, weight: 5},
|
||||
{name: "T-51 Power Armor", description: "T-51 Power Armor, excellent protection from ballistic damage.", type: "parmor", resistances: {balistic: 50, slash: 50, laser: 30, plasma: 30}, unit: "dt", cost: 5, weight: 5},
|
||||
|
||||
// Special Armor
|
||||
{name: "Enclave Uniform", description: "Enclave uniform, standard issue", type: "armor", resistances: {balistic: 0, slash: 0, laser: 0, plasma: 0}, unit: "dr",cost: 20, weight: 20},
|
||||
{name: "Chinese Stealth Suit", description: "Chinese Stealth Suit, +25% Chance to skip encounter if worn", type: "uarmor", resistances: {balistic: 5, slash: 5, laser: 5, plasma: 5}, unit: "dr",cost: 20, weight: 20},
|
||||
{name: "Excavator Power Armor", description: "Excavator Power Armor, +25% Chance to find extra loot", type: "parmor", resistances: {balistic: 5, slash: 5, laser: 5, plasma: 5}, unit: "dt", cost: 5, weight: 5},
|
||||
|
||||
// Fists (Yes I know this should go by the weapons but I dont wanna mess this up)
|
||||
{name: "Fists (Unarmed)", description: "Unarmed combat, does 5 bash damage", type: "weapon", value: "5", unit: "bash", cost: 5, weight: 1},
|
||||
];
|
||||
|
||||
|
|
@ -111,16 +93,11 @@ global.radPoints = 0; // If the player reaches 100 rad points the game ends
|
|||
global.xpPerLevel = 10; // Amount of XP needed per level. Raises 50% each level
|
||||
global.level = 0; // Level of player. Modifies enemy scaling
|
||||
global.inventory = [ // Inventory of player, holds all items
|
||||
// Supplies: chems, aid
|
||||
[],
|
||||
// Equipment: weapons, armor, tools
|
||||
[
|
||||
equipmentList[27],
|
||||
equipmentList[24],
|
||||
]
|
||||
equipmentList[25],
|
||||
]
|
||||
global.equippedWeapon = equipmentList[27];
|
||||
global.equippedArmor = equipmentList[24];
|
||||
global.equippedArmor = equipmentList[25];
|
||||
|
||||
// Game Mechanics
|
||||
global.walkRate = 0; // Units the player walks per day, affects foodRateCalc and radPointsCalc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue