Core: use assert correctly (#345)

Core: add some more types to State and add count() method
This commit is contained in:
Fabian Dill
2022-03-26 01:12:54 +01:00
committed by GitHub
parent 902472be32
commit 64ac619b46
6 changed files with 20 additions and 17 deletions

View File

@@ -2242,7 +2242,7 @@ def crossed_shuffle_dungeons(world, player: int):
connect_caves(world, dungeon_entrances, [], [('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)')], player)
connect_caves(world, dungeon_entrances, [], dungeon_exits, player)
assert not dungeon_exits # make sure all exits are accounted for
assert not dungeon_exits , "make sure all exits are accounted for"
def inverted_crossed_shuffle_dungeons(world, player: int):
@@ -2293,7 +2293,7 @@ def inverted_crossed_shuffle_dungeons(world, player: int):
connect_mandatory_exits(world, dungeon_entrances, dungeon_exits, lw_dungeon_entrances_must_exit, player)
connect_caves(world, dungeon_entrances, [], dungeon_exits, player)
assert not dungeon_exits # make sure all exits are accounted for
assert not dungeon_exits, "make sure all exits are accounted for"
def unbias_some_entrances(world, Dungeon_Exits, Cave_Exits, Old_Man_House, Cave_Three_Exits):
def shuffle_lists_in_list(ls):

View File

@@ -545,7 +545,7 @@ def get_pool_core(world, player: int):
pool.extend(diff.alwaysitems)
def place_item(loc, item):
assert loc not in placed_items
assert loc not in placed_items, "cannot place item twice"
placed_items[loc] = item
# provide boots to major glitch dependent seeds
@@ -681,7 +681,7 @@ def make_custom_item_pool(world, player):
treasure_hunt_icon = None
def place_item(loc, item):
assert loc not in placed_items
assert loc not in placed_items, "cannot place item twice"
placed_items[loc] = item
# Correct for insanely oversized item counts and take initial steps to handle undersized pools.

View File

@@ -419,7 +419,7 @@ progressive_technology_table: Dict[str, Technology] = {}
for root in sorted_rows:
progressive = progressive_rows[root]
assert all(tech in tech_table for tech in progressive)
assert all(tech in tech_table for tech in progressive), "declared a progressive technology without base technology"
factorio_id += 1
progressive_technology = Technology(root, technology_table[progressive_rows[root][0]].ingredients, factorio_id,
progressive,