Player now pays for what he buys and buying a heart does not put it in the inventory. Solves #38 and #36
This commit is contained in:
@@ -70,6 +70,13 @@ class Player(FightingEntity):
|
||||
self.current_xp += xp
|
||||
self.level_up()
|
||||
|
||||
def change_hazel_balance(self, hz: int) -> None:
|
||||
"""
|
||||
Change the number of hazel the player has by hz. hz is negative
|
||||
when the player loses money and positive when he gains money
|
||||
"""
|
||||
self.hazel += hz
|
||||
|
||||
# noinspection PyTypeChecker,PyUnresolvedReferences
|
||||
def check_move(self, y: int, x: int, move_if_possible: bool = False) \
|
||||
-> bool:
|
||||
@@ -125,6 +132,12 @@ class Player(FightingEntity):
|
||||
"""
|
||||
self.inventory.append(obj)
|
||||
|
||||
def remove_from_inventory(self, obj: Any) -> None:
|
||||
"""
|
||||
Removes an object from the inventory
|
||||
"""
|
||||
self.inventory.remove(obj)
|
||||
|
||||
def save_state(self) -> dict:
|
||||
"""
|
||||
Saves the state of the entity into a dictionary
|
||||
|
Reference in New Issue
Block a user