Skip to content

Commit df5b50e

Browse files
authored
Merge pull request ArchipelagoMW#10 from dewiniaid/hk-costsanity
Hk costsanity updates and bugfixes
2 parents 015e331 + 35272a3 commit df5b50e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

worlds/hk/Options.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,21 @@ class StartingGeo(Range):
426426
default = 0
427427

428428

429-
class CostSanity(Toggle):
429+
class CostSanity(Choice):
430430
"""If enabled, most locations with costs (like stag stations) will have randomly determined costs.
431+
If set to shopsonly, CostSanity will only apply to shops (including Grubfather, Seer and Egg Shop).
432+
If set to notshops, CostSanity will only apply to non-shops (e.g. Stag stations and Cornifer locations)
431433
432434
These costs can be in Geo (except Grubfather, Seer and Eggshop), Grubs, Charms, Essence and/or Rancid Eggs
433435
"""
436+
option_off = 0
437+
alias_false = 0
438+
alias_no = 0
439+
option_on = 1
440+
alias_true = 1
441+
alias_yes = 1
442+
option_shopsonly = 2
443+
option_notshops = 3
434444
display_name = "Cost Sanity"
435445

436446

@@ -446,7 +456,7 @@ class CostSanityHybridChance(Range):
446456
extra_data = {
447457
"__module__": __name__, "range_end": 1000,
448458
"__doc__": (
449-
"The likelihood of Costsanity choosing a {cost.option} cost."
459+
f"The likelihood of Costsanity choosing a {cost.option} cost."
450460
" Chosen as a sum of all weights from other types."
451461
),
452462
"default": cost.weight

worlds/hk/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .Items import item_table, lookup_type_to_names, item_name_groups
1212
from .Regions import create_regions
1313
from .Rules import set_rules, cost_terms
14-
from .Options import hollow_knight_options, hollow_knight_randomize_options, Goal, WhitePalace, \
14+
from .Options import hollow_knight_options, hollow_knight_randomize_options, Goal, WhitePalace, CostSanity, \
1515
shop_to_option
1616
from .ExtractedData import locations, starts, multi_locations, location_to_region_lookup, \
1717
event_names, item_effects, connectors, one_ways, vanilla_shop_costs, vanilla_location_costs
@@ -339,7 +339,8 @@ def sort_shops_by_cost(self):
339339
loc.costs = costs
340340

341341
def apply_costsanity(self):
342-
if not self.world.CostSanity[self.player].value:
342+
setting = self.world.CostSanity[self.player].value
343+
if not setting:
343344
return # noop
344345

345346
def _compute_weights(weights: dict, desc: str) -> typing.Dict[str, int]:
@@ -382,7 +383,10 @@ def _compute_weights(weights: dict, desc: str) -> typing.Dict[str, int]:
382383
continue
383384
if location.name == "Vessel_Fragment-Basin":
384385
continue
385-
386+
if setting == CostSanity.option_notshops and location.basename in multi_locations:
387+
continue
388+
if setting == CostSanity.option_shopsonly and location.basename not in multi_locations:
389+
continue
386390
if location.basename in {'Grubfather', 'Seer', 'Eggshop'}:
387391
our_weights = dict(weights_geoless)
388392
else:

0 commit comments

Comments
 (0)