Skip to content

Commit

Permalink
Merge pull request #435 from phst-randomizer/disable-asm-patch
Browse files Browse the repository at this point in the history
Disable broken ASM patch
  • Loading branch information
mike8699 committed Feb 18, 2024
2 parents ef7b47f + a57081e commit 9cc51b9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.2.0
hooks:
- id: black

Expand All @@ -46,15 +46,14 @@ repos:
- --remove-unused-variables

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-black
- flake8-bugbear
- flake8-isort
# TODO: re-enable when https://github.com/zheller/flake8-quotes/issues/117 is fixed
# - flake8-quotes
- flake8-quotes
args:
- --config
- .flake8
Expand All @@ -66,7 +65,7 @@ repos:

# Validate aux data against schema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
rev: 0.28.0
hooks:
- id: check-jsonschema
files: ^ph_rando/shuffler/logic/.*\.json$
Expand Down
9 changes: 5 additions & 4 deletions base/code/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@
; patch out check that ensures only keys (id 0x1) can be spawned this way
.endarea

.org 0x213a174
.area 0x4
bl spawn_custom_freestanding_item
.endarea
// TODO: this causes crashes sometimes. Disable for now.
// .org 0x213a174
// .area 0x4
// bl spawn_custom_freestanding_item
// .endarea

; There is essentially a giant `switch` statement in the game code that determines which item
; id's are "valid" and able to be spawned from a shovel dig spot. For "invalid" items like
Expand Down
4 changes: 2 additions & 2 deletions ph_rando/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
@runtime_checkable
class PatcherHook(Protocol):
def __call__(self, value: bool | str | set[str], patcher: Patcher) -> None:
...
pass


@runtime_checkable
class ShufflerHook(Protocol):
def __call__(self, value: bool | str | set[str], shuffler: Shuffler) -> None:
...
pass


class BaseSetting(BaseModel):
Expand Down
18 changes: 10 additions & 8 deletions ph_rando/shuffler/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,21 +524,23 @@ def annotate_logic(areas: list[Area], logic_directory: Path | None = None) -> No
Edge(
src=node1,
dest=node2,
requirements=parse_edge_requirement(edge.requirements)
if edge.requirements
else None,
requirements=(
parse_edge_requirement(edge.requirements)
if edge.requirements
else None
),
)
)
if edge.direction == '<->':
node2.edges.append(
Edge(
src=node2,
dest=node1,
requirements=parse_edge_requirement(
edge.requirements
)
if edge.requirements
else None,
requirements=(
parse_edge_requirement(edge.requirements)
if edge.requirements
else None
),
)
)
break
Expand Down
10 changes: 5 additions & 5 deletions tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def test_graph_connectedness() -> None:
shuffler = Shuffler(
seed='test',
settings={
setting.name: True
if setting.type == 'flag'
else setting.default
if setting.type == 'multiple_choice'
else setting.default
setting.name: (
True
if setting.type == 'flag'
else setting.default if setting.type == 'multiple_choice' else setting.default
)
for setting in RANDOMIZER_SETTINGS.values()
},
)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_shuffler.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ def test_assumed_search(
shuffler = Shuffler(
seed='test',
settings={
setting.name: True
if setting.type == 'flag'
else setting.default
if setting.type == 'multiple_choice'
else setting.default
setting.name: (
True
if setting.type == 'flag'
else setting.default if setting.type == 'multiple_choice' else setting.default
)
for setting in RANDOMIZER_SETTINGS.values()
},
starting_node_name=starting_node_name,
Expand Down

0 comments on commit 9cc51b9

Please sign in to comment.