Code Your Own Adventure 2! 5/6


#1

Ok, so i think i have it done but it says i still need a logical 'or' (||) .
I don't know what a logical is but this is my code so far:
var user = prompt("You encounter a demon, do you RUN away, CHECK your inventory for a weapon and fight, FIGHT with your bare hands or make a DEAL?").toUpperCase();
switch(user) {
case 'RUN':
console.log("Sadly your agility level was too low and it caught up to you");
break;
case 'CHECK':
var weapon = prompt("Do you have a weapon?").toLowerCase();
if(weapon = "yes") {
console.log("you quickly check your inventory. luckily you have the rusty sword your dad gave you, you give a BIG swing dealing 20 damage and Killing the demon!");
console.log("you won");
console.log("you gained 30 exp and 7 gold");
} else {
console.log("You had no weapons and it quickly tore you to shreds");
};
break;
case 'FIGHT':
console.log("You punched the demon's chest but you broke your fist, level up your strength level to 12 if you want to do any damage with your fists.");
console.log("luckily you didnt die it stole your items and flew away");
console.log("your inventory is now empty");
break;
case 'DEAL':
console.log("you said you would be willing to trade if it doesnt kill you.");
console.log("It agree's to trade.");
console.log("you are too stuborn to give it your $1000 watch so it kills you and takes it anyways");
break;
default:
console.log("you have too low of an IQ to choose an option so it devours you");
break;
}

/* sorry i need so much help i'm only 13 in a month */


#2

A post was merged into an existing topic: Code Your Own Adventure 2! 5/6


#3