!============================================================================ ! Program name: onimusha.inf ! Program author: Man K. Woo ! Project: CIS 587 Assignment 1 ! Note: This game is test in WinFrotz after compiled. !============================================================================ Constant Story "Onimusha Warlords"; Constant Headline "^CIS 587 Assignment no.2 ^by Man K. Woo.^"; Release 1; Serial "101602"; Constant MAX_SCORE = 7; ! This is the max score that the play can get Constant MAX_CARRIED = 5; ! This is the max number of items that the player can carry at one time Include "Parser"; Include "VerbLib"; !============================================================================ ! Object classes Class Room ! This is a container class for a room that has light has light; Class Prop ! This is a container class for any prop in the game with before [; Examine: return false; default: print_ret "You don't need to worry about ", (the) self, "."; ], has scenery; Class Furniture ! This is a container class for any furniture with before [; Take,Pull,Push,PushDir: ! If player tries to take, pull, push or pushdir the furniture: print_ret (The) self, " is too bulky for that."; ], has static; Class Arrow ! Class for an arrow with name 'arrow' 'arrows//p', article "an", plural "arrows", description "They are sharp and new.", before [; Drop: print_ret "What are you going to do with the bow then?"; ]; Class NPC ! This is a class for Non-player character with life [; Answer,Ask,Order,Tell: print_ret "Just use T[ALK] [TO ", (the) self, "]."; ], has animate; !============================================================================ ! The game objects ! The corridor is a the first room that the player enters Room corridor "A long corridor" with description [; print "This is a dim and long corridor. There are a broken vase and a short blade on the floor. Dead bodies are lying along the way. There aren't any rooms on both sides, but you can see some lights ahead in the north direction.^"; if (self hasnt visited) print "^~Kaede, be careful.~ you say, ~and stay close to me.~^"; ], n_to end_corridor, ! Go north to the end of the corridor s_to "You need to hurry up to save Princess Yuki!"; ! Player can't go back south from where he comes from Prop "broken vase" ! This is one of the props found in the corridor with name 'broken' 'vase', description "The vase is broken into pieces, you have little interested in it.", found_in corridor; Prop "short blade" ! This is one of the props found in the corridor with name 'short' 'blade', description "The short blade is designed for female ninja, but it's now damaged.", found_in corridor; Prop "dead bodies" ! This is one of the props found in the corridor with name 'dead' 'bodies' 'carcases', description "These are the dead bodies of the samurai in this castle, some of them are very terrifying.", found_in corridor end_corridor; !------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ! The ending of the corridor is connecting to the hall Room end_corridor "Far end of the corridor" with description "Just a little further north, you will reach the exit of the corridor. But at the same time, you notice something moving in the stack of dead bodies. It's a man! a surviving man.", n_to hall, ! Go north to hall s_to corridor; ! Go south back to the corridor ! Samurai is a NPC found in the end of the corridor NPC injuredsamurai "Samurai" end_corridor with name 'injured' 'injured' 'samurai', description "The samurai is injured seriously, moanning and lying on the floor. He seemed to have been involved in a big fight.", initial [; print "The samurai is alive, but seriously injured, waiting for help.^"; if (location hasnt visited) { ! If the player just comes here print "^The samurai says, ~Sir, please save Princess Yuki! I saw that bastard kidnaps our princess, heading to the north from here. Don't stay here with me. I'm okay. Go! Rescue Princess Yuki!~^"; } ], times_spoken_to 0, ! for counting the conversation numbers life [; Give: if (noun ~= herb) ! If the player gives a non-herb item to him print_ret "Thank you, sir, but I don't find it useful."; else { ! If the player gives a herb to him score = score + 1; ! Add one point to player move noun to self; move mirror to player; ! Samurai gives a mirror to player as reward print_ret "~Thank you, you are very kind. I can take care of myself now. Let me give you this sacred mirror as a reward.~"; } Kiss: print_ret "~Ooh, I'm not gay!~"; ! If player tries to kiss samurai Attack: print_ret "He's the only survivor, you still want to kill him?"; ! If player tries to kill samurai ! check how many times the player tries to talk with him Talk: self.times_spoken_to = self.times_spoken_to + 1; switch (self.times_spoken_to) { 1: score = score + 1; ! If this is the first time that player talks with him print_ret "I know it's him, Nobunaga! Sir, you must save Princess Yuki. Please!"; ! If player keeps on talking with him 2: print_ret "~Hurry, there is no time left.~"; default: return false; } ], has male proper; ! samurai is a man !---------------------------------------------------------------------------- ! Hall is a big room which has 4 exits on each of its side ! East leads to the red-door room ! South leads to the end of corridor ! West leads to the blue-door room ! North leads to the yellow-door room Room hall "A big hall" with description "This is a big hall with the long corridor in the south direction. You can find some chairs, lamps and a notice board. ^^There are also three doors :red door, yellow door and blue door, that are supposed to be connecting to other rooms. ^^You can see them in the east, north and west direction respectively.", e_to [; ! Tell the player that he needs to use a key to open this door print_ret "You need to have a special key to open this red door."; ], n_to [; ! Tell the player that he needs to use a key to open this door print_ret "You need to have a special key to open this yellow door."; ], w_to [; ! Tell the player that he needs to use a key to open this door print_ret "You need to have a special key to open this blue door."; ], s_to end_corridor; ! Go south back to the end of corridor ! lamps are the furniture found in the hall Furniture lamps "lamps" hall with name 'lamp' 'lamps', description "They are only small lamps, and are broken.", before [; Search: <>; ], has scenery; ! chairs are the furniture found in the hall Furniture chairs "chairs" hall with name 'chair' 'chairs', description "They are crappy chairs!", before [; Search: <>; ], has scenery; ! notice board is the furniture found in the hall Furniture board "notice board" hall with name 'notice' 'board', description "The notice board says, ~Workers: go to the store room through the red door!~", has scenery; !---------------------------------------------------------------------------- ! This room has a red door which leads to an exit outside the castle Room red_room "The red-door room" with description "It is only a little dirty store room which has an exit in the east direction.", w_to hall, ! Go west back to the hall e_to [; deadflag = 3; ! Game over with a bad ending print_ret "Running with Kaede, you leave the castle and continue to search for Princess Yuki. However, you would never find her."; ]; !---------------------------------------------------------------------------- ! This room has a blue door which contains demons and a yellow key Room blue_room "The blue-door room" with description [; print "This room is totally ruined in the battle. "; if (self hasnt visited) print "^^Suddenly, you heard of some strange roaring on top of you. When you look up, you are shocked! There are demons crawling on the wall! You have never seen such ugly creatures in your life.^"; ], attacks_count 0, ! for counting the attack of player before [; Go: if (noun == e_obj) { ! If player wants to go back to the hall if (demon.has_been_killed == true) { ! If player has killed the demons already PlayerTo(hall); ! Player goes back to hall return false; } else { self.attacks_count = self.attacks_count + 1; ! Count how many turns left for player to attack switch (self.attacks_count) { ! Two turns left for the player to attack 1: print_ret "The demons are approaching you, they won't let you run away!"; ! One turn left for the player to attack 2: print_ret "The demons are attacking you fiercely. You'd better counter their attacks!"; ! Too late for the player to attack, the demons kill the player default: style underline; print "Samonosuke,"; print "your skills are not good enough. And the demons are too strong. They slash you and Kaede into pieces.^"; deadflag = 3; ! Game over with a bad ending print_ret "You and Kaede had failed your mission and Princess Yuki is never found."; } } } ]; ! Demons are the prop found in the blue room Prop demon "Demons" blue_room with name 'demon' 'demons' 'monster' 'monsters', description "They're brutal and horrible creatures. You'd better kill them or you suffer.", has_been_killed false, ! Demons are not killed at the beginning before [; FireAt, attack: ! When player tries to shoot or attack demons score = score + 1; ! Give one point to the player self.has_been_killed = true; ! Demons are killed print_ret "Your fast action kills the demons. You are a strong onimusha."; ! When player tries to kiss the demons Kiss: print_ret "Are you nuts?"; ! When player tries to talk to the demons Talk: print_ret "~......~"; ], has animate pluralname proper; !---------------------------------------------------------------------------- ! This room has a yellow door which contains Nobunaga and Princess Yuki Room yellow_room "The yellow-door room" with description "You enter into a large dinning room. As you expected, all the furnitures are demolished. All of a sudden,^ ~HELP! Somebody help!~ You recognize this voice is Princess Yuki's. You look at the direction where the voice comes from and you see them! Princess Yuki and the evil warlord, Nobunaga Oda!^^ You shout, ~You evil! Release Princess Yuki immediately or you won't see the sunset tomorrow!~^^ Grasping Princess Yuki's neck, Nobunaga's face is wearing a cunning smile. He says,^ ~You foolish human scum, do you think you can stop me? do you think your poor strength can match with my great evil power? You idiot!", cant_go "What? Are you going to leave your poor Yuki here?"; ! When player tries to leave this room ! Nobunaga is a NPC found in the yellow room NPC nobunaga "Nobunaga" yellow_room with name 'nobunaga' 'oda' 'evil', description "Nobunaga, one of the greatest warlords, is wearing a black and shinny armor. He is holding a long sword and his face gives you a chill feeling. Doubtlessly, he is brutal and cruel.", initial [; print "Nobunaga is obviously very confident to himself.^"; if (location hasnt visited) ! If the player just comes here print "^~Foolish samurai, you'd better stop there. If you take one more step forward, I will kill Princess Yuki at once! You can try to fight me, but I doubt you will risk your Princess's life.~^"; ], times_spoken_with 0, ! for counting the conversation numbers life [; ! Check the number of times that the player talks with him Talk: self.times_spoken_with = self.times_spoken_with + 1; switch (self.times_spoken_with) { 1: score = score + 1; ! When this is the first time that the player talks with him print_ret "He yells, ~You have no choice, samurai. Now, either your princess got killed or you shoot your friend, the ninja next to you! Do it!"; default: print_ret "~Do it!!!~"; ! When the player keeps on talking with him } ], before [; Attack, FireAt: if (NotBowOrArrow(second)) return true; ! If player tries to attack or shoot him deadflag = 3; ! Game over with a bad ending print_ret "You cannot just kill Kaede, and while you pretend to shoot her, you turn and fire at Nobunaga! ^^The evil cannot react with this surprised attack; However, you are too confident to your skill. Not only does your arrow pierces his heart, but also Princess Yuki's. They both die at the scene. ^^Your heart fills with sorrow and you regret what you have done on Princess Yuki. One week later, you commit suicide as you feel so guilty."; ], has animate male proper; ! Nobunaga is a man ! Yuki is a NPC found in yellow room NPC yuki "Yuki" yellow_room with name 'princess' 'yuki', description "She is tied up by Nobunaga, but it seems that she does not have any injuries.", life [; Talk: print_ret "~Samosuke!!! Help me!~"; ! If player tires to talk with her ], before [; Attack, FireAt: print_ret "Are you insane? She's the princess!"; ! If player tries to attack or shoot her ], has animate female proper; ! Yuki is a girl !============================================================================ ! Player's possessions ! This is the sword of the player Object sword "sword" with name 'sword', description "Made of refined steel, it virtually slashes everything!", before [; Drop,Give: print_ret "You need to be survived with this."; ! Player can't drop or give it ]; ! This is the bow of the player Object bow "bow" with name 'bow', description "Your great bow, a present from your master.", before [; Drop,Give: print_ret "What are you going to do with the arrows then?"; ! Player can't drop or give it ] has clothing; ! This is the quiver that holds the arrows Object quiver "quiver" with name 'quiver', description "Just a normal quiver to hold arrows.", before [; Drop,Give: print_ret "Are you going to hold the arrows in your bare hands?"; ! Player can't drop or give it ], has container open clothing; ! This is a herb that is supposed to give to the samurai Object herb "herb" with name 'herb', description "They can cure your injuries. Very efficient.", before [; Eat, Use: print_ret "You don't need this now. You are 100% healthy!"; ! Player can't use or eat it ]; ! This is the red key that can open the red door, found in the corridor Object RedKey "red key" corridor with name 'red' 'key', description "It is a red key, should be useful in somewhere.", before [; ! Player can only use the key in the hall to open the red door Use: if (location ~= hall) print_ret "You can't use it here."; else PlayerTo(red_room); ]; ! This is the blue key that can open the blue door, found in the corridor Object BlueKey "blue key" corridor with name 'blue' 'key', description "It is a blue key, should be useful in somewhere.", before [; ! Player can only use the key in the hall to open the blue door Use: if (location ~= hall) print_ret "You can't use it here."; else PlayerTo(blue_room); ]; ! This is the yellow key that can open the yellow door, found in the blue room Object YelloKey "yellow key" blue_room with name 'yellow' 'key', description "It is a yellow key, should be useful in somewhere.", before [; ! Player can only use the key in the hall to open the yellow door Use: if (location ~= hall) print_ret "You can't use it here."; else PlayerTo(yellow_room); ]; ! Place the 10 arrows to the quiver Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; Arrow "arrow" quiver; ! Kaede is a NPC that is moving with the player NPC kaede "Kaede" with name 'kaede' 'female' 'ninja' 'assistant', description [; ! Description of Kaede changes when she is in the yellow room if (location == yellow_room) print_ret "Kaede's face is so pale, you know that she feels hopeless now. But she pretends to be very brave and be alerted."; else print_ret "Being your great female assistant, she's fast and sexy."; ], life [; Give: ! If the player tries to give a non-mirror item to her if (noun ~= mirror) print_ret "Thank you, Samonosuke, but I don't need it."; else { ! If the player tries to give the mirror to her score = score + 1; ! Give one point to the player move noun to self; ! Give the mirror to her print_ret "~Thank you, Samonosuke.~"; } Kiss: print_ret "Samonosuke, are you out of your mind?"; ! If player tries to kiss her Talk: if (location == yellow_room) ! If player talks to her in the yellow room print_ret "~Samonosuke, what should we do?~"; else ! If the player talks to her elsewhere print_ret "~Samonosuke, we got to be hurry!~"; ], before [; Examine,Listen,Talk: return false; ! If player types examine, listen or talk Attack, FireAt: ! If player tries to attack or shoot Kaede if (location == yellow_room) { ! If the player tries to kill her in the yellow room if (NotBowOrArrow(second)) return true; deadflag = 3; ! Game is over with a bad ending print_ret "You are no different with the evil lord. How can you kill your assistant?"; } ! If the player tries to kill her elsewhere else print_ret "Are you serious? She is your helpful and reliable assistant!"; ], found_in [; return true; ], has female proper scenery transparent; ! Kaede is a pretty girl :) ! Mirror is the object given by the samurai if the player gives him the herb Object mirror "sacred mirror" with name 'sacred' 'mirror', description [; if (parent(self) == kaede) ! If the mirror is given to Kaede print_ret "It is inside Kaede's hagama (samurai uniform) now."; else ! If the player examines the mirror score = score + 1; ! Give one point to the player print_ret "The sacred mirror has some sort of magic! It is penetrable.^^ When you throw a stone to it, the stone penetrates the mirror, and then bounces back at once.^^But you think that it's more suitable for a lady than a samurai like you."; ], before [; Drop: print_ret "This mirror looks weird -- better hang on to it."; ! Player cannot drop it ! If the player tries to shoot the mirror outside the yellow room FireAt: if (location ~= yellow_room) return false; if (NotBowOrArrow(second)) return true; ! If the player shoots the mirror in the yellow room score = score + 1; ! Give one point to player deadflag = 2; ! Game over with a good ending print_ret "You place an arrow in the bow and draw back the string, pretending to aim at Kaede's heart. 2 seconds passed, you release the arrow. It flies towards your clever assistant, who knows what your actual plan is.^^The arrow hits the target --- the sacred mirror! Kaede directs the mirror to an angle pointing to Nobunaga and the arrow bounces back, shooting Nobunaga. He is shot right in the middle of his heart. However, his dead body transforms to a thick smoke and disappears!^^ You have successfully safed Princess Yuki and she gives you a kiss, showing her true love to you. ^^But you reject her love, thinking that the love between a princess and a samurai should not exist. And it would hinder your way of the sword.^^ After helping Princess Yuki to rebuild her clan, you continue your quest to find the ultimate way of the sword.^"; ]; !============================================================================ ! Initialization routines [ Initialise; location = corridor; ! Player is at the corridor at the start of the game lookmode = 2; ! like the VERBOSE command move sword to player; ! Give sword to the player move bow to player; ! Give bow to the player move quiver to player; ! Give quiver to the player move herb to player; ! Give herb to the player player.description = "You wear the Orge Armor. This can help you endure attacks from enemies."; ! Story background print_ret "^^ The year is Eiroku 3(AD 1560).The place is ancient fedual Japan. Warlord Nobunaga Oda has just defeated warlord Yoshimoto Imagawa in a surprise night attack and is preparing for the next attack on Yoshitatsu Saito's famous Inabayama Castle in the Mino Prefecture.^^One year later, strange incidents are occuring in Inabayama Castle. Soldiers and workers are disappearing without a trace. Worried by these inexplicable events, Princess Yuki sends a plea for help to onimusha Samanosuke Akechi. At once, he races to the castle. But he arrives too late.^^ Yuki has been kidnapped!!! At the same time, enemy troops are attacking the castle.Leading the army - risen from certain death and astride a fierce warhorse - is warlord Nobunaga Oda! Samanosuke vows to rescue Yuki with the help of his partner kunoichi (female ninja) Kaede and defeat Nobunaga and his army of demon warriors. ^^ Acting as Samanosuke, you have come out from the dark forest, accompanied by Kaede, going into the castle. You are a formidable samurai warrior who are skilled with a sword and a bow. You can only carry at most 5 items at one time. ^^ The castle is so quiet, with dead bodies lying on the floor. Nearly everything is damaged.^"; ]; [ DeathMessage; print "You have screwed up the mission!"; ]; ! Bad ending's message !============================================================================ ! Standard and extended grammar Include "Grammar"; !-------------------------------------------------------------------------------------------- ! Routines to handle the "Talk" command [ TalkSub; if (noun == player) print_ret "Don't be silly."; if (RunLife(noun,##Talk) ~= false) return; ! consult life[; Talk: ] print_ret "At this moment, there is nothing to talk about."; ]; Verb 'talk' 't//' 'converse' 'chat' 'gossip' * 'to'/'with' creature -> Talk * creature -> Talk; !-------------------------------------------------------------------------------------------- ! Routine to validate a weapon [ NotBowOrArrow o; if (o == bow or nothing || o ofclass Arrow) return false; print_ret "That's a weapon, isn't it?"; ]; ! Routine to handle the "Shoot" command [ FireAtSub; if (noun == nothing) print_ret "What, just fire off an arrow at random?"; if (NotBowOrArrow(second)) return true; print_ret "There is no reason to shoot right now"; ]; ! Routine to handle the "Use" command [ UseSub; if (noun == nothing) print_ret "What do you want to use?"; ]; ! Assign more verbs Verb 'fire' 'shoot' 'aim' * -> FireAt * noun -> FireAt * 'at' noun -> FireAt * 'at' noun 'with' noun -> FireAt * noun 'with' noun -> FireAt * noun 'at' noun -> FireAt reverse; !------------------------------------------------------------------------------------------- Verb 'use' * noun -> use; !============================================================================ ! Map of this game: ! W ! ----------------------------- -------|----->N ! | Blue-door Room | ! ----------------------------- ! ^ ! | ! --------------------- ---------------------------- --------------- ----------------------------------- ! | Corridor |===>| End of Corridor | ===>| Hall |===>| Yellow-door Room | ! --------------------- ---------------------------- --------------- ----------------------------------- ! | ! V ! ---------------------------- ! | Red-door Room | ! ---------------------------- ! | ! V ! Exit to outside ! !============================================================================