5656from randomizer .Enums .SwitchTypes import SwitchType
5757from randomizer .Enums .Switches import Switches
5858from randomizer .Lists .Switches import SwitchInfo
59- from archipelago .Options import Goal , SwitchSanity , SelectStartingKong
59+ from archipelago .Options import Goal , SwitchSanity , SelectStartingKong , GalleonWaterLevel
6060from archipelago .Goals import GOAL_MAPPING , QUANTITY_GOALS , calculate_quantity
6161from archipelago .Logic import logic_item_name_to_id
6262
@@ -128,7 +128,6 @@ def get_default_settings() -> dict:
128128 "filler_items_selected" : [ItemRandoFiller .junkitem ],
129129 "free_trade_setting" : True ,
130130 "fungi_time" : FungiTimeSetting .dusk ,
131- "galleon_water" : GalleonWaterSetting .raised ,
132131 "generate_spoilerlog" : True ,
133132 "hard_bosses_selected" : [],
134133 "hard_mode_selected" : [],
@@ -189,12 +188,11 @@ def get_default_settings() -> dict:
189188 "kong_model_tiny" : KongModels .default ,
190189 "krool_access" : False ,
191190 "krool_in_boss_pool" : False ,
192- "krool_key_count" : 8 ,
191+ "krool_key_count" : 0 ,
193192 "krool_phase_count" : 3 ,
194193 "krool_phase_order_rando" : True ,
195194 "krool_random" : False ,
196195 "less_fragile_boulders" : True ,
197- "level_randomization" : LevelRandomization .level_order_complex ,
198196 "logic_type" : LogicType .glitchless ,
199197 "maximize_helm_blocker" : True ,
200198 "medal_cb_req" : 40 ,
@@ -317,6 +315,7 @@ def apply_archipelago_settings(settings_dict: dict, options, multiworld) -> None
317315 settings_dict ["krool_in_boss_pool" ] = options .krool_in_boss_pool .value
318316 settings_dict ["helm_phase_count" ] = options .helm_phase_count .value
319317 settings_dict ["krool_phase_count" ] = options .krool_phase_count .value
318+ settings_dict ["level_randomization" ] = LevelRandomization .loadingzone if options .loading_zone_rando .value else LevelRandomization .level_order_complex
320319
321320 # Medal distribution settings
322321 if options .medal_distribution .value == 0 : # pre_selected
@@ -337,6 +336,12 @@ def apply_archipelago_settings(settings_dict: dict, options, multiworld) -> None
337336 if options .enable_cutscenes .value :
338337 settings_dict ["more_cutscene_skips" ] = ExtraCutsceneSkips .press
339338 settings_dict ["alt_minecart_mayhem" ] = options .alternate_minecart_mayhem .value
339+ if options .galleon_water_level == GalleonWaterLevel .option_lowered :
340+ settings_dict ["galleon_water" ] = GalleonWaterSetting .lowered
341+ elif options .galleon_water_level == GalleonWaterLevel .option_raised :
342+ settings_dict ["galleon_water" ] = GalleonWaterSetting .raised
343+ else :
344+ settings_dict ["galleon_water" ] = GalleonWaterSetting .vanilla
340345
341346
342347def apply_blocker_settings (settings_dict : dict , options ) -> None :
@@ -437,7 +442,8 @@ def apply_hard_mode_settings(settings_dict: dict, options) -> None:
437442def apply_kong_settings (settings_dict : dict , options ) -> None :
438443 """Apply Kong settings."""
439444 # Key settings
440- settings_dict ["krool_key_count" ] = options .krool_key_count .value
445+ settings_dict ["krool_key_count" ] = options .pregiven_keys .value
446+ settings_dict ["win_condition_spawns_ship" ] = 1 if options .require_beating_krool .value else 0
441447
442448 # Kong mapping
443449 kong_mapping = {
@@ -679,6 +685,13 @@ def apply_goal_settings(settings_dict: dict, options, random_obj) -> None:
679685 """Apply goal and win condition settings."""
680686 settings_dict ["win_condition_item" ] = GOAL_MAPPING [options .goal ]
681687
688+ # Krool's Challenge always requires beating K. Rool otherwise wheres the challenge
689+ if options .goal == Goal .option_krools_challenge :
690+ settings_dict ["win_condition_spawns_ship" ] = True
691+ # The rabbit is too powerful to allow this
692+ elif options .goal == Goal .option_kill_the_rabbit :
693+ settings_dict ["win_condition_spawns_ship" ] = False
694+
682695 if options .goal in QUANTITY_GOALS .keys ():
683696 goal_name = QUANTITY_GOALS [options .goal ]
684697 settings_dict ["win_condition_count" ] = calculate_quantity (goal_name , options .goal_quantity .value , random_obj )
@@ -733,6 +746,66 @@ def apply_minigame_settings(settings_dict: dict, options, multiworld) -> None:
733746 settings_dict ["bonus_barrel_auto_complete" ] = options .auto_complete_bonus_barrels .value and options .goal .value != Goal .option_bonuses
734747 settings_dict ["helm_room_bonus_count" ] = HelmBonuses (options .helm_room_bonus_count .value )
735748
749+ # Map crown door and coin door settings
750+ crown_door_mapping = {
751+ 0 : HelmDoorItem .vanilla ,
752+ 1 : HelmDoorItem .opened ,
753+ 2 : HelmDoorItem .medium_random ,
754+ 3 : HelmDoorItem .req_gb ,
755+ 4 : HelmDoorItem .req_bp ,
756+ 5 : HelmDoorItem .req_companycoins ,
757+ 6 : HelmDoorItem .req_key ,
758+ 7 : HelmDoorItem .req_medal ,
759+ 8 : HelmDoorItem .req_crown ,
760+ 9 : HelmDoorItem .req_fairy ,
761+ 10 : HelmDoorItem .req_rainbowcoin ,
762+ 11 : HelmDoorItem .req_bean ,
763+ 12 : HelmDoorItem .req_pearl ,
764+ 13 : HelmDoorItem .easy_random ,
765+ 14 : HelmDoorItem .hard_random ,
766+ }
767+
768+ coin_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+ 6 : HelmDoorItem .req_key ,
775+ 7 : HelmDoorItem .req_medal ,
776+ 8 : HelmDoorItem .req_crown ,
777+ 9 : HelmDoorItem .req_fairy ,
778+ 10 : HelmDoorItem .req_rainbowcoin ,
779+ 11 : HelmDoorItem .req_bean ,
780+ 12 : HelmDoorItem .req_pearl ,
781+ 13 : HelmDoorItem .easy_random ,
782+ 14 : HelmDoorItem .hard_random ,
783+ }
784+
785+ # Map door item type to the key name in helm_door_item_count dict
786+ door_item_to_key = {
787+ 3 : "golden_bananas" , # req_gb
788+ 4 : "blueprints" , # req_bp
789+ 5 : "company_coins" , # req_companycoins
790+ 6 : "keys" , # req_key
791+ 7 : "medals" , # req_medal
792+ 8 : "crowns" , # req_crown
793+ 9 : "fairies" , # req_fairy
794+ 10 : "rainbow_coins" , # req_rainbowcoin
795+ 11 : "bean" , # req_bean
796+ 12 : "pearls" , # req_pearl
797+ }
798+
799+ settings_dict ["crown_door_item" ] = crown_door_mapping .get (options .crown_door_item .value , HelmDoorItem .opened )
800+ # Get count from dict based on selected item, default to 1 if not found
801+ crown_item_key = door_item_to_key .get (options .crown_door_item .value )
802+ settings_dict ["crown_door_item_count" ] = options .helm_door_item_count .value .get (crown_item_key , 1 ) if crown_item_key else 1
803+
804+ settings_dict ["coin_door_item" ] = coin_door_mapping .get (options .coin_door_item .value , HelmDoorItem .opened )
805+ # Get count from dict based on selected item, default to 1 if not found
806+ coin_item_key = door_item_to_key .get (options .coin_door_item .value )
807+ settings_dict ["coin_door_item_count" ] = options .helm_door_item_count .value .get (coin_item_key , 1 ) if coin_item_key else 1
808+
736809 if hasattr (multiworld , "generation_is_fake" ):
737810 if hasattr (multiworld , "re_gen_passthrough" ):
738811 if "Donkey Kong 64" in multiworld .re_gen_passthrough :
@@ -751,10 +824,8 @@ def handle_fake_generation_settings(settings: Settings, multiworld) -> None:
751824
752825 # Switch logic lifted out of level shuffle due to static levels for UT
753826 if settings .alter_switch_allocation :
754- allocation = [1 , 1 , 1 , 1 , 2 , 2 , 3 , 3 ]
755827 for x in range (8 ):
756- level = settings .level_order [x + 1 ]
757- settings .switch_allocation [level ] = allocation [x ]
828+ settings .switch_allocation [x ] = passthrough ["SlamLevels" ][x ]
758829
759830 settings .starting_kong_list = passthrough ["StartingKongs" ]
760831 settings .starting_kong = settings .starting_kong_list [0 ] # fake a starting kong so that we don't force a different kong
0 commit comments