Add "timer" as individual setting (#23)

This commit is contained in:
cassidy 2020-02-02 20:10:56 -05:00 committed by GitHub
parent 8ea3f34898
commit 21b8c73179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 17 deletions

View File

@ -18,7 +18,7 @@ class World(object):
self.swords = swords.copy()
self.difficulty = difficulty.copy()
self.difficulty_adjustments = difficulty_adjustments.copy()
self.timer = timer
self.timer = timer.copy()
self.progressive = progressive
self.goal = goal.copy()
self.algorithm = algorithm
@ -37,7 +37,6 @@ class World(object):
self.shuffle_bonk_prizes = False
self.light_world_light_cone = False
self.dark_world_light_cone = False
self.clock_mode = 'off'
self.rupoor_cost = 10
self.aga_randomness = True
self.lock_aga_door_in_escape = False
@ -48,7 +47,6 @@ class World(object):
self.retro = retro.copy()
self.custom = custom
self.customitemarray = customitemarray
self.can_take_damage = True
self.hints = hints.copy()
self.dynamic_regions = []
self.dynamic_locations = []
@ -93,6 +91,8 @@ class World(object):
set_player_attr('open_pyramid', False)
set_player_attr('treasure_hunt_icon', 'Triforce Piece')
set_player_attr('treasure_hunt_count', 0)
set_player_attr('clock_mode', 'off')
set_player_attr('can_take_damage', False)
def get_name_string_for_object(self, obj):
return obj.name if self.players == 1 else f'{obj.name} ({self.get_player_names(obj.player)})'

View File

@ -289,7 +289,7 @@ def parse_arguments(argv, no_defaults=False):
playerargs = parse_arguments(shlex.split(getattr(ret,f"p{player}")), True)
for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality',
'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid',
'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'timer',
'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory',
'retro', 'accessibility', 'hints', 'beemizer',
'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',

View File

@ -129,12 +129,12 @@ def generate_itempool(world, player):
'dungeons',
'triforcehunt',
'crystals']
or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer not in ['none', 'display',
or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in ['none', 'display',
'timed', 'timed-ohko',
'ohko',
'timed-countdown']):
raise NotImplementedError('Not supported yet')
if world.timer in ['ohko', 'timed-ohko']:
if world.timer[player] in ['ohko', 'timed-ohko']:
world.can_take_damage = False
if world.goal[player] in ['pedestal', 'triforcehunt']:
@ -181,14 +181,14 @@ def generate_itempool(world, player):
if world.custom:
(pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive[player], world.shuffle[player],
world.difficulty[player], world.timer, world.goal[player],
world.difficulty[player], world.timer[player], world.goal[player],
world.mode[player], world.swords[player],
world.retro[player], world.customitemarray)
world.rupoor_cost = min(world.customitemarray[69], 9999)
else:
(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],
world.difficulty[player], world.timer, world.goal[player],
world.difficulty[player], world.timer[player], world.goal[player],
world.mode[player], world.swords[player], world.retro[player])
for item in precollected_items:
@ -226,7 +226,7 @@ def generate_itempool(world, player):
world.lamps_needed_for_dark_rooms = lamps_needed_for_dark_rooms
if clock_mode is not None:
world.clock_mode = clock_mode
world.clock_mode[player] = clock_mode
if treasure_hunt_count is not None:
world.treasure_hunt_count[player] = treasure_hunt_count

View File

@ -54,6 +54,7 @@ def main(args, seed=None):
world.enemy_health = args.enemy_health.copy()
world.enemy_damage = args.enemy_damage.copy()
world.beemizer = args.beemizer.copy()
world.timer = args.timer.copy()
world.shufflepots = args.shufflepots.copy()
world.progressive = args.progressive.copy()
world.extendedmsu = args.extendedmsu.copy()
@ -273,6 +274,7 @@ def copy_world(world):
ret.enemy_health = world.enemy_health.copy()
ret.enemy_damage = world.enemy_damage.copy()
ret.beemizer = world.beemizer.copy()
ret.timer = world.timer.copy()
ret.shufflepots = world.shufflepots.copy()
ret.extendedmsu = world.extendedmsu.copy()

View File

@ -217,6 +217,13 @@ def roll_settings(weights):
ret.beemizer = int(get_choice('beemizer')) if 'beemizer' in weights else 0
ret.timer = {'none': 'none',
'timed': 'timed',
'timed_ohko': 'timed-ohko',
'ohko': 'ohko',
'timed_countdown': 'timed-countdown',
'display': 'display'}[get_choice('timer')] if 'timer' in weights.keys() else 'none'
ret.progressive = convert_to_on_off(get_choice('progressive')) if "progressive" in weights else 'on'
inventoryweights = weights.get('startinventory', {})
startitems = []

14
Rom.py
View File

@ -707,7 +707,7 @@ def patch_rom(world, rom, player, team, enemized):
# Set stun items
rom.write_byte(0x180180, 0x03) # All standard items
#Set overflow items for progressive equipment
if world.timer in ['timed', 'timed-countdown', 'timed-ohko']:
if world.timer[player] in ['timed', 'timed-countdown', 'timed-ohko']:
overflow_replacement = GREEN_CLOCK
else:
overflow_replacement = GREEN_TWENTY_RUPEES
@ -861,19 +861,19 @@ def patch_rom(world, rom, player, team, enemized):
ERtimeincrease = 20
if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]:
ERtimeincrease = ERtimeincrease + 15
if world.clock_mode == 'off':
if world.clock_mode[player] == 'off':
rom.write_bytes(0x180190, [0x00, 0x00, 0x00]) # turn off clock mode
write_int32(rom, 0x180200, 0) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 0) # blue clock adjustment time (in frames, sint32)
write_int32(rom, 0x180208, 0) # green clock adjustment time (in frames, sint32)
write_int32(rom, 0x18020C, 0) # starting time (in frames, sint32)
elif world.clock_mode == 'ohko':
elif world.clock_mode[player] == 'ohko':
rom.write_bytes(0x180190, [0x01, 0x02, 0x01]) # ohko timer with resetable timer functionality
write_int32(rom, 0x180200, 0) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 0) # blue clock adjustment time (in frames, sint32)
write_int32(rom, 0x180208, 0) # green clock adjustment time (in frames, sint32)
write_int32(rom, 0x18020C, 0) # starting time (in frames, sint32)
elif world.clock_mode == 'countdown-ohko':
elif world.clock_mode[player] == 'countdown-ohko':
rom.write_bytes(0x180190, [0x01, 0x02, 0x01]) # ohko timer with resetable timer functionality
write_int32(rom, 0x180200, -100 * 60 * 60 * 60) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 2 * 60 * 60) # blue clock adjustment time (in frames, sint32)
@ -882,13 +882,13 @@ def patch_rom(world, rom, player, team, enemized):
write_int32(rom, 0x18020C, (10 + ERtimeincrease) * 60 * 60) # starting time (in frames, sint32)
else:
write_int32(rom, 0x18020C, int((5 + ERtimeincrease / 2) * 60 * 60)) # starting time (in frames, sint32)
if world.clock_mode == 'stopwatch':
if world.clock_mode[player] == 'stopwatch':
rom.write_bytes(0x180190, [0x02, 0x01, 0x00]) # set stopwatch mode
write_int32(rom, 0x180200, -2 * 60 * 60) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 2 * 60 * 60) # blue clock adjustment time (in frames, sint32)
write_int32(rom, 0x180208, 4 * 60 * 60) # green clock adjustment time (in frames, sint32)
write_int32(rom, 0x18020C, 0) # starting time (in frames, sint32)
if world.clock_mode == 'countdown':
if world.clock_mode[player] == 'countdown':
rom.write_bytes(0x180190, [0x01, 0x01, 0x00]) # set countdown, with no reset available
write_int32(rom, 0x180200, -2 * 60 * 60) # red clock adjustment time (in frames, sint32)
write_int32(rom, 0x180204, 2 * 60 * 60) # blue clock adjustment time (in frames, sint32)
@ -1119,7 +1119,7 @@ def patch_rom(world, rom, player, team, enemized):
rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld
# compasses showing dungeon count
if world.clock_mode != 'off':
if world.clock_mode[player] != 'off':
rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location
elif world.compassshuffle[player]:
rom.write_byte(0x18003C, 0x01) # show on pickup

View File

@ -105,6 +105,13 @@ beemizer:
2: 0
3: 0
4: 0
timer:
none: 1
timed: 0
timed_ohko: 0
ohko: 0
timed_countdown: 0
display: 0
rom:
sprite:
random: 1
@ -141,4 +148,4 @@ rom:
uw_palettes:
default: 1
random: 1
blackout: 0
blackout: 0