Skip to content

Commit 562a031

Browse files
authored
Merge pull request #2963 from UmedMuzl/final-things-for-umed
2 parents 3826084 + 0fc0eb0 commit 562a031

File tree

17 files changed

+185
-79
lines changed

17 files changed

+185
-79
lines changed

archipelago.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"minimum_ap_version": "0.6.5",
3-
"world_version": "1.4.21",
3+
"world_version": "1.4.22",
44
"authors": ["2dos", "AlmostSeagull", "Ballaam", "Green Bean", "Killklli", "Lrauq", "PoryGone", "Umed"],
55
"version": 7,
66
"compatible_version": 7,

archipelago/FillSettings.py

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
TroffSetting,
4848
WinConditionComplex,
4949
WrinklyHints,
50+
KroolInBossPool,
5051
)
5152
from randomizer.Enums.Items import Items as DK64RItems
5253
from randomizer.Enums.Types import Types
@@ -249,7 +250,6 @@ def get_default_settings() -> dict:
249250
MiscChangesSelected.move_spring_cabin_rocketbarrel,
250251
],
251252
"more_cutscene_skips": ExtraCutsceneSkips.auto,
252-
"no_consumable_upgrades": False,
253253
"no_healing": False,
254254
"no_melons": False,
255255
"open_lobbies": False,
@@ -328,7 +328,10 @@ def apply_archipelago_settings(settings_dict: dict, options, multiworld) -> None
328328
settings_dict["archipelago"] = True
329329
settings_dict["starting_kongs_count"] = options.starting_kong_count.value
330330
settings_dict["open_lobbies"] = options.open_lobbies.value
331-
settings_dict["krool_in_boss_pool"] = options.krool_in_boss_pool.value
331+
if options.krool_in_boss_pool.value:
332+
settings_dict["krool_in_boss_pool_v2"] = KroolInBossPool.full_shuffle
333+
else:
334+
settings_dict["krool_in_boss_pool_v2"] = KroolInBossPool.off
332335
settings_dict["helm_phase_count"] = options.helm_phase_count.value
333336
settings_dict["krool_phase_count"] = options.krool_phase_count.value
334337
settings_dict["level_randomization"] = LevelRandomization.loadingzone if options.loading_zone_rando.value else LevelRandomization.level_order_complex
@@ -342,7 +345,6 @@ def apply_archipelago_settings(settings_dict: dict, options, multiworld) -> None
342345
settings_dict["medal_requirement"] = options.jetpac_requirement.value
343346
settings_dict["rareware_gb_fairies"] = options.rareware_gb_fairies.value
344347
settings_dict["mirror_mode"] = options.mirror_mode.value
345-
settings_dict["hard_mode"] = options.hard_mode.value
346348
settings_dict["key_8_helm"] = options.helm_key_lock.value
347349
settings_dict["shuffle_helm_location"] = options.shuffle_helm_level_order.value
348350
settings_dict["mermaid_gb_pearls"] = options.mermaid_gb_pearls.value
@@ -358,6 +360,7 @@ def apply_archipelago_settings(settings_dict: dict, options, multiworld) -> None
358360
settings_dict["galleon_water"] = GalleonWaterSetting.raised
359361
else:
360362
settings_dict["galleon_water"] = GalleonWaterSetting.vanilla
363+
settings_dict["no_consumable_upgrades"] = options.remove_bait_potions.value
361364

362365

363366
def apply_blocker_settings(settings_dict: dict, options) -> None:
@@ -764,65 +767,28 @@ def apply_minigame_settings(settings_dict: dict, options, multiworld) -> None:
764767
settings_dict["bonus_barrel_auto_complete"] = options.auto_complete_bonus_barrels.value and options.goal.value != Goal.option_bonuses
765768
settings_dict["helm_room_bonus_count"] = HelmBonuses(options.helm_room_bonus_count.value)
766769

767-
# Map crown door and coin door settings
768-
crown_door_mapping = {
769-
0: HelmDoorItem.vanilla,
770-
1: HelmDoorItem.opened,
771-
2: HelmDoorItem.medium_random,
772-
3: HelmDoorItem.req_gb,
773-
4: HelmDoorItem.req_bp,
774-
5: HelmDoorItem.req_companycoins,
775-
6: HelmDoorItem.req_key,
776-
7: HelmDoorItem.req_medal,
777-
8: HelmDoorItem.req_crown,
778-
9: HelmDoorItem.req_fairy,
779-
10: HelmDoorItem.req_rainbowcoin,
780-
11: HelmDoorItem.req_bean,
781-
12: HelmDoorItem.req_pearl,
782-
13: HelmDoorItem.easy_random,
783-
14: HelmDoorItem.hard_random,
784-
}
785-
786-
coin_door_mapping = {
787-
0: HelmDoorItem.vanilla,
788-
1: HelmDoorItem.opened,
789-
2: HelmDoorItem.medium_random,
790-
3: HelmDoorItem.req_gb,
791-
4: HelmDoorItem.req_bp,
792-
5: HelmDoorItem.req_companycoins,
793-
6: HelmDoorItem.req_key,
794-
7: HelmDoorItem.req_medal,
795-
8: HelmDoorItem.req_crown,
796-
9: HelmDoorItem.req_fairy,
797-
10: HelmDoorItem.req_rainbowcoin,
798-
11: HelmDoorItem.req_bean,
799-
12: HelmDoorItem.req_pearl,
800-
13: HelmDoorItem.easy_random,
801-
14: HelmDoorItem.hard_random,
802-
}
803-
804770
# Map door item type to the key name in helm_door_item_count dict
805771
door_item_to_key = {
806-
3: "golden_bananas", # req_gb
807-
4: "blueprints", # req_bp
808-
5: "company_coins", # req_companycoins
809-
6: "keys", # req_key
810-
7: "medals", # req_medal
811-
8: "crowns", # req_crown
812-
9: "fairies", # req_fairy
813-
10: "rainbow_coins", # req_rainbowcoin
814-
11: "bean", # req_bean
815-
12: "pearls", # req_pearl
772+
HelmDoorItem.req_gb: "golden_bananas",
773+
HelmDoorItem.req_bp: "blueprints",
774+
HelmDoorItem.req_companycoins: "company_coins",
775+
HelmDoorItem.req_key: "keys",
776+
HelmDoorItem.req_medal: "medals",
777+
HelmDoorItem.req_crown: "crowns",
778+
HelmDoorItem.req_fairy: "fairies",
779+
HelmDoorItem.req_rainbowcoin: "rainbow_coins",
780+
HelmDoorItem.req_bean: "bean",
781+
HelmDoorItem.req_pearl: "pearls",
816782
}
817783

818-
settings_dict["crown_door_item"] = crown_door_mapping.get(options.crown_door_item.value, HelmDoorItem.opened)
784+
settings_dict["crown_door_item"] = HelmDoorItem(options.crown_door_item.value)
819785
# Get count from dict based on selected item, default to 1 if not found
820-
crown_item_key = door_item_to_key.get(options.crown_door_item.value)
786+
crown_item_key = door_item_to_key.get(settings_dict["crown_door_item"])
821787
settings_dict["crown_door_item_count"] = options.helm_door_item_count.value.get(crown_item_key, 1) if crown_item_key else 1
822788

823-
settings_dict["coin_door_item"] = coin_door_mapping.get(options.coin_door_item.value, HelmDoorItem.opened)
789+
settings_dict["coin_door_item"] = HelmDoorItem(options.coin_door_item.value)
824790
# Get count from dict based on selected item, default to 1 if not found
825-
coin_item_key = door_item_to_key.get(options.coin_door_item.value)
791+
coin_item_key = door_item_to_key.get(settings_dict["coin_door_item"])
826792
settings_dict["coin_door_item_count"] = options.helm_door_item_count.value.get(coin_item_key, 1) if coin_item_key else 1
827793

828794
if hasattr(multiworld, "generation_is_fake"):

archipelago/Items.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ def setup_items(world: "DK64World") -> typing.List[DK64Item]:
136136
case DK64RTypes.Shop | DK64RTypes.TrainingBarrel | DK64RTypes.Shockwave:
137137
if name == "Camera and Shockwave":
138138
continue
139+
# Skip JunkSharedMoves if no_consumable_upgrades is enabled
140+
if item_id in DK64RItemPoolUtility.JunkSharedMoves and world.spoiler.settings.no_consumable_upgrades:
141+
continue
139142
if item_id in DK64RItemPoolUtility.JunkSharedMoves:
140143
ap_item.classification = ItemClassification.useful
141144
num_moves = 1 # Track the number of each potion, default 1

archipelago/Options.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,6 @@ class MirrorMode(Toggle):
492492
display_name = "Mirror Mode"
493493

494494

495-
class HardModeEnabled(Toggle):
496-
"""Determines whether Hard Mode is enabled. Use the yaml option below this to determine which settings you want enabled."""
497-
498-
display_name = "Hard Mode Enabled"
499-
500-
501495
class HardModeSelected(OptionList):
502496
"""If Hard Mode is enabled, determines which Hard Mode settings are included.
503497
@@ -1370,6 +1364,16 @@ class GalleonWaterLevel(Choice):
13701364
default = 0
13711365

13721366

1367+
class RemoveBaitPotions(Toggle):
1368+
"""If enabled, Ammo Belts and Instrument Upgrades will not be placed in the world.
1369+
1370+
You can still start with them.
1371+
Only recommended to enable this with Loading Zone Rando enabled.
1372+
"""
1373+
1374+
display_name = "Remove Bait Potions"
1375+
1376+
13731377
@dataclass
13741378
class DK64Options(PerGameCommonOptions):
13751379
"""Options for DK64R."""
@@ -1415,7 +1419,6 @@ class DK64Options(PerGameCommonOptions):
14151419
tricks_selected: TricksSelected
14161420
half_medals_in_pool: HalfMedals
14171421
glitches_selected: GlitchesSelected
1418-
hard_mode: HardModeEnabled
14191422
hard_mode_selected: HardModeSelected
14201423
mirror_mode: MirrorMode
14211424
hints_in_item_pool: HintItemRandomization
@@ -1469,6 +1472,7 @@ class DK64Options(PerGameCommonOptions):
14691472
shop_prices: ShopPrices
14701473
loading_zone_rando: LoadingZoneRando
14711474
galleon_water_level: GalleonWaterLevel
1475+
remove_bait_potions: RemoveBaitPotions
14721476

14731477

14741478
dk64_option_groups: List[OptionGroup] = [
@@ -1567,7 +1571,6 @@ class DK64Options(PerGameCommonOptions):
15671571
OptionGroup(
15681572
"Hard Mode",
15691573
[
1570-
HardModeEnabled,
15711574
HardModeSelected,
15721575
HardBosses,
15731576
MirrorMode,
@@ -1634,6 +1637,7 @@ class DK64Options(PerGameCommonOptions):
16341637
"Quality of Life",
16351638
[
16361639
EnableCutscenes,
1640+
RemoveBaitPotions,
16371641
ReceiveNotifications,
16381642
],
16391643
),

base-hack/src/randomizers/crowd_control.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,14 @@ int cc_enabler_paper(void) {
474474
for (int i = 0; i < ActorCount; i++) {
475475
actorData *actor = ActorArray[i];
476476
if (actor) {
477-
if (inShortList(actor->actorType, &ignored_paper_types, sizeof(ignored_paper_types) >> 1)) {
477+
if (!inShortList(actor->actorType, &ignored_paper_types, sizeof(ignored_paper_types) >> 1)) {
478478
if (actor->render) {
479479
actor->render->scale_z = 0.015f;
480480
}
481481
}
482482
}
483483
}
484+
return 0;
484485
}
485486

486487
int cc_disabler_paper(void) {
@@ -494,6 +495,7 @@ int cc_disabler_paper(void) {
494495
}
495496
}
496497
}
498+
return 0;
497499
}
498500

499501
int cc_enabler_time(void) {

randomizer/ItemPool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,9 @@ def DistributeItems(items: list, count: int, distro: list[int] = None) -> list:
657657

658658

659659
def FakeItems(settings):
660-
"""Return a list of Fake Items to be placed."""
660+
"""Return a copy of the list of Fake Items to be placed."""
661661
# This order of items helps ensure that with low ice trap counts, you see models other than GBs
662-
return settings.trap_assortment
662+
return [item for item in settings.trap_assortment]
663663

664664

665665
def FillerItems(settings):

randomizer/Patching/DoorPlacer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def place_door_locations(spoiler, ROM_COPY: LocalROM):
507507
pushNewDKPortalScript(portal_map, dk_portal_ids, ROM_COPY)
508508
exit_start = getPointerLocation(TableNames.Exits, portal_map)
509509
exits_to_alter = [-1]
510-
if cont_map_id in LEVEL_MAIN_MAPS:
510+
if portal_map in LEVEL_MAIN_MAPS:
511511
exits_to_alter = PORTAL_MAP_EXIT_PAIRING[portal_map]
512512
for exit_index in exits_to_alter:
513513
if exit_index >= 0:

randomizer/ShuffleBosses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def getBosses(settings) -> list:
4343
def ShuffleBosses(boss_location_rando: bool, settings):
4444
"""Shuffle boss locations."""
4545
boss_maps = getBosses(settings)
46-
if len(boss_maps) < 12:
47-
dupe_count = math.ceil(12 / len(boss_maps))
46+
if len(boss_maps) < 7:
47+
dupe_count = math.ceil(7 / len(boss_maps))
4848
original_maps = boss_maps.copy()
4949
for _ in range(dupe_count):
5050
boss_maps.extend(original_maps)

static/js/randomize_settings.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ function random_multi_select_setting(weights_obj) {
116116
function assign_multi_select_setting(setting_name, options_list) {
117117
/** Assign a list of values to a multi-select. */
118118
const selectElem = get_setting_element(setting_name);
119+
if (!selectElem) {
120+
console.warn(`Setting element not found: ${setting_name}`);
121+
return;
122+
}
119123
if (selectElem.tagName == "SELECT") {
120124
// Regular Multi-select
121125
for (let i = 0; i < selectElem.options.length; i++) {
@@ -125,8 +129,18 @@ function assign_multi_select_setting(setting_name, options_list) {
125129
} else {
126130
// Dropdown Multiselect
127131
const checkboxes = Array.from(selectElem.getElementsByTagName("input"));
132+
let selectedCount = 0;
128133
for (let cb of checkboxes) {
129134
cb.checked = options_list.includes(cb.value);
135+
if (cb.checked) {
136+
selectedCount++;
137+
}
138+
}
139+
// Update the count display directly
140+
const baseName = setting_name.endsWith('_selected') ? setting_name.slice(0, -9) : setting_name;
141+
const countLabel = document.getElementById(`selectedCount_${baseName}`);
142+
if (countLabel) {
143+
countLabel.innerText = `${selectedCount} item${selectedCount !== 1 ? 's' : ''} selected`;
130144
}
131145
}
132146
}
@@ -238,8 +252,9 @@ function randomize_settings() {
238252
// value to the list if the number is's above the provided weight.
239253
const min_selected = data.min_selected ?? 0;
240254
let length = -1;
241-
while (length >= min_selected) {
242-
let randomList = random_multi_select_setting(data.options[parsed_weight_name]);
255+
let randomList;
256+
while (length < min_selected) {
257+
randomList = random_multi_select_setting(data.options[parsed_weight_name]);
243258
length = randomList.length;
244259
}
245260
randSettings[settingName] = {
@@ -295,7 +310,7 @@ function randomize_settings() {
295310
randSettings["blocker_text"].value = parseInt((randSettings["blocker_text"].value / 201) * 100);
296311
}
297312
console.log(randSettings)
298-
if (randSettings["no_healing"].value) {
313+
if (randSettings["no_healing"]?.value && randSettings["hard_mode_selected"]?.value) {
299314
// Disable water is lava if no healing is selected
300315
randSettings["hard_mode_selected"].value = randSettings["hard_mode_selected"].value.filter(k => k != 'water_is_lava');
301316
}
@@ -310,12 +325,20 @@ function randomize_settings() {
310325
const settingType = setting_data.type;
311326
if (settingType == "bool") {
312327
const settingElem = get_setting_element(settingName);
328+
if (!settingElem) {
329+
console.warn(`Setting element not found: ${settingName}`);
330+
continue;
331+
}
313332
settingElem.checked = settingVal;
314333
} else if (settingType == "choice_multiple") {
315334
assign_multi_select_setting(settingName, settingVal);
316335
} else if (settingType != "item_rando") {
317336
// Both numeric and single-select settings work here.
318337
const settingElem = get_setting_element(settingName);
338+
if (!settingElem) {
339+
console.warn(`Setting element not found: ${settingName}`);
340+
continue;
341+
}
319342
settingElem.value = settingVal;
320343
}
321344
}

static/patches/shrink-dk64.bps

4 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)