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:
@ -3,6 +3,7 @@ from ..translations import gettext as _
|
||||
from .player import Player
|
||||
from .items import Item
|
||||
from random import choice
|
||||
from typing import Dict, Tuple, Any
|
||||
|
||||
|
||||
class Merchant(FriendlyEntity):
|
||||
@ -50,6 +51,24 @@ class Merchant(FriendlyEntity):
|
||||
d = super().save_state()
|
||||
d["inventory"] = [item.save_state() for item in self.inventory]
|
||||
return d
|
||||
|
||||
def add_to_inventory(self, obj: Any) -> None:
|
||||
"""
|
||||
Adds an object to inventory
|
||||
"""
|
||||
self.inventory.append(obj)
|
||||
|
||||
def remove_from_inventory(self, obj: Any) -> None:
|
||||
"""
|
||||
Removes an object from the inventory
|
||||
"""
|
||||
self.inventory.remove(obj)
|
||||
|
||||
def change_hazel_balance(self, hz: int) -> None:
|
||||
"""
|
||||
Change the number of hazel the merchant has by hz.
|
||||
"""
|
||||
self.hazel += hz
|
||||
|
||||
|
||||
class Sunflower(FriendlyEntity):
|
||||
|
Reference in New Issue
Block a user