This program goes through a quick Pokemon run. A user picks a starter from the first generation Pokemon and then is immediately dropped into a trainer battle to get the hang of the combat. After the first battle, users gain some credits that they can use and now have the option to explore the world of Pokemon--albeit a very small, condensed world of Pokemon with only 3 options in the main menu...
The main menu includes these features:
- The Pokemon center where they can buy items
- Explore the wild (kind of) and catch new pokemon
- Fight the rest of the trainers
More on these options below!
This function allows users to buy either potions or pokeballs with the credits they earn through trainer battles. These items are then appended to their bag and the cost is subtracted from their credits (not doing so would be very bad for business)
Calling this function generates a random pokemon from a list and the users have the option to catch it by typing 'C' into the terminal or they can exit the encounter by typing 'exit'. If a player tries to catch a pokemon, they have a 50/50 chance of either catching the pokemon--to which the pokemon is appended to their party--or the pokemon escapes. A player can only catch a pokemon IF there is a pokeball in their bag, else they are returned back to the main menu. Entering an invalid input will prompt the user again.
The source of my struggle.. The battles are a bit harder since the trainers have more HP and have the chance to do more damage. Damage is done by pressing Enter and is done at a random capped interval. The player still has more HP than the trainer for convenience though. If both the user AND the trainer have 0 health, this returns False and the battle has to be initiated again. The function also returns False if the user loses, so they will have to reinitiate the battle again. Lastly, if the user wins (hopefully), the function returns True and the trainer they defeated will be removed from the trainer list and earn credit that is set to a random (also capped) range. Additionally, users can also use their potions from the shop to heal their pokemon by inputting 'H'! If the user has no potions in their bag, they will be notified. Once all trainers are defeated (i.e. there are no more trainers in the trainer list), the user will be notified and congratulated!! :D
This is very rough python code a while ago... It definitely is missing a lot of features and doesn't account for all cases of user input, but I hope whoever looks through it doesn't laugh at it (you can laugh a little though it's okay)