コード例 #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')
コード例 #2
0
ファイル: test_tether.py プロジェクト: ashfall/imaginary
 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')
コード例 #3
0
ファイル: test_furniture.py プロジェクト: ashfall/imaginary
 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."])
コード例 #4
0
ファイル: example_world.py プロジェクト: ashfall/imaginary
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
コード例 #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