LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - move.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 43 828 5.2 %
Date: 2017-08-31 19:31:11 Functions: 5 41 12.2 %
Branches: 11 338 3.3 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* move.c */
       3                 :            : /* general functions for player moving */
       4                 :            : 
       5                 :            : #include "glob.h"
       6                 :            : 
       7                 :            : #include <unistd.h> /* usleep */
       8                 :            : 
       9                 :            : /* various miscellaneous location functions */
      10                 :          1 : void l_water(void)
      11                 :            : {
      12         [ +  - ]:          1 :   if (! gamestatusp(MOUNTED))  {
      13         [ +  - ]:          1 :     if ((Player.possessions[O_ARMOR] != NULL)) {
      14                 :          1 :       print1("Your heavy armor drags you under the water!");
      15                 :          1 :       morewait();
      16                 :          1 :       p_drown();
      17                 :          1 :       print2("You reach the surface again.");
      18                 :            :     }
      19         [ #  # ]:          0 :     else if (Player.itemweight > ((int) (Player.maxweight / 2))) {
      20                 :          0 :       print1("The weight of your burden drags you under water!");
      21                 :          0 :       morewait();
      22                 :          0 :       p_drown();
      23                 :          0 :       print2("You reach the surface again.");
      24                 :            :     }
      25   [ #  #  #  #  :          0 :     else switch(random_range(32)) {
                      # ]
      26                 :          0 :     case 0:print1("Splish. Splash!"); break;
      27                 :          0 :     case 1:print1("I want my ducky!"); break;
      28                 :          0 :     case 2:print1("So finally you take a bath!"); break;
      29                 :          1 :     case 3:print1("You must be very thirsty!"); break;
      30                 :            :     }
      31                 :            :   }
      32   [ #  #  #  #  :          0 :   else switch(random_range(32)) {
                      # ]
      33                 :          0 :     case 0:print1("Your horse frolics playfully in the water."); break;
      34                 :          0 :     case 1:print1("Your horse quenches its thirst."); break;
      35                 :          0 :     case 2:print1("Your steed begins to swim...."); break;
      36                 :          0 :     case 3:print1("Your mount thrashes about in the water."); break;
      37                 :            :     }
      38                 :          1 : }
      39                 :            : 
      40                 :            : 
      41                 :            : 
      42                 :          0 : void l_chaos(void)
      43                 :            : {
      44         [ #  # ]:          0 :   if (gamestatusp(MOUNTED)) {
      45                 :          0 :     print1("Your steed tries to swim in the raw Chaos, but seems to");
      46                 :          0 :     print2("be having some difficulties...");
      47                 :          0 :     morewait();
      48                 :          0 :     print1("probably because it's just turned into a chaffinch.");
      49                 :          0 :     morewait();
      50                 :          0 :     resetgamestatus(MOUNTED);
      51                 :            :   }
      52         [ #  # ]:          0 :   if (! onewithchaos)
      53                 :          0 :     print1("You are immersed in raw Chaos....");
      54         [ #  # ]:          0 :   if (Player.rank[ADEPT]) {
      55         [ #  # ]:          0 :     if (! onewithchaos)
      56                 :            :     {
      57                 :          0 :       onewithchaos = 1;
      58                 :          0 :       print2("You achieve oneness of Chaos....");
      59                 :            :     }
      60         [ #  # ]:          0 :     Player.mana = max(Player.mana,calcmana());
      61                 :          0 :     Player.hp = max(Player.hp, Player.maxhp);
      62                 :            :   }
      63         [ #  # ]:          0 :   else if (onewithchaos) /* adept that gets amnesia from chaos storm */
      64                 :            :   {
      65                 :          0 :     print2("The chaos sea doesn't seem to bother you at all.");
      66                 :            :   }
      67 [ #  # ][ #  # ]:          0 :   else if (Player.rank[PRIESTHOOD] && (! saved)) {
      68                 :          0 :     print2("A mysterious force protects you from the Chaos!");
      69                 :          0 :     print3("Wow.... You feel a bit smug.");
      70                 :          0 :     gain_experience(500);
      71                 :          0 :     saved = TRUE;
      72                 :            :   }
      73                 :            :   else {
      74                 :          0 :     print2("Uh oh....");
      75         [ #  # ]:          0 :     if (saved) nprint2("Nothing mysterious happens this time....");
      76                 :          0 :     morewait();
      77                 :          0 :     print1("Congratulations! You've achieved maximal entropy!");
      78                 :          0 :     Player.alignment -= 50;
      79                 :          0 :     gain_experience(1000);
      80                 :          0 :     p_death("immersion in raw Chaos");
      81                 :            :   }
      82                 :          0 : }
      83                 :            : 
      84                 :            : 
      85                 :            : 
      86                 :            : 
      87                 :          1 : void l_hedge(void)
      88                 :            : {
      89         [ -  + ]:          1 :   if (Player.patron == DRUID) print1("You move through the hedges freely.");
      90                 :            :   else {
      91                 :          1 :     print1("You struggle in the brambly hedge... ");
      92   [ +  -  -  -  :          1 :     switch(random_range(6)) {
                      - ]
      93                 :            :     case 0: 
      94                 :          1 :       print2("You are stabbed by thorns!");
      95                 :          1 :       p_damage(random_range(6),NORMAL_DAMAGE,"a hedge");
      96                 :          1 :       print3("The thorns were poisonous!");
      97                 :          1 :       p_poison(random_range(12));
      98                 :          1 :       break;
      99                 :            :     case 1: 
     100                 :          0 :       print2("You are stabbed by thorns!");
     101                 :          0 :       p_damage(random_range(12),NORMAL_DAMAGE,"a hedge");
     102                 :          0 :       break;
     103                 :            :     case 2: 
     104                 :          0 :       print2("You seem to have gotten stuck in the hedge.");
     105                 :          0 :       Player.status[IMMOBILE]+=random_range(5)+1;
     106                 :          0 :       break;
     107                 :            :     case 3: 
     108         [ #  # ]:          0 :       if (Player.possessions[O_CLOAK] != NULL) {
     109                 :          0 :         print2("Your cloak was torn on the brambles!");
     110                 :          0 :         dispose_lost_objects(1,Player.possessions[O_CLOAK]);
     111                 :            :       }
     112                 :          0 :       else print2("Ouch! These thorns are scratchy!");
     113                 :          0 :       break;
     114                 :          0 :     default: print2("You make your way through unscathed."); break;
     115                 :            :     }
     116                 :            :   }
     117                 :          1 : }
     118                 :            : 
     119                 :            : 
     120                 :            : 
     121                 :          0 : void l_lava(void)
     122                 :            : {
     123                 :          0 :   print1("Very clever -- walking into a pool of lava...");
     124         [ #  # ]:          0 :   if (gamestatusp(MOUNTED)) {
     125                 :          0 :     print2("Your horse is incinerated... You fall in too!");
     126                 :          0 :     resetgamestatus(MOUNTED);
     127                 :            :   }
     128                 :          0 :   morewait();
     129         [ #  # ]:          0 :   if (strcmp(Player.name,"Saltheart Foamfollower")==0) {
     130                 :          0 :     print1("Strangely enough, you don't seem terribly affected.");
     131                 :          0 :     p_damage(1,UNSTOPPABLE,"slow death in a pool of lava");
     132                 :            :   }
     133                 :            :   else {
     134                 :          0 :     p_damage(random_range(75),FLAME,"incineration in a pool of lava");
     135         [ #  # ]:          0 :     if (Player.hp> 0) p_drown();
     136                 :          0 :     Player.status[IMMOBILE]+=2;
     137                 :            :   }
     138                 :          0 : }
     139                 :            : 
     140                 :            : 
     141                 :            : 
     142                 :          0 : void l_fire(void)
     143                 :            : {
     144                 :          0 :   print1("You boldly stride through the curtain of fire...");
     145         [ #  # ]:          0 :   if (gamestatusp(MOUNTED)) {
     146                 :          0 :     print2("Your horse is fried and so are you...");
     147                 :          0 :     resetgamestatus(MOUNTED);
     148                 :            :   }
     149                 :          0 :   p_damage(random_range(100),FLAME,"self-immolation");
     150                 :          0 : }
     151                 :            : 
     152                 :          0 : void l_abyss(void)
     153                 :            : {
     154                 :            :   int i;
     155         [ #  # ]:          0 :   if (Current_Environment != Current_Dungeon) {
     156                 :          0 :     print1("You fall through a dimensional portal!");
     157                 :          0 :     morewait();
     158                 :          0 :     strategic_teleport(-1);
     159                 :            :   }
     160                 :            :   else {
     161                 :          0 :     print1("You enter the infinite abyss!");
     162                 :          0 :     morewait();
     163         [ #  # ]:          0 :     if (random_range(100)==13) {
     164                 :          0 :       print1("As you fall you see before you what seems like");
     165                 :          0 :       print2("an infinite congerie of iridescent bubbles.");
     166                 :          0 :       print3("You have met Yog Sothoth!!!");
     167                 :          0 :       morewait();
     168                 :          0 :       clearmsg();
     169         [ #  # ]:          0 :       if (Player.alignment > -10) 
     170                 :          0 :         p_death("the Eater of Souls");
     171                 :            :       else {
     172                 :          0 :         print1("The All-In-One must have taken pity on you.");
     173                 :          0 :         print2("A transdimensional portal appears...");
     174                 :          0 :         morewait();
     175                 :          0 :         change_level(Level->depth,Level->depth+1,FALSE);
     176                 :          0 :         gain_experience(2000);
     177                 :          0 :         Player.alignment -= 50;
     178                 :            :       }
     179                 :            :     }
     180                 :            :     else {
     181                 :          0 :       i = 0;
     182                 :          0 :       print1("You fall...");
     183         [ #  # ]:          0 :       while(random_range(3)!=2) {
     184         [ #  # ]:          0 :         if (i%6 == 0)
     185                 :          0 :             print2("and fall... ");
     186                 :            :         else
     187                 :          0 :             nprint2("and fall... ");
     188                 :          0 :         i++;
     189                 :          0 :         morewait();
     190                 :            :       }
     191                 :          0 :       i++;
     192                 :          0 :       print1("Finally,you emerge through an interdimensional interstice...");
     193                 :          0 :       morewait();
     194         [ #  # ]:          0 :       if (Level->depth+i>MaxDungeonLevels) {
     195                 :          0 :         print2("You emerge high above the ground!!!!");
     196                 :          0 :         print3("Yaaaaaaaah........");
     197                 :          0 :         morewait();
     198                 :          0 :         change_environment(E_COUNTRYSIDE);
     199                 :            :         do {
     200                 :          0 :           setPlayerXY( random_range(COUNTRY_WIDTH), random_range(COUNTRY_LENGTH));
     201         [ #  # ]:          0 :         } while(Country[Player.x][Player.y].base_terrain_type == CHAOS_SEA);
     202                 :          0 :         p_damage(i*50,NORMAL_DAMAGE,"a fall from a great height");
     203                 :            :       }
     204                 :            :       else {
     205                 :          0 :         print2("You built up some velocity during your fall, though....");
     206                 :          0 :         morewait();
     207                 :          0 :         p_damage(i*5,NORMAL_DAMAGE,"a fall through the abyss");
     208                 :          0 :         change_level(Level->depth,Level->depth+i,FALSE);
     209                 :          0 :         gain_experience(i*i*50);
     210                 :            :       }
     211                 :            :     }
     212                 :            :   }
     213                 :          0 : }
     214                 :            : 
     215                 :            : 
     216                 :          0 : void l_lift(void)
     217                 :            : {
     218                 :            :   char response;
     219                 :            :   int levelnum;
     220                 :            :   int distance;
     221                 :          0 :   int too_far = 0;
     222                 :            : 
     223                 :          0 :   Level->site[Player.x][Player.y].locchar = FLOOR;
     224                 :          0 :   Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     225                 :          0 :   lset(Player.x, Player.y, CHANGED);
     226                 :          0 :   print1("You walk onto a shimmering disk....");
     227                 :          0 :   print2("The disk vanishes, and a glow surrounds you.");
     228                 :          0 :   print3("You feel weightless.... You feel ghostly....");
     229                 :          0 :   morewait();
     230                 :          0 :   clearmsg();
     231                 :          0 :   print1("Go up, down, or neither [u,d,ESCAPE] ");
     232                 :          0 :   do response = (char) mcigetc();
     233         [ #  # ]:          0 :   while ((response != 'u') && 
     234         [ #  # ]:          0 :          (response != 'd') &&
     235         [ #  # ]:          0 :          (response != ESCAPE));
     236         [ #  # ]:          0 :   if (response != ESCAPE) {
     237                 :          0 :     print1("How many levels?");
     238                 :          0 :     levelnum = (int) parsenum("");
     239         [ #  # ]:          0 :     if (levelnum > 6) {
     240                 :          0 :       too_far = 1;
     241                 :          0 :       levelnum = 6;
     242                 :            :     }
     243 [ #  # ][ #  # ]:          0 :     if (response == 'u' && Level->depth - levelnum < 1) {
     244                 :          0 :       distance = levelnum - Level->depth;
     245                 :          0 :       change_environment(E_COUNTRYSIDE); /* "you return to the countryside." */
     246         [ #  # ]:          0 :       if (distance > 0) {
     247                 :          0 :         nprint1("..");
     248                 :          0 :         print2("...and keep going up!  You hang in mid air...");
     249                 :          0 :         morewait();
     250                 :          0 :         print3("\"What goes up...\"");
     251                 :          0 :         morewait();
     252                 :          0 :         print3("Yaaaaaaaah........");
     253                 :          0 :         p_damage(distance*10,NORMAL_DAMAGE,"a fall from a great height");
     254                 :            :       }
     255                 :          0 :       return;
     256                 :            :     }
     257 [ #  # ][ #  # ]:          0 :     else if (response == 'd' && Level->depth + levelnum > MaxDungeonLevels) {
     258                 :          0 :       too_far = 1;
     259                 :          0 :       levelnum = MaxDungeonLevels - Level->depth;
     260                 :            :     }
     261         [ #  # ]:          0 :     if (levelnum == 0) {
     262                 :          0 :       print1("Nothing happens.");
     263                 :          0 :       return;
     264                 :            :     }
     265         [ #  # ]:          0 :     if (too_far) {
     266                 :          0 :       print1("The lift gives out partway...");
     267                 :          0 :       print2("You rematerialize.....");
     268                 :            :     }
     269                 :            :     else
     270                 :          0 :       print1("You rematerialize.....");
     271         [ #  # ]:          0 :     change_level(Level->depth,
     272                 :            :                 (response=='d' ? 
     273                 :          0 :                  Level->depth+levelnum : 
     274                 :          0 :                  Level->depth-levelnum),
     275                 :            :                 FALSE);
     276                 :          0 :     roomcheck();
     277                 :            :   }
     278                 :            : }
     279                 :            : 
     280                 :            : 
     281                 :          0 : void l_magic_pool(void)
     282                 :            : {
     283                 :          0 :   int possibilities=random_range(100);
     284                 :          0 :   print1("This pool seems to be enchanted....");
     285         [ #  # ]:          0 :   if (gamestatusp(MOUNTED)) {
     286         [ #  # ]:          0 :     if (random_range(2)) {
     287                 :          0 :       print2("Your horse is polymorphed into a fig newton.");
     288                 :          0 :       resetgamestatus(MOUNTED);
     289                 :            :     }
     290                 :          0 :     else print2("Whatever it was, your horse enjoyed it....");
     291                 :            :   }
     292         [ #  # ]:          0 :   else  if (possibilities == 0) {
     293                 :          0 :     print1("Oh no! You encounter the DREADED AQUAE MORTIS...");
     294         [ #  # ]:          0 :     if (random_range(1000) < Player.level*Player.level*Player.level) {
     295                 :          0 :       print2("The DREADED AQUAE MORTIS throttles you within inches....");
     296                 :          0 :       print3("but for some reason chooses to let you escape.");
     297                 :          0 :       gain_experience(500);
     298                 :          0 :       Player.hp = 1;
     299                 :            :     }
     300                 :          0 :     else p_death("the DREADED AQUAE MORTIS!");
     301                 :            :   }
     302         [ #  # ]:          0 :   else if (possibilities < 25)
     303                 :          0 :     augment(0);
     304         [ #  # ]:          0 :   else if (possibilities < 30)
     305                 :          0 :     augment(1);
     306         [ #  # ]:          0 :   else if (possibilities < 60)
     307                 :          0 :     augment(-1);
     308         [ #  # ]:          0 :   else if (possibilities < 65)
     309                 :          0 :     cleanse(1);
     310         [ #  # ]:          0 :   else if (possibilities < 80) {
     311         [ #  # ]:          0 :     if (Player.possessions[O_WEAPON_HAND] != NULL) {
     312                 :          0 :       print1("You drop your weapon in the pool! It's gone forever!");
     313                 :          0 :       dispose_lost_objects(1,Player.possessions[O_WEAPON_HAND]);
     314                 :            :     }
     315                 :          0 :     else print1("You feel fortunate.");
     316                 :            :   }
     317         [ #  # ]:          0 :   else if (possibilities < 90) {
     318         [ #  # ]:          0 :     if (Player.possessions[O_WEAPON_HAND] != NULL) {
     319                 :          0 :       print1("Your weapon leaves the pool with a new edge....");
     320                 :          0 :       Player.possessions[O_WEAPON_HAND]->plus += random_range(10)+1;
     321                 :          0 :       calc_melee();
     322                 :            :     }
     323                 :          0 :     else print1("You feel unfortunate.");
     324                 :            :   }
     325         [ #  # ]:          0 :   else if (possibilities < 95) {
     326                 :          0 :     Player.hp += 10;
     327                 :          0 :     print1("You feel healthier after the dip...");
     328                 :            :   }
     329         [ #  # ]:          0 :   else if (possibilities < 99) {
     330                 :          0 :     print1("Oooh, a tainted pool...");
     331                 :          0 :     p_poison(10);
     332                 :            :   }
     333         [ #  # ]:          0 :   else if (possibilities == 99) {
     334                 :          0 :     print1("Wow! A pool of azoth!");
     335                 :          0 :     heal(10);
     336                 :          0 :     cleanse(1);
     337                 :          0 :     Player.mana = calcmana()*3;
     338                 :          0 :     Player.str = (Player.maxstr++)*3;
     339                 :            :   }
     340                 :          0 :   print2("The pool seems to have dried up.");
     341                 :          0 :   Level->site[Player.x][Player.y].locchar = TRAP;
     342                 :          0 :   Level->site[Player.x][Player.y].p_locf = L_TRAP_PIT;
     343                 :          0 :   lset(Player.x, Player.y, CHANGED);
     344                 :          0 : }
     345                 :            :     
     346                 :            : 
     347                 :        833 : void l_no_op(void)
     348                 :            : {
     349                 :        833 : }
     350                 :            : 
     351                 :            : 
     352                 :         17 : void l_tactical_exit(void)
     353                 :            : {
     354         [ +  - ]:         17 :   if (optionp(CONFIRM)) {
     355         [ +  + ]:         17 :     if (cinema_confirm("You're about to leave this place.") != 'y')
     356                 :         14 :       return;
     357                 :            :   }
     358                 :            :   /* Free up monsters and items, and the level, if not SAVE_LEVELS */
     359                 :          3 :   free_level(Level);
     360                 :          3 :   Level = NULL;
     361 [ +  - ][ +  - ]:          3 :   if ((Current_Environment == E_TEMPLE) || 
     362                 :          3 :       (Current_Environment == E_TACTICAL_MAP) )
     363                 :          3 :     change_environment(E_COUNTRYSIDE);
     364                 :          0 :   else change_environment(Last_Environment);
     365                 :            : }
     366                 :            : 
     367                 :            : 
     368                 :          0 : void l_rubble(void)
     369                 :            : {
     370                 :          0 :   int screwup = random_range(100) - (Player.agi + Player.level); 
     371                 :          0 :   print1("You climb over the unstable pile of rubble....");
     372         [ #  # ]:          0 :   if (screwup < 0) print2("No problem!");
     373                 :            :   else {
     374                 :          0 :     print2("You tumble and fall in a small avalanche of debris!");
     375                 :          0 :     print3("You're trapped in the pile!");
     376                 :          0 :     Player.status[IMMOBILE]+=2;
     377                 :          0 :     p_damage(screwup/5,UNSTOPPABLE,"rubble and debris");
     378                 :          0 :     morewait();
     379                 :            :   }
     380                 :          0 : }
     381                 :            : 
     382                 :            : 
     383                 :            : 
     384                 :            : 
     385                 :            : 
     386                 :            : /* Drops all portcullises in 5 moves */
     387                 :          0 : void l_portcullis_trap(void)
     388                 :            : {
     389                 :          0 :   int i,j,slam=FALSE;
     390                 :            :   
     391                 :          0 :   print3("Click.");
     392                 :          0 :   morewait();
     393         [ #  # ]:          0 :   for (i=max(Player.x-5,0);i<min(Player.x+6,Level->level_width);i++)
     394         [ #  # ]:          0 :     for(j=max(Player.y-5,0);j<min(Player.y+6,Level->level_length);j++) {
     395 [ #  # ][ #  # ]:          0 :       if ((Level->site[i][j].p_locf == L_PORTCULLIS) &&
     396                 :          0 :           (Level->site[i][j].locchar != PORTCULLIS)) {
     397                 :          0 :         Level->site[i][j].locchar = PORTCULLIS;
     398                 :          0 :         lset(i, j, CHANGED);
     399                 :          0 :         putspot(i,j,PORTCULLIS);
     400 [ #  # ][ #  # ]:          0 :         if ((i==Player.x)&&(j==Player.y)) {
     401                 :          0 :           print3("Smash! You've been hit by a falling portcullis!");
     402                 :          0 :           morewait();
     403                 :          0 :           p_damage(random_range(1000),NORMAL_DAMAGE,"a portcullis");
     404                 :            :         }
     405                 :          0 :         slam = TRUE;
     406                 :            :       }
     407                 :            :     }
     408         [ #  # ]:          0 :   if (slam) print3("You hear heavy walls slamming down!");
     409                 :          0 : }
     410                 :            : 
     411                 :            : /* drops every portcullis on level, then kills itself and all similar traps. */
     412                 :          0 : void l_drop_every_portcullis(void)
     413                 :            : {
     414                 :          0 :   int i,j,slam=FALSE;
     415                 :            :   
     416                 :          0 :   print3("Click.");
     417                 :          0 :   morewait();
     418         [ #  # ]:          0 :   for(j=0;j<Level->level_length;j++)
     419         [ #  # ]:          0 :     for(i=0;i<Level->level_width;i++) {
     420         [ #  # ]:          0 :       if (Level->site[i][j].p_locf == L_DROP_EVERY_PORTCULLIS) {
     421                 :          0 :         Level->site[i][j].p_locf = L_NO_OP;
     422                 :          0 :         lset(i, j, CHANGED);
     423                 :            :       }
     424 [ #  # ][ #  # ]:          0 :       else if ((Level->site[i][j].p_locf == L_PORTCULLIS) &&
     425                 :          0 :           (Level->site[i][j].locchar != PORTCULLIS)) {
     426                 :          0 :         Level->site[i][j].locchar = PORTCULLIS;
     427                 :          0 :         lset(i, j, CHANGED);
     428                 :          0 :         putspot(i,j,PORTCULLIS);
     429 [ #  # ][ #  # ]:          0 :         if ((i==Player.x)&&(j==Player.y)) {
     430                 :          0 :           print3("Smash! You've been hit by a falling portcullis!");
     431                 :          0 :           morewait();
     432                 :          0 :           p_damage(random_range(1000),NORMAL_DAMAGE,"a portcullis");
     433                 :            :         }
     434                 :          0 :         slam = TRUE;
     435                 :            :       }
     436                 :            :     }
     437         [ #  # ]:          0 :   if (slam) print3("You hear heavy walls slamming down!");
     438                 :          0 : }
     439                 :            : 
     440                 :            : 
     441                 :            : 
     442                 :          0 : void l_raise_portcullis(void)
     443                 :            : {
     444                 :          0 :   int i,j,open=FALSE;
     445         [ #  # ]:          0 :   for(j=0;j<Level->level_length;j++) 
     446         [ #  # ]:          0 :     for(i=0;i<Level->level_width;i++) {
     447         [ #  # ]:          0 :       if (Level->site[i][j].locchar == PORTCULLIS) {
     448                 :          0 :         Level->site[i][j].locchar = FLOOR;
     449                 :          0 :         lset(i, j, CHANGED);
     450                 :          0 :         putspot(i,j,FLOOR);
     451                 :          0 :         open = TRUE;
     452                 :            :       }
     453                 :            :     }
     454         [ #  # ]:          0 :   if (open) print1("You hear the sound of steel on stone!");
     455                 :          0 : }
     456                 :            : 
     457                 :            : 
     458                 :          0 : void l_arena_exit(void)
     459                 :            : {
     460                 :          0 :   resetgamestatus(ARENA_MODE);
     461                 :            : #ifndef MSDOS_SUPPORTED_ANTIQUE
     462                 :          0 :   free_level(Level);
     463                 :            : #endif
     464                 :          0 :   Level = NULL;
     465                 :          0 :   change_environment(E_CITY);
     466                 :          0 : }
     467                 :            : 
     468                 :            : 
     469                 :          0 : void l_house_exit(void)
     470                 :            : {
     471         [ #  # ]:          0 :   if (optionp(CONFIRM)) {
     472                 :          0 :     clearmsg();
     473         [ #  # ]:          0 :     if (cinema_confirm("You're about to step out of this abode.") != 'y')
     474                 :          0 :       return;
     475                 :            :   }
     476                 :            : #ifndef MSDOS_SUPPORTED_ANTIQUE
     477                 :          0 :   free_level(Level);
     478                 :            : #endif
     479                 :          0 :   Level = NULL;
     480                 :          0 :   change_environment(Last_Environment);
     481                 :            : }
     482                 :            : 
     483                 :            : 
     484                 :          0 : void l_void(void)
     485                 :            : {
     486                 :          0 :   clearmsg();
     487                 :          0 :   print1("Geronimo!");
     488                 :          0 :   morewait();
     489                 :          0 :   clearmsg();
     490                 :          0 :   print1("You leap into the void.");
     491         [ #  # ]:          0 :   if (Level->mlist) {
     492                 :          0 :     print2("Death peers over the edge and gazes quizzically at you....");
     493                 :          0 :     morewait();
     494                 :          0 :     print3("'Bye-bye,' he says... 'We'll meet again.'");
     495                 :            :   }
     496                 :          0 :   morewait();
     497         [ #  # ]:          0 :   while(Player.hp>0) {
     498                 :          0 :     Time+=60;
     499                 :          0 :     hourly_check();
     500                 :            :     /* WDT: GCC doesn't like usleep being included from unistd.h when it's
     501                 :            :      * checking for ANSI compliance.  That's the stupidest thing I've seen,
     502                 :            :      * but I wasn't offered a choice -- the man pages don't document any other
     503                 :            :      * options.
     504                 :            :      * Fortunately, this is a bad use of usleep, so commenting it out won't
     505                 :            :      * hurt the game, and might even help it. */
     506                 :            : /*    usleep(250000);*/
     507                 :            :   }
     508                 :          0 : }
     509                 :            : 
     510                 :            : 
     511                 :          0 : void l_fire_station(void)
     512                 :            : {
     513                 :          0 :   print1("The flames leap up, and the heat is incredible.");
     514         [ #  # ]:          0 :   if (Player.immunity[FLAME]) {
     515                 :          0 :     print2("You feel the terrible heat despite your immunity to fire!");
     516                 :          0 :     morewait();
     517                 :            :   }
     518                 :          0 :   print2("Enter the flames? [yn] ");
     519         [ #  # ]:          0 :   if (ynq2()=='y') {
     520         [ #  # ]:          0 :     if (Player.hp == 1) p_death("total incineration");
     521                 :          0 :     else Player.hp = 1;
     522                 :          0 :     dataprint();
     523                 :          0 :     print1("You feel like you are being incinerated! Jump back? [yn] ");
     524         [ #  # ]:          0 :     if (ynq1()=='y')
     525                 :          0 :       print2("Phew! That was close!");
     526                 :            :     else {
     527                 :          0 :       Player.pow -= (15+random_range(15));
     528         [ #  # ]:          0 :       if (Player.pow > 0) {
     529                 :          0 :         print2("That's odd, the flame seems to have cooled down now....");
     530                 :          0 :         print3("A flicker of fire seems to dance above the void nearby.");
     531                 :          0 :         Level->site[Player.x][Player.y].locchar = FLOOR;
     532                 :          0 :         Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     533                 :          0 :         stationcheck();
     534                 :            :       }
     535                 :            :       else {
     536                 :          0 :         print2("The flames seem to have leached away all your mana!");
     537                 :          0 :         p_death("the Essence of Fire");
     538                 :            :       }
     539                 :            :     }
     540                 :            :   }
     541                 :          0 :   else print2("You flinch away from the all-consuming fire.");
     542                 :          0 : }
     543                 :            : 
     544                 :            : 
     545                 :            : 
     546                 :            : 
     547                 :          0 : void l_water_station(void)
     548                 :            : {
     549                 :          0 :   print1("The fluid seems murky and unknowably deep.");
     550                 :          0 :   print2("It bubbles and hisses threateningly.");
     551                 :          0 :   morewait();
     552         [ #  # ]:          0 :   if (Player.status[BREATHING]) {
     553                 :          0 :     print1("You don't feel sanguine about trying to breathe that stuff!");
     554                 :          0 :     morewait();
     555                 :            :   }
     556         [ #  # ]:          0 :   if (Player.immunity[ACID]) {
     557                 :          0 :     print2("The vapor burns despite your immunity to acid!");
     558                 :          0 :     morewait();
     559                 :            :   }
     560                 :          0 :   print1("Enter the fluid? [yn] ");
     561         [ #  # ]:          0 :   if (ynq1()=='y') {
     562         [ #  # ]:          0 :     if (Player.hp == 1) p_death("drowning in acid (ick, what a way to go)");
     563                 :          0 :     else Player.hp = 1;
     564                 :          0 :     dataprint();
     565                 :          0 :     print2("You choke....");
     566                 :          0 :     morewait();
     567                 :          0 :     nprint2("Your lungs burn....");
     568                 :          0 :     morewait();
     569                 :          0 :     print2("Your body begins to disintegrate.... Leave the pool? [yn] ");
     570         [ #  # ]:          0 :     if (ynq2()=='y')
     571                 :          0 :       print2("Phew! That was close!");
     572                 :            :     else {
     573                 :          0 :       clearmsg();
     574                 :          0 :       Player.con -= (15+random_range(15));
     575         [ #  # ]:          0 :       if (Player.con > 0) {
     576                 :          0 :         print1("That's odd, the fluid seems to have been neutralized....");
     577                 :          0 :         print2("A moist miasma wafts above the void nearby.");
     578                 :          0 :         Level->site[Player.x][Player.y].locchar = FLOOR;
     579                 :          0 :         Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     580                 :          0 :         stationcheck();
     581                 :            :       }
     582                 :            :       else {
     583                 :          0 :         print2("The bubbling fluid has destroyed your constitution!");
     584                 :          0 :         p_death("the Essence of Water");
     585                 :            :       }
     586                 :            :     }
     587                 :            :     
     588                 :            :   }
     589                 :          0 :   else print2("You step back from the pool of acid.");
     590                 :          0 : }
     591                 :            : 
     592                 :            : 
     593                 :            : 
     594                 :            : 
     595                 :          0 : void l_air_station(void)
     596                 :            : {
     597                 :          0 :   print1("The whirlwind spins wildly and crackles with lightning.");
     598         [ #  # ]:          0 :   if (Player.immunity[ELECTRICITY])
     599                 :          0 :     print2("You feel static cling despite your immunity to electricity!");
     600                 :          0 :   morewait();
     601                 :          0 :   print1("Enter the storm? [yn] ");
     602         [ #  # ]:          0 :   if (ynq1()=='y') {
     603         [ #  # ]:          0 :     if (Player.hp == 1) p_death("being torn apart and then electrocuted");
     604                 :          0 :     else Player.hp = 1;
     605                 :          0 :     dataprint();
     606                 :          0 :     print1("You are buffeted and burnt by the storm....");
     607                 :          0 :     print2("You begin to lose consciousness.... Leave the storm? [yn] ");
     608         [ #  # ]:          0 :     if (ynq1()=='y')
     609                 :          0 :       print2("Phew! That was close!");
     610                 :            :     else {
     611                 :          0 :       Player.iq -= (random_range(15)+15);
     612         [ #  # ]:          0 :       if (Player.iq > 0) {
     613                 :          0 :         print1("That's odd, the storm subsides....");
     614                 :          0 :         print2("A gust of wind brushes past the void nearby.");
     615                 :          0 :         Level->site[Player.x][Player.y].locchar = FLOOR;
     616                 :          0 :         Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     617                 :          0 :         stationcheck();
     618                 :            :       }
     619                 :            :       else {
     620                 :          0 :         print2("The swirling storm has destroyed your intelligence!");
     621                 :          0 :         p_death("the Essence of Air");
     622                 :            :       }
     623                 :            :     }
     624                 :            :   }
     625                 :          0 :   else print2("You step back from the ominous whirlwind.");
     626                 :          0 : }
     627                 :            : 
     628                 :            : 
     629                 :            : 
     630                 :            : 
     631                 :          0 : void l_earth_station(void)
     632                 :            : {
     633                 :            :   pob o;
     634                 :          0 :   print1("The tendrilled mass reaches out for you from the muddy ooze.");
     635         [ #  # ]:          0 :   if (find_item(&o,OB_SALT_WATER,-1))
     636                 :          0 :     print2("A splash of salt water does nothing to dissuade the vines.");
     637                 :          0 :   morewait();
     638                 :          0 :   print1("Enter the overgrown mire? [yn] ");
     639         [ #  # ]:          0 :   if (ynq1()=='y') {
     640         [ #  # ]:          0 :     if (Player.hp == 1) p_death("being eaten alive");
     641                 :          0 :     else Player.hp = 1;
     642                 :          0 :     dataprint();
     643                 :          0 :     print1("You are being dragged into the muck. Suckers bite you....");
     644                 :          0 :     print2("You're about to be entangled.... Leave the mud? [yn] ");
     645         [ #  # ]:          0 :     if (ynq2()=='y')
     646                 :          0 :       print2("Phew! That was close!");
     647                 :            :     else {
     648                 :          0 :       Player.str -= (15+random_range(15));
     649         [ #  # ]:          0 :       if (Player.str > 0) {
     650                 :          0 :         print1("That's odd, the vine withdraws....");
     651                 :          0 :         print2("A spatter of dirt sprays into the void nearby.");
     652                 :          0 :         Level->site[Player.x][Player.y].locchar = FLOOR;
     653                 :          0 :         Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     654                 :          0 :         stationcheck();
     655                 :            :       }
     656                 :            :       else {
     657                 :          0 :         print2("The tendril has destroyed your strength!");
     658                 :          0 :         p_death("the Essence of Earth");
     659                 :            :       }
     660                 :            :     }
     661                 :            :   }
     662                 :          0 :   else print2("You step back from the ominous vegetation.");
     663                 :          0 : }
     664                 :            : 
     665                 :          0 : void stationcheck(void) 
     666                 :            : {
     667                 :          0 :   int stationsleft=FALSE;
     668                 :            :   int i,j;
     669                 :          0 :   morewait();
     670                 :          0 :   clearmsg();
     671                 :          0 :   print1("You feel regenerated.");
     672                 :          0 :   Player.hp = Player.maxhp;
     673                 :          0 :   dataprint();
     674         [ #  # ]:          0 :   for(j=0;j<Level->level_length;j++)
     675         [ #  # ]:          0 :     for(i=0;i<Level->level_width;i++)
     676 [ #  # ][ #  # ]:          0 :       if ((Level->site[i][j].locchar == WATER) ||
     677         [ #  # ]:          0 :           (Level->site[i][j].locchar == HEDGE) ||
     678         [ #  # ]:          0 :           (Level->site[i][j].locchar == WHIRLWIND) ||
     679                 :          0 :           (Level->site[i][j].locchar == FIRE))
     680                 :          0 :         stationsleft=TRUE;
     681         [ #  # ]:          0 :   if (! stationsleft) {
     682                 :          0 :     print1("There is a noise like a wild horse's neigh.");
     683                 :          0 :     print2("You spin around, and don't see anyone around at all");
     684                 :          0 :     print3("except for a spurred black cloaked figure carrying a scythe.");
     685                 :          0 :     morewait();clearmsg();
     686                 :          0 :     print1("Death coughs apologetically. He seems a little embarrassed.");
     687                 :          0 :     print2("A voice peals out:");
     688                 :          0 :     print3("'An Adept must be able to conquer Death himself....");
     689                 :          0 :     make_site_monster(32,4,DEATH);
     690                 :            :   }
     691                 :          0 : }
     692                 :            : 
     693                 :            : 
     694                 :            : /* To survive the void, the other four stations must be visited first,
     695                 :            :    to activate the void, then something (Death's scythe, possibly) 
     696                 :            :    must be thrown in to satiate the void, then all other items must
     697                 :            :    be dropped, then the void must be entered. */
     698                 :            : 
     699                 :          0 : void l_void_station(void)
     700                 :            : {
     701                 :          0 :   int i,something=FALSE;
     702         [ #  # ]:          0 :   if (cinema_confirm("You're about to Peter Pan into an endless void.")=='y') {
     703         [ #  # ]:          0 :     if (Level->mlist == NULL) {
     704                 :          0 :       print2("You fall forever. Eventually you die of starvation.");
     705                 :          0 :       morewait();
     706         [ #  # ]:          0 :       while(Player.hp>0) {
     707                 :          0 :         Time+=60;
     708                 :          0 :         hourly_check();
     709                 :          0 :         usleep(250000);
     710                 :            :       }
     711                 :            :     }
     712                 :            :     else {
     713                 :          0 :       print1("You enter the void.");
     714                 :          0 :       print2("You feel a sudden surge of power from five directions.");
     715                 :          0 :       morewait();
     716                 :          0 :       something = (Player.packptr > 0);
     717         [ #  # ]:          0 :       if (! something)
     718 [ #  # ][ #  # ]:          0 :         for(i=0;((i<MAXITEMS)&&(!something));i++)
     719         [ #  # ]:          0 :           if (Player.possessions[i] != NULL)
     720                 :          0 :             something = TRUE;
     721         [ #  # ]:          0 :       if (something) {
     722                 :          0 :         print1("The flow of power is disrupted by something!");
     723                 :          0 :         print2("The power is unbalanced! You lose control!");
     724                 :          0 :         morewait();
     725                 :          0 :         print1("Each of your cells explodes with a little scream of pain.");
     726                 :          0 :         print2("Your disrupted essence merges with the megaflow.");
     727                 :          0 :         p_death("the Power of the Void");
     728                 :            :       }
     729         [ #  # ]:          0 :       else if (! gamestatusp(PREPARED_VOID)){
     730                 :          0 :         print1("The hungry void swallows you whole!");
     731                 :          0 :         print2("Your being dissipates with a pathetic little sigh....");
     732                 :          0 :         p_death("the Emptyness of the Void");
     733                 :            :       }
     734                 :            :       else {
     735                 :          0 :         print1("The flow of power rages through your body,");
     736                 :          0 :         print2("but you manage to master the surge!");
     737                 :          0 :         print3("You feel adept....");
     738                 :          0 :         morewait();clearmsg();
     739                 :          0 :         print1("With a thought, you soar up through the void to the");
     740                 :          0 :         print2("place from whence you came.");
     741                 :          0 :         print3("As the platform of the Challenge dwindles beneath you");
     742                 :          0 :         morewait();
     743                 :          0 :         clearmsg();
     744                 :          0 :         print1("You see Death raise his scythe to you in a salute.");
     745                 :          0 :         Player.rank[ADEPT] = 1;
     746                 :          0 :         setgamestatus(COMPLETED_CHALLENGE);
     747                 :          0 :         FixedPoints = calc_points();
     748                 :            :         /* set so change_environment puts player in correct temple! */
     749                 :          0 :         Player.x = 49;
     750                 :          0 :         Player.y = 59;
     751                 :          0 :         print2("You find yourself back in the Temple of Destiny.");
     752                 :          0 :         morewait();
     753                 :          0 :         change_environment(E_TEMPLE);
     754                 :            :       }
     755                 :            :     }
     756                 :            :   }
     757                 :          0 :   else print2("You back away from the edge....");
     758                 :          0 : }
     759                 :            : 
     760                 :            : 
     761                 :          0 : void l_voice1(void)
     762                 :            : {
     763                 :          0 :   print1("A mysterious voice says: The Hunger of the Void must be satiated.");
     764                 :          0 :   Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     765                 :          0 : }
     766                 :            : 
     767                 :          0 : void l_voice2(void)
     768                 :            : {
     769                 :          0 :   print1("A strange voice recites: Enter the Void as you entered the World.");
     770                 :          0 :   Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     771                 :          0 : }
     772                 :            : 
     773                 :          0 : void l_voice3(void)
     774                 :            : {
     775                 :          0 :   print1("An eerie voice resounds: The Void is the fifth Elemental Station.");
     776                 :          0 :   Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     777                 :          0 : }
     778                 :            : 
     779                 :            : 
     780                 :          0 : void l_whirlwind(void)
     781                 :            : {
     782                 :          0 :   print1("Buffeting winds swirl you up!");
     783                 :          0 :   p_damage(random_range(difficulty()*10),NORMAL_DAMAGE,"a magic whirlwind");
     784         [ #  # ]:          0 :   if (random_range(2)) {
     785                 :          0 :     print2("You are jolted by lightning!");
     786                 :          0 :     p_damage(random_range(difficulty()*10),ELECTRICITY,"a magic whirlwind");
     787                 :            :   }
     788                 :          0 :   morewait();
     789         [ #  # ]:          0 :   if (random_range(2)) {
     790                 :          0 :     print1("The whirlwind carries you off....");
     791         [ #  # ]:          0 :     if (random_range(20)==17)
     792                 :          0 :       print2("'I don't think we're in Kansas anymore, toto.'");
     793                 :          0 :     p_teleport(0);
     794                 :            :   }
     795                 :          0 : }
     796                 :            : 
     797                 :            : 
     798                 :          0 : void l_enter_circle(void)
     799                 :            : {
     800                 :          0 :   print1("You see a translucent stairway before you, leading down.");
     801                 :          0 :   print2("Take it? [yn] ");
     802         [ #  # ]:          0 :   if (ynq()=='y')
     803                 :          0 :     change_environment(E_CIRCLE);
     804                 :          0 : }
     805                 :            : 
     806                 :          0 : void l_circle_library(void)
     807                 :            : {
     808                 :          0 :   print1("You see before you the arcane library of the Circle of Sorcerors.");
     809                 :          0 : }
     810                 :            : 
     811                 :          0 : void l_tome1(void)
     812                 :            : {
     813                 :          0 :   menuclear();
     814                 :          0 :   menuprint("\nYou discover in a dusty tome some interesting information....");
     815                 :          0 :   menuprint("\nThe Star Gem holds a vast amount of mana, usable");
     816                 :          0 :   menuprint("\nfor either Law or Chaos. It is magically linked to Star Peak");
     817                 :          0 :   menuprint("\nand can either be activated or destroyed there. If destroyed,");
     818                 :          0 :   menuprint("\nits power will be used for Chaos, if activated, for Law.");
     819                 :          0 :   menuprint("\n\nIt is said the LawBringer has waited for an eternity");
     820                 :          0 :   menuprint("\nat Star Peak for someone to bring him the gem.");
     821                 :          0 :   menuprint("\nIt is also rumored that while anyone might destroy the gem,");
     822                 :          0 :   menuprint("\nreleasing chaotic energy, only the LawBringer can release");
     823                 :          0 :   menuprint("\nthe lawful potential of the gem.");
     824                 :          0 :   showmenu();
     825                 :          0 :   morewait();
     826                 :          0 :   xredraw();
     827                 :          0 : }
     828                 :            : 
     829                 :            : 
     830                 :          0 : void l_tome2(void)
     831                 :            : {
     832                 :          0 :   menuclear();
     833                 :          0 :   menuprint("\nYou discover in some ancient notes that the Star Gem can be");
     834                 :          0 :   menuprint("\nused for transportation, but also read a caution that it must");
     835                 :          0 :   menuprint("\nbe allowed to recharge a long time between uses.");
     836                 :          0 :   menuprint("\nA marginal note says 'if only it could be reset to go somewhere");
     837                 :          0 :   menuprint("\nbesides Star Peak, the gem might be useful....'");
     838                 :          0 :   showmenu();
     839                 :          0 :   morewait();
     840                 :          0 :   xredraw();
     841                 :          0 : }
     842                 :            : 
     843                 :            : 
     844                 :          0 : void l_temple_warning(void)
     845                 :            : {
     846                 :          0 :   print1("A stern voice thunders in the air around you:");
     847                 :          0 :   print2("'No unbelievers may enter these sacred precincts;");
     848                 :          0 :   print3("those who defile this shrine will be destroyed!");
     849                 :          0 : }
     850                 :            : 
     851                 :          0 : void l_throne(void)
     852                 :            : {
     853                 :            :   pob o;
     854                 :            :   int i;
     855                 :          0 :   print1("You have come upon a huge ornately appointed throne!");
     856                 :          0 :   print2("Sit in it? [yn] ");
     857         [ #  # ]:          0 :   if (ynq1()=='y') {
     858         [ #  # ]:          0 :     if (! find_item(&o,OB_SCEPTRE,-1)) {
     859                 :          0 :       print1("The throne emits an eerie violet-black radiance.");
     860                 :          0 :       print2("You find, to your horror, that you cannot get up!");
     861                 :          0 :       print3("You feel an abstract sucking sensation...");
     862         [ #  # ]:          0 :       for(i=0;i<NUMSPELLS;i++) Spells[i].known = FALSE;
     863                 :          0 :       Player.pow = 3;
     864                 :          0 :       Player.mana = 0;
     865                 :          0 :       Player.hp = 1;
     866                 :          0 :       dispel(-1);
     867                 :          0 :       morewait();clearmsg();
     868                 :          0 :       print1("The radiance finally ceases. You can get up now.");
     869                 :            :     }
     870                 :            :     else {
     871         [ #  # ]:          0 :       if (HiMagicUse == Date) 
     872                 :          0 :         print3("You hear the sound of a magic kazoo played by an asthmatic.");
     873                 :            :       else {
     874                 :          0 :         HiMagicUse = Date;
     875                 :          0 :         print1("Following some strange impulse, you raise the Sceptre....");
     876                 :          0 :         print2("You hear a magical fanfare, repeated three times.");
     877   [ #  #  #  #  :          0 :         switch(HiMagic++) {
             #  #  #  # ]
     878                 :            :         case 0: 
     879                 :          0 :           print3("Strength.");
     880                 :          0 :           Player.str+=5;
     881                 :          0 :           Player.maxstr+=5;
     882                 :          0 :           break;
     883                 :            :         case 1: 
     884                 :          0 :           print3("Constitution.");  
     885                 :          0 :           Player.con+=5;
     886                 :          0 :           Player.maxcon+=5;
     887                 :          0 :           break;
     888                 :            :         case 2: 
     889                 :          0 :           print3("Dexterity.");
     890                 :          0 :           Player.dex+=5;
     891                 :          0 :           Player.maxdex+=5;
     892                 :          0 :           break;
     893                 :            :         case 3: 
     894                 :          0 :           print3("Agility.");  
     895                 :          0 :           Player.agi+=5;
     896                 :          0 :           Player.maxagi+=5;
     897                 :          0 :           break;
     898                 :            :         case 4: 
     899                 :          0 :           print3("Intelligence.");
     900                 :          0 :           Player.iq+=5;
     901                 :          0 :           Player.maxiq+=5;
     902                 :          0 :           break;
     903                 :            :         case 5: 
     904                 :          0 :           print3("Power.");  
     905                 :          0 :           Player.pow+=5;
     906                 :          0 :           Player.maxpow+=5;
     907                 :          0 :           break;
     908                 :            :         default:
     909         [ #  # ]:          0 :           if (Spells[S_WISH].known) {
     910                 :          0 :             print1("A mysterious voice mutters peevishly....");
     911                 :          0 :             print2("So what do you want now? A medal?");
     912                 :            :           }
     913                 :            :           else {
     914                 :          0 :             print1("Mystic runes appear in the air before you:");
     915                 :          0 :             print2("They appear to describe some high-powered spell.");
     916                 :          0 :             morewait();
     917                 :          0 :             print1("You hear a distant voice....");
     918                 :          0 :             print2("'You may now tread the path of High Magic.'");
     919                 :          0 :             Spells[S_WISH].known = TRUE;
     920                 :            :           }
     921                 :          0 :           break;
     922                 :            :         case 17:
     923                 :          0 :           print1("Weird flickering lights play over the throne.");
     924                 :          0 :           print2("You hear a strange droning sound, as of a magical");
     925                 :          0 :           morewait();
     926                 :          0 :           print1("artifact stressed by excessive use....");
     927                 :          0 :           print2("With an odd tinkling sound the throne shatters!");
     928                 :          0 :           Level->site[Player.x][Player.y].locchar = RUBBLE;
     929                 :          0 :           Level->site[Player.x][Player.y].p_locf = L_RUBBLE;
     930                 :          0 :           lset(Player.x, Player.y, CHANGED);
     931         [ #  # ]:          0 :           if (find_and_remove_item(OB_SCEPTRE,-1)) {
     932                 :          0 :             morewait();
     933                 :          0 :             print1("Your sceptre reverberates with the noise, and");
     934                 :          0 :             print2("it too explodes in a spray of shards.");
     935                 :            :           }
     936                 :          0 :           break;
     937                 :            :         }
     938                 :          0 :         calc_melee();
     939                 :          0 :         dataprint();
     940                 :            :       }
     941                 :            :     }
     942                 :            :   }
     943                 :          0 : }
     944                 :            : 
     945                 :            : 
     946                 :          0 : void l_escalator(void)
     947                 :            : {
     948                 :          0 :   print1("You have found an extremely long stairway going straight up.");
     949                 :          0 :   print2("The stairs are grilled steel and the bannister is rubber.");
     950                 :          0 :   morewait();
     951                 :          0 :   print1("Take the stairway? [yn] ");
     952         [ #  # ]:          0 :   if (ynq1()=='y') {
     953                 :          0 :     print1("The stairs suddenly start moving with a grind of gears!");
     954                 :          0 :     print2("You are wafted to the surface....");
     955                 :          0 :     change_environment(E_COUNTRYSIDE);
     956                 :            :   }
     957                 :          0 : }
     958                 :            : 
     959                 :          0 : void l_enter_court(void)
     960                 :            : {
     961                 :          0 :   print1("You have found a magical portal! Enter it? [yn] ");
     962         [ #  # ]:          0 :   if (ynq1()=='y') {
     963         [ #  # ]:          0 :     if (! gamestatusp(COMPLETED_CASTLE)) {
     964         [ #  # ]:          0 :       if (! gamestatusp(ATTACKED_ORACLE)) {
     965                 :          0 :         print2("A dulcet voice says: 'Jolly good show!'");
     966                 :          0 :         morewait();
     967                 :            :       }
     968                 :          0 :       setgamestatus(COMPLETED_CASTLE);
     969                 :            :     }
     970                 :          0 :     change_environment(E_COURT);
     971                 :            :   }
     972                 :          0 : }
     973                 :            : 
     974                 :          0 : void l_chaostone(void)
     975                 :            : {
     976                 :          0 :   print1("This is a menhir carved of black marble with veins of gold.");
     977                 :          0 :   print2("It emanates an aura of raw chaos, which is not terribly");
     978                 :          0 :   morewait();
     979                 :          0 :   print1("surprising, considering its location.");
     980         [ #  # ]:          0 :   if (Player.alignment < 0) 
     981                 :          0 :     print2("You feel an almost unbearable attraction to the stone.");
     982                 :          0 :   else print2("You find it extremely difficult to approach the stone.");
     983                 :          0 :   morewait();
     984                 :          0 :   clearmsg();
     985         [ #  # ]:          0 :   if (cinema_confirm("You reach out your fist to strike it.")=='y') {
     986                 :          0 :     print1("A sudden flux of energy surrounds you!");
     987                 :          0 :     morewait();
     988         [ #  # ]:          0 :     if (stonecheck(-1)) {
     989                 :          0 :       print2("You feel stronger!");
     990                 :          0 :       Player.maxstr = min(Player.maxstr+10,max(30,Player.maxstr));
     991                 :          0 :       dataprint();
     992                 :            :     }
     993                 :            :   }
     994                 :          0 :   else print1("You step back from the ominous dolmech.");
     995                 :          0 : }
     996                 :            : 
     997                 :            : 
     998                 :          0 : void l_balancestone(void)
     999                 :            : {
    1000                 :          0 :   print1("This is a massive granite slab teetering dangerously on a corner.");
    1001                 :          0 :   print2("You feel a sense of balance as you regard it.");
    1002                 :          0 :   morewait();
    1003                 :          0 :   clearmsg();
    1004         [ #  # ]:          0 :   if (cinema_confirm("Your hand naturally drifts forward to touch it.")=='y') {
    1005                 :          0 :     print1("A vortex of mana spins about you!");
    1006         [ #  # ]:          0 :     if (abs(Player.alignment) > random_range(50)) {
    1007                 :          0 :       print2("The cyclone whirls you off to a strange place!");
    1008                 :          0 :       morewait();
    1009                 :          0 :       change_environment(E_COUNTRYSIDE);
    1010                 :            :       do {
    1011                 :          0 :           setPlayerXY( random_range(COUNTRY_WIDTH), random_range(COUNTRY_LENGTH));
    1012         [ #  # ]:          0 :       } while (Country[Player.x][Player.y].current_terrain_type == CHAOS_SEA);
    1013                 :          0 :       screencheck(Player.x,Player.y);
    1014                 :          0 :       drawvision(Player.x,Player.y);
    1015                 :            :     }
    1016                 :            :     else {
    1017                 :          0 :       print2("You are being drained of experience! Step back? [yn] ");
    1018         [ #  # ]:          0 :       if (ynq2()=='y') {
    1019                 :          0 :         clearmsg();
    1020                 :          0 :         print1("The vortex calms down, dimishes, and then disappears.");
    1021                 :            :       }
    1022                 :            :       else {
    1023                 :          0 :         Player.xp -= Player.xp/4;
    1024                 :          0 :         dataprint();
    1025                 :          0 :         print2("The vortex vanishes. Suddenly, there is a clap of thunder!");
    1026                 :          0 :         morewait();
    1027                 :          0 :         Player.alignment = 0;
    1028                 :          0 :         strategic_teleport(1);
    1029                 :            :       }
    1030                 :            :     }
    1031                 :            :   }
    1032                 :          0 :   else print1("You step back from the unlikely boulder.");
    1033                 :          0 : }
    1034                 :            : 
    1035                 :            : 
    1036                 :          0 : void l_lawstone(void)
    1037                 :            : {
    1038                 :          0 :   print1("This is a stele carved of blueish-green feldspar.");
    1039                 :          0 :   print2("You feel an aura of serenity rising from it, and your gaze");
    1040                 :          0 :   morewait();
    1041                 :          0 :   print1("is attracted to the bulk of Star Peak to the North-East.");
    1042         [ #  # ]:          0 :   if (Player.alignment > 0) 
    1043                 :          0 :     print2("You feel a subtle attraction to the stone.");
    1044                 :          0 :   else print2("You find the stone extremely distasteful to contemplate.");
    1045                 :          0 :   morewait();
    1046                 :          0 :   clearmsg();
    1047         [ #  # ]:          0 :   if (cinema_confirm("Your arm moves as though compelled to grasp it.")=='y') {
    1048                 :          0 :     print1("A matrix of power flows about you!");
    1049                 :          0 :     morewait();
    1050         [ #  # ]:          0 :     if (stonecheck(1)) {
    1051                 :          0 :       print2("You feel more vigorous!");
    1052                 :          0 :       Player.maxcon = min(Player.maxcon+10,max(Player.maxcon,30));
    1053                 :          0 :       dataprint();
    1054                 :            :     }
    1055                 :            :   }
    1056                 :          0 :   else print1("You step back from the strange obelisk.");
    1057                 :          0 : }
    1058                 :            : 
    1059                 :            : 
    1060                 :          0 : void l_voidstone(void)
    1061                 :            : {
    1062                 :            :   int i;
    1063                 :          0 :   print1("This is a grey and uninteresting stone.");
    1064                 :          0 :   print2("A feeling of nihility emanates from it.");
    1065                 :          0 :   morewait();
    1066                 :          0 :   clearmsg();
    1067         [ #  # ]:          0 :   if (cinema_confirm("You're about to touch it.")=='y') {
    1068                 :          0 :     print1("You feel negated.");
    1069                 :          0 :     morewait();
    1070                 :          0 :     Player.mana = 0;
    1071                 :          0 :     toggle_item_use(TRUE);
    1072         [ #  # ]:          0 :     for(i=0;i<NUMSTATI;i++)
    1073                 :          0 :       Player.status[i] = 0;
    1074         [ #  # ]:          0 :     for(i=0;i<MAXITEMS;i++) 
    1075         [ #  # ]:          0 :       if (Player.possessions[i] != NULL) {
    1076                 :          0 :         Player.possessions[i]->blessing = 0;
    1077                 :          0 :         Player.possessions[i]->plus = 0;
    1078                 :          0 :         Player.possessions[i]->usef = I_NOTHING;
    1079                 :            :       }
    1080                 :          0 :     toggle_item_use(FALSE);
    1081                 :          0 :     calc_melee();
    1082                 :            :   }
    1083                 :          0 :   else print1("You back away from the strange rock.");
    1084                 :          0 : }
    1085                 :            : 
    1086                 :          0 : void l_sacrificestone(void)
    1087                 :            : {
    1088                 :          0 :   int sacrifice=1;
    1089                 :          0 :   int oldmaxhp = Player.maxhp;
    1090                 :          0 :   print1("You have come on a weathered basaltic block.");
    1091                 :          0 :   print2("On the top surface is an indentation in human shape.");
    1092                 :          0 :   morewait();
    1093                 :          0 :   print1("You see old rust colored stains in the grain of the stone.");
    1094                 :          0 :   print2("You sense something awakening. Touch the block? [yn] ");
    1095         [ #  # ]:          0 :   if (ynq2() == 'y') {
    1096                 :          0 :     print1("You sense great pain emanating from the ancient altar.");
    1097                 :          0 :     print2("Climb on to the block? [yn] ");
    1098         [ #  # ]:          0 :     if (ynq2() == 'y') {
    1099                 :          0 :       print1("You are stuck fast to the block!");
    1100                 :          0 :       print2("You feel your life-force being sucked away!");
    1101                 :          0 :       morewait();
    1102                 :          0 :       print1("Hit ESCAPE to try and get up at any moment, SPACE to remain.");
    1103                 :            :       do {
    1104   [ #  #  #  #  :          0 :         switch(random_range(4)) {
                      # ]
    1105                 :          0 :           case 0: print2("You feel weaker."); break;
    1106                 :          0 :           case 1: print2("You feel your life fading."); break;
    1107                 :          0 :           case 2: print2("Your energy is vanishing."); break;
    1108                 :          0 :           case 3: print2("You are being drained."); break;
    1109                 :            :           }
    1110                 :          0 :         Player.hp -= sacrifice;
    1111                 :          0 :         Player.maxhp -= sacrifice/2;
    1112                 :          0 :         sacrifice *= 2;
    1113                 :          0 :         dataprint();
    1114 [ #  # ][ #  # ]:          0 :         if ((Player.hp < 1) || (Player.maxhp < 1))
    1115                 :          0 :           p_death("self-sacrifice");
    1116         [ #  # ]:          0 :       } while (stillonblock());
    1117                 :          0 :       print1("You manage to wrench yourself off the ancient altar!");
    1118                 :          0 :       print2("You leave some skin behind, though....");
    1119                 :          0 :       morewait();
    1120 [ #  # ][ #  # ]:          0 :       if ((oldmaxhp > 10) && (Player.maxhp < 3 * oldmaxhp/4)) {
    1121                 :          0 :         print1("A strange red glow arises from the altar.");
    1122                 :          0 :         print2("The glow surrounds you.... You sense gratitude.");
    1123                 :          0 :         Player.pow += sacrifice;
    1124                 :          0 :         Player.maxpow += sacrifice/10;
    1125                 :          0 :         dataprint();
    1126                 :            :       }
    1127                 :            :       else {
    1128                 :          0 :         print1("You a have a sense of rejection.");
    1129                 :          0 :         print2("A roil of fetid vapor smokes up from the altar.");
    1130                 :          0 :         gain_experience(sacrifice);
    1131                 :            :       }
    1132                 :            :     }
    1133                 :            :     else {
    1134                 :          0 :       print1("You sense an emotion of pique all around you.");
    1135                 :          0 :       print2("You retreat from the strange stone.");
    1136                 :            :     }
    1137                 :            :   }
    1138                 :            :   else {
    1139                 :          0 :     print1("You decide discretion to be the better part of valour.");
    1140                 :          0 :     print2("The stone seems to subside sleepily.");
    1141                 :            :   }
    1142                 :          0 : }
    1143                 :            : 
    1144                 :          1 : void l_mindstone(void)
    1145                 :            : {
    1146                 :          1 :   print1("You approach a giant crystal of some opaline material.");
    1147                 :          1 :   print2("Flashes of irridescent light glint from the object.");
    1148                 :          1 :   morewait();
    1149                 :          1 :   print1("You feel your attention being drawn by the intricate crystal.");
    1150                 :          1 :   print2("Look away from the interesting phenomenon? [yn] ");
    1151         [ +  - ]:          1 :   if (ynq2()=='n') {
    1152                 :          1 :     print1("Your gaze focuses deeply on the gem....");
    1153                 :          1 :     print2("The crystal seems to open up and surround you!");
    1154                 :          1 :     morewait();
    1155         [ -  + ]:          1 :     if (stonecheck(0)) {
    1156                 :          0 :       print1("Your mind has been enhanced by the experience!");
    1157                 :          0 :       Player.maxiq = min(Player.maxiq+10,max(Player.maxiq,30));
    1158                 :          1 :       dataprint();
    1159                 :            :     }
    1160                 :            :   }
    1161                 :            :   else {
    1162                 :          0 :     print1("You manage to wrench your gaze from the odd jewel.");
    1163                 :          0 :     print2("The light flashes from the crystal diminish in frequency.");
    1164                 :            :   }
    1165                 :          1 : }

Generated by: LCOV version 1.11