diff options
Diffstat (limited to 'weatbag/tiles/n2.py')
| -rw-r--r-- | weatbag/tiles/n2.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/weatbag/tiles/n2.py b/weatbag/tiles/n2.py index 32e3ce4..70f6051 100644 --- a/weatbag/tiles/n2.py +++ b/weatbag/tiles/n2.py @@ -1,10 +1,16 @@ from weatbag import words +from weatbag.utils import transfer class Tile: + def __init__(self): + self.contents = {'match': 42} + def describe(self): print("You are standing in the mouth of a cave. The air feels cool and " "is filled with the stench of rotting flesh. " "A dark path leads to the north. An exit to the south.") + if self.contents['match'] > 0: + print("Someone has dropped a box of matches on the ground.") def leave(self, player, direction): if direction=='s': @@ -15,14 +21,21 @@ class Tile: "that stalwart friend of the adventurer, the flaming torch.") def action(self, player, do): - if (do[0] in words.use or do[0]=='light') and do[1]=='torch': - if player.has('unlit torch'): + if (do[0] in words.take) and ('matches' in do): + if transfer('match', self.contents, player.inventory, n=42): + print("You pick up the matches.") + else: + print("You've already taken the matches.") + + elif (do[0] in words.use or do[0]=='light') and do[1]=='torch': + if player.has('unlit torch') and player.has('match'): player.take('unlit torch') + player.take('match') player.give('flaming torch') print("The torch catches, casting a flickering light on the " "cave walls.") else: - print("Good plan, but you don't have a torch.") + print("You'll need a torch and a match.") else: print("Sorry, I don't understand") |
