!Game Honey Quest !Project 2 for CIS 587 Summer !Jianrong Huang !Version 1 Constant Story "Honey Quest"; Constant Headline "^^Project 2 for CIS 587^by Jianrong Huang^^"; Constant DEBUG; !Possible values for a monkey’s state property: Constant FLOOR_STATE = 0; !Playing on floor Constant FIGHT_STATE = 1; !Fighting with a nut Constant EAT_STATE = 2; !Eating nuts Constant MAX_SCORE=100; Include "parser"; Include "verblib"; Include "grammar"; [Initialise; location = Tom_Bear_Room; StartDaemon(Monkey); print " ^^After a long, long winter, the Spring has come at last. Tom Bear woke up. He stretched and yawned. Standing on the floor of his home in bare feet and shorts, he decided that he would like to get some fresh air and enjoy the sunshine of the Spring.^^"; ]; [ Inside x y; do { x = parent(x); } until (x == 0 or y); if (x == 0) rfalse; ]; !Magic word [ YENOHYENOHYENOHSub; "Nothing happens."; ]; Verb "honeyhoneyhoney" * -> YENOHYENOHYENOH; !------------------------------------------------------- ! Tom Bear’s house !------------------------------------------------------- Object Tom_Bear_Room "In Tom Bear Room" has light enterable with name "room" "house", description "There is a Stone table and two chairs, just the right size for a bear. To the left there is a little cupboard, and the cupboard is where Tom Bear stores all his food, but it is now empty. Opposite of the cupboard is a bed made out of leaves and other soft materials. Right next to the bed is a door, and it has a big lock on it, opposite of this door is a closed window.", out_to In_Front_of_House, before[; if (Exitdoor hasnt general ) rfalse; Exit, Go: if(noun==d_obj or out_obj) "That is not the way to go out the house!"; Examine, Enter, ThrowAt, ThrownAt:; default: if(inp1~=1 && noun ~=0 && Inside (noun, Exitdoor) == 0) "You can’t ", (the) noun, " from up here."; if(inp2~=1 && second ~=0 && Inside (second, Exitdoor) == 0) "You can’t ", (the) second, " from up here."; ]; Object->Stone_table "stone table" has supporter concealed with name "table", description "The table is made out of stone."; Object->chair "chair" has scenery with description "Its size is just right for a bear"; Object->bed "bed" has scenery with description "It’s soft with dry leaves and other types of soft stuffing, it also smells a little like pine."; Object-> Cupboard "cupboard" has concealed enterable supporter static !general if Tom Bear have found nuts from here with name "little" "cup" "board", description "Tom Bear stores all his honey in the cupboard, but it’s now empty.", before[; LookUnder: if(player notin Tom_Bear_Room) "Tom Bear is unable to reach the cupboard from here."; if(self hasnt general){ give self general; move nut to player; move nuts to player; score=score+10; "Tom Bear find the nots under bottom of the cupboard."; } ]; Object->window "window" has concealed static with name "window" "pane", description[; if(self hasnt general) print "^There is misty glass and everything outside is fuzzy threw the glass.^"; else print "^There is a mountain out side with rocks on the bottom, trees in the middle and honey on top.^"; ], before[; give self general; score=score+5; open: "^A sunlit and enchanting scene of spring. Tom Bear is very happy but he feels that his tummy was empty. He remembered a old myth about a huge pot of honey buried at the top of the mountain, and that mountain can be seen from Tom Bear's window."; search: <>; ]; Object->lock "lock" has static concealed !general if unlock the lock with name "bolt" "lock" "chain", description "^The lock is fastened to the wall and locks with the door.^", before[; Unlock, Open: if(player notin Tom_Bear_Room) "^Tom Bear will have to get off ", (the) parent(player), " first."; else{ give self general; score=score+5; "Now, the door is unlocked.^"; } ]; Object->Exitdoor "door" has static concealed enterable with name "exit" "door" "wood" "outside" "brown", description "^This is the only way to get out of the house. ", before[; GoTo, Push, Exit, Open: if (lock hasnt general) "The door is locked." ; if (window hasnt general) "Tom Bear does not know where he will be going."; if(Monkey.state ~= EAT_STATE) "Tom Bear does not have his clothes. He can not go out."; else give self general; "^Tom Bear found the way to go. Now go ahead to take your honey."; !Deadflag=2; ]; !------------------------------------------------------- ! Monkeys !------------------------------------------------------- Object Monkey "monkeys" Tom_Bear_Room has animate with name "monkeys", state FLOOR_STATE, describe[; switch (self.state) { FIGHT_STATE: "^These two monkeys are fighting for one piece of nut."; EAT_STATE: "The two monkeys are happy to share these nuts."; FLOOR_STATE: "^Two monkeys are playing a shirt and pants together on the floor."; default: rtrue; } ], description "How cute these two monkeys are.", life [; Ask, Order: print_ret "These monkeys stop playing and look at Tom Bear with such a clever expression that Tom Bear are certain that they don't understand any word you saying."; Attack: "These two monkeys run away. Tom Bear can't catch them and get the shirt and pants."; Give, ThrowAt: if ( noun == nut) { move noun to Tom_Bear_Room; self.state = FIGHT_STATE; score=score-10; "Tom Bear toss ", (the) noun, " onto the floor.", (The) self, " begin to fight each other for one nut, but Tom Bear can not get his clothes. "; } else{ if ( noun == nuts) { move noun to monkey; self.state = EAT_STATE; give player general; score=score+20; "Monkey returns back the shirt and pants to Tom Bear. "; } else { if ( noun ~=nuts || noun ~= nut) { if (action == ##ThrowAt) { move noun to Tom_Bear_Room; score=score-5; print "Tom Bear toss ", (the) noun, "onto the floor, but ", (the) self; } else print (The) self; " just examines ", (the) noun, " with a quizzical expression."; } } } ], daemon [; if(player in Tom_Bear_Room){ give self ~general; new_line; print (The) self; switch (self.state) { FLOOR_STATE: switch (random(4)) { 1: " fight over the pants, then the yellow one put the pants on his head."; 2: " fight over the shirt, then the black one hangs the shirt on his tail."; 3: " fight over the pants and shirt."; 4: " try to wear them but they have no idea how."; } FIGHT_STATE: switch (random(4)) { 1: " bite each other."; 2: " hurl the nut across the room."; 3: " snatch from each other."; 4: " try to pull each other tails off."; } EAT_STATE: switch (random(4)) { 1: " pick at nuts."; 2: " chew thoughtfully."; 3: " pig nuts down."; 4: " eat nuts."; } } } ]; Object Nut "nut" Tom_Bear_Room has edible concealed with name "nut", before[; take: if(Cupboard hasnt general) "Tom Bear, the nuts were stored somewhere last winter."; else "Taken a nut."; ]; Object Nuts "nuts" Tom_Bear_Room has edible concealed with name "food" "nuts", describe [; if (Monkey.state == EAT_STATE) rtrue; ], description "Nut is favor food for monkey.", before[; take: if(Cupboard hasnt general) "Tom Bear, the nuts were stored somewhere before last winter."; else "Taken some nuts."; ], after[; Give: if(Monkey.state == FLOOR_STATE) Monkey.state = EAT_STATE; ]; !------------------------------------------------------------------- ! Outside of Tom Bear’s house !------------------------------------------------------------------- Object In_Front_of_House "In the front of House" has light with name "yard" "garden", description "^Tom Bear is standing in the front of his house. There is a forest before his house. The mountain is behind his house.", in_to Tom_Bear_Room, n_to Forest_and_House, w_to Lake, e_to Side_Walk; Object Lake "to lake" has scenery light with name "lake" "water", description "^This a great lake. You can not cross it.", before[; Go: score=score-5; ], e_to In_Front_of_House; Class OutsideHouse has light; OutsideHouse Side_Walk "Sidewalk" with description "^In order to get to the road leading to the mountain, Tom Bear must start from the path.", s_to Sharp_Rocks_Road, u_to Sharp_Rocks_Road, w_to In_Front_of_House, name "sidewalk" "path"; OutsideHouse Sharp_Rocks_Road "Sharp Rocks Road" with name "sharp" "road" "street" "rocks", description [; if(BlueBoots in player){ score=score+15; print "Now, Tom Bear may pass it"; } else { score=score-15; print "^Oops, Tom Bear can not pass the sharp rocks without wearing boots."; } ], u_to Top_Mountain, n_to Side_Walk, d_to Side_Walk; OutsideHouse Top_Mountain "On the top of mountain" with name "mountain" "bump" "incline" "top", description "^On the top of the mountain, there is a tower. A note on the door of the tower says, ~Magic word YENOHYENOHYENOH.~", before [; YENOHYENOHYENOH: PlayerTo(In_Side_Tower); score=score+10; rtrue; ], has supporter enterable; Object Table "Table" with name "top" "table", description "A pot is on the table. A magical sound comes from some where ~Come my child, the honey is here, please take it.~", has light; Object->Pot "Pot of honey" has edible with name "pot" "honey", description "^The honey is magic , it refills itself each day.", before[; if (player notin Table) "^Tom Bear can not reach the pot from where he is standing." ; Take: score=score+20; "^Congratulation! Tom Bear has the honey.^^", Deadflag=2; ]; OutsideHouse Forest_and_House "Road between forest and house" with description "^This is the way that leads you to the forest, where a couple pairs of boots are hidden.", s_to In_Front_of_House, n_to In_Forest, name "dirt" "path"; OutsideHouse In_Forest "In forest" with name "forest" "tree" "bushes" "dark" "berry", description "^It is a dark forest, and it is also rather damp. Many cobras hide beneath the hundreds of layers of leaves on the ground. If you get bitten by one you will surly die. The trees are hundreds of feet tall and would be impossible to climb on. However there are also lots of berry bushes with yummy berries, but watch out they could be poisonous.", s_to Forest_and_House, has enterable light; Object Leaves "leaves" In_Forest has enterable static supporter ! general if Tom Bear have found the boots under leaves with name "leaves", description "^These leaves are very soft, they are left over from thousands of Autumns. It is the best place for a snake to live.", before[; Push, Pull: "^Be careful, some snakes are sleeping here!"; LookUnder: if(player in ~In_Forest) "Tom Bear unable to reach the leaves from here."; if(self hasnt general) { give self general; score=score+15; move BlueBoots to player; "^Congratulation! Tom Bear has found the boots and puts them on."; } ]; Class BlueBoots with name "blue" "boots" , short_name "blue boot", plural "blue boots", has enterable concealed; Class RedBoots with name "red" "boots" , short_name "red boot", plural "red boots", has enterable concealed; BlueBoots->; RedBoots->; ! -------------------- ! A MazeTower ! -------------------- Class MazeTower has light with name "inside" "tower" "Maze", out_to "Find the honey, you will never need to be worry for food.", description "This is a maze tower."; MazeTower In_Side_Tower "In Side of Tower" with s_to At_Second_Floor, e_to At_Fifth_Floor, w_to At_Basement, n_to At_Eleventh_Floor, u_to At_Fourth_Floor, d_to At_Basement; MazeTower At_Second_Floor "Second Floor" with w_to In_Side_Tower, s_to At_Basement, e_to In_Third_Floor, n_to At_Fourth_Floor, u_to At_Eleventh_Floor; MazeTower In_Third_Floor "Third Floor" with e_to At_Eleventh_Floor, d_to Table, s_to At_Fifth_Floor, w_to At_Basement; MazeTower At_Fourth_Floor "Fourth Floor" with s_to In_Side_Tower, w_to At_Basement, e_to At_Eleventh_Floor, u_to At_Fifth_Floor, n_to At_Sixth_Floor; MazeTower At_Fifth_Floor "Fifth Floor" with s_to In_Side_Tower, n_to At_Basement, w_to At_Eleventh_Floor, e_to At_Fifth_Floor, u_to At_Sixth_Floor; MazeTower At_Sixth_Floor "Sixth Floor" with s_to In_Side_Tower, e_to At_Basement, n_to At_Eleventh_Floor, d_to At_Fifth_Floor, w_to At_Fourth_Floor; MazeTower At_Eleventh_Floor "Eleventh Floor" with d_to In_Third_Floor, w_to At_Basement, e_to At_Fifth_Floor, s_to At_Sixth_Floor; MazeTower At_Basement "Basement" with u_to In_Side_Tower, w_to At_Fourth_Floor, e_to At_Fifth_Floor, n_to At_Eleventh_Floor;