From 76d1149e6725ca8a59799e0c1f2112d3cbab5afb Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sat, 5 Jan 2013 17:10:23 +0000 Subject: Various fixes to game core --- weatbag/action.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'weatbag/action.py') diff --git a/weatbag/action.py b/weatbag/action.py index 159e9a0..9ef0f47 100644 --- a/weatbag/action.py +++ b/weatbag/action.py @@ -12,13 +12,7 @@ def get_action(): action = input('> ').lower().split() for prep in words.prepositions.intersection(action): action.remove(prep) - - - # Look around - return look_around - - return (move, action[1][0]) return action move_directions = {'n','e','s','w','north','east','south','west'} @@ -36,7 +30,7 @@ def handle_action(tile, player, do): elif len(do) == 2 and (do[0] in words.look) and (do[1] in words.inventory): # Look at bag - for item, n in inventory.most_common(): + for item, n in player.inventory.most_common(): if n < 1: break print(item, '(%d)' % n) @@ -44,14 +38,9 @@ def handle_action(tile, player, do): else: tile.action(player, do) -def process_move(direction): - direction = direction[0].lower() - if direction == 'n': - return (0, 1) - if direction == 's': - return (0, -1) - if direction == 'w': - return (-1, 0) - if direction == 'e': - return (1, 0) - return (0, 0) +move_coords = { + 'n': (0, 1), + 's': (0, -1), + 'w': (-1, 0), + 'e': (1, 0) +} -- cgit v1.3