dining_hall.link_room(living_room, "west") dining_hall.link_room(kitchen, 'north') living_room.link_room(dining_hall, "east") living_room.link_room(bedroom, "north") bedroom.link_room(kitchen, "east") kitchen.link_room(bedroom, "west") kitchen.link_room(balcony, "east") balcony.link_room(kitchen, "west") living_room.link_room(dining_hall, "east") bedroom.link_room(living_room, "south") # Set Friends ross = Friend("Ross Geller", "An emotionally unstable and socially awkward nerd.") ross.set_conversation( "Hi....I'm fine. Totally fine. I don't know why my voice is coming out all loud and squeaky because really, I'm fine!" ) ross.set_remedy("box") balcony.set_character(ross) chandler = Friend("Chandler Bing", "A sarcastic and technologically inclined goof ball.") chandler.set_conversation( "Argh. Long day at work Phoebe, please leave a message after the BING. \n\n\n'BING'" ) chandler.set_remedy('big_box') living_room.set_character(chandler) rachel = Friend( "Rachel Green", "A ditzy but fashionably dressed lady who is helplessly in love in Ross Geller."
ballroom = Room("Ballroom") ballroom.set_description("A vast room with shiny decorations") 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 = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... rgrhl... brains...") dave.set_weakness("cheese") dining_hall.set_character(dave) catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) candle = Item("Candle") candle.set_description("A candle to see your way through dark passages") kitchen.set_item(candle) current_room = kitchen backpack = [] dead = False while dead == False: print("\n") current_room.get_details()
from room import Room from item import Item from helpMe import HelpMe from character import Enemy from character import Friend myhelp = HelpMe() myhelp.helpMe() dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I am a a zomilator") dave.set_weakness("cheese") mary = Friend("Mary", "A nice person") mary.set_conversation("I like hugs") #dave.set_weakness("cheese") # create rooms kitchen = Room("Kitchen") kitchen.set_description("A dank and dirty room buzzing with flies.") kitchen.set_character(mary) dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on each wall.") #put an enemy in the room dining_hall.set_character(dave) ballroom = Room("Ballroom") ballroom.set_description( "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance."
ballroom.set_description("A vast room with a shiny floor.") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") ballroom.link_room(dining_hall, "east") dining_hall.link_room(ballroom, "west") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Braiiiinnnnns") dave.set_weakness("cheese") laura = Friend( "Laura", "Laura creates and maintains Raspberry Pi educational resources. Aside from computers, she loves cats, cakes, board games and making jam." ) laura.set_conversation("Sorry, did you somehow put me inside your game?") laura.favorites = [ "computer", "computers", "cats", "cat", "cake", "cakes", "board game", "board games" ] cheese = Item("cheese") cheese.set_description("This is a wedge of cheese.") roland = Enemy("Roland", "An evil cat.") roland.set_weakness("tuna") tuna = Item("tuna") kitchen.set_character(laura) dining_hall.set_character(dave)
# link the rooms kitchen.link_room(dining_hall, "south") ballroom.link_room(dining_hall, "east") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") # set characters dave = Enemy("Dave", "A smelly zombie!") dave.set_conversation("Ahhh...I will eat you!") dave.set_weakness("cheese") susi = Character("Susi", "A cute little puppy") susi.set_conversation("Wuff, wuff!") ricky = Friend("Ricky", "A lovely penguin") ricky.set_conversation("Hello!") # put characters into rooms dining_hall.set_character(dave) ballroom.set_character(susi) kitchen.set_character(ricky) current_room = kitchen # items cheese = Item("cheese") old_sward = Item("old Sward") shield = Item("Shield") wand = Item("wand") book = Item("Book")
cheese.set_description("A block of yellow mouldy cheese") key = Item("key") key.set_description("Your way to freedom") # Assign items to rooms kitchen.set_item(cheese) dining_room.set_item(gun) # Create characters dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I am here to eat your brains") dave.set_weakness("cheese") catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("I am here to guide you") # Assign characters to rooms dining_room.set_character(dave) # Function to reassign an item to a room during game def change_item(item): if item == 'gun': current_room.set_item(gun) elif item == 'cheese': current_room.set_item(cheese) elif item == 'dagger': current_room.set_item(dagger) elif item == 'key': current_room.set_item(key)
tennis = Item("tennis") tennis.set_description("A furry greeinsh round thing") dining_hall.set_item(tennis) dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I eat your brains") dave.set_weakness("cheese") dining_hall.set_character(dave) baxter = Enemy("Baxter", "A rabid wild dog beast") baxter.set_conversation("Woof Woof") baxter.set_weakness("tennis") kitchen.set_character(baxter) claire = Friend("Claire", "A sexy ghost who loves you") claire.set_conversation("Come and give me a great big hug") claire.set_strength("bff") ballroom.set_character(claire) dead = False current_room = kitchen current_item = sword while not dead and Enemy.enemies_defeated <= 1: print("\n") # Print out the room details current_room.get_details() # Print out the item/s in the room current_item.get_details() inhabitant = current_room.get_character() if inhabitant is not None:
) print("There are " + str(Room.number_of_rooms) + " rooms to explore") 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 = Enemy("Dave", "A smelly zombie!") dave.set_conversation("Brrlgrh... rgrhl... brains...") dave.set_weakness("cheese") dining_hall.set_character(dave) catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Hello, there!") ballroom.set_character(catrina) cheese = Item("cheese") cheese.set_description("A large and smelly block of cheese") ballroom.set_item(cheese) book = Item("book") book.set_description("A really good book entitled 'Knitting for dummies'") dining_hall.set_item(book) current_room = kitchen backpack = [] dead = False while dead == False:
kitchen.set_character(borris) # Add item(s) to room brain = Item("brain") brain.set_description("A wet and wriggling brain. Looks like zombie food.") dining_hall.set_item(brain) quartz = Item("quartz") quartz.set_description("A huge crystal ball! It is full of inclusions and very dazzling.") kitchen.set_item(quartz) # Add a new character catrina = Friend("Catrina", "A happily lost treasure-hunter with a fondness for quartz.") catrina.set_conversation("'Hello, there! I am looking for a large quartz crystal. Have you seen it?'") catrina.set_item_give("quartz") ballroom.set_character(catrina) #puts catrina in the ballroom ##### CURRENT ROOM ##### current_room = parlor backpack = [] #empty, as you find items, they will go in backpack dead = False while dead == False: print("\n") current_room.get_details() print("\n")
Hobbiton.link_room(Storage, "east", False) Storage.link_room(Hobbiton, "west", True) Forrest.link_room(DeadMarshes, "north", False) DeadMarshes.link_room(Forrest, "south", True) Forrest.link_room(DustyGrove, "east", True) DustyGrove.link_room(Forrest, "west", True) DeadMarshes.link_room(Mirkwood, "north", False) Mirkwood.link_room(DeadMarshes, "south", True) Mirkwood.link_room(BossArea, "north", False) BossArea.link_room(Mirkwood, "south", True) HobbitKitchen.link_room(Cupboard, "south", False) Cupboard.link_room(HobbitKitchen, "north", True) Gandalf = Friend("Gandalf", "A tall, polite grey wizard") Gandalf.set_conversation( "Good day master Baggins\nThe door is jammed but i can open it for you, so long as i get a drink to recharge my magic" ) Gandalf.set_want("tea", "north") HobbitHole.set_character(Gandalf) flyGarry = Enemy("Garry the fly", "A tiny fly making an annoying buzzing noise") flyGarry.set_conversation("Buzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz") flyGarry.set_weakness("book", "south") HobbitKitchen.set_character(flyGarry) farmerSteve = Neutral("Steve the farmer", "An honest man earning an honest living") farmerSteve.set_conversation( "aye there Bilbo, how are ya?\nDo you by any chance know how to farm?") farmerSteve.set_weakness("book", "north")
evilapple.set_weakness(weakness3) dining_hall.set_character(evilapple) bbear = Enemy('Bombardier Bear', 'giant gummy bear') bbear.set_conversation('Bomb\'s away!') bbear.set_weakness(weakness2) battle_room.set_character(bbear) dave = Enemy('Dave', 'smelly zombie') dave.set_conversation('UAhrhhjwblehajrkewaablhchshhghhrhrhw') dave.set_weakness(weakness1) kitchen.set_character(dave) # Set up friends apollo = Friend('Apollo', 'a young dog') apollo.set_conversation('Arf!') masterbr.set_character(apollo) gil = Friend('Gil', 'leprechaun') gil.set_conversation('Top \'o the mornin\' to ye!') gil.set_superpower(weakness2) ballroom.set_character(gil) artemis = Friend('Artemis', 'sparkly UniKitty') artemis.set_conversation('Hiiiiii!!!!!!! I am SO glad to see you.') artemis.set_superpower(weakness1) ballroom.set_character(artemis) # Set up starting conditions current_room = kitchen alive = True
basement.link_room(bedroom, "east") dave = Enemy("Dave", "A smelly zombie") # Add some conversation for Dave when he is talked to dave.set_conversation("What's up, dude!") dave.set_weakness("cheese") dining_hall.set_character(dave) # Add a new character catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) #Adding a new character beast = Enemy("Beast", "A very violent being") beast.set_conversation( "I am the eternal ruler of the basement. You cannot hope to beat me without a sword!" ) beast.set_weakness("sword") basement.set_character(beast)
peter = Enemy('Peter', 'A giant squid') peter.set_weakness('spatula') kitchen.set_character(peter) peter.set_money(randint(0,10)) zebulon = Enemy('Zebulon', 'a sentient gas cloud') zebulon.set_weakness('dustbuster') ballroom.set_character(zebulon) zebulon.set_money(randint(0,5)) # Add new character catrina = Friend("Catrina", "A friendly skellington") kitchen.set_character(catrina) catrina.set_money(randint(0, 10)) catrina.set_conversation("Wotcher, chuck") # Add items cheese = Item('cheese') cheese.set_description('a lethal-looking wedge of sharp cheddar') kitchen.set_item(cheese) dustbuster = Item('dustbuster') dustbuster.set_description('A handy-looking portable vacuum-cleaner') ballroom.set_item(dustbuster) spatula = Item('spatula') spatula.set_description('a mean-looking wooden fish-slice') dining_hall.set_item(spatula)
dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") ballroom.link_room(conservatory, "south") conservatory.link_room(ballroom, "north") dave = Enemy("Dave", "A smelly zombie!") dave.set_conversation("Eurghrrh...flesshh") dave.set_weakness("cheese") brad = Enemy("Brad", "A bloodthirsty vampire!") brad.set_conversation( "Listen to them, the children of the night. What sweet music they make!") brad.set_weakness("garlic") mildred = Friend("Mildred", "A lazy ghost!") mildred.set_conversation("Woooo...oh I can't be bothered - hello friend!") mildred.set_tip("Dave is terrified of cheese!") frank = Friend("Frank", "A chatty crow!") frank.set_conversation("Caw! Caw!") frank.set_tip("Caw! Brad hates garlic") key = Item("key") key.description = "A small ornate brass key" key.size = 1 cheese = Item("cheese") cheese.description = "A very smelly brie" cheese.size = 2 garlic = Item("garlic")
def game_start(): fname = "rooms.txt" fh = open(fname) spooky_castle = RPGInfo("The Spooky Castle") spooky_castle.welcome() RPGInfo.info() RPGInfo.author = "Santiago Fernández de la Torre" for line in fh: if line.startswith("Kitchen:"): pieces = line.split(":") kitchen_description = pieces[1].strip() if line.startswith("Ballroom"): pieces = line.split(":") ballroom_description = pieces[1].strip() if line.startswith("Dining Hall"): pieces = line.split(":") dininghall_description = pieces[1].strip() backpack = Inventory() kitchen = Room("Kitchen") kitchen.set_description(kitchen_description) ballroom = Room("Ballroom") ballroom.set_description(ballroom_description) dining_hall = Room("Dining hall") dining_hall.set_description(dininghall_description) #print("There are " + str(Room.number_of_rooms) + " rooms to explore.") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "east") ballroom.link_room(dining_hall, "west") dave = Enemy("Dave", "A smelly zombie!\n") dave.set_conversation("BrAiNs!\n") dave.set_weakness("cheese") eustace = Enemy("Eustace", "A very angry buttler") eustace.set_conversation("Justicia social!") eustace.set_weakness(None) eustace.set_interest("gold coin") morgan = Friend("Morgan Freeman", "You just met GOD") morgan.set_conversation("Hello, my child.") cheese = Item("cheese") cheese.description = "A piece of moldy cheese" cheese.itype = "Consumable" cheese.quantity = 1 kitchen.set_item(cheese) gold = Item("gold coin") gold.description = "A gold coin from ancient times" gold.itype = "Consumable" gold.quantity = 1 dining_hall.set_item(gold) # sword = Item("sword") # sword.description = "An old rusty sword" # sword.itype="Usable" # sword.quantity = 1 # dining_hall.set_item(sword) key = Item("key") key.description = "A key used to get out of the spooky castle" key.itype = "Usable" key.quantity = 1 key.durability = 1 ballroom.set_item(key) fists = Item("fists") fists.description = "Who needs weapons when you have these cannons?" fists.itype = "Usable" fists.quantity = 999 fists.durability = 999 backpack.set_inventory(fists) kitchen.set_character(morgan) dining_hall.set_character(dave) ballroom.set_character(eustace) current_room = kitchen return current_room, fists, key, kitchen, dining_hall, ballroom, gold, morgan, eustace, dave, backpack, spooky_castle
dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") dave = 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 = 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) jane = Friend("Jane", "A pretty girl") jane.set_conversation("Hi there, give us a hug") lobby.set_character(jane) cheese = Item("cheese") cheese.set_description("A large and smelly block of cheese") ballroom.set_item(cheese) book = Item("book") book.set_description("A really good book entitled 'Knitting for dummies'") dining_hall.set_item(book) current_room = deck backpack = [] dead = False
"Dark, cold and full of cobwebs and rat-like sounds") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") garden.set_description("A tangled semi-jungle of prickly thorns") garden.link_room(kitchen, "east") garden.link_room(ballroom, "south") dave = Enemy("Dave", "a slimy, stinky zombie") dining_hall.set_character(dave) dave.set_conversation("Hey Dude - listen to an old zombie!") dave.set_weakness("cheese") dave.add_name_to_set() duncan = Friend("Duncan", "a shifty-looking elf") duncan.set_conversation("Ugh, can't I have some peace.") garden.set_character(duncan) duncan.will_fight = False duncan.will_hug = False duncan.will_bribe = True duncan.gift = "magnifying glass" duncan.add_name_to_set() aurora = Friend("Aurora", "a powerful, magical fairy") aurora.set_conversation("Sparkly, sparkle.") ballroom.set_character(aurora) aurora.will_fight = True aurora.will_hug = True aurora.will_bribe = False aurora.gift = "sapphire" aurora.add_name_to_set()
bunker.link_room(kitchen, "South") kitchen.link_room(bunker, "North") dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on each wall.") dining_hall.link_room(kitchen, "North") kitchen.link_room(dining_hall, "South") ballroom = Room("Ballroom") ballroom.set_description("A place where people dance at parties") ballroom.link_room(dining_hall, "East") dining_hall.link_room(ballroom, "West") jon = Friend("Jon", "An old pal. ") jon.set_conversation("Sah dude") ##dining_hall.get_details() ##print() ##kitchen.get_details() current_room = kitchen dave = Enemy("Dave", "A smelly zombie.") ##dave.describe() ##dave.talk() dave.set_conversation("bruh bruh bruh bruh bruh") ##dave.talk() ## dave.set_worth(5) dave.set_weakness("cheese") ##print("What will you fight with?") ##fight_with=input()
kitchen.link_room(dining_hall, "s") dining_hall.link_room(kitchen, "n") dining_hall.link_room(ballroom, "w") ballroom.link_room(dining_hall, "e") vlad = Enemy("Vlad", "A scary vampire") vlad.set_conversation("I'm always looking for my necks victim!") vlad.set_weakness("stake") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... Rgrhl... Braaaaains!") dave.set_weakness("bat") catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Konnichiwa!") kitchen.set_character(vlad) dining_hall.set_character(dave) ballroom.set_character(catrina) bat = Item("bat", "A solid looking cricket bat") stake = Item("stake", "A wooden stake, sharpened at one end") ballroom.set_item(bat) dining_hall.set_item(stake) current_room = kitchen inventory = [] game_over = False
dining_hall = Room("Dining Hall") dining_hall.set_description("A grand room with a table") ballroom = Room("Ballroom") ballroom.set_description("A large room with room to dance") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") ballroom.link_room(dining_hall, "east") dining_hall.link_room(ballroom, "west") current_room = kitchen banker = Friend("Banker", "A Friendy Bank Manager - Well this is a fanasty!!!!") banker.set_conversation("Its going to cosh you!!") banker.set_cash(500) kitchen.set_character(banker) dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... rgrhl... brains...") dave.set_weakness("cheese") dining_hall.set_character(dave) mark = Enemy("Mark", "A greedy Goblin") mark.set_conversation("Give me all your money") mark.set_weakness("dagger") mark.set_bribe(50) ballroom.set_character(mark) cheese = Item("cheese")
cellar.link_room(wine_cellar, "east") wine_cellar.link_room(cellar, "west") swimming_pool.link_room(ballroom, "east") ballroom.link_room(swimming_pool, "west") gym.link_room(swimming_pool, "up") swimming_pool.link_room(gym, "down") kitchen.link_room(greenhouse, "west") greenhouse.link_room(kitchen, "east") dave = Enemy("Dave", "a smelly, hungry zombie.") dave.set_conversation("Brrlgrh... rgrhl... braaains...") dave.set_weakness("brains") dining_hall.set_character(dave) catrina = Friend("Catrina", "a tall friendly skeleton.") catrina.set_conversation("Why hello there, friend!") ballroom.set_character(catrina) key = Item("key") key.set_description ("a small shiny key") cheese = Item("cheese") cheese.set_description ("a cumbling block of smelly, rotting cheese") broken_glass = Item("broken glass") broken_glass.set_description ("several broken bottles' worth of broken glass") weight = Item("weight") weight.set_description ("a ten pound iron weight") flower_pot = Item("flower pot")
# Items time_machine = Item("Time Machine") time_machine.set_description( "It's a small metallic intricate cube, with a rotating ball nestled in it." ) time_machine.set_power("teleport") # Items in rooms ballroom.set_item(time_machine) # Characters jeff = Enemy("Jeff", "A bare knock fighter") jeff.set_conversation("I'll blow you down like smoke!") jeff.set_weakness("melon") catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("I'm all bones.") # Characters in rooms dining_hall.set_character(jeff) kitchen.set_character(catrina) # No repetitions new_room = True new_inhabitant = True new_gadget = True # Starting elements current_room = kitchen backpack = [] dead = False
dave = Enemy('Dave', 'A smelly grumpy zombie') dave.set_conversation('Brrlgrh... rgrhl... brains...') dave.set_weakness('cheese') jack = Enemy('Jack', 'An enormous fierce rat') jack.set_conversation('And a fine day it is') jack.set_weakness('book') jill = Enemy('Jill', 'A nasty troll') jill.set_conversation('How much will you pay me to cross the bridge?') jill.set_weakness('duster') # Friends connie = Friend('Connie', 'A friendly skelton') connie.set_conversation('How are you today?') connie.set_hint('Dave doesn\'t like cheese.') jim = Friend('Jim', 'A friendly gardiner') jim.set_conversation('I hope it doens\'t rain inside again today') jim.set_hint('Jack doesn\'t like books') oscar = Friend('Oscar', 'A friendly little white dog with a very waggy tail') oscar.set_conversation('Where''s my treat human') oscar.set_hint('I''ll guard the treat cupboard for you') # Neutral gaylord = Nuetral('Gaylord', 'A Bored Shop keeper') gaylord.set_conversation('I don\'t have many things to sell, can you bring me some more items for my shop')
dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") # set Enemy dave = Enemy("Dave", "A smelly zombie") # initialize enemy dave.describe() dave.set_conversation("Brrlgrh... rgrhl... brains...") # set auto-response dave.set_weakness("cheese") dave.talk() # trigger conversation dining_hall.set_character(dave) # place enemy # set Friend catrina = Friend("Catrina", "A friendly skeleton") # initialize Friend catrina.describe() catrina.set_conversation("Why hello there...") # set auto-response catrina.talk() # trigger conversation ballroom.set_character(catrina) # place friend # player location current_room = kitchen dead = False while dead == False: print("\n") current_room.get_details() inhabitant = current_room.get_character() if inhabitant is not None: inhabitant.describe()
dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("That'll be your brain that I'm after") dave.set_weakness("elephant") dave.set_awake(True) dining_hall.set_character(dave) # add another enemy, Eben, in the Ballroom eben = Enemy("Eben", "An angry giant with a deep voice") eben.set_conversation("I run a large computer company") eben.set_weakness("artichoke") eben.set_awake(False) ballroom.set_character(eben) # add a friend, kate in the kitchen greta = Friend("Greta", "An environmental warrior") greta.set_conversation("Stop flying, it's madness and terrible") greta.set_awake(False) kitchen.set_character(greta) # distribute items sword = Item("sword", "it's pointy at one end") kitchen.set_item(sword) elephant = Item("elephant", "surprisingly small, grey and with a trunk") dining_hall.set_item(elephant) artichoke = Item("artichoke", "it's green and spikey") ballroom.set_item(artichoke) # main game initialisation
ballroom.link_room(dinning_hall, "east") # Create characters and assing them to rooms # Chicho chicho = Enemy("Chicho", "Un apestoso zombi") chicho.set_conversation("Eres lo peor que nos ha pasado nunca") chicho.set_weakness("Chocos") dinning_hall.set_character(chicho) chicho.set_items(["lobos", "dragones", "mandriles"]) # Catrina catrina = Friend("Catrina", "Una amistosa esqueleto") catrina.set_conversation("¿Hay alguien ahí?") ballroom.set_character(catrina) # Create items and assign it to rooms # Chocos chocos = Item() chocos.set_name("Chocos") chocos.set_description("Cefalópodos recién pescados") ballroom.set_item(chocos) # Comienza el bucle de la partida current_room = kitchen #mochila = []
dining_hall.set_description("A large room with ornate decorations.") ballroom = Room("Ballroom") ballroom.set_description("A vast room with a shiny wooden floor.") # Add an enemy and it's weakness to defeat it dave = Enemy("Dave","A bad, very smelly Zombie") dave.set_weakness("cheese") # Add some conversation for Dave when talked to dave.set_conversation("Argh, me eat your brains!") # Add a friend and it's feelings kati = Friend("Kati","A friendly skeleton") kati.set_feelings("I'm very happy today!") # Add some conversation for Kati when talked to kati.set_conversation("Do you need a hug today?") # Add an item cheese = Item("Cheese") cheese.set_description("A large and smelly block of cheese") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") # Add characters to rooms dining_hall.set_character(dave) ballroom.set_character(kati) # Add items to rooms
cheese = Item("cheese") cheese.set_description("A food that Dave the Zombie hates!") dining_hall.set_item(cheese) akashi = Enemy("Akashi", "The monster") akashi.set_conversation("Yeet") akashi.set_bribe("True") akashi.set_weakness("call mama phone") kitchen.set_character(akashi) call_mama_phone = Item("call mama phone") call_mama_phone.set_description("A phone that calls Akashi's mom.") kitchen.set_item(call_mama_phone) sunny = Friend("Sunny", "A nice friend who likes to dance!") sunny.set_conversation("Do you want to dance?") ballroom.set_character(sunny) #*Start in the kitchen current_room = kitchen defeat_enemy_count = 0 #*Store items in backpack backpack = [] loop = True while loop: print("\n") current_room.get_details() #*Check whether there are characters in the room. inhabitant = current_room.get_character() current_item = current_room.get_item()
livre = Item("livre") livre.set_readable_name("un livre") livre.set_description("Un très gros livre intitulé \"Python pour les nuls\".") salon.set_item(livre) # Define the people dave = Enemy("Dave", "Un zombie puant") dave.set_conversation("Arrrgggg... yahhhhh... manger...") dave.set_weakness("fromage") salon.set_character(dave) olga = Friend("Olga", "Un squelette sympa") olga.set_conversation("Salut ! Je suis un tas d'os.") cuisine.set_character(olga) tabatha = Enemy("Tabatha", "Une énorme araignée aux pattes velues.") tabatha.set_conversation("Pfffff.... Je m'ennuie...") tabatha.set_weakness("livre") salle_a_manger.set_character(tabatha) #Start: current_room = cuisine backpack = [] dead = False while dead == False:
from room import Room from item import Item from character import Character, Enemy, Friend #Setup Characters dave = Enemy('Dave', 'A smelly zombie') dave.set_conversation('urrrrgghhh....brraaaaaiiinnssss') dave.set_weakness('milk') #dave.set_items('meat') bill = Friend('Bill', 'A small black kitten') bill.set_conversation('Meow') #Set up rooms kitchen = Room("Kitchen") kitchen.set_description("A dark and dirty room buzzing with flies.") kitchen.set_character(bill) diningHall = Room("Dining Hall") diningHall.set_description("A large room with ornate fixtures and fittings") diningHall.set_character(dave) ballroom = Room("Ballroom") ballroom.set_description("A vast room with a shiny wooden floor") kitchen.link_room(diningHall, "south") diningHall.link_room(ballroom, "west") diningHall.link_room(kitchen, "north") ballroom.link_room(diningHall, "east") kitchen.room_items("Knife", 2)