diff --git a/dungeonbattle/entities/player.py b/dungeonbattle/entities/player.py index 1f64d3d..7fdf041 100644 --- a/dungeonbattle/entities/player.py +++ b/dungeonbattle/entities/player.py @@ -24,13 +24,22 @@ class Player(FightingEntity): self.map.currentx = x def level_up(self) -> None: + """ + Add levels to the player as much as it is possible. + """ while self.current_xp > self.max_xp: self.level += 1 self.current_xp -= self.max_xp self.max_xp = self.level * 10 self.health = self.maxhealth + # TODO Remove it, that's only fun + self.map.spawn_random_entities(randint(self.level, self.level * 5)) def add_xp(self, xp: int) -> None: + """ + Add some experience to the player. + If the required amount is reached, level up. + """ self.current_xp += xp self.level_up()