Skip to content

Commit 70e471e

Browse files
committed
starting moves and kongs count
1 parent 23e617c commit 70e471e

File tree

3 files changed

+77
-15
lines changed

3 files changed

+77
-15
lines changed

worlds/dk64/Items.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,56 @@ def setup_items(world: World) -> typing.List[DK64Item]:
9797
item_table.append(DK64Item(seed_item.name, classification, full_item_table[item.name].code, world.player))
9898
# print("Adding item: " + seed_item.name + " | " + str(classification))
9999

100-
# Extract starting moves from the list - these items will be placed in your starting inventory directly
100+
# Extract starting moves from the item table - these items will be placed in your starting inventory directly
101101
for move in world.options.start_inventory:
102102
for i in range(world.options.start_inventory[move]):
103-
print(move)
104103
for item in item_table:
105-
if item.name == move:
104+
# The starting inventory move name may or may not have spaces in it.
105+
if item.name == move.replace(" ", ""):
106106
item_table.remove(item)
107107
break
108108

109+
# Handle starting Kong list here
110+
for kong in world.logic_holder.settings.starting_kong_list:
111+
kong_item = DK64RItemPoolUtility.ItemFromKong(kong)
112+
for item in item_table:
113+
if item.name == kong_item.name:
114+
# We don't need to precollect Kong items, as they'll patch in to the main menu properly
115+
item_table.remove(item)
116+
print("Removing starting kong: " + kong_item.name)
117+
break
118+
print(world.logic_holder.settings.starting_kong_list)
119+
120+
# Handle starting move alterations here
121+
all_eligible_starting_moves = DK64RItemPoolUtility.AllKongMoves()
122+
all_eligible_starting_moves.extend(DK64RItemPoolUtility.TrainingBarrelAbilities())
123+
# Either include Climbing as an eligible starting move or place it in the starting inventory
124+
if world.options.climbing_shuffle:
125+
all_eligible_starting_moves.extend(DK64RItemPoolUtility.ClimbingAbilities())
126+
else:
127+
world.multiworld.push_precollected(DK64Item("Climbing", ItemClassification.progression, full_item_table[DK64RItems.Climbing.name].code, world.player))
128+
for item in item_table:
129+
if item.name == "Climbing":
130+
item_table.remove(item)
131+
break
132+
133+
world.random.shuffle(all_eligible_starting_moves)
134+
for i in range(world.options.starting_move_count):
135+
if len(all_eligible_starting_moves) == 0:
136+
break
137+
move_id = all_eligible_starting_moves.pop()
138+
move = DK64RItem.ItemList[move_id]
139+
# We don't want to pick anything we're already starting with. As an aside, the starting inventory move name may or may not have spaces in it.
140+
if move_id.name in world.options.start_inventory.options or move.name in world.options.start_inventory.options:
141+
# If we were to choose a move we're forcibly starting with, pick another
142+
i =- 1
143+
continue
144+
for item in item_table:
145+
if item.name == move_id.name or item.name == move.name:
146+
world.multiworld.push_precollected(item)
147+
item_table.remove(item)
148+
break
149+
109150
# If there's too many locations and not enough items, add some junk
110151
junk_item = DK64RItem.ItemList[DK64RItems.JunkMelon]
111152
# print("location comparison: " + str(world.logic_holder.location_pool_size - 1))

worlds/dk64/Options.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,31 @@ class ClimbingShuffle(Toggle):
2424
Whether or not you shuffle the Climbing ability into the world(s)
2525
"""
2626
display_name = "Climbing Shuffle"
27+
28+
29+
class StartingKongCount(Range):
30+
"""
31+
Determines how many Kongs you start with
32+
"""
33+
display_name = "Starting Kong Count"
34+
range_start = 1
35+
range_end = 5
36+
default = 1
37+
38+
39+
class StartingMoveCount(Range):
40+
"""
41+
Determines how many additional random moves you start with. If you choose more moves than are available, you will start with all moves.
42+
"""
43+
display_name = "Starting Move Count"
44+
range_start = 0
45+
range_end = 50
46+
default = 0
2747

2848

2949
@dataclass
3050
class DK64Options(PerGameCommonOptions):
3151
goal: Goal
3252
climbing_shuffle: ClimbingShuffle
53+
starting_kong_count: StartingKongCount
54+
starting_move_count: StartingMoveCount

worlds/dk64/__init__.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ def __init__(self, multiworld: MultiWorld, player: int):
126126

127127
self.rom_name_available_event = threading.Event()
128128
super().__init__(multiworld, player)
129-
# V1 LIMITATION: We are restricting settings pretty heavily. This string serves as the base for all seeds, with AP options overriding some options
130-
self.settings_string = "fjNPxAMxDIUx0QSpbHPUlZlBLg5gPQ+oBwRDIhKlsa58Iz8fiNEpEtiFKi4bVAhMF6AAd+AAOCAAGGAAGKAAAdm84FBiMhjoStwFIKW2wLcBJIBpkzVRCjFIKUUwGTLK/BQBuAIMAN4CBwBwAYQAOIECQByAoUAOYGCwB0A4YeXIITIagOrIrwAZTiU1QwkoSjuq1ZLEjQ0gRydoVFtRl6KiLAImIoArFljkbsl4u8igch2MvacgZ5GMGQBlU4IhAALhQALhgAJhwAJiAAHrQAHiQAFigADiwAHjAAFjQADrgALT5XoElypbPZZDCOZJ6Nh8Zq7WBgM5dVhVFZoKZUWjHFKAFBWDReUAnFRaJIuIZiTxrSyDSIjXR2AB0AvCoICQoLDA0OEBESFBUWGBkaHB0eICEiIyQlJicoKSorLC0uLzAxMjM0Nay+AMAAwgDEAJ0AsgBRAA"
131-
settings_dict = decrypt_settings_string_enum(self.settings_string)
132-
settings_dict["archipelago"] = True
133-
settings = Settings(settings_dict, self.random)
134-
spoiler = Spoiler(settings)
135-
spoiler.settings.shuffled_location_types.append(Types.ArchipelagoItem)
136-
self.logic_holder = LogicVarHolder(spoiler, self)
137129

138130
@classmethod
139131
def stage_assert_generate(cls, multiworld: MultiWorld):
@@ -148,6 +140,16 @@ def _get_slot_data(self):
148140
}
149141

150142
def generate_early(self):
143+
# V1 LIMITATION: We are restricting settings pretty heavily. This string serves as the base for all seeds, with AP options overriding some options
144+
self.settings_string = "fjNPxAMxDIUx0QSpbHPUlZlBLg5gPQ+oBwRDIhKlsa58Iz8fiNEpEtiFKi4bVAhMF6AAd+AAOCAAGGAAGKAAAdm84FBiMhjoStwFIKW2wLcBJIBpkzVRCjFIKUUwGTLK/BQBuAIMAN4CBwBwAYQAOIECQByAoUAOYGCwB0A4YeXIITIagOrIrwAZTiU1QwkoSjuq1ZLEjQ0gRydoVFtRl6KiLAImIoArFljkbsl4u8igch2MvacgZ5GMGQBlU4IhAALhQALhgAJhwAJiAAHrQAHiQAFigADiwAHjAAFjQADrgALT5XoElypbPZZDCOZJ6Nh8Zq7WBgM5dVhVFZoKZUWjHFKAFBWDReUAnFRaJIuIZiTxrSyDSIjXR2AB0AvCoICQoLDA0OEBESFBUWGBkaHB0eICEiIyQlJicoKSorLC0uLzAxMjM0Nay+AMAAwgDEAJ0AsgBRAA"
145+
settings_dict = decrypt_settings_string_enum(self.settings_string)
146+
settings_dict["archipelago"] = True
147+
settings_dict["starting_kongs_count"] = self.options.starting_kong_count.value
148+
settings = Settings(settings_dict, self.random)
149+
spoiler = Spoiler(settings)
150+
spoiler.settings.shuffled_location_types.append(Types.ArchipelagoItem)
151+
self.logic_holder = LogicVarHolder(spoiler, self)
152+
151153
# Handle enemy rando
152154
spoiler = self.logic_holder.spoiler
153155
spoiler.enemy_rando_data = {}
@@ -163,9 +165,6 @@ def create_regions(self) -> None:
163165
create_regions(self.multiworld, self.player, self.logic_holder)
164166

165167
def create_items(self) -> None:
166-
# Handle starting inventory alterations here
167-
if not self.options.climbing_shuffle.value:
168-
self.options.start_inventory.options["Climbing"] = 1
169168
itempool: typing.List[DK64Item] = setup_items(self)
170169
self.multiworld.itempool += itempool
171170

@@ -178,7 +177,7 @@ def set_rules(self):
178177
def generate_basic(self):
179178
connect_regions(self, self.logic_holder)
180179

181-
self.multiworld.get_location("Banana Hoard", self.player).place_locked_item(DK64Item("BananaHoard", ItemClassification.progression, 0x000000, self.player)) # TEMP?
180+
self.multiworld.get_location("Banana Hoard", self.player).place_locked_item(DK64Item("BananaHoard", ItemClassification.progression, 0xD64060, self.player)) # TEMP?
182181

183182
def generate_output(self, output_directory: str):
184183
try:

0 commit comments

Comments
 (0)