Compass/Map can be progressive

Fixed filter_for_potential_bk_locations
Changed rules to use dungeon_table
This commit is contained in:
aerinon
2021-08-26 15:25:29 -06:00
parent 5c835dc243
commit 4e8a8d2840
3 changed files with 13 additions and 11 deletions

View File

@@ -852,7 +852,7 @@ class CollectionState(object):
reduced = Counter() reduced = Counter()
for item, cnt in self.prog_items.items(): for item, cnt in self.prog_items.items():
item_name, item_player = item item_name, item_player = item
if item_player == player and self.check_if_progressive(item_name): if item_player == player and self.check_if_progressive(item_name, player):
if item_name.startswith('Bottle'): # I think magic requirements can require multiple bottles if item_name.startswith('Bottle'): # I think magic requirements can require multiple bottles
bottle_count += cnt bottle_count += cnt
elif item_name in ['Boss Heart Container', 'Sanctuary Heart Container', 'Piece of Heart']: elif item_name in ['Boss Heart Container', 'Sanctuary Heart Container', 'Piece of Heart']:
@@ -868,8 +868,7 @@ class CollectionState(object):
reduced[('Heart Container', player)] = 1 reduced[('Heart Container', player)] = 1
return frozenset(reduced.items()) return frozenset(reduced.items())
@staticmethod def check_if_progressive(self, item_name, player):
def check_if_progressive(item_name):
return (item_name in return (item_name in
['Bow', 'Progressive Bow', 'Progressive Bow (Alt)', 'Book of Mudora', 'Hammer', 'Hookshot', ['Bow', 'Progressive Bow', 'Progressive Bow (Alt)', 'Book of Mudora', 'Hammer', 'Hookshot',
'Magic Mirror', 'Ocarina', 'Pegasus Boots', 'Power Glove', 'Cape', 'Mushroom', 'Shovel', 'Magic Mirror', 'Ocarina', 'Pegasus Boots', 'Power Glove', 'Cape', 'Mushroom', 'Shovel',
@@ -881,7 +880,8 @@ class CollectionState(object):
'Mirror Shield', 'Progressive Shield', 'Bug Catching Net', 'Cane of Byrna', 'Mirror Shield', 'Progressive Shield', 'Bug Catching Net', 'Cane of Byrna',
'Boss Heart Container', 'Sanctuary Heart Container', 'Piece of Heart', 'Magic Upgrade (1/2)', 'Boss Heart Container', 'Sanctuary Heart Container', 'Piece of Heart', 'Magic Upgrade (1/2)',
'Magic Upgrade (1/4)'] 'Magic Upgrade (1/4)']
or item_name.startswith(('Bottle', 'Small Key', 'Big Key'))) or item_name.startswith(('Bottle', 'Small Key', 'Big Key'))
or (self.world.restrict_boss_items[player] != 'none' and item_name.startswith(('Map', 'Compass'))))
def can_reach(self, spot, resolution_hint=None, player=None): def can_reach(self, spot, resolution_hint=None, player=None):
try: try:

View File

@@ -679,7 +679,8 @@ def create_graph_piece_from_state(door, o_state, b_state, proposed_map, exceptio
def filter_for_potential_bk_locations(locations, world, player): def filter_for_potential_bk_locations(locations, world, player):
return count_locations_exclude_big_chest(locations, world, player) return [x for x in locations if '- Big Chest' not in x.name and not not reserved_location(x, world, player) and
not x.forced_item and not prize_or_event(x) and not blind_boss_unavail(x, locations, world, player)]
type_map = { type_map = {
@@ -1078,7 +1079,7 @@ def prize_or_event(loc):
def reserved_location(loc, world, player): def reserved_location(loc, world, player):
return loc.name in world.item_pool_config.reserved_locations[player] return hasattr(world, 'item_pool_config') and loc.name in world.item_pool_config.reserved_locations[player]
def blind_boss_unavail(loc, locations, world, player): def blind_boss_unavail(loc, locations, world, player):

View File

@@ -4,7 +4,7 @@ from collections import deque
import OverworldGlitchRules import OverworldGlitchRules
from BaseClasses import CollectionState, RegionType, DoorType, Entrance, CrystalBarrier, KeyRuleType from BaseClasses import CollectionState, RegionType, DoorType, Entrance, CrystalBarrier, KeyRuleType
from Dungeons import dungeon_regions, dungeon_prize from Dungeons import dungeon_table
from RoomData import DoorKind from RoomData import DoorKind
from OverworldGlitchRules import overworld_glitches_rules from OverworldGlitchRules import overworld_glitches_rules
@@ -562,10 +562,11 @@ def global_rules(world, player):
map_name = f'Map ({d_name})' map_name = f'Map ({d_name})'
add_rule(boss_location, lambda state: state.has(compass_name, player) and state.has(map_name, player)) add_rule(boss_location, lambda state: state.has(compass_name, player) and state.has(map_name, player))
for dungeon in dungeon_prize.keys(): for dungeon, info in dungeon_table.items():
d_name = "Thieves' Town" if dungeon.startswith('Thieves') else dungeon if info.prize:
for loc in [dungeon_prize[dungeon], f'{d_name} - Boss']: d_name = "Thieves' Town" if dungeon.startswith('Thieves') else dungeon
add_mc_rule(loc) for loc in [info.prize, f'{d_name} - Boss']:
add_mc_rule(loc)
if world.doorShuffle[player] == 'crossed': if world.doorShuffle[player] == 'crossed':
add_mc_rule('Agahnim 1') add_mc_rule('Agahnim 1')
add_mc_rule('Agahnim 2') add_mc_rule('Agahnim 2')