NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

The procedure takes in 7 parameters, the fighter, dropnames, equipmentChangeAllowed, playerBagAllowed, goToTownAllowed, mainPlayer, enemy. The fighter parameter is the player object. The dropnames parameter is a string that defines what the enemy would be dropping given the player wins. equipmentChangeAllowed is a boolean that tells if the player is allowed to change their equipment after the battle. playerBagAllowed is a boolean variable that tells if the player is allowed to use their bag during the battle. goToTownAllowed is a boolean variable that tells if the player is allowed to go to town after they battle. mainPlayer is a boolean variable that tells if the mainPlayer is the one the player is controlling or not. The enemy is the enemy object. First, a while loop is started until either the players or the enemies health points is 0. The while loop defines everytime the player and enemy do a turn. First, both parties health points is printed and then the menu is printed. If the player is allowed to use magic, an extra menu part is added. If the input for battle is 1, the miss chance is calculated using the miss chance function. If the random critical hit equals 1, the player misses hitting the enemy and the enemies damage function is called. If the player doesn’t miss, the players random critical hit and if it rolls 1, then it is printed that the player has performed a critical hit and then the enemy damage function is called. If the player doesn’t do a critical hit, it is a normal hit and then the enemy damage function is called. If the input for battle is 2, the player has a chance to defend. If the defense of the player is greater than that of the enemies attack, then the player successfully defends against the attack and the enemy has no chance of doing any damage. Else, the enemy is the only one who performs a turn and the player effectively looses that turn. If the input for the battle is 3, then the player can use an item that they have in their bag. Currently only 3 items ar defined, small potion, medium potion and large potion. The player can chose one and when they do, the corresponding method from the player is called. The enemy damage function is then called. If the player inputs 4 for homescreen, if the fighters agility is more than the enemies they can escape to the home screen without taking any damage but if the enemies agility is more than the players then the player is unable to escape and then the enemies damage function is called. There is a fifth battle function which is the magic menu that can only be used in one instance of the game. This asks the player what magic they want to use and calls the corresponding function from the player. The next part is if the players hp goes down to 0, all their hp is restored but they are sent back to the homescreen and have to restart the level. If the enemies hp goes down to 0, a win statement is printed and the player is asked if they want to pickup the items dropped. If the player inputs yes, then the itemPickup function is called. If it is a no, the battle function continues. Next, if the player earns enough exp to level up, their new attributes are printed out to the console. Next they are given the option to change their equipment, continue the adventure or go to menu. If they select change their equipment, the change equipment function is called. If they select continue adventure, the next sequence starts. If menu is selected, the players go back to the home screen.

The procedure takes in 6 parameters, fighter, dropNames, equipmentChangeAllowed, playerBagAllowed, mainPlayer, enemy. Fighter and enemy define the fighter and enemy objects. dropNames is a string of the names of the drops. equipmentChangeAllowed, playerBagAllowed, and mainPlayer are all booleans that define if the player is allowed to change equipment, use their bag and if the mainplayer is being used. We start with a while loop that runs until either the enemies hp or players hp is 0. First we print out the hp of both parties and then bring up a menu that has the option to attack, defend, use the bag or flee. If the user chooses attack, a random number is picked and if it equals 1, the player performs a critical attck and if else, the player does a normal attack. If the player selects defend, the player can defend if their defense is greater than the enemies. If the player selects their bag, they can use an item that they own. If the player selects flee, they can stop the battle.
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.