Ejemplo n.º 1
0
    def test_read_non_readable(self):
        item = Surface(self.game, "desk")
        item.moveTo(self.start_room)

        self.game.turnMain("read desk")

        self.assertIn("There's nothing written there. ", self.app.print_stack)
Ejemplo n.º 2
0
    def test_exit_surface(self):
        thing = Surface(self.game, "tray")
        thing.moveTo(self.start_room)
        self.game.me.moveTo(thing)

        self.game.turnMain("exit")

        self.assertFalse(thing.containsItem(self.game.me),
                         "Player should have left the Container")
Ejemplo n.º 3
0
    def test_take_all_does_not_take_items_that_are_not_discovered(self):
        desk = Surface(self.game, "desk")
        desk.inv_item = False
        desk.desc_reveal = False  # don't reveal the contents with "look"
        desk.moveTo(self.start_room)
        hat = Thing(self.game, "hat")
        hat.moveTo(desk)

        self.game.turnMain("l")
        self.game.turnMain("take all")

        self.assertTrue(self.game.me.containsItem(hat))
Ejemplo n.º 4
0
    def test_take_all_takes_known_objects_from_sub_locations(self):
        desk = Surface(self.game, "desk")
        desk.inv_item = False
        desk.desc_reveal = True
        desk.moveTo(self.start_room)
        hat = Thing(self.game, "hat")
        hat.moveTo(desk)

        self.game.turnMain("l")
        self.game.turnMain("take all")

        self.assertTrue(self.game.me.containsItem(hat))
Ejemplo n.º 5
0
    def test_get_item_when_pc_is_on_surface(self):
        loc = Surface(self.game, "desk")
        loc.moveTo(self.start_room)
        loc.can_contain_standing_player = True

        sub_loc = Surface(self.game, "box")
        sub_loc.moveTo(loc)
        sub_loc.can_contain_standing_player = True

        self.game.me.moveTo(sub_loc)

        self.game.turnMain("take desk")

        self.assertIn("You climb down from the desk. ", self.app.print_stack)
Ejemplo n.º 6
0
        me.opaltaken = True
        opalAchievement.award(game)
        print(opal.ix)
        print(opal.ix in me.knows_about)


opal.getVerbDobj = takeOpalFunc

bench = Surface(game, "bench")
bench.can_contain_sitting_player = True
bench.can_contain_standing_player = True
bench.invItem = False
bench.description = "A rough wooden bench sits against the wall. "
bench.x_description = (
    "The wooden bench is splintering, and faded grey. It looks very old. ")
bench.moveTo(startroom)

underbench = UnderSpace(game, "space")
underbench.contains_preposition = "in"
bench.addComposite(underbench)
# UnderSpaces that are components of another item are not described if their "description"
# attribute is None
# This also means that we cannot see what's underneath
# Set description to an empty string so we can show what's underneath without
# having to print an actual description of the UnderSpace
underbench.description = ""
underbench.full_name = "space under the bench"

box = Container(game, "box")
box.giveLid()
box.moveTo(underbench)
Ejemplo n.º 7
0
 def test_set_surface_on_itself(self):
     item = Surface(self.game, "thing")
     item.moveTo(self.start_room)
     self.game.turnMain("set thing on thing")
     self.assertIn("You cannot", self.app.print_stack.pop())
     self.assertFalse(item.containsItem(item))