Merged in DR v0.4.0.12

This commit is contained in:
codemann8
2021-07-23 16:08:32 -05:00
21 changed files with 53 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
import logging import logging
import random import RaceRandom as random
from BaseClasses import Boss from BaseClasses import Boss
from Fill import FillError from Fill import FillError

View File

@@ -1,4 +1,4 @@
import random import RaceRandom as random
from collections import defaultdict, deque from collections import defaultdict, deque
import logging import logging
import operator as op import operator as op
@@ -1843,7 +1843,7 @@ def find_accessible_entrances(world, player, builder):
elif world.mode[player] != 'inverted': elif world.mode[player] != 'inverted':
start_regions = ['Links House', 'Sanctuary'] start_regions = ['Links House', 'Sanctuary']
else: else:
start_regions = ['Links House', 'Dark Sanctuary Hint'] start_regions = ['Links House', 'Dark Sanctuary Hint', 'Hyrule Castle Ledge']
regs = convert_regions(start_regions, world, player) regs = convert_regions(start_regions, world, player)
visited_regions = set() visited_regions = set()
visited_entrances = [] visited_entrances = []

View File

@@ -1,4 +1,4 @@
import random import RaceRandom as random
import collections import collections
import itertools import itertools
from collections import defaultdict, deque from collections import defaultdict, deque

View File

@@ -3,7 +3,7 @@ import argparse
import copy import copy
import os import os
import logging import logging
import random import RaceRandom as random
import textwrap import textwrap
import shlex import shlex
import sys import sys

View File

@@ -1,4 +1,4 @@
import random import RaceRandom as random
from BaseClasses import Dungeon from BaseClasses import Dungeon
from Bosses import BossFactory from Bosses import BossFactory

View File

@@ -1,4 +1,4 @@
import random import RaceRandom as random
# ToDo: With shuffle_ganon option, prevent gtower from linking to an exit only location through a 2 entrance cave. # ToDo: With shuffle_ganon option, prevent gtower from linking to an exit only location through a 2 entrance cave.
from collections import defaultdict from collections import defaultdict
@@ -493,7 +493,7 @@ def link_entrances(world, player):
if invFlag: if invFlag:
# shuffle aga door first. if it's on hc ledge, then one other hc ledge door has to be must_exit # shuffle aga door first. if it's on hc ledge, then one other hc ledge door has to be must_exit
all_entrances_aga = lw_entrances + dw_entrances all_entrances_aga = lw_entrances + dw_entrances
aga_doors = [i for i in all_entrances_aga] aga_doors = [i for i in all_entrances_aga if world.shufflelinks[player]]
random.shuffle(aga_doors) random.shuffle(aga_doors)
aga_door = aga_doors.pop() aga_door = aga_doors.pop()
@@ -687,7 +687,8 @@ def link_entrances(world, player):
if invFlag: if invFlag:
# shuffle aga door. if it's on hc ledge, then one other hc ledge door has to be must_exit # shuffle aga door. if it's on hc ledge, then one other hc ledge door has to be must_exit
aga_door = random.choice(entrances) aga_choices = [x for x in entrances if world.shufflelinks[player]]
aga_door = random.choice(aga_choices)
if aga_door in hc_ledge_entrances: if aga_door in hc_ledge_entrances:
hc_ledge_entrances.remove(aga_door) hc_ledge_entrances.remove(aga_door)

View File

@@ -1,4 +1,4 @@
import random import RaceRandom as random
import logging import logging
from BaseClasses import CollectionState from BaseClasses import CollectionState

View File

@@ -1,7 +1,7 @@
from collections import namedtuple from collections import namedtuple
import logging import logging
import math import math
import random import RaceRandom as random
from BaseClasses import Region, RegionType, Shop, ShopType, Location, CollectionState from BaseClasses import Region, RegionType, Shop, ShopType, Location, CollectionState
from Bosses import place_bosses from Bosses import place_bosses

13
Main.py
View File

@@ -4,7 +4,8 @@ from itertools import zip_longest
import json import json
import logging import logging
import os import os
import random import RaceRandom as random
import string
import time import time
import zlib import zlib
@@ -28,7 +29,7 @@ from Fill import sell_potions, sell_keys, balance_multiworld_progression, balanc
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops
from Utils import output_path, parse_player_names from Utils import output_path, parse_player_names
__version__ = '0.4.0.11u' __version__ = '0.4.0.12u'
class EnemizerError(RuntimeError): class EnemizerError(RuntimeError):
@@ -42,8 +43,8 @@ def main(args, seed=None, fish=None):
start = time.perf_counter() start = time.perf_counter()
# if args.securerandom: if args.securerandom:
# random.use_secure() random.use_secure()
# initialize the world # initialize the world
if args.code: if args.code:
@@ -62,7 +63,7 @@ def main(args, seed=None, fish=None):
random.seed(world.seed) random.seed(world.seed)
if args.securerandom: if args.securerandom:
world.seed = None world.seed = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(9))
world.remote_items = args.remote_items.copy() world.remote_items = args.remote_items.copy()
world.mapshuffle = args.mapshuffle.copy() world.mapshuffle = args.mapshuffle.copy()
@@ -341,7 +342,7 @@ def main(args, seed=None, fish=None):
logger.info(world.fish.translate("cli","cli","made.playthrough") % (YES if (args.calc_playthrough) else NO)) logger.info(world.fish.translate("cli","cli","made.playthrough") % (YES if (args.calc_playthrough) else NO))
logger.info(world.fish.translate("cli","cli","made.spoiler") % (YES if (not args.jsonout and args.create_spoiler) else NO)) logger.info(world.fish.translate("cli","cli","made.spoiler") % (YES if (not args.jsonout and args.create_spoiler) else NO))
logger.info(world.fish.translate("cli","cli","used.enemizer") % (YES if enemized else NO)) logger.info(world.fish.translate("cli","cli","used.enemizer") % (YES if enemized else NO))
logger.info(world.fish.translate("cli","cli","seed") + ": %d", world.seed) logger.info(world.fish.translate("cli","cli","seed") + ": %s", world.seed)
logger.info(world.fish.translate("cli","cli","total.time"), time.perf_counter() - start) logger.info(world.fish.translate("cli","cli","total.time"), time.perf_counter() - start)
# print_wiki_doors_by_room(dungeon_regions,world,1) # print_wiki_doors_by_room(dungeon_regions,world,1)

View File

@@ -1,6 +1,6 @@
import argparse import argparse
import logging import logging
import random import RaceRandom as random
import urllib.request import urllib.request
import urllib.parse import urllib.parse
import yaml import yaml

View File

@@ -3,7 +3,7 @@ import argparse
import hashlib import hashlib
import logging import logging
import os import os
import random import RaceRandom as random
import time import time
import sys import sys

View File

@@ -275,7 +275,7 @@ vanilla_pots = {
def shuffle_pots(world, player): def shuffle_pots(world, player):
import random import RaceRandom as random
new_pot_contents = {} new_pot_contents = {}

View File

@@ -22,6 +22,11 @@ For accessibility, you now get a C or P indicator to the left of the magic bar o
# Bug Fixes and Notes. # Bug Fixes and Notes.
* 0.4.0.12
* ER Inverted fix for HC Ledge, and Aga Tower choosing Links House incorrectly
* Credits again - hopefully for good
* Incorporated music fixes for now (may revisit later)
* Secure random re-incorporated
* 0.4.0.11 * 0.4.0.11
* Some minor base rom fixes * Some minor base rom fixes
* Improved distribution of bombable/dashable doors * Improved distribution of bombable/dashable doors

19
Rom.py
View File

@@ -5,7 +5,7 @@ import json
import hashlib import hashlib
import logging import logging
import os import os
import random import RaceRandom as random
import struct import struct
import sys import sys
import subprocess import subprocess
@@ -31,7 +31,7 @@ from OverworldShuffle import default_flute_connections, flute_data
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '487a04cf965bb89636f9b1621dd606d1' RANDOMIZERBASEHASH = 'abcc9ca7e5ec6eac56a70e8b248a5883'
class JsonRom(object): class JsonRom(object):
@@ -893,17 +893,17 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
write_int16(rom, 0x187010, credits_total) # dynamic credits write_int16(rom, 0x187010, credits_total) # dynamic credits
if credits_total != 216: if credits_total != 216:
# collection rate address: # collection rate address (hi):
cr_address = 0x2391C2 cr_address = 0x238057
cr_pc = cr_address - 0x120000 # convert to pc cr_pc = cr_address - 0x120000 # convert to pc
mid_top, mid_bot = credits_digit((credits_total // 10) % 10) mid_top, mid_bot = credits_digit((credits_total // 10) % 10)
last_top, last_bot = credits_digit(credits_total % 10) last_top, last_bot = credits_digit(credits_total % 10)
# top half # top half
rom.write_byte(cr_pc+0x1c, mid_top) rom.write_byte(cr_pc+0x1, mid_top)
rom.write_byte(cr_pc+0x1d, last_top) rom.write_byte(cr_pc+0x2, last_top)
# bottom half # bottom half
rom.write_byte(cr_pc+0x3a, mid_bot) rom.write_byte(cr_pc+0x1f, mid_bot)
rom.write_byte(cr_pc+0x3b, last_bot) rom.write_byte(cr_pc+0x20, last_bot)
# patch medallion requirements # patch medallion requirements
if world.required_medallions[player][0] == 'Bombos': if world.required_medallions[player][0] == 'Bombos':
@@ -1615,8 +1615,9 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
# set rom name # set rom name
# 21 bytes # 21 bytes
from Main import __version__ from Main import __version__
seedstring = f'{world.seed:09}' if isinstance(world.seed, int) else world.seed
# todo: change to DR when Enemizer is okay with DR # todo: change to DR when Enemizer is okay with DR
rom.name = bytearray(f'ER{__version__.split("-")[0].replace(".","")[0:3]}_{team+1}_{player}_{world.seed:09}\0', 'utf8')[:21] rom.name = bytearray(f'ER{__version__.split("-")[0].replace(".","")[0:3]}_{team+1}_{player}_{seedstring}\0', 'utf8')[:21]
rom.name.extend([0] * (21 - len(rom.name))) rom.name.extend([0] * (21 - len(rom.name)))
rom.write_bytes(0x7FC0, rom.name) rom.write_bytes(0x7FC0, rom.name)

View File

@@ -179,6 +179,17 @@ JSL BlindsAtticHint : NOP #2
org $1cfd69 org $1cfd69
Main_ShowTextMessage: Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $028ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$10
db $B0, $21 ; BCS $028B04
BRA + : NOP #6 : +
org $02C3F2 ; <- Bank02.asm:10521 Unused call
Underworld_DoorDown_Call:
org $02C3F3
dw $8AD9 ; address of Bank02.asm:2085
; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire ; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire
; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes ; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes
; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds ; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds

View File

@@ -398,7 +398,7 @@ StraightStairsTrapDoor:
.animateTraps .animateTraps
lda #$05 : sta $11 lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690 inc $0468 : stz $068e : stz $0690
++ rtl ++ JSL Underworld_DoorDown_Call : rtl
+ JML Dungeon_ApproachFixedColor ; what we wrote over + JML Dungeon_ApproachFixedColor ; what we wrote over
} }

View File

@@ -353,7 +353,7 @@ OWNewDestination:
; turn into bunny ; turn into bunny
lda $5d : cmp #$17 : beq .return lda $5d : cmp #$17 : beq .return
lda #$17 : sta $5d lda #$17 : sta $5d
lda #$01 : sta $02e0 lda #$01 : sta $2e0
bra .return bra .return
.nobunny .nobunny
lda $5d : cmp #$17 : bne .return lda $5d : cmp #$17 : bne .return

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{ {
"cli": { "cli": {
"app.title": "ALttP Tür Randomisier Version %s - Nummer: %d, Code: %s", "app.title": "ALttP Tür Randomisier Version %s - Nummer: %s, Code: %s",
"shuffling.world": "Welt wird durchmischt.", "shuffling.world": "Welt wird durchmischt.",
"generating.itempool": "Generier Gegenstandsbasis.", "generating.itempool": "Generier Gegenstandsbasis.",
"calc.access.rules": "Berechne Zugriffsregeln.", "calc.access.rules": "Berechne Zugriffsregeln.",

View File

@@ -2,7 +2,7 @@
"cli": { "cli": {
"yes": "Yes", "yes": "Yes",
"no": "No", "no": "No",
"app.title": "ALttP Door Randomizer Version %s - Seed: %d, Code: %s", "app.title": "ALttP Door Randomizer Version %s - Seed: %s, Code: %s",
"version": "Version", "version": "Version",
"seed": "Seed", "seed": "Seed",
"player": "Player", "player": "Player",

View File

@@ -1,6 +1,6 @@
{ {
"cli": { "cli": {
"app.title": "ALttP Puerta Aleatorizador Versión %s - Número: %d, Código: %s", "app.title": "ALttP Puerta Aleatorizador Versión %s - Número: %s, Código: %s",
"player": "Jugador", "player": "Jugador",
"shuffling.world": "Barajando el Mundo", "shuffling.world": "Barajando el Mundo",
"shuffling.dungeons": "Barajando Mazmorras", "shuffling.dungeons": "Barajando Mazmorras",