Use EasyModeEscape flag of upcoming Enemizer

This commit is contained in:
Fabian Dill 2020-07-05 02:06:00 +02:00
parent fc76698997
commit 346a08c3dd
4 changed files with 17 additions and 11 deletions

View File

@ -176,7 +176,7 @@ def main(args, seed=None):
patch_rom(world, rom, player, team, use_enemizer) patch_rom(world, rom, player, team, use_enemizer)
if use_enemizer: if use_enemizer:
patch_enemizer(world, player, rom, args.rom, args.enemizercli, args.shufflepots[player], patch_enemizer(world, player, rom, args.enemizercli,
sprite_random_on_hit) sprite_random_on_hit)
if args.race: if args.race:

View File

@ -21,6 +21,7 @@ def get_base_rom_path(file_name: str = "") -> str:
file_name = Utils.local_path(file_name) file_name = Utils.local_path(file_name)
return file_name return file_name
def get_base_rom_bytes(file_name: str = "") -> bytes: def get_base_rom_bytes(file_name: str = "") -> bytes:
base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None) base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None)
if not base_rom_bytes: if not base_rom_bytes:
@ -38,7 +39,9 @@ def get_base_rom_bytes(file_name: str = "") -> bytes:
def generate_yaml(patch: bytes, metadata: Optional[dict] = None) -> bytes: def generate_yaml(patch: bytes, metadata: Optional[dict] = None) -> bytes:
patch = yaml.dump({"meta": metadata, patch = yaml.dump({"meta": metadata,
"patch": patch}) "patch": patch,
"game": "alttp",
"base_checksum": JAP10HASH})
return patch.encode(encoding="utf-8-sig") return patch.encode(encoding="utf-8-sig")

12
Rom.py
View File

@ -143,7 +143,7 @@ def read_rom(stream) -> bytearray:
buffer = buffer[0x200:] buffer = buffer[0x200:]
return buffer return buffer
def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, random_sprite_on_hit): def patch_enemizer(world, player: int, rom: LocalRom, enemizercli, random_sprite_on_hit):
randopatch_path = os.path.abspath(output_path(f'enemizer_randopatch_{player}.sfc')) randopatch_path = os.path.abspath(output_path(f'enemizer_randopatch_{player}.sfc'))
options_path = os.path.abspath(output_path(f'enemizer_options_{player}.json')) options_path = os.path.abspath(output_path(f'enemizer_options_{player}.json'))
enemizer_output_path = os.path.abspath(output_path(f'enemizer_output_{player}.sfc')) enemizer_output_path = os.path.abspath(output_path(f'enemizer_output_{player}.sfc'))
@ -161,12 +161,14 @@ def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, r
'AllowEnemyZeroDamage': True, 'AllowEnemyZeroDamage': True,
'ShuffleEnemyDamageGroups': world.enemy_damage[player] != 'default', 'ShuffleEnemyDamageGroups': world.enemy_damage[player] != 'default',
'EnemyDamageChaosMode': world.enemy_damage[player] == 'chaos', 'EnemyDamageChaosMode': world.enemy_damage[player] == 'chaos',
'EasyModeEscape': False, 'EasyModeEscape': world.mode[player] == "standard",
'EnemiesAbsorbable': False, 'EnemiesAbsorbable': False,
'AbsorbableSpawnRate': 10, 'AbsorbableSpawnRate': 10,
'AbsorbableTypes': { 'AbsorbableTypes': {
'FullMagic': True, 'SmallMagic': True, 'Bomb_1': True, 'BlueRupee': True, 'Heart': True, 'BigKey': True, 'Key': True, 'FullMagic': True, 'SmallMagic': True, 'Bomb_1': True, 'BlueRupee': True, 'Heart': True, 'BigKey': True,
'Fairy': True, 'Arrow_10': True, 'Arrow_5': True, 'Bomb_8': True, 'Bomb_4': True, 'GreenRupee': True, 'RedRupee': True 'Key': True,
'Fairy': True, 'Arrow_10': True, 'Arrow_5': True, 'Bomb_8': True, 'Bomb_4': True, 'GreenRupee': True,
'RedRupee': True
}, },
'BossMadness': False, 'BossMadness': False,
'RandomizeBosses': True, 'RandomizeBosses': True,
@ -188,7 +190,7 @@ def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, r
'GrayscaleMode': False, 'GrayscaleMode': False,
'GenerateSpoilers': False, 'GenerateSpoilers': False,
'RandomizeLinkSpritePalette': False, 'RandomizeLinkSpritePalette': False,
'RandomizePots': shufflepots, 'RandomizePots': world.shufflepots[player],
'ShuffleMusic': False, 'ShuffleMusic': False,
'BootlegMagic': True, 'BootlegMagic': True,
'CustomBosses': False, 'CustomBosses': False,

View File

@ -15,7 +15,7 @@ import sys
import functools import functools
from yaml import load, dump from yaml import load, dump, safe_load
try: try:
from yaml import CLoader as Loader from yaml import CLoader as Loader
@ -147,7 +147,7 @@ def make_new_base2current(old_rom='Zelda no Densetsu - Kamigami no Triforce (Jap
out_data[idx] = [int(new)] out_data[idx] = [int(new)]
for offset in reversed(list(out_data.keys())): for offset in reversed(list(out_data.keys())):
if offset - 1 in out_data: if offset - 1 in out_data:
out_data[offset-1].extend(out_data.pop(offset)) out_data[offset - 1].extend(out_data.pop(offset))
with open('data/base2current.json', 'wt') as outfile: with open('data/base2current.json', 'wt') as outfile:
json.dump([{key: value} for key, value in out_data.items()], outfile, separators=(",", ":")) json.dump([{key: value} for key, value in out_data.items()], outfile, separators=(",", ":"))
@ -156,7 +156,8 @@ def make_new_base2current(old_rom='Zelda no Densetsu - Kamigami no Triforce (Jap
return "New Rom Hash: " + basemd5.hexdigest() return "New Rom Hash: " + basemd5.hexdigest()
parse_yaml = functools.partial(load, Loader=Loader) parse_yaml = safe_load
unsafe_parse_yaml = functools.partial(load, Loader=Loader)
class Hint(typing.NamedTuple): class Hint(typing.NamedTuple):
@ -251,7 +252,7 @@ def persistent_load() -> typing.Dict[dict]:
if os.path.exists(path): if os.path.exists(path):
try: try:
with open(path, "r") as f: with open(path, "r") as f:
storage = parse_yaml(f.read()) storage = unsafe_parse_yaml(f.read())
except Exception as e: except Exception as e:
import logging import logging
logging.debug(f"Could not read store: {e}") logging.debug(f"Could not read store: {e}")