Exemplo n.º 1
0
 def setUp(self):
     """
     Tether a ball to the room.
     """
     CommandTestCaseMixin.setUp(self)
     self.ball = Thing(store=self.store, name=u'ball')
     self.ball.moveTo(self.location)
     self.tether = Tether.createFor(self.ball, to=self.location)
     self.otherPlace = Thing(store=self.store, name=u'elsewhere')
     Container.createFor(self.otherPlace, capacity=1000)
     Exit.link(self.location, self.otherPlace, u'north')
Exemplo n.º 2
0
 def setUp(self):
     """
     Tether a ball to the room.
     """
     CommandTestCaseMixin.setUp(self)
     self.ball = Thing(store=self.store, name=u'ball')
     self.ball.moveTo(self.location)
     self.tether = Tether.createFor(self.ball, to=self.location)
     self.otherPlace = Thing(store=self.store, name=u'elsewhere')
     Container.createFor(self.otherPlace, capacity=1000)
     Exit.link(self.location, self.otherPlace, u'north')
Exemplo n.º 3
0
 def test_moveWhenSitting(self):
     """
     A player who is sitting shouldn't be able to move without standing up
     first.
     """
     self.test_sitDown()
     otherRoom = createLocation(self.store, u"elsewhere", None).thing
     Exit.link(self.location, otherRoom, u'north')
     self.assertCommandOutput(
         "go north",
         ["You can't do that while sitting down."])
     self.assertCommandOutput(
         "go south",
         ["You can't go that way."])
Exemplo n.º 4
0
def world(store):
    def room(name):
        it = Thing(store=store, name=name)
        Container.createFor(it, capacity=1000)
        return it
    world = ImaginaryWorld(store=store,
                           origin=room("The Beginning"))
    protagonist = world.create("An Example Player")
    shirt = createShirt(store=store, name="shirt", location=world.origin)
    pants = createPants(store=store, name="pants", location=world.origin)
    middle = room("The Middle")
    wearer = IClothingWearer(protagonist)
    wearer.putOn(IClothing(shirt))
    wearer.putOn(IClothing(pants))
    Exit.link(world.origin, middle, "north")

    squeakerThing = Thing(name="squeaker", location=middle, store=store)
    Squeaker.createFor(squeakerThing)
    return world
Exemplo n.º 5
0
def world(store):
    def room(name):
        it = Thing(store=store, name=name)
        Container.createFor(it, capacity=1000)
        return it

    world = ImaginaryWorld(store=store, origin=room("The Beginning"))
    protagonist = world.create("An Example Player")
    shirt = createShirt(store=store, name="shirt", location=world.origin)
    pants = createPants(store=store, name="pants", location=world.origin)
    middle = room("The Middle")
    wearer = IClothingWearer(protagonist)
    wearer.putOn(IClothing(shirt))
    wearer.putOn(IClothing(pants))
    Exit.link(world.origin, middle, "north")

    squeakerThing = Thing(name="squeaker", location=middle, store=store)
    Squeaker.createFor(squeakerThing)
    return world