Use EasyModeEscape flag of upcoming Enemizer
This commit is contained in:
		
							parent
							
								
									fc76698997
								
							
						
					
					
						commit
						346a08c3dd
					
				
							
								
								
									
										2
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										2
									
								
								Main.py
								
								
								
								
							| 
						 | 
				
			
			@ -176,7 +176,7 @@ def main(args, seed=None):
 | 
			
		|||
        patch_rom(world, rom, player, team, 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)
 | 
			
		||||
 | 
			
		||||
        if args.race:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								Patch.py
								
								
								
								
							
							
						
						
									
										5
									
								
								Patch.py
								
								
								
								
							| 
						 | 
				
			
			@ -21,6 +21,7 @@ def get_base_rom_path(file_name: str = "") -> str:
 | 
			
		|||
        file_name = Utils.local_path(file_name)
 | 
			
		||||
    return file_name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_base_rom_bytes(file_name: str = "") -> bytes:
 | 
			
		||||
    base_rom_bytes = getattr(get_base_rom_bytes, "base_rom_bytes", None)
 | 
			
		||||
    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:
 | 
			
		||||
    patch = yaml.dump({"meta": metadata,
 | 
			
		||||
                       "patch": patch})
 | 
			
		||||
                       "patch": patch,
 | 
			
		||||
                       "game": "alttp",
 | 
			
		||||
                       "base_checksum": JAP10HASH})
 | 
			
		||||
    return patch.encode(encoding="utf-8-sig")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								Rom.py
								
								
								
								
							
							
						
						
									
										12
									
								
								Rom.py
								
								
								
								
							| 
						 | 
				
			
			@ -143,7 +143,7 @@ def read_rom(stream) -> bytearray:
 | 
			
		|||
        buffer = buffer[0x200:]
 | 
			
		||||
    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'))
 | 
			
		||||
    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'))
 | 
			
		||||
| 
						 | 
				
			
			@ -161,12 +161,14 @@ def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, r
 | 
			
		|||
        'AllowEnemyZeroDamage': True,
 | 
			
		||||
        'ShuffleEnemyDamageGroups': world.enemy_damage[player] != 'default',
 | 
			
		||||
        'EnemyDamageChaosMode': world.enemy_damage[player] == 'chaos',
 | 
			
		||||
        'EasyModeEscape': False,
 | 
			
		||||
        'EasyModeEscape': world.mode[player] == "standard",
 | 
			
		||||
        'EnemiesAbsorbable': False,
 | 
			
		||||
        'AbsorbableSpawnRate': 10,
 | 
			
		||||
        'AbsorbableTypes': {
 | 
			
		||||
            'FullMagic': True, 'SmallMagic': True, 'Bomb_1': True, 'BlueRupee': True, 'Heart': True, 'BigKey': True, 'Key': True,
 | 
			
		||||
            'Fairy': True, 'Arrow_10': True, 'Arrow_5': True, 'Bomb_8': True, 'Bomb_4': True, 'GreenRupee': True, 'RedRupee': True
 | 
			
		||||
            'FullMagic': True, 'SmallMagic': True, 'Bomb_1': True, 'BlueRupee': True, 'Heart': True, 'BigKey': True,
 | 
			
		||||
            'Key': True,
 | 
			
		||||
            'Fairy': True, 'Arrow_10': True, 'Arrow_5': True, 'Bomb_8': True, 'Bomb_4': True, 'GreenRupee': True,
 | 
			
		||||
            'RedRupee': True
 | 
			
		||||
        },
 | 
			
		||||
        'BossMadness': False,
 | 
			
		||||
        'RandomizeBosses': True,
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +190,7 @@ def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, r
 | 
			
		|||
        'GrayscaleMode': False,
 | 
			
		||||
        'GenerateSpoilers': False,
 | 
			
		||||
        'RandomizeLinkSpritePalette': False,
 | 
			
		||||
        'RandomizePots': shufflepots,
 | 
			
		||||
        'RandomizePots': world.shufflepots[player],
 | 
			
		||||
        'ShuffleMusic': False,
 | 
			
		||||
        'BootlegMagic': True,
 | 
			
		||||
        'CustomBosses': False,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								Utils.py
								
								
								
								
							
							
						
						
									
										9
									
								
								Utils.py
								
								
								
								
							| 
						 | 
				
			
			@ -15,7 +15,7 @@ import sys
 | 
			
		|||
 | 
			
		||||
import functools
 | 
			
		||||
 | 
			
		||||
from yaml import load, dump
 | 
			
		||||
from yaml import load, dump, safe_load
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    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)]
 | 
			
		||||
    for offset in reversed(list(out_data.keys())):
 | 
			
		||||
        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:
 | 
			
		||||
        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()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
parse_yaml = functools.partial(load, Loader=Loader)
 | 
			
		||||
parse_yaml = safe_load
 | 
			
		||||
unsafe_parse_yaml = functools.partial(load, Loader=Loader)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Hint(typing.NamedTuple):
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +252,7 @@ def persistent_load() -> typing.Dict[dict]:
 | 
			
		|||
    if os.path.exists(path):
 | 
			
		||||
        try:
 | 
			
		||||
            with open(path, "r") as f:
 | 
			
		||||
                storage = parse_yaml(f.read())
 | 
			
		||||
                storage = unsafe_parse_yaml(f.read())
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            import logging
 | 
			
		||||
            logging.debug(f"Could not read store: {e}")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue