home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / ccr.zip / CLOSE.T < prev    next >
Text File  |  1993-01-23  |  5KB  |  194 lines

  1. /*
  2.  * Colossal Cave Revisited
  3.  *
  4.  * A remake of Willie Crowther and Don Woods' classic Adventure.
  5.  * Converted from Donald Ekman's PC port of the original FORTRAN source.
  6.  * TADS version by David M. Baggett for ADVENTIONS.
  7.  *
  8.  * Please document all changes in the history so we know who did what.
  9.  *
  10.  * This source code is copylefted under the terms of the GNU Public
  11.  * License.  Essentially, this means that you are free to do whatever
  12.  * you wish with this source code, provided you do not charge any
  13.  * money for it or for any derivative works.
  14.  *
  15.  * ADVENTIONS distributes this game, but you are free to do what you will
  16.  * with it, provided you adhere to the terms in the GNU Public License.
  17.  * Send correspondence regarding this game or original works distributed
  18.  * by ADVENTIONS to 
  19.  *
  20.  *    ADVENTIONS
  21.  *    PO Box 851
  22.  *    Columbia, MD 21044
  23.  *
  24.  * If you would like a catalog of releases, please enclose a SASE.  Thanks!
  25.  *
  26.  * Contributors
  27.  *
  28.  *    dmb    In real life:    David M. Baggett
  29.  *        Internet:    <dmb@ai.mit.edu>
  30.  *        Compu$erve:    76440,2671 (ADVENTIONS account)
  31.  *        GEnie:        ADVENTIONS
  32.  *
  33.  * Modification History
  34.  *
  35.  * 1-Jan-93    dmb    rec.arts.int-fiction BETA release (source only)
  36.  *                      For beta testing only -- not for general
  37.  *            distribution.
  38.  *
  39.  */
  40.  
  41. /*
  42.  * This file defines a few game-specific functions for the cave closing.
  43.  * Don't read any of this unless you want to spoil the ending!
  44.  */
  45.  
  46. /*
  47.  * This function is called every turn to see if it's time to start
  48.  * closing the cave.
  49.  */
  50. check_for_closing: function(parm)
  51. {
  52.     //
  53.     // If there are no more treasures left to be found, count
  54.     // down the cave closing counter whenever the player is
  55.     // well inside but not at Y2.
  56.     //
  57.     if (global.closingtime > 0 and global.treasures = 0) {
  58.         if (not Me.location.notfarin and not Me.isIn(At_Y2)) {
  59.             global.closingtime := global.closingtime - 1;
  60.             if (global.closingtime < 1)
  61.                 start_closing();
  62.         }
  63.     }
  64. }
  65.  
  66. /*
  67.  * This function is called every turn to see if it's time to start
  68.  * the final puzzle.
  69.  */
  70. check_for_endgame: function(parm)
  71. {
  72.     if (global.closed and global.bonustime > 0) {
  73.         global.bonustime := global.bonustime - 1;
  74.         if (global.bonustime < 1) {
  75.             // Start the final puzzle
  76.             start_endgame();
  77.         }
  78.     }
  79. }
  80.  
  81. start_closing: function
  82. {    P();
  83.     I(); "A sepulchral voice reverberating through the cave says, 
  84.     \"Cave closing soon.  All adventurers exit immediately 
  85.     through main office.\"";
  86.  
  87.     incscore(global.closingpoints);
  88.  
  89.     global.closed := true;
  90.  
  91.     CrystalBridge.exists := nil;    // destroy the bridge
  92.     Grate.islocked := true;        // lock the grate ...
  93.     Grate.mykey := nil;        // ...and throw away the key
  94.     Dwarves.loclist := [];        // nuke dwarves...
  95.     Pirates.loclist := [];        // ...and pirate(s)
  96.     Troll.moveInto(nil);        // vaporize troll
  97.     Bear.exists := nil;        // ditto for bear
  98.  
  99.     // This was listed in the original as being too much trouble
  100.     // to bother with, but why not:
  101.     Dragon.moveInto(nil);        // nuke the dragon too
  102. }
  103.  
  104. start_endgame: function
  105. {
  106.     P();
  107.     I(); "The sepulchral voice intones, \"The cave is now 
  108.     closed.\" As the echoes fade, there is a blinding flash of 
  109.     light (and a small puff of orange smoke).\ .\ .\ .  As your 
  110.     eyes refocus, you look around and find that you're...\b";
  111.  
  112.     //
  113.     // Vaporize everyting the player's carrying.
  114.     //
  115.     while (length(Me.contents) > 0)
  116.         Me.contents[1].moveInto(nil);
  117.  
  118.     //
  119.     // Stock the northeast end
  120.     //
  121.     bottle.moveInto(At_Ne_End);
  122.     bottle.empty;    // don't want to worry about watering the plants
  123.     giant_bivalve.moveInto(At_Ne_End);
  124.     brass_lantern.moveInto(At_Ne_End);
  125.     black_rod.moveInto(At_Ne_End);
  126.  
  127.     //
  128.     // Stock the southwest end
  129.     //
  130.     little_bird.moveInto(At_Sw_End);
  131.     wicker_cage.moveInto(At_Sw_End);
  132.     black_mark_rod.moveInto(At_Sw_End);
  133.     velvet_pillow.moveInto(At_Sw_End);
  134.  
  135.     //
  136.     // Move the player
  137.     //
  138.     Me.travelTo(At_Ne_End);
  139.  
  140.     incscore(global.endpoints);
  141. }
  142.  
  143. /*
  144.  * Determine how the player fares in the final puzzle.
  145.  */
  146. endpuzzle: function
  147. {
  148.     if (black_mark_rod.isIn(At_Ne_End) and Me.isIn(At_Sw_End)) {
  149.         incscore(global.winpoints);
  150.  
  151.         I(); "There is a loud explosion, and a twenty-foot 
  152.         hole appears in the far wall, burying the dwarves in 
  153.         the rubble.  You march through the hole and find 
  154.         yourself in the main office, where a cheering band of 
  155.         friendly elves carry the conquering adventurer off 
  156.         into the sunset."; P();
  157.  
  158.         win();
  159.     }
  160.     else if (black_mark_rod.isIn(At_Sw_End) and Me.isIn(At_Ne_End)) {
  161.         incscore(global.almostpoints);
  162.  
  163.         I(); "There is a loud explosion, and a twenty-foot 
  164.         hold appears in the far wall, burying the snakes in 
  165.         the rubble.  A river of molten lava pours in through 
  166.         the hole, destroying everything in its path, 
  167.         including you!"; P();
  168.  
  169.         win();
  170.     }
  171.     else if (black_mark_rod.isIn(Me.location)) {
  172.         incscore(global.wrongpoints);
  173.  
  174.         "There is a loud explosion, and you are suddenly 
  175.         splashed across the walls of the room."; P();
  176.  
  177.         win();
  178.     }
  179. }
  180.  
  181. /*
  182.  * The player resolves the endgame by disturbing the dwarves.
  183.  */
  184. end_dwarves: function
  185. {
  186.     P();
  187.     I(); "The resulting ruckus has awakened the dwarves.  There 
  188.     are now several threatening little dwarves in the room with 
  189.     you! Most of them throw knives at you!  All of them get 
  190.     you!"; P();
  191.  
  192.     win();
  193. }
  194.