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)
def takeOpalFunc(game): if not me.opaltaken: game.addText( "As you hold the opal in your hand, you're half-sure you can feel the air cooling around you. A shiver runs down your spine. Something is not right here.", ) 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 = ""