!/-----------------------------------------------------------------------------/ !/- -/ !/- Beer Party -/ !/- An Interactive Fiction Game -/ !/- -/ !/- By: Michael Alff -/ !/- For: CIS 487, Fall 2006 -/ !/- -/ !/- Description: This is an interactive textual adventure game -/ !/- where players assume the role of Bud, a hopeless -/ !/- party going drunk whose ultimate goal is to go to -/ !/- his neighbor's Halloween Beer Party where he -/ !/- can pick up a chick and get drunk. -/ !/- -/ !/- Known Bugs: None -/ !/- -/ !/-----------------------------------------------------------------------------/ !/----- Constants -----/ Constant Story "HALLOWEEN BEER PARTY"; !The Game Titles Constant Headline "^A Drunken Halloween Adventure Game by Michael Alff^"; Constant DEBUG; !/----- Libraries -----/ Include "parser"; Include "verblib"; Include "grammar"; !/----- Global Variables -----/ Global threatened = 0; !Represents if teenagers in party store are present Global wearing = 0; !Represents if player is wearing his Halloweeen costume Global pin1 = 0; !Represents the first digit of the ATM pin code Global pin2 = 0; Global pin3 = 0; Global pin4 = 0; !/----- Initialization -----/ !This section delivers places the player in the initial location [ Initialise; !and provides the initial story to the user. location = Buds_Yard; print "^^It's Saturday night, or so you think. At least that would explain why you're waking up in your front yard with a stale taste of beer on your breath. You begin to remember the previous night as you think to yourself 'Bud, that was one hell of a party.' It all starts to become clear. You were at a Halloween party last night trying to pick up chicks. Eventually you made it home only to pass out on your front lawn. This isn't the first time you have woken up here. You must have been so drunk you couldn't even make it inside your house. Clearly you didn't have any luck with the ladies, otherwise you wouldn't be waking up with a splitting head-ach on your front lawn. You think to yourself, 'Tonight will be better, I'll go to my neighbors Halloween party and find a chick for sure.'^^"; ]; !/----- Rooms / Locations -----/ !The following contain the code that make up the areas or rooms of the game. !/*** Bud's Yard ***/ ! This is the starting location. ! Visible objects: front_door, willow_tree ! Hidden objects: key Object Buds_Yard "Bud's Front Yard" has light with name "lawn" "yard" "grass" "outside", description "You're in the fenced in front lawn of your house. There are weeds everywhere. You really could stand to do some lawn maintenance sometime. You can see the front door of your house and an old willow tree in the center of your yard with a spooky looking hole in it. ^To the South you see the street you live on.", s_to Street_1, n_to Front_Door; !/*** Bud's House ***/ !Visible objects: nightstand, bed, cloths !Hidden objects: ATM_Card, Drivers_License, Costume Object Buds_House "Bud's House - Home Sweet Home" has light with name "home" "house" "bedroom" "living room" "main room" "center room", description "Here you are, the place you call home. Nothing spectacular, it's a small three room house with everything a dashing bachelor needs. You stand back impressed as you look at the result of your fine decorating skill. On your bed you see a messy and Offensively smelly heap of cloths. Next to the bed, you see your nightstand slightly cracked open. ^Your foul smelling bathroom is to the west, while your kitchen lies to the east. The front door of your house is south of you.", e_to Buds_Kitchen, w_to Buds_Bathroom, s_to Buds_Yard; !/*** Bud's Kitchen ***/ !Visible objects: beer_cans, dishes, knife, refridgarator !Hidden objects: beef_jerky Object Buds_Kitchen "Bud's Kitchen" has light with name "kitchen", description "Like the rest of you house, this place is a mess. There are piles of dirty dishes in the sink, a pyramid of empty beer cans on the counter, and a less than sanitary looking refrigerator.", w_to Buds_House; !/*** Bud's Bathroom ***/ !Visible objects: picture Object Buds_Bathroom "Bud's Bathroom" has light with name "bathroom" "bath" "washroom" "water closet" "wc", description "The bathroom is the smallest room in the house. There seems to be an excessive amount of mildew and mold on the walls. In fact, the only thing not covered in the scum is the odd picture hanging on the wall.", e_to Buds_House; !/*** Street 1 ***/ Object Street_1 "Street In front of Bud's House" has light with name "street" "road" "path", description "This is the street that you so frequently travel in your drunken adventures. The street continues onward to the east. You look to the distant west where you see a well lit parking lot containing that hot yellow Hummer you love so much.", w_to Parking_Lot, e_to Street_2, n_to Buds_Yard; !/*** Street 2 ***/ Object Street_2 "Street In front of Buds Neighbor's House" has light with description "Nothing very exciting here. The street normally looks just like any other one, however tonight, both sides of the street are lined with cars. To the west you see a few teenagers loitering around the local party store. As you look south, you see a new white park gazebo where children play during the day. North of you is your neighbor's house. A smile graces your face when you realize that's where the party is.", n_to Neighbors_House, e_to Party_Store, w_to Street_1, s_to Gazebo; !/*** Gazebo ***/ !Visible objects: pillow_case !Hidden objects: candy Object Gazebo "Park Gazebo" has light with name "gazebo" "play area", description "As you step inside the park gazebo, you notice the structure was build well. It is a calming, yet sophisticated area where town's people often serve breakfast. You think it would be a good place to bring a chick and try to score. During the day you have noticed children playing here.", n_to Street_2; !/*** Party Store ***/ !Visible objects: beer, clerk, teenagers Object Party_Store "Party Store" has light with name "party store" "convenience store" "beer store", description "As you walk in to the party store you so frequently visit your eyes almost immediately focus on the large shelf full of delicious beer, next to the corpulent lady behind the counter. There isn't really much in this store, but then again, you only care about the beer. The clerk seems distracted.", w_to Street_2; !/*** Neighbors House ***/ !Visible objects: bouncer Object Neighbors_House "Neighbor's House" has light with name "neighbors house" "neighbor" "party house" "party", description "As you approach your neighbors house you can hear crazy loud music coming from inside. You see a tall man dressed in black standing in front of the door into the house. It looks as if she has hired a bouncer for her Halloween party blow-out.", s_to Street_2; !/*** Parking Lot ***/ !Visible objects: Hummer Object Parking_Lot "Parking Lot" has light with name "parking lot" "lot", description "This area is the parking area for the local Halloween USA. You can see the costume display window of the store. The parking lot looks delicate as there are no people around. Additionally, there is only one car there, the hot yellow Hummer you wish was yours. To your south is a long dim lit ally way. To your east you see your bank.", e_to Street_1, w_to Bank, s_to Ally; !/*** Ally ***/ !Visible objects: Bum !Hidden objects: Flashlight Object Ally "Ally" has light with name "Ally Way" "Ally", description "As you slowly walk into the poorly lit ally way you see a bum scavenging through some trash with a flashlight. He is probably hungry. The only way out of this area is back the way you came.", n_to Parking_Lot; !/*** Bank ***/ !Visible objects: ATM !Hidden objects: Money Object Bank "Bank" has light with name "Bank", description "The bank is a clean, well lit area with a high-tech look. You begin to chuckle remembering the ATM you persistently hit on in one of you previous drunken adventures. Since the bank closed at this time of night, there doesn't seem to be anything interesting going on here.", e_to Parking_Lot; !/----- Objects and Items -----/ !The following descriptions depict the objects used in the game. !some objects are used in solving a puzzle, others are not. !/*** Pillow Case ***/ !Contains candy to trade to bum. !Found in Gazebo Object Pillow_Case "Pillow Case" Gazebo with name "pillow" "case" "pillow case", initial "As you look around you see a pillow case lying on the ground.", description "It's a pillow case that looks like it has something inside. One of the neighborhoods children must have lost it trick-or-treating.^", before [; open: move candy to player; print "You found some candy as you discard the pillow case!^"; remove Pillow_Case; rtrue;], has openable; !/*** Candy ***/ !Trade to bum for flashlight !Found inside pillow case thats found in the gazebo. Object Candy "Candy Bar" with name "candy bar" "milky way" "candy", description "A Milky Way Bar, your least favorite candy. Maybe someone else will want it.", before [; eat: "You don't want to eat that, you hate Milky Ways.";]; !/*** Bum ***/ ! Found in Ally !Has flashlight <-- aquire by trading him candy Object Bum "Ally Bum" Ally with name "Bum" "Poor Man" "Man", description "He's a dirty looking fella looking through the trash with a flashlight.", before [; talk: "Hello there you dirty bum. The Bum replies, 'Hey there fella, give me some food'";], life [; give: if (noun == candy) { print "You give the bum the candy bar, he hands you the flashlight.^"; move candy to bum; move flashlight to player; rtrue; } else { print "The bum doesn't seem to want anything but food.^"; } ], has concealed, has animate; !/*** Flashlight ***/ !Found in Ally !Bum has it, trade him the candy to get it. Object Flashlight "Flashlight" with name "flashlight" "light", description "It's a small cheepo flashlight, one of the neighborhood kids must have lost it when trick-or-treating.^", before [; take: print "The bum screams at you, 'This is mine butt hole!!!'^ Maybe you can give him something in exchange for it."; rfalse; use: if (location == Buds_Yard) { print "After shining the flashlight around the yard, you notice a key in the hole of the tree. You quickly snatch the key"; move key to player; } else { print "That wont help you here.^"; } ], has concealed scored; !/*** Willow Tree ***/ !Contains the key to buds house !Need to use flashlight to find key in tree !Found in Buds_Yard Object Willow_Tree "Willow Tree" Buds_Yard with name "tree" "willow" "hole", description "This old tree is almost dead, you really should take better care of your yard. Upon inspection you see a dark hole in the side of the tree. You can't see anything inside it.", has static scenery; !/*** House Key ***/ !Found in Buds_Yard in hole of tree using flashlight. !Opens front door and allows acess to buds_house Object Key "Key" with name "key" "keys", description "It's your house key.", has concealed; !/*** Buds Front Door ***/ !Provides entrance to Buds_House !Initially locked <-- open with key found in yard Object Front_Door "Front Door" Buds_Yard with name "door" "front door", description "It's the front door of your house.", when_open "The door is open.", when_closed "The door is closed.", in_to Buds_House, door_to Buds_House, door_dir n_to, with_key Key, has static door openable lockable locked scenery; !/*** Costume ***/ !Found in Buds_House on bed !A Mega Man Halloween costume used to gain entrance to the party Object Costume "Mega Man Costume" Buds_House with name "costume" "mega" "man" "mega man" "mega man costume", description "It's a costume of your favorite hero, Mega Man.^", after[; puton, wear: !You can wear the costume wearing = 1; print "You look like Mega Man, you are so cool dude.^"; rtrue;], has clothing concealed scored; !/*** Nightstand ***/ ! Contains the ATM_Card and Drivers_License ! Found in Buds_House Object Nightstand "Nightstand" Buds_House with name "nightstand" "stand" "drawer", description "Your nightstand is cracked slightly open, wonder what's inside.^", after[; open: print "You see your ATM card and drivers license.^"; move ATM_Card to Buds_House; move Drivers_License to Buds_House; rtrue;], has openable scenery; !/*** ATM Card ***/ !Used to retrieve money from the ATM !Found in Buds_House Object ATM_Card "ATM Card" with name "atm card" "debit Card" "credit card" "card", description "It's your ATM Card.^", before [; use: if (location == Bank) !You must be at the bank to use the ATM { if (money in player) !Cant withdrawl if you already have cash { print "You already have money.^"; } else { if (ATM_Card in player) !You must have the ATM card to use the ATM { print "Please enter your four digit pin number.^"; @read_char 1 pin1; @read_char 1 pin2; @read_char 1 pin3; @read_char 1 pin4; if ((pin1 == 52) && (pin2 == 53) && (pin3 == 53) && (pin4 == 52)) { print "You grab a twenty dollar bill as it slides out of the ATM.^"; give money ~static; move money to player; } else { print "Sorry Bud, that's the wrong pin number.^"; } } else { print "You need an ATM card to use this machine.^"; } } } else { print "You can't user your ATM card because there is no ATM around here.^"; } ], has concealed; !/*** Drivers License ***/ !Found in the nightstand in the Buds_House !Used to purchase beer Object Drivers_License "Drivers License" with name "License" "Drivers License" "Drivers", description "It's your Drivers License, but you don't have a car.^", has concealed; !/*** Picture ***/ !Found in Buds_Bathroom !Has the pin number to the ATM printed on it. Object Picture "Picture" Buds_Bathroom with name "picture" "photo", description "It's a very odd picture, just some numbers reading 4554. Bud your a strange man.^", has static scenery; !/*** Buds Refrigerator ***/ !Found in Buds_Kitchen !Contains beef_jerky Object Refrigerator "Refrigerator" Buds_Kitchen with name "fridge" "refrigerator", description "Your lovely kitchen is furnished with an outdated fridge.^", when_open "The fridge is open.", when_closed "The fridge is closed.", after [; open: print "You see a pile of old beef jerky.^"; rtrue; ], has static door openable scenery; !/*** Knife ***/ !Found in Buds_Kitchen !Used to threaten teenagers beer purchase is allowed Object Knife "Knife" Buds_Kitchen with name "knife" "blade", description "It's a strong sturdy blade about 15 inches long, real sharp too.^", before [; use: print "That won't do you any good here.^"; rtrue; ]; !/*** Beef Jerky ***/ ! Found in the refridgarator in Buds_Kitchen ! Does nothing Object Beef_Jerky "Beef Jerky" Buds_Kitchen with name "Beef" "Jerky" "Beef Jerky", description "It looks pretty stale, not sure if you should eat that.^", after [; eat: "Suddenly you don't feel so well, between the drinking and your diet, it's a wonder you're alive.^"; ], has edible concealed; !/*** Dishes ***/ !Found in Buds_Kitchen !Does nothing Object Dishes "Dishes" Buds_Kitchen with name "Dish" "Dishes", description "They are dirty dishes what else can I say.^", after [; drop: print "Just after you drop the dishes, they hit the floor and shatter, nice going Bud.^"; give dishes static; ], has concealed; !/*** Beer Cans ***/ !Found in Buds_Kitchen !Does nothing Object Beer_Cans "Beer_Cans" Buds_Kitchen with name "Cans" "Beer Cans", description "Tons of empty beer cans, you alcoholic.^", has concealed; !/*** ATM ***/ !Found in the Bank !Contains money and dispenses it to user. Object ATM "ATM" Bank with name "ATM", description "Just your typical ATM. What a convenient location.^", has static scenery; !/*** Money ***/ !Found in the Bank !Dispensed by ATM !Used to purchase beer Object Money "Twenty Dollar Bill" ATM with name "Money" "Cash", description "I crisp new twenty dollar bill.^", has static concealed scored; !/*** Clerk ***/ !Found in Party_Store !Sells player the beer after player threatens teenagers with knife Object Clerk "Store Clerk" Party_Store with name "clerk" "sales clerk" "lady" "women" "girl", description "She's a corpulent looking lady whom you've never seen before. She must be new, as you purchase beer here quite often.^", before [; talk: if (threatened == 0) !The teenagers have to have left to purchase the beer { print "I'm not ringing anyone up until those teenagers leave. They look like they're up to something.^ You notice some mischievous looking teenagers in the back corner of the store."; } else { print "We only take cash, hurry up and buy!^"; } ], has animate scenery; !/*** Teenagers ***/ !Found in Party_Store !Prevent player from puchasing beer !To make them leave, player must threaten with knife Object Teenagers "Teenagers" Party_Store with name "teenagers" "teenager" "kid" "kids", description "Those crazy kids look like they're up to no good.^", before [; threaten: if (knife in player) !Must have knife to threaten kids { print "You wave your knife wildly at the teenagers and yell at them to leave. They quickly exit the area.^"; move teenagers to parking_lot; threatened = 1; } else { print "As you ask the teenagers to leave, they simply laugh at you. Maybe you should get a weapon.^"; } talk: print "You ask the teenagers what they are up to. They tell you to go to hell. You may need to threaten them.^"; ], has animate scenery; !/*** Beer ***/ !Found in party_store !Used to gain entrance to party Object Beer "Six Pack of Beer" Party_Store with name "beer" "ale", description "Ah, the life giving liquid you live for. Nothing makes you happier than drinking beer.^", before [; buy: if (threatened == 1) !Teenagers must have left to buy beer { if (money in player) !Must have cash to buy beer { if (Drivers_License in player) !Must have ID for legal purchase { print "The sales clerk ask for you ID and you gleefully hand it to her. As you hand the sales clerk your money, you think to yourself, 'Tonight is going to rock.' When she hands you the beer you start to tremble from excitement.^"; move beer to player; remove money; rtrue; } else { print "The sales clerk ask for you ID and even though you insist you purchase your alcohol here up to three times a day, she wont give you the beer."; } } else { print "Even though you've used your debit card here in the past, the new sales clerk insist she will only take cash, better find an ATM.^"; rfalse; } } else { print "The clerk tells you she wont ring you up until the teenagers leave.^"; rfalse; } take: print "You can't just take the beer, you have to buy it first.^"; rtrue; drink: print "You better wait until you get to the party to start drinking.^"; rtrue; ], has concealed has scenery scored; !/*** Bed ***/ !Found in Buds_House !Does nothing Object Bed "Bed" Buds_House with name "bed", description "It's a small twin size bed, with sweat stains all over it.", has static scenery; !/*** Clothes ***/ !Found in Buds_House !Mega Man costume hidden underneath Object Clothes "Heap of Dirty Clothes" Buds_House with name "pile" "clothes" "clothes pile" "heap of clothes", before[; examine, search: move Costume to Buds_House; "After sifting through your smelly cloths, you find a Mega Man costume.^"; ], has concealed; !/*** Hummer ***/ !Found in parking lot !Does nothing Object Hummer "Hummer" Parking_Lot with name "Hummer" "car" "suv" "truck", description "Wow, just like you always wanted, a yellow Hummer. Bet you could afford one if you didn't spend all your money on beer.^", has static scenery; !/*** Bouncer ***/ !Found in neighbors house !Talk to him with costume and beer to gain entrance to party and win game Object Bouncer "Bouncer" Neighbors_House with name "bouncer" "guard" "big guy", description "He's a big and mean looking dude. Best to do what he ask you to.^", before [; talk: if (wearing == 1 && (beer in player)) !Must be wearing costume and have beer to get in { print "Welcome to the Party, step on in brother!!!^^ As you step into the party, you realize that your a total winner and you will find a chick for sure tonight.^^ *************************YOU WIN***************************"; deadflag = 2;; rtrue; } else { print "The bouncer tells you only people wearing a costume and bringing beer may enter the party, you better talk to him after you have both beer and a costume^."; } threaten: print "It wouldn't be wise to threaten him. You wouldn't stand a chance even with a weapon.^"; ], has animate; !/----- Added Grammar -----/ !The following verbs were added to the game. !You may talk to animate objects [ talkSub; ;]; Verb "talk" * 'to' noun -> talk * noun -> talk; !You need to use some objects to solve puzzles [ useSub; ;]; Verb "use" * held -> use; !You can threaten some objects [ threatenSub; ;]; Verb "threaten" * noun -> threaten; Verb 'trade' 'exchange' = 'give';