Skip to content

Commit

Permalink
Added XP Multiplier Options
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Jan 22, 2024
1 parent 9eb11ad commit 91e77d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 7 additions & 1 deletion worlds/kh1/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ def on_package(self, cmd: str, args: dict):
filename = f"send{ss}"
with open(os.path.join(self.game_communication_path, filename), 'w') as f:
f.close()
print("Slot Data: " + str(args['slot_data']))
if "EXP Multiplier" in list(args['slot_data'].keys()):
xp_mult = args['slot_data']["EXP Multiplier"]
else:
xp_mult = 1.0
with open(os.path.join(self.game_communication_path, "xpmult.cfg"), 'w') as f:
f.write(str(xp_mult))
f.close()

if cmd in {"ReceivedItems"}:
start_index = args["index"]
Expand Down
18 changes: 17 additions & 1 deletion worlds/kh1/Options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass

from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionSet, PerGameCommonOptions
from Options import NamedRange, Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionSet, PerGameCommonOptions

class StrengthIncrease(Range):
"""
Expand Down Expand Up @@ -82,6 +82,21 @@ class Goal(Choice):
option_postcards = 10
default = 0

class EXPMultiplier(NamedRange):
"""
Determines the multiplier to apply to EXP gained
"""
display_name = "EXP Multiplier"
default = 16
range_start = default / 2
range_end = 48
special_range_names = {
"half": default / 2,
"normal": default,
"double": default * 2,
"triple": default * 3,
}

@dataclass
class KH1Options(PerGameCommonOptions):
goal: Goal
Expand All @@ -93,3 +108,4 @@ class KH1Options(PerGameCommonOptions):
mp_increase: MPIncrease
accessory_slot_increase: AccessorySlotIncrease
item_slot_increase: ItemSlotIncrease
exp_multiplier: EXPMultiplier
2 changes: 1 addition & 1 deletion worlds/kh1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def get_filler_item_name(self) -> str:
return self.multiworld.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]

def fill_slot_data(self) -> dict:
slot_data = {"EXP Multiplier": 1.0}
slot_data = {"EXP Multiplier": int(self.options.exp_multiplier)/16}
return slot_data

def create_item(self, name: str) -> KH1Item:
Expand Down

0 comments on commit 91e77d1

Please sign in to comment.