LTTP: fix open pyramid for real this time (#1393)

This commit is contained in:
alwaysintreble 2023-01-19 09:17:16 -06:00 committed by GitHub
parent f6616da5a9
commit 29e1c3dcf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 2 deletions

View File

@ -169,6 +169,9 @@ class WorldTestBase(unittest.TestCase):
def can_reach_location(self, location: str) -> bool: def can_reach_location(self, location: str) -> bool:
return self.multiworld.state.can_reach(location, "Location", 1) return self.multiworld.state.can_reach(location, "Location", 1)
def can_reach_entrance(self, entrance: str) -> bool:
return self.multiworld.state.can_reach(entrance, "Entrance", 1)
def count(self, item_name: str) -> int: def count(self, item_name: str) -> int:
return self.multiworld.state.count(item_name, 1) return self.multiworld.state.count(item_name, 1)

View File

@ -20,7 +20,7 @@ def GetBeemizerItem(world, player: int, item):
# should be replaced with direct world.create_item(item) call in the future # should be replaced with direct world.create_item(item) call in the future
def ItemFactory(items, player: int): def ItemFactory(items: typing.Union[str, typing.Iterable[str]], player: int):
from worlds.alttp import ALTTPWorld from worlds.alttp import ALTTPWorld
world = ALTTPWorld(None, player) world = ALTTPWorld(None, player)
ret = [] ret = []

View File

@ -526,7 +526,7 @@ def default_rules(world, player):
set_rule(world.get_entrance('Floating Island Mirror Spot', player), lambda state: state.has('Magic Mirror', player)) set_rule(world.get_entrance('Floating Island Mirror Spot', player), lambda state: state.has('Magic Mirror', player))
set_rule(world.get_entrance('Turtle Rock', player), lambda state: state.has('Moon Pearl', player) and state.has_sword(player) and state.has_turtle_rock_medallion(player) and state.can_reach('Turtle Rock (Top)', 'Region', player)) # sword required to cast magic (!) set_rule(world.get_entrance('Turtle Rock', player), lambda state: state.has('Moon Pearl', player) and state.has_sword(player) and state.has_turtle_rock_medallion(player) and state.can_reach('Turtle Rock (Top)', 'Region', player)) # sword required to cast magic (!)
set_rule(world.get_entrance('Pyramid Hole', player), lambda state: state.has('Beat Agahnim 2', player) or world.open_pyramid[player]) set_rule(world.get_entrance('Pyramid Hole', player), lambda state: state.has('Beat Agahnim 2', player) or world.open_pyramid[player].to_bool(world, player))
if world.swordless[player]: if world.swordless[player]:
swordless_rules(world, player) swordless_rules(world, player)

View File

@ -0,0 +1,37 @@
from test.TestBase import WorldTestBase
from ...Items import ItemFactory
class PyramidTestBase(WorldTestBase):
game = "A Link to the Past"
class OpenPyramidTest(PyramidTestBase):
options = {
"open_pyramid": "open"
}
def testAccess(self):
self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"])
self.assertTrue(self.can_reach_entrance("Pyramid Hole"))
class GoalPyramidTest(PyramidTestBase):
options = {
"open_pyramid": "goal"
}
def testCrystalsGoalAccess(self):
self.multiworld.goal[1] = "crystals"
self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"])
self.assertTrue(self.can_reach_entrance("Pyramid Hole"))
def testGanonGoalAccess(self):
self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.collect_by_name(["Hammer", "Progressive Glove", "Moon Pearl"])
self.assertFalse(self.can_reach_entrance("Pyramid Hole"))
self.multiworld.state.collect(ItemFactory("Beat Agahnim 2", 1))
self.assertTrue(self.can_reach_entrance("Pyramid Hole"))