Skip to content

Commit 1b72771

Browse files
committed
mapping fill results to spoiler
1 parent 733df73 commit 1b72771

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

worlds/dk64/Logic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def UpdateFromArchipelagoItems(self, collectionState: CollectionState):
374374
self.Update(ownedItems)
375375

376376
# We update CBs after updating items because we need to know if we have each Kong
377+
colored_banana_counts = [[0] * 5 for _ in range(9)]
377378
for item_name in cbArchItems:
378379
# CBs are carefully named in the following format:
379380
# index 0: "Collectible CBs" - needed to identify this as a collectible item
@@ -387,7 +388,8 @@ def UpdateFromArchipelagoItems(self, collectionState: CollectionState):
387388
continue
388389
level = Levels[item_data[2]]
389390
quantity = int(item_data[3])
390-
self.ColoredBananas[level][kong] += quantity
391+
colored_banana_counts[level][kong] += quantity
392+
self.ColoredBananas = colored_banana_counts
391393

392394
def Update(self, ownedItems):
393395
"""Update logic variables based on owned items."""

worlds/dk64/Regions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from worlds.dk64.DK64R.randomizer.Enums.Levels import Levels
1111
from worlds.dk64.DK64R.randomizer.Enums.Locations import Locations
1212
from worlds.dk64.DK64R.randomizer.Enums.Regions import Regions
13-
from worlds.dk64.DK64R.randomizer.Enums.Settings import HelmSetting, FungiTimeSetting
13+
from worlds.dk64.DK64R.randomizer.Enums.Settings import HelmSetting, FungiTimeSetting, FasterChecksSelected
1414
from worlds.dk64.DK64R.randomizer.Enums.Types import Types
1515
from worlds.dk64.DK64R.randomizer.Lists import Location as DK64RLocation, Item as DK64RItem
1616
from worlds.dk64.DK64R.randomizer.LogicClasses import Collectible, Event, LocationLogic, TransitionFront, Region as DK64Region
@@ -130,6 +130,12 @@ def create_region(multiworld: MultiWorld, player: int, region_name: str, level:
130130
location_logics = []
131131
for location_logic in location_logics:
132132
location_obj = DK64RLocation.LocationListOriginal[location_logic.id]
133+
# DK Arcade Round 1 is dependent on a setting - don't create the inaccessible location depending on that Faster Checks toggle
134+
if location_logic.id == Locations.FactoryDonkeyDKArcade:
135+
if logic_holder.checkFastCheck(FasterChecksSelected.factory_arcade_round_1) and region_name == "FactoryArcadeTunnel":
136+
continue
137+
elif not logic_holder.checkFastCheck(FasterChecksSelected.factory_arcade_round_2) and region_name == "FactoryBaboonBlast":
138+
continue
133139
# Starting move locations and Kongs may be shuffled but their locations are not relevant ever due to item placement restrictions
134140
if location_obj.type in (Types.TrainingBarrel, Types.PreGivenMove, Types.Kong):
135141
continue
@@ -187,7 +193,7 @@ def create_region(multiworld: MultiWorld, player: int, region_name: str, level:
187193
elif collectible.type == Collectibles.balloon:
188194
quantity *= 10
189195
location.place_locked_item(DK64Item("Collectible CBs, " + collectible.kong.name + ", " + level.name + ", " + str(quantity), ItemClassification.progression, None, player))
190-
print("Collectible CBs, " + collectible.kong.name + ", " + level.name + ", " + str(quantity))
196+
# print("Collectible CBs, " + collectible.kong.name + ", " + level.name + ", " + str(quantity))
191197
new_region.locations.append(location)
192198

193199
for event in events:

worlds/dk64/__init__.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
sys.path.append('./worlds/dk64/DK64R/')
1010

1111
from BaseClasses import Item, MultiWorld, Tutorial, ItemClassification
12+
from worlds.dk64.DK64R.randomizer.Enums.Items import Items as DK64RItems
1213
from worlds.dk64.DK64R.randomizer.SettingStrings import decrypt_settings_string_enum
1314
from .Items import DK64Item, full_item_table, setup_items
1415
from .Options import GenerateDK64Options, dk64_options
@@ -94,7 +95,34 @@ def generate_basic(self):
9495

9596
def generate_output(self, output_directory: str):
9697
try:
97-
# DK64_TODO: Handle patching via DK64R
98+
# Read through all item assignments in this AP world and find their DK64 equivalents so we can update our world state for patching purposes
99+
for ap_location in self.multiworld.get_locations(self.player):
100+
# We never need to place Collectibles or Events in our world state
101+
if "Collectible" in ap_location.name or "Event" in ap_location.name:
102+
continue
103+
# Find the corresponding DK64 Locations enum
104+
dk64_location_id = None
105+
for dk64_loc_id, dk64_loc in self.logic_holder.spoiler.LocationList.items():
106+
if dk64_loc.name == ap_location.name:
107+
dk64_location_id = dk64_loc_id
108+
break
109+
if dk64_location_id is not None and ap_location.item is not None:
110+
ap_item = ap_location.item
111+
if ap_item.player != self.player:
112+
self.logic_holder.spoiler.LocationList[dk64_location_id].PlaceItem(self.logic_holder.spoiler, DK64RItems.TestItem) # TODO: replace with new AP item
113+
elif "Collectible" in ap_item.name:
114+
continue
115+
else:
116+
dk64_item = DK64RItems[ap_item.name]
117+
if dk64_item is not None:
118+
self.logic_holder.spoiler.LocationList[dk64_location_id].PlaceItem(self.logic_holder.spoiler, dk64_item)
119+
else:
120+
print(f"Item {ap_item.name} not found in DK64 item table.")
121+
elif dk64_location_id is not None:
122+
self.logic_holder.spoiler.LocationList[dk64_location_id].PlaceItem(self.logic_holder.spoiler, DK64RItems.NoItem)
123+
else:
124+
print(f"Location {ap_location.name} not found in DK64 location table.")
125+
98126
rompath = os.path.join(output_directory, f"{self.multiworld.get_out_file_name_base(self.player)}.sfc")
99127
except:
100128
raise

0 commit comments

Comments
 (0)