TUNIC: Some cleanup (#3115)

This commit is contained in:
Scipio Wright 2024-04-13 20:06:06 -04:00 committed by GitHub
parent 3d5c21cec5
commit fb3035a78b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 13 deletions

View File

@ -125,7 +125,7 @@ class TunicWorld(World):
item_table[filler].classification == ItemClassification.filler] item_table[filler].classification == ItemClassification.filler]
# Remove filler to make room for other items # Remove filler to make room for other items
def remove_filler(amount: int): def remove_filler(amount: int) -> None:
for _ in range(0, amount): for _ in range(0, amount):
if not available_filler: if not available_filler:
fill = "Fool Trap" fill = "Fool Trap"
@ -231,7 +231,7 @@ class TunicWorld(World):
def get_filler_item_name(self) -> str: def get_filler_item_name(self) -> str:
return self.random.choice(filler_items) return self.random.choice(filler_items)
def extend_hint_information(self, hint_data: Dict[int, Dict[int, str]]): def extend_hint_information(self, hint_data: Dict[int, Dict[int, str]]) -> None:
if self.options.entrance_rando: if self.options.entrance_rando:
hint_data.update({self.player: {}}) hint_data.update({self.player: {}})
# all state seems to have efficient paths # all state seems to have efficient paths

View File

@ -991,7 +991,7 @@ def set_er_region_rules(world: "TunicWorld", ability_unlocks: Dict[str, int], re
# connecting the regions portals are in to other portals you can access via ladder storage # connecting the regions portals are in to other portals you can access via ladder storage
# using has_stick instead of can_ladder_storage since it's already checking the logic rules # using has_stick instead of can_ladder_storage since it's already checking the logic rules
if options.logic_rules == "unrestricted": if options.logic_rules == "unrestricted":
def get_portal_info(portal_sd: str) -> (str, str): def get_portal_info(portal_sd: str) -> Tuple[str, str]:
for portal1, portal2 in portal_pairs.items(): for portal1, portal2 in portal_pairs.items():
if portal1.scene_destination() == portal_sd: if portal1.scene_destination() == portal_sd:
return portal1.name, portal2.region return portal1.name, portal2.region

View File

@ -22,13 +22,13 @@ class TunicERLocation(Location):
def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]: def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]:
regions: Dict[str, Region] = {} regions: Dict[str, Region] = {}
if world.options.entrance_rando: if world.options.entrance_rando:
portal_pairs: Dict[Portal, Portal] = pair_portals(world) portal_pairs = pair_portals(world)
# output the entrances to the spoiler log here for convenience # output the entrances to the spoiler log here for convenience
for portal1, portal2 in portal_pairs.items(): for portal1, portal2 in portal_pairs.items():
world.multiworld.spoiler.set_entrance(portal1.name, portal2.name, "both", world.player) world.multiworld.spoiler.set_entrance(portal1.name, portal2.name, "both", world.player)
else: else:
portal_pairs: Dict[Portal, Portal] = vanilla_portals() portal_pairs = vanilla_portals()
for region_name, region_data in tunic_er_regions.items(): for region_name, region_data in tunic_er_regions.items():
regions[region_name] = Region(region_name, world.player, world.multiworld) regions[region_name] = Region(region_name, world.player, world.multiworld)

View File

@ -3,4 +3,4 @@ from test.bases import WorldTestBase
class TunicTestBase(WorldTestBase): class TunicTestBase(WorldTestBase):
game = "TUNIC" game = "TUNIC"
player: int = 1 player = 1

View File

@ -4,14 +4,14 @@ from .. import options
class TestAccess(TunicTestBase): class TestAccess(TunicTestBase):
# test whether you can get into the temple without laurels # test whether you can get into the temple without laurels
def test_temple_access(self): def test_temple_access(self) -> None:
self.collect_all_but(["Hero's Laurels", "Lantern"]) self.collect_all_but(["Hero's Laurels", "Lantern"])
self.assertFalse(self.can_reach_location("Sealed Temple - Page Pickup")) self.assertFalse(self.can_reach_location("Sealed Temple - Page Pickup"))
self.collect_by_name(["Lantern"]) self.collect_by_name(["Lantern"])
self.assertTrue(self.can_reach_location("Sealed Temple - Page Pickup")) self.assertTrue(self.can_reach_location("Sealed Temple - Page Pickup"))
# test that the wells function properly. Since fairies is written the same way, that should succeed too # test that the wells function properly. Since fairies is written the same way, that should succeed too
def test_wells(self): def test_wells(self) -> None:
self.collect_all_but(["Golden Coin"]) self.collect_all_but(["Golden Coin"])
self.assertFalse(self.can_reach_location("Coins in the Well - 3 Coins")) self.assertFalse(self.can_reach_location("Coins in the Well - 3 Coins"))
self.collect_by_name(["Golden Coin"]) self.collect_by_name(["Golden Coin"])
@ -22,7 +22,7 @@ class TestStandardShuffle(TunicTestBase):
options = {options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true} options = {options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true}
# test that you need to get holy cross to open the hc door in overworld # test that you need to get holy cross to open the hc door in overworld
def test_hc_door(self): def test_hc_door(self) -> None:
self.assertFalse(self.can_reach_location("Fountain Cross Door - Page Pickup")) self.assertFalse(self.can_reach_location("Fountain Cross Door - Page Pickup"))
self.collect_by_name("Pages 42-43 (Holy Cross)") self.collect_by_name("Pages 42-43 (Holy Cross)")
self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup")) self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup"))
@ -33,7 +33,7 @@ class TestHexQuestShuffle(TunicTestBase):
options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true} options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true}
# test that you need the gold questagons to open the hc door in overworld # test that you need the gold questagons to open the hc door in overworld
def test_hc_door_hex_shuffle(self): def test_hc_door_hex_shuffle(self) -> None:
self.assertFalse(self.can_reach_location("Fountain Cross Door - Page Pickup")) self.assertFalse(self.can_reach_location("Fountain Cross Door - Page Pickup"))
self.collect_by_name("Gold Questagon") self.collect_by_name("Gold Questagon")
self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup")) self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup"))
@ -44,7 +44,7 @@ class TestHexQuestNoShuffle(TunicTestBase):
options.AbilityShuffling.internal_name: options.AbilityShuffling.option_false} options.AbilityShuffling.internal_name: options.AbilityShuffling.option_false}
# test that you can get the item behind the overworld hc door with nothing and no ability shuffle # test that you can get the item behind the overworld hc door with nothing and no ability shuffle
def test_hc_door_no_shuffle(self): def test_hc_door_no_shuffle(self) -> None:
self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup")) self.assertTrue(self.can_reach_location("Fountain Cross Door - Page Pickup"))
@ -52,7 +52,7 @@ class TestNormalGoal(TunicTestBase):
options = {options.HexagonQuest.internal_name: options.HexagonQuest.option_false} options = {options.HexagonQuest.internal_name: options.HexagonQuest.option_false}
# test that you need the three colored hexes to reach the Heir in standard # test that you need the three colored hexes to reach the Heir in standard
def test_normal_goal(self): def test_normal_goal(self) -> None:
location = ["The Heir"] location = ["The Heir"]
items = [["Red Questagon", "Blue Questagon", "Green Questagon"]] items = [["Red Questagon", "Blue Questagon", "Green Questagon"]]
self.assertAccessDependency(location, items) self.assertAccessDependency(location, items)
@ -63,7 +63,7 @@ class TestER(TunicTestBase):
options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true, options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true,
options.HexagonQuest.internal_name: options.HexagonQuest.option_false} options.HexagonQuest.internal_name: options.HexagonQuest.option_false}
def test_overworld_hc_chest(self): def test_overworld_hc_chest(self) -> None:
# test to see that static connections are working properly -- this chest requires holy cross and is in Overworld # test to see that static connections are working properly -- this chest requires holy cross and is in Overworld
self.assertFalse(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross")) self.assertFalse(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross"))
self.collect_by_name(["Pages 42-43 (Holy Cross)"]) self.collect_by_name(["Pages 42-43 (Holy Cross)"])