Exemplo n.º 1
0
    def setup(self):
        bedroom = Room("Bedroom", "This is an average bedroom.", {
            "north": "Bathroom",
            "south": "Living Room"
        })

        #print(bedroom)

        livingRoom = Room("Living Room",
                          "A TV, sofa, and game console are here.", {
                              "north": "Bedroom",
                              "east": "Kitchen"
                          })
        #print(livingRoom)

        bathroom = Room("Bathroom",
                        "Somebody left the toothpaste uncapped again.",
                        {"south": "Bedroom"})

        kitchen = Room("Kitchen",
                       "There are the usual appliances, but no food.",
                       {"west": "Living Room"})

        # Place rooms in a dictionary.
        # (Game will handle this in the full version)
        rooms = {
            bedroom.name: bedroom,
            livingRoom.name: livingRoom,
            bathroom.name: bathroom,
            kitchen.name: kitchen
        }

        # Add some items to the rooms
        phone = Item("phone", "it's yours.")
        bedroom.addItem(phone)

        key = Item("key", "for the front door.")
        kitchen.addItem(key)

        sword = Item("sword", "best $20 you spent at the flea market.")
        livingRoom.addItem(sword)

        return rooms
Exemplo n.º 2
0
    def createRooms(self):
        # creating rooms
        home = Room(
            "Home",
            "inside your home, this is where you live \n go to the House of Inte-Gral"
        )
        firstroad = Room("Village Road",
                         "outside, in the main road of the village")
        magicianhouse = Room(
            "Inte-Gral House",
            "in the house of the magician Inte-Gral \n you should go to the bethesda cave and take the sword"
        )
        bethesda = Room("Bethesda Cave", "inside the bethesda Cave")
        secondroad = Room("Outside Road",
                          "outside of your village, in the road")
        beauchef = Room(
            "Beauchef City",
            "in Beauchef City, it's said near here is the Golden Sword")
        catacomb = Room(
            "Beauchef 851 Catacombs",
            "underground the City, you see the famous Golden Sword")
        candymountain = Room(
            "Candy Mountain",
            "in the candy mountain, yes a mountain made of candy")
        thirdroad = Room("Candy Road", "outside in the Candy Road")
        littlevillage = Room(
            "Little Village",
            "in the main road of the Little Village, a village of dwarfs")
        floihouse = Room(
            "Floi's Home",
            "inside the house of Floi, a very brave dwarf,\n who fought several times in the past against the goblins"
        )
        telcharhouse = Room(
            "Telchar's Home",
            "inside the house of Telchar, the greatest smith of the kingdom")
        ironvalley = Room(
            "Iron Valley",
            "in the Iron Valley, this is where the best smiths of the kingdom get \n their iron for making weapons"
        )
        nomansdesert = Room(
            "No man's Desert",
            "lost in the gigantic desert, you hope to find a way out")
        countryside = Room("Countryside",
                           "in the beautiful Countryside of the kingdom")
        forest = Room(
            "Southern Forest",
            "surrounded by very large and old trees, you can hear strange noises in the distance"
        )
        fourthroad = Room(
            "Lake Road",
            "in the Lake Road, if you follow the path you will reach the Mysterious Lake"
        )
        lake = Room(
            "Mysterious Lake",
            "in the shore of the Lake, the Lake has red water and very few fishes to catch.\n The entrance to the Volcano is near."
        )
        volcanoentrance = Room(
            "Chaiten Volcano Entrance",
            " in the Entrance of the Volcano, the end of your Quest is close")
        volcanotop = Room(
            "Chaiten Volcano Top",
            "in the top of the Volcano, you just have to throw the bracelet")

        #create the items
        potion = Item("potion", "A simple potion", "item")
        sword = Item("sword", "An iron sword", "weapon")
        shield = Item("helmet", "A metal shield", "item")
        bow = Item("bow", "A bow made from wood", "weapon")
        magicbracelet = Item(
            "MagicBracelet",
            "A magic bracelet, you have to throw it in Chaiten Volcano",
            "item")
        goldensword = Item(
            "GoldenSword",
            "This sword is better than a normal one, it can defeat any dragon",
            "weapon")

        #create enemies
        ogre = Character("ogre")
        goblin = Character("goblin")
        dragon = Character("DragonErre")
        #initialize enemies
        ogre.setHP(20)
        goblin.setHP(40)
        dragon.setHP(100)
        ogre.addItem(potion)
        goblin.addItem(potion)
        dragon.addItem(potion)
        #initialize room items
        home.addItem(potion)
        magicianhouse.addItem(magicbracelet)
        magicianhouse.addItem(potion)
        catacomb.addItem(goldensword)
        candymountain.addItem(bow)
        bethesda.addItem(sword)
        floihouse.addItem(bow)
        floihouse.addItem(potion)
        telcharhouse.addItem(potion)
        telcharhouse.addItem(shield)
        forest.addItem(potion)
        lake.addItem(potion)
        # initialise room exits
        home.setExit("south", firstroad)
        firstroad.setExit("south", secondroad)
        firstroad.setExit("west", bethesda)
        firstroad.setExit("east", magicianhouse)
        firstroad.setExit("north", home)
        bethesda.setExit("east", firstroad)
        magicianhouse.setExit("west", firstroad)
        secondroad.setExit("north", firstroad)
        secondroad.setExit("west", beauchef)
        secondroad.setExit("east", candymountain)
        beauchef.setExit("east", secondroad)
        beauchef.setExit("south", catacomb)
        catacomb.setExit("north", beauchef)
        candymountain.setExit("west", secondroad)
        candymountain.setExit("south", thirdroad)
        thirdroad.setExit("south", littlevillage)
        thirdroad.setExit("north", candymountain)
        littlevillage.setExit("north", thirdroad)
        littlevillage.setExit("east", floihouse)
        littlevillage.setExit("west", telcharhouse)
        littlevillage.setExit("south", ironvalley)
        floihouse.setExit("west", littlevillage)
        telcharhouse.setExit("east", littlevillage)
        ironvalley.setExit("north", littlevillage)
        ironvalley.setExit("east", nomansdesert)
        nomansdesert.setExit("west", ironvalley)
        nomansdesert.setExit("east", countryside)
        nomansdesert.setExit("south", fourthroad)
        countryside.setExit("west", nomansdesert)
        countryside.setExit("east", forest)
        forest.setExit("west", countryside)
        forest.setExit("south", volcanoentrance)
        volcanoentrance.setExit("north", forest)
        volcanoentrance.setExit("east", lake)
        volcanoentrance.setExit("south", volcanotop)
        lake.setExit("west", volcanoentrance)
        lake.setExit("north", fourthroad)
        fourthroad.setExit("south", lake)
        fourthroad.setExit("north", nomansdesert)
        volcanotop.setExit("north", volcanoentrance)

        #initialize room enemies
        secondroad.setEnemy(ogre)
        thirdroad.setEnemy(ogre)
        fourthroad.setEnemy(ogre)
        catacomb.setEnemy(goblin)
        countryside.setEnemy(goblin)
        nomansdesert.setEnemy(goblin)
        volcanoentrance.setEnemy(dragon)
        # start game in home
        self.currentRoom = home