예제 #1
0
# Connect rooms. These are one-way connections.
kitchen.link_room(locked, "EAST")
kitchen.link_room(smalloffice, "SOUTH")
kitchen.link_room(locked, "WEST")
supplycloset.link_room(smalloffice, "EAST")
smalloffice.link_room(kitchen, "NORTH")
smalloffice.link_room(lab, "EAST")
smalloffice.link_room(locked, "SOUTH")
smalloffice.link_room(supplycloset, "WEST")
lab.link_room(locked, "SOUTH")
lab.link_room(smalloffice, "WEST")
current_room = kitchen

# Set up characters
dmitry = Enemy("Dmitry", "A smelly zombie")
dmitry.set_speech("Brrlgrh... rgrhl... brains...")
dmitry.set_weaknesses(["FORK","SPORK","KNIFE"])
supplycloset.set_character(dmitry)

# This is a procedure that simply prints the items the player is holding and tells them if they can do something with that item
def playerItems():
    # Print out the player's Held Items and let player know if they can USE an item to fight a character or something
    if len(heldItems) == 1:
        print("You are holding a "+heldItems[0])
        print("You can DROP "+heldItems[0].upper())
        if current_room.character is not None:
            print("You can USE "+heldItems[0].upper()+" to fight "+current_room.character.name)
    elif len(heldItems) >= 2:
        print("Your hands are full. You must drop something before you can pick anything else up.")
        print("You are holding a "+heldItems[0]+" and a "+heldItems[1])
예제 #2
0
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)
예제 #3
0
kitchen = Room("Kitchen")
kitchen.set_description("This is where we cook.")

dining_hall = Room("Dining Hall")
dining_hall.set_description("We eat all the junks here.")

ballroom = Room("Ballroom")
ballroom.set_description("We hold parties here. party, party.")

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

john = Enemy("john", "A terrifying face")

# Add some conversation for Dave when he is talked to
john.set_conversation("What's up, dude!")

john.set_weakness("cheese")

dining_hall.set_character(john)

# Add a new character

tom = Friend("tom", "A friendly skeleton")
tom.set_conversation("Why hello there.")
ballroom.set_character(tom)

current_room = kitchen
예제 #4
0
# from character import Character

# dave = Character("Dave","A smelly zombie")
# dave.describe()

# dave.set_conversation ("Hello, how are you? what's going on.")
# dave.talk()

# michael=Character ("Michael", "An ugly big fellow")
# michael.describe ()

# michael.set_conversation(None)
# michael.talk()

# michael.fight ("I")

from character import Enemy

dave = Enemy("dave", "A smeely zombie")
dave.describe()

dave.set_weakness("cheese")

print("What will you fight with?")
fight_with = input()
dave.fight(fight_with)
예제 #5
0
corridor = Room('Corridor')
corridor.set_description('A room that links rooms.')

# Linking rooms
kitchen.link_room(corridor, 'south')
ballroom.link_room(corridor, 'east')
ballroom.link_room(bedroom, 'south')
bedroom.link_room(ballroom, 'north')
corridor.link_room(kitchen, 'north')
corridor.link_room(ballroom, 'west')
corridor.link_room(dining_hall, 'east')
dining_hall.link_room(corridor, 'west')

# Dave the Enemy Skeleton
charpos = [corridor, dining_hall]
dave = Enemy('Dave', 'He is a smelly zombie')
dave.set_conversation(
    'Hello dear friend, \nwanna take a little sip of this fine brandy?')
dave.set_weakness(randitem)
dave.set_item(handr)
choice(charpos).set_character(dave)

# Catrina the Friendly Skeleton
catrina = Friend('Catrina', 'She is a friendly skeleton!?')
catrina.set_conversation('Hello dude, lets go!')
kitchen.set_character(catrina)

# Set default room
current_room = bedroom

# Set item