Пример #1
0
import rpg

#-------------------------------------------------------------
#set up rooms

kitchen = rpg.Room("Kitchen")
kitchen.set_description("a dank and dirty room buzzing with flies.")

dining_hall = rpg.Room("Dining Hall")
dining_hall.set_description("a bare, scruffy room with sparse furniture.")

ballroom = rpg.Room("Ballroom")
ballroom.set_description("a large, well-lit room.")

porch = rpg.Room("Porch")
porch.set_description("a small, dank room with a locked door to the garden")

conservatory = rpg.Room("Conservatory")
conservatory.set_description("a light, airy room overlooking the garden")

kitchen.link_room(dining_hall, "south")
kitchen.link_room(porch, "east")
ballroom.link_room(dining_hall, "east")
ballroom.link_room(conservatory, "south")
dining_hall.link_room(ballroom, "west")
dining_hall.link_room(kitchen, "north")
porch.link_room(kitchen, "west")
conservatory.link_room(ballroom, "north")

#-------------------------------------------------------------
#set up characters
Пример #2
0
import rpg

kitchen = rpg.Room("Kitchen")

kitchen.set_description("a cute white room where\nount Nilda cooks for my"
                        " family!")

dinning_room = rpg.Room("Dinning Room")
dinning_room.set_description("an illuminated room,\nwith a cristal "
                             "chandelier and a square glass table"
                             "with two wood cupboards\nthat serve as "
                             "wine cellars :p")

living_room = rpg.Room("Living Room")
living_room.set_description("a big room, field with\npompous furniture "
                            "and glass doors to the inside"
                            "garden and the pool :)")

dinning_room.link_to_room(kitchen, "north")
dinning_room.link_to_room(living_room, "east")
kitchen.link_to_room(dinning_room, "south")
living_room.link_to_room(dinning_room, "west")

dave = rpg.Enemy("Dave", "A smelly zombie")
dave.set_conversation("Me want brainnnnnsss >:(")
dave.set_weakness("dog")
dave.set_stolen_item("nothing")

catrina = rpg.Friend("Catrina", "A friendly skeleton")
catrina.set_conversation("Why hello there!")
catrina.set_greetings("Hi, my name is Catrina, it's nice to meet you!")
Пример #3
0
import rpg
"""set up rooms"""
kitchen = rpg.Room("Kitchen")
kitchen.set_description("A dank and dirty room buzzing with flies.")

dining_hall = rpg.Room("Dining Hall")
dining_hall.set_description(
    "A large room with ornate golden decorations on each wall.")

ball_room = rpg.Room("Ball Room")
ball_room.set_description("A vast room with a shiney wooden floor.")
"""set up room interlinks"""
kitchen.link_room(dining_hall, "south")
ball_room.link_room(dining_hall, "east")
dining_hall.link_room(kitchen, "north")
dining_hall.link_room(ball_room, "west")
"""set up items"""
club = rpg.Item("club")
club.set_description("a heavy wooden club")
dining_hall.set_item(club)

bread = rpg.Item("bread")
bread.set_description("a loaf of rough milled bread.")
kitchen.set_item(bread)

cheese = rpg.Item("cheese")
cheese.set_description("a large wedge of tasty looking cheese.")
ball_room.set_item(cheese)
"""set up characters"""
dave = rpg.Enemy("Dave", "A smelly zombie")
dave.set_conversation("Errrrgh, Brains!")
Пример #4
0
import rpg

# the player's backpack
backpack = rpg.Backpack()

# setup rooms
kitchen = rpg.Room("Kitchen")
kitchen.set_description("A dank and dirty room buzzing with flies.")

dining = rpg.Room("Dining Hall")
dining.set_description(
    "A large room with ornate golden decorations on each wall.")

ball = rpg.Room("Ballroom")
ball.set_description(
    "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance.")

# setup characters
john = rpg.Friend("John", "A nice fellow guarding the door.")
john.set_conversation("Hi there. You may not pass through this door.")

dave = rpg.Enemy("Dave", "A smelly zombie")
dave.set_conversation("Brrlgrh... rgrhl... brains...")
dave.set_weakness("knife")

# setup items
knife = rpg.Item("Knife", "A sharp knife is lying on the table")
bag = rpg.Item(
    "bag", "A small bag, like the ones used to hold coins. Seems to have something inside.")
Пример #5
0
teddy = rpg.Friend("Teddy", "A small, friendly bear cub, with soft brown fur.")             
teddy.says["cora"] = (   "This house is haunted... " + "\n" + 
                         "Watch out for Lady Cora's ghost! She's angry!" + "\n" +
                         "I don't know why. But don't worry, bright lights " +
                         "scare her.")
teddy.says["davos"] = (  "If you want to fight the butler, " + "\n" +
                         "you'll need a weapon with a good long handle.")
teddy.says["diamond"] =  "You've found Cora's lost diamond! That's splendid!"
teddy.says["thanks"] =   "Talk to Cora, she wants to say thank you."
teddy.says["treasure"] = "Well done! Now have a look at that treasure!"
teddy.set_conversation(teddy.says["cora"])



# Rooms
kitchen = rpg.Room("Kitchen")
kitchen.set_description("A spotlessly clean room, big enough for forty cooks.")
kitchen.set_character(davos)

dining_hall = rpg.Room("Dining Hall")
dining_hall.set_description("A long, high-ceilinged room panelled in oak.")
dining_hall.set_character(teddy)

ballroom = rpg.Room("Ballroom")
ballroom.set_description("A vast room with a shining floor and splendid golden decorations.")
ballroom.set_blocked_exit("north",
                          "A whirlwind of icy air throws you back. Cora glares at you.")
ballroom.set_character(cora)

pantry = rpg.Room("Pantry")
Пример #6
0
    Sets up a string to display the available enemy names for use in advice processing
    Input:  enemies, a dictionary mapping enemy names to enemy objects.
    Returns: a string suitable for displaying the available enemy names
    '''
    if len(enemies) == 0:  # no enemies present
        return ''
    enemies_list = 'Choose from: '
    for enemy in enemies:
        enemies_list = enemies_list + enemy + ', '
    enemies_list = enemies_list[:-2] + ' ' # remove trailing comma
    return enemies_list

# Set up game rooms, items, enemies and friend    

# Set up kitchen
kitchen = rpg.Room('Kitchen')
kitchen.set_description('A dank and dirty room buzzing with flies.')
# Set up Dining hall
dining_hall = rpg.Room('Dining Hall')
dining_hall.set_description('A large room with ornate golden decorations on each wall.')
# Set up Ballroom
ballroom = rpg.Room('Ballroom')
ballroom.set_description('A vast room with a shiny wooden floor. Huge candlesticks guard the entrance.')
# Set up bedroom
bedroom = rpg.Room('Bedroom')
bedroom.set_description('The master bedroom - huge 4 poster bed!')
# Link the 3 rooms together as per diagram in 2.6
# Add in a link to the bedroom in the top quadrant
kitchen.link_room(dining_hall, 'south')
dining_hall.link_room(ballroom, 'west')
bedroom.link_room(kitchen, 'east')