From 1e153c7e88d46499148983111490617bb21ac1c1 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 21 Dec 2020 16:46:10 -0500 Subject: [PATCH 01/20] First commit, Forked and Cloned, Renamed and Trello updated in Readme --- .gitignore | 1 + ...ndividual_Project_The_Flame_Of_Ragnarok.js | 8 ++ README.md | 2 +- package-lock.json | 127 +++++++++++++++++- package.json | 1 + textBasedAdventure.js | 5 - 6 files changed, 137 insertions(+), 7 deletions(-) create mode 100644 .gitignore create mode 100644 Module_One_Individual_Project_The_Flame_Of_Ragnarok.js delete mode 100644 textBasedAdventure.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js new file mode 100644 index 0000000..c9b3ac7 --- /dev/null +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -0,0 +1,8 @@ +const readline1 = require('readline-sync') + +const chalk = require('chalk') + +let nameInput = readline1.question("Enter your name: ") + +console.log(`Hello ${nameInput}! Welcome to The Flame Of Ragnarok.`) +console.log(readline1.keyInYN(chalk.red.bold('Would you like to play my game? '))) diff --git a/README.md b/README.md index f0a4dd4..0b1f45f 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ let yourVariableHere = readline.question("Enter your name: ") Replace the link below with the link to your Trello project: -[Trello](https://trello.com/b/vbKtMOKj/text-based-adventure-project-plan) +[Trello](https://trello.com/b/MCXVQYyr/text-based-adventure-project-plan) ## Rubric diff --git a/package-lock.json b/package-lock.json index 4e5e2be..1082e20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,138 @@ { "name": "FSW-Text-Based-Adventure", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "chalk": "^4.1.0", + "readline-sync": "^1.4.10" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + } + }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, "readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } } } } diff --git a/package.json b/package.json index 8e8b06f..ec48514 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "homepage": "https://github.com/joinpursuit/FSW-Text-Based-Adventure#readme", "dependencies": { + "chalk": "^4.1.0", "readline-sync": "^1.4.10" } } diff --git a/textBasedAdventure.js b/textBasedAdventure.js deleted file mode 100644 index d392b19..0000000 --- a/textBasedAdventure.js +++ /dev/null @@ -1,5 +0,0 @@ -const readline1 = require('readline-sync') - -let nameInput = readline.question("Enter your name: ") - -console.log(`Hello ${nameInput}! Welcome to my game.`) From d4c3a500698e3beb79ce232784e4b6fd15d37822 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Fri, 1 Jan 2021 01:44:24 -0500 Subject: [PATCH 02/20] started my start, restart, quit (games), and a rough idea of how I adventure to go --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 105 +++++++++++++++++- 1 file changed, 100 insertions(+), 5 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index c9b3ac7..2aae116 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -1,8 +1,103 @@ -const readline1 = require('readline-sync') +const readline = require('readline-sync'); -const chalk = require('chalk') +const chalk = require('chalk'); -let nameInput = readline1.question("Enter your name: ") +let nameInput = readline.question(chalk.bold.yellowBright("Enter your name: ")); -console.log(`Hello ${nameInput}! Welcome to The Flame Of Ragnarok.`) -console.log(readline1.keyInYN(chalk.red.bold('Would you like to play my game? '))) +console.log(chalk.bold.red(`Hello ` + chalk.bold.yellowBright(nameInput) + `! ` + `Welcome to The Flame Of Ragnarok.`)); +console.log(chalk.green("In this adventure you will explore the caves of Asgard!!")); +console.log(chalk.green("Be wary of your actions Young God or they might be you last!!")); +console.log(chalk.blueBright("Also if come across " + chalk.bold.greenBright("Loki ") + "remember he is the Trickster God and just loves mayhem and mischief!!!")) +console.log(chalk.green("In your exploration you will need to find " + chalk.bold.yellowBright("Gungnir ") + "the spear of Odin himself inorder to stop Ragnarok!!!!")) + +const startGame = () => { + console.log(chalk.red.bold("Welcome " + nameInput + "!")) + let answer = readline.keyInYN('Would you like to start your adventure?') + if (answer) { + console.log("Let's Begin!") + gameLoop() + } + else{ + console.log("Remember that Asgard is where it's people are not the where the land is Young God!!!") + quitGame() + } + + } + +const quitGame = () => { + console.log("Goodbye! Until we meet again!!") + process.exit() + } + +const restartGame = () => { + console.log(readline.keyInYN("Would you like to play again?")) + if(answer){ + startGame() + } + else{ + quitGame() + } + } + + const gameLoop = () => { + console.log("You walk into the Cave of Time") + let choice1 = (nameInput + "You see that the cave has two paths to take. Which path do you take? The right path or the left path?") + console.log("You chose to take " + choice1) +if(choice1 === "right path"){ + console.log("You have taken the right path") + choice1 = ("You find something glowing in the distance do you want walk towards it? yes or no") + if(choice1 === "yes"){ + console.log("You have found Gungnir!!! Congrats!!! You Have saved Asgard!!!") + restartGame() + } + else if(choice1 === "no"){ + console.log("A mysterious fire came out of nowhere!! Oh no you are trapped in The Flame of Ragnorak!!") + console.log("Unfortunately Young God you weren't able to save Asgard!!!!!") + quitGame() + } +} +else if(choice1 === "left path"){ + console.log("You have taken the left path") + choice1 = ("You have found Loki and he wants to play a game!! He wants you to guess one of two numbers. One will set you free and the other will not. 666 or 333") + if(choice1 === "333"){ + console.log("He smiles maliciously and says you have the guessed correctly!") + console.log("Loki then disapears and you think you're safe to continue on your journey....") + console.log("Oh no!!! That trickster set you up in a trap and you are burned by the Flames of Ragnorak!!") + restartGame() + } + else if(choice1 === "666"){ + console.log("Loki looks at you furiously and offended!!") + console.log("I am way smarter and not to mention better looking than the so called Devil, he says...") + console.log("He starts laughing in a erie and evil way and then says good luck....") + console.log("With that you are transported to another part of the cave where you see something glowing in the distance") + console.log("Turns out Loki sent you to the right side of the cave where you find Gungnir!!!!!") + console.log("Congrats!!! You saved Asgard!!!") + quitGame() + } + +} + } + + + + + + + + + + + + + + + + + + + + + startGame() + quitGame() + restartGame() + gameLoop() \ No newline at end of file From d72398c7338f2c3e3507f091edb5abd0a63891cf Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Sat, 2 Jan 2021 02:25:22 -0500 Subject: [PATCH 03/20] comming together nicely, got my first two paths started --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 161 ++++++++++++------ 1 file changed, 111 insertions(+), 50 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 2aae116..119c2e1 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -12,10 +12,11 @@ console.log(chalk.green("In your exploration you will need to find " + chalk.bol const startGame = () => { console.log(chalk.red.bold("Welcome " + nameInput + "!")) - let answer = readline.keyInYN('Would you like to start your adventure?') - if (answer) { + if (readline.keyInYN('Would you like to start your adventure?')) { console.log("Let's Begin!") - gameLoop() + console.log("This will be an epic adventure " + nameInput + ", may the odds be your favor!!!") + console.log("Good luck!!!! \n") + runOrFly() } else{ console.log("Remember that Asgard is where it's people are not the where the land is Young God!!!") @@ -24,59 +25,121 @@ const startGame = () => { } -const quitGame = () => { - console.log("Goodbye! Until we meet again!!") - process.exit() - } +function runOrFly(){ + console.log("You wake up in the Castle of Asgard. \n") + console.log("You just got word that Thor, The God of Thunder himself wants to speak to you about a very important quest! \n") + console.log("He is waiting for you in Thrudheim. Would you like to run or fly?") + let ability + while(ability !== "run" && ability !== "fly"){ + ability = readline.question("Please choose run or fly \n") + if(ability === "run"){ + chooseArmorInCastle() + } + else if(ability === "fly"){ + chooseArmorThorOffers() + } + } +} + +function chooseArmorInCastle(){ + console.log("Before heading to Thrudheim, you see a few armor sets that are element based: Fire, Earth, Water, Thunder, & Steel \n") +let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") +if(armor === "Fire"){ + console.log("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" ) + console.log("You now head to Thrudheim \n") +} +else if(armor === "Earth"){ + console.log("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n") + console.log("You now head to Thrudheim \n") +} +else if(armor === "Water"){ + console.log("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ") + console.log("You now head to Thrudheim \n") +} +else if(armor === "Thunder"){ + console.log("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n") + console.log("You now head to Thrudheim \n") +} +else if(armor === "Steel"){ + console.log("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n") + console.log("You now head to Thrudheim \n") +} +else{ +console.log("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n") +chooseArmorInCastle() +} + +thrudheimCaves() +} + +function chooseArmorThorOffers(){ + console.log("After hearing that the mighty Thor has summoned you,") + console.log("You decided that flying would be fastest getting to him.... \n") + console.log("You are stopped half way in your flight by no other than Thor himself.... \n") + console.log(nameInput + "what's taking you so long he asks? I asked to speak with you over an hour ago!! \n") + console.log("Also where is your armor?!?!?!?! You know that God needs their armor without it can be very dangerous!! \n") + console.log("Luckily I brought a few armor sets with me just in case they are element based: Fire, Earth, Water, Thunder, & Steel \n") +let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") +if(armor === "Fire"){ + console.log("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" ) + console.log("You now head to Thrudheim together with Thor \n") +} +else if(armor === "Earth"){ + console.log("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n") + console.log("You now head to Thrudheim together with Thor \n") +} +else if(armor === "Water"){ + console.log("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ") + console.log("You now head to Thrudheim together with Thor \n") +} +else if(armor === "Thunder"){ + console.log("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n") + console.log("You now head to Thrudheim together with Thor \n") +} +else if(armor === "Steel"){ + console.log("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n") + console.log("You now head to Thrudheim together with Thor \n") +} +else{ +console.log("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n") +chooseArmorThorOffers() +} + +thrudheimCaves() +} + +function thrudheimCaves(){ +console.log("After a few minutes you have reached The Thrudheim Caves \n") +console.log("Thor stops and seems confused and says" + nameInput + "these four paths weren't here before \n") +console.log("You see" + nameInput + "why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n") +console.log("And it seems like this time he has gone too far!!! \n") +console.log(nameInput + "It's up to you to stop him or Ragnorak will spread throughout Asgard and then to the rest of the multi-verse!!! \n") +console.log("He will be in the Cave of Time find him and stop him Young God!!!!!! \n") +let path = readline.question("Which of the four paths would you like to take: path (1), path (2), path (3), or path (4); (Choose a number) \n") +if(path === "1"){} +else if(path === "2"){} +else if(path === "3"){} +else if(path === "4"){} +else{ + console.log("Invalid Entry, Remember it's number... Please try again") + thrudheimCaves() +} +} const restartGame = () => { - console.log(readline.keyInYN("Would you like to play again?")) - if(answer){ - startGame() + if(readline.keyInYN("Would you like to play again? \n")){ + runOrFly() } else{ quitGame() } } - const gameLoop = () => { - console.log("You walk into the Cave of Time") - let choice1 = (nameInput + "You see that the cave has two paths to take. Which path do you take? The right path or the left path?") - console.log("You chose to take " + choice1) -if(choice1 === "right path"){ - console.log("You have taken the right path") - choice1 = ("You find something glowing in the distance do you want walk towards it? yes or no") - if(choice1 === "yes"){ - console.log("You have found Gungnir!!! Congrats!!! You Have saved Asgard!!!") - restartGame() - } - else if(choice1 === "no"){ - console.log("A mysterious fire came out of nowhere!! Oh no you are trapped in The Flame of Ragnorak!!") - console.log("Unfortunately Young God you weren't able to save Asgard!!!!!") - quitGame() - } -} -else if(choice1 === "left path"){ - console.log("You have taken the left path") - choice1 = ("You have found Loki and he wants to play a game!! He wants you to guess one of two numbers. One will set you free and the other will not. 666 or 333") - if(choice1 === "333"){ - console.log("He smiles maliciously and says you have the guessed correctly!") - console.log("Loki then disapears and you think you're safe to continue on your journey....") - console.log("Oh no!!! That trickster set you up in a trap and you are burned by the Flames of Ragnorak!!") - restartGame() - } - else if(choice1 === "666"){ - console.log("Loki looks at you furiously and offended!!") - console.log("I am way smarter and not to mention better looking than the so called Devil, he says...") - console.log("He starts laughing in a erie and evil way and then says good luck....") - console.log("With that you are transported to another part of the cave where you see something glowing in the distance") - console.log("Turns out Loki sent you to the right side of the cave where you find Gungnir!!!!!") - console.log("Congrats!!! You saved Asgard!!!") - quitGame() + const quitGame = () => { + console.log("Goodbye! Until we meet again!!") + process.exit() } -} - } @@ -97,7 +160,5 @@ else if(choice1 === "left path"){ - startGame() - quitGame() - restartGame() - gameLoop() \ No newline at end of file + +startGame() \ No newline at end of file From 3b7020133c5e9ed8c5ea4c2d2a70de1f8a599568 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 4 Jan 2021 01:37:56 -0500 Subject: [PATCH 04/20] All done, I just have to make it look pretty now. --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 364 +++++++++++++++++- 1 file changed, 353 insertions(+), 11 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 119c2e1..ecc7ea3 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -12,14 +12,13 @@ console.log(chalk.green("In your exploration you will need to find " + chalk.bol const startGame = () => { console.log(chalk.red.bold("Welcome " + nameInput + "!")) - if (readline.keyInYN('Would you like to start your adventure?')) { + if (readline.keyInYN('Would you like to start your adventure? \n')) { console.log("Let's Begin!") console.log("This will be an epic adventure " + nameInput + ", may the odds be your favor!!!") console.log("Good luck!!!! \n") runOrFly() } else{ - console.log("Remember that Asgard is where it's people are not the where the land is Young God!!!") quitGame() } @@ -38,6 +37,10 @@ function runOrFly(){ else if(ability === "fly"){ chooseArmorThorOffers() } + else{ + console.log("Invalid choice, Please choose run or fly! \n") + runOrFly() + } } } @@ -76,7 +79,7 @@ function chooseArmorThorOffers(){ console.log("After hearing that the mighty Thor has summoned you,") console.log("You decided that flying would be fastest getting to him.... \n") console.log("You are stopped half way in your flight by no other than Thor himself.... \n") - console.log(nameInput + "what's taking you so long he asks? I asked to speak with you over an hour ago!! \n") + console.log(nameInput + " what's taking you so long he asks? I asked to speak with you over an hour ago!! \n") console.log("Also where is your armor?!?!?!?! You know that God needs their armor without it can be very dangerous!! \n") console.log("Luckily I brought a few armor sets with me just in case they are element based: Fire, Earth, Water, Thunder, & Steel \n") let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") @@ -110,22 +113,360 @@ thrudheimCaves() function thrudheimCaves(){ console.log("After a few minutes you have reached The Thrudheim Caves \n") -console.log("Thor stops and seems confused and says" + nameInput + "these four paths weren't here before \n") -console.log("You see" + nameInput + "why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n") +console.log("Thor stops and seems confused and says " + nameInput + " these four paths weren't here before, \n") +console.log("You see " + nameInput + " why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n") console.log("And it seems like this time he has gone too far!!! \n") -console.log(nameInput + "It's up to you to stop him or Ragnorak will spread throughout Asgard and then to the rest of the multi-verse!!! \n") +console.log(nameInput + " It's up to you to stop him or Ragnorak will spread throughout Asgard and then to the rest of the multi-verse!!! \n") console.log("He will be in the Cave of Time find him and stop him Young God!!!!!! \n") let path = readline.question("Which of the four paths would you like to take: path (1), path (2), path (3), or path (4); (Choose a number) \n") -if(path === "1"){} -else if(path === "2"){} -else if(path === "3"){} -else if(path === "4"){} +if(path === "1"){ + goingThroughPathOne() +} +else if(path === "2"){ + goingThroughPathTwo() +} +else if(path === "3"){ + goingThroughPathThree() +} +else if(path === "4"){ + goingThroughPathFour() +} else{ - console.log("Invalid Entry, Remember it's number... Please try again") + console.log("Invalid Entry, Remember it's number... Please try again \n") thrudheimCaves() } } + +function goingThroughPathOne(){ + console.log("You decided to take the first path. \n") + console.log("While walking along the path you notice that there is a vendor selling goods. \n") + console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + if (merchant === "Health Potions"){ + healthPotion() + } + else if (merchant === "Vitality Potions"){ + vitalityPotion() + } + else if(merchant === "Stamina Potions"){ + staminaPotion() + } + else{ + console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + goingThroughPathOne() + } +} + +function goingThroughPathTwo(){ + console.log("You decided to take the second path. \n") + console.log("While walking along the path you notice that there is a vendor selling goods. \n") + console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + if (merchant === "Health Potions"){ + healthPotion() + } + else if (merchant === "Vitality Potions"){ + vitalityPotion() + } + else if(merchant === "Stamina Potions"){ + staminaPotion() + } + else{ + console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + goingThroughPathTwo() + } +} + +function goingThroughPathThree(){ + console.log("You decided to take the third path. \n") + console.log("While walking through this path all of a sudden you hear a loud sinister laugh!!!") + console.log("Oh no it's Loki!! He brings down the boulder right on top of you!! \n") + let blocked = readline.question("What would you like to do: quit or restart? \n") +if (blocked === "quit"){ + quitGame() +} +else if(blocked === "restart"){ + restartGame() +} +else{ + console.log("Invalid response please select either: quit or restart, and try again!! \n") + goingThroughPathThree() +} +} + +function goingThroughPathFour(){ + console.log("You decided to take the fourth path. \n") + console.log("While walking along the path you notice that there is a vendor selling goods. \n") + console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + if (merchant === "Health Potions"){ + healthPotion() + } + else if (merchant === "Vitality Potions"){ + vitalityPotion() + } + else if(merchant === "Stamina Potions"){ + staminaPotion() + } + else{ + console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + goingThroughPathFourth() + } +} + +function healthPotion(){ + console.log("You chose the Health Potion that is a very wise choice!! \n") + console.log("I would recommend that you use it wisely.. \n") + console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + if (continuedPath === "Rest"){ + console.log("You rested for a bit and then drank the Health Potion. \n") + console.log("You then carried on the path feeling full of energy, it was hard but you got the feeling that it's only the begining. \n") + caveOfTime() + } + else if (continuedPath === "Carry On"){ + console.log("You then carried on the path feeling full of energy. \n") + console.log("It was a long and hard path but you got the feeling that it's only the begining, but so far you have managed to overcome every obstacle!! \n") + caveOfTime() + } + else if (continuedPath === "Quit"){ + console.log("It's a shame that you decided not to continue your adventure Young God... \n") + console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + quitGame() + } +} + +function vitalityPotion(){ + console.log("You chose the Vitality Potion that is a very wise choice!! \n") + console.log("I would recommend that you use it wisely.. \n") + console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + if (continuedPath === "Rest"){ + console.log("You rested for a bit and then drank the Vitality Potion. \n") + console.log("You then carried on the path feeling full of magic energy, this magic is powerful making you unstoppable!! \n") + caveOfTime() + } + else if (continuedPath === "Carry On"){ + console.log("You then carried on the path feeling full of magic energy. \n") + console.log("The path was long but using the magic potion really helped and made it a little easier!! \n") + caveOfTime() + } + else if (continuedPath === "Quit"){ + console.log("It's a shame that you decided not to continue your adventure Young God... \n") + console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + quitGame() + } +} + +function staminaPotion(){ + console.log("You chose the Stamina Potion that is a very wise choice!! \n") + console.log("I would recommend that you use it wisely.. \n") + console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + if (continuedPath === "Rest"){ + console.log("You rested for a bit and then drank the Stamina Potion. \n") + console.log("You then carried on the path feeling full of stamina, it was quick and easy, wow these potions are amazing!! \n") + caveOfTime() + } + else if (continuedPath === "Carry On"){ + console.log("You then carried on the path feeling full of energy. \n") + console.log("The path was long but so far you have managed to overcome every obstacle quickly!! \n") + caveOfTime() + } + else if (continuedPath === "Quit"){ + console.log("It's a shame that you decided not to continue your adventure Young God... \n") + console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + quitGame() + } +} +function caveOfTime(){ + console.log("After a few minutes you reach the Cave of Time!! \n") + console.log(nameInput + " wait I need to tell you something...") + console.log("'Thor flew down' " + nameInput + " you need to becareful inside the Cave of Time, Loki will be up to no good!!! \n") + console.log("Once you go inside there will be four pathways one of them will lead you to Gungnir,") + console.log("That is the Spear of Odin himself, we will need it to stop Ragnarok and save the multi-verse good luck " + nameInput + "!!! \n") + let cavePath = readline.question("You have entered the Cave of Time and you have found the four paths Thor was talking about, which path route will you take: route(1), route(2), route(3), or route(4). Please choose a number. \n") + if (cavePath === "1"){ + routePathOne() + } + else if (cavePath === "2"){ + routePathTwo() + } + else if (cavePath === "3"){ + routePathThree() + } + else if (cavePath === "4"){ + routePathFour() + } + else{ + console.log("Invalid Entry, Remember it's number... Please try again \n") + caveOfTime() + } +} + +function routePathOne(){ + console.log("You decided to take the first path...") + console.log("You walk deep into the cave and it seems like that it goes on forever....") + console.log("After sometime and what seemed like an eternity later, you take a step and fall into the Hole of Eternal Darkness. \n") + setTimeout(() => { console.log("."); }, 2000) + setTimeout(() => { console.log(".."); }, 6000) + setTimeout(() => { console.log("..."); }, 8000) + setTimeout(() => { console.log("...."); }, 10000) + setTimeout(() => { console.log("....."); }, 12000) + setTimeout(() => { let fall = readline.question("What would you like to do: quit or restart? \n") + if (fall === "quit"){ + quitGame() +} +else if(fall === "restart"){ + restartGame() +} +else{ + console.log("Invalid response please select either: quit or restart, and try again!! \n") + routePathOne() +} +}, 14000) +} + +function routePathTwo(){ + console.log("You decided to take the second path...") + console.log("You walk deep into the cave and just you thought this is taking a long time... \n") + let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") + if (cavePathLeftOrRight === "Right"){ + console.log("You entered the right path of the cave..") + cavePathRight() + } + else if (cavePathLeftOrRight === "Left"){ + console.log("You entered the left path of the cave..") + cavePathLeft() + } + else{ + console.log("Invalid Entry Please choose: Right or Left, try again!") + routePathTwo() + } +} + +function routePathThree(){ + console.log("You decided to take the third path...") + console.log("You walk deep into the cave and it seems like that it goes on forever....") + setTimeout(() => { console.log("After a while Loki appeared... you shouldn't be here this will be your downfall!!"); }, 6000) + setTimeout(() => { console.log("He suddenly disappears and The Bifrost sweeps you away!!"); }, 10000) + setTimeout(() => { let sweep = readline.question("What would you like to do: quit or restart? \n") + if (sweep === "quit"){ + quitGame() +} +else if(sweep === "restart"){ + restartGame() +} +else{ + console.log("Invalid response please select either: quit or restart, and try again!! \n") + routePathThree() +} +}, 16000) +} + +function routePathFour(){ + console.log("You decided to take the fourth path...") + console.log("You walk deep into the cave and just you thought this is taking a long time... \n") + let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") + if (cavePathLeftOrRight === "Right"){ + console.log("You entered the right path of the cave.. \n") + cavePathRight() + } + else if (cavePathLeftOrRight === "Left"){ + console.log("You entered the left path of the cave.. \n") + cavePathLeft() + } + else{ + console.log("Invalid Entry Please choose: Right or Left, try again! \n") + routePathFour() + } +} + +function cavePathRight(){ + console.log("You see a glowing light coming from deep in the cave...") + console.log("You get excited and hurry torwards that light! \n") + console.log("When you reach the light you meet the old wizard and he says " + nameInput + " in order to get what you need,") + console.log("You need to play a game I'm going to give you five treasure chests, only one has what you need while the others don't. \n") + if (readline.keyInYN('Would you like to play? \n')){ + let index = readline.question('Which chest would you like to chose? Please choose one: Chest 1, Chest 2, Chest 3, Chest 4, or Chest 5. \n' ); + if (index === 'Chest 1'){ + console.log("Wow gold and lots of it!! It's a shame that's not what you need") + console.log("Please try again!! \n") + cavePathRight() + } + else if(index === 'Chest 2'){ + console.log("It's Gungnir!!! Congrats!!!! Now it's time to stop Loki!!!!! \n") + finalShowDown() + } + else if(index === 'Chest 3'){ + console.log("It's Thors hammer!! To bad that's not what you need") + console.log("Please try again!! \n") + cavePathRight() + } + else if(index === 'Chest 4'){ + console.log("It's a feast of food, it looks so good it's making you hungry!!") + console.log("Please try again!! \n") + cavePathRight() + } + else if(index === 'Chest 5'){ + console.log("An empty chest?! Looks like this wizard has a sense of humor!!!") + console.log("Please try again!! \n") + cavePathRight() + } + else{ + console.log("He's a tricky wizard, Please try again!! \n") + } +} +else{ + console.log("It is recommended that you play the fate of the multi-verse lies in your hands after all " + nameInput + "!! \n") + cavePathRight() +} +} + +function cavePathLeft(){ + console.log("You are starting to grow weary and tired you didn't expect that the Cave of Time would be this big... \n") + console.log("You start to question your decision and wonder if you should give up..... \n") + setTimeout(() => { console.log("Well what did you expect you are in the Cave of Time after all, A Voice Echoed From the Distance!!!!! \n"); }, 7000) + setTimeout(() => { console.log("I am just an old wizard trying to help don't get frightened Young God"); }, 10000) + setTimeout(() => { console.log("I will transport you over to the correct cave!!!!! \n"); }, 13000) + setTimeout(() => { cavePathRight(); }, 16000) +} + +function finalShowDown(){ + setTimeout(() => { console.log("Just like that old wizard transported you outside The Cave of Time!!!!! \n"); }, 5000) + setTimeout(() => { console.log("Congrats!!!! " + nameInput + " I knew you can do it said Thor, by the way that old wizard is my father Odin himself!! \n"); }, 7000) + setTimeout(() => { console.log("He wanted to make sure you are worthy, he has done something similar to me in the past as well! \n"); }, 11000) + setTimeout(() => { console.log("Now that you have Grungnir you have to throw it in the Flame of Ragnorak while I take care of my brother Loki... \n"); }, 15000) + setTimeout(() => { if(readline.keyInYN("Are you ready to stop Ragnorak? \n")){ + console.log("With all your might during the epic fight between Thor and Loki..") + console.log("You threw Grungnir into the Flame of Ragnorak and saved the multiverse...") + console.log("Congratulations " + nameInput + " You beat the game!!!") + restartGame() + } + else{ + console.log("You get caught in the crossfire between Thor and Loki!!!") + console.log("The Staff of Odin flies from your hand, but you're not going to give up.") + console.log("With every ounce of energy you have left you get up and start looking for Grungnir.... \n") + finalThrowItsAllOrNothing() + } + }, 19000) +} + +function finalThrowItsAllOrNothing () { + console.log("After what seemed like an eternity you finally find Grungnir... \n") + console.log("Asgard looks like a dead planet now due to Loki's actions, it was once a very beautiful place!!! \n") + setTimeout(() => { console.log("It is now or never!! You take Grungnir and throw it with all your might right in the center of The Flame of Ragnorak!!! \n")}, 8000) + setTimeout(() => { console.log("Congratulations " + nameInput + " You saved the multiverse and beat the game!!!! \n"); }, 14000) + setTimeout(() => { restartGame(); }, 17000) +} + + + + + + + const restartGame = () => { if(readline.keyInYN("Would you like to play again? \n")){ runOrFly() @@ -137,6 +478,7 @@ const restartGame = () => { const quitGame = () => { console.log("Goodbye! Until we meet again!!") + console.log("And remember that Asgard is where it's people are not the where the land is Young God!!!") process.exit() } From f178e25871a796324b52b453f91a44fe99a5aae1 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 4 Jan 2021 04:47:52 -0500 Subject: [PATCH 05/20] spell check --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 24 ++- package-lock.json | 148 ++++++++++++++++++ package.json | 2 + 3 files changed, 167 insertions(+), 7 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index ecc7ea3..c4b8031 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -2,6 +2,16 @@ const readline = require('readline-sync'); const chalk = require('chalk'); +const figlet = require('figlet') + +console.log(figlet.textSync(' FLAME RAGNAROK', { + font: 'Fire Font-k', + horizontalLayout: 'default', + verticalLayout: 'default', + width: 60, + whitespaceBreak: true +})) + let nameInput = readline.question(chalk.bold.yellowBright("Enter your name: ")); console.log(chalk.bold.red(`Hello ` + chalk.bold.yellowBright(nameInput) + `! ` + `Welcome to The Flame Of Ragnarok.`)); @@ -116,7 +126,7 @@ console.log("After a few minutes you have reached The Thrudheim Caves \n") console.log("Thor stops and seems confused and says " + nameInput + " these four paths weren't here before, \n") console.log("You see " + nameInput + " why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n") console.log("And it seems like this time he has gone too far!!! \n") -console.log(nameInput + " It's up to you to stop him or Ragnorak will spread throughout Asgard and then to the rest of the multi-verse!!! \n") +console.log(nameInput + " It's up to you to stop him or Ragnarok will spread throughout Asgard and then to the rest of the multi-verse!!! \n") console.log("He will be in the Cave of Time find him and stop him Young God!!!!!! \n") let path = readline.question("Which of the four paths would you like to take: path (1), path (2), path (3), or path (4); (Choose a number) \n") if(path === "1"){ @@ -437,26 +447,26 @@ function finalShowDown(){ setTimeout(() => { console.log("Just like that old wizard transported you outside The Cave of Time!!!!! \n"); }, 5000) setTimeout(() => { console.log("Congrats!!!! " + nameInput + " I knew you can do it said Thor, by the way that old wizard is my father Odin himself!! \n"); }, 7000) setTimeout(() => { console.log("He wanted to make sure you are worthy, he has done something similar to me in the past as well! \n"); }, 11000) - setTimeout(() => { console.log("Now that you have Grungnir you have to throw it in the Flame of Ragnorak while I take care of my brother Loki... \n"); }, 15000) - setTimeout(() => { if(readline.keyInYN("Are you ready to stop Ragnorak? \n")){ + setTimeout(() => { console.log("Now that you have Gungnir you have to throw it in the Flame of Ragnarok while I take care of my brother Loki... \n"); }, 15000) + setTimeout(() => { if(readline.keyInYN("Are you ready to stop Ragnarok? \n")){ console.log("With all your might during the epic fight between Thor and Loki..") - console.log("You threw Grungnir into the Flame of Ragnorak and saved the multiverse...") + console.log("You threw Gungnir into the Flame of Ragnarok and saved the multiverse...") console.log("Congratulations " + nameInput + " You beat the game!!!") restartGame() } else{ console.log("You get caught in the crossfire between Thor and Loki!!!") console.log("The Staff of Odin flies from your hand, but you're not going to give up.") - console.log("With every ounce of energy you have left you get up and start looking for Grungnir.... \n") + console.log("With every ounce of energy you have left you get up and start looking for Gungnir.... \n") finalThrowItsAllOrNothing() } }, 19000) } function finalThrowItsAllOrNothing () { - console.log("After what seemed like an eternity you finally find Grungnir... \n") + console.log("After what seemed like an eternity you finally find Gungnir... \n") console.log("Asgard looks like a dead planet now due to Loki's actions, it was once a very beautiful place!!! \n") - setTimeout(() => { console.log("It is now or never!! You take Grungnir and throw it with all your might right in the center of The Flame of Ragnorak!!! \n")}, 8000) + setTimeout(() => { console.log("It is now or never!! You take Gungnir and throw it with all your might right in the center of The Flame of Ragnarok!!! \n")}, 8000) setTimeout(() => { console.log("Congratulations " + nameInput + " You saved the multiverse and beat the game!!!! \n"); }, 14000) setTimeout(() => { restartGame(); }, 17000) } diff --git a/package-lock.json b/package-lock.json index 1082e20..e4351a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "license": "ISC", "dependencies": { "chalk": "^4.1.0", + "chalklet": "^1.0.0", + "figlet": "^1.5.0", "readline-sync": "^1.4.10" } }, @@ -41,6 +43,71 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chalklet": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chalklet/-/chalklet-1.0.0.tgz", + "integrity": "sha512-4+QgYsN7LGFGEBgTa5su3Fx1F5q5ERKJI7qhdsJGHC2cgXY4h3qCsivX4x7hlcYHdJmwEuPVMBSiEyqNBEdHZQ==", + "dependencies": { + "chalk": "^2.4.1", + "figlet": "^1.2.1" + } + }, + "node_modules/chalklet/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalklet/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalklet/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/chalklet/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "node_modules/chalklet/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/chalklet/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -57,6 +124,22 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/figlet": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.5.0.tgz", + "integrity": "sha512-ZQJM4aifMpz6H19AW1VqvZ7l4pOE9p7i/3LyxgO2kp+PO/VcDYNqIHEMtkccqIhTXMKci4kjueJr/iCQEaT/Ww==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -103,6 +186,61 @@ "supports-color": "^7.1.0" } }, + "chalklet": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chalklet/-/chalklet-1.0.0.tgz", + "integrity": "sha512-4+QgYsN7LGFGEBgTa5su3Fx1F5q5ERKJI7qhdsJGHC2cgXY4h3qCsivX4x7hlcYHdJmwEuPVMBSiEyqNBEdHZQ==", + "requires": { + "chalk": "^2.4.1", + "figlet": "^1.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -116,6 +254,16 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "figlet": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.5.0.tgz", + "integrity": "sha512-ZQJM4aifMpz6H19AW1VqvZ7l4pOE9p7i/3LyxgO2kp+PO/VcDYNqIHEMtkccqIhTXMKci4kjueJr/iCQEaT/Ww==" + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", diff --git a/package.json b/package.json index ec48514..4cefe01 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "homepage": "https://github.com/joinpursuit/FSW-Text-Based-Adventure#readme", "dependencies": { "chalk": "^4.1.0", + "chalklet": "^1.0.0", + "figlet": "^1.5.0", "readline-sync": "^1.4.10" } } From bd35c56f58fe2fd0f08ac7f96f3609c8ee17be92 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Tue, 5 Jan 2021 21:27:56 -0500 Subject: [PATCH 06/20] all done --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 306 +++++++++--------- 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index c4b8031..0a47d21 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -4,13 +4,13 @@ const chalk = require('chalk'); const figlet = require('figlet') -console.log(figlet.textSync(' FLAME RAGNAROK', { +console.log(chalk.redBright(figlet.textSync('THE FLAME ' + ' OF' + ' RAGNAROK', { font: 'Fire Font-k', horizontalLayout: 'default', verticalLayout: 'default', width: 60, whitespaceBreak: true -})) +}))) let nameInput = readline.question(chalk.bold.yellowBright("Enter your name: ")); @@ -21,11 +21,11 @@ console.log(chalk.blueBright("Also if come across " + chalk.bold.greenBright("Lo console.log(chalk.green("In your exploration you will need to find " + chalk.bold.yellowBright("Gungnir ") + "the spear of Odin himself inorder to stop Ragnarok!!!!")) const startGame = () => { - console.log(chalk.red.bold("Welcome " + nameInput + "!")) - if (readline.keyInYN('Would you like to start your adventure? \n')) { - console.log("Let's Begin!") - console.log("This will be an epic adventure " + nameInput + ", may the odds be your favor!!!") - console.log("Good luck!!!! \n") + console.log(chalk.red.bold("Welcome " + chalk.bold.yellowBright(nameInput) + "!")) + if (chalk.blueBright(readline.keyInYN('Would you like to start your adventure? \n'))) { + console.log(chalk.green("Let's Begin!")) + console.log(chalk.green("This will be an epic adventure ") + chalk.bold.yellowBright(nameInput) + chalk.green(", may the odds be your favor!!!")) + console.log(chalk.green("Good luck!!!! \n")) runOrFly() } else{ @@ -35,9 +35,9 @@ const startGame = () => { } function runOrFly(){ - console.log("You wake up in the Castle of Asgard. \n") - console.log("You just got word that Thor, The God of Thunder himself wants to speak to you about a very important quest! \n") - console.log("He is waiting for you in Thrudheim. Would you like to run or fly?") + console.log(chalk.green("You wake up in the Castle of Asgard. \n")) + console.log(chalk.green("You just got word that Thor, The God of Thunder himself wants to speak to you about a very important quest! \n")) + console.log(chalk.green("He is waiting for you in Thrudheim. Would you like to run or fly?")) let ability while(ability !== "run" && ability !== "fly"){ ability = readline.question("Please choose run or fly \n") @@ -48,37 +48,37 @@ function runOrFly(){ chooseArmorThorOffers() } else{ - console.log("Invalid choice, Please choose run or fly! \n") + console.log(chalk.redBright("Invalid choice, Please choose run or fly! \n")) runOrFly() } } } function chooseArmorInCastle(){ - console.log("Before heading to Thrudheim, you see a few armor sets that are element based: Fire, Earth, Water, Thunder, & Steel \n") + console.log(chalk.green("Before heading to Thrudheim, you see a few armor sets that are element based: Fire, Earth, Water, Thunder, & Steel \n")) let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") if(armor === "Fire"){ - console.log("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" ) - console.log("You now head to Thrudheim \n") + console.log(chalk.green("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" )) + console.log(chalk.green("You now head to Thrudheim \n")) } else if(armor === "Earth"){ - console.log("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n") - console.log("You now head to Thrudheim \n") + console.log(chalk.green("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n")) + console.log(chalk.green("You now head to Thrudheim \n")) } else if(armor === "Water"){ - console.log("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ") - console.log("You now head to Thrudheim \n") + console.log(chalk.green("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ")) + console.log(chalk.green("You now head to Thrudheim \n")) } else if(armor === "Thunder"){ - console.log("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n") - console.log("You now head to Thrudheim \n") + console.log(chalk.green("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n")) + console.log(chalk.green("You now head to Thrudheim \n")) } else if(armor === "Steel"){ - console.log("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n") - console.log("You now head to Thrudheim \n") + console.log(chalk.green("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n")) + console.log(chalk.green("You now head to Thrudheim \n")) } else{ -console.log("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n") +console.log(chalk.redBright("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n")) chooseArmorInCastle() } @@ -86,35 +86,35 @@ thrudheimCaves() } function chooseArmorThorOffers(){ - console.log("After hearing that the mighty Thor has summoned you,") - console.log("You decided that flying would be fastest getting to him.... \n") - console.log("You are stopped half way in your flight by no other than Thor himself.... \n") - console.log(nameInput + " what's taking you so long he asks? I asked to speak with you over an hour ago!! \n") - console.log("Also where is your armor?!?!?!?! You know that God needs their armor without it can be very dangerous!! \n") - console.log("Luckily I brought a few armor sets with me just in case they are element based: Fire, Earth, Water, Thunder, & Steel \n") + console.log(chalk.green("After hearing that the mighty Thor has summoned you,")) + console.log(chalk.green("You decided that flying would be fastest getting to him.... \n")) + console.log(chalk.green("You are stopped half way in your flight by no other than Thor himself.... \n")) + console.log(chalk.bold.yellowBright(nameInput) + chalk.green(" what's taking you so long he asks? I asked to speak with you over an hour ago!! \n")) + console.log(chalk.green("Also where is your armor?!?!?!?! You know that God needs their armor without it can be very dangerous!! \n")) + console.log(chalk.green("Luckily I brought a few armor sets with me just in case they are element based: Fire, Earth, Water, Thunder, & Steel \n")) let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") if(armor === "Fire"){ - console.log("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" ) - console.log("You now head to Thrudheim together with Thor \n") + console.log(chalk.green("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" )) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) } else if(armor === "Earth"){ - console.log("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n") - console.log("You now head to Thrudheim together with Thor \n") + console.log(chalk.green("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) } else if(armor === "Water"){ - console.log("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ") - console.log("You now head to Thrudheim together with Thor \n") + console.log(chalk.green("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) } else if(armor === "Thunder"){ - console.log("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n") - console.log("You now head to Thrudheim together with Thor \n") + console.log(chalk.green("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) } else if(armor === "Steel"){ - console.log("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n") - console.log("You now head to Thrudheim together with Thor \n") + console.log(chalk.green("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) } else{ -console.log("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n") +console.log(chalk.redBright("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n")) chooseArmorThorOffers() } @@ -122,12 +122,12 @@ thrudheimCaves() } function thrudheimCaves(){ -console.log("After a few minutes you have reached The Thrudheim Caves \n") -console.log("Thor stops and seems confused and says " + nameInput + " these four paths weren't here before, \n") -console.log("You see " + nameInput + " why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n") -console.log("And it seems like this time he has gone too far!!! \n") -console.log(nameInput + " It's up to you to stop him or Ragnarok will spread throughout Asgard and then to the rest of the multi-verse!!! \n") -console.log("He will be in the Cave of Time find him and stop him Young God!!!!!! \n") +console.log(chalk.green("After a few minutes you have reached The Thrudheim Caves \n")) +console.log(chalk.green("Thor stops and seems confused and says ") + chalk.bold.yellowBright(nameInput) + chalk.green(" these four paths weren't here before, \n")) +console.log(chalk.green("You see ") + chalk.bold.yellowBright(nameInput) + chalk.green(" why I called you here now? It's my brother Loki he is up to his no good deeds again.... \n")) +console.log(chalk.green("And it seems like this time he has gone too far!!! \n")) +console.log(chalk.bold.yellowBright(nameInput) + chalk.green(" It's up to you to stop him or Ragnarok will spread throughout Asgard and then to the rest of the multi-verse!!! \n")) +console.log(chalk.green("He will be in the Cave of Time find him and stop him Young God!!!!!! \n")) let path = readline.question("Which of the four paths would you like to take: path (1), path (2), path (3), or path (4); (Choose a number) \n") if(path === "1"){ goingThroughPathOne() @@ -142,15 +142,15 @@ else if(path === "4"){ goingThroughPathFour() } else{ - console.log("Invalid Entry, Remember it's number... Please try again \n") + console.log(chalk.redBright("Invalid Entry, Remember it's number... Please try again \n")) thrudheimCaves() } } function goingThroughPathOne(){ - console.log("You decided to take the first path. \n") - console.log("While walking along the path you notice that there is a vendor selling goods. \n") - console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + console.log(chalk.green("You decided to take the first path. \n")) + console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) + console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") if (merchant === "Health Potions"){ healthPotion() @@ -162,15 +162,15 @@ function goingThroughPathOne(){ staminaPotion() } else{ - console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) goingThroughPathOne() } } function goingThroughPathTwo(){ - console.log("You decided to take the second path. \n") - console.log("While walking along the path you notice that there is a vendor selling goods. \n") - console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + console.log(chalk.green("You decided to take the second path. \n")) + console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) + console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") if (merchant === "Health Potions"){ healthPotion() @@ -182,15 +182,15 @@ function goingThroughPathTwo(){ staminaPotion() } else{ - console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) goingThroughPathTwo() } } function goingThroughPathThree(){ - console.log("You decided to take the third path. \n") - console.log("While walking through this path all of a sudden you hear a loud sinister laugh!!!") - console.log("Oh no it's Loki!! He brings down the boulder right on top of you!! \n") + console.log(chalk.green("You decided to take the third path. \n")) + console.log(chalk.green("While walking through this path all of a sudden you hear a loud sinister laugh!!!")) + console.log(chalk.green("Oh no it's Loki!! He brings down the boulder right on top of you!! \n")) let blocked = readline.question("What would you like to do: quit or restart? \n") if (blocked === "quit"){ quitGame() @@ -199,15 +199,15 @@ else if(blocked === "restart"){ restartGame() } else{ - console.log("Invalid response please select either: quit or restart, and try again!! \n") + console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) goingThroughPathThree() } } function goingThroughPathFour(){ - console.log("You decided to take the fourth path. \n") - console.log("While walking along the path you notice that there is a vendor selling goods. \n") - console.log("Hoping that he has something to help you along your journey you carefully approach. \n") + console.log(chalk.green("You decided to take the fourth path. \n")) + console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) + console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") if (merchant === "Health Potions"){ healthPotion() @@ -219,83 +219,83 @@ function goingThroughPathFour(){ staminaPotion() } else{ - console.log("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n") + console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) goingThroughPathFourth() } } function healthPotion(){ - console.log("You chose the Health Potion that is a very wise choice!! \n") - console.log("I would recommend that you use it wisely.. \n") - console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + console.log(chalk.green("You chose the Health Potion that is a very wise choice!! \n")) + console.log(chalk.green("I would recommend that you use it wisely.. \n")) + console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") if (continuedPath === "Rest"){ - console.log("You rested for a bit and then drank the Health Potion. \n") - console.log("You then carried on the path feeling full of energy, it was hard but you got the feeling that it's only the begining. \n") + console.log(chalk.green("You rested for a bit and then drank the Health Potion. \n")) + console.log(chalk.green("You then carried on the path feeling full of energy, it was hard but you got the feeling that it's only the begining. \n")) caveOfTime() } else if (continuedPath === "Carry On"){ - console.log("You then carried on the path feeling full of energy. \n") - console.log("It was a long and hard path but you got the feeling that it's only the begining, but so far you have managed to overcome every obstacle!! \n") + console.log(chalk.green("You then carried on the path feeling full of energy. \n")) + console.log(chalk.green("It was a long and hard path but you got the feeling that it's only the begining, but so far you have managed to overcome every obstacle!! \n")) caveOfTime() } else if (continuedPath === "Quit"){ - console.log("It's a shame that you decided not to continue your adventure Young God... \n") - console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) + console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } } function vitalityPotion(){ - console.log("You chose the Vitality Potion that is a very wise choice!! \n") - console.log("I would recommend that you use it wisely.. \n") - console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + console.log(chalk.green("You chose the Vitality Potion that is a very wise choice!! \n")) + console.log(chalk.green("I would recommend that you use it wisely.. \n")) + console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") if (continuedPath === "Rest"){ - console.log("You rested for a bit and then drank the Vitality Potion. \n") - console.log("You then carried on the path feeling full of magic energy, this magic is powerful making you unstoppable!! \n") + console.log(chalk.green("You rested for a bit and then drank the Vitality Potion. \n")) + console.log(chalk.green("You then carried on the path feeling full of magic energy, this magic is powerful making you unstoppable!! \n")) caveOfTime() } else if (continuedPath === "Carry On"){ - console.log("You then carried on the path feeling full of magic energy. \n") - console.log("The path was long but using the magic potion really helped and made it a little easier!! \n") + console.log(chalk.green("You then carried on the path feeling full of magic energy. \n")) + console.log(chalk.green("The path was long but using the magic potion really helped and made it a little easier!! \n")) caveOfTime() } else if (continuedPath === "Quit"){ - console.log("It's a shame that you decided not to continue your adventure Young God... \n") - console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) + console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } } function staminaPotion(){ - console.log("You chose the Stamina Potion that is a very wise choice!! \n") - console.log("I would recommend that you use it wisely.. \n") - console.log("Now that you have everything you need, you need to decide what you want to do to continue your path. \n") + console.log(chalk.green("You chose the Stamina Potion that is a very wise choice!! \n")) + console.log(chalk.green("I would recommend that you use it wisely.. \n")) + console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") if (continuedPath === "Rest"){ - console.log("You rested for a bit and then drank the Stamina Potion. \n") - console.log("You then carried on the path feeling full of stamina, it was quick and easy, wow these potions are amazing!! \n") + console.log(chalk.green("You rested for a bit and then drank the Stamina Potion. \n")) + console.log(chalk.green("You then carried on the path feeling full of stamina, it was quick and easy, wow these potions are amazing!! \n")) caveOfTime() } else if (continuedPath === "Carry On"){ - console.log("You then carried on the path feeling full of energy. \n") - console.log("The path was long but so far you have managed to overcome every obstacle quickly!! \n") + console.log(chalk.green("You then carried on the path feeling full of energy. \n")) + console.log(chalk.green("The path was long but so far you have managed to overcome every obstacle quickly!! \n")) caveOfTime() } else if (continuedPath === "Quit"){ - console.log("It's a shame that you decided not to continue your adventure Young God... \n") - console.log("Until next time remember that the fate of the multi-verse is in your hands!! \n") + console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) + console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } } function caveOfTime(){ - console.log("After a few minutes you reach the Cave of Time!! \n") - console.log(nameInput + " wait I need to tell you something...") - console.log("'Thor flew down' " + nameInput + " you need to becareful inside the Cave of Time, Loki will be up to no good!!! \n") - console.log("Once you go inside there will be four pathways one of them will lead you to Gungnir,") - console.log("That is the Spear of Odin himself, we will need it to stop Ragnarok and save the multi-verse good luck " + nameInput + "!!! \n") + console.log(chalk.green("After a few minutes you reach the Cave of Time!! \n")) + console.log(chalk.bold.yellowBright(nameInput) + chalk.green(" wait I need to tell you something...")) + console.log(chalk.green("'Thor flew down' ") + chalk.bold.yellowBright(nameInput) + chalk.green(" you need to becareful inside the Cave of Time, Loki will be up to no good!!! \n")) + console.log(chalk.green("Once you go inside there will be four pathways one of them will lead you to Gungnir,")) + console.log(chalk.green("That is the Spear of Odin himself, we will need it to stop Ragnarok and save the multi-verse good luck ") + chalk.yellowBright(nameInput) + chalk.red("!!! \n")) let cavePath = readline.question("You have entered the Cave of Time and you have found the four paths Thor was talking about, which path route will you take: route(1), route(2), route(3), or route(4). Please choose a number. \n") if (cavePath === "1"){ routePathOne() @@ -310,21 +310,21 @@ function caveOfTime(){ routePathFour() } else{ - console.log("Invalid Entry, Remember it's number... Please try again \n") + console.log(chalk.redBright("Invalid Entry, Remember it's number... Please try again \n")) caveOfTime() } } function routePathOne(){ - console.log("You decided to take the first path...") - console.log("You walk deep into the cave and it seems like that it goes on forever....") - console.log("After sometime and what seemed like an eternity later, you take a step and fall into the Hole of Eternal Darkness. \n") - setTimeout(() => { console.log("."); }, 2000) - setTimeout(() => { console.log(".."); }, 6000) - setTimeout(() => { console.log("..."); }, 8000) - setTimeout(() => { console.log("...."); }, 10000) - setTimeout(() => { console.log("....."); }, 12000) - setTimeout(() => { let fall = readline.question("What would you like to do: quit or restart? \n") + console.log(chalk.green("You decided to take the first path...")) + console.log(chalk.green("You walk deep into the cave and it seems like that it goes on forever....")) + console.log(chalk.green("After sometime and what seemed like an eternity later, you take a step and fall into the Hole of Eternal Darkness. \n")) + setTimeout(() => { console.log(chalk.cyanBright(".")); }, 2000) + setTimeout(() => { console.log(chalk.cyanBright("..")); }, 6000) + setTimeout(() => { console.log(chalk.cyanBright("...")); }, 8000) + setTimeout(() => { console.log(chalk.cyanBright("....")); }, 10000) + setTimeout(() => { console.log(chalk.cyanBright(".....")); }, 12000) + setTimeout(() => { let fall = chalk.blueBright(readline.question("What would you like to do: quit or restart? \n")) if (fall === "quit"){ quitGame() } @@ -332,15 +332,15 @@ else if(fall === "restart"){ restartGame() } else{ - console.log("Invalid response please select either: quit or restart, and try again!! \n") + console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) routePathOne() } }, 14000) } function routePathTwo(){ - console.log("You decided to take the second path...") - console.log("You walk deep into the cave and just you thought this is taking a long time... \n") + console.log(chalk.green("You decided to take the second path...")) + console.log(chalk.green("You walk deep into the cave and just you thought this is taking a long time... \n")) let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") if (cavePathLeftOrRight === "Right"){ console.log("You entered the right path of the cave..") @@ -351,16 +351,16 @@ function routePathTwo(){ cavePathLeft() } else{ - console.log("Invalid Entry Please choose: Right or Left, try again!") + console.log(chalk.redBright("Invalid Entry Please choose: Right or Left, try again!")) routePathTwo() } } function routePathThree(){ - console.log("You decided to take the third path...") - console.log("You walk deep into the cave and it seems like that it goes on forever....") - setTimeout(() => { console.log("After a while Loki appeared... you shouldn't be here this will be your downfall!!"); }, 6000) - setTimeout(() => { console.log("He suddenly disappears and The Bifrost sweeps you away!!"); }, 10000) + console.log(chalk.green("You decided to take the third path...")) + console.log(chalk.green("You walk deep into the cave and it seems like that it goes on forever....")) + setTimeout(() => { console.log(chalk.cyanBright("After a while Loki appeared... you shouldn't be here this will be your downfall!!")); }, 6000) + setTimeout(() => { console.log(chalk.cyanBright("He suddenly disappears and The Bifrost sweeps you away!!")); }, 10000) setTimeout(() => { let sweep = readline.question("What would you like to do: quit or restart? \n") if (sweep === "quit"){ quitGame() @@ -369,15 +369,15 @@ else if(sweep === "restart"){ restartGame() } else{ - console.log("Invalid response please select either: quit or restart, and try again!! \n") + console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) routePathThree() } }, 16000) } function routePathFour(){ - console.log("You decided to take the fourth path...") - console.log("You walk deep into the cave and just you thought this is taking a long time... \n") + console.log(chalk.green("You decided to take the fourth path...")) + console.log(chalk.green("You walk deep into the cave and just you thought this is taking a long time... \n")) let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") if (cavePathLeftOrRight === "Right"){ console.log("You entered the right path of the cave.. \n") @@ -388,86 +388,86 @@ function routePathFour(){ cavePathLeft() } else{ - console.log("Invalid Entry Please choose: Right or Left, try again! \n") + console.log(chalk.redBright("Invalid Entry Please choose: Right or Left, try again! \n")) routePathFour() } } function cavePathRight(){ - console.log("You see a glowing light coming from deep in the cave...") - console.log("You get excited and hurry torwards that light! \n") - console.log("When you reach the light you meet the old wizard and he says " + nameInput + " in order to get what you need,") - console.log("You need to play a game I'm going to give you five treasure chests, only one has what you need while the others don't. \n") + console.log(chalk.green("You see a glowing light coming from deep in the cave...")) + console.log(chalk.green("You get excited and hurry torwards that light! \n")) + console.log(chalk.green("When you reach the light you meet the old wizard and he says ") + chalk.bold.yellowBright(nameInput) + chalk.green(" in order to get what you need,")) + console.log(chalk.green("You need to play a game I'm going to give you five treasure chests, only one has what you need while the others don't. \n")) if (readline.keyInYN('Would you like to play? \n')){ let index = readline.question('Which chest would you like to chose? Please choose one: Chest 1, Chest 2, Chest 3, Chest 4, or Chest 5. \n' ); if (index === 'Chest 1'){ - console.log("Wow gold and lots of it!! It's a shame that's not what you need") - console.log("Please try again!! \n") + console.log(chalk.green("Wow gold and lots of it!! It's a shame that's not what you need")) + console.log(chalk.magenta("Please try again!! \n")) cavePathRight() } else if(index === 'Chest 2'){ - console.log("It's Gungnir!!! Congrats!!!! Now it's time to stop Loki!!!!! \n") + console.log(chalk.yellowBright("It's Gungnir!!! Congrats!!!! Now it's time to stop Loki!!!!! \n")) finalShowDown() } else if(index === 'Chest 3'){ - console.log("It's Thors hammer!! To bad that's not what you need") - console.log("Please try again!! \n") + console.log(chalk.green("It's Thors hammer!! To bad that's not what you need")) + console.log(chalk.magenta("Please try again!! \n")) cavePathRight() } else if(index === 'Chest 4'){ - console.log("It's a feast of food, it looks so good it's making you hungry!!") - console.log("Please try again!! \n") + console.log(chalk.green("It's a feast of food, it looks so good it's making you hungry!!")) + console.log(chalk.magenta("Please try again!! \n")) cavePathRight() } else if(index === 'Chest 5'){ - console.log("An empty chest?! Looks like this wizard has a sense of humor!!!") - console.log("Please try again!! \n") + console.log(chalk.green("An empty chest?! Looks like this wizard has a sense of humor!!!")) + console.log(chalk.magenta("Please try again!! \n")) cavePathRight() } else{ - console.log("He's a tricky wizard, Please try again!! \n") + console.log(chalk.magenta("He's a tricky wizard, Please try again Remember to Type 'Chest' with the number!! \n")) } } else{ - console.log("It is recommended that you play the fate of the multi-verse lies in your hands after all " + nameInput + "!! \n") + console.log(chalk.magenta("It is recommended that you play the fate of the multi-verse lies in your hands after all ") + chalk.bold.yellowBright(nameInput) + chalk.magenta("!! \n")) cavePathRight() } } function cavePathLeft(){ - console.log("You are starting to grow weary and tired you didn't expect that the Cave of Time would be this big... \n") - console.log("You start to question your decision and wonder if you should give up..... \n") - setTimeout(() => { console.log("Well what did you expect you are in the Cave of Time after all, A Voice Echoed From the Distance!!!!! \n"); }, 7000) - setTimeout(() => { console.log("I am just an old wizard trying to help don't get frightened Young God"); }, 10000) - setTimeout(() => { console.log("I will transport you over to the correct cave!!!!! \n"); }, 13000) + console.log(chalk.green("You are starting to grow weary and tired you didn't expect that the Cave of Time would be this big... \n")) + console.log(chalk.green("You start to question your decision and wonder if you should give up..... \n")) + setTimeout(() => { console.log(chalk.cyanBright("Well what did you expect you are in the Cave of Time after all, A Voice Echoed From the Distance!!!!! \n")); }, 7000) + setTimeout(() => { console.log(chalk.cyanBright("I am just an old wizard trying to help don't get frightened Young God")); }, 10000) + setTimeout(() => { console.log(chalk.cyanBright("I will transport you over to the correct cave!!!!! \n")); }, 13000) setTimeout(() => { cavePathRight(); }, 16000) } function finalShowDown(){ - setTimeout(() => { console.log("Just like that old wizard transported you outside The Cave of Time!!!!! \n"); }, 5000) - setTimeout(() => { console.log("Congrats!!!! " + nameInput + " I knew you can do it said Thor, by the way that old wizard is my father Odin himself!! \n"); }, 7000) - setTimeout(() => { console.log("He wanted to make sure you are worthy, he has done something similar to me in the past as well! \n"); }, 11000) - setTimeout(() => { console.log("Now that you have Gungnir you have to throw it in the Flame of Ragnarok while I take care of my brother Loki... \n"); }, 15000) + setTimeout(() => { console.log(chalk.cyanBright("Just like that old wizard transported you outside The Cave of Time!!!!! \n")); }, 5000) + setTimeout(() => { console.log(chalk.cyanBright("Congrats!!!! ") + chalk.bold.yellowBright(nameInput) + chalk.cyanBright(" I knew you can do it said Thor, by the way that old wizard is my father Odin himself!! \n")); }, 7000) + setTimeout(() => { console.log(chalk.cyanBright("He wanted to make sure you are worthy, he has done something similar to me in the past as well! \n")); }, 11000) + setTimeout(() => { console.log(chalk.cyanBright("Now that you have Gungnir you have to throw it in the Flame of Ragnarok while I take care of my brother Loki... \n")); }, 15000) setTimeout(() => { if(readline.keyInYN("Are you ready to stop Ragnarok? \n")){ - console.log("With all your might during the epic fight between Thor and Loki..") - console.log("You threw Gungnir into the Flame of Ragnarok and saved the multiverse...") - console.log("Congratulations " + nameInput + " You beat the game!!!") + console.log(chalk.yellowBright("With all your might during the epic fight between Thor and Loki..")) + console.log(chalk.yellowBright("You threw Gungnir into the Flame of Ragnarok and saved the multiverse...")) + console.log(chalk.green("Congratulations ") + chalk.bold.yellowBright(nameInput) + chalk.green(" You beat the game!!!")) restartGame() } else{ - console.log("You get caught in the crossfire between Thor and Loki!!!") - console.log("The Staff of Odin flies from your hand, but you're not going to give up.") - console.log("With every ounce of energy you have left you get up and start looking for Gungnir.... \n") + console.log(chalk.magenta("You get caught in the crossfire between Thor and Loki!!!")) + console.log(chalk.magenta("The Staff of Odin flies from your hand, but you're not going to give up.")) + console.log(chalk.magenta("With every ounce of energy you have left you get up and start looking for Gungnir.... \n")) finalThrowItsAllOrNothing() } }, 19000) } function finalThrowItsAllOrNothing () { - console.log("After what seemed like an eternity you finally find Gungnir... \n") - console.log("Asgard looks like a dead planet now due to Loki's actions, it was once a very beautiful place!!! \n") - setTimeout(() => { console.log("It is now or never!! You take Gungnir and throw it with all your might right in the center of The Flame of Ragnarok!!! \n")}, 8000) - setTimeout(() => { console.log("Congratulations " + nameInput + " You saved the multiverse and beat the game!!!! \n"); }, 14000) + console.log(chalk.green("After what seemed like an eternity you finally find Gungnir... \n")) + console.log(chalk.green("Asgard looks like a dead planet now due to Loki's actions, it was once a very beautiful place!!! \n")) + setTimeout(() => { console.log(chalk.cyanBright("It is now or never!! You take Gungnir and throw it with all your might right in the center of The Flame of Ragnarok!!! \n"))}, 8000) + setTimeout(() => { console.log(chalk.cyanBright("Congratulations " + chalk.bold.yellowBright(nameInput) + " You saved the multiverse and beat the game!!!! \n")); }, 14000) setTimeout(() => { restartGame(); }, 17000) } @@ -487,8 +487,8 @@ const restartGame = () => { } const quitGame = () => { - console.log("Goodbye! Until we meet again!!") - console.log("And remember that Asgard is where it's people are not the where the land is Young God!!!") + console.log(chalk.redBright("Goodbye! Until we meet again!!")) + console.log(chalk.redBright("And remember that Asgard is where it's people are not the where the land is Young God!!!")) process.exit() } From db1c15aea52ba0d0b5ad1dfe294718b86a9e504e Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Tue, 5 Jan 2021 21:45:19 -0500 Subject: [PATCH 07/20] found a bug fixed now --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 0a47d21..4137551 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -329,7 +329,7 @@ function routePathOne(){ quitGame() } else if(fall === "restart"){ - restartGame() + caveOfTime() } else{ console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) @@ -366,7 +366,7 @@ function routePathThree(){ quitGame() } else if(sweep === "restart"){ - restartGame() + caveOfTime() } else{ console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) From e4ccb32299b6b97f4a24186f0cbce4803b25c0b6 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Tue, 5 Jan 2021 21:46:22 -0500 Subject: [PATCH 08/20] should be all good now --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 4137551..b762adc 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -324,12 +324,12 @@ function routePathOne(){ setTimeout(() => { console.log(chalk.cyanBright("...")); }, 8000) setTimeout(() => { console.log(chalk.cyanBright("....")); }, 10000) setTimeout(() => { console.log(chalk.cyanBright(".....")); }, 12000) - setTimeout(() => { let fall = chalk.blueBright(readline.question("What would you like to do: quit or restart? \n")) + setTimeout(() => { let fall = readline.question("What would you like to do: quit or restart? \n") if (fall === "quit"){ quitGame() } else if(fall === "restart"){ - caveOfTime() + restartGame() } else{ console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) @@ -366,7 +366,7 @@ function routePathThree(){ quitGame() } else if(sweep === "restart"){ - caveOfTime() + restartGame() } else{ console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) From 77837ae239703de14bcef98298417289000080b9 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Wed, 6 Jan 2021 10:19:22 -0500 Subject: [PATCH 09/20] i forgot to push this last night --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index b762adc..559cc66 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -35,7 +35,7 @@ const startGame = () => { } function runOrFly(){ - console.log(chalk.green("You wake up in the Castle of Asgard. \n")) + console.log(chalk.green("You wake up in the Castle of Asgard. \n")) console.log(chalk.green("You just got word that Thor, The God of Thunder himself wants to speak to you about a very important quest! \n")) console.log(chalk.green("He is waiting for you in Thrudheim. Would you like to run or fly?")) let ability From e5b33d9995b570c81bf54428361ca9cbc15d12a6 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Wed, 6 Jan 2021 17:29:53 -0500 Subject: [PATCH 10/20] fixed another bug --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 559cc66..b9699c0 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -244,6 +244,10 @@ function healthPotion(){ console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } + else { + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) + + } } function vitalityPotion(){ @@ -266,6 +270,8 @@ function vitalityPotion(){ console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } + else { + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) } function staminaPotion(){ @@ -288,6 +294,8 @@ function staminaPotion(){ console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) quitGame() } + else { + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) } function caveOfTime(){ From 91e2fce88719ab7c193cca2ab09bda0d1c5ff16f Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Wed, 6 Jan 2021 17:30:20 -0500 Subject: [PATCH 11/20] should be good now --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index b9699c0..b942c1f 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -246,7 +246,6 @@ function healthPotion(){ } else { console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) - } } @@ -272,7 +271,8 @@ function vitalityPotion(){ } else { console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) -} + } + } function staminaPotion(){ console.log(chalk.green("You chose the Stamina Potion that is a very wise choice!! \n")) @@ -296,6 +296,7 @@ function staminaPotion(){ } else { console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) + } } function caveOfTime(){ From 58bab6fe2127725f4ca04e92925f64dd9f630c59 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Wed, 6 Jan 2021 17:40:01 -0500 Subject: [PATCH 12/20] Im not seeing my commits so I tried again --- ...One_Individual_Project_The_Flame_Of_Ragnarok.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index b942c1f..cfd3c53 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -245,7 +245,8 @@ function healthPotion(){ quitGame() } else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) + thrudheimCaves() } } @@ -270,7 +271,8 @@ function vitalityPotion(){ quitGame() } else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) + thrudheimCaves() } } @@ -295,7 +297,8 @@ function staminaPotion(){ quitGame() } else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!!")) + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) + thrudheimCaves() } } @@ -435,7 +438,8 @@ function cavePathRight(){ } else{ console.log(chalk.magenta("He's a tricky wizard, Please try again Remember to Type 'Chest' with the number!! \n")) - } + cavePathRight() + } } else{ console.log(chalk.magenta("It is recommended that you play the fate of the multi-verse lies in your hands after all ") + chalk.bold.yellowBright(nameInput) + chalk.magenta("!! \n")) @@ -463,7 +467,7 @@ function finalShowDown(){ console.log(chalk.green("Congratulations ") + chalk.bold.yellowBright(nameInput) + chalk.green(" You beat the game!!!")) restartGame() } - else{ + else { console.log(chalk.magenta("You get caught in the crossfire between Thor and Loki!!!")) console.log(chalk.magenta("The Staff of Odin flies from your hand, but you're not going to give up.")) console.log(chalk.magenta("With every ounce of energy you have left you get up and start looking for Gungnir.... \n")) From ad1760f14c1bd631a9d1a6c8913c1b6734c8a16f Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Wed, 6 Jan 2021 18:03:59 -0500 Subject: [PATCH 13/20] All fixed --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index cfd3c53..0fd7bb8 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -441,11 +441,7 @@ function cavePathRight(){ cavePathRight() } } -else{ - console.log(chalk.magenta("It is recommended that you play the fate of the multi-verse lies in your hands after all ") + chalk.bold.yellowBright(nameInput) + chalk.magenta("!! \n")) - cavePathRight() -} -} + } function cavePathLeft(){ console.log(chalk.green("You are starting to grow weary and tired you didn't expect that the Cave of Time would be this big... \n")) From 44d813a29241275f77b4d379549beda7974686c3 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Fri, 8 Jan 2021 16:41:44 -0500 Subject: [PATCH 14/20] I fixed the issue in the begining of the code that Myra mentioned --- ...le_One_Individual_Project_The_Flame_Of_Ragnarok.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 0fd7bb8..9eaced4 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -22,7 +22,9 @@ console.log(chalk.green("In your exploration you will need to find " + chalk.bol const startGame = () => { console.log(chalk.red.bold("Welcome " + chalk.bold.yellowBright(nameInput) + "!")) - if (chalk.blueBright(readline.keyInYN('Would you like to start your adventure? \n'))) { + + let answer = readline.keyInYN('Would you like to start your adventure? \n') + if (answer){ console.log(chalk.green("Let's Begin!")) console.log(chalk.green("This will be an epic adventure ") + chalk.bold.yellowBright(nameInput) + chalk.green(", may the odds be your favor!!!")) console.log(chalk.green("Good luck!!!! \n")) @@ -30,8 +32,7 @@ const startGame = () => { } else{ quitGame() - } - + } } function runOrFly(){ @@ -482,10 +483,6 @@ function finalThrowItsAllOrNothing () { - - - - const restartGame = () => { if(readline.keyInYN("Would you like to play again? \n")){ runOrFly() From b40d1a154d58bb339eda34fbb466a5753b84c607 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 11 Jan 2021 18:20:33 -0500 Subject: [PATCH 15/20] goingThroughPathThree issue --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 194 ++++++++---------- 1 file changed, 87 insertions(+), 107 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 9eaced4..7bd1e1e 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -4,6 +4,9 @@ const chalk = require('chalk'); const figlet = require('figlet') +let armor +let merchant + console.log(chalk.redBright(figlet.textSync('THE FLAME ' + ' OF' + ' RAGNAROK', { font: 'Fire Font-k', horizontalLayout: 'default', @@ -23,7 +26,7 @@ console.log(chalk.green("In your exploration you will need to find " + chalk.bol const startGame = () => { console.log(chalk.red.bold("Welcome " + chalk.bold.yellowBright(nameInput) + "!")) - let answer = readline.keyInYN('Would you like to start your adventure? \n') + let answer = readline.keyInYN(chalk.red('Would you like to start your adventure? \n')) if (answer){ console.log(chalk.green("Let's Begin!")) console.log(chalk.green("This will be an epic adventure ") + chalk.bold.yellowBright(nameInput) + chalk.green(", may the odds be your favor!!!")) @@ -57,31 +60,8 @@ function runOrFly(){ function chooseArmorInCastle(){ console.log(chalk.green("Before heading to Thrudheim, you see a few armor sets that are element based: Fire, Earth, Water, Thunder, & Steel \n")) -let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") -if(armor === "Fire"){ - console.log(chalk.green("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" )) - console.log(chalk.green("You now head to Thrudheim \n")) -} -else if(armor === "Earth"){ - console.log(chalk.green("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n")) - console.log(chalk.green("You now head to Thrudheim \n")) -} -else if(armor === "Water"){ - console.log(chalk.green("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ")) - console.log(chalk.green("You now head to Thrudheim \n")) -} -else if(armor === "Thunder"){ - console.log(chalk.green("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n")) - console.log(chalk.green("You now head to Thrudheim \n")) -} -else if(armor === "Steel"){ - console.log(chalk.green("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n")) - console.log(chalk.green("You now head to Thrudheim \n")) -} -else{ -console.log(chalk.redBright("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n")) -chooseArmorInCastle() -} +armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") +chooseArmor(armor) thrudheimCaves() } @@ -93,33 +73,11 @@ function chooseArmorThorOffers(){ console.log(chalk.bold.yellowBright(nameInput) + chalk.green(" what's taking you so long he asks? I asked to speak with you over an hour ago!! \n")) console.log(chalk.green("Also where is your armor?!?!?!?! You know that God needs their armor without it can be very dangerous!! \n")) console.log(chalk.green("Luckily I brought a few armor sets with me just in case they are element based: Fire, Earth, Water, Thunder, & Steel \n")) -let armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") -if(armor === "Fire"){ - console.log(chalk.green("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" )) - console.log(chalk.green("You now head to Thrudheim together with Thor \n")) -} -else if(armor === "Earth"){ - console.log(chalk.green("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n")) - console.log(chalk.green("You now head to Thrudheim together with Thor \n")) -} -else if(armor === "Water"){ - console.log(chalk.green("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ")) - console.log(chalk.green("You now head to Thrudheim together with Thor \n")) -} -else if(armor === "Thunder"){ - console.log(chalk.green("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n")) - console.log(chalk.green("You now head to Thrudheim together with Thor \n")) -} -else if(armor === "Steel"){ - console.log(chalk.green("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n")) - console.log(chalk.green("You now head to Thrudheim together with Thor \n")) -} -else{ -console.log(chalk.redBright("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n")) -chooseArmorThorOffers() -} + armor = readline.question("Which armor would you like to wear? (Choose only the Element) \n") + + chooseArmor(armor) -thrudheimCaves() + thrudheimCaves() } function thrudheimCaves(){ @@ -152,77 +110,37 @@ function goingThroughPathOne(){ console.log(chalk.green("You decided to take the first path. \n")) console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) - let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") - if (merchant === "Health Potions"){ - healthPotion() - } - else if (merchant === "Vitality Potions"){ - vitalityPotion() - } - else if(merchant === "Stamina Potions"){ - staminaPotion() - } - else{ - console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) - goingThroughPathOne() - } + merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + salesMerchant(merchant) } function goingThroughPathTwo(){ console.log(chalk.green("You decided to take the second path. \n")) console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) - let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") - if (merchant === "Health Potions"){ - healthPotion() - } - else if (merchant === "Vitality Potions"){ - vitalityPotion() - } - else if(merchant === "Stamina Potions"){ - staminaPotion() - } - else{ - console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) - goingThroughPathTwo() - } + merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + salesMerchant(merchant) } -function goingThroughPathThree(){ +function goingThroughPathThree(armor){ console.log(chalk.green("You decided to take the third path. \n")) console.log(chalk.green("While walking through this path all of a sudden you hear a loud sinister laugh!!!")) console.log(chalk.green("Oh no it's Loki!! He brings down the boulder right on top of you!! \n")) - let blocked = readline.question("What would you like to do: quit or restart? \n") -if (blocked === "quit"){ - quitGame() -} -else if(blocked === "restart"){ - restartGame() -} -else{ - console.log(chalk.redBright("Invalid response please select either: quit or restart, and try again!! \n")) - goingThroughPathThree() -} + + setTimeout(() => {console.log(chalk.redBright("He then disappears thinking that he won and nothing can stop him now! \n"))}, 3000) + setTimeout((armor) => {console.log(chalk.redBright("What he didn't realize is that you have the element " + armor + " armor!! \n"))}, 5000) + setTimeout(() => {console.log(chalk.redBright("It will take much more than a mere boulder to stop you " + nameInput + "!!! \n"))}, 7000) + setTimeout(() => {console.log(chalk.redBright("Now that the coast is clear you carry on ready for anything!! \n"))}, 9000) + setTimeout(() => {caveOfTime()}, 13000) + } function goingThroughPathFour(){ console.log(chalk.green("You decided to take the fourth path. \n")) console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) - let merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") - if (merchant === "Health Potions"){ - healthPotion() - } - else if (merchant === "Vitality Potions"){ - vitalityPotion() - } - else if(merchant === "Stamina Potions"){ - staminaPotion() - } - else{ - console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) - goingThroughPathFourth() - } + merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") + salesMerchant(merchant) } function healthPotion(){ @@ -470,7 +388,7 @@ function finalShowDown(){ console.log(chalk.magenta("With every ounce of energy you have left you get up and start looking for Gungnir.... \n")) finalThrowItsAllOrNothing() } - }, 19000) + }, 19000) } function finalThrowItsAllOrNothing () { @@ -483,6 +401,68 @@ function finalThrowItsAllOrNothing () { +function chooseArmor(armor){ + if(armor === "Fire"){ + console.log(chalk.green("Wow you chose the Fire Armor! You feel like an unstoppable Inferno!! \n" )) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) + } + else if(armor === "Earth"){ + console.log(chalk.green("Wow you chose the Earth Armor! You feel like Mother Nature will always protect you!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) + } + else if(armor === "Water"){ + console.log(chalk.green("Wow you chose the Water Armor! You feel calm and focused, Just like the calm before the storm!! \n ")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) + } + else if(armor === "Thunder"){ + console.log(chalk.green("Wow you chose the Thunder Armor! You feel powerful just like a Thunder storm or even Thor himself!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) + } + else if(armor === "Steel"){ + console.log(chalk.green("Wow you chose the Steel Armor! You feel invincible, just like an indestructible force!! \n")) + console.log(chalk.green("You now head to Thrudheim together with Thor \n")) + } + else{ + console.log(chalk.redBright("Invalid Choice, Remember that you can only choose the elements and Pay close attention to how the element is written, Please try again... \n")) + if (chooseArmorInCastle){ + chooseArmorInCastle() + }else{ + chooseArmorThorOffers() + } +} +} + +function salesMerchant(merchant){ + if (merchant === "Health Potions"){ + healthPotion() + } + else if (merchant === "Vitality Potions"){ + vitalityPotion() + } + else if(merchant === "Stamina Potions"){ + staminaPotion() + } + else{ + console.log(chalk.redBright("Wrong entry please choose one of the following Health Potions, Vitality Potions, or Stamina Potions and try again. \n")) + if(goingThroughPathOne){ + goingThroughPathOne() + } + else if (goingThroughPathTwo){ + goingThroughPathTwo() + } + else{ + goingThroughPathFour() + } + } +} + + + + + + + + const restartGame = () => { if(readline.keyInYN("Would you like to play again? \n")){ runOrFly() From a13d354f2563b60d4b322ef44aea0f8ed0e3cb13 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 11 Jan 2021 18:35:52 -0500 Subject: [PATCH 16/20] I fixed the D.R.Y. that you mentioned --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 91 ++++++------------- 1 file changed, 29 insertions(+), 62 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 7bd1e1e..955f0c6 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -6,6 +6,7 @@ const figlet = require('figlet') let armor let merchant +let mixedPotions console.log(chalk.redBright(figlet.textSync('THE FLAME ' + ' OF' + ' RAGNAROK', { font: 'Fire Font-k', @@ -111,7 +112,7 @@ function goingThroughPathOne(){ console.log(chalk.green("While walking along the path you notice that there is a vendor selling goods. \n")) console.log(chalk.green("Hoping that he has something to help you along your journey you carefully approach. \n")) merchant = readline.question("Would you like to buy: Health Potions, Vitality Potions, or Stamina Potions? \n") - salesMerchant(merchant) + salesMerchant(merchant) } function goingThroughPathTwo(){ @@ -147,78 +148,24 @@ function healthPotion(){ console.log(chalk.green("You chose the Health Potion that is a very wise choice!! \n")) console.log(chalk.green("I would recommend that you use it wisely.. \n")) console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - if (continuedPath === "Rest"){ - console.log(chalk.green("You rested for a bit and then drank the Health Potion. \n")) - console.log(chalk.green("You then carried on the path feeling full of energy, it was hard but you got the feeling that it's only the begining. \n")) - caveOfTime() - } - else if (continuedPath === "Carry On"){ - console.log(chalk.green("You then carried on the path feeling full of energy. \n")) - console.log(chalk.green("It was a long and hard path but you got the feeling that it's only the begining, but so far you have managed to overcome every obstacle!! \n")) - caveOfTime() - } - else if (continuedPath === "Quit"){ - console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) - console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) - quitGame() - } - else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) - thrudheimCaves() - } + mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + potionMix(mixedPotions) } function vitalityPotion(){ console.log(chalk.green("You chose the Vitality Potion that is a very wise choice!! \n")) console.log(chalk.green("I would recommend that you use it wisely.. \n")) console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - if (continuedPath === "Rest"){ - console.log(chalk.green("You rested for a bit and then drank the Vitality Potion. \n")) - console.log(chalk.green("You then carried on the path feeling full of magic energy, this magic is powerful making you unstoppable!! \n")) - caveOfTime() - } - else if (continuedPath === "Carry On"){ - console.log(chalk.green("You then carried on the path feeling full of magic energy. \n")) - console.log(chalk.green("The path was long but using the magic potion really helped and made it a little easier!! \n")) - caveOfTime() - } - else if (continuedPath === "Quit"){ - console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) - console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) - quitGame() - } - else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) - thrudheimCaves() - } + mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + potionMix(mixedPotions) } function staminaPotion(){ console.log(chalk.green("You chose the Stamina Potion that is a very wise choice!! \n")) console.log(chalk.green("I would recommend that you use it wisely.. \n")) console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - let continuedPath = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - if (continuedPath === "Rest"){ - console.log(chalk.green("You rested for a bit and then drank the Stamina Potion. \n")) - console.log(chalk.green("You then carried on the path feeling full of stamina, it was quick and easy, wow these potions are amazing!! \n")) - caveOfTime() - } - else if (continuedPath === "Carry On"){ - console.log(chalk.green("You then carried on the path feeling full of energy. \n")) - console.log(chalk.green("The path was long but so far you have managed to overcome every obstacle quickly!! \n")) - caveOfTime() - } - else if (continuedPath === "Quit"){ - console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) - console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) - quitGame() - } - else { - console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) - thrudheimCaves() - } + mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + potionMix(mixedPotions) } function caveOfTime(){ @@ -456,7 +403,27 @@ function salesMerchant(merchant){ } } - +function potionMix(mixedPotions){ + if (mixedPotions === "Rest"){ + console.log(chalk.green("You rested for a bit and then drank the Health Potion. \n")) + console.log(chalk.green("You then carried on the path feeling full of energy, it was hard but you got the feeling that it's only the begining. \n")) + caveOfTime() + } + else if (mixedPotions === "Carry On"){ + console.log(chalk.green("You then carried on the path feeling full of energy. \n")) + console.log(chalk.green("It was a long and hard path but you got the feeling that it's only the begining, but so far you have managed to overcome every obstacle!! \n")) + caveOfTime() + } + else if (mixedPotions === "Quit"){ + console.log(chalk.red("It's a shame that you decided not to continue your adventure Young God... \n")) + console.log(chalk.red("Until next time remember that the fate of the multi-verse is in your hands!! \n")) + quitGame() + } + else { + console.log(chalk.red("Invalid choice, Please remember to choose one of the options and Spell it exactly how you see it!!! Please choose the path again!!")) + thrudheimCaves() + } +} From 85539db72e39c3ee71a88c8af9e02b79eff2a787 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Mon, 11 Jan 2021 18:48:38 -0500 Subject: [PATCH 17/20] Now there's no more D.R.Y. --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 955f0c6..99ee529 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -7,6 +7,7 @@ const figlet = require('figlet') let armor let merchant let mixedPotions +let cavePathLeftOrRight console.log(chalk.redBright(figlet.textSync('THE FLAME ' + ' OF' + ' RAGNAROK', { font: 'Fire Font-k', @@ -219,19 +220,8 @@ else{ function routePathTwo(){ console.log(chalk.green("You decided to take the second path...")) console.log(chalk.green("You walk deep into the cave and just you thought this is taking a long time... \n")) - let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") - if (cavePathLeftOrRight === "Right"){ - console.log("You entered the right path of the cave..") - cavePathRight() - } - else if (cavePathLeftOrRight === "Left"){ - console.log("You entered the left path of the cave..") - cavePathLeft() - } - else{ - console.log(chalk.redBright("Invalid Entry Please choose: Right or Left, try again!")) - routePathTwo() - } + cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") + cave(cavePathLeftOrRight) } function routePathThree(){ @@ -256,19 +246,8 @@ else{ function routePathFour(){ console.log(chalk.green("You decided to take the fourth path...")) console.log(chalk.green("You walk deep into the cave and just you thought this is taking a long time... \n")) - let cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") - if (cavePathLeftOrRight === "Right"){ - console.log("You entered the right path of the cave.. \n") - cavePathRight() - } - else if (cavePathLeftOrRight === "Left"){ - console.log("You entered the left path of the cave.. \n") - cavePathLeft() - } - else{ - console.log(chalk.redBright("Invalid Entry Please choose: Right or Left, try again! \n")) - routePathFour() - } + cavePathLeftOrRight = readline.question("Deep inside The Cave of Time you come across another two paths that Thor never mentioned: A path to the (Right) and a path to the (Left), which would you like to choose? \n") + cave(cavePathLeftOrRight) } function cavePathRight(){ @@ -425,6 +404,25 @@ function potionMix(mixedPotions){ } } +function cave(cavePathLeftOrRight){ + if (cavePathLeftOrRight === "Right"){ + console.log("You entered the right path of the cave..") + cavePathRight() + } + else if (cavePathLeftOrRight === "Left"){ + console.log("You entered the left path of the cave..") + cavePathLeft() + } + else{ + console.log(chalk.redBright("Invalid Entry Please choose: Right or Left, try again!")) + if(routePathTwo){ + routePathTwo() + } + else{ + routePathFour() + } + } +} From d59fa1da3f03fbfaf0e2567026a0594f21a0fbde Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Tue, 12 Jan 2021 19:04:11 -0500 Subject: [PATCH 18/20] thank you for all the feedback Myra --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 99ee529..848d7b0 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -97,7 +97,7 @@ else if(path === "2"){ goingThroughPathTwo() } else if(path === "3"){ - goingThroughPathThree() + goingThroughPathThree(armor) } else if(path === "4"){ goingThroughPathFour() @@ -130,7 +130,7 @@ function goingThroughPathThree(armor){ console.log(chalk.green("Oh no it's Loki!! He brings down the boulder right on top of you!! \n")) setTimeout(() => {console.log(chalk.redBright("He then disappears thinking that he won and nothing can stop him now! \n"))}, 3000) - setTimeout((armor) => {console.log(chalk.redBright("What he didn't realize is that you have the element " + armor + " armor!! \n"))}, 5000) + setTimeout(() => {console.log(chalk.redBright("What he didn't realize is that you have the element " + armor + " armor!! \n"))}, 5000) setTimeout(() => {console.log(chalk.redBright("It will take much more than a mere boulder to stop you " + nameInput + "!!! \n"))}, 7000) setTimeout(() => {console.log(chalk.redBright("Now that the coast is clear you carry on ready for anything!! \n"))}, 9000) setTimeout(() => {caveOfTime()}, 13000) From abc5d3dccfcc22411d6ce992374bcbfe6809be9a Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Thu, 28 Jan 2021 16:31:58 -0500 Subject: [PATCH 19/20] fixed the repeat in Potions made new function --- ...ndividual_Project_The_Flame_Of_Ragnarok.js | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 848d7b0..2bcb39c 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -7,6 +7,7 @@ const figlet = require('figlet') let armor let merchant let mixedPotions +let advice let cavePathLeftOrRight console.log(chalk.redBright(figlet.textSync('THE FLAME ' + ' OF' + ' RAGNAROK', { @@ -145,28 +146,22 @@ function goingThroughPathFour(){ salesMerchant(merchant) } -function healthPotion(){ +function healthPotion(advice){ console.log(chalk.green("You chose the Health Potion that is a very wise choice!! \n")) - console.log(chalk.green("I would recommend that you use it wisely.. \n")) - console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - potionMix(mixedPotions) -} + + merchantAdvice(advice) + } -function vitalityPotion(){ +function vitalityPotion(advice){ console.log(chalk.green("You chose the Vitality Potion that is a very wise choice!! \n")) - console.log(chalk.green("I would recommend that you use it wisely.. \n")) - console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - potionMix(mixedPotions) - } + + merchantAdvice(advice) + } -function staminaPotion(){ +function staminaPotion(advice){ console.log(chalk.green("You chose the Stamina Potion that is a very wise choice!! \n")) - console.log(chalk.green("I would recommend that you use it wisely.. \n")) - console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) - mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") - potionMix(mixedPotions) + + merchantAdvice(advice) } function caveOfTime(){ @@ -404,6 +399,13 @@ function potionMix(mixedPotions){ } } +function merchantAdvice(_advice){ + console.log(chalk.green("I would recommend that you use it wisely.. \n")) + console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) + mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") + potionMix(mixedPotions) +} + function cave(cavePathLeftOrRight){ if (cavePathLeftOrRight === "Right"){ console.log("You entered the right path of the cave..") From b8db3d353ba76e8b268ed570172ccfed4899b4a3 Mon Sep 17 00:00:00 2001 From: Hady Mohamed Date: Thu, 28 Jan 2021 18:43:05 -0500 Subject: [PATCH 20/20] pushed --- Module_One_Individual_Project_The_Flame_Of_Ragnarok.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js index 2bcb39c..d3b7065 100644 --- a/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js +++ b/Module_One_Individual_Project_The_Flame_Of_Ragnarok.js @@ -404,6 +404,7 @@ function merchantAdvice(_advice){ console.log(chalk.green("Now that you have everything you need, you need to decide what you want to do to continue your path. \n")) mixedPotions = readline.question("Would you like to: Rest, Carry On, or Quit? \n") potionMix(mixedPotions) + } function cave(cavePathLeftOrRight){