Project 7: Pokemon
In this project we will be creating a basic implementation of Pokemon, and then create a game for them to battle. This project will have three steps. The Pokemon Classes, the User classes, and the game loop.
Overview
9 Pokemon
Each Pokemon comes from 1 of 3 types:
- Grass
- fire
- water
Classes
You will be given a base Pokemon class which the grass, fire, and water classes will inherit from.
Class: User
- You will be given a bare-bones implementation of the base user class.
Class: Computer
- The computer class should inherit from the user class
- The computer class will need to overwrite certain methods of the user class.
Attacks
All Pokemon of the same type have the same set of attacks, one of the following:
- hp (hit points)
- pp(power points)
- name.
Game Loop
Before the battle begins, Ask the user:
- Name
- Computer Name
Battle Pairing
- Ask the user to pick 3 Pokemon for their hand
- Randomly select the computer’s Pokemon from the remaining Pokemon.
- Ask the user which Pokemon they would like to use in battle with currently
- Randomly select one for the Computer
- Battle begins.
Each Turn
The user will be given the option to
attackhealswitch.- Computer will be randomly selected, but should more frequently be
attack.
Attack
Gives the user the options
- attacks the Pokemon
- pick one to attack with
Attack Name
An attack has a name, and corresponds to a list of the power of the attack and the accuracy.
An Attack should
- be a random number in the range between the
attack power(or the pp if that is lower than the attack power) - 20 - the
attack power (or the pp if that is lower than the attack power) - randomly fail according to the attack’s accuracy.
- decrease the enemy’s hp, and print out a useful description.
- The computer randomly selects an attack to use in the battle.
Heal
- Gives 20 HP back to the current Pokemon,
- Takes away the turn
Switch
- Lists the stats (HP, AP, Name) of all Pokemon in the hand, and then
- switches the current Pokemon
- takes away the turn.
- On the computer’s turn if this option is randomly selected, choose a random Pokemon to switch with
- If either the user’s or the computer’s current Pokemon is out of HP, they will be required to switch Pokemon
- If there are no available Pokemon, that player has lost.
Continue looping until one player has lost
Behaviour
Game Play
- Ask the user to choose 3 Pokemon: At the beginning of the game the program will list out the pokemon to choose from. Options are the following, HP stands for the health points the pokemon has and AP says the max value of attack
- Grass Type:
- Bulbasoar: 60HP, 40AP
- Bellsprout: 40HP, 60AP
- Oddish: 50HP, 50AP
- Fire Type:
- Charmainder: 25HP, 70AP
- Ninetails: 30HP, 50AP
- Ponyta: 40HP, 60AP
- Water Type:
- Squirtle: 80HP, 20AP
- Psyduck: 70HP, 40AP
- Polywag: 50HP, 50AP
- Ask the user to choose Pokemon to use in fight
- Generate Computer’s Hand and randomly select a pokemon to start
- On each turn the player or computer can either
attack,heal, orswitch - At the end of each the turn print out the HP of the current Pokemon, and check if either side has lost the game
- A player has lost if all their Pokemon are out of HP
switch: Lists the stats (HP, AP, Name) of all Pokemon in the hand, and asks the user what Pokemon they would like to switch to. Cannot attack until next turn.stats: Lists all the stats of the Pokemon in the handheal: adds 20 hp to the current Pokemon, cannot attack until next turnattack: lists all attacks of current Pokemon, prompts the user pick an attack and then inflicts that damage on the Computer’s current pokemon. If this K.Os the enemy then the Computer must switch Pokemon on their next turn. Should print out the following:
>>> Ash is attacking. Bulbosaur used Leaf Storm and did 20 damage.
Computer
- Computer will select between the three options. 2/3 of the time a user should attack. 1/6 of the time they should heal and 1/6 of the time they should switch pokemon.
attack: Will randomly select an attack and do damage to the User’s current Pokemon.heal: WIll heal current Pokemon by 20 HP, but cannot attack that turnswitch: switched current Pokemon, but cannot attack
Pokemon Attacks
All Pokemon of the same type have the same Attacks.
Grass Type
All grass type have the following attacks:
- Leaf Storm: 130 Power, 90% accurate
- Mega Drain: 50 Power, 100% accurate
- Razor Leaf: 55 Power, 95% accurate Grass Type is 1.5x stronger against Water Type.
Fire Type
All fire type have the following attacks
- Ember: 60 Power, 100% accurate
- Fire Punch: 85 Power, 80% accurate
- Flame Wheel: 70 Power, 90% accurate Fire Type is 1.5x stronger against Grass.
Water Type
All fire type have the following attacks:
- Bubble: 40 Power, 100% accurate
- Hydro Pump: 185 Power, 30% accurate
- Surf: 70 Power, 90% accurate
- Water Type is 1.5x stronger against Fire Types.
Implementation Details
- Use classes to build off the implemented base class for Pokemon. Keep track of HP, Max AP, and type.
- Here is some starter_code
- Design classes for Fire, Grass, Water Types that inherit from the base Pokemon Class
- Each Pokemon should be an instance, use a master list to store all the Pokemon and create this the beginning of the game
- Use methods to set the Pokemon for each player and remove those pokemon from the master Pokemon list.
- Player’s and Computer’s Pokemon should be stored using a list
- Pokemon attacks should be stored using a dictionary from the attack name to a list of [attack’s power, attack’s accuracy]
Check Point 1
Implement the following:
get_attack_poweron Pokemon classattackon Pokemon classtake_damageon Pokemon classhealon Pokemon class- Grass, Fire, and Water type classes
set_typeon Fire, Water and Grass classesset_attackson Fire, Water and Grass classesget_attack_poweron Fire, Water, and Grass classes
Check Point 2
Implement the following:
list_pokemonon User Classswitchon User Classhealon User Classis_end_gameon User Classprint_attackson USer Classattackon User Class
Computer class
play_turnon Computer classset_pokemonon Computer Classattackon Computer Classswitchon Computer Class
Check Point 3
Implement the following
- a game loop
- inputs that ask if user would like to attack, heal or switch
- call correct player function based on inputs
- check for the end of the game and end game if necessary