Skip to content

Commit

Permalink
Add Keyblade stat rando and fix Wayfinders on stickers
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Aug 25, 2024
1 parent ccb81f2 commit 6906352
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion worlds/khbbs/OpenKH.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 47 additions & 0 deletions worlds/khbbs/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
15 changes: 15 additions & 0 deletions worlds/khbbs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6906352

Please sign in to comment.