Exemple #1
0
    def test_add_stairs_to_room(self):
        """
        Test that stairs can be added to a room
        """
        level = (LevelBuilder()
                 .with_size((20, 20))
                 .with_floor_tile(self.floor_rock)
                 .with_wall_tile(self.wall_empty)
                 .build())

        for loc_y in range(8, 12):
            for loc_x in range(8, 12):
                add_location_tag(level, (loc_x, loc_y), 'room')

        portal_adder = PortalAdder((1, 2),
                                   'room',
                                   mock(),
                                   False,
                                   self.rng)

        portal_adder.add_portal(level)

        portals = []
        for loc_y in range(8, 12):
            for loc_x in range(8, 12):
                temp = get_portal(level, (loc_x, loc_y))
                if temp:
                    portals.append(temp)

        assert_that(portals, has_length(1))
        portal = portals[0]
        assert_that(located_in_room(portal), is_(True))
    def test_add_stairs_to_room(self):
        """
        Test that stairs can be added to a room
        """
        level = (LevelBuilder().with_size((20, 20)).with_floor_tile(
            self.floor_rock).with_wall_tile(self.wall_empty).build())

        for loc_y in range(8, 12):
            for loc_x in range(8, 12):
                add_location_tag(level, (loc_x, loc_y), 'room')

        portal_adder = PortalAdder((1, 2), 'room', mock(), False, self.rng)

        portal_adder.add_portal(level)

        portals = []
        for loc_y in range(8, 12):
            for loc_x in range(8, 12):
                temp = get_portal(level, (loc_x, loc_y))
                if temp:
                    portals.append(temp)

        assert_that(portals, has_length(1))
        portal = portals[0]
        assert_that(located_in_room(portal), is_(True))
Exemple #3
0
    def test_adding_to_location(self):
        """
        Test that ItemAdder will use location types passed to it
        """
        potion = [x for x in get_items(self.level)
                  if x.name == 'red potion'][0]

        location = potion.location

        assert_that(located_in_room(potion))
Exemple #4
0
    def test_adding_to_location(self):
        """
        Test that ItemAdder will use location types passed to it
        """
        potion = [x for x in get_items(self.level)
                  if x.name == 'red potion'][0]

        location = potion.location

        assert_that(located_in_room(potion))
    def test_adding_to_location(self):
        """
        Test that CreatureAdder will use location types passed to it
        """
        dragon = [x for x in self.level.creatures
                  if x.name == 'dragon'][0]

        location = dragon.location

        assert_that(located_in_room(dragon))