2020-10-23 16:17:48 +02:00
|
|
|
from ..interfaces import FightingEntity
|
2020-10-16 17:58:00 +02:00
|
|
|
|
2020-11-06 15:33:26 +01:00
|
|
|
|
2020-10-16 17:58:00 +02:00
|
|
|
class Player(FightingEntity):
|
|
|
|
maxhealth = 20
|
2020-10-23 15:15:37 +02:00
|
|
|
strength = 5
|
2020-11-06 18:12:17 +01:00
|
|
|
|
2020-11-06 18:03:30 +01:00
|
|
|
def move_up(self) -> bool:
|
|
|
|
return self.check_move(self.y - 1, self.x, True)
|
2020-11-06 17:48:47 +01:00
|
|
|
|
2020-11-06 18:03:30 +01:00
|
|
|
def move_down(self) -> bool:
|
|
|
|
return self.check_move(self.y + 1, self.x, True)
|
2020-11-06 17:48:47 +01:00
|
|
|
|
2020-11-06 18:03:30 +01:00
|
|
|
def move_left(self) -> bool:
|
|
|
|
return self.check_move(self.y, self.x - 1, True)
|
2020-11-06 17:48:47 +01:00
|
|
|
|
2020-11-06 18:03:30 +01:00
|
|
|
def move_right(self) -> bool:
|
|
|
|
return self.check_move(self.y, self.x + 1, True)
|
2020-11-06 20:04:24 +01:00
|
|
|
|
2020-11-06 18:12:17 +01:00
|
|
|
currentXP: int
|
|
|
|
maxXP: int
|
|
|
|
|
|
|
|
def level_up(self):
|
|
|
|
if currentXP>maxXP :
|
|
|
|
self.level+=1
|
|
|
|
currentXP = 0
|
|
|
|
maxXP = self.level*10
|
|
|
|
def addXP(self, xp) :
|
|
|
|
currentXP+=xp
|
|
|
|
self.level_up()
|