Exemplo n.º 1
0
            super().give_info(full_info, light)


class DarkTunnel(classes.Location):
    def __init__(self):
        super().__init__(name='Dark Tunnel',
                         items=[],
                         creatures=[Orc(), Orc(), Orc(),
                                    Orc()],
                         exits={},
                         description='You are in a featureless dark tunnel.',
                         show_name_when_exit=False,
                         dark=True)


bathroom = classes.Location('Bathroom', [ToiletPaper()], [],
                            show_name_when_exit=True)
bathroom.description = 'There is a toilet and a sink here. They seem'\
                       ' out of place since this is 600 B.C.'
home = classes.Location('Home', [Paper(), classes.Lantern()], [],
                        show_name_when_exit=True)
home.items[0].description = '''NOTICE:
These lands have recently become infested with the servants of evil.
Currently, the main problem is the Legendary Dragon of Nogard (the LDN),
a very powerful lizard that threatens to destroy everything we live for.
It would be greatly appreciated if you would help exterminate the
creatures currently endangering the world. There may be some reward to
anyone who defeats the Legendary Dragon of Nogard that has been ravaging
the nation.
We have left a weapon for you in a nearby chest that might be locked in
a chest. You may have to break it open. We really didn't plan this very well.'''
home.description = 'You are in a familiar cabin made out of logs. '\
Exemplo n.º 2
0
from pag import Game
from pag import classes

# This gives the Game the list of all locations that is updated every time a
# new location is created. Since setting a variable to another variable with a
# list points to the one list's memory address, the list in the game class also
# updates.
game = Game(locations=classes.location_list)


class ToiletPaper(classes.Item):
    def __init__(self):
        super().__init__(name='toilet paper',
                         description='The toilet paper is labeled "X-t'
                         'raSoft.',
                         loc_description='A roll of toilet paper is in '
                         'the room.',
                         weight=1)


home = classes.Location('Home', start=True, show_name_when_exit=True)
home.description = 'You\'re at home.'
bathroom = classes.Location('Bathroom',
                            items=[ToiletPaper()],
                            show_name_when_exit=True)
bathroom.description = 'You\'re in the bathroom.'
home.exits = {'south': bathroom}
bathroom.exits = {'north': home}

game.play()