Test player level up

This commit is contained in:
Yohann D'ANELLO
2020-11-06 21:23:17 +01:00
parent 0de11abfa8
commit aeb43a0cec
3 changed files with 13 additions and 7 deletions

View File

@ -2,8 +2,11 @@ from ..interfaces import FightingEntity
class Player(FightingEntity):
maxhealth = 20
strength = 5
maxhealth: int = 20
strength: int = 5
level: int = 1
current_xp: int = 0
max_xp: int = 10
def move_up(self) -> bool:
return self.check_move(self.y - 1, self.x, True)
@ -17,13 +20,10 @@ class Player(FightingEntity):
def move_right(self) -> bool:
return self.check_move(self.y, self.x + 1, True)
current_xp: int
max_xp: int
def level_up(self) -> None:
if self.current_xp > self.max_xp:
while self.current_xp > self.max_xp:
self.level += 1
self.current_xp = 0
self.current_xp -= self.max_xp
self.max_xp = self.level * 10
def add_xp(self, xp: int) -> None: