HK: don't progression balance "Currency"-like progression items (#419)

* HK: don't progression balance "Currency"-like progression items

* only skip prog balancing on charms that don't unlock checks by themselves

Co-authored-by: Kono Tyran <HAklowner@gmail.com>
This commit is contained in:
Fabian Dill 2022-04-06 00:41:15 +02:00 committed by GitHub
parent d32d268d97
commit 491e6c8730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 8 deletions

18
Fill.py
View File

@ -310,24 +310,26 @@ def balance_multiworld_progression(world: MultiWorld) -> None:
# Define a threshold value based on the player with the most available locations. # Define a threshold value based on the player with the most available locations.
# If other players are below the threshold value, swap progression in this sphere into earlier spheres, # If other players are below the threshold value, swap progression in this sphere into earlier spheres,
# which gives more locations available by this sphere. # which gives more locations available by this sphere.
balanceable_players = {player for player in world.player_ids if world.progression_balancing[player]} balanceable_players: typing.Set[int] = {player for player in world.player_ids if world.progression_balancing[player]}
if not balanceable_players: if not balanceable_players:
logging.info('Skipping multiworld progression balancing.') logging.info('Skipping multiworld progression balancing.')
else: else:
logging.info(f'Balancing multiworld progression for {len(balanceable_players)} Players.') logging.info(f'Balancing multiworld progression for {len(balanceable_players)} Players.')
state = CollectionState(world) state: CollectionState = CollectionState(world)
checked_locations: typing.Set[Location] = set() checked_locations: typing.Set[Location] = set()
unchecked_locations = set(world.get_locations()) unchecked_locations: typing.Set[Location] = set(world.get_locations())
reachable_locations_count = { reachable_locations_count: typing.Dict[int, int] = {
player: 0 player: 0
for player in world.player_ids for player in world.player_ids
if len(world.get_filled_locations(player)) != 0 if len(world.get_filled_locations(player)) != 0
} }
total_locations_count = Counter(location.player for location in world.get_locations() if not location.locked) total_locations_count: Counter = Counter(location.player for location in world.get_locations() if
balanceable_players = {player for player in balanceable_players if total_locations_count[player]} not location.locked)
sphere_num = 1 balanceable_players = {player for player in balanceable_players if
moved_item_count = 0 total_locations_count[player]}
sphere_num: int = 1
moved_item_count: int = 0
def get_sphere_locations(sphere_state: CollectionState, def get_sphere_locations(sphere_state: CollectionState,
locations: typing.Set[Location]) -> typing.Set[Location]: locations: typing.Set[Location]) -> typing.Set[Location]:

View File

@ -75,6 +75,17 @@ white_palace_locations = {
} }
progression_charms = {
# Baulder Killers
"Grubberfly's_Elegy", "Weaversong", "Glowing_Womb",
# Spore Shroom spots in fungle wastes
"Spore_Shroom",
# Tuk gives egg,
"Defender's_Crest",
# Unlocks Grimm Troupe
"Grimmchild1", "Grimmchild2"
}
class HKWorld(World): class HKWorld(World):
"""Beneath the fading town of Dirtmouth sleeps a vast, ancient kingdom. Many are drawn beneath the surface, """Beneath the fading town of Dirtmouth sleeps a vast, ancient kingdom. Many are drawn beneath the surface,
@ -321,6 +332,12 @@ class HKItem(Item):
if name == "Mimic_Grub": if name == "Mimic_Grub":
self.trap = True self.trap = True
if type in ("Grub", "DreamWarrior", "Root", "Egg"):
self.skip_in_prog_balancing = True
if type == "Charm" and name not in progression_charms:
self.skip_in_prog_balancing = True
class HKLogicMixin(LogicMixin): class HKLogicMixin(LogicMixin):
world: MultiWorld world: MultiWorld