nodes/inn.pyΒΆ
Part of Dungeon Explorer.
1"""Inn: rest/heal for gold."""
2
3from simvx.core import Node2D
4
5
6class Inn(Node2D):
7 """Inn logic: pay gold to fully heal."""
8
9 REST_COST = 50
10
11 def __init__(self, **kwargs):
12 super().__init__(name="Inn", **kwargs)
13
14 @staticmethod
15 def can_rest(gold: int) -> bool:
16 return gold >= Inn.REST_COST
17
18 @staticmethod
19 def rest(player) -> int:
20 """Heal the player. Returns gold cost."""
21 if player.gold < Inn.REST_COST:
22 return 0
23 player.gold -= Inn.REST_COST
24 player.hp = player.max_hp
25 return Inn.REST_COST