diff options
Diffstat (limited to 'weatbag')
| -rw-r--r-- | weatbag/__init__.py | 4 | ||||
| -rw-r--r-- | weatbag/words.py | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py index 6c8ed1b..7212bfa 100644 --- a/weatbag/__init__.py +++ b/weatbag/__init__.py @@ -10,6 +10,7 @@ class Player: self.position = (0,0) def has(self, item): + "Does the player have any of item?" return self.inventory[item] > 0 def give(self, item, n=1): @@ -64,6 +65,9 @@ def main(): while True: do = action.get_action() if action.is_move(do): + # check if we can leave tile + if not getattr(tile, 'leave', lambda p,d: True)(player, do[1]): + continue # move n,e = player.position dn, de = action.process_move(do[1]) diff --git a/weatbag/words.py b/weatbag/words.py index 8212657..11ede7d 100644 --- a/weatbag/words.py +++ b/weatbag/words.py @@ -1,3 +1,12 @@ +"""A thesaurus of words the player might use, so you can easily accept +synonyms of the word you want. + +e.g. This will recognise take, pick, get or collect:: + + if do[0] in weatbag.words.take: + #... +""" + move = {'move','walk','go'} give = {'give', 'feed', 'present'} use = {'eat', 'use', 'wear'} |
