diff --git a/worlds/khbbs/OpenKH.py b/worlds/khbbs/OpenKH.py index bcfdee2db168..ee50ed51f338 100644 --- a/worlds/khbbs/OpenKH.py +++ b/worlds/khbbs/OpenKH.py @@ -121,7 +121,7 @@ def get_sticker_replace(self): replace_stickers_str = replace_stickers_str + (" " * 7) + "WriteInt(field_item_address_pointer + (" + str(location_data.offset) + "), 0x" if self.player == location.item.player: item_data = item_table[location.item.name] - if item_data.category == "Key Item": + if item_data.category == "Key Item" and "Wayfinder" not in location.item.name: write_value = get_world_offset(location_data.category) + item_data.khbbsid replace_stickers_str = replace_stickers_str + write_value + ", true)\n" return replace_stickers_str diff --git a/worlds/khbbs/Options.py b/worlds/khbbs/Options.py index 380cca4b0fd1..b29c360a6a78 100644 --- a/worlds/khbbs/Options.py +++ b/worlds/khbbs/Options.py @@ -81,6 +81,48 @@ class MaxHPIncreases(Range): range_start = 0 range_end = 9 +class RandomizeKeybladeStats(Toggle): + """ + Determines if Keyblade stats should be randomized + """ + display_name = "Randomize Keyblade Stats" + +class KeybladeMinStrength(Range): + """ + Determines the minimum Strength bonus a keyblade can have. + """ + display_name = "Keyblade Minimum STR Bonus" + default = 2 + range_start = 2 + range_end = 10 + +class KeybladeMaxStrength(Range): + """ + Determines the maximum Strength bonus a keyblade can have. + """ + display_name = "Keyblade Maximum STR Bonus" + default = 10 + range_start = 10 + range_end = 10 + +class KeybladeMinMagic(Range): + """ + Determines the minimum Magic bonus a keyblade can have. + """ + display_name = "Keyblade Minimum MP Bonus" + default = -2 + range_start = -2 + range_end = 10 + +class KeybladeMaxMagic(Range): + """ + Determines the maximum Magic bonus a keyblade can have. + """ + display_name = "Keyblade Maximum MP Bonus" + default = 7 + range_start = -2 + range_end = 10 + @dataclass class KHBBSOptions(PerGameCommonOptions): character: Character @@ -91,3 +133,8 @@ class KHBBSOptions(PerGameCommonOptions): command_board: CommandBoard super_bosses: SuperBosses max_hp_increases: MaxHPIncreases + randomize_keyblade_stats: RandomizeKeybladeStats + keyblade_min_str: KeybladeMinStrength + keyblade_max_str: KeybladeMaxStrength + keyblade_min_mgc: KeybladeMinMagic + keyblade_max_mgc: KeybladeMaxMagic diff --git a/worlds/khbbs/__init__.py b/worlds/khbbs/__init__.py index e6956c9d8a82..b625e74384dd 100644 --- a/worlds/khbbs/__init__.py +++ b/worlds/khbbs/__init__.py @@ -110,6 +110,21 @@ def get_filler_item_name(self) -> str: def fill_slot_data(self) -> dict: slot_data = {"xpmult": int(self.options.exp_multiplier)/16, "non_remote_location_ids": self.get_non_remote_location_ids()} + if self.options.randomize_keyblade_stats: + min_str_bonus = min(self.options.keyblade_min_str.value, self.options.keyblade_max_str.value) + max_str_bonus = max(self.options.keyblade_min_str.value, self.options.keyblade_max_str.value) + self.options.keyblade_min_str.value = min_str_bonus + self.options.keyblade_max_str.value = max_str_bonus + min_mgc_bonus = min(self.options.keyblade_min_mgc.value, self.options.keyblade_max_mgc.value) + max_mgc_bonus = max(self.options.keyblade_min_mgc.value, self.options.keyblade_max_mgc.value) + self.options.keyblade_min_mgc.value = min_mgc_bonus + self.options.keyblade_max_mgc.value = max_mgc_bonus + slot_data["keyblade_stats"] = "" + for i in range(49): + str_bonus = int(self.random.randint(min_str_bonus, max_str_bonus)) + mgc_bonus = int(self.random.randint(min_mgc_bonus, max_mgc_bonus)) + slot_data["keyblade_stats"] = slot_data["keyblade_stats"] + str(str_bonus) + "," + str(mgc_bonus) + "," + slot_data["keyblade_stats"] = slot_data["keyblade_stats"][:-1] return slot_data def create_item(self, name: str) -> KHBBSItem: