Merge branch 'main' into Archipelago_Main

# Conflicts:
#	BaseClasses.py
#	LttPAdjuster.py
#	Main.py
#	Mystery.py
#	Utils.py
#	WebHostLib/generate.py
#	playerSettings.yaml
This commit is contained in:
Fabian Dill
2021-04-01 11:44:37 +02:00
20 changed files with 1979 additions and 1238 deletions

View File

@@ -228,10 +228,10 @@ def place_bosses(world, player: int):
level = loc[-1]
loc = " ".join(loc[:-1])
loc = loc.title().replace("Of", "of")
if can_place_boss(boss, loc, level) and [loc, level] in boss_locations:
if can_place_boss(boss, loc, level) and (loc, level) in boss_locations:
place_boss(world, player, boss, loc, level)
already_placed_bosses.append(boss)
boss_locations.remove([loc, level])
boss_locations.remove((loc, level))
else:
raise Exception(f"Cannot place {boss} at {format_boss_location(loc, level)} for player {player}.")
else:

View File

@@ -31,6 +31,7 @@ def parse_arguments(argv, no_defaults=False):
No Logic: Distribute items without regard for
item requirements.
''')
parser.add_argument('--glitch_triforce', help='Allow glitching to Triforce from Ganon\'s room', action='store_true')
parser.add_argument('--mode', default=defval('open'), const='open', nargs='?', choices=['standard', 'open', 'inverted'],
help='''\
Select game mode. (default: %(default)s)

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '4f63251fb1f769e1a6b017346b2e51dc'
RANDOMIZERBASEHASH = '13a75c5dd28055fbcf8f69bd8161871d'
import io
import json
@@ -226,6 +226,9 @@ def apply_random_sprite_on_event(rom: LocalRom, sprite, local_random, allow_rand
elif sprite == 'randomonnone':
# Allows for opting into random on events on race rom seeds, without actually enabling any of the events initially.
onevent = 0x0000
elif sprite == 'randomonrandom':
# Allows random to take the wheel on which events apply. (at least one event will be applied.)
onevent = local_random.randint(0x0001, 0x003F)
elif userandomsprites:
onevent = 0x01 if 'hit' in sprite else 0x00
onevent += 0x02 if 'enter' in sprite else 0x00
@@ -536,6 +539,8 @@ class Sprite(object):
self.valid = False
return
(sprite, palette, self.name, self.author_name) = result
if self.name == "":
self.name = os.path.split(filename)[1].split(".")[0]
if len(sprite) != 0x7000:
self.valid = False
return
@@ -1499,6 +1504,7 @@ def patch_rom(world, rom, player, team, enemized):
rom.write_byte(0xEFD95, digging_game_rng)
rom.write_byte(0x1800A3, 0x01) # enable correct world setting behaviour after agahnim kills
rom.write_byte(0x1800A4, 0x01 if world.logic[player] != 'nologic' else 0x00) # enable POD EG fix
rom.write_byte(0x186383, 0x01 if world.glitch_triforce or world.logic[player] == 'nologic' else 0x00) # disable glitching to Triforce from Ganons Room
rom.write_byte(0x180042, 0x01 if world.save_and_quit_from_boss else 0x00) # Allow Save and Quit after boss kill
# remove shield from uncle

View File

@@ -194,20 +194,21 @@ def ShopSlotFill(world):
del locations_per_sphere
total_spheres = len(candidates_per_sphere)
for i, current_shop_slots in enumerate(shops_per_sphere):
if current_shop_slots:
candidate_sphere_ids = list(range(i, total_spheres))
# getting all candidates and shuffling them feels cpu expensive, there may be a better method
candidates = [(location, i) for i, candidates in enumerate(candidates_per_sphere[i:], start=i)
for location in candidates]
world.random.shuffle(candidates)
for location in current_shop_slots:
shop: Shop = location.parent_region.shop
swapping_sphere_id = world.random.choices(candidate_sphere_ids,
cum_weights=cumu_weights[i:])[0]
swapping_sphere: list = candidates_per_sphere[swapping_sphere_id]
for c in swapping_sphere: # chosen item locations
for index, (c, swapping_sphere_id) in enumerate(candidates): # chosen item locations
if c.item_rule(location.item) and location.item_rule(c.item):
swap_location_item(c, location, check_locked=False)
logger.debug(f'Swapping {c} into {location}:: {location.item}')
# remove candidate
candidates_per_sphere[swapping_sphere_id].remove(c)
candidates.pop(index)
break
else:
@@ -216,10 +217,6 @@ def ShopSlotFill(world):
location.shop_slot_disabled = True
continue
# remove candidate
swapping_sphere.remove(c)
cumu_weights[swapping_sphere_id] -= 1
item_name = location.item.name
if any(x in item_name for x in ['Compass', 'Map', 'Single Bomb', 'Single Arrow', 'Piece of Heart']):
price = world.random.randrange(1, 7)