Adding attribute to world object to indicate whether world is a copy

This commit is contained in:
codemann8
2022-08-01 19:42:54 -05:00
parent 7fecbee3bb
commit 8a5a092522
3 changed files with 10 additions and 8 deletions

View File

@@ -62,6 +62,8 @@ class World(object):
self.aga_randomness = True self.aga_randomness = True
self.lock_aga_door_in_escape = False self.lock_aga_door_in_escape = False
self.save_and_quit_from_boss = True self.save_and_quit_from_boss = True
self.override_bomb_check = False
self.is_copied_world = False
self.accessibility = accessibility.copy() self.accessibility = accessibility.copy()
self.fix_skullwoods_exit = {} self.fix_skullwoods_exit = {}
self.fix_palaceofdarkness_exit = {} self.fix_palaceofdarkness_exit = {}
@@ -1306,7 +1308,7 @@ class CollectionState(object):
# In the future, this can be used to check if the player starts without bombs # In the future, this can be used to check if the player starts without bombs
def can_use_bombs(self, player): def can_use_bombs(self, player):
return (not self.world.bombbag[player] or self.has('Bomb Upgrade (+10)', player) or self.has('Bomb Upgrade (+5)', player, 2)) and ((hasattr(self.world,"override_bomb_check") and self.world.override_bomb_check) or self.can_farm_bombs(player)) return (not self.world.bombbag[player] or self.has('Bomb Upgrade (+10)', player) or self.has('Bomb Upgrade (+5)', player, 2)) and (self.world.override_bomb_check or self.can_farm_bombs(player))
def can_hit_crystal(self, player): def can_hit_crystal(self, player):
return (self.can_use_bombs(player) return (self.can_use_bombs(player)

View File

@@ -557,6 +557,7 @@ def copy_world(world, partial_copy=False):
if partial_copy: if partial_copy:
# undo some of the things that unintentionally affect the original world object # undo some of the things that unintentionally affect the original world object
world.key_logic = {} world.key_logic = {}
ret.is_copied_world = True
return ret return ret

View File

@@ -21,12 +21,12 @@ def set_rules(world, player):
global_rules(world, player) global_rules(world, player)
default_rules(world, player) default_rules(world, player)
ow_rules(world, player) ow_inverted_rules(world, player)
ow_bunny_rules(world, player) ow_bunny_rules(world, player)
if world.mode[player] == 'standard': if world.mode[player] == 'standard':
if world.get_region('Big Bomb Shop', player).entrances: # just some location that is placed late in the ER algorithm, prevent standard rules from applying when trying to search reachability in the overworld if not world.is_copied_world:
standard_rules(world, player) standard_rules(world, player)
elif world.mode[player] == 'open' or world.mode[player] == 'inverted': elif world.mode[player] == 'open' or world.mode[player] == 'inverted':
open_rules(world, player) open_rules(world, player)
@@ -805,7 +805,6 @@ def pot_rules(world, player):
add_rule(l, lambda state: state.can_hit_crystal(player)) add_rule(l, lambda state: state.can_hit_crystal(player))
def default_rules(world, player): def default_rules(world, player):
set_rule(world.get_entrance('Other World S&Q', player), lambda state: state.has_Mirror(player) and state.has_beaten_aga(player)) set_rule(world.get_entrance('Other World S&Q', player), lambda state: state.has_Mirror(player) and state.has_beaten_aga(player))
@@ -825,7 +824,7 @@ def default_rules(world, player):
# Bonk Item Access # Bonk Item Access
if world.shuffle_bonk_drops[player]: if world.shuffle_bonk_drops[player]:
if world.get_region('Big Bomb Shop', player).entrances: # just some location that is placed late in the ER algorithm, prevent standard rules from applying when trying to search reachability in the overworld if not world.is_copied_world:
from Regions import bonk_prize_table from Regions import bonk_prize_table
for location_name, (_, _, aga_required, _, _, _) in bonk_prize_table.items(): for location_name, (_, _, aga_required, _, _, _) in bonk_prize_table.items():
loc = world.get_location(location_name, player) loc = world.get_location(location_name, player)
@@ -958,7 +957,7 @@ def default_rules(world, player):
swordless_rules(world, player) swordless_rules(world, player)
def ow_rules(world, player): def ow_inverted_rules(world, player):
if world.is_atgt_swapped(player): if world.is_atgt_swapped(player):
set_rule(world.get_entrance('Agahnims Tower', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player)) set_rule(world.get_entrance('Agahnims Tower', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player))
else: else:
@@ -1481,7 +1480,7 @@ def no_glitches_rules(world, player):
# add_rule(world.get_location(location, player), lambda state: state.has('Hookshot', player)) # add_rule(world.get_location(location, player), lambda state: state.has('Hookshot', player))
set_rule(world.get_entrance('Paradox Cave Push Block Reverse', player), lambda state: False) # no glitches does not require block override set_rule(world.get_entrance('Paradox Cave Push Block Reverse', player), lambda state: False) # no glitches does not require block override
forbid_bomb_jump_requirements(world, player) forbid_bomb_jump_requirements(world, player)
if world.get_region('Big Bomb Shop', player).entrances: # just some location that is placed late in the ER algorithm, prevent underworld rules from applying when trying to search reachability in the overworld if not world.is_copied_world:
add_conditional_lamps(world, player) add_conditional_lamps(world, player)
@@ -1744,7 +1743,7 @@ def standard_rules(world, player):
add_rule(world.get_entrance('Bonk Fairy (Light)', player), lambda state: state.has('Zelda Delivered', player)) add_rule(world.get_entrance('Bonk Fairy (Light)', player), lambda state: state.has('Zelda Delivered', player))
if world.shuffle_bonk_drops[player]: if world.shuffle_bonk_drops[player]:
if world.get_region('Big Bomb Shop', player).entrances: # just some location that is placed late in the ER algorithm, prevent standard rules from applying when trying to search reachability in the overworld if not world.is_copied_world:
add_rule(world.get_location('Hyrule Castle Tree', player), lambda state: state.has('Zelda Delivered', player)) add_rule(world.get_location('Hyrule Castle Tree', player), lambda state: state.has('Zelda Delivered', player))
add_rule(world.get_location('Central Bonk Rocks Tree', player), lambda state: state.has('Zelda Delivered', player)) add_rule(world.get_location('Central Bonk Rocks Tree', player), lambda state: state.has('Zelda Delivered', player))