!============================================================================= ! A conversion from the original MiniAdventure source. Constant Story "Enchanted Castle by Jon Ripley (C) 1995"; Constant Headline "^^The tape begins...Your mission if you decide to accept it is to penetrate the castle grounds and, well, just penetrate the castle grounds.^^A conversion from the original MiniAdventure source.^^"; Serial "050130"; Release 1; ! Constant NO_HEALTH; Constant MAX_SCORE = 0; Include "Parser"; Include "VerbLib"; Global Strength = 70; !============================================================================= ! Object classes Class Room has light; Class Connector with before [; Examine: print "The door is currently "; if (self has open) print "open"; else print "closed"; if (self has locked) print " and locked"; "."; ], has lockable locked openable door static scenery; Class Hazard with hazardpoints 10, before [; Take,Pull,Push,PushDir: Strength=Strength-self.hazardpoints; print "Ouch! That hurt.^"; #Ifndef NO_HEALTH; if ( Strength <= 0) GameOver(3); #Endif; ! NO_HEALTH rtrue; default: "Careful - ", (the) self, " looks dangerous."; ], has static; Class Prop with before [; Take,Pull,Push,PushDir: print_ret (The) self, " is fixed in place."; default: "You don't need to worry about ", (the) self, "."; ], has static; !============================================================================= ! Game locations Room forest "Forest" with description "You are in the forest. There are exits north, south, east and west.", n_to forest, s_to forest, e_to forest_clearing, w_to forest; Object -> key "key" with description "key", name 'key'; Prop -> tree "tree" with description "tree", name 'tree', has static; !============================================================================= Room forest_clearing "Forest Clearing" with description "You are in a clearing. There are exits north, south, east and west.", n_to forest, s_to castle_gate, e_to forest, w_to forest; Hazard -> knife "knife" with description "knife", name 'knife', hazardpoints 20; !============================================================================= Room enchanted_castle "Enchanted Castle" with description "You are at the Enchanted Castle. An exit leads south.", s_to castle_grounds; !============================================================================= Room castle_gate "Castle Gate" with description "You are by a huge iron gate. There are exits north, south, east (through a door) and west.", n_to forest_clearing, s_to forest, e_to door_1, w_to forest; Hazard -> snake "snake" with description "snake", name 'snake', hazardpoints 60; Connector door_1 "door" with name 'door', door_to [; if (location == castle_gate) return castle_grounds; return castle_gate;], door_dir [; if (location == castle_grounds) return w_to; return e_to;], found_in castle_gate castle_grounds, with_key key; !============================================================================= Room castle_grounds "Castle Grounds" with description "You are in the castle grounds. Exits lead north and west (through a door).", n_to enchanted_castle, w_to door_1; Hazard -> glowing_metal "glowing metal" with description "glowing metal", name 'glowing' 'metal', hazardpoints 40; !============================================================================= ! Setup Daemons Object strength_drain with daemon [; Strength=Strength-1; if (Strength > 0 ) return; StopDaemon(self); GameOver(4); ]; Object endgame_test with daemon [; if (score < MAX_SCORE) return; if (real_location ~= enchanted_castle) return; StopDaemon(self); GameOver(2); ]; !============================================================================= ! Display end-game messages [ DeathMessage; switch(deadflag) { 3: print "You killed yourself"; 4: print "You ran out of time"; } ]; [ GameOver x; deadflag=x; switch(deadflag) { 2 : print "^Well done, but next time - your majesty - try not to lose your keys..."; 3,4: print "^Oh well, you seem to not have made it into the castle. You hear a click as the tape in your pocket recorder clicks off. 5...4...3...2...1... K A B O O M !"; } ]; !============================================================================= ! Initialisation routine [ Initialise; location=castle_gate; lookmode=2; #Ifndef NO_HEALTH; StartDaemon(strength_drain); #Endif; ! NO_HEALTH StartDaemon(endgame_test); ]; !============================================================================= ! Include grammar here Include "Grammar"; !============================================================================= ! Custom Verbs [ HealthSub; #Ifdef NO_HEALTH; if (deadflag == 0) "As strong and healthy as usual."; #Ifnot; "You have ",Strength," health points remaining."; #Endif; ! NO_HEALTH ]; Verb meta 'health' 'strength' * -> Health; !=============================================================================