set_rule(world.get_entrance('Kings Grave'),lambdastate:state.has_Boots()and(state.can_lift_heavy_rocks()or(state.has_Mirror()andstate.can_reach('West Dark World'))))
set_rule(world.get_entrance('Desert Ledge Return Rocks'),lambdastate:state.can_lift_rocks())# should we decide to place something that is not a dungeon end up there at some point
set_rule(world.get_entrance('Dark World Potion Shop'),lambdastate:state.has_Pearl()and(state.can_lift_rocks()orstate.has('Hammer')orstate.has('Flippers')))
set_rule(world.get_entrance('West Dark World Gap'),lambdastate:state.has_Pearl()andstate.has('Hookshot')and(state.has('Flippers')orstate.has('Hammer')orstate.can_lift_rocks()))
set_rule(world.get_entrance('Palace of Darkness'),lambdastate:state.has_Pearl())# ToDo Not sure if required
set_rule(world.get_entrance('Dark Lake Hylia Drop (East)'),lambdastate:(state.has_Pearl()andstate.has('Flippers')orstate.has_Mirror()))# Overworld Bunny Revival
set_rule(world.get_location('Bombos Tablet'),lambdastate:state.has('Book of Mudora')andstate.has_beam_sword()andstate.has_Mirror())
set_rule(world.get_entrance('Dark Lake Hylia Drop (South)'),lambdastate:state.has('Flippers'))# ToDo any fake flipper set up?
set_rule(world.get_entrance('Dark Desert Cave'),lambdastate:state.has_Pearl())# ToDo Bunny Revival can give access to this cave in super bunny state. Not sure how to deal with shuffled entrances, as much easier to block of cave entrances than individual shuffled chests
set_rule(world.get_entrance('Dark Desert Hint'),lambdastate:state.has_Pearl())# ToDo Bunny Revival can give access to this cave in super bunny state. Not sure how to deal with shuffled entrances, as much easier to block of cave entrances than individual shuffled chests
set_rule(world.get_entrance('Dark Desert Fairy'),lambdastate:state.has_Pearl())# ToDo Bunny Revival can give access to this cave in super bunny state. Not sure how to deal with shuffled entrances, as much easier to block of cave entrances than individual shuffled chests
set_rule(world.get_entrance('Dark Death Mountain Climb (Top)'),lambdastate:state.has_Pearl())# Chests inside could be collected with super bunny, but may be shuffled. rather limit access for now ToDo
set_rule(world.get_entrance('Dark Death Mountain Climb (Bottom)'),lambdastate:state.has_Pearl())
set_rule(world.get_entrance('Cave Shop (Dark Death Mountain)'),lambdastate:state.has_Pearl())# just for save bunny algo for now
set_rule(world.get_entrance('Dark Death Mountain Climb Exit (Bottom)'),lambdastate:False)# Cannot get to bottom exit from top. Just exists for shuffling
set_rule(world.get_location('[cave-055] Spike Cave'),lambdastate:state.has('Hammer')andstate.can_lift_rocks())# damage should be survivable always somehow. MAY need more logic ToDo
set_rule(world.get_location('[cave-056] Hookshot Cave [top right chest]'),lambdastate:state.has('Hookshot'))
set_rule(world.get_location('[cave-056] Hookshot Cave [top left chest]'),lambdastate:state.has('Hookshot'))
set_rule(world.get_location('[cave-056] Hookshot Cave [bottom right chest]'),lambdastate:state.has('Hookshot'))
set_rule(world.get_location('[cave-056] Hookshot Cave [bottom left chest]'),lambdastate:state.has('Hookshot')orstate.has('Pegasus Boots'))
set_rule(world.get_location('Piece of Heart (Death Mountain - Floating Island)'),lambdastate:state.has_Mirror())
set_rule(world.get_entrance('Turtle Rock'),lambdastate:state.has_Pearl()andstate.has_sword()andstate.has_turtle_rock_medallion())# sword required to cast magic (!)
set_rule(world.get_location('[dungeon-D4-B2] Thieves Town - Big Chest'),lambdastate:state.can_collect('Small Key (Thieves Town)')andstate.has('Hammer'))
set_rule(world.get_location('[dungeon-D4-1F] Thieves Town - Room above Boss'),lambdastate:state.can_collect('Small Key (Thieves Town)'))
forlocationin['[dungeon-D4-1F] Thieves Town - Room above Boss','[dungeon-D4-B2] Thieves Town - Big Chest','[dungeon-D4-B2] Thieves Town - Chest next to Blind','Blind - Heart Container']:
(state.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').itemisnotNoneandstate.world.get_location('[dungeon-D5-B1] Ice Palace - Big Key Room').item.namein['Big Key (Ice Palace)'])or
(state.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').itemisnotNoneandstate.world.get_location('[dungeon-D5-B2] Ice Palace - Map Room').item.namein['Big Key (Ice Palace)']))))# if you do ipbj and waste SKs in the basement, you have to BJ over the hookshot room to fix your mess potentially. This seems fair
set_rule(world.get_location('[dungeon-D7-1F] Turtle Rock - Compass Room'),lambdastate:state.has('Cane of Somaria'))# We could get here from the middle section without Cane as we don't cross the entrance gap!
set_rule(world.get_location('[dungeon-D7-1F] Turtle Rock - Map Room [left chest]'),lambdastate:state.has('Cane of Somaria')andstate.has('Fire Rod'))
set_rule(world.get_location('[dungeon-D7-1F] Turtle Rock - Map Room [right chest]'),lambdastate:state.has('Cane of Somaria')andstate.has('Fire Rod'))
set_rule(world.get_entrance('Turtle Rock Pokey Room'),lambdastate:state.can_collect('Small Key (Turtle Rock)',3)ifstate.can_reach('Turtle Rock (Dark Room) (North)','Entrance')elsestate.can_collect('Small Key (Turtle Rock)',2)ifstate.can_reach('Turtle Rock (Eye Bridge)')elsestate.can_collect('Small Key (Turtle Rock)',1))# May waste keys from back entrance if accessible
set_rule(world.get_entrance('Turtle Rock (Chain Chomp Room) (South)'),lambdastate:state.can_collect('Small Key (Turtle Rock)',4))# Just to be save
set_rule(world.get_entrance('Turtle Rock (Chain Chomp Room) (North)'),lambdastate:state.can_collect('Small Key (Turtle Rock)',4)ifstate.can_reach('Turtle Rock (Dark Room) (North)','Entrance')elsestate.can_collect('Small Key (Turtle Rock)',3)ifstate.can_reach('Turtle Rock (Eye Bridge)')elsestate.can_collect('Small Key (Turtle Rock)',2))# May waste keys from back entrance if accessible
set_rule(world.get_location('[dungeon-D7-B1] Turtle Rock - Big Chest'),lambdastate:state.can_collect('Big Key (Turtle Rock)')and(state.has('Cane of Somaria')orstate.has('Hookshot')))
set_rule(world.get_entrance('Turtle Rock (Big Chest) (North)'),lambdastate:state.has('Cane of Somaria')orstate.has('Hookshot'))
set_rule(world.get_entrance('Turtle Rock Big Key Door'),lambdastate:state.can_collect('Big Key (Turtle Rock)'))
set_rule(world.get_entrance('Turtle Rock Dark Room Staircase'),lambdastate:state.can_collect('Small Key (Turtle Rock)',3))
set_rule(world.get_entrance('Turtle Rock (Dark Room) (North)'),lambdastate:state.has('Cane of Somaria'))
set_rule(world.get_entrance('Turtle Rock (Dark Room) (South)'),lambdastate:state.has('Cane of Somaria'))
set_rule(world.get_entrance('Turtle Rock (Trinexx)'),lambdastate:state.can_collect('Small Key (Turtle Rock)',4)andstate.can_collect('Big Key (Turtle Rock)')and
state.has('Cane of Somaria')andstate.has('Fire Rod')andstate.has('Ice Rod')and
forlocationin['[dungeon-D7-B1] Turtle Rock - Big Chest','Trinexx - Heart Container','[dungeon-D7-B1] Turtle Rock - Roller Switch Room','[dungeon-D7-B2] Turtle Rock - Eye Bridge Room [bottom left chest]',
'[dungeon-D7-B2] Turtle Rock - Eye Bridge Room [bottom right chest]','[dungeon-D7-B2] Turtle Rock - Eye Bridge Room [top left chest]','[dungeon-D7-B2] Turtle Rock - Eye Bridge Room [top right chest]']:# ToDo Big Key can be elsewhere if we have an entrance shuffle
set_rule(world.get_entrance('Dark Palace Bridge Room'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',1))# If we can reach any other small key door, we already have back door access to this area
set_rule(world.get_entrance('Dark Palace Big Key Door'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',6)andstate.can_collect('Big Key (Palace of Darkness)')andstate.has('Bow')andstate.has('Hammer'))
set_rule(world.get_entrance('Dark Palace Big Key Chest Staircase'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',6)or(state.world.get_location('[dungeon-D1-1F] Dark Palace - Big Key Room').itemisnotNoneand(state.world.get_location('[dungeon-D1-1F] Dark Palace - Big Key Room').item.namein['Small Key (Palace of Darkness)'])))
set_rule(world.get_entrance('Dark Palace Spike Statue Room Door'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',6)or(state.world.get_location('[dungeon-D1-1F] Dark Palace - Spike Statue Room').itemisnotNoneand(state.world.get_location('[dungeon-D1-1F] Dark Palace - Spike Statue Room').item.namein['Small Key (Palace of Darkness)'])))
set_rule(world.get_entrance('Dark Palace (North)'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',4))
set_rule(world.get_entrance('Dark Palace Maze Door'),lambdastate:state.can_collect('Small Key (Palace of Darkness)',6))
set_rule(world.get_location('[dungeon-D1-1F] Dark Palace - Big Chest'),lambdastate:state.can_collect('Big Key (Palace of Darkness)'))
forlocationin['[dungeon-D1-1F] Dark Palace - Big Chest','Helmasaur - Heart Container']:
forbid_item(world.get_location(location),'Big Key (Palace of Darkness)')
# these key rules are conservative, you might be able to get away with more lenient rules
set_rule(world.get_entrance('Pyramid Hole'),lambdastate:state.can_reach('East Dark World')and(state.has_sword()orstate.has('Bottle')orstate.has('Bug Catching Net')))# some obscure hammer on pyramid soft lock potential scenarios
forlocationin['[dungeon-A2-1F] Ganons Tower - Big Chest','[dungeon-A2-6F] Ganons Tower - Mini Helmasaur Room [left chest]','[dungeon-A2-6F] Ganons Tower - Mini Helmasaur Room [right chest]',
set_rule(world.get_location('Ganon'),lambdastate:state.has_beam_sword()andstate.has_fire_source()and(state.has('Tempered Sword')orstate.has('Golden Sword')orstate.has('Silver Arrows')orstate.has('Lamp')orstate.has('Bottle')orstate.has('Half Magic')orstate.has('Quarter Magic')))# need to light torch a sufficient amount of times
set_rule(world.get_entrance('Dark Lake Hylia Teleporter'),lambdastate:state.has_Pearl()andstate.has('Flippers')and(state.has('Hammer')orstate.can_lift_rocks()))
set_rule(world.get_entrance('Dark Lake Hylia Ledge Drop'),lambdastate:state.has('Flippers'))
add_rule(world.get_location('[dungeon-C-B1] Escape - Final Basement Room [left chest]'),lambdastate:state.can_reach('Sewer Drop'))
add_rule(world.get_location('[dungeon-C-B1] Escape - Final Basement Room [middle chest]'),lambdastate:state.can_reach('Sewer Drop'))
add_rule(world.get_location('[dungeon-C-B1] Escape - Final Basement Room [right chest]'),lambdastate:state.can_reach('Sewer Drop'))
add_rule(world.get_location('[dungeon-C-B1] Escape - First B1 Room'),lambdastate:state.can_reach('Sewer Drop')or(state.world.get_location('[dungeon-C-B1] Escape - First B1 Room').itemisnotNoneandstate.world.get_location('[dungeon-C-B1] Escape - First B1 Room').item.namein['Small Key (Escape)']))# you could skip this chest and be unable to go back until you can drop into escape