Implement (most) Hollow Knight Options

This commit is contained in:
Fabian Dill
2021-03-21 00:47:17 +01:00
parent 8c6c7bc575
commit f2a1858b59
7 changed files with 150 additions and 48 deletions

View File

@@ -33,8 +33,9 @@ class HKLocation(Location):
class HKItem(Item):
game = "Hollow Knight"
def __init__(self, name, advancement, code, player: int = None):
def __init__(self, name, advancement, code, type, player: int = None):
super(HKItem, self).__init__(name, advancement, code, player)
self.type = type
def gen_hollow(world: MultiWorld, player: int):
@@ -48,12 +49,33 @@ def gen_hollow(world: MultiWorld, player: int):
def link_regions(world: MultiWorld, player: int):
world.get_entrance('Hollow Nest S&Q', player).connect(world.get_region('Hollow Nest', player))
not_shufflable_types = {"Essence_Boss"}
option_to_type_lookup = {
"Root": "RandomizeWhisperingRoots",
"Dreamer": "RandomizeDreamers",
"Geo": "RandomizeGeoChests",
"Skill": "RandomizeSkills",
"Map": "RandomizeMaps",
"Relic": "RandomizeRelics",
"Charm": "RandomizeCharms",
"Notch": "RandomizeCharmNotches",
"Key": "RandomizeKeys",
"Stag": "RandomizeStags",
"Flame": "RandomizeFlames",
"Grub": "RandomizeGrubs",
"Cocoon": "RandomizeLifebloodCocoons",
"Mask": "RandomizeMaskShards",
"Ore": "RandomizePaleOre",
"Egg": "RandomizeRancidEggs",
"Vessel": "RandomizeVesselFragments",
}
def gen_items(world: MultiWorld, player: int):
pool = []
for item_name, item_data in item_table.items():
item = HKItem(item_name, item_data.advancement, item_data.id, player=player)
item = HKItem(item_name, item_data.advancement, item_data.id, item_data.type, player=player)
if item_data.type == "Event":
event_location = world.get_location(item_name, player)
@@ -62,10 +84,35 @@ def gen_items(world: MultiWorld, player: int):
event_location.locked = True
if item.name == "King's_Pass":
world.push_precollected(item)
elif item_data.type == "Cursed":
if world.CURSED[player]:
raise Exception("Cursed is not implemented yet.")
# implement toss_junk for HK first
else:
event_location = world.get_location(item_name, player)
world.push_item(event_location, item)
event_location.event = True
event_location.locked = True
world.push_precollected(item)
elif item_data.type == "Fake":
pass
elif item_data.type in not_shufflable_types:
location = world.get_location(item_name, player)
world.push_item(location, item)
location.event = item.advancement
location.locked = True
else:
pool.append(item)
target = option_to_type_lookup[item.type]
shuffle_it = getattr(world, target)
if shuffle_it[player]:
pool.append(item)
else:
location = world.get_location(item_name, player)
world.push_item(location, item)
location.event = item.advancement
location.locked = True
logger.debug(f"Placed {item_name} to vanilla for player {player}")
world.itempool += pool