def test_taking_escape_stairs_ends_game(self): """ Test that player taking escape stairs will create escape """ model = self.character.model model.player = self.character portal3 = Portal((None, None), None) portal3.exits_dungeon = True add_portal(self.level1, (2, 2), portal3) self.character.location = (2, 2) pyherc.vtable['\ufdd0:move'](character=self.character, direction=Direction.enter) assert_that(model.end_condition, is_(equal_to(ESCAPED_DUNGEON)))
def add_portal(self, level): """ Add given stairs to the level :param level: level to modify :type level: Level """ locations = [x for x in get_locations_by_tag(level, self.location_type) if safe_passage(level, x)] if locations: location = self.rng.choice(locations) portal = Portal(icons=self.icons, level_generator_name=self.level_generator_name) portal.exits_dungeon = self.escape_stairs add_portal(level, location, portal)
def add_portal(self, level): """ Add given stairs to the level :param level: level to modify :type level: Level """ locations = [ x for x in get_locations_by_tag(level, self.location_type) if safe_passage(level, x) ] if locations: location = self.rng.choice(locations) portal = Portal(icons=self.icons, level_generator_name=self.level_generator_name) portal.exits_dungeon = self.escape_stairs add_portal(level, location, portal)