add a HK game completion rule
This commit is contained in:
parent
fe17fc6320
commit
a248fd5f94
|
@ -133,6 +133,7 @@ class MultiWorld():
|
|||
set_player_attr('plando_texts', {})
|
||||
set_player_attr('plando_connections', [])
|
||||
set_player_attr('game', "A Link to the Past")
|
||||
set_player_attr('completion_condition', lambda state: True)
|
||||
|
||||
self.worlds = []
|
||||
#for i in range(players):
|
||||
|
@ -374,7 +375,7 @@ class MultiWorld():
|
|||
|
||||
def has_beaten_game(self, state, player: Optional[int] = None):
|
||||
if player:
|
||||
return state.has('Triforce', player) or state.world.logic[player] == 'nologic'
|
||||
return self.completion_condition[player](state)
|
||||
else:
|
||||
return all((self.has_beaten_game(state, p) for p in range(1, self.players + 1)))
|
||||
|
||||
|
|
8
Main.py
8
Main.py
|
@ -1,4 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
import copy
|
||||
from itertools import zip_longest
|
||||
import logging
|
||||
|
@ -23,7 +22,7 @@ from Fill import distribute_items_restrictive, flood_items, balance_multiworld_p
|
|||
from worlds.alttp.Shops import create_shops, ShopSlotFill, SHOP_ID_START, total_shop_slots, FillDisabledShopSlots
|
||||
from worlds.alttp.ItemPool import generate_itempool, difficulties, fill_prizes
|
||||
from Utils import output_path, parse_player_names, get_options, __version__, _version_tuple
|
||||
from worlds.hk import *
|
||||
from worlds.hk import gen_hollow, gen_regions, set_rules as set_hk_rules
|
||||
import Patch
|
||||
|
||||
seeddigits = 20
|
||||
|
@ -466,7 +465,7 @@ def main(args, seed=None):
|
|||
multidata_task = pool.submit(write_multidata, rom_futures)
|
||||
if not check_accessibility_task.result():
|
||||
if not world.can_beat_game():
|
||||
raise Exception("Game appears is unbeatable. Aborting.")
|
||||
raise Exception("Game appears as unbeatable. Aborting.")
|
||||
else:
|
||||
logger.warning("Location Accessibility requirements not fulfilled.")
|
||||
if not args.skip_playthrough:
|
||||
|
@ -585,6 +584,9 @@ def copy_world(world):
|
|||
for player in world.alttp_player_ids:
|
||||
set_rules(ret, player)
|
||||
|
||||
for player in world.hk_player_ids:
|
||||
set_hk_rules(ret, player)
|
||||
|
||||
|
||||
return ret
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ def set_rules(world, player):
|
|||
if world.logic[player] == 'nologic':
|
||||
logging.info(
|
||||
'WARNING! Seeds generated under this logic often require major glitches and may be impossible!')
|
||||
|
||||
if world.players == 1:
|
||||
world.get_region('Menu', player).can_reach_private = lambda state: True
|
||||
no_logic_rules(world, player)
|
||||
|
@ -25,6 +26,9 @@ def set_rules(world, player):
|
|||
world.accessibility[player] = 'none'
|
||||
world.progression_balancing[player] = False
|
||||
|
||||
else:
|
||||
world.completion_condition[player] = lambda state: state.has('Triforce', player)
|
||||
|
||||
global_rules(world, player)
|
||||
dungeon_boss_rules(world, player)
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ class HKLocation(Location):
|
|||
super(HKLocation, self).__init__(player, name, address, parent)
|
||||
|
||||
class HKItem(Item):
|
||||
game = "Hollow Knight"
|
||||
|
||||
def __init__(self, name, advancement, code, player: int = None):
|
||||
super(HKItem, self).__init__(name, advancement, code, player)
|
||||
|
||||
|
@ -23,9 +25,15 @@ def gen_hollow(world: MultiWorld, player: int):
|
|||
gen_regions(world, player)
|
||||
link_regions(world, player)
|
||||
gen_items(world, player)
|
||||
set_rules(world, player)
|
||||
world.clear_location_cache()
|
||||
world.clear_entrance_cache()
|
||||
|
||||
def set_rules(world: MultiWorld, player: int):
|
||||
if world.logic[player] != 'nologic':
|
||||
world.completion_condition[player] = lambda state: state.has('Lurien', player) and \
|
||||
state.has('Monomon', player) and \
|
||||
state.has('Herrah', player)
|
||||
|
||||
def gen_regions(world: MultiWorld, player: int):
|
||||
world.regions += [
|
||||
|
@ -43,7 +51,6 @@ def gen_items(world: MultiWorld, player: int):
|
|||
for item_id, item_data in items.items():
|
||||
name = item_data["name"]
|
||||
item = HKItem(name, item_data["advancement"], item_id, player=player)
|
||||
item.game = "Hollow Knight"
|
||||
pool.append(item)
|
||||
world.itempool += pool
|
||||
|
||||
|
|
Loading…
Reference in New Issue