Liliana797979

02. mu online - fundamentals

Jul 14th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function muOnline(input) {
  2.     let array = input.shift().split("|");
  3.     //console.log(array);
  4.     let newArray = array.slice(" ");
  5.     //console.log(newArray);
  6.     let health = 100;
  7.     let bitcoins = 0;
  8.     let monster = "";
  9.     let amount = 0;
  10.     let command = input.shift();
  11.     while (command === "chest") {
  12.         console.log(`You found ${amount} bitcoins.`);
  13.         break;
  14.     }
  15.     if (command === "potion") {
  16.         console.log(`You healed for ${amount} hp.`);
  17.         console.log(`Current health: ${currentHealth} hp.`);
  18.     }
  19.     if (health <= 0) {
  20.         console.log(`You slayed ${monster}.`);
  21.     } else if (health === 0) {
  22.         console.log(`You died! Killed by ${monster}.`);
  23.         console.log(`Best room: ${room}`);
  24.     } else {
  25.         console.log(`You've made it!", "Bitcoins: ${bitcoins}", "Health: ${health}`);
  26.    }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment