diff options
| author | Julian Irwin <julian.irwin@gmail.com> | 2013-01-26 13:03:36 -0500 |
|---|---|---|
| committer | Julian Irwin <julian.irwin@gmail.com> | 2013-01-26 13:03:36 -0500 |
| commit | 96ec51791405fd8982fdda3ee430a0520f0a822c (patch) | |
| tree | 337afbc8831baddd574700b0a0150102d5120e69 /weatbag/tiles | |
| parent | 7f6cb008d54bb650662605ecd702089f87eea70d (diff) | |
| parent | f19f86792b33beaf2e1e12989a85557ae7fbc29c (diff) | |
Merge branch 'master' of git://github.com/takluyver/weatbag into southern-tiles-1
Getting everything up to date before I continue. Also see if anyone has added cool new features.
Diffstat (limited to 'weatbag/tiles')
| -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") |
