Fixed grammar, unified the docstring's format and added documentation to some classes that did not have any. Closes #32.

This commit is contained in:
eichhornchen
2020-12-13 21:29:25 +01:00
parent 3f62fbaa2b
commit 646e0063be
24 changed files with 254 additions and 170 deletions

View File

@ -11,7 +11,7 @@ from ..interfaces import FightingEntity, InventoryHolder
class Player(InventoryHolder, FightingEntity):
"""
The class of the player
The class of the player.
"""
current_xp: int = 0
max_xp: int = 10
@ -45,7 +45,7 @@ class Player(InventoryHolder, FightingEntity):
def level_up(self) -> None:
"""
Add levels to the player as much as it is possible.
Add as many levels as possible to the player.
"""
while self.current_xp > self.max_xp:
self.level += 1
@ -59,8 +59,8 @@ class Player(InventoryHolder, FightingEntity):
def add_xp(self, xp: int) -> None:
"""
Add some experience to the player.
If the required amount is reached, level up.
Adds some experience to the player.
If the required amount is reached, the player levels up.
"""
self.current_xp += xp
self.level_up()
@ -89,9 +89,8 @@ class Player(InventoryHolder, FightingEntity):
def recalculate_paths(self, max_distance: int = 8) -> None:
"""
Use Dijkstra algorithm to calculate best paths for monsters to go to
the player. Actually, the paths are computed for each tile adjacent to
the player then for each step the monsters use the best path avaliable.
Uses Dijkstra algorithm to calculate best paths for monsters to go to
the player.
"""
distances = []
predecessors = []