 8870b577d0
			
		
	
	8870b577d0
	
	
	
		
			
			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.
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from ..generic.Rules import set_rule, add_rule
 | |
| from BaseClasses import MultiWorld
 | |
| from ..AutoWorld import World
 | |
| from .GeneratedRules import set_generated_rules
 | |
| from typing import NamedTuple
 | |
| 
 | |
| 
 | |
| class CostTerm(NamedTuple):
 | |
|     term: str
 | |
|     option: str
 | |
|     singular: str
 | |
|     plural: str
 | |
|     weight: int  # CostSanity
 | |
|     sort: int
 | |
| 
 | |
| 
 | |
| cost_terms = {x.term: x for x in (
 | |
|     CostTerm("RANCIDEGGS", "Egg", "Rancid Egg", "Rancid Eggs", 1, 3),
 | |
|     CostTerm("GRUBS", "Grub", "Grub", "Grubs", 1, 2),
 | |
|     CostTerm("ESSENCE", "Essence", "Essence", "Essence", 1, 4),
 | |
|     CostTerm("CHARMS", "Charm", "Charm", "Charms", 1, 1),
 | |
|     CostTerm("GEO", "Geo", "Geo", "Geo", 8, 9999),
 | |
| )}
 | |
| 
 | |
| 
 | |
| def hk_set_rule(hk_world: World, location: str, rule):
 | |
|     player = hk_world.player
 | |
| 
 | |
|     locations = hk_world.created_multi_locations.get(location)
 | |
|     if locations is None:
 | |
|         try:
 | |
|             locations = [hk_world.world.get_location(location, player)]
 | |
|         except KeyError:
 | |
|             return
 | |
| 
 | |
|     for location in locations:
 | |
|         set_rule(location, rule)
 | |
| 
 | |
| 
 | |
| def set_rules(hk_world: World):
 | |
|     player = hk_world.player
 | |
|     world = hk_world.world
 | |
|     set_generated_rules(hk_world, hk_set_rule)
 | |
| 
 | |
|     # Shop costs
 | |
|     for region in world.get_regions(player):
 | |
|         for location in region.locations:
 | |
|             if location.costs:
 | |
|                 for term, amount in location.costs.items():
 | |
|                     if term == "GEO":  # No geo logic!
 | |
|                         continue
 | |
|                     add_rule(location, lambda state, term=term, amount=amount: state.count(term, player) >= amount)
 |