示例#1
0
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

eric_the_zombie = rpg.Enemy(
    "Eric the Zombie",
    "a bloodstained, ragged youth with a far off expression")
eric_the_zombie.set_conversation("growl.... growl...")
eric_the_zombie.set_weakness("stick")

elding = rpg.Character("Elding", "a friendly elf")
elding.set_conversation("hi, pleased to meet you. Can I help?")

sue = rpg.Character("Sue", "a smiling woman with a colourful jacket")
sue.set_conversation("I'm very happy to see you here")

bugblatter = rpg.Enemy("the Bugblatter Beast of Trall",
                       "the fiercest monster you have ever seen")
bugblatter.set_conversation(
    "I can't see you because you have a towel covering your eyes")
bugblatter.set_weakness("sword")
示例#2
0
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!")
dave.set_weakness("cheese")
dining_hall.set_character(dave)

graham = rpg.Enemy("Graham", "A lurching skeleton")
graham.set_conversation("Clatter, creak.")
graham.set_weakness("club")
ball_room.set_character(graham)

burt = rpg.Friend("Burt", "An old man, who is sitting, sadly in the corner.")
burt.set_conversation("I have been stuck here for so long, give me a hug?")
burt.set_gift(
    "The zombie hates cheese and there is no point stabbin'the skinny fella, it needs a good solid whackin'."
)
kitchen.set_character(burt)
示例#3
0
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!")

cheese = rpg.Item("cheese")
cheese.set_desc_item("a large and smelly block of cheese")

dog = rpg.Item("dog")
dog.set_desc_item("a protective dog, cute with you,"
                  "\nmercilessly against your enemies")
示例#4
0
dining_hall = rpg.Room("Dining Hall")
dining_hall.set_description(
    "A large room with ornate golden decorations on each wall.")

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

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

dave = rpg.Enemy("Dave", "A smelly zombie")
dave.set_conversation("What's up, dude! I'm hungry.")
dave.set_weakness("cheese")
dining_hall.set_character(dave)

tabitha = rpg.Enemy("Tabitha",
                    "An enormous spider with countless eyes and furry legs.")
tabitha.set_conversation("Sssss....I'm so bored...")
tabitha.set_weakness("book")
ballroom.set_character(tabitha)

cheese = rpg.Item("cheese")
cheese.set_description("A large and smelly block of cheese")
ballroom.set_item(cheese)

book = rpg.Item("book")
示例#5
0
)

ballroom = rpg.Room("Ballroom")
ballroom.set_description(
    "A large hall with a marbel floor, this hasn't been danced in for a millenia"
)

kitchen.link_room(dining_hall, 'south')
dining_hall.link_room(kitchen, 'north')
dining_hall.link_room(ballroom, 'west')
ballroom.link_room(dining_hall, 'east')

starter_weapon = rpg.Item("Wooden Sword",
                          "A basic sword made out of cheap wood", "Sword")

greg = rpg.Enemy("Greg", 'Just a normal dude')
greg.set_conversation(
    "Hi, My name is greg, i'm just a normal dude trying to make his way in the text adventure"
)
greg.set_weakness("Nintendo Switch")
greg.set_item(starter_weapon)

greg_corpse = rpg.Character(
    "Greg's Body",
    "The corpse of a perfectly innocent man that you just murdered")
greg_corpse.set_conversation("Nothing, because he's dead")

switch = rpg.Item(
    "Nintendo Switch",
    "An amazing portable video game console brought to you by Nintendo",
    "Utility")
示例#6
0
 def spawn_enemy(self):
     self.enemy = rpg.Enemy(self.enemies[0], IMG_ENEMIES[self.enemies[0]])
示例#7
0
diamond = rpg.Item("diamond", "A tiny, sparkling diamond.")

hyacinth = rpg.Item("hyacinth", "A common hyacinth.")
hyacinth.set_smell("A strong, sweet scent.")

orchid = rpg.Item("orchid", "A rare, indigo-blue orchid - very pretty.")
orchid.set_smell("A strong, sweet scent. " + "\n" +
                 "Ohhhhhhhh... my mistake, it's a hyacinth.")
orchid.set_alternative(hyacinth)
                 
torch = rpg.Item("torch", "An ultra-bright electric torch.")



# Characters
davos = rpg.Enemy("Davos", "An ancient and crumbling butler.")
davos.set_conversation("Brrlgrh... rgrhl... brains..." +
                       "\n" + "(Oh dear, Davos doesn't sound too well. Best " +
                       "keep your distance.)")
davos.set_attack_moves(["lurches forward, arms outstretched.",
                        "thrashes around the room, punching everything in his path.",
                        "wobbles mightily, before trying to kill you again.",
                        "throws himself forward once more.",
                        "is still flat on his back from last time, but seizes" + "\n" +
                        "his chance to grab you by the ankle and try to eat your foot."])
                        
davos.set_post_attack(4, "Davos trips on the broom and flies head over heels.")
davos.set_post_attack(5, "Davos fixes you with a look of withering contempt, before" +
                         "\n" + "hauling himself off to the terrace for a nice rest.")

davos.set_weakness(broom)
示例#8
0
import rpg

#Our weapons -- you will need to get these from the friendly characters
cheese = rpg.Item("Cheese", "A lovely smelly Gorgonzola!")
magic_bean = rpg.Item("Magic bean", "Maybe Jack left this behind...")
garlic = rpg.Item("Garlic", "Great for sorting out vampires")

#The baddies, and their weaknesses
dave = rpg.Enemy("Dave", "A smelly zombie")
dave.conversation = "Brrlgrh... rgrhl... brains..."
dave.weakness = cheese.name

tilda = rpg.Enemy("Tilda", "A poisonous toad")
tilda.conversation = "Ribbit..... ribbit....."
tilda.weakness = magic_bean.name

madge = rpg.Enemy("Madge", "A fearsome witch, Mildred's evil twin!")
madge.conversation = "Hubble bubble, toil and trouble!"
madge.weakness = garlic.name

#Some friendlier folk... they might be able to help you
fred = rpg.Friend("Fred", "A helpful giant")
fred.set_item_carried(cheese)

mildred = rpg.Friend("Mildred", "A wise witch, Madge's helpful twin.")
mildred.set_item_carried(garlic)

bascule = rpg.Friend("Bascule",
                     "A curious fellow, with a kindly twinkle in his eyes.")
bascule.set_item_carried(magic_bean)
示例#9
0
import rpg

#To take itens
backpack = []

#All objects declations
billy = rpg.Enemy("Billy", "A f*****g weirdo with a baseball bat")
jesse = rpg.Character("Jesse", "A sweet little stranger, an eminent danger")
kitchen = rpg.Room("Kitchen")

dinning_hall = rpg.Room("Dinning Hall")
ballroom = rpg.Room("Ballroom")
sword = rpg.Item("sword", "Galandor")

#The  descriptions of some objects
kitchen.set_description("A dank and dirty room buzzing with flies.")
dinning_hall.set_description(
    "A large room with ornate golden decorations on each wall.")
ballroom.set_description("I don\'t know what this was supposed to be.")
sword.set_description("Pure simpathy")

#Linking the rooms
kitchen.link_room(dinning_hall, "south")
dinning_hall.link_room(kitchen, "north")
dinning_hall.link_room(ballroom, "east")
ballroom.link_room(dinning_hall, "west")

#Setting an item in the ballroom
ballroom.set_item(sword)

# Some actions with a friendly character
示例#10
0
# 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')
bedroom.link_room(ballroom,'south')
# create and place items
item1 = rpg.Item('banana', 'A large yellow piece of fruit', 'small', 'light')
item2 = rpg.Item('sword', 'A massive steel sword', 'large', 'heavy')
item3 = rpg.Item('pineapple', 'A juicy piece of fruit', 'large', 'light')
dining_hall.set_item(item1)
kitchen.set_item(item2)
bedroom.set_item(item3)
# Set up and place enemies
#Dave
dave = rpg.Enemy('Dave', 'A smelly zombie')
dave.set_conversation("I'm simply to die for!")
dave.set_weakness(item3.get_name())
dining_hall.set_character(dave)
#Lucretia
lucretia = rpg.Enemy('Lucretia', 'A wicked and cunning witch')
lucretia.set_conversation("Look at my lovely blond hair.")
lucretia.set_weakness(item2.get_name())
kitchen.set_character(lucretia)
#Jamie
jamie = rpg.Enemy('Jamie', 'A vindictive poltergeist')
jamie.set_conversation("I hate humans sooo much!")
jamie.set_weakness(item1.get_name())
bedroom.set_character(jamie)
# create and place a friend character
casper = rpg.Friend('Casper', 'A cute, friendly ghost')
示例#11
0
revolver = rpg.Item("revolver", "A shiny, metal object", "loaded")
dishWasher = rpg.Item("dishwasher", "A large kitchen appliance", "closed")
pill = rpg.Item(
    "pill",
    "Something that cures headaches, perhaps even gonorrhea and cancer",
    "glowing")
dishWasher.placeItem(pill, "inside")
towel = rpg.Item("towel", "Something fluffy, full of magic dust and cobwebs",
                 "dry and ready")

troll = rpg.Character("Busey", "A big, hairy troll", "angry")
troll.addResponse(
    "up", lambda x: troll.speak("I wish I could, but I'm too fat, mate"))

alex = rpg.Enemy("Alex", "A very, very bad radio host", "baleful")
alex.addResponse(
    "silence", lambda x: alex.speak(
        "OOOPS!!\n *Unfortunately, Alex uses epithets unsuitable for print*"))
alex.addFightResponse("revolver", lambda x: alex.killWith("guhn"))


def daveHelpPill(word):
    if word == "dishwasher":
        dave.speak(word + "? Let me take a look. Yes, there's a pill in here")
    if word == "headache":
        dave.speak(
            "Too much of that Cuban rum, huh? Why don't you take a pill?")
    dave.setState("compassionately")
    dave.speak(
        "Pills cure all kinds of ailments, except, perhaps, broken bones")
示例#12
0
    +
    "and broken tiles portray what was once a room filled with dancing, happy people."
)

# Link room code
kitchen.link_room(dining_hall, "south")
dining_hall.link_room(kitchen, "north")
dining_hall.link_room(ballroom, "west")
ballroom.link_room(dining_hall, "east")

# Sets starting room
current_room = kitchen

# --Enemies--
# Beef
beef = rpg.Enemy("Beef", "A viking slab of meat.\n")
beef.set_conversation("Yes, I'm talking meat. I know it's strange.")
beef.set_weakness("salad")
dining_hall.set_character(beef)

# Vampire
vampire = rpg.Enemy(
    "Vlad",
    "A dark sinister figure, pale skinned and with pointed teeth, occupies a dark corner of the ballroom.\n"
)
vampire.set_conversation("I vant to suck your blood, blaaa!")
vampire.set_weakness("stake")
ballroom.set_character(vampire)

# --Friends--
# Casper