Beispiel #1
0
    def test_wilderness_correct_exits(self):
        wilderness.create_wilderness()
        wilderness.enter_wilderness(self.char1)

        # By default we enter at a corner (0, 0), so only a few exits should
        # be visible / traversable
        exits = [i for i in self.char1.location.contents
                 if i.destination and (
                  i.access(self.char1, "view") or
                  i.access(self.char1, "traverse"))]

        self.assertEquals(len(exits), 3)
        exitsok = ["north", "northeast", "east"]
        for each_exit in exitsok:
            self.assertTrue(any([e for e in exits if e.key == each_exit]))

        # If we move to another location not on an edge, then all directions
        # should be visible / traversable
        wilderness.enter_wilderness(self.char1, coordinates=(1, 1))
        exits = [i for i in self.char1.location.contents
                 if i.destination and (
                  i.access(self.char1, "view") or
                  i.access(self.char1, "traverse"))]
        self.assertEquals(len(exits), 8)
        exitsok = ["north", "northeast", "east", "southeast", "south",
                   "southwest", "west", "northwest"]
        for each_exit in exitsok:
            self.assertTrue(any([e for e in exits if e.key == each_exit]))
Beispiel #2
0
    def test_wilderness_correct_exits(self):
        wilderness.create_wilderness()
        wilderness.enter_wilderness(self.char1)

        # By default we enter at a corner (0, 0), so only a few exits should
        # be visible / traversable
        exits = [
            i for i in self.char1.location.contents if i.destination and
            (i.access(self.char1, "view") or i.access(self.char1, "traverse"))
        ]

        self.assertEquals(len(exits), 3)
        exitsok = ["north", "northeast", "east"]
        for each_exit in exitsok:
            self.assertTrue(any([e for e in exits if e.key == each_exit]))

        # If we move to another location not on an edge, then all directions
        # should be visible / traversable
        wilderness.enter_wilderness(self.char1, coordinates=(1, 1))
        exits = [
            i for i in self.char1.location.contents if i.destination and
            (i.access(self.char1, "view") or i.access(self.char1, "traverse"))
        ]
        self.assertEquals(len(exits), 8)
        exitsok = [
            "north", "northeast", "east", "southeast", "south", "southwest",
            "west", "northwest"
        ]
        for each_exit in exitsok:
            self.assertTrue(any([e for e in exits if e.key == each_exit]))
Beispiel #3
0
 def test_enter_wilderness_custom_name(self):
     name = "customnname"
     wilderness.create_wilderness(name)
     wilderness.enter_wilderness(self.char1, name=name)
     self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
Beispiel #4
0
 def test_enter_wilderness_custom_coordinates(self):
     wilderness.create_wilderness()
     wilderness.enter_wilderness(self.char1, coordinates=(1, 2))
     self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
     w = self.get_wilderness_script()
     self.assertEquals(w.db.itemcoordinates[self.char1], (1, 2))
Beispiel #5
0
 def test_enter_wilderness_custom_name(self):
     name = "customnname"
     wilderness.create_wilderness(name)
     wilderness.enter_wilderness(self.char1, name=name)
     self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
Beispiel #6
0
 def test_enter_wilderness_custom_coordinates(self):
     wilderness.create_wilderness()
     wilderness.enter_wilderness(self.char1, coordinates=(1, 2))
     self.assertIsInstance(self.char1.location, wilderness.WildernessRoom)
     w = self.get_wilderness_script()
     self.assertEquals(w.db.itemcoordinates[self.char1], (1, 2))