Skip to content

Commit

Permalink
Merge pull request #22 from gaithernOrg/dev
Browse files Browse the repository at this point in the history
Added XP Multiplier Options
  • Loading branch information
gaithern authored Jan 22, 2024
2 parents 6d53a7c + 91e77d1 commit 55ae070
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions worlds/kh1/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +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()
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
4 changes: 4 additions & 0 deletions worlds/kh1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def get_filler_item_name(self) -> str:
weights = [data.weight for data in fillers.values()]
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": int(self.options.exp_multiplier)/16}
return slot_data

def create_item(self, name: str) -> KH1Item:
data = item_table[name]
return KH1Item(name, data.classification, data.code, self.player)
Expand Down

0 comments on commit 55ae070

Please sign in to comment.