-
Notifications
You must be signed in to change notification settings - Fork 0
/
objects.py
25 lines (20 loc) · 975 Bytes
/
objects.py
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
from pokemon import Pokemon, Act
class Objects:
class Potion(Act):
def __init__(self, name: str) -> None:
super().__init__(name)
def use(self, pokemon_that_beneficies: Pokemon):
new_life = pokemon_that_beneficies.get_life() + 60
if new_life >= pokemon_that_beneficies.get_max_life():
pokemon_that_beneficies.set_life(pokemon_that_beneficies.get_max_life())
else:
pokemon_that_beneficies.set_life(new_life)
class SuperPotion(Act):
def __init__(self, name: str) -> None:
super().__init__(name)
def use(self, pokemon_that_beneficies: Pokemon):
new_life = pokemon_that_beneficies.get_life() + 100
if new_life >= pokemon_that_beneficies.get_max_life():
pokemon_that_beneficies.set_life(pokemon_that_beneficies.get_max_life())
else:
pokemon_that_beneficies.set_life(new_life)