implement glitch_boots as a proper CLI option
This commit is contained in:
parent
30ae9487d4
commit
31d3b7ce84
|
@ -111,6 +111,7 @@ class World(object):
|
||||||
set_player_attr('treasure_hunt_count', 0)
|
set_player_attr('treasure_hunt_count', 0)
|
||||||
set_player_attr('clock_mode', False)
|
set_player_attr('clock_mode', False)
|
||||||
set_player_attr('can_take_damage', True)
|
set_player_attr('can_take_damage', True)
|
||||||
|
set_player_attr('glitch_boots', True)
|
||||||
|
|
||||||
def get_name_string_for_object(self, obj) -> str:
|
def get_name_string_for_object(self, obj) -> str:
|
||||||
return obj.name if self.players == 1 else f'{obj.name} ({self.get_player_names(obj.player)})'
|
return obj.name if self.players == 1 else f'{obj.name} ({self.get_player_names(obj.player)})'
|
||||||
|
|
|
@ -292,12 +292,15 @@ def parse_arguments(argv, no_defaults=False):
|
||||||
parser.add_argument('--create_diff', default=defval(False), action='store_true', help='''\
|
parser.add_argument('--create_diff', default=defval(False), action='store_true', help='''\
|
||||||
create a binary patch file from which the randomized rom can be recreated using MultiClient.
|
create a binary patch file from which the randomized rom can be recreated using MultiClient.
|
||||||
Does not work with jsonout.''')
|
Does not work with jsonout.''')
|
||||||
|
parser.add_argument('--disable_glitch_boots', default=defval(False), action='store_true', help='''\
|
||||||
|
turns off starting with Pegasus Boots in glitched modes.''')
|
||||||
|
|
||||||
if multiargs.multi:
|
if multiargs.multi:
|
||||||
for player in range(1, multiargs.multi + 1):
|
for player in range(1, multiargs.multi + 1):
|
||||||
parser.add_argument(f'--p{player}', default=defval(''), help=argparse.SUPPRESS)
|
parser.add_argument(f'--p{player}', default=defval(''), help=argparse.SUPPRESS)
|
||||||
|
|
||||||
ret = parser.parse_args(argv)
|
ret = parser.parse_args(argv)
|
||||||
|
ret.glitch_boots = not ret.disable_glitch_boots
|
||||||
if ret.timer == "none":
|
if ret.timer == "none":
|
||||||
ret.timer = False
|
ret.timer = False
|
||||||
if ret.dungeon_counters == 'on':
|
if ret.dungeon_counters == 'on':
|
||||||
|
@ -319,7 +322,7 @@ def parse_arguments(argv, no_defaults=False):
|
||||||
'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',
|
'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',
|
||||||
'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor',
|
'ow_palettes', 'uw_palettes', 'sprite', 'disablemusic', 'quickswap', 'fastmenu', 'heartcolor',
|
||||||
'heartbeep',
|
'heartbeep',
|
||||||
'remote_items', 'progressive', 'extendedmsu', 'dungeon_counters']:
|
'remote_items', 'progressive', 'extendedmsu', 'dungeon_counters', 'glitch_boots']:
|
||||||
value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name)
|
value = getattr(defaults, name) if getattr(playerargs, name) is None else getattr(playerargs, name)
|
||||||
if player == 1:
|
if player == 1:
|
||||||
setattr(ret, name, {1: value})
|
setattr(ret, name, {1: value})
|
||||||
|
|
44
ItemList.py
44
ItemList.py
|
@ -189,9 +189,7 @@ def generate_itempool(world, player):
|
||||||
world.rupoor_cost = min(world.customitemarray[69], 9999)
|
world.rupoor_cost = min(world.customitemarray[69], 9999)
|
||||||
else:
|
else:
|
||||||
(pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
|
(pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
|
||||||
lamps_needed_for_dark_rooms) = get_pool_core(world.progressive[player], world.shuffle[player],
|
lamps_needed_for_dark_rooms) = get_pool_core(world, player)
|
||||||
world.difficulty[player], world.timer[player], world.goal[player],
|
|
||||||
world.mode[player], world.swords[player], world.retro[player], world.logic[player])
|
|
||||||
|
|
||||||
for item in precollected_items:
|
for item in precollected_items:
|
||||||
world.push_precollected(ItemFactory(item, player))
|
world.push_precollected(ItemFactory(item, player))
|
||||||
|
@ -392,7 +390,17 @@ def set_up_shops(world, player):
|
||||||
rss.locked = True
|
rss.locked = True
|
||||||
|
|
||||||
|
|
||||||
def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, retro, logic):
|
def get_pool_core(world, player: int):
|
||||||
|
progressive = world.progressive[player]
|
||||||
|
shuffle = world.shuffle[player]
|
||||||
|
difficulty = world.difficulty[player]
|
||||||
|
timer = world.timer[player]
|
||||||
|
goal = world.goal[player]
|
||||||
|
mode = world.mode[player]
|
||||||
|
swords = world.swords[player]
|
||||||
|
retro = world.retro[player]
|
||||||
|
logic = world.logic[player]
|
||||||
|
|
||||||
pool = []
|
pool = []
|
||||||
placed_items = {}
|
placed_items = {}
|
||||||
precollected_items = []
|
precollected_items = []
|
||||||
|
@ -410,7 +418,7 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, r
|
||||||
return random.choice([True, False]) if progressive == 'random' else progressive == 'on'
|
return random.choice([True, False]) if progressive == 'random' else progressive == 'on'
|
||||||
|
|
||||||
# provide boots to major glitch dependent seeds
|
# provide boots to major glitch dependent seeds
|
||||||
if logic in ['owglitches', 'nologic']:
|
if logic in {'owglitches', 'nologic'} and world.glitch_boots[player]:
|
||||||
precollected_items.append('Pegasus Boots')
|
precollected_items.append('Pegasus Boots')
|
||||||
pool.remove('Pegasus Boots')
|
pool.remove('Pegasus Boots')
|
||||||
pool.extend(['Rupees (20)'])
|
pool.extend(['Rupees (20)'])
|
||||||
|
@ -674,31 +682,5 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s
|
||||||
|
|
||||||
return (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms)
|
return (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms)
|
||||||
|
|
||||||
# A quick test to ensure all combinations generate the correct amount of items.
|
|
||||||
def test():
|
|
||||||
for difficulty in ['normal', 'hard', 'expert']:
|
|
||||||
for goal in ['ganon', 'triforcehunt', 'pedestal']:
|
|
||||||
for timer in [False, 'display', 'timed', 'timed-ohko', 'ohko', 'timed-countdown']:
|
|
||||||
for mode in ['open', 'standard', 'inverted']:
|
|
||||||
for swords in ['random', 'assured', 'swordless', 'vanilla']:
|
|
||||||
for progressive in ['on', 'off']:
|
|
||||||
for shuffle in ['full', 'insanity_legacy']:
|
|
||||||
for retro in [True, False]:
|
|
||||||
for logic in ['noglitches', 'owglitches']:
|
|
||||||
out = get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords,
|
|
||||||
retro, logic)
|
|
||||||
count = len(out[0]) + len(out[1])
|
|
||||||
|
|
||||||
correct_count = total_items_to_place
|
|
||||||
if goal == 'pedestal' and swords != 'vanilla':
|
|
||||||
# pedestal goals generate one extra item
|
|
||||||
correct_count += 1
|
|
||||||
if retro:
|
|
||||||
correct_count += 28
|
|
||||||
try:
|
|
||||||
assert count == correct_count, "expected {0} items but found {1} items for {2}".format(correct_count, count, (progressive, shuffle, difficulty, timer, goal, mode, swords, retro))
|
|
||||||
except AssertionError as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test()
|
test()
|
||||||
|
|
1
Main.py
1
Main.py
|
@ -59,6 +59,7 @@ def main(args, seed=None):
|
||||||
world.progressive = args.progressive.copy()
|
world.progressive = args.progressive.copy()
|
||||||
world.dungeon_counters = args.dungeon_counters.copy()
|
world.dungeon_counters = args.dungeon_counters.copy()
|
||||||
world.extendedmsu = args.extendedmsu.copy()
|
world.extendedmsu = args.extendedmsu.copy()
|
||||||
|
world.glitch_boots = args.glitch_boots.copy()
|
||||||
|
|
||||||
world.rom_seeds = {player: random.randint(0, 999999999) for player in range(1, world.players + 1)}
|
world.rom_seeds = {player: random.randint(0, 999999999) for player in range(1, world.players + 1)}
|
||||||
|
|
||||||
|
|
|
@ -282,9 +282,7 @@ def roll_settings(weights):
|
||||||
startitems.append(item)
|
startitems.append(item)
|
||||||
elif itemvalue:
|
elif itemvalue:
|
||||||
startitems.append(item)
|
startitems.append(item)
|
||||||
glitch_boots = get_choice('glitch_boots', weights) if 'glitch_boots' in weights else True
|
ret.glitch_boots = get_choice('glitch_boots', weights) if 'glitch_boots' in weights else True
|
||||||
if ret.logic != 'noglitches' and 'Pegasus Boots' not in startitems and glitch_boots:
|
|
||||||
startitems.append('Pegasus Boots')
|
|
||||||
ret.startinventory = ','.join(startitems)
|
ret.startinventory = ','.join(startitems)
|
||||||
|
|
||||||
ret.remote_items = get_choice('remote_items', weights) if 'remote_items' in weights else False
|
ret.remote_items = get_choice('remote_items', weights) if 'remote_items' in weights else False
|
||||||
|
|
Loading…
Reference in New Issue