! Hassan Mehanna ! CIS 487 ! Assignment #1 ! Looking For A Fortune Constant Story "LOOking For A Fortune"; Constant Headline "^^Hassan Mehanna- CIS 487- Assignment #1^^"; Constant DEBUG; !Initializing the state for the thiefs in each case. Constant RUN = 0; !RUNNING AWAY Constant SATISFY = 1; !Getting money or attacked by Junior Constant MAX_SCORE=100; Include "parser"; Include "verblib"; Include "grammar"; !Here the game starts in Junior's Room [Initialise; location = Junior_Room; StartDaemon(thiefs); print "^^Junior,a boy from Cameroon, the country rich in diamonds, has been having dreams every night about his parents since the war in Congo was over.His rich family got killed and robbed. Tonight,he saw his dad in his dream. He told him not to worry about money because he has hidden his real fortune in a safe place on a mountain close to their house in the village. Junior then woke up ^^"; ]; !Player's name [ JuniorSub;] ; Verb "Junior" * ->Junior ; !---------------------------------------------------------------------------------------------- ! In Junior's house !---------------------------------------------------------------------------------------------- !//////////////////////////////////Junior's Room/////////////////////////////////////////////// Object Junior_Room "Junior Room" has light enterable with name "room" "house", description "There is a closed drawer that has a letter from Junior's dad. There is also a safe which Junior's dad used to save money in it. There is a closed door and a window that cannot be opened. Junior sees two men who are taking the map that leads to the fortune.", out_to In_Front_of_House, before[; if (Exitdoor hasnt general ) rfalse; ]; !////////////////////////////////////////Safe//////////////////////////////////////////////////// Object-> safe "safe" has supporter static openable with name "safe", description "Junior's dad used to save his money in this safe, you might use the money to let the user leave you alone.", before[; open: if(player notin Junior_Room) "Junior is unable to reach the safe from here."; if(self hasnt general){ give self general; move Money to player; score=score+10; "Junior finds some money in the safe. That might help!"; } ]; !///////////////////////////////////////Drawer////////////////////////////////////////////////// Object->drawer "drawer" has concealed static openable with name "drawer" , description[; if(self hasnt general) print "^There is a difficulty to read what's in the letter^"; else print "^ The secret is in the drawer. you should examine it. The drawer is closed.^"; ], before[; give self general; score=score+5; open: "^ Inside the drawer, Junior dad's handwritten in a letter says:My son, take the map and go search for the treasure I left for you."; search: <>; ]; !//////////////////////////////////////////Exit Door////////////////////////////////////////////// Object->Exitdoor "door that leads you to the yard of the house" has static door openable with name "exit" "door" "outside", description "^This is the main exit of the house. ", before[; Go, exit: if (self hasnt open) "The door is closed." ; if(thiefs.state ~= SATISFY) "You do not have the map."; else give self general; "^you are ready to go now. Get out and find your dad's fortune! "; !Deadflag=1; ]; !//////////////////////////////////////////Thiefs///////////////////////////////////////////////// Object thiefs"thiefs" Junior_Room has animate with name "thiefs" "thief", state RUN, description "The thiefs don't know about the treasure in the map. they may accept to leave for some money.!!!", life [; Ask, Order: print_ret "The thiefs look at Junior and want to know what he wants to offer them"; Attack: self.state = SATISFY; score=score+10; "Good job! you got the map"; Give, ThrowAt: if ( noun ==Money ) { move noun to thiefs; self.state = SATISFY; give player general; score=score+20; "The thiefs trade the map for the money and run away "; } ], daemon [; if(player in Junior_Room){ give self ~general; new_line; print (The) self; switch (self.state) { RUN: switch (random(2)) { 1: " try to run away with the map but they can't find the exit"; 2: " try to run through the window with the map but cannot do that"; } SATISFY: switch (random(2)) { 1: " are leaving the house"; 2: " Look at each other wondering what's so important about the map!!!"; } } } ]; !//////////////////////////////////////////////////////Money//////////////////////////////////////////////////// Object Money "money" Junior_Room has edible concealed with name "bill" "bills" "money", describe [; if (thiefs.state == SATISFY) rtrue; ], description "Spend few money. Get more. ", before[; take: if(safe hasnt general) give self general; move Money to player; "Taken some dollar bills."; ], after[; Give: if(thiefs.state == RUN) thiefs.state = SATISFY; ]; !--------------------------------------------------------------------------------------------------------------- ! Outside of Junior’s house !--------------------------------------------------------------------------------------------------------------- !//////////////////////////////////////////////////In The Front house (Yard)//////////////////////////////////// Object In_Front_of_House " In front of the house" has light with name "yard", description "^Junior is standing in the yard outside his house. he can't wait to get the fortune ", in_to Junior_Room, n_to Weapon_Store_Road, w_to Nigerian_Border, e_to Road_of_devils; !////////////////////////////////////////////////////Nigerian Border/////////////////////////////////////////// Object Nigerian_Border "to the Nigerian border" has scenery light with name "border", description "^ This is the nigerian border, and there is a war betweer Nigeria and Cameroon. You can't enter there.", before[; Go: score=score-5; ], e_to In_Front_of_House; !////////////////////////////////////////////////////Outside//////////////////////////////////////////////////// class Outside has light; !///////////////////////////////////////////////////Road of Devils///////////////////////////////////////////////// Outside Road_of_devils "road of devils" with description "^The map says that the fortune is hidden in the next village. To get to this village, you need to cross a road called the raod of devils", s_to Dangerous_Zoo, w_to In_Front_of_House, name "road" "devils"; !///////////////////////////////////////////////////Dangerous Zoo////////////////////////////////////////////////// Outside Dangerous_Zoo "Dangerous Zoo" with name "Zoo" "dangerous", description [; if(Gun in player) { score=score+15; "It looks safe to cross the zoo"; } else { score=score-15; "^Danger!Junior needs a gun in order to cross the zoo"; } ], e_to On_The_Hill, n_to Road_of_devils; !//////////////////////////////////////////////////////////////////Weapon Store's Road//////////////////////////////////// Outside Weapon_Store_Road "Road between Weapons store and house" with description "^This road takes you to a huge weapon store in the village where each person can get only one gun and keep it for his safety.", s_to In_Front_of_House, n_to weapon_Store, name "weapon road" ; !///////////////////////////////////////////////////////////////////Weapon's Store//////////////////////////////////////// Outside Weapon_Store "In the weapons store" with name "store" "weapon store", description "^It is a huge store that has all kinds of weapons. many villagers are working there. they are very busy because they say that war might come back and they have to store more weapons. All faces look strict and serious. ", s_to Weapon_Store_Road, has enterable light; !///////////////////////////////////////////////////////////////////Gun///////////////////////////////////////////////////// Object Gun "Gun" weapon_Store has enterable static supporter !general if Junior takes the gun with name "gun" "weapon", description "^This is one of the best guns in the store. it keeps you very safe.", before[; if(self hasnt general) { give self general; score=score+15; move Gun to player; "^Congratulation! You got the gun. You are now safe."; } ]; !///////////////////////////////////////////////////////////On The Hill////////////////////////////////////////////// Outside On_The_Hill "On the hill" with name "on hill", description "^On the door of the village, there is a security guard. you tell him you wanna enter the village. He asks you about your name ", before [; Junior: PlayerTo(In_Village); score=score+10; rtrue; ], has supporter enterable; Object Hill "hill" with name "hill" , description "on the hill, there is a bag full of diamonds. looks like your dad's fortune. It's all in here", has light; !/////////////////////////////////////////////////////////////////Bag///////////////////////////////////////////////// Object->bag "bag" has edible with name "bag", description "^The bag is full of diamonds.", before[; if (player notin Hill) "^You can not get the bag from here." ; Take: score=score+20; "^Congratulation!You got the diamonds.^^", Deadflag=2; ]; ! ---------------------------------------------------------------------------------------------------------------------------- ! Village Of Treasure ! --------------------=------------------------------------------------------------------------------------------------------ Class Village_of_Treasure has light with name "village", out_to "You are almost there now. Just get your dad's treasure.", description "This is the village where the diamonds are hidden. The map says the treasure is hidden on a hill located northern east of the village "; !/////////////////////////////////////////////////////////////////In Village////////////////////////////////////////////// Village_of_Treasure In_Village "In the village" with e_to East_of_Village; !/////////////////////////////////////////////////////////////////East Of The Village////////////////////////////////////// Village_of_Treasure East_of_Village "East of the village" with name "east village", description "You are on your right way. This is the eastern side of the village. Keep going.", n_to North_East; !//////////////////////////////////////////////////////////////////NorthernEastern Of the Village/////////////////////////// Village_of_Treasure North_East "North_East" with name " northern east village", description "You are getting closer. This is the NorthEastern side of the village. You will be rich soon. To get to the hill, you gotta find a way to get there.", u_to Hill;