def get_look_string(self, location=None): looks = [] for object in self.game.world.objects: if self.has_conditional_look_response(object.responses): if location is None: for response in Response.Responses( object.responses, self.game.world.verbs['LOOK']): looks += [response.kwargs['message']] elif type( object.placement ) == LocationPlacement and object.placement.location == location: message, reward, result = Response.Respond( object.responses, self.game.world.verbs['LOOK'], self.game) if result == Response.Success: looks += [ message, ] return ' '.join(looks)
def has_conditional_look_response(self, responses): for response in Response.Responses(responses, self.game.world.verbs['LOOK']): if response.is_conditional_look_response(): return True return False