Test player level up
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user