Retro break up of various options

This commit is contained in:
aerinon
2022-09-02 13:09:39 -06:00
parent af4f8e5b4b
commit 87834986d4
28 changed files with 351 additions and 193 deletions

View File

@@ -158,7 +158,7 @@ class PlacementRule(object):
left -= rule_needed
return False
def is_satisfiable(self, outside_keys, unplaced_keys, big_key_loc, prize_location, cr_count):
def is_satisfiable(self, outside_keys, wild_keys, unplaced_keys, big_key_loc, prize_location, cr_count):
if self.prize_relevance and prize_location:
if self.prize_relevance == 'BigBomb':
if prize_location.item.name not in ['Crystal 5', 'Crystal 6']:
@@ -272,7 +272,7 @@ def analyze_dungeon(key_layout, world, player):
key_logic.bk_chests.update(find_big_chest_locations(key_layout.all_chest_locations))
key_logic.bk_chests.update(find_big_key_locked_locations(key_layout.all_chest_locations))
key_logic.prize_location = dungeon_table[key_layout.sector.name].prize
if world.retro[player] and world.mode[player] != 'standard':
if world.keyshuffle[player] == 'universal' and world.mode[player] != 'standard':
return
original_key_counter = find_counter({}, False, key_layout, False)
@@ -923,7 +923,7 @@ def self_lock_possible(counter):
def available_chest_small_keys(key_counter, world, player):
if not world.keyshuffle[player] and not world.retro[player]:
if world.keyshuffle[player] == 'none':
cnt = 0
for loc in key_counter.free_locations:
if key_counter.big_key_opened or '- Big Chest' not in loc.name:
@@ -934,7 +934,7 @@ def available_chest_small_keys(key_counter, world, player):
def available_chest_small_keys_logic(key_counter, world, player, sm_restricted):
if not world.keyshuffle[player] and not world.retro[player]:
if world.keyshuffle[player] == 'none':
cnt = 0
for loc in key_counter.free_locations:
if loc not in sm_restricted and (key_counter.big_key_opened or '- Big Chest' not in loc.name):
@@ -1446,8 +1446,9 @@ def validate_bk_layout(proposal, builder, start_regions, world, player):
# Soft lock stuff
def validate_key_layout(key_layout, world, player):
# retro is all good - except for hyrule castle in standard mode
if (world.retro[player] and (world.mode[player] != 'standard' or key_layout.sector.name != 'Hyrule Castle')) or world.logic[player] == 'nologic':
# universal key is all good - except for hyrule castle in standard mode
if world.logic[player] == 'nologic' or (world.keyshuffle[player] == 'universal' and
(world.mode[player] != 'standard' or key_layout.sector.name != 'Hyrule Castle')):
return True
flat_proposal = key_layout.flat_prop
state = ExplorationState(dungeon=key_layout.sector.name)
@@ -1575,8 +1576,8 @@ def enough_small_locations(state, avail_small_loc):
def determine_prize_lock(key_layout, world, player):
if ((world.retro[player] and (world.mode[player] != 'standard' or key_layout.sector.name != 'Hyrule Castle'))
or world.logic[player] == 'nologic'):
if world.logic[player] == 'nologic' or (world.keyshuffle[player] == 'universal' and
(world.mode[player] != 'standard' or key_layout.sector.name != 'Hyrule Castle')):
return # done, doesn't matter what
flat_proposal = key_layout.flat_prop
state = ExplorationState(dungeon=key_layout.sector.name)
@@ -1608,7 +1609,7 @@ def determine_prize_lock(key_layout, world, player):
def cnt_avail_small_locations(free_locations, key_only, state, world, player):
if not world.keyshuffle[player] and not world.retro[player]:
if world.keyshuffle[player] == 'none':
bk_adj = 1 if state.big_key_opened and not state.big_key_special else 0
avail_chest_keys = min(free_locations - bk_adj, state.key_locations - key_only)
return max(0, avail_chest_keys + key_only - state.used_smalls)
@@ -1616,7 +1617,7 @@ def cnt_avail_small_locations(free_locations, key_only, state, world, player):
def cnt_avail_small_locations_by_ctr(free_locations, counter, layout, world, player):
if not world.keyshuffle[player] and not world.retro[player]:
if world.keyshuffle[player] == 'none':
bk_adj = 1 if counter.big_key_opened and not layout.big_key_special else 0
avail_chest_keys = min(free_locations - bk_adj, layout.max_chests)
return max(0, avail_chest_keys + len(counter.key_only_locations) - counter.used_keys)
@@ -2059,14 +2060,14 @@ def val_rule(rule, skn, allow=False, loc=None, askn=None, setCheck=None):
# Soft lock stuff
def validate_key_placement(key_layout, world, player):
if world.retro[player] or world.accessibility[player] == 'none':
if world.keyshuffle[player] == 'universal' or world.accessibility[player] == 'none':
return True # Can't keylock in retro. Expected if beatable only.
max_counter = find_max_counter(key_layout)
keys_outside = 0
big_key_outside = False
smallkey_name = dungeon_keys[key_layout.sector.name]
bigkey_name = dungeon_bigs[key_layout.sector.name]
if world.keyshuffle[player]:
if world.keyshuffle[player] != 'none':
keys_outside = key_layout.max_chests - sum(1 for i in max_counter.free_locations if i.item is not None and i.item.name == smallkey_name and i.item.player == player)
if world.bigkeyshuffle[player]:
max_counter = find_max_counter(key_layout)