Skip to content

Commit 90993f4

Browse files
committed
New Krool in boss pool setting
1 parent a792f15 commit 90993f4

File tree

14 files changed

+136
-37
lines changed

14 files changed

+136
-37
lines changed

morpher.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,17 @@ <h5 class="modal-title"></h5>
718718
console.log('Setting ice_trap_model to complex');
719719
setting_data.ice_trap_model = "complex";
720720
}
721+
if (sel_version_num < numericVersion("5.7.57")) {
722+
// Migrate krool_in_boss_pool from boolean to enum
723+
if (setting_data.krool_in_boss_pool !== undefined) {
724+
console.log('Migrating krool_in_boss_pool from boolean to enum');
725+
if (setting_data.krool_in_boss_pool === true) {
726+
setting_data.krool_in_boss_pool_v2 = "full_shuffle";
727+
} else {
728+
setting_data.krool_in_boss_pool_v2 = "off";
729+
}
730+
}
731+
}
721732
// Update to include all unhandled options to unsorted
722733
const all_valid_items = Object.keys(output_json.ItemRandoListSelected);
723734
let mentioned_items = [];

randomizer/Enums/Settings.jsonc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,19 @@
228228
"on": 2
229229
},
230230

231+
/*
232+
KroolInBossPool:
233+
- Determines how K. Rool phases are shuffled with regular bosses.
234+
- off: K. Rool phases remain in the final fight only. Regular bosses remain in T&S portals only.
235+
- krool_only: K. Rool phases can appear as T&S bosses, but the final fight only has K. Rool phases.
236+
- full_shuffle: K. Rool phases and regular bosses can be shuffled bidirectionally between T&S portals and the final fight.
237+
*/
238+
"KroolInBossPool": {
239+
"off": 0,
240+
"krool_only": 1,
241+
"full_shuffle": 2
242+
},
243+
231244
/*
232245
ExcludedSongs:
233246
- Determines the types of songs excluded.
@@ -1404,7 +1417,8 @@
14041417
"random_starting_region_new": 290,
14051418
"kong_model_mode": 291,
14061419
"win_condition_spawns_ship": 292,
1407-
"ice_trap_model": 293
1420+
"ice_trap_model": 293,
1421+
"krool_in_boss_pool_v2": 294
14081422
},
14091423
/*
14101424
SettingsStringDataType:
@@ -1560,7 +1574,8 @@
15601574
"switchsanity_switch_japes_free_kong": { "obj": "SwitchsanityKong" },
15611575
"switchsanity_switch_aztec_free_tiny": { "obj": "SwitchsanityKong" },
15621576
"switchsanity_switch_aztec_free_lanky": { "obj": "SwitchsanityKong" },
1563-
"switchsanity_switch_factory_free_kong": { "obj": "SwitchsanityKong" }
1577+
"switchsanity_switch_factory_free_kong": { "obj": "SwitchsanityKong" },
1578+
"krool_in_boss_pool_v2": { "obj": "KroolInBossPool" }
15641579
},
15651580
// ALL SETTINGS NEED AN ENTRY HERE!
15661581
// This maps settings to the data types that will be used to encode them in the
@@ -2150,7 +2165,8 @@
21502165
"SettingsStringEnum.total_fairies": { "obj": "SettingsStringDataType.u8" },
21512166
"SettingsStringEnum.trap_weight_animal": { "obj": "SettingsStringDataType.int8" },
21522167
"SettingsStringEnum.trap_weight_rockfall": { "obj": "SettingsStringDataType.int8" },
2153-
"SettingsStringEnum.trap_weight_disabletag": { "obj": "SettingsStringDataType.int8" }
2168+
"SettingsStringEnum.trap_weight_disabletag": { "obj": "SettingsStringDataType.int8" },
2169+
"SettingsStringEnum.krool_in_boss_pool_v2": { "obj": "KroolInBossPool" }
21542170
},
21552171
// ALL LIST SETTINGS NEED AN ENTRY HERE!
21562172
// Another map for list settings, for the underlying data type of the list.

randomizer/Settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ def generate_main(self):
429429
self.random_prices = None
430430
self.boss_location_rando = None
431431
# self.boss_kong_rando = None # Deprecated
432+
self.krool_in_boss_pool_v2 = KroolInBossPool.off
432433
self.kasplat_rando_setting = None
433434
# self.puzzle_rando = None # Deprecated
434435
self.puzzle_rando_difficulty = PuzzleRando.off
@@ -1737,7 +1738,7 @@ def resolve_settings(self):
17371738
Maps.KroolTinyPhase,
17381739
Maps.KroolChunkyPhase,
17391740
]
1740-
if self.krool_in_boss_pool:
1741+
if self.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle:
17411742
phases.extend(
17421743
[
17431744
Maps.JapesBoss,

randomizer/ShuffleBosses.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from randomizer.Enums.Kongs import Kongs
77
from randomizer.Enums.Levels import Levels
88
from randomizer.Enums.Locations import Locations
9-
from randomizer.Enums.Settings import SlamRequirement, HardBossesSelected
9+
from randomizer.Enums.Settings import SlamRequirement, HardBossesSelected, KroolInBossPool
1010
from randomizer.Lists.Exceptions import BossOutOfLocationsException, PlandoIncompatibleException
1111
from randomizer.Enums.Maps import Maps
1212
from randomizer.Patching.Library.Generic import IsDDMSSelected
@@ -32,7 +32,7 @@
3232
def getBosses(settings) -> list:
3333
"""Get list of bosses."""
3434
boss_maps = BossMapList.copy()
35-
if settings.krool_in_boss_pool:
35+
if settings.krool_in_boss_pool_v2 == KroolInBossPool.krool_only or settings.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle:
3636
boss_maps.extend(KRoolMaps.copy())
3737
return [x for x in boss_maps if x not in settings.krool_order]
3838

@@ -173,7 +173,11 @@ def ShuffleBossesBasedOnOwnedItems(spoiler, ownedKongs: dict, ownedMoves: dict):
173173
# Lanky Phase also needs Lanky and Trombone
174174
is_beta_lanky = IsDDMSSelected(spoiler.settings.hard_bosses_selected, HardBossesSelected.beta_lanky_phase)
175175
required_additional_item_lankyphase = Items.Grape if is_beta_lanky else Items.Trombone
176-
if spoiler.settings.krool_in_boss_pool and Kongs.lanky in ownedKongs[level] and required_additional_item_lankyphase in ownedMoves[level]:
176+
if (
177+
(spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.krool_only or spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle)
178+
and Kongs.lanky in ownedKongs[level]
179+
and required_additional_item_lankyphase in ownedMoves[level]
180+
):
177181
bossOptions[level].append(Maps.KroolLankyPhase)
178182
# Mad Jack always requires a slam
179183
if Items.ProgressiveSlam in ownedMoves[level]:
@@ -183,7 +187,7 @@ def ShuffleBossesBasedOnOwnedItems(spoiler, ownedKongs: dict, ownedMoves: dict):
183187
# Outside of hard bosses, you need exactly Tiny and Twirl
184188
elif Kongs.tiny in ownedKongs[level] and Items.PonyTailTwirl in ownedMoves[level]:
185189
bossOptions[level].append(Maps.FactoryBoss)
186-
if spoiler.settings.krool_in_boss_pool:
190+
if spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.krool_only or spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle:
187191
# Donkey Phase may or may not need Blast
188192
if Kongs.donkey in ownedKongs[level] and Items.Climbing in ownedMoves[level] and (not spoiler.settings.cannons_require_blast or Items.BaboonBlast in ownedMoves[level]):
189193
bossOptions[level].append(Maps.KroolDonkeyPhase)
@@ -221,10 +225,12 @@ def ShuffleBossesBasedOnOwnedItems(spoiler, ownedKongs: dict, ownedMoves: dict):
221225
chosenBoss = None
222226
# If we don't have an option available for this very restrictive level
223227
# OR if we haven't placed many bosses yet, we'll take a peek at the endgame and see if any of those could fit
224-
if not any(notTakenBossOptions) or (spoiler.settings.krool_in_boss_pool and len(placedLevels) < 2):
228+
if not any(notTakenBossOptions) or (
229+
(spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.krool_only or spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle) and len(placedLevels) < 2
230+
):
225231
# If we don't have an option available, desperate times call for desperate measures
226232
# If T&S Bosses could be on endgame fights, we might have to go steal one
227-
if spoiler.settings.krool_in_boss_pool:
233+
if spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.krool_only or spoiler.settings.krool_in_boss_pool_v2 == KroolInBossPool.full_shuffle:
228234
# It's possible we can take a boss out of the endgame rotation and put it here instead
229235
possibleEndgameBossSwaps = [map for map in bossOptions[mostRestrictiveLevel] if map in spoiler.settings.krool_order]
230236
# If we can't do that, then there exists no combination of bosses that could make this fill work

static/js/rando_options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,10 @@ document.getElementById("cb_rando_enabled").addEventListener("change", plando_di
892892

893893
// Disable K. Rool phases as bosses if they are not in the boss pool.
894894
function plando_disable_krool_phases_as_bosses(evt) {
895-
const kroolInBossPool = document.getElementById("krool_in_boss_pool").checked;
895+
const kroolInBossPool = document.getElementById("krool_in_boss_pool_v2").value;
896896
const tnsBossOptions = document.getElementsByClassName("plando-tns-boss");
897897

898-
if (kroolInBossPool) {
898+
if (kroolInBossPool !== "off") {
899899
for (let option of tnsBossOptions) {
900900
option.removeAttribute("disabled");
901901
}
@@ -912,7 +912,7 @@ function plando_disable_krool_phases_as_bosses(evt) {
912912
}
913913
}
914914

915-
document.getElementById("krool_in_boss_pool").addEventListener("click", plando_disable_krool_phases_as_bosses);
915+
document.getElementById("krool_in_boss_pool_v2").addEventListener("change", plando_disable_krool_phases_as_bosses);
916916

917917
// Make changes to the plando tab based on other settings
918918
document

static/presets/weights/weight_files_raw.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,12 +2117,24 @@
21172117
"points_list_shopkeepers": {
21182118
"ignore": true
21192119
},
2120-
"krool_in_boss_pool": {
2121-
"setting_type": "bool",
2120+
"krool_in_boss_pool_v2": {
2121+
"setting_type": "choice_single",
21222122
"options": {
2123-
"easy": 80,
2124-
"standard": 65,
2125-
"difficult": 50
2123+
"easy": {
2124+
"off": 20.0,
2125+
"krool_only": 30.0,
2126+
"full_shuffle": 50.0
2127+
},
2128+
"standard": {
2129+
"off": 35.0,
2130+
"krool_only": 30.0,
2131+
"full_shuffle": 35.0
2132+
},
2133+
"difficult": {
2134+
"off": 25.0,
2135+
"krool_only": 50.0,
2136+
"full_shuffle": 25.0
2137+
}
21262138
},
21272139
"qol_uses_hard": true
21282140
},

static/presets/weights/weights_files.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@
274274
},
275275
"krool_access": 0.7,
276276
"win_condition_spawns_ship": 0.3,
277-
"krool_in_boss_pool": 0.8,
277+
"krool_in_boss_pool_v2": {
278+
"off": 0.2,
279+
"krool_only": 0.3,
280+
"full_shuffle": 0.5
281+
},
278282
"krool_phase_order_rando": 0.8,
279283
"krool_random": 1,
280284
"level_randomization": {
@@ -712,7 +716,11 @@
712716
},
713717
"krool_access": 0.7,
714718
"win_condition_spawns_ship": 0.5,
715-
"krool_in_boss_pool": 0.65,
719+
"krool_in_boss_pool_v2": {
720+
"off": 0.35,
721+
"krool_only": 0.3,
722+
"full_shuffle": 0.35
723+
},
716724
"krool_phase_order_rando": 0.8,
717725
"krool_random": 1,
718726
"level_randomization": {
@@ -1173,7 +1181,11 @@
11731181
},
11741182
"krool_access": 0.7,
11751183
"win_condition_spawns_ship": 0.7,
1176-
"krool_in_boss_pool": 0.5,
1184+
"krool_in_boss_pool_v2": {
1185+
"off": 0.25,
1186+
"krool_only": 0.50,
1187+
"full_shuffle": 0.25
1188+
},
11771189
"krool_phase_order_rando": 0.8,
11781190
"krool_random": 1,
11791191
"level_randomization": {
@@ -1665,7 +1677,11 @@
16651677
},
16661678
"krool_access": 0.7,
16671679
"win_condition_spawns_ship": 0.7,
1668-
"krool_in_boss_pool": 0.5,
1680+
"krool_in_boss_pool_v2": {
1681+
"off": 0.25,
1682+
"krool_only": 0.50,
1683+
"full_shuffle": 0.25
1684+
},
16691685
"krool_phase_order_rando": 0.8,
16701686
"krool_random": 1,
16711687
"level_randomization": {

templates/overworld.html

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,25 @@ <h2 class="title">LOCATION RANDOMIZERS</h2>
192192
<h2 class="title">BOSSES</h2>
193193
<div class="flex-container">
194194
{{ toggle_input("boss_location_rando", "Shuffle Boss Location", "The boss you can get in a level is different than normal.") }}
195-
<div class="form-check form-switch item-switch">
196-
<label data-toggle="tooltip"
197-
title="K. Rool phases can be found in the T&S, and T&S bosses can be encountered as an endgame phase.">
198-
<input class="form-check-input"
199-
type="checkbox"
200-
name="krool_in_boss_pool"
201-
id="krool_in_boss_pool"
202-
display_name="Shuffle Boss Kong Required"
203-
value="True"/>
204-
K Rool Phases as Bosses
205-
</label>
195+
<div class="item-select">
196+
<p class="select-title">K. Rool in Boss Pool</p>
197+
<select name="krool_in_boss_pool_v2"
198+
id="krool_in_boss_pool_v2"
199+
display_name="K. Rool in Boss Pool"
200+
class="form-select"
201+
aria-label="K. Rool Boss Pool"
202+
data-toggle="tooltip"
203+
title="Determines how K. Rool phases are shuffled with regular bosses.&#10;-Off: K. Rool phases remain in the final fight only. Regular bosses remain as T&S bosses only.&#10;-K. Rool Only: K. Rool phases can appear as T&S bosses, but the final fight only has K. Rool phases.&#10;-Full Shuffle: K. Rool phases and regular bosses can be shuffled between each other.">
204+
<option selected id="off" value="off">
205+
Off
206+
</option>
207+
<option id="krool_only" value="krool_only">
208+
K. Rool Only
209+
</option>
210+
<option id="full_shuffle" value="full_shuffle">
211+
Full Shuffle
212+
</option>
213+
</select>
206214
</div>
207215
</div>
208216
</div>

typings/randomizer/Enums/Settings.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ export enum DKPortalRando {
113113
on = 2,
114114
}
115115

116+
export enum KroolInBossPool {
117+
off = 0,
118+
krool_only = 1,
119+
full_shuffle = 2,
120+
}
121+
116122
export enum ExcludedSongs {
117123
wrinkly = 1,
118124
transformation = 2,
@@ -947,6 +953,7 @@ export enum SettingsStringEnum {
947953
kong_model_mode = 291,
948954
win_condition_spawns_ship = 292,
949955
ice_trap_model = 293,
956+
krool_in_boss_pool_v2 = 294,
950957
}
951958

952959
export enum SettingsStringDataType {
@@ -1095,6 +1102,7 @@ export const SettingsMap = {
10951102
'switchsanity_switch_aztec_free_tiny': SwitchsanityKong,
10961103
'switchsanity_switch_aztec_free_lanky': SwitchsanityKong,
10971104
'switchsanity_switch_factory_free_kong': SwitchsanityKong,
1105+
'krool_in_boss_pool_v2': KroolInBossPool,
10981106
}
10991107

11001108
export const SettingsStringTypeMap = {
@@ -1391,6 +1399,7 @@ export const SettingsStringTypeMap = {
13911399
SettingsStringEnum.trap_weight_animal: SettingsStringDataType.int8,
13921400
SettingsStringEnum.trap_weight_rockfall: SettingsStringDataType.int8,
13931401
SettingsStringEnum.trap_weight_disabletag: SettingsStringDataType.int8,
1402+
SettingsStringEnum.krool_in_boss_pool_v2: KroolInBossPool,
13941403
}
13951404

13961405
export const SettingsStringListTypeMap = {

typings/randomizer/Enums/Settings.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ class DKPortalRando(IntEnum):
9999
main_only = 1
100100
on = 2
101101

102+
class KroolInBossPool(IntEnum):
103+
off = 0
104+
krool_only = 1
105+
full_shuffle = 2
106+
102107
class ExcludedSongs(IntEnum):
103108
wrinkly = 1
104109
transformation = 2
@@ -882,6 +887,7 @@ class SettingsStringEnum(IntEnum):
882887
kong_model_mode = 291
883888
win_condition_spawns_ship = 292
884889
ice_trap_model = 293
890+
krool_in_boss_pool_v2 = 294
885891

886892
class SettingsStringDataType(IntEnum):
887893
bool = 1
@@ -1028,6 +1034,7 @@ SettingsMap: dict = {
10281034
"switchsanity_switch_aztec_free_tiny": SwitchsanityKong,
10291035
"switchsanity_switch_aztec_free_lanky": SwitchsanityKong,
10301036
"switchsanity_switch_factory_free_kong": SwitchsanityKong,
1037+
"krool_in_boss_pool_v2": KroolInBossPool,
10311038
}
10321039

10331040
SettingsStringTypeMap: dict = {
@@ -1324,6 +1331,7 @@ SettingsStringTypeMap: dict = {
13241331
SettingsStringEnum.trap_weight_animal: SettingsStringDataType.int8,
13251332
SettingsStringEnum.trap_weight_rockfall: SettingsStringDataType.int8,
13261333
SettingsStringEnum.trap_weight_disabletag: SettingsStringDataType.int8,
1334+
SettingsStringEnum.krool_in_boss_pool_v2: KroolInBossPool,
13271335
}
13281336

13291337
SettingsStringListTypeMap: dict = {

0 commit comments

Comments
 (0)