! ------------------------------------------------------------------------------ ! Demon Hunt ! ! Inform Text Adventure ! ! Michael Cowles ! ! CIS 587 Project #2 ! ! 10/30/2001 ! ! ------------------------------------------------------------------------------ Constant Story "Demon Hunt"; Constant Headline "^Inform Text Adventure^ written by Michael Cowles - 10/30/2001^"; Include "Parser"; Include "VerbLib"; !------------------------------------------------------------------------------- ! Initialise ! !------------------------------------------------------------------------------- [ Initialise; location = Town_B; print "^^It's a nice summer day.^^ You are walking down the path to your home town,^ the village of Trada. You think to yourself about^ your long journey and how you will be glad when ^ you make it back to town. However, when you finally ^ make it back, you find that everything has disappeared!!!!^^ You don't see any houses or people, just a few objects^ scattered throughout the grass. you suspect that the ^ nearby demon, Ractor, has something to do with this, so you go^ decide to find out where everybody is and whether the^ demon has anything to do with the missing town^^ Now is the start of your incredible journey...^^^"; ]; ! ---------------------------------------------------------------------------- ! Locations ! ! In this section we will define our locations. These are "Objects" to Inform. ! ! ---------------------------------------------------------------------------- ! Objects in the Town !---------------------------------------------------------------------- ! Northwest location of town Object Town_A "Town, Paths = E, S, W" with description "You are in the north west part of the town.^ You see paths to the east, south that lead to other parts^ of the town. The path to the west leads to the forest^", e_to Town_B, s_to Town_D, w_to Forest_A, in_to Door_Sam, has light; ! Door to Sam's house, concealed until you find the bubble that rebuilds ! the house Object -> Door_Sam "Door to Sam's House" with name "door", description "Sam's house is here", when_open "Sam's door is open", when_closed "Sam's door is closed", door_to House_Sam, door_dir in_to, has static door openable open concealed; ! Sam's House, which contains the red key, one of the two keys needed ! to enter the demon's lair Object House_Sam "Sam's House" with description "You are in Sam's house, he tells you to take the key. He also mentions the letters ~EW~. What could they mean?", s_to Town_A, out_to Town_A, has light; ! The red key, one of the two keys needed ! to enter the demon's lair Object -> red_key "red key" with name "red" "key", article "the"; !---------------------------------------------------------------------- ! North-central location of town Object Town_B "Town, Paths = E, S, W" with description "You are in the north central part of the town.^ You see paths to the east, south, and west.^ There is also a sign that says ~RN~ What could that mean?", e_to Town_C, s_to Town_E, w_to Town_A, in_to Door_Mayor, has light; ! The gold piece is needed to buy a bomb, it is found here and in the cave. Object -> Gold_Piece "gold piece" with name "piece" "gold", article "a", before [; Drop: if (Player in House_Bomb) { give bomb ~concealed; print "You give the clerk the gold, and he tells you to take a bomb"; move gold_piece to Cave_F; rtrue; } ]; ! Door to the Mayor's house, concealed until you find the bubble that rebuilds ! the house. If you are able to walk through the door, with the demon ! trapped in his lair, you win. If the demon is not trapped, you lose. Object -> Door_Mayor "Mayor's Door" with name "door", description "You see the Mayor's house ahead.", when_open "The door is open.", when_closed "c", door_to [; if (red_door has concealed) { deadflag=2; "You walk in to the Mayor's room and the mayor congratulates you on saving the town and trapping the demon in his lair!!!"; } else { deadflag=1; "As you walk in the Mayor's house, you hear the demon come flying out of his lair and into the house, killing both you and the mayor in the process"; } return Town_B; ], door_dir n_to, has static door openable open concealed; !---------------------------------------------------------------------- ! Northeast location of town Object Town_C "Town, Paths = E, S, W" with description "You are in the north east part of the town.^ You see paths to the west and south that lead to other parts^ of the town. A path to the east leads to the cave^", w_to Town_B, s_to Town_F, e_to Cave_A, in_to Door_Ray, has light; ! Door to Ray's house, concealed until you find the bubble that rebuilds ! the house Object -> Door_Ray "Door to Ray's House" with name "door", description "Ray's house is here", when_open "Ray's door is open", when_closed "Ray's door is closed", door_to House_Ray, door_dir in_to, has static door openable open concealed; ! Ray's House, which contains the blue key, one of the two keys needed ! to enter the demon's lair Object House_Ray "Ray's House" with description "You are in Ray's house, he tells you to take the key. He also mentions the letters ~CE~. What could they mean?", s_to Town_C, out_to Town_C, has light; ! The blue key, one of the two keys needed ! to enter the demon's lair Object -> blue_key "blue key" with name "blue" "key", article "the"; !---------------------------------------------------------------------- ! Southwest location of town Object Town_D "Town, Paths = E, N" with description "You are in the south west part of the town.^ You see paths to the east and north that lead to other parts^ of the town.^", e_to Town_E, n_to Town_A, in_to Door_Nick, has light; ! The rock can be thrown at the Ogre to defeat it. Ogre drops the knife, so ! you can pick it up. Object -> Rock "rock" with name "rock", before [; Insert,PutOn,ThrowAt: if (second==Ogre) { print "You throw the rock at the Ogre. The rock hits the ogre in the head. The Ogre gets knocked out and drops his knife!^"; move Knife to Cave_C; remove Ogre; move rock to trash; rtrue; } else { print "You can't throw the rock at ",(the) second, ".^"; rtrue; } ]; ! Door to Nick's house, concealed until you find the bubble that rebuilds ! the house Object -> Door_Nick "Nick's Door" with name "door", description "Nick's house is here", when_open "The door to Nick's house is open", when_closed "Nick's door is closed.", door_to House_Nick, door_dir w_to, has static door openable open concealed; ! Nick's house, which contains the rope needed to cross the pit in the forest. Object House_Nick "Nick's House" with description "You are in Nick's House. Nick tells you that you can take^ the rope if you want to. He also mentions the letters ~AW~.^ What could they mean?^", e_to Town_D, out_to Town_D, has light; ! The rope can be attached to the hook. Object -> Rope "rope" with name "rope", before [; puton, insert: if (second == hook) { move Rope_Hook to Player; move rope to trash; move hook to trash; print "You tied the rope to the hook"; rtrue; } ]; ! Combination of rope and hook, can be thrown at branch so that person can ! can swing across the pit in the forest. Object -> -> Rope_Hook "rope (with hook)" with name "hook" "rope", before [; puton, insert, throwat: if (second == Branch) { move Rope_Hook to Branch; print "You throw the hooked rope at the branch. The hook attached to the branch and now you can swing across the pit using the rope"; rtrue; } ]; !---------------------------------------------------------------------- ! South-central location of town Object Town_E "Town, Paths = E, N, S, W" with description "You are in the south central part of the town.^ You see paths to the west, north, and east that lead to other parts^ of the town. A path to the south leads to the demon's lair^", e_to Town_F, n_to Town_B, w_to Town_D, s_to Red_Door, has light; Object -> Ledge "ledge over the demon's lair" with name "ledge", description "There is a ledge here that looks like it is blocking ^ a bunch of rocks from falling over the entrance to the^ demon's lair", has static; ! Stick, no use in the game Object -> Stick "stick" with name "stick"; ! The red door is one of the two doors that leads to the Demon's Lair ! You need the red key to unlock it Object -> Red_Door "Red Door to the Demon's Lair" with name "red" "door", description "The door to the demon's lair has a red lock", when_open "The door is open.", when_closed "The door is closed.", door_to Town_G, door_dir s_to, with_key red_key, has static door openable lockable locked; !---------------------------------------------------------------------- ! Southeast location of town Object Town_F "Town, Paths = N, W" with description "You are in the south east part of the town.^ You see paths to the west and north that lead to other parts^ of the town.^", w_to Town_E, n_to Town_C, in_to Door_Bomb, has light; ! Door to the bomb shop, concealed until you find the bubble that rebuilds ! the house Object -> Door_Bomb "Door to the Bomb shop" with name "door", description "The bomb shop is here", when_open "The door to the bomb shop is open.", when_closed "The door to the bomb shop is closed", door_to House_Bomb, door_dir e_to, has static door openable open concealed; ! The bomb shop. You can buy a bomb with one gold piece. Object House_Bomb "Bomb Shop" with description "You are at the Bomb shop, the clerk tells you to drop a ^ gold piece if you want a bomb. He also mentions the letters ~LS~.^ What could they mean?", w_to Town_F, out_to Town_F, has light; ! The bomb can be used to bust open a path through some rocks in the ! cave, and to block the demon from exiting, after you get the bubble ! from the demon's lair. Object -> Bomb "bomb" with name "bomb", before [; PutOn, Insert, ThrowAt: if (second==Rocks) { give path2 ~concealed; print "You bomb the rocks BAMMM and clear a path"; move bomb to House_Bomb; give bomb concealed; rtrue; } if (second == ledge && Door_Mayor hasnt concealed) { give red_door concealed; print "You bomb the ledge, and rocks fall, blocking the door in and out of the demon's lair."; move bomb to House_Bomb; give bomb ~concealed; rtrue; } ], has concealed; !---------------------------------------------------------------------- ! Area in Town between the two doors to the Demon's Lair Object Town_G "Town, Paths = S, N" with description "You are approaching the demon's lair. You see a sign that says ^ ~THE PATH TO YOUR DESTINY IS CLEAR~", s_to Blue_Door, n_to Town_E, has light; ! The blue door is one of the two doors that leads to the Demon's Lair ! You need the blue key to unlock it Object -> Blue_Door "Blue Door to the Demon's Lair" with name "blue" "door", description "The door to the demon's lair has a blue lock", when_open "The door is open.", when_closed "The door is closed.", door_to Lair_A, door_dir s_to, with_key blue_key, has static door openable lockable locked; ! Objects in the Forest !---------------------------------------------------------------------- ! Entrance to Forest Object Forest_A "Forest, Paths = E, W" with description "You are in the forest. The west path leads deeper into ^ the forest, while the east path leads back to the town^", e_to Town_A, w_to Forest_B, has light; ! The Leaf has no use in the game. Object -> Leaf "leaf" with name "leaf"; !---------------------------------------------------------------------- ! Path in forest with bubble, trees, and hook Object Forest_B "Forest, Paths = N, S, E" with description "You are in the forest, there are paths to the north, east, ^ and south.^", e_to Forest_A, s_to Forest_C, n_to Forest_D, has light; ! Bubble which makes Nick's house appear. Bubble disappears once he ! touches it. Object -> Bubble_D "bubble" with name "bubble", before [; take: give Door_Nick ~concealed; print "As soon as you take the bubble, you hear a faint voice. ^ The voice says, ~A house has been re-created in the southwest ^ corner of the town. Better go and check it out~"; move Bubble_D to trash; rtrue; ]; ! When player tries to climb the trees, the hook shakes out Object -> Trees "trees" with name "trees", article "some", before [; Climb: if (Hook in Trees) { move Hook to Forest_B; print "a hook fell out of trees as you tried to climb the trees"; rtrue; } ], has static; ! Hook can be attached to rope in order to make the hooked rope Object -> -> Hook "hook" with name "hook", article "a", before [; puton, insert: if (second == rope) { move Rope_Hook to Player; print "You tied the rope to the hook"; move rope to trash; move hook to trash; rtrue; } ]; !---------------------------------------------------------------------- ! Forest Path with fire shield Object Forest_C "Forest, Paths = N" with description "You are in the forest, there is a path to the north.^", n_to Forest_B, has light; ! The fire shield is needed to get by the dragon in the cave. Object -> Shield "fire-proof shield" with name "shield" "fire"; !---------------------------------------------------------------------- ! Forest Path with vines Object Forest_D "Forest, Paths = S, W" with description "You are in the forest, there is a path to the south.^ The west path has some vines in the way^", w_to Path, s_to Forest_B, has light; ! Path that is concealed by the vines, vines need to be cut before ! you can use the path. Object -> Path "path" with name "path", description "The path is open", when_open "The path is open", when_closed "The path is closed", door_to Forest_E, door_dir w_to, has static door open concealed; ! The vines block the path and need to be cut using the knife, ! in order to unconceal the path. Object -> Vines "vines" with name "vines", before [; cut: if (knife in Player) { give path ~concealed; print "You cut the vines with your knife"; rtrue; } ], has static; !---------------------------------------------------------------------- ! Forest Path with pit Object Forest_E "Forest, Paths = E, W" with description "You are in the forest, there is a path to the east.^ The west path is blocked by a bottomless pit^", e_to Forest_D, w_to Pit, has light; ! The pit blocks the west path, the player can swing over it using ! the rope hook. Object -> Pit "bottomless pit blocking the west pathway" with name "pit", when_open "A seemingly bottomless pit blocks the west pathway.", door_to [; if (Rope_Hook in Branch) { print "You swing across the pit an into the next path"; return Forest_F; } else { deadflag=1; "You try to cross the pit, but fall to your death"; } ], door_dir w_to has static door open; ! Rope hook hooks on to the branch so the player can swing across Object -> Branch "branch above the pit" with name "branch", has static; !---------------------------------------------------------------------- ! Forest Path with bubble Object Forest_F "Forest, Paths = E" with description "You are in the forest, there is a path to the east.^", e_to Forest_E, has light; ! Bubble which makes Sam's house appear. Bubble disappears once he ! touches it. Object -> Bubble_A "bubble" with name "bubble", before [; take: give Door_Sam ~concealed; print "As soon as you take the bubble, you hear a faint voice.^ The voice says, ~A house has been re-created back in the ^ northwest corner of the town. Better go and check it out~^"; move Bubble_A to trash; rtrue; ]; ! Objects in the Cave !---------------------------------------------------------------------- ! Cave Entrance Object Cave_A "Cave, Paths = E, W" with description "You are in the cave, the east path leads deeper in the cave.^ The west path leads back to town^", w_to Town_C, e_to Cave_B, has light; !---------------------------------------------------------------------- ! Cave Path Object Cave_B "Cave, Paths = E, W, S" with description "You are in the cave, the east, west, and south paths ^ leads deeper in the cave.^", w_to Cave_A, e_to Cave_D, s_to Cave_C, has light; !---------------------------------------------------------------------- ! Cave Path with ogre, knife, and bubble Object Cave_C "Cave, Paths = N" with description "You are in the cave, the north path is the only way out. ^ A menacing looking Ogre is here. It has a knife.^", n_to Cave_B, has light; ! Bubble which makes the Bomb Shop appear. Bubble disappears once he ! touches it. The Ogre will attack anybody who comes near it. Object -> Bubble_F "bubble" with name "bubble", before [; Take: if (Player in Cave_C && Ogre in Cave_C) { deadflag=1; "As you reach to take the bubble, the ogre comes and slashes you with his knife"; } else { give Door_Bomb ~concealed; print "As soon as you take the bubble, you hear a faint voice.^ The voice says, ~A house has been re-created back in the ^ southeast corner of the town. Better go and check it out~"; move Bubble_F to trash; rtrue; } ]; ! Ogre guards the bubble with his knife. It will kill anyone that ! comes near it. Object -> Ogre "ogre" with name "ogre", article "an", before [; Attack: deadflag=1; "You try to fight the ogre, but lose"; ], has static; ! The knife is needed to cut the vines in the forest. Object -> -> Knife "knife" with name "knife", article "a"; !---------------------------------------------------------------------- ! Cave Path with rocks blocking the path Object Cave_D "Cave, Paths = W, N" with description "You are in the cave. The west path leads deeper in the cave^ The north path is blocked by a big pile of rocks^", w_to Cave_B, n_to Path2, has light; ! Path that is concealed by the rocks, rocks need to be bombed before ! you can use the path. Object -> Path2 "path" with name "path", description "The path is open", when_open "The path is open", when_closed "The path is closed", door_to Cave_E, door_dir n_to, has static door open concealed; ! The rocks block the path, they need to be bombed to open the path Object -> Rocks "rocks blocking a path" with name "rocks", article "some", has static; !---------------------------------------------------------------------- ! Cave Path with dragon Object Cave_E "Cave, Paths = S, E" with description "You are in the cave, a dragon is guarding the east door.^ There is also a path to the south^", e_to Dragon, s_to Cave_D, has light; ! The dragon guards the east path. Only people with the shield will get ! by without getting killed. Attacking the dragon is also futile. Object -> Dragon "dragon" with name "dragon", article "a", when_open "A dragon blocks the east path", door_to [; if (shield in player) { print "As you walk up to the dragon, it breathes fire on you,^ however you had the fire-proof shield and walk past without^ any harm.^"; } else { deadflag=1; "As you try to pass by the dragon, it breathes fire^ and you get burned."; } return Cave_F; ], door_dir e_to, before [; Attack: deadflag=1; "You try to fight the dragon, but lose^"; ], has static door open; !---------------------------------------------------------------------- ! Cave Path with bubble Object Cave_F "Cave, Paths = W" with description "You are in the cave, the only path is to the west", w_to Cave_E, has light; ! Bubble which makes Ray's House appear. Bubble disappears once he ! touches it. Object -> Bubble_C "bubble" with name "bubble", before [; take: give Door_Ray ~concealed; print "As soon as you take the bubble, you hear a faint voice. ^ The voice says, ~A house has been re-created back in the ^ northeast corner of the town. Better go and check it out~^"; move Bubble_C to trash; rtrue; ]; ! Objects in the Demon's Lair !---------------------------------------------------------------------- ! The Path through the Demon's lair can be solved from the opening sign ! "The Path is CLEAR" Various people also had two letter clues, which ! when put in order say "CE" "LS" "EW" "AW" "RN". The first letters spell ! CLEAR, while the second letters represent directions in getting through ! the maze. ! East Path leads onward. Object Lair_A "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Town_E, e_to Lair_B, s_to Lair_A, w_to Lair_A, has light; ! South Path leads onward. Object Lair_B "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Town_E, e_to Lair_A, s_to Lair_C, w_to Lair_A, has light; ! West Path leads onward. Object Lair_C "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Town_E, e_to Lair_A, s_to Lair_A, w_to Lair_D, has light; ! West Path leads onward. Object Lair_D "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Town_E, e_to Lair_A, s_to Lair_A, w_to Lair_E, has light; ! North Path leads onward. Object Lair_E "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Lair_F, e_to Lair_A, s_to Lair_A, w_to Lair_A, has light; ! This room contains the final bubble for the Mayor's house Object Lair_F "Demon's Lair, Paths = S, W, N, E" with description "You are in the Lair Maze", n_to Town_E, e_to Lair_A, s_to Lair_A, w_to Lair_A, has light; ! Bubble which makes the Mayor's House appear. Bubble disappears once he ! touches it. Object -> Bubble_B "bubble" with name "bubble", before [; take: give Door_Mayor ~concealed; print "As soon as you take the bubble, you hear a faint voice.^ The voice says, ~A house has been re-created back in the ^ north central part of the town. Better go and check it out~^"; move Bubble_B to trash; rtrue; ]; ! Contains objects not in use. Object Trash "Trash" with description "Trash", has light; ! ---------------------------------------------------------------------------- ! Grammar ! ! The grammar section includes the file "Grammar" and will later include ! extensions to the standard grammar library. ! ! ---------------------------------------------------------------------------- Include "Grammar";