Clean up get_choice(x,weights) if x in weights else y code.
This commit is contained in:
parent
f8ad83c86d
commit
d7d7f32d0c
30
Mystery.py
30
Mystery.py
|
@ -259,8 +259,7 @@ def roll_settings(weights):
|
||||||
ret.logic = {None: 'noglitches', 'none': 'noglitches', 'no_logic': 'nologic', 'overworld_glitches': 'owglitches',
|
ret.logic = {None: 'noglitches', 'none': 'noglitches', 'no_logic': 'nologic', 'overworld_glitches': 'owglitches',
|
||||||
'minor_glitches' : 'minorglitches'}[
|
'minor_glitches' : 'minorglitches'}[
|
||||||
glitches_required]
|
glitches_required]
|
||||||
ret.progression_balancing = get_choice('progression_balancing',
|
ret.progression_balancing = get_choice('progression_balancing', weights, True)
|
||||||
weights) if 'progression_balancing' in weights else True
|
|
||||||
# item_placement = get_choice('item_placement')
|
# item_placement = get_choice('item_placement')
|
||||||
# not supported in ER
|
# not supported in ER
|
||||||
|
|
||||||
|
@ -272,10 +271,10 @@ def roll_settings(weights):
|
||||||
elif not dungeon_items:
|
elif not dungeon_items:
|
||||||
dungeon_items = ""
|
dungeon_items = ""
|
||||||
|
|
||||||
ret.mapshuffle = get_choice('map_shuffle', weights) if 'map_shuffle' in weights else 'm' in dungeon_items
|
ret.mapshuffle = get_choice('map_shuffle', weights, 'm' in dungeon_items)
|
||||||
ret.compassshuffle = get_choice('compass_shuffle', weights) if 'compass_shuffle' in weights else 'c' in dungeon_items
|
ret.compassshuffle = get_choice('compass_shuffle', weights, 'c' in dungeon_items)
|
||||||
ret.keyshuffle = get_choice('smallkey_shuffle', weights) if 'smallkey_shuffle' in weights else 's' in dungeon_items
|
ret.keyshuffle = get_choice('smallkey_shuffle', weights, 's' in dungeon_items)
|
||||||
ret.bigkeyshuffle = get_choice('bigkey_shuffle', weights) if 'bigkey_shuffle' in weights else 'b' in dungeon_items
|
ret.bigkeyshuffle = get_choice('bigkey_shuffle', weights, 'b' in dungeon_items)
|
||||||
|
|
||||||
ret.accessibility = get_choice('accessibility', weights)
|
ret.accessibility = get_choice('accessibility', weights)
|
||||||
|
|
||||||
|
@ -297,13 +296,10 @@ def roll_settings(weights):
|
||||||
|
|
||||||
ret.crystals_ganon = get_choice('ganon_open', weights)
|
ret.crystals_ganon = get_choice('ganon_open', weights)
|
||||||
|
|
||||||
ret.triforce_pieces_available = get_choice('triforce_pieces_available',
|
ret.triforce_pieces_available = get_choice('triforce_pieces_available', weights, 30)
|
||||||
weights) if "triforce_pieces_available" in weights else 30
|
|
||||||
|
|
||||||
ret.triforce_pieces_available = min(max(1, int(ret.triforce_pieces_available)), 90)
|
ret.triforce_pieces_available = min(max(1, int(ret.triforce_pieces_available)), 90)
|
||||||
|
|
||||||
ret.triforce_pieces_required = get_choice('triforce_pieces_required',
|
ret.triforce_pieces_required = get_choice('triforce_pieces_required', weights, 20)
|
||||||
weights) if "triforce_pieces_required" in weights else 20
|
|
||||||
ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 90)
|
ret.triforce_pieces_required = min(max(1, int(ret.triforce_pieces_required)), 90)
|
||||||
|
|
||||||
ret.mode = get_choice('world_state', weights)
|
ret.mode = get_choice('world_state', weights)
|
||||||
|
@ -343,7 +339,7 @@ def roll_settings(weights):
|
||||||
|
|
||||||
ret.shufflepots = get_choice('pot_shuffle', weights)
|
ret.shufflepots = get_choice('pot_shuffle', weights)
|
||||||
|
|
||||||
ret.beemizer = int(get_choice('beemizer', weights)) if 'beemizer' in weights else 0
|
ret.beemizer = int(get_choice('beemizer', weights, 0))
|
||||||
|
|
||||||
ret.timer = {'none': False,
|
ret.timer = {'none': False,
|
||||||
None: False,
|
None: False,
|
||||||
|
@ -352,11 +348,11 @@ def roll_settings(weights):
|
||||||
'timed_ohko': 'timed-ohko',
|
'timed_ohko': 'timed-ohko',
|
||||||
'ohko': 'ohko',
|
'ohko': 'ohko',
|
||||||
'timed_countdown': 'timed-countdown',
|
'timed_countdown': 'timed-countdown',
|
||||||
'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else False
|
'display': 'display'}[get_choice('timer', weights, False)]
|
||||||
|
|
||||||
ret.dungeon_counters = get_choice('dungeon_counters', weights) if 'dungeon_counters' in weights else 'default'
|
ret.dungeon_counters = get_choice('dungeon_counters', weights, 'default')
|
||||||
|
|
||||||
ret.progressive = convert_to_on_off(get_choice('progressive', weights)) if "progressive" in weights else 'on'
|
ret.progressive = convert_to_on_off(get_choice('progressive', weights, 'on'))
|
||||||
inventoryweights = weights.get('startinventory', {})
|
inventoryweights = weights.get('startinventory', {})
|
||||||
startitems = []
|
startitems = []
|
||||||
for item in inventoryweights.keys():
|
for item in inventoryweights.keys():
|
||||||
|
@ -370,9 +366,9 @@ def roll_settings(weights):
|
||||||
startitems.append(item)
|
startitems.append(item)
|
||||||
ret.startinventory = ','.join(startitems)
|
ret.startinventory = ','.join(startitems)
|
||||||
|
|
||||||
ret.glitch_boots = get_choice('glitch_boots', weights) if 'glitch_boots' in weights else True
|
ret.glitch_boots = get_choice('glitch_boots', weights, True)
|
||||||
|
|
||||||
ret.remote_items = get_choice('remote_items', weights) if 'remote_items' in weights else False
|
ret.remote_items = get_choice('remote_items', weights, False)
|
||||||
|
|
||||||
ret.local_items = set()
|
ret.local_items = set()
|
||||||
for item_name in weights.get('local_items', []):
|
for item_name in weights.get('local_items', []):
|
||||||
|
|
Loading…
Reference in New Issue