Hollow Knight June 2022 Updates (#720)
This is a combined PR for assorted Hollow Knight updates for June 2022 that have cleared testing. It supersedes any HK-exclusive PRs open by myself or @Alchav unless stated otherwise. Summary of changes below: * Implement Split Claw, Split Cloak, Split Superdash, Randomize Nail, Randomize Focus, Randomize Swim and Elevator * Pass options (@Alchav) * Add support for Deathlink with three different modes (@dewiniaid) * Add customizable additional shop slots per-shop (@Alchav) and overall (@dewiniaid) * Overhaul shop cost output to be more generic and account for all locations with standard costs (such as Stag Stations, Cornifer, and Divine) (@dewiniaid) * Add "CostSanity", allowing random prices using any cost type to be chosen for any location with a cost. (e.g. a Stag station requiring 15 grubs to obtain an item) * Item classification fixes (Map and Journal items are fillter, Mask Shards/Pale Ore/Vessel Fragments are useful) (@Alchav) * Fix Ijii -> Jiji (@Alchav ) * General code quality updates The above changes are only for the HK world.
This commit is contained in:
@@ -1,50 +1,20 @@
|
||||
from ..generic.Rules import set_rule, add_rule
|
||||
# This module is written by Extractor.py, do not edit manually!.
|
||||
from functools import partial
|
||||
|
||||
units = {
|
||||
"Egg": "RANCIDEGGS",
|
||||
"Grub": "GRUBS",
|
||||
"Essence": "ESSENCE",
|
||||
"Charm": "CHARMS",
|
||||
}
|
||||
|
||||
|
||||
def hk_set_rule(hk_world, location: str, rule):
|
||||
count = hk_world.created_multi_locations[location]
|
||||
if count:
|
||||
locations = [f"{location}_{x}" for x in range(1, count+1)]
|
||||
elif (location, hk_world.player) in hk_world.world._location_cache:
|
||||
locations = [location]
|
||||
else:
|
||||
return
|
||||
for location in locations:
|
||||
set_rule(hk_world.world.get_location(location, hk_world.player), rule)
|
||||
|
||||
|
||||
def set_shop_prices(hk_world):
|
||||
def set_generated_rules(hk_world, hk_set_rule):
|
||||
player = hk_world.player
|
||||
for shop, unit in hk_world.shops.items():
|
||||
for i in range(1, 1 + hk_world.created_multi_locations[shop]):
|
||||
loc = hk_world.world.get_location(f"{shop}_{i}", hk_world.player)
|
||||
add_rule(loc, lambda state, unit=units[unit], cost=loc.cost: state.count(unit, player) >= cost)
|
||||
|
||||
|
||||
def set_rules(hk_world):
|
||||
player = hk_world.player
|
||||
world = hk_world.world
|
||||
fn = partial(hk_set_rule, hk_world)
|
||||
|
||||
# Events
|
||||
{% for location, rule_text in event_rules.items() %}
|
||||
hk_set_rule(hk_world, "{{location}}", lambda state: {{rule_text}})
|
||||
fn("{{location}}", lambda state: {{rule_text}})
|
||||
{%- endfor %}
|
||||
|
||||
# Locations
|
||||
{% for location, rule_text in location_rules.items() %}
|
||||
hk_set_rule(hk_world, "{{location}}", lambda state: {{rule_text}})
|
||||
fn("{{location}}", lambda state: {{rule_text}})
|
||||
{%- endfor %}
|
||||
|
||||
# Shop prices
|
||||
set_shop_prices(hk_world)
|
||||
|
||||
# Connectors
|
||||
{% for entrance, rule_text in connectors_rules.items() %}
|
||||
rule = lambda state: {{rule_text}}
|
||||
@@ -54,4 +24,4 @@ def set_rules(hk_world):
|
||||
world.get_entrance("{{entrance}}_R", player).access_rule = lambda state, entrance= entrance: \
|
||||
rule(state) and entrance.can_reach(state)
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
{%- endfor %}
|
||||
Reference in New Issue
Block a user