-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokemon.py
More file actions
64 lines (49 loc) · 1.48 KB
/
Copy pathPokemon.py
File metadata and controls
64 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from abc import ABC, abstractmethod
class Pokemon(ABC):
# The Pokemon Class. it contains the basic attributes every Pokemon must have.
def __init__(self, name, catch_rate):
if not isinstance(name, str): # Validating input type.
raise TypeError("Expected a String")
self.__name = name
if (catch_rate < 40) or (catch_rate > 45): # Validating input Value.
raise ValueError("A Pokemon catch rate must be an Integer between 40-45")
if not isinstance(catch_rate, int): # Validating input type.
raise TypeError("Expected an Integer between 40-45")
self.__catch_rate = catch_rate
def get_name(self):
return str(self.__name)
def get_catch_rate(self):
return int(self.__catch_rate)
@abstractmethod
def __repr__(self):
pass
@abstractmethod
def absorb(self, damage):
pass
@abstractmethod
def attack(self, other):
pass
@abstractmethod
def can_fight(self):
pass
@abstractmethod
def get_damage(self, other):
pass
@abstractmethod
def get_defense_power(self):
pass
@abstractmethod
def get_effective_against_me(self):
pass
@abstractmethod
def get_effective_against_others(self):
pass
@abstractmethod
def get_hit_points(self):
pass
@abstractmethod
def get_pokemon_type(self):
pass
@abstractmethod
def level_up(self, level_gain):
pass