-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFire.py
More file actions
56 lines (43 loc) · 1.53 KB
/
Copy pathFire.py
File metadata and controls
56 lines (43 loc) · 1.53 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
from Pokemon import Pokemon, abstractmethod
import copy
class Fire(Pokemon):
# represents all the attributes related to a Pokemon of a Fire type.
def __init__(self, name, catch_rate, pokemon_type):
Pokemon.__init__(self, name, catch_rate)
if not isinstance(pokemon_type, str): # Validating input type.
raise TypeError("Expected a String")
if pokemon_type != "fire": # Validating input value.
raise ValueError("The Pokemon type must be fire")
self.__pokemon_type = pokemon_type
self.__effective_against_me = ["water"] # resetting the pokemon type which is effective against Fire pokemons.
self.__effective_against_others = [] # resetting the pokemon type which is effective against other pokemons.
def get_pokemon_type(self):
return str(self.__pokemon_type)
def get_effective_against_me(self):
return copy.copy(self.__effective_against_me)
def get_effective_against_others(self):
return copy.copy(self.__effective_against_others)
@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_hit_points(self):
pass
@abstractmethod
def level_up(self, level_gain):
pass