Skip to content

Commit

Permalink
Fix "game is not beatable" error on some starting room seeds in OoE
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jan 22, 2018
1 parent dca6a91 commit f1a0fea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions randomizers/starting_room_randomizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def randomize_starting_room
next if room.entities.find{|e| e.is_boss?}

# Limit to rooms where the player can access at least 3 item locations. Otherwise the player could be stuck right at the start with no items.
checker.set_starting_room(room, 0)
room_doors = room.doors.reject{|door| checker.inaccessible_doors.include?(door.door_str)}
room_doors.select!{|door| door.direction == :left || door.direction == :right}
door = room_doors[0]
door_index = room.doors.index(door)
checker.set_starting_room(room, door_index)
accessible_locations, accessible_doors = checker.get_accessible_locations_and_doors()
next if accessible_locations.size < 3

Expand All @@ -63,7 +67,7 @@ def randomize_starting_room

room_doors = room.doors.reject{|door| checker.inaccessible_doors.include?(door.door_str)}
room_doors.select!{|door| door.direction == :left || door.direction == :right}
door = room_doors.sample(random: rng)
door = room_doors[0] # .sample(random: rng)
gap_start_index, gap_end_index, tiles_in_biggest_gap = get_biggest_door_gap(door)
case door.direction
when :left
Expand Down

0 comments on commit f1a0fea

Please sign in to comment.