!============================================================================= ! A conversion from the original MiniAdventure source. Constant Story "Prison by Jon Ripley (C) 1995"; Constant Headline "^^You have been imprisoned...For three weeks you haven't eaten, no-one has come to your cell to give you food or water. You are very weak and must either try to escape or give up and die.^^A conversion from the original MiniAdventure source.^^"; Serial "050130"; Release 1; ! Constant NO_HEALTH; Constant MAX_SCORE = 200; Include "Parser"; Include "VerbLib"; Global Strength = 50; !============================================================================= ! 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 Treasure with treasurepoints 0, after [; Take: score=score+self.treasurepoints; Drop: score=score-self.treasurepoints; ]; 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; !============================================================================= ! Game locations Room prison_cell "Prison Cell" with description "You are in a small murky cell, a small shaft of light filters through a crack in the ceiling. An exit leads east (through a door).", e_to door_1; Hazard -> poison "poison" with description "poison", name 'poison', hazardpoints 100; Object -> key "key" with description "key", name 'key'; Connector door_1 "door" with name 'door', door_to [; if (location == prison_cell) return homeland; return prison_cell;], door_dir [; if (location == homeland) return w_to; return e_to;], found_in prison_cell homeland, with_key key; !============================================================================= Room homeland "Homeland" with description "You are in the wide open spaces of your homeland. There are exits north, south, east and west (through a door).", n_to homeland, s_to homeland, e_to homeland, w_to door_1; Treasure -> food "food" with description "food", name 'food', treasurepoints 100; Treasure -> water "water" with description "water", name 'water', treasurepoints 100; !============================================================================= ! 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 ~= homeland) 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 "^You are free to go wherever you like without fear of being trapped again!"; 3,4: print "^You have died...Whether you took the poison or starved you will never see the open spaces of your homeland again. In fact, you never leave the cell."; } ]; !============================================================================= ! Initialisation routine [ Initialise; location=prison_cell; 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; !=============================================================================