Skip to content

Commit

Permalink
Simplify small keys in logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mike8699 committed Dec 2, 2023
1 parent 81407a1 commit e8ea499
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 37 deletions.
1 change: 0 additions & 1 deletion ph_rando/patcher/_items.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ITEMS: dict[str, int] = {
'SmallKey': 0x1,
'SmallKey_MercayGrotto': 0x1,
'SmallKey_FireTemple': 0x1,
'SmallKey_WindTemple': 0x1,
Expand Down
9 changes: 0 additions & 9 deletions ph_rando/shuffler/_shuffler.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ def generate(self: Self) -> ShufflerAuxData:
for room in area.rooms:
for check in room.chests:
item = check.contents
# print(check)
# Append area name for keys, so that we know where we can place
# it later on.
if item.name == 'SmallKey':
item.name += f'_{area.name}'

if check not in self._checks_to_exclude:
item_pool.append(item)
Expand Down Expand Up @@ -467,10 +462,6 @@ def assumed_search(self: Self, items: list[Item], area: str | None = None) -> Or
for check in node.checks:
if check.contents and check not in completed_checks:
item = check.contents
# If this is a small key, append the area name to it
# so that we can tell what dungeon it goes to.
if item.name == 'SmallKey':
item.name += f'_{node.area.name}'
items.append(item)
states.update(item.states)
found_new_items = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "AfterSpikeTraps",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_CourageTemple"
},
"zmb_file_path": "Map/dngn_pluck/map00.bin/zmb/dngn_pluck_00.zmb",
"zmb_mapobject_index": 105,
Expand Down Expand Up @@ -49,15 +49,15 @@
"name": "PolsKey",
"type": "on_enemy",
"contents": {
"name": "SmallKey"
"name": "SmallKey_CourageTemple"
},
"display_name": "Defeat the Pols Voice (left)"
},
{
"name": "PolsKeyTopRight",
"type": "on_enemy",
"contents": {
"name": "SmallKey"
"name": "SmallKey_CourageTemple"
},
"display_name": "Defeat the Pols Voice (top right)"
}
Expand Down
6 changes: 3 additions & 3 deletions ph_rando/shuffler/logic/Dungeons/Fire Temple/FireTemple.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "KeesesSmallKey",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_FireTemple"
},
"zmb_file_path": "Map/dngn_flame/map00.bin/zmb/dngn_flame_00.zmb",
"zmb_mapobject_index": 26,
Expand Down Expand Up @@ -98,7 +98,7 @@
"name": "RatKey",
"type": "on_enemy",
"contents": {
"name": "SmallKey"
"name": "SmallKey_FireTemple"
},
"display_name": "Catch the Rat"
}
Expand Down Expand Up @@ -179,7 +179,7 @@
"name": "SwitchesSmallKey",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_FireTemple"
},
"display_name": "Hit the switches in the right order"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": "PullRedLever",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_IceTemple"
},
"zmb_file_path": "Map/dngn_water/map02.bin/zmb/dngn_water_02.zmb",
"zmb_mapobject_index": 23,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"name": "Bounce",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_IceTemple"
},
"zmb_file_path": "Map/dngn_water/map05.bin/zmb/dngn_water_05.zmb",
"zmb_mapobject_index": 26,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "FreestandingKey",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_IceTemple"
},
"display_name": "Hit the switches"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"name": "MiddleHammer",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_MutohTemple"
},
"zmb_file_path": "Map/dngn_wisdom/map03.bin/zmb/dngn_wisdom_03.zmb",
"zmb_mapobject_index": 262,
Expand Down Expand Up @@ -262,7 +262,7 @@
"name": "Middle",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_MutohTemple"
},
"zmb_file_path": "Map/dngn_wisdom/map04.bin/zmb/dngn_wisdom_04.zmb",
"zmb_mapobject_index": 34,
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/B1/B1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Key",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"display_name": "Freestanding key after door"
},
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/B10/B10.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "PhantomKey",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"type": "on_enemy",
"display_name": "Stun the Phantom"
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/B2/B2.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "Key",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"display_name": "Freestanding key after plate"
},
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/B3/B3.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"name": "PhantomKey",
"type": "on_enemy",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"display_name": "Hit the lower Phantom"
},
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/B4/B4.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "FreestandingKey",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"display_name": "Freestanding Key"
},
Expand Down
2 changes: 1 addition & 1 deletion ph_rando/shuffler/logic/Dungeons/ToTOK/F1/F1.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "EmptyChest",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_TempleOfTheOceanKing"
},
"zmb_file_path": "Map/dngn_main/map00.bin/zmb/dngn_main_00.zmb",
"zmb_mapobject_index": 34,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"name": "DroppedKey",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_WindTemple"
},
"display_name": "Activate the windmill"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "KeyChest",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_MercayGrotto"
},
"zmb_file_path": "Map/dngn_first/map00.bin/zmb/dngn_first_00.zmb",
"zmb_mapobject_index": 21,
Expand All @@ -29,7 +29,7 @@
"name": "KeyAfter2143",
"type": "freestanding",
"contents": {
"name": "SmallKey"
"name": "SmallKey_MercayGrotto"
},
"display_name": "Key after levers 2143"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "SmallKey",
"type": "on_enemy",
"contents": {
"name": "SmallKey"
"name": "SmallKey_MercayGrotto"
},
"display_name": "Catch the Rat"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_data/key_test/test.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Test",
"name": "FireTemple",
"rooms": [
{
"name": "Test",
Expand All @@ -8,7 +8,7 @@
"name": "KeyChest",
"type": "chest",
"contents": {
"name": "SmallKey"
"name": "SmallKey_FireTemple"
},
"zmb_file_path": "test",
"zmb_mapobject_index": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/key_test/test.logic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
area Test:
area FireTemple:
room Test:
node Start:
chest KeyChest
Expand Down
6 changes: 3 additions & 3 deletions tests/test_shuffler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def test_edge_parser(
),
(
'key_test',
'Test.Test.Start',
['Test.Test.Start', 'Test.Test.LockedDoor1', 'Test.Test.LockedDoor2'],
['Test.Test.End'],
'FireTemple.Test.Start',
['FireTemple.Test.Start', 'FireTemple.Test.LockedDoor1', 'FireTemple.Test.LockedDoor2'],
['FireTemple.Test.End'],
),
(
'edge_directions_test',
Expand Down

0 comments on commit e8ea499

Please sign in to comment.