/* Sohail Meghani, Jeremy Thummel, David Cacorovski 7/5/2020 Javascript Basic Project In this code, we make the code for the game */ //These are all the variables for our game let level = 1; let health = 100; let enemy; let enemyHealth; let move; let hit; let chest; let chestNum; let exp = 0; let enemyHit; let enemyDamage; let chestwait = 0; let level4 = false; let level7 = false; let level11 = false; let level16 = false; let classe; let mage = false; let brute = false; let playerName = prompt("Please enter your name:"); alert("Welcome "+playerName+" to the land of Dharkon!"); alert("Dravigon has been occupying the land of Dharkon for years and we need you to fend him off!"); alert("Let's start your adventure!"); //This is the while loop that holds the code for all battles before the boss while(level < 20) { enemy = parseInt(1+Math.round(Math.random()*1)); console.log(enemy); //this is if the player reaches lv 7 and they cant encounter a slime anymore and start encountering eagles. if(level > 6) { enemy = enemy + 1; } //this is if the player reaches lv 11 and they cant encounter a wolf anymore and start encountering ogres. if(level > 10) { enemy = enemy + 1; } //this is if the player reaches lv 16 and they cant encounter a eagle anymore and start encountering flying gremlin. if(level > 15) { enemy = enemy + 1; } //Slime Battle if(enemy == 1) { alert("An enemy has approached! You have encountered a slime!"); enemyHealth = 20; while(enemyHealth > 0) { //This is the code if the user reached level 4 and chose the mage class if(level4 == true && mage == true && brute == false && level7 == false) { //This is the code for the first move that the user can use against the slime move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { // This code is a hit or miss or critical hit mechanic using the randomized number code. hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } //This is the code for the second move against the slime else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { //Since the wolf snack is ineffective against slimes, the hit system doesn't work as normal hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } //This is the code for the third move that can be unlocked by the user at level 4 and that can be used by the player as well else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { //This is the critical system for the third move, Moonlight Cannon. However, this move cannot miss at all hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } // if the user chose not to input the right input or select no input. else { alert("You chose not to input a move."); } //This is the code that only should be executed once the player has killed the enemy. In this case, it is the slime. if(enemyHealth > 0) { //enemy hit miss or critical strike mechanic. enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(2+Math.round(Math.random()*2)); health = health - enemyDamage; alert("The slime attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { //if the player ran out of health and lost the game. alert(playerName+", you have died. Better luck next time!"); end; } // stating how much health they have left. alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9)//This is the code that is executed if the player missed the attack of the slime { alert("You have evaded the slimes attack!"); alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) //This is the code that is executed if the slime landed a critical strike on the player { enemyDamage = parseInt(2+Math.round(Math.random()*2)); enemyDamage = enemyDamage + 3; alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0)//This is the code to be executed if the player's health is equal to 0. Meaning that they are dead { alert(playerName+", you have died. Better luck next time!"); end; } alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //This is the if loop if the user has reached level 4 and if they chose the brute class if(level4 == true && brute == true && mage == false && level7 == false) { //This is the code for the first moeve that can be used against the slime in the second scenario move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { //This is the hit, miss or critical mechanic for this move hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } }//This is the code that should be executed if the user chooses the second else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { //This is the hit, miss and critial mechanic for the second move hit = parseInt(1+Math.round(Math.random()*9)); //Since the wolf snack doesn't pwork on the slime, the hit system always misses if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { // this move has a mechanic where if you attack the enemy you lose some of your own health. hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-20; health=health*0.75; alert("You have dealt 20 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; health=health*0.70; alert("You have dealt a critical strike of 40 damage! But lost 30% of your health due to recoil!"); } } else//This is the code if the user didn't input a move { alert("You chose not to input a move."); } if(enemyHealth > 0) //This is the code that is executed if the enemy is still alive { //This is the enemy's hit, miss and critical system enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(2+Math.round(Math.random()*2)); health = health - enemyDamage; alert("The slime attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the slimes attack!"); alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(2+Math.round(Math.random()*2)); enemyDamage = enemyDamage + 3; alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //This is the game loop if the user doesn't have the mage class, the brute class and if they haven't reached level 4 yet. if(level4 == false && mage == false && brute == false && level7 ==false) {//this is the code for the first move that the user can input move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") {//Hit, miss or critical system hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(2+Math.round(Math.random()*2)); health = health - enemyDamage; alert("The slime attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the slimes attack!"); alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(2+Math.round(Math.random()*2)); enemyDamage = enemyDamage + 3; alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The slime has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } // after enemyHealth is not greater then 0 and battle ends. health = 100; alert("You have defeated that evil slime, and your health was restored!"); chestwait = chestwait + 1; // chest mechanic to select a Guaranteed exp chest or a gambling chest. while(chestwait == 1) { chest = prompt("Select what chest you would like: \n \n Chest #1 (Guaranteed EXP) \n \n Chest #2 (50% Chance to Gain 2 Levels, 50% chance to lose 75% of your health next turn!)"); if(chest == "Chest #1" || chest == "#1" || chest == "1" || chest == "chest 1") { exp = parseInt(exp) + 50; alert("You have opened Chest #1 and gained 50EXP!"); alert("You are at Level " + level + " and " + exp + "/100EXP"); //if they exceed the amount of exp it takes to level up. if(exp >= 100) { level = level + 1; alert("You have leveled up to level " +level+ "!"); exp = exp - 100; alert("You are now at Level " + level + " and " + exp + "/100EXP"); // if they reached to level4 or 5 or 6 to select a class. diferent class means a different move. if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage Made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); // if mage has been selected. if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } // if brute has been selected. else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } // if they decided to chose nothing. else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } // once they reach level 7 or 8, causing them to learn a new move. else if(level == 7 && level7 == false || level == 8 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } // once they reach level 11 or 12, causing them to learn a new move. else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } // once they reach level 16 or 17, causing them to learn a new move. else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine Snacks!"); level16 = true; } } chestwait = chestwait - 1; } // randomized chance to loose 75% of your health next battle or chance to gain 2 levels instead of the Guaranteed half level. else if(chest == "Chest #2" || chest == "#2" || chest == "2" || chest == "chest 2") { chestNum = parseInt(1+Math.round(Math.random()*1)); if(chestNum == 1) { level=level+2; alert("You opened Chest #2 and have gained 2 levels, and are now at level "+level+"."); alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false || level == 9 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine snacks!"); level16 = true; } } else if(chestNum == 2) { health = health*0.25; alert("You opened Chest #2 and have lost 75% of your health, leaving you with "+health+"HP for your next battle."); } chestwait = chestwait - 1; } else { alert("Please type in the correct input."); } } } //Wolf battle if(enemy == 2) { alert("An enemy has approached! You have encountered a wolf!"); enemyHealth = 50; while(enemyHealth > 0) { // if you reached lv 7 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } //when wolf snack is actually effective since the enemy is a wolf. else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 7 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-20; health=health*0.75; alert("You have dealt 20 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; health=health*0.70; alert("You have dealt a critical strike of 40 damage! But lost 30% of your health due to recoil!"); } } else if(move=="4)" || move=="4" || move=="Rising phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if level 7 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //This is the code if the user reached level 4 and chose the mage class if(level4 == true && mage == true && brute == false && level7 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //This is the if loop if the user has reached level 4 and if they chose the brute class if(level4 == true && brute == true && mage == false && level7 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-20; health=health*0.75; alert("You have dealt 20 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; health=health*0.70; alert("You have dealt a critical strike of 40 damage! But lost 30% of your health due to recoil!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //This is the game loop if the user doesn't have the mage class, the brute class and if they haven't reached level 4 yet. if(level4 == false && mage == false && brute == false && level7 ==false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You threw the wolf snack at the wolf, the wolf was happy and ran away with the wolf snack."); enemyHealth = enemyHealth - enemyHealth; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(6+Math.round(Math.random()*4)); health = health - enemyDamage; alert("The wolf attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the wolf's attack!"); alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(12+Math.round(Math.random()*4)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The wolf has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } health = 100; alert("You have defeated that evil wolf, and your health was restored!"); chestwait = chestwait + 1; while(chestwait == 1) { chest = prompt("Select what chest you would like: \n \n Chest #1 (Guaranteed EXP) \n \n Chest #2 (50% Chance to Gain 2 Levels, 50% chance to lose 75% of your health next turn!)"); if(chest == "Chest #1" || chest == "#1" || chest == "1" || chest == "chest 1") { exp = parseInt(exp) + 50; alert("You have opened Chest #1 and gained 50EXP!"); alert("You are at Level " + level + " and " + exp + "/100EXP"); if(exp >= 100) { level = level + 1; alert("You have leveled up to level " +level+ "!"); exp = exp - 100; alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage Made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine Snacks!"); level16 = true; } } chestwait = chestwait - 1; } else if(chest == "Chest #2" || chest == "#2" || chest == "2" || chest == "chest 2") { chestNum = parseInt(1+Math.round(Math.random()*1)); if(chestNum == 1) { level=level+2; alert("You opened Chest #2 and have gained 2 levels, and are now at level "+level+"."); alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false || level == 9 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine snacks!"); level16 = true; } } else if(chestNum == 2) { health = health*0.25; alert("You opened Chest #2 and have lost 75% of your health, leaving you with "+health+"HP for your next battle."); } chestwait = chestwait - 1; } else { alert("Please type in the correct input."); } } } //Eagle battle if(enemy == 3) { alert("An enemy has approached! You have encountered an eagle!"); enemyHealth = 75; while(enemyHealth > 0) { //if level 11 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == true && level16 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom \n \n 5) Starlight Slap"); // special mechanic where the eagle is airborne and melee attacks is ineffective againt airborne enemys. if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } // since wolf snack is not used on a wolf it is ineffective. else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { // same mechanic as hammer of flames but can hit airborne enemys. hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 11 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == true && level16 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom \n \n 5) Starlight Slap"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } // special mechanic where the eagle is airborne and melee attacks is ineffective againt airborne enemys. else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { alert("You used Hammer of Flames, but since the eagle was in the air, your attack did nothing."); } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } // if you reached lv 11 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom 4) Starlight Slap"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="4)" || move=="4" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } // if you reached lv 7 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 7 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { alert("You used Hammer of Flames, but since the eagle was in the air, your attack did nothing."); } else if(move=="4)" || move=="4" || move=="Rising phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if level 7 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the eagle was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the eagle, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(5+Math.round(Math.random()*3)); health = health - enemyDamage; alert("The eagle attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the eagle's attack!"); alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(10+Math.round(Math.random()*3)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The eagle has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } health = 100; alert("You have defeated that evil eagle, and your health was restored!"); chestwait = chestwait + 1; while(chestwait == 1) { chest = prompt("Select what chest you would like: \n \n Chest #1 (Guaranteed EXP) \n \n Chest #2 (50% Chance to Gain 2 Levels, 50% chance to lose 75% of your health next turn!)"); if(chest == "Chest #1" || chest == "#1" || chest == "1" || chest == "chest 1") { exp = parseInt(exp) + 50; alert("You have opened Chest #1 and gained 50EXP!"); alert("You are at Level " + level + " and " + exp + "/100EXP"); if(exp >= 100) { level = level + 1; alert("You have leveled up to level " +level+ "!"); exp = exp - 100; alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage Made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine Snacks!"); level16 = true; } } chestwait = chestwait - 1; } else if(chest == "Chest #2" || chest == "#2" || chest == "2" || chest == "chest 2") { chestNum = parseInt(1+Math.round(Math.random()*1)); if(chestNum == 1) { level=level+2; alert("You opened Chest #2 and have gained 2 levels, and are now at level "+level+"."); alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false || level == 9 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine snacks!"); level16 = true; } } else if(chestNum == 2) { health = health*0.25; alert("You opened Chest #2 and have lost 75% of your health, leaving you with "+health+"HP for your next battle."); } chestwait = chestwait - 1; } else { alert("Please type in the correct input."); } } } //Ogre Battle if(enemy == 4) { alert("An enemy has approached! You have encountered an ogre!"); enemyHealth = 100; while(enemyHealth > 0) { // if you reached lv 16 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom 4) Starlight Slap \n \n 5) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="4)" || move=="4" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } // new move where you can heal yourself in battle. else if(move=="5)" || move=="5" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; // since the hp cap is 100 this if statement is here in case the user exceeds 100 hp, causing the hp to remain at the 100 cap. if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 16 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-20; health=health*0.75; alert("You have dealt 20 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; health=health*0.70; alert("You have dealt a critical strike of 40 damage! But lost 30% of your health due to recoil!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } // if lv 16 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if level 11 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == true && level16 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom \n \n 5) Starlight Slap"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 11 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == true && level16 == false) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom \n \n 5) Starlight Slap"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-20; health=health*0.75; alert("You have dealt 20 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; health=health*0.70; alert("You have dealt a critical strike of 40 damage! But lost 30% of your health due to recoil!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } // if you reached lv 11 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom 4) Starlight Slap"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-10; alert("You have dealt 10 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-20; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the ogre, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="4)" || move=="4" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(10+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The ogre attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 9) { alert("You have evaded the ogre's attack!"); alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(20+Math.round(Math.random()*10)); alert("The enemy has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The ogre has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } health = 100; alert("You have defeated that evil ogre, and your health was restored!"); chestwait = chestwait + 1; while(chestwait == 1) { chest = prompt("Select what chest you would like: \n \n Chest #1 (Guaranteed EXP) \n \n Chest #2 (50% Chance to Gain 2 Levels, 50% chance to lose 75% of your health next turn!)"); if(chest == "Chest #1" || chest == "#1" || chest == "1" || chest == "chest 1") { exp = parseInt(exp) + 50; alert("You have opened Chest #1 and gained 50EXP!"); alert("You are at Level " + level + " and " + exp + "/100EXP"); if(exp >= 100) { level = level + 1; alert("You have leveled up to level " +level+ "!"); exp = exp - 100; alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage Made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine Snacks!"); level16 = true; } } chestwait = chestwait - 1; } else if(chest == "Chest #2" || chest == "#2" || chest == "2" || chest == "chest 2") { chestNum = parseInt(1+Math.round(Math.random()*1)); if(chestNum == 1) { level=level+2; alert("You opened Chest #2 and have gained 2 levels, and are now at level "+level+"."); alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false || level == 9 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine snacks!"); level16 = true; } } else if(chestNum == 2) { health = health*0.25; alert("You opened Chest #2 and have lost 75% of your health, leaving you with "+health+"HP for your next battle."); } chestwait = chestwait - 1; } else { alert("Please type in the correct input."); } } } // flying gremlin Battle if(enemy == 5) { alert("An enemy has approached! You have encountered a flying gremlin!"); enemyHealth = 30; while(enemyHealth > 0) { // if you reached lv 16 and did not select a class if(level4 == false && mage == false && brute == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom 4) Starlight Slap \n \n 5) Divine Snacks"); // airborne enemy. if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the gremlin was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="4)" || move=="4" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*99)); // if 1-100 randomizer rolls a 1, you get one shotted and lose the game. if(enemyHit == 1) { alert("You have been 1 hit KO'd by the flying gremlin!") health = 0; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } } if(enemyHit < 80 && enemyHit != 1) { enemyDamage = parseInt(50+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The flying gremlin attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } if(enemyHit > 80) { alert("You have evaded the flying gremlin attack!"); alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //if lv 16 brute if(level4 == true && brute == true && mage == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the gremlin was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { alert("You used Hammer of Flames, but since the gremlin was in the air, your attack did nothing."); } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*99)); if(enemyHit == 1) { alert("You have been 1 hit KO'd by the flying gremlin!") health = 0; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } } if(enemyHit < 80 && enemyHit != 1) { enemyDamage = parseInt(50+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The flying gremlin attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } if(enemyHit > 80) { alert("You have evaded the flying gremlin attack!"); alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } // if lv 16 mage if(level4 == true && mage == true && brute == false && level7 == true && level11 == true && level16 == true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { alert("You used Flaming Strike, but since the gremlin was in the air, your attack did nothing."); } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="ws" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8 || hit==9 || hit==10) { alert("You used the wolf snack on the slime, nothing happened. Why would you do that?"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-25; alert("You have dealt 25 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-50; alert("You have dealt a critical strike of 50 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-40; health=health*0.65; alert("You have dealt 40 damage! But lost 35% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-80; health=health*0.6; alert("You have dealt a critical strike of 80 damage! But lost 40% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*99)); if(enemyHit == 1) { alert("You have been 1 hit KO'd by the flying gremlin!") health = 0; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } } if(enemyHit < 80 && enemyHit != 1) { enemyDamage = parseInt(50+Math.round(Math.random()*5)); health = health - enemyDamage; alert("The flying gremlin attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } if(enemyHit > 80) { alert("You have evaded the flying gremlin attack!"); alert("The flying gremlin has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } health = 100; alert("You have defeated that evil flying gremlin, and your health was restored!"); chestwait = chestwait + 1; while(chestwait == 1) { chest = prompt("Select what chest you would like: \n \n Chest #1 (Guaranteed EXP) \n \n Chest #2 (50% Chance to Gain 2 Levels, 50% chance to lose 75% of your health next turn!)"); if(chest == "Chest #1" || chest == "#1" || chest == "1" || chest == "chest 1") { exp = parseInt(exp) + 50; alert("You have opened Chest #1 and gained 50EXP!"); alert("You are at Level " + level + " and " + exp + "/100EXP"); if(exp >= 100) { level = level + 1; alert("You have leveled up to level " +level+ "!"); exp = exp - 100; alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage Made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine Snacks!"); level16 = true; } } chestwait = chestwait - 1; } else if(chest == "Chest #2" || chest == "#2" || chest == "2" || chest == "chest 2") { chestNum = parseInt(1+Math.round(Math.random()*1)); if(chestNum == 1) { level=level+2; alert("You opened Chest #2 and have gained 2 levels, and are now at level "+level+"."); alert("You are now at Level " + level + " and " + exp + "/100EXP"); if(level == 4 && level4 == false || level == 5 && level4 == false || level == 6 && level4 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); classe = prompt("But first please select what class you would like. \n \n #1: A Mage made of Dreams (Type in 1 exactly.) \n \n #2 A Raging Fire Brute (Type in 2 exactly.)"); if(classe == "#1" || classe == "1" || classe == "a mage made of dreams" || classe == "A mage made of dreams") { alert("Hello " + playerName + ", the Mage! You have learned a new move called Moonlight Cannon!"); level4 = true; mage = true; brute = false; } else if(classe == "#2" || classe == "2" || classe == "Fire Brute" || classe == "Fire brute" || classe == "fire brute") { alert("Hello " + playerName + ", the Brute! You have learned a new move called Hammer Of Flames!"); level4 = true; mage = false; brute = true; } else { alert(playerName + ", You chose not to input a class therefore learned nothing."); level4 = false; mage = false; brute = false; } } else if(level == 7 && level7 == false || level == 8 && level7 == false || level == 9 && level7 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Rising Phantom!"); level7 = true; } else if(level == 11 && level11 == false || level == 12 && level11 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Starlight Slap!"); level11 = true; } else if(level == 16 && level16 == false || level == 17 && level16 == false) { alert("Congratulations! you have leveled up to a point where you can learn a new move!"); alert("You have learned a new move called Divine snacks!"); level16 = true; } } else if(chestNum == 2) { health = health*0.25; alert("You opened Chest #2 and have lost 75% of your health, leaving you with "+health+"HP for your next battle."); } chestwait = chestwait - 1; } else { alert("Please type in the correct input."); } } } } //Boss Fight if(level >= 20) { alert("Looks like you have finally reached the Castle of Dharkon! Now, you must face the evil Dravigon himself!"); // mechanic where you deal 50% more damage when your faced against Dravigon. alert("Seeing Dravigon face to face has awakened a power inside of you! All of your attacks do 50% more damage!"); enemyHealth = 500; while(enemyHealth > 0) { //Mage Final Boss if(level4 == true && mage == true && brute == false && level7==true && level11==true && level16==true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Moonlight Cannon 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } // wolf snack works againt dravigon because hes not that smart and decides to eat it. else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="WS" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-25; alert("You gave Dravigon the Wolf Snack. He ate it, and got food poisoning! It did 25 damage to him!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit==10) { enemyHealth=enemyHealth-50; alert("You gave Dravigon the Wolf Snack. He ate it, and got bad food poisoning! It did a critial strike of 50 damage!"); } } else if(move=="3)" || move=="3" || move=="Moonlight Cannon"|| move=="moonlight Cannon" || move=="MC" || move=="mc") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-22.5; alert("You have dealt 22.5 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-45; alert("You have dealt a critical strike of 45 damage!"); } else { alert("You chose not to input a move."); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising Phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-37.5; alert("You have dealt 37.5 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-75; alert("You have dealt a critical strike of 75 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-60; health=health*0.55; alert("You have dealt 60 damage! But lost 55% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-120; health=health*0.5; alert("You have dealt a critical strike of 120 damage! But lost 50% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(20+Math.round(Math.random()*5)); health = health - enemyDamage; alert("Dravigon attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } else if(health > 0) { alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } else if(enemyHit == 9) { alert("You have evaded Dravigon's attack!"); alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(35+Math.round(Math.random()*15)); alert("Dravigon has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //Brute Final Boss if(level4 == true && brute == true && mage == false && level7==true && level11==true && level16==true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Hammer of Flames 4) Rising Phantom \n \n 5) Starlight Slap 6) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit==9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-30; alert("You have dealt a critical strike of 30 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="WS" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-25; alert("You gave Dravigon the Wolf Snack. He ate it, and got food poisoning! It did 25 damage to him!"); } else if(hit==9) { alert("Dravigon has evaded the attack!"); } else if(hit==10) { enemyHealth=enemyHealth-50; alert("You gave Dravigon the Wolf Snack. He ate it, and got bad food poisoning! It did a critial strike of 50 damage!"); } } else if(move=="3)" || move=="3" || move=="Hammer Of Flames"|| move=="hammer of flames" || move=="HOF" || move=="hof") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6) { enemyHealth=enemyHealth-30; health=health*0.75; alert("You have dealt 30 damage! But lost 25% of your health due to recoil!"); } else if(hit == 7 || hit == 8 || hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-60; health=health*0.70; alert("You have dealt a critical strike of 60 damage! But lost 30% of your health due to recoil!"); } } else if(move=="4)" || move=="4" || move=="Rising Phantom" || move=="rising Phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-37.5; alert("You have dealt 37.5 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-75; alert("You have dealt a critical strike of 75 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-60; health=health*0.55; alert("You have dealt 60 damage! But lost 55% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-120; health=health*0.5; alert("You have dealt a critical strike of 120 damage! But lost 50% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="6)" || move=="6" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(20+Math.round(Math.random()*5)); health = health - enemyDamage; alert("Dravigon attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } else if(health > 0) { alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } else if(enemyHit == 9) { alert("You have evaded Dravigon's attack!"); alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(35+Math.round(Math.random()*15)); alert("Dravigon has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } //Not Mage or Brute Final Boss if(level4 == false && mage == false && brute == false && level7==true && level11==true && level16==true) { move=prompt("What move do you want to use? \n \n 1) Flaming Strike 2) Wolf Snack \n \n 3) Rising Phantom 4) Starlight Slap \n \n 5) Divine Snacks"); if(move=="1)" || move=="1" || move=="Flaming Strike"|| move=="flaming strike" || move=="FS" || move=="fs") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-15; alert("You have dealt 15 damage!"); } else if(hit == 9) { alert("The enemy has evaded the attack!"); } else if(hit == 10) { enemyHealth=enemyHealth-40; alert("You have dealt a critical strike of 20 damage!"); } } else if(move=="2)" || move=="2" || move=="Wolf Snack"|| move=="wolf snack" || move=="WS" || move=="ws") { hit = parseInt(1+Math.round(Math.random()*9)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit==7 || hit==8) { enemyHealth=enemyHealth-25; alert("You gave Dravigon the Wolf Snack. He ate it, and got food poisoning! It did 25 damage to him!"); } else if(hit==9) { alert("Dravigon has evaded the attack!"); } else if(hit==10) { enemyHealth=enemyHealth-50; alert("You gave Dravigon the Wolf Snack. He ate it, and got bad food poisoning! It did a critial strike of 50 damage!"); } } else if(move=="3)" || move=="3" || move=="Rising Phantom" || move=="rising Phantom" || move=="RP" || move=="rp") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-37.5; alert("You have dealt 37.5 damage!"); } else if(hit == 10) { enemyHealth=enemyHealth-75; alert("You have dealt a critical strike of 75 damage!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="4)" || move=="4" || move=="Starlight Slap" || move=="starlight slap" || move=="SS" || move=="ss") { hit = parseInt(1+Math.round(Math.random()*14)); if(hit==1 || hit==2 || hit==3 || hit==4 || hit==5 || hit==6 || hit == 7 || hit == 8 || hit == 9) { enemyHealth=enemyHealth-60; health=health*0.55; alert("You have dealt 60 damage! But lost 55% of your health due to recoil!"); } else if(hit == 10) { enemyHealth=enemyHealth-120; health=health*0.5; alert("You have dealt a critical strike of 120 damage! But lost 50% of your health due to recoil!"); } else if(hit==11 || hit==12 || hit==13 || hit==14 || hit==15) { alert("The enemy has evaded the attack!"); } } else if(move=="5)" || move=="5" || move=="Divine Snacks" || move=="divine snacks" || move=="DS" || move=="ds") { alert("You have healed yourself by 35HP!"); health = health + 35; if(health > 100) { health = 100; } } else { alert("You chose not to input a move."); } if(enemyHealth > 0) { enemyHit = parseInt(1+Math.round(Math.random()*9)); if(enemyHit == 1 || enemyHit == 2 || enemyHit == 3 || enemyHit == 4 || enemyHit == 5 || enemyHit == 6 || enemyHit == 7 || enemyHit == 8) { enemyDamage = parseInt(20+Math.round(Math.random()*5)); health = health - enemyDamage; alert("Dravigon attacks! " + enemyDamage + " damage has been dealt to you!"); if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } else if(health > 0) { alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } else if(enemyHit == 9) { alert("You have evaded Dravigon's attack!"); alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } else if(enemyHit == 10) { enemyDamage = parseInt(35+Math.round(Math.random()*15)); alert("Dravigon has landed a crtical strike on you! "+enemyDamage+" damage has been dealt to you!"); health = health - enemyDamage; if(health <= 0) { alert(playerName+", you have died. Better luck next time!"); end; } alert("Dravigon has " + enemyHealth + "HP remaining."); alert("You have " + health + "HP remaining."); } } } } // if you win the game and get out of while statement for boss. health = 100; alert("Congratulations! You have won the game, and defeated the evil Dravigon!"); alert("From this day forward, "+playerName+" has become a houshold name in the land of Dharkon."); }
The main objective of this game is to save the princess from the evil castle! On your treacherous journey to the castle, you will face many random monsters that must be defeated! In order to save the princess and win the game, you must reach level 20 and defeat the final boss! However, if you die to any monster, you lose and you must start from the beginning! Not only can monsters kill you, but also chests! You can chose between 2 chests at the end of each battle. The first chest is guarenteed to give you experience points, which you need to level up! However, the second chest has a 50% chance of losing 75% of your hp for the next battle, and a 50% chance of gaining 2 levels!
Words you must be familiar with:
HP - Health / Health Points
EXP - Experience Points (They help you gain levels)
Input |
Processing |
Output |
---|---|---|
- The player's name - Their desired attack method in a battle - The chest they would like to select after defeating an enemy |
- Alert the player of a backstory - Ask for the player's name -Calculate a random whole number from 1 - 10 - Based on that whole number, determine the enemy that will fight the player - Calculate another random whole number from 1 - 10 - This number will determine the chance of a critical hit after the player selects a move - Calculate another random whole number from 1 - 10 - This number will determine the chance of what items you get from the chest after beating an enemy - The player could either gain experience points from the chest, or an extra life, or they could die and get a game over - If they get enough experience points, the player’s level will go up - If they get an extra life, the next time the player loses a battle they will survive and fight a new enemy - If they die, they lose the game, and must restart if they wish to keep playing - After the chest is opened, they will continuously fight other enemies - Once the player has gotten to level 99, they win the game |
- The player will be told a backstory of the land they must save - The player will fight a monster - The battle will be turn-based - Once the battle is finished, the player picks a chest - The player either gains experience points, gets an extra life, or dies - If the player manages to get to level 99, they win - If the player dies, they lose |