Skip to content

Commit

Permalink
Merge pull request #1 from gaithernOrg/dev
Browse files Browse the repository at this point in the history
Complete Overhaul
  • Loading branch information
gaithern authored Mar 7, 2024
2 parents 13cba4f + 2586d4e commit 3497e47
Show file tree
Hide file tree
Showing 7 changed files with 786 additions and 674 deletions.
15 changes: 15 additions & 0 deletions worlds/khrecom/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ def on_package(self, cmd: str, args: dict):
with open(os.path.join(self.game_communication_path, "worldorder.cfg"), 'w') as f:
f.write(str(world_order))
f.close()
if "Zeroes" in list(args['slot_data'].keys()):
zeroes_str = args['slot_data']["Zeroes"]
else:
zeroes_str = "Yes"
if zeroes_str == "No":
with open(os.path.join(self.game_communication_path, "nozeroes.cfg"), 'w') as f:
f.write("")
f.close()
if "Attack Power" in list(args['slot_data'].keys()):
attack_power = args['slot_data']["Attack Power"]
else:
attack_power = 10
with open(os.path.join(self.game_communication_path, "attackpower.cfg"), 'w') as f:
f.write(str(attack_power))
f.close()
if cmd in {"ReceivedItems"}:
start_index = args["index"]
if start_index != len(self.items_received):
Expand Down
442 changes: 194 additions & 248 deletions worlds/khrecom/Items.py

Large diffs are not rendered by default.

495 changes: 273 additions & 222 deletions worlds/khrecom/Locations.py

Large diffs are not rendered by default.

33 changes: 11 additions & 22 deletions worlds/khrecom/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

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

class Zeroes(DefaultOnToggle):
"""
Toggle whether 0 value cards should be included in the item pool.
"""
display_name = "Zeroes"

class Cure(DefaultOnToggle):
"""
Toggle whether Cure cards should be included in the item pool.
Expand All @@ -20,17 +14,20 @@ class EarlyCure(DefaultOnToggle):
"""
display_name = "Early Cure"

class EnemyCards(DefaultOnToggle):
class Zeroes(DefaultOnToggle):
"""
Toggle whether Enemy Cards should be included in the item pool.
Toggle whether 0 value cards are included in card sets
"""
display_name = "Enemy Cards"
display_name = "Zeroes"

class DaysItems(Toggle):
class AttackPower(Range):
"""
Toggle whether items not available to the player until they watch 358/2 Days are included in the item pool.
Modifier for Sora's strike power. Default is 10
"""
display_name = "Days Items"
display_name = "Attack Power"
range_start = 1
range_end = 100
default = 10

class DaysLocations(Toggle):
"""
Expand All @@ -49,12 +46,6 @@ class ChecksBehindMinigames(Toggle):
Toggle whether to include checks behind 100 Acre Woods Minigames.
"""
display_name = "Checks Behind Minigames"

class ChecksBehindSleights(Toggle):
"""
Toggle whether to include checks behind Sleights.
"""
display_name = "Checks Behind Sleights"

class ChecksBehindSleightsLevels(Toggle):
"""
Expand All @@ -73,14 +64,12 @@ class EXPMultiplier(Range):

@dataclass
class KHRECOMOptions(PerGameCommonOptions):
zeroes: Zeroes
cure: Cure
early_cure: EarlyCure
enemy_cards: EnemyCards
days_items: DaysItems
days_locations: DaysLocations
checks_behind_leon: ChecksBehindLeon
exp_multiplier: EXPMultiplier
minigames: ChecksBehindMinigames
sleights: ChecksBehindSleights
levels: ChecksBehindSleightsLevels
zeroes: Zeroes
attack_power: AttackPower
297 changes: 179 additions & 118 deletions worlds/khrecom/Regions.py

Large diffs are not rendered by default.

153 changes: 101 additions & 52 deletions worlds/khrecom/Rules.py

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions worlds/khrecom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def create_items(self):
if i < 3:
self.multiworld.get_location(starting_locations[i], self.player).place_locked_item(self.create_item(starting_worlds[i]))
elif i == 3 and self.options.early_cure:
self.multiworld.get_location(starting_locations[i], self.player).place_locked_item(self.create_item("Card Set Cure 4-6"))
self.multiworld.get_location(starting_locations[i], self.player).place_locked_item(self.create_item("Card Set Cure"))
i = i + 1
total_locations = len(self.multiworld.get_unfilled_locations(self.player))
for name, data in item_table.items():
quantity = data.max_quantity

# Ignore filler, it will be added in a later stage.
if data.category not in ["World Unlocks", "Gold Map Cards", "Friend Cards"]:
if data.category not in ["World Unlocks", "Gold Map Cards", "Friend Cards", "Enemy Cards", "Sleights"]:
continue
if name not in starting_worlds:
item_pool += [self.create_item(name) for _ in range(0, quantity)]
Expand All @@ -91,21 +91,17 @@ def create_items(self):
attempts = attempts + 1

self.multiworld.itempool += item_pool

print("Total Locations: " + str(total_locations))
print("Item Pool Length: " + str(len(item_pool)))

def get_filler_item_name(self) -> str:
fillers = {}
disclude = []
if not self.options.zeroes:
disclude.append("0")
if not self.options.cure:
disclude.append("Cure")
if self.options.early_cure:
disclude.append("Cure 4-6")
if self.options.enemy_cards:
fillers.update(get_items_by_category("Enemy Cards", disclude))
if self.options.days_items:
fillers.update(get_items_by_category("Days Sets", disclude))
fillers.update(get_items_by_category("Days Enemy Cards", disclude))
disclude.append("Cure")
fillers.update(get_items_by_category("Sets", disclude))
weights = [data.weight for data in fillers.values()]
return self.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]
Expand All @@ -126,12 +122,17 @@ def create_regions(self):

def fill_slot_data(self) -> dict:
self.decide_world_order()
zeroes_string = "Yes"
world_order_string = ""
for world_id in self.world_order:
world_order_string = world_order_string + str(world_id) + ","
world_order_string = world_order_string[:-1]
slot_data = {"EXP Multiplier": int(self.options.exp_multiplier)
,"World Order": world_order_string}
if not self.options.zeroes:
zeroes_string = "No"
slot_data = {"EXP Multiplier": int(self.options.exp_multiplier)
,"World Order": world_order_string
,"Zeroes": zeroes_string
,"Attack Power": int(self.options.attack_power)}
return slot_data

def decide_world_order(self):
Expand Down

0 comments on commit 3497e47

Please sign in to comment.