adventure-game #3

Open
Kenwood wants to merge 80 commits from adventure-game into master
3 changed files with 26 additions and 1 deletions
Showing only changes of commit 377bb43e42 - Show all commits

View File

@ -29,6 +29,13 @@ class GameNavigator(npyscreen.FormBaseNew):
self.logBox.value = res # Set the logbox to that value self.logBox.value = res # Set the logbox to that value
def update_location(self, location):
"""
This may not be needed in the future, dynamic
handling of location is something the navigator should do and should inherit from player.
"""
pass
def create(self): def create(self):
top_division_height = 20 top_division_height = 20
inventory_width = 20 inventory_width = 20

View File

@ -92,6 +92,17 @@ class Handler(npyscreen.ButtonPress):
self.parent.update_log(room[long_arg.lower()]['pick_up']) self.parent.update_log(room[long_arg.lower()]['pick_up'])
except KeyError: except KeyError:
self.parent.update_log("You cant pick that up.") self.parent.update_log("You cant pick that up.")
elif command == 'OPEN':
try:
self.parent.parentApp.log.info('Player tried to open door: {0}'.format(arguments[0]))
new_room = room[arguments[0].lower()]['leads_to']
self.parent.parentApp.log.debug('New room is: {0}'.format(new_room))
except KeyError:
self.parent.update_log("You cant open that.")
except IndexError:
self.parent.update_log("you must specify something to open")
else: else:
self.parent.parentApp.log.info('Player\'s command was not understood: {0}'.format(command)) self.parent.parentApp.log.info('Player\'s command was not understood: {0}'.format(command))
self.parent.update_log('I didn\'t understand {0}'.format(command)) self.parent.update_log('I didn\'t understand {0}'.format(command))

View File

@ -9,3 +9,10 @@ class Player:
self.save_location = save_location self.save_location = save_location
self.playerData = parse(save_location) self.playerData = parse(save_location)
def change_room(self, new_room):
"""
Should move the player to a new room
TODO: Put a check here that checks if the room we're moving to exists!
"""
self.playerData['player']['location'] = new_room