Skip to content

yukl-c/Python-OOP-Pokemon-Battle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Python-OOP-Pokemon-Battle

Pokemon Battle in Python OOP

Class: set the Pokemon's name, type, moves with its type and power, abilities including level, attack, defence, speed, and hp.

def fight(self, pokemon2): Function of pokemen battle. To illustrate the players and their pokemon to battle, then ask their command of move to battle. Higher speed, higher opportunity that the pokemon is the first one to attack. Pokemon attack target to reduce the target's hp. When one player's pokemon's hp drop to 0, it faints. Another player win the battle.

def show(self, pokemon2): Function to the names, types, levels and hp of pokemons.

def move_command(self): Function to ask move and record type, power, and name of moves.

def attack_sum(self, pokemon2): Function to calculate the attack sum according to the move type and target pokemon's type. The attack times 2 if the move type is super effective to attack to the target's type. The attack times 0.2 if the move type is not very effective to attack to the target's type.

def damage_to_rival(self, pokemon2): Function to calculate the damage to the target.

About

Pokemon Battle in Python OOP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages