Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Room
- from Dungeon import TOP_LEVEL_DELIM, SECOND_LEVEL_DELIM
- class Exit:
- direction = ""
- source_room = ""
- destination_room = ""
- def manuel_exit(self,direction,source_room,destination_room):
- self.dir = direction
- self.source_room = source_room
- self.destination_room = destination_room
- self.source_room.addExit(self)
- return self
- def __init__(self):
- pass
- def scanner_exit(self,f,d):
- self.__init__()
- source_roomTitle = f.readline()
- if source_roomTitle == TOP_LEVEL_DELIM:
- raise Exception("No exit found")
- self.source_room = d.getRoom(source_roomTitle)
- self.direction=f.readline()
- self.destination_room = d.getRoom(f.readline())
- if(f.readline()!=DungeonInstance.SECOND_LEVEL_DELIM):
- raise Exception(f"Dungeon format error: No {SECOND_LEVEL_DELIM} found after exit.")
- def describe(self):
- return f"You can go {self.direction} to the {self.destination_room.getName()}."
- def get_direction(self):
- return self.direction
- def get_source(self):
- return self.source_room
- def get_destination_roomination(self):
- return self.destination_room
Add Comment
Please, Sign In to add comment