Update dungeon tests to work with the new exploration algorithm
This commit is contained in:
parent
195f6c86d2
commit
d6dc559ed6
|
@ -13,7 +13,8 @@ class TestDungeon(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.world = World(1, {1:'vanilla'}, {1:'noglitches'}, {1:'open'}, {1:'random'}, {1:'normal'}, {1:'normal'}, {1:False}, {1:'on'}, {1:'ganon'}, 'balanced', {1:'items'},
|
self.world = World(1, {1:'vanilla'}, {1:'noglitches'}, {1:'open'}, {1:'random'}, {1:'normal'}, {1:'normal'}, {1:False}, {1:'on'}, {1:'ganon'}, 'balanced', {1:'items'},
|
||||||
True, {1:False}, False, None, {1:False})
|
True, {1:False}, False, None, {1:False})
|
||||||
self.starting_regions = []
|
self.starting_regions = [] # Where to start exploring
|
||||||
|
self.remove_exits = [] # Block dungeon exits
|
||||||
self.world.difficulty_requirements[1] = difficulties['normal']
|
self.world.difficulty_requirements[1] = difficulties['normal']
|
||||||
create_regions(self.world, 1)
|
create_regions(self.world, 1)
|
||||||
create_dungeons(self.world, 1)
|
create_dungeons(self.world, 1)
|
||||||
|
@ -21,6 +22,7 @@ class TestDungeon(unittest.TestCase):
|
||||||
for exitname, regionname in mandatory_connections:
|
for exitname, regionname in mandatory_connections:
|
||||||
connect_simple(self.world, exitname, regionname, 1)
|
connect_simple(self.world, exitname, regionname, 1)
|
||||||
connect_simple(self.world, 'Big Bomb Shop', 'Big Bomb Shop', 1)
|
connect_simple(self.world, 'Big Bomb Shop', 'Big Bomb Shop', 1)
|
||||||
|
self.world.get_region('Menu', 1).exits = []
|
||||||
self.world.swamp_patch_required[1] = True
|
self.world.swamp_patch_required[1] = True
|
||||||
set_rules(self.world, 1)
|
set_rules(self.world, 1)
|
||||||
generate_itempool(self.world, 1)
|
generate_itempool(self.world, 1)
|
||||||
|
@ -28,8 +30,8 @@ class TestDungeon(unittest.TestCase):
|
||||||
self.world.itempool.extend(ItemFactory(['Green Pendant', 'Red Pendant', 'Blue Pendant', 'Beat Agahnim 1', 'Beat Agahnim 2', 'Crystal 1', 'Crystal 2', 'Crystal 3', 'Crystal 4', 'Crystal 5', 'Crystal 6', 'Crystal 7'], 1))
|
self.world.itempool.extend(ItemFactory(['Green Pendant', 'Red Pendant', 'Blue Pendant', 'Beat Agahnim 1', 'Beat Agahnim 2', 'Crystal 1', 'Crystal 2', 'Crystal 3', 'Crystal 4', 'Crystal 5', 'Crystal 6', 'Crystal 7'], 1))
|
||||||
|
|
||||||
def run_tests(self, access_pool):
|
def run_tests(self, access_pool):
|
||||||
for region in self.starting_regions:
|
for exit in self.remove_exits:
|
||||||
self.world.get_region(region, 1).can_reach_private = lambda _: True
|
self.world.get_entrance(exit, 1).connected_region = self.world.get_region('Menu', 1)
|
||||||
|
|
||||||
for location, access, *item_pool in access_pool:
|
for location, access, *item_pool in access_pool:
|
||||||
items = item_pool[0]
|
items = item_pool[0]
|
||||||
|
@ -42,6 +44,14 @@ class TestDungeon(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
items = ItemFactory(items, 1)
|
items = ItemFactory(items, 1)
|
||||||
state = CollectionState(self.world)
|
state = CollectionState(self.world)
|
||||||
|
state.reachable_regions[1].add(self.world.get_region('Menu', 1))
|
||||||
|
for region_name in self.starting_regions:
|
||||||
|
region = self.world.get_region(region_name, 1)
|
||||||
|
state.reachable_regions[1].add(region)
|
||||||
|
for exit in region.exits:
|
||||||
|
if exit.connected_region is not None:
|
||||||
|
state.blocked_connections[1].add(exit)
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
item.advancement = True
|
item.advancement = True
|
||||||
state.collect(item)
|
state.collect(item)
|
||||||
|
|
|
@ -42,6 +42,7 @@ class TestSkullWoods(TestDungeon):
|
||||||
|
|
||||||
def testSkullWoodsLeftOnly(self):
|
def testSkullWoodsLeftOnly(self):
|
||||||
self.starting_regions = ['Skull Woods First Section (Left)']
|
self.starting_regions = ['Skull Woods First Section (Left)']
|
||||||
|
self.remove_exits = ['Skull Woods First Section Exit']
|
||||||
self.run_tests([
|
self.run_tests([
|
||||||
["Skull Woods - Big Chest", False, []],
|
["Skull Woods - Big Chest", False, []],
|
||||||
["Skull Woods - Big Chest", False, [], ['Never in logic']],
|
["Skull Woods - Big Chest", False, [], ['Never in logic']],
|
||||||
|
@ -59,6 +60,7 @@ class TestSkullWoods(TestDungeon):
|
||||||
|
|
||||||
def testSkullWoodsBackOnly(self):
|
def testSkullWoodsBackOnly(self):
|
||||||
self.starting_regions = ['Skull Woods First Section (Top)']
|
self.starting_regions = ['Skull Woods First Section (Top)']
|
||||||
|
self.remove_exits = ['Skull Woods First Section Exit']
|
||||||
self.run_tests([
|
self.run_tests([
|
||||||
["Skull Woods - Big Chest", False, []],
|
["Skull Woods - Big Chest", False, []],
|
||||||
["Skull Woods - Big Chest", False, [], ['Big Key (Skull Woods)']],
|
["Skull Woods - Big Chest", False, [], ['Big Key (Skull Woods)']],
|
||||||
|
@ -81,6 +83,7 @@ class TestSkullWoods(TestDungeon):
|
||||||
|
|
||||||
def testSkullWoodsMiddle(self):
|
def testSkullWoodsMiddle(self):
|
||||||
self.starting_regions = ['Skull Woods Second Section']
|
self.starting_regions = ['Skull Woods Second Section']
|
||||||
|
self.remove_exits = ['Skull Woods Second Section Exit (East)', 'Skull Woods Second Section Exit (West)']
|
||||||
self.run_tests([["Skull Woods - Big Key Chest", True, []]])
|
self.run_tests([["Skull Woods - Big Key Chest", True, []]])
|
||||||
|
|
||||||
def testSkullWoodsBack(self):
|
def testSkullWoodsBack(self):
|
||||||
|
|
Loading…
Reference in New Issue