def _CanMove(self, entry_direction: Direction, exit_direction: Direction, level_num: LevelNum, room_num: RoomNum, room: Room) -> bool: if not room.GetRoomType().AllowsDoorToDoorMovement( entry_direction, exit_direction, self.inventory.Has( Item.LADDER)): return False # Hungry enemy's room doesn't have a closed shutter door. So need a special check to similate # how it's not possible to move up in the room until the goriya has been properly fed. if (exit_direction == Direction.NORTH and room.GetEnemy() == Enemy.HUNGRY_ENEMY and not self.inventory.Has(Item.BAIT)): log.info("Hungry goriya is still hungry :(") return False wall_type = room.GetWallType(exit_direction) if (wall_type == WallType.SOLID_WALL or (wall_type == WallType.SHUTTER_DOOR and not self._CanDefeatEnemies(room))): return False if wall_type in [WallType.LOCKED_DOOR_1, WallType.LOCKED_DOOR_2]: if self.inventory.HasKey(): self.inventory.UseKey(level_num, room_num, exit_direction) else: return False return True
def _CanGetRoomItem(self, entry_direction: Direction, room: Room) -> bool: # Can't pick up a room in any rooms with water/moats without a ladder. # TODO: Make a better determination here based on the drop location and the entry direction. if room.GetRoomType().HasWater() and not self.inventory.Has( Item.LADDER): return False if room.HasDropBitSet() and not self._CanDefeatEnemies(room): return False if (room.GetRoomType() == RoomType.HORIZONTAL_CHUTE_ROOM and entry_direction in [Direction.NORTH, Direction.SOUTH]): return False if (room.GetRoomType() == RoomType.VERTICAL_CHUTE_ROOM and entry_direction in [Direction.EAST, Direction.WEST]): return False if room.GetRoomType() == RoomType.T_ROOM: return False return True