LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - site2.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 58 812 7.1 %
Date: 2017-09-08 22:00:26 Functions: 3 20 15.0 %
Branches: 30 411 7.3 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* site2.c */
       3                 :            : /* 2nd half of site functions and aux functions to them */
       4                 :            : 
       5                 :            : #include "glob.h"
       6                 :            : 
       7                 :            : 
       8                 :            : 
       9                 :          0 : void l_condo(void)
      10                 :            : {
      11                 :          0 :   pol ol,prev=NULL;
      12                 :          0 :   int i,done=FALSE,over=FALSE,weeksleep=FALSE;
      13                 :            :   char response;
      14                 :            :   
      15         [ #  # ]:          0 :   if (! gamestatusp(SOLD_CONDO)) {
      16                 :          0 :     response = cinema_interact
      17                 :            :                    ("rp","Rampart Arms. Weekly Condo Rentals and Purchases",
      18                 :            :                          "Which are you interested in [r,p, or ESCAPE] ",
      19                 :            :                          NULL);
      20         [ #  # ]:          0 :     if (response == 'p') {
      21                 :          0 :       print2("Only 50,000Au. Buy it? [yn] ");
      22         [ #  # ]:          0 :       if (ynq2()=='y') {
      23         [ #  # ]:          0 :         if (Player.cash < 50000) 
      24                 :          0 :           print3("No mortgages, buddy.");
      25                 :            :         else {
      26                 :          0 :           setgamestatus(SOLD_CONDO);
      27                 :          0 :           Player.cash-=50000;
      28                 :          0 :           dataprint();
      29                 :          0 :           print2("You are the proud owner of a luxurious condo penthouse.");
      30                 :          0 :           Condoitems = NULL;
      31                 :            :         }
      32                 :            :       }
      33                 :            :     }
      34         [ #  # ]:          0 :     else if (response == 'r') {
      35                 :          0 :       print2("Weekly Rental, 1000Au. Pay for it? [yn] ");
      36         [ #  # ]:          0 :       if (ynq2()=='y') {
      37         [ #  # ]:          0 :         if (Player.cash < 1000)
      38                 :          0 :           print2("Hey, pay the rent or out you go....");
      39                 :            :         else {
      40                 :          0 :           weeksleep = TRUE;
      41                 :          0 :           Player.cash -=1000;
      42                 :          0 :           dataprint();
      43                 :            :         }
      44                 :            :       }
      45                 :            :     }
      46                 :          0 :     else print2("Please keep us in mind for your housing needs.");
      47                 :            :   }
      48                 :            :   else {
      49         [ #  # ]:          0 :     while (! done) {
      50                 :          0 :       menuclear();
      51                 :          0 :       menuprint("Home Sweet Home\n");
      52                 :          0 :       menuprint("a: Leave items in your safe.\n");
      53                 :          0 :       menuprint("b: Retrieve items.\n");
      54                 :          0 :       menuprint("c: Take a week off to rest.\n");
      55                 :          0 :       menuprint("d: Retire permanently.\n");
      56                 :          0 :       menuprint("ESCAPE: Leave this place.\n");
      57                 :          0 :       showmenu();
      58                 :          0 :       response = (char) mcigetc();
      59         [ #  # ]:          0 :       if (response == 'a') {
      60                 :          0 :         i = getitem(NULL_ITEM);
      61         [ #  # ]:          0 :         if (i != ABORT) {
      62         [ #  # ]:          0 :           if (Player.possessions[i]->blessing < 0) 
      63                 :          0 :             print2("The item just doesn't want to be stored away...");
      64                 :            :           else {
      65                 :          0 :             ol = ((pol) checkmalloc(sizeof(oltype)));
      66                 :          0 :             ol->thing = Player.possessions[i];
      67                 :          0 :             ol->next = Condoitems;
      68                 :          0 :             Condoitems = ol;
      69                 :          0 :             conform_unused_object(Player.possessions[i]);
      70                 :          0 :             Player.possessions[i] = NULL;
      71                 :            :           }
      72                 :            :         }
      73                 :            :       }
      74         [ #  # ]:          0 :       else if (response == 'b') {
      75                 :          0 :         ol = Condoitems;
      76 [ #  # ][ #  # ]:          0 :         while ((ol != NULL) && (! over)) {
      77                 :          0 :           print1("Retrieve ");
      78                 :          0 :           nprint1(itemid(ol->thing));
      79                 :          0 :           nprint1(" [ynq] ");
      80                 :          0 :           response = (char) mcigetc();
      81                 :            :           /* DAG -- fix memory leak where object list nodes weren't deleted */
      82         [ #  # ]:          0 :           if (response == 'y') {
      83                 :          0 :             gain_item(ol->thing);
      84         [ #  # ]:          0 :             if (ol == Condoitems)
      85                 :            :             {
      86                 :          0 :               ol = ol->next;
      87                 :          0 :               free( Condoitems );
      88                 :          0 :               Condoitems = ol;
      89                 :            :             }
      90                 :            :             else 
      91                 :            :             {
      92                 :          0 :               ol=ol->next;
      93                 :          0 :               free( prev->next );
      94                 :          0 :               prev->next = ol;
      95                 :            :             }
      96                 :            :           }
      97         [ #  # ]:          0 :           else if (response == 'q')
      98                 :          0 :             over = TRUE;
      99                 :            :           else 
     100                 :            :           {
     101                 :          0 :             prev = ol;
     102                 :          0 :             ol = ol->next;
     103                 :            :           }
     104                 :            :         }
     105                 :            :       }
     106         [ #  # ]:          0 :       else if (response == 'c') {
     107                 :          0 :           weeksleep = TRUE;
     108                 :          0 :           print1("You take a week off to rest...");
     109                 :          0 :           morewait();
     110                 :            :       }
     111         [ #  # ]:          0 :       else if (response == 'd') {
     112                 :          0 :         clearmsg();
     113         [ #  # ]:          0 :         if (cinema_confirm("You ponder settling down here for good.") == 'y') {
     114                 :          0 :           p_win();
     115                 :            :         }
     116                 :            :       }
     117         [ #  # ]:          0 :       else if (response == ESCAPE) done = TRUE;
     118                 :            :     }
     119                 :          0 :     xredraw();
     120                 :            :   }
     121         [ #  # ]:          0 :   if (weeksleep) {
     122                 :          0 :     clearmsg();
     123                 :          0 :     print1("Taking a week off to rest...");
     124                 :          0 :     morewait();
     125                 :          0 :     toggle_item_use(TRUE);
     126                 :          0 :     Player.hp = Player.maxhp;
     127                 :          0 :     Player.str = Player.maxstr;
     128                 :          0 :     Player.agi = Player.maxagi;
     129                 :          0 :     Player.con = Player.maxcon;
     130                 :          0 :     Player.dex = Player.maxdex;
     131                 :          0 :     Player.iq = Player.maxiq;
     132                 :          0 :     Player.pow = Player.maxpow;
     133         [ #  # ]:          0 :     for (i=0;i<NUMSTATI;i++)
     134         [ #  # ]:          0 :       if (Player.status[i]<1000) Player.status[i]=0;
     135                 :          0 :     toggle_item_use(FALSE);
     136                 :          0 :     Player.food = 36;
     137                 :          0 :     print2("You're once again fit and ready to continue your adventure.");
     138                 :          0 :     Time += 60*24*7;
     139                 :          0 :     Date += 7;
     140                 :          0 :     moon_check();
     141                 :          0 :     timeprint();
     142                 :            :   }
     143                 :          0 : }
     144                 :            : 
     145                 :            : 
     146                 :            : 
     147                 :            : 
     148                 :          0 : void gymtrain(int *maxstat, int *stat)
     149                 :            : {
     150         [ #  # ]:          0 :   if (Gymcredit + Player.cash < 2000)
     151                 :          0 :     print2("You can't afford our training!");
     152                 :            :   else {
     153         [ #  # ]:          0 :     if (Gymcredit > 2000) Gymcredit -= 2000;
     154                 :            :     else {
     155                 :          0 :       Player.cash -= (2000-Gymcredit);
     156                 :          0 :       Gymcredit = 0;
     157                 :            :     }
     158                 :          0 :     print2("Sweat. Sweat. ");
     159   [ #  #  #  # ]:          0 :     if ((*maxstat < 30) && 
     160         [ #  # ]:          0 :         ((*maxstat < random_range(30)) || (random_range(3)==1))){
     161                 :          0 :       nprint2("The training pays off!");
     162                 :          0 :       (*maxstat)++;
     163                 :          0 :       (*stat)++;
     164                 :            :     }
     165                 :            :     else {
     166                 :          0 :       nprint2("You feel the healthy glow of a good workout.");
     167         [ #  # ]:          0 :       if (*stat < *maxstat) {
     168                 :          0 :         (*stat)++;
     169                 :          0 :         print3("A feeling of rehabilitation washes through you.");
     170                 :            :       }
     171                 :            :     }
     172                 :            :   }
     173                 :          0 :   dataprint();
     174                 :          0 : }
     175                 :            : 
     176                 :          0 : void healforpay(void)
     177                 :            : {
     178         [ #  # ]:          0 :   if (Player.cash < 50)
     179                 :          0 :     print2("You can't afford to be healed!");
     180                 :            :   else {
     181                 :          0 :     Player.cash -= 50;
     182         [ #  # ]:          0 :     if (Player.hp < Player.maxhp )
     183                 :            :     {
     184                 :          0 :       Player.hp += 20+random_range(20);
     185         [ #  # ]:          0 :       if (Player.hp > Player.maxhp) 
     186                 :          0 :         Player.hp = Player.maxhp;
     187                 :            :     }
     188                 :          0 :     print2("Another medical marvel....");
     189                 :            :   }
     190                 :          0 :   dataprint();
     191                 :          0 : }
     192                 :            : 
     193                 :          0 : void cureforpay(void)
     194                 :            : {
     195         [ #  # ]:          0 :   if (Player.cash < 250)
     196                 :          0 :     print2("You can't afford to be cured!");
     197                 :            :   else {
     198                 :          0 :     Player.cash -= 250;
     199                 :          0 :     Player.status[DISEASED] = 0;
     200                 :          0 :     print2("Quarantine lifted....");
     201                 :          0 :     showflags();
     202                 :            :   }
     203                 :          0 : }  
     204                 :            : 
     205                 :            : 
     206                 :            : 
     207                 :          0 : void pacify_guards(void)
     208                 :            : {
     209                 :            :   pml ml;
     210                 :            : 
     211         [ #  # ]:          0 :   for(ml=Level->mlist;ml!=NULL;ml=ml->next)
     212 [ #  # ][ #  # ]:          0 :     if ((ml->m->id == GUARD) || /*guard*/
     213         [ #  # ]:          0 :         ((ml->m->id == HISCORE_NPC) && (ml->m->aux2 == 15))) {/* justiciar */
     214                 :          0 :       m_status_reset(ml->m,HOSTILE);
     215                 :          0 :       ml->m->specialf = M_NO_OP;
     216 [ #  # ][ #  # ]:          0 :       if (ml->m->id == GUARD && ml->m->hp > 0 && ml->m->aux1 > 0) {
                 [ #  # ]
     217         [ #  # ]:          0 :         if (Level->site[ml->m->x][ml->m->y].creature == ml->m)
     218                 :          0 :           Level->site[ml->m->x][ml->m->y].creature = NULL;
     219                 :          0 :         ml->m->x = ml->m->aux1;
     220                 :          0 :         ml->m->y = ml->m->aux2;
     221                 :          0 :         Level->site[ml->m->x][ml->m->y].creature = ml->m;
     222                 :            :       }
     223 [ #  # ][ #  # ]:          0 :       else if (ml->m->id == HISCORE_NPC && ml->m->hp > 0 &&
                 [ #  # ]
     224                 :          0 :           Current_Environment == E_CITY) {
     225         [ #  # ]:          0 :         if (Level->site[ml->m->x][ml->m->y].creature == ml->m)
     226                 :          0 :           Level->site[ml->m->x][ml->m->y].creature = NULL;
     227                 :          0 :         ml->m->x = 40;
     228                 :          0 :         ml->m->y = 62;
     229                 :          0 :         Level->site[ml->m->x][ml->m->y].creature = ml->m;
     230                 :            :       }
     231                 :            :     }
     232         [ #  # ]:          0 :     if (Current_Environment == E_CITY)
     233                 :          0 :       Level->site[40][60].p_locf = L_ORDER; /* undoes action in alert_guards */
     234                 :          0 : }
     235                 :            : 
     236                 :          0 : void send_to_jail(void)
     237                 :            : {
     238         [ #  # ]:          0 :   if (Player.rank[ORDER] > 0) {
     239                 :          0 :     print1("A member of the Order of Paladins sent to jail!");
     240                 :          0 :     print2("It cannot be!");
     241                 :          0 :     morewait();
     242                 :          0 :     print1("You are immediately expelled permanently from the Order!");
     243                 :          0 :     print2("Your name is expunged from the records....");
     244                 :          0 :     Player.rank[ORDER] = -1;
     245                 :            :   }
     246         [ #  # ]:          0 :   else if (gamestatusp(DESTROYED_ORDER)) 
     247                 :          0 :     print1("The destruction of the Order of Paladins has negated the law!");
     248 [ #  # ][ #  # ]:          0 :   else if ((Current_Environment != E_CITY) &&
     249                 :          0 :            (Last_Environment != E_CITY)) 
     250                 :          0 :     print1("Fortunately, there is no jail around here, so you are freed!");
     251                 :            :   else {
     252                 :          0 :     pacify_guards();
     253 [ #  # ][ #  # ]:          0 :     if (((Current_Environment == E_HOUSE) || 
     254         [ #  # ]:          0 :          (Current_Environment == E_MANSION) ||
     255         [ #  # ]:          0 :          (Current_Environment == E_HOVEL)) &&
     256                 :          0 :         (Last_Environment == E_CITY))
     257                 :            :     {
     258                 :          0 :       setgamestatus(SUPPRESS_PRINTING);
     259                 :          0 :       change_environment(E_CITY);
     260                 :          0 :       resetgamestatus(SUPPRESS_PRINTING);
     261                 :            :     }
     262         [ #  # ]:          0 :     if (Current_Environment == E_CITY) {
     263         [ #  # ]:          0 :       if (gamestatusp(UNDEAD_GUARDS)) {
     264                 :          0 :         print1("You are taken to a weirdly deserted chamber where an undead");
     265                 :          0 :         print2("Magistrate presides over a court of ghosts and haunts.");
     266                 :          0 :         morewait();
     267                 :          0 :         print1("'Mr. Foreman, what is the verdict?'");
     268                 :          0 :         print2("'Guilty as charged, your lordship.'");
     269                 :          0 :         morewait();
     270                 :          0 :         clearmsg();
     271                 :          0 :         print1("'Guilty...");
     272                 :          0 :         morewait();
     273                 :          0 :         nprint1("Guilty...");
     274                 :          0 :         morewait();
     275                 :          0 :         nprint1("Guilty...");
     276                 :          0 :         morewait();
     277                 :          0 :         nprint1("Guilty...'");
     278                 :          0 :         clearmsg();
     279                 :          0 :         print1("The members of the court close in around, fingers pointing.");
     280                 :          0 :         print2("You feel insubstantial hands closing around your throat....");
     281                 :          0 :         print3("You feel your life draining away!");
     282         [ #  # ]:          0 :         while(Player.level > 0) {
     283                 :          0 :           Player.level--;
     284                 :          0 :           Player.xp /= 2;
     285                 :          0 :           Player.hp /= 2;
     286                 :          0 :           dataprint();
     287                 :            :         }
     288                 :          0 :         Player.maxhp = Player.maxcon;
     289                 :          0 :         morewait();
     290                 :          0 :         print1("You are finally released, a husk of your former self....");
     291                 :          0 :         Player.x = 58;
     292                 :          0 :         Player.y = 40;
     293                 :          0 :         screencheck(Player.x,Player.y);
     294                 :            :       }
     295                 :            :       /* Hmm...  The sorcerors ought to be able to get you free, too,
     296                 :            :        * although of course they should have their *own* price. */
     297                 :          0 :       else if (Player.alignment + random_range(200) < 0) {
     298                 :            :         print1("Luckily for you, a smooth-tongued advocate from the");
     299                 :            :         print2("Rampart Chaotic Liberties Union gets you off!");
     300                 :            :         Player.x = 58;
     301                 :            :         Player.y = 40;
     302                 :            :         screencheck(Player.x,Player.y);
     303                 :            :       }
     304      [ #  #  # ]:          0 :       else switch(Imprisonment++) {
     305                 :            :       case 0:
     306                 :          0 :         print1("The Magistrate sternly reprimands you.");
     307                 :          0 :         print2("As a first-time offender, you are given probation.");
     308                 :          0 :         Player.y = 58;
     309                 :          0 :         Player.x = 40;
     310                 :          0 :         screencheck(Player.x,Player.y);
     311                 :          0 :         break;
     312                 :            :       case 1:
     313                 :          0 :         print1("The Magistrate expresses shame for your conduct.");
     314                 :          0 :         print2("You are thrown in jail!");
     315                 :          0 :         morewait();     
     316                 :          0 :         repair_jail();
     317                 :          0 :         Player.y = 54;
     318                 :          0 :         Player.x = 37 + (2*random_range(4));
     319                 :          0 :         screencheck(Player.x,Player.y);
     320                 :          0 :         l_portcullis_trap();
     321                 :          0 :         break;
     322                 :            :       default:
     323                 :          0 :         print1("The Magistrate renders summary judgement.");
     324                 :          0 :         print2("You are sentenced to prison!");
     325                 :          0 :         morewait();
     326                 :          0 :         print1("The guards recognize you as a 'three-time-loser'"); 
     327                 :          0 :         print2("...and beat you up a little to teach you a lesson.");
     328                 :          0 :         p_damage(random_range(Imprisonment * 10),
     329                 :            :                  UNSTOPPABLE,
     330                 :            :                  "police brutality");
     331                 :          0 :         morewait();
     332                 :          0 :         repair_jail();
     333                 :          0 :         Player.y = 54;
     334                 :          0 :         Player.x = 37 + (2*random_range(4));
     335                 :          0 :         screencheck(Player.x,Player.y);
     336                 :          0 :         l_portcullis_trap();
     337                 :            :       }
     338                 :            :     }
     339                 :            :   }
     340                 :          0 : }
     341                 :            : 
     342                 :            : 
     343                 :          0 : void l_adept(void)
     344                 :            : {
     345                 :          0 :   print1("You see a giant shimmering gate in the form of an omega.");
     346         [ #  # ]:          0 :   if (! gamestatusp(ATTACKED_ORACLE)) {
     347         [ #  # ]:          0 :     if (Player.str+Player.con+Player.iq+Player.pow < 100)
     348                 :          0 :       print2("A familiar female voice says: I would not advise this now....");
     349                 :          0 :     else print2("A familiar female voice says: Go for it!");
     350                 :            :   }
     351                 :          0 :   morewait();
     352                 :          0 :   clearmsg();
     353         [ #  # ]:          0 :   if (cinema_confirm("You're about to step into the mystic portal.")!='y') {
     354         [ #  # ]:          0 :     if (Player.level > 100) {
     355                 :          0 :       print1("The Lords of Destiny spurn your cowardice and indecision...");
     356                 :          0 :       Player.xp = 0;
     357                 :          0 :       Player.level = 0;
     358                 :          0 :       Player.hp = Player.maxhp = Player.con;
     359                 :          0 :       Player.mana = calcmana();
     360                 :          0 :       print2("You suddenly feel very inexperienced.");
     361                 :          0 :       dataprint();
     362                 :          0 :       morewait();
     363                 :          0 :       clearmsg();
     364                 :            :     }
     365                 :          0 :     print1("You edge away from the challenge.");
     366                 :            :   }
     367                 :            :   else {
     368                 :          0 :     clearmsg();
     369                 :          0 :     print1("You pass through the portal.");
     370                 :          0 :     morewait();
     371                 :          0 :     drawomega();
     372                 :          0 :     print1("Like wow man! Colors! ");
     373         [ #  # ]:          0 :     if (Player.patron != DESTINY) {
     374                 :          0 :       print2("Strange forces try to tear you apart!");
     375                 :          0 :       p_damage(random_range(200),UNSTOPPABLE,"a vortex of chaos");
     376                 :            :     }
     377                 :          0 :     else print2("Some strange force shields you from a chaos vortex!");
     378                 :          0 :     morewait();
     379                 :          0 :     print1("Your head spins for a moment....");
     380                 :          0 :     print2("and clears....");
     381                 :          0 :     morewait();
     382                 :          0 :     Player.hp = Player.maxhp;
     383                 :          0 :     Player.mana = calcmana();
     384                 :          0 :     change_environment(E_ABYSS);
     385                 :            :   }
     386                 :          0 : }
     387                 :            : 
     388                 :            : 
     389                 :            : 
     390                 :          0 : void l_trifid(void)
     391                 :            : {
     392                 :          0 :   int damage=0,stuck=TRUE;
     393                 :          0 :   print1("The hedge comes alive with a surge of alien growth!");
     394         [ #  # ]:          0 :   while (stuck) {
     395                 :          0 :     dataprint();
     396                 :          0 :     damage += Level->depth/2+1;
     397                 :          0 :     print2("Razor-edged vines covered in suckers attach themselves to you.");
     398                 :          0 :     morewait();
     399         [ #  # ]:          0 :     if (find_and_remove_item(OB_SALT_WATER,-1)) {
     400                 :          0 :       print1("Thinking fast, you toss salt water on the trifid...");
     401                 :          0 :       print2("The trifid disintegrates with a frustrated sigh.");
     402                 :          0 :       Level->site[Player.x][Player.y].locchar = FLOOR;
     403                 :          0 :       Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     404                 :          0 :       lset(Player.x, Player.y, CHANGED);
     405                 :          0 :       gain_experience(1000);
     406                 :          0 :       stuck = FALSE;
     407                 :            :     }
     408                 :            :     else {
     409                 :          0 :       p_damage(damage,UNSTOPPABLE,"a trifid");
     410                 :          0 :       morewait();
     411                 :          0 :       print1("You are entangled in tendrils...");
     412                 :          0 :       menuclear();
     413                 :          0 :       menuprint("a: Try to break free.\n");
     414                 :          0 :       menuprint("b: Hang limp and hope the tendrils uncoil.\n");
     415                 :          0 :       menuprint("c: Pray for assistance.\n");
     416                 :          0 :       menuprint("d: Attempt to bargain with the hedge.\n");
     417                 :          0 :       menuprint("e: Click your heels together and wish for escape.\n");
     418                 :          0 :       menuprint("ANYTHING ELSE: writhe and scream hopelessly.\n");
     419                 :          0 :       showmenu();
     420   [ #  #  #  #  :          0 :       switch(menugetc()) {
                   #  # ]
     421                 :            :       case 'a': 
     422         [ #  # ]:          0 :         if (Player.str > random_range(200)) {
     423                 :          0 :           print1("Amazing! You're now free.");
     424                 :          0 :           print2("The trifid writhes hungrily at you.");
     425                 :          0 :           stuck = FALSE;
     426                 :            :         }
     427                 :          0 :         else print1("Well, THAT didn't work.");
     428                 :          0 :         break;
     429                 :            :       case 'b': 
     430                 :          0 :         print1("Well, at least you're facing your fate with dignity.");
     431                 :          0 :         break;
     432                 :            :       case 'c': 
     433   [ #  #  #  # ]:          0 :         if ((Player.patron == DRUID) && 
     434                 :          0 :             (Player.rank[PRIESTHOOD] > random_range(5))) {
     435                 :          0 :             print1("A shaft of golden light bathes the alien plant");
     436                 :          0 :             print2("which grudginly lets you go....");
     437                 :          0 :             stuck = FALSE;
     438                 :            :           }
     439                 :          0 :         else print1("You receive no divine aid as yet.");
     440                 :          0 :         break;
     441                 :            :       case 'd':
     442                 :          0 :         print1("The hedge doesn't answer your entreaties.");
     443                 :          0 :         break;
     444                 :            :       case 'e':
     445                 :          0 :         print1("You forgot your ruby slippers, stupid.");
     446                 :          0 :         break;
     447                 :            :       default:
     448                 :          0 :         print1("The hedge enjoys your camp play-acting....");
     449                 :          0 :         break;
     450                 :            :       }
     451                 :            :     }
     452                 :            :   }
     453                 :          0 :   xredraw();
     454                 :          0 : }
     455                 :            : 
     456                 :            : 
     457                 :          0 : void l_vault(void)
     458                 :            : {
     459                 :          0 :   print1("You come to a thick vault door with a complex time lock.");
     460         [ #  # ]:          0 :   if ((hour()==23)) {
     461                 :          0 :     print2("The door is open.");
     462                 :          0 :     Level->site[12][56].locchar = FLOOR;
     463                 :            :   }
     464                 :            :   else {
     465                 :          0 :     print2("The door is closed.");
     466                 :          0 :     Level->site[12][56].locchar = WALL;
     467                 :          0 :     morewait();
     468                 :          0 :     clearmsg();
     469         [ #  # ]:          0 :     if (cinema_confirm("You're about to try to crack the safe.")=='y') {
     470         [ #  # ]:          0 :       if (random_range(100) < Player.rank[THIEVES]*Player.rank[THIEVES]) {
     471                 :          0 :         print2("The lock clicks open!!!");
     472                 :          0 :         gain_experience(5000);
     473                 :          0 :         Level->site[12][56].locchar = FLOOR;
     474                 :            :       } 
     475                 :            :       else {
     476                 :          0 :         print2("Uh, oh, set off the alarm.... The castle guard arrives....");
     477                 :          0 :         morewait();
     478         [ #  # ]:          0 :         if (Player.rank[NOBILITY] == DUKE) {
     479                 :          0 :           clearmsg();
     480                 :          0 :           print1("\"Ah, just testing us, your Grace?  I hope we're up to scratch.\"");
     481                 :          0 :           morewait();
     482                 :            :         }
     483                 :            :         else
     484                 :          0 :           send_to_jail();
     485                 :            :       }
     486                 :            :     }
     487                 :          0 :     else print2("Good move.");
     488                 :            :   }
     489                 :          0 : }
     490                 :            : 
     491                 :            : 
     492                 :          0 : void l_brothel(void)
     493                 :            : {
     494                 :            :   char response;
     495                 :          0 :   print1("You come to a heavily reinforced inner door.");
     496                 :          0 :   print2("A sign reads `The House of the Eclipse'");
     497                 :          0 :   morewait();
     498                 :          0 :   clearmsg();
     499         [ #  # ]:          0 :   if (cinema_confirm("You are about to open the door.")=='y') {
     500                 :          0 :     menuclear();
     501                 :          0 :     menuprint("a:knock on the door.\n");
     502                 :          0 :     menuprint("b:try to pick the lock.\n");
     503                 :          0 :     menuprint("c:bash down the door.\n");
     504                 :          0 :     menuprint("ESCAPE: Leave this house of ill repute.\n");
     505                 :          0 :     showmenu();
     506                 :            :     do 
     507                 :          0 :       response = menugetc();
     508         [ #  # ]:          0 :     while ((response != 'a') &&
     509         [ #  # ]:          0 :            (response != 'b') &&
     510         [ #  # ]:          0 :            (response != 'c') &&
     511         [ #  # ]:          0 :            (response != ESCAPE));
     512                 :          0 :     xredraw();
     513         [ #  # ]:          0 :     if (response == 'a') {
     514         [ #  # ]:          0 :       if (!nighttime())
     515                 :          0 :         print2("There is no reponse.");
     516                 :            :       else {
     517                 :          0 :         print1("A window opens in the door.");
     518                 :          0 :         print2("`500Au, buddy. For the night.' pay it? [yn] ");
     519         [ #  # ]:          0 :         if (ynq2()=='y') {
     520         [ #  # ]:          0 :           if (Player.cash < 500) {
     521                 :          0 :             print1("`What, no roll?!'");
     522                 :          0 :             print2("The bouncer bounces you a little and lets you go.");
     523                 :          0 :             p_damage(25,UNSTOPPABLE,"da bouncer");
     524                 :            :           }
     525                 :            :           else {
     526                 :          0 :             Player.cash -= 500;
     527                 :          0 :             print1("You are ushered into an opulently appointed hall.");
     528                 :          0 :             print2("After an expensive dinner (takeout from Les Crapuleux)");
     529                 :          0 :             morewait();
     530         [ #  # ]:          0 :             if (Player.preference == 'n') {
     531   [ #  #  #  #  :          0 :               switch(random_range(4)) {
                      # ]
     532                 :            :               case 0:
     533                 :          0 :                 print1("you spend the evening playing German Whist with");
     534                 :          0 :                 break;
     535                 :            :               case 1:
     536                 :          0 :                 print1("you spend the evening discussing philosophy with");
     537                 :          0 :                 break;
     538                 :            :               case 2:
     539                 :          0 :                 print1("you spend the evening playing chess against");
     540                 :          0 :                 break;
     541                 :            :               case 3:
     542                 :          0 :                 print1("you spend the evening telling your adventures to");
     543                 :            :               }
     544                 :          0 :               print2("various employees of the House of the Eclipse.");
     545                 :            :             }
     546                 :            :             else {
     547                 :          0 :               print1("you spend an enjoyable and educational evening with");
     548 [ #  # ][ #  # ]:          0 :               if (Player.preference == 'm' ||
     549         [ #  # ]:          0 :                   (Player.preference == 'y' && random_range(2)))
     550   [ #  #  #  #  :          0 :                 switch(random_range(4)) {
                      # ]
     551                 :            :                 case 0: 
     552                 :          0 :                   print2("Skarn the Insatiable, a satyr.");
     553                 :          0 :                   break;
     554                 :            :                 case 1: 
     555                 :          0 :                   print2("Dryden the Defanged, an incubus.");
     556                 :          0 :                   break;
     557                 :            :                 case 2: 
     558                 :          0 :                   print2("Gorgar the Equipped, a centaur.");
     559                 :          0 :                   break;
     560                 :            :                 case 3: 
     561                 :          0 :                   print2("Hieronymus, the mendicant priest of Eros.");
     562                 :          0 :                   break;
     563                 :            :                 }       
     564   [ #  #  #  #  :          0 :               else switch(random_range(4)) {
                      # ]
     565                 :            :               case 0: 
     566                 :          0 :                 print2("Noreen the Nymph (omaniac)");
     567                 :          0 :                 break;
     568                 :            :               case 1: 
     569                 :          0 :                 print2("Angelface, a recanted succubus.");
     570                 :          0 :                 break;
     571                 :            :               case 2: 
     572                 :          0 :                 print2("Corporal Sue of the City Guard (moonlighting).");
     573                 :          0 :                 break;
     574                 :            :               case 3: 
     575                 :          0 :                 print2("Sheena the Queena the Jungle, a wereleopard.");
     576                 :          0 :                 break;
     577                 :            :               } 
     578                 :            :             }
     579                 :          0 :             morewait();
     580         [ #  # ]:          0 :             if (hour() > 12) Time += ((24-hour())+8) * 60;
     581                 :            :             else {
     582                 :          0 :               Time += ((9-hour())*60);
     583                 :          0 :               Date++;
     584                 :            :             }
     585                 :          0 :             Player.food = 40;
     586                 :          0 :             Player.status[DISEASED] = 0;
     587                 :          0 :             Player.status[POISONED] = 0;
     588                 :          0 :             Player.hp = Player.maxhp;
     589                 :            :             /* reduce temporary stat gains to max stat levels */
     590                 :          0 :             toggle_item_use(TRUE);
     591                 :          0 :             Player.str = min(Player.str,Player.maxstr);
     592                 :          0 :             Player.con = min(Player.con,Player.maxcon);
     593                 :          0 :             Player.agi = min(Player.agi,Player.maxagi);
     594                 :          0 :             Player.dex = min(Player.dex,Player.maxdex);
     595                 :          0 :             Player.iq = min(Player.iq,Player.maxiq);
     596                 :          0 :             Player.pow = min(Player.pow,Player.maxpow);
     597                 :          0 :             toggle_item_use(FALSE);
     598         [ #  # ]:          0 :             if (Player.preference == 'n')
     599                 :          0 :               Player.iq++; /* whatever :-) */
     600                 :            :             else
     601                 :          0 :               Player.con++;
     602                 :          0 :             gain_experience(100);
     603                 :          0 :             timeprint();
     604                 :          0 :             dataprint();
     605                 :          0 :             showflags();
     606                 :          0 :             morewait();
     607                 :          0 :             clearmsg();
     608         [ #  # ]:          0 :             if (Player.preference == 'n')
     609                 :          0 :               print1("You arise refreshed the next morning...");
     610                 :            :             else
     611                 :          0 :               print1("You arise, tired but happy, the next morning...");
     612                 :            :           }
     613                 :            :         }
     614                 :          0 :         else print2("What are you, some kinda prude?");
     615                 :            :       }
     616                 :            :     }
     617         [ #  # ]:          0 :     else if (response == 'b') {
     618         [ #  # ]:          0 :       if (nighttime()) {
     619                 :          0 :         print1("As you fumble at the lock, the door opens....");
     620                 :          0 :         print2("The bouncer tosses you into the street.");
     621                 :            :       }
     622                 :          0 :       else print1("The door appears to be bolted and barred from behind.");
     623                 :            :     }
     624         [ #  # ]:          0 :     else if (response == 'c') {
     625         [ #  # ]:          0 :       if (nighttime()) {
     626                 :          0 :         print1("As you charge toward the door it opens....");
     627                 :          0 :         print2("Yaaaaah! Thud!");
     628                 :          0 :         morewait();
     629                 :          0 :         print1("You run past the startled bouncer into a wall.");
     630                 :          0 :         p_damage(20,UNSTOPPABLE,"a move worthy of Clouseau");
     631                 :          0 :         print2("The bouncer tosses you into the street.");
     632                 :            :       }
     633                 :            :       else {
     634                 :          0 :         print1("Ouch! The door resists your efforts.");
     635                 :          0 :         p_damage(1,UNSTOPPABLE,"a sturdy door");
     636                 :          0 :         morewait();
     637                 :          0 :         print1("You hear an irritated voice from inside:");
     638                 :          0 :         print2("'Keep it down out there! Some of us are trying to sleep!'");
     639                 :            :       }
     640                 :            :     }
     641                 :            :   }
     642                 :          0 : }
     643                 :            : 
     644                 :            : 
     645                 :            : 
     646                 :            : #ifndef MSDOS_SUPPORTED_ANTIQUE
     647                 :            : /* if signp is true, always print message, otherwise do so only sometimes */
     648                 :        336 : void sign_print(int x, int y, int signp)
     649                 :            : {
     650 [ +  + ][ +  + ]:        336 :   if ((Level->site[x][y].p_locf >= CITYSITEBASE) &&
     651                 :         27 :       (Level->site[x][y].p_locf < CITYSITEBASE+NUMCITYSITES))
     652                 :          6 :     CitySiteList[Level->site[x][y].p_locf - CITYSITEBASE][0] = TRUE;
     653   [ -  -  -  -  :        336 :   switch(Level->site[x][y].p_locf) {
          -  -  -  +  -  
          +  -  -  -  -  
          -  -  -  -  -  
          -  -  -  -  +  
          -  -  -  -  -  
                   +  + ]
     654                 :            :   case L_CHARITY:
     655                 :          0 :     print1("You notice a sign: The Rampart Orphanage and Hospice For The Needy.");
     656                 :          0 :     break;
     657                 :            :   case L_MANSION:
     658                 :          0 :     print1("You notice a sign:");
     659                 :          0 :     print2("This edifice protected by DeathWatch Devices, Ltd.");
     660                 :          0 :     morewait();
     661                 :          0 :     break;
     662                 :            :   case L_GRANARY:  
     663                 :          0 :     print1("You notice a sign:");
     664                 :          0 :     print2("Public Granary: Entrance Strictly Forbidden.");
     665                 :          0 :     break;
     666                 :            :   case L_PORTCULLIS:
     667         [ #  # ]:          0 :     if (Level->site[x][y].locchar == FLOOR)
     668                 :          0 :       print1("You see a groove in the floor and slots above you.");
     669                 :          0 :     break;
     670                 :            :   case L_STABLES:
     671                 :          0 :     print1("You notice a sign:");
     672                 :          0 :     print2("Village Stables");
     673                 :          0 :     break;
     674                 :            :   case L_COMMONS:
     675                 :          0 :     print1("You notice a sign:");
     676                 :          0 :     print2("Village Commons: No wolves allowed.");
     677                 :          0 :     break;
     678                 :            :   case L_MAZE:
     679                 :          0 :     print1("You notice a sign:");
     680                 :          0 :     print2("Hedge maze closed for trifid extermination.");
     681                 :          0 :     break;
     682                 :            :   case L_BANK:
     683         [ -  + ]:          1 :     if (signp) {
     684                 :          0 :       print1("You notice a sign:");
     685                 :          0 :       print2("First Bank of Omega: Autoteller Carrel.");
     686                 :            :     }
     687                 :          1 :     break;
     688                 :            :   case L_TEMPLE:
     689                 :          0 :     print1("You see the ornate portico of the Rampart Pantheon");
     690                 :          0 :     break;
     691                 :            :   case L_ARMORER:
     692         [ -  + ]:          1 :     if (signp) {
     693                 :          0 :       print1("You notice a sign:");
     694                 :          0 :       print2("Julie's Armor of Proof and Weapons of Quality");
     695                 :            :     }
     696                 :          1 :     break;
     697                 :            :   case L_CLUB:
     698         [ #  # ]:          0 :     if (signp) {
     699                 :          0 :       print1("You notice a sign:");
     700                 :          0 :       print2("Rampart Explorers' Club.");
     701                 :            :     }
     702                 :          0 :     break;
     703                 :            :   case L_GYM:
     704         [ #  # ]:          0 :     if (signp) {
     705                 :          0 :       print1("You notice a sign:");
     706                 :          0 :       print2("The Rampart Gymnasium, (affil. Rampart Coliseum).");
     707                 :            :     }
     708                 :          0 :     break;
     709                 :            :   case L_HEALER:
     710         [ #  # ]:          0 :     if (signp) {
     711                 :          0 :       print1("You notice a sign:");
     712                 :          0 :       print2("Rampart Healers. Member RMA.");
     713                 :            :     }
     714                 :          0 :     break;
     715                 :            :   case L_CASINO:
     716         [ #  # ]:          0 :     if (signp) {
     717                 :          0 :       print1("You notice a sign:");
     718                 :          0 :       print2("Rampart Mithril Nugget Casino.");
     719                 :            :     }
     720                 :          0 :     break;
     721                 :            :   case L_SEWER:
     722                 :          0 :     print1("A sewer entrance. You don't want to go down THERE, do you?");
     723                 :          0 :     break;
     724                 :            :   case L_COMMANDANT:
     725         [ #  # ]:          0 :     if (signp) {
     726                 :          0 :       print1("You notice a sign:");
     727                 :          0 :       print2("Commandant Sonder's Rampart-fried Lyzzard partes. Open 24 hrs.");
     728                 :            :     }
     729                 :          0 :     break;
     730                 :            :   case L_DINER:
     731         [ #  # ]:          0 :     if (signp) {
     732                 :          0 :       print1("You notice a sign:");
     733                 :          0 :       print2("The Rampart Diner. All you can eat, 25Au.");
     734                 :            :     }
     735                 :          0 :     break;
     736                 :            :   case L_CRAP:
     737         [ #  # ]:          0 :     if (signp) {
     738                 :          0 :       print1("You notice a sign:"); 
     739                 :          0 :       print2("Les Crapeuleaux. (****)");
     740                 :            :     }
     741                 :          0 :     break;
     742                 :            :   case L_TAVERN:
     743         [ #  # ]:          0 :     if (signp) {
     744                 :          0 :       print1("You notice a sign:"); 
     745                 :          0 :       print2("The Centaur and Nymph -- J. Riley, prop.");
     746                 :            :     }
     747                 :          0 :     break;
     748                 :            :   case L_ALCHEMIST:
     749         [ #  # ]:          0 :     if (signp) {
     750                 :          0 :       print1("You notice a sign:"); 
     751                 :          0 :       print2("Ambrosias' Potions et cie.");
     752                 :            :     }
     753                 :          0 :     break;
     754                 :            :   case L_DPW:
     755         [ #  # ]:          0 :     if (signp) {
     756                 :          0 :       print1("You notice a sign:"); 
     757                 :          0 :       print2("Rampart Department of Public Works.");
     758                 :            :     }
     759                 :          0 :     break;
     760                 :            :   case L_LIBRARY:
     761         [ #  # ]:          0 :     if (signp) {
     762                 :          0 :       print1("You notice a sign:"); 
     763                 :          0 :       print2("Rampart Public Library.");
     764                 :            :     }
     765                 :          0 :     break;
     766                 :            :   case L_CONDO:
     767         [ #  # ]:          0 :     if (signp) {
     768                 :          0 :       print1("You notice a sign:"); 
     769         [ #  # ]:          0 :       if (gamestatusp(SOLD_CONDO)) 
     770                 :          0 :         print2("Home Sweet Home");
     771                 :          0 :       else print2("Luxury Condominium For Sale; Inquire Within");
     772                 :            :     }
     773                 :          0 :     break;
     774                 :            :   case L_PAWN_SHOP:
     775         [ -  + ]:          1 :     if (signp) {
     776                 :          0 :       print1("You notice a sign:"); 
     777                 :          0 :       print2("Knight's Pawn Shop.");
     778                 :            :     }
     779                 :          1 :     break;
     780                 :            :   case L_CEMETARY:
     781                 :          0 :     print1("You notice a sign:"); 
     782                 :          0 :     print2("Rampart City Cemetary. Closed -- Full.");
     783                 :          0 :     break;
     784                 :            :   case L_GARDEN:
     785                 :          0 :     print1("You notice a sign:"); 
     786                 :          0 :     print2("Rampart Botanical Gardens---Do not deface statues.");
     787                 :          0 :     break;
     788                 :            :   case L_JAIL:
     789                 :          0 :     print1("You notice a sign:"); 
     790                 :          0 :     print2("Rampart City Gaol -- always room for more.");
     791                 :          0 :     break;
     792                 :            : #ifdef INCLUDE_MONKS
     793                 :            :   case L_MONASTERY:
     794                 :          0 :     print1("You notice a sign:"); 
     795                 :          0 :     print2("Tholian Monastery. Truthseekers Welcome.");
     796                 :          0 :     break;
     797                 :            : #endif
     798                 :            :   case L_ORACLE:
     799                 :          0 :     print1("You notice a sign:");
     800                 :          0 :     print2("The Oracle of the Cyan Flames");
     801                 :          0 :     morewait();
     802                 :          0 :     break;
     803                 :            :   case L_TOURIST:
     804         [ -  + ]:          1 :     if (signp) {
     805                 :          0 :       print1("You notice a sign:"); 
     806                 :          0 :       print2("Rampart Department of Tourism.");
     807                 :            :     }
     808                 :          1 :     break;
     809                 :            :   }
     810                 :        336 : }
     811                 :            : #endif
     812                 :            :   
     813                 :            : 
     814                 :            : 
     815                 :          1 : void l_countryside(void)
     816                 :            : {
     817         [ +  - ]:          1 :   if (optionp(CONFIRM)) {
     818         [ -  + ]:          1 :     if (cinema_confirm("You're about to return to the countryside.") != 'y')
     819                 :          0 :       return;
     820                 :            :   }
     821                 :          1 :   change_environment(E_COUNTRYSIDE);
     822                 :            : }
     823                 :            : 
     824                 :            : 
     825                 :            : 
     826                 :          0 : void l_oracle(void)
     827                 :            : {
     828                 :            :   char response;
     829 [ #  # ][ #  # ]:          0 :   if (gamestatusp(ATTACKED_ORACLE) && (! gamestatusp(COMPLETED_ASTRAL))) {
     830                 :          0 :     print1("You come before a blue crystal dais. You see a broken mirror.");
     831                 :          0 :     print2("Look in the mirror? [yn] ");
     832         [ #  # ]:          0 :     if (ynq2()=='y') {
     833                 :          0 :       print1("A strange force rips you from your place....");
     834                 :          0 :       Player.hp = 1;
     835                 :          0 :       print2("You feel drained....");
     836                 :          0 :       dataprint();
     837                 :          0 :       print3("You find yourself in a weird flickery maze.");
     838                 :          0 :       change_environment(E_ASTRAL);
     839                 :            :     }
     840                 :            :   }
     841                 :            :   else {
     842                 :          0 :     print1("You come before a blue crystal dais. There is a bell and a mirror.");
     843                 :          0 :     print2("Ring the bell [b], look in the mirror [m], or leave [ESCAPE] ");
     844                 :          0 :     do response = (char) mcigetc();
     845 [ #  # ][ #  # ]:          0 :     while ((response != 'b') && (response != 'm') && (response != ESCAPE));
                 [ #  # ]
     846         [ #  # ]:          0 :     if (response == 'b') {
     847                 :          0 :       print1("The ringing note seems to last forever.");
     848                 :          0 :       print2("You notice a robed figure in front of you....");
     849                 :          0 :       morewait();
     850                 :          0 :       print1("The oracle doffs her cowl. Her eyes glitter with blue fire!");
     851                 :          0 :       print2("Attack her? [yn] ");
     852         [ #  # ]:          0 :       if (ynq2() == 'y') {
     853                 :          0 :         setgamestatus(ATTACKED_ORACLE);
     854                 :          0 :         print1("The oracle deftly avoids your attack.");
     855                 :          0 :         print2("She sneers at you and vanishes.");
     856                 :            :       }
     857                 :            :       else {
     858                 :          0 :         print2("She stares at you...and speaks:");
     859         [ #  # ]:          0 :         if (!gamestatusp(SPOKE_TO_DRUID)) {
     860                 :          0 :           print3("'The ArchDruid speaks wisdom in his forest shrine.'");
     861                 :            :         }
     862         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_CAVES)) {
     863                 :          0 :           print3("'Thou mayest find aught of interest in the caves to the South.'");
     864                 :            :         }
     865         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_SEWERS)) {
     866                 :          0 :           print3("'Turn thy attention to the abyssal depths of the city.'");
     867                 :            :         }
     868         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_CASTLE)) {
     869                 :          0 :           print3("'Explorest thou the depths of the Castle of the ArchMage.'");
     870                 :            :         }
     871         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_ASTRAL)) {
     872                 :          0 :           morewait();
     873                 :          0 :           print1("'Journey to the Astral Plane and meet the Gods' servants.'");
     874                 :          0 :           print2("The oracle holds out her hand. Do you take it? [yn] ");
     875         [ #  # ]:          0 :           if (ynq2()=='y') {
     876                 :          0 :             print1("'Beware: Only the Star Gem can escape the Astral Plane.'");
     877                 :          0 :             print2("A magic portal opens behind the oracle. She leads you");
     878                 :          0 :             morewait();
     879                 :          0 :             print1("through a sequence of special effects that would have");
     880                 :          0 :             print2("IL&M technicians cursing in awe and deposits you in an");
     881                 :          0 :             morewait();
     882                 :          0 :             clearmsg();
     883                 :          0 :             print1("odd looking room whose walls seem strangely insubstantial.");
     884                 :          0 :             gain_experience(5000);
     885                 :          0 :             change_environment(E_ASTRAL);
     886                 :            :           }
     887                 :          0 :           else print3("You detect the hint of a sneer from the oracle.");
     888                 :            :         }
     889         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_VOLCANO)) {
     890                 :          0 :           print3("'The infernal maw may yield its secrets to thee now.'");
     891                 :            :         }
     892         [ #  # ]:          0 :         else if (!gamestatusp(COMPLETED_CHALLENGE)) {
     893                 :          0 :           print3("'The challenge of adepthood yet awaits thee.'");
     894                 :            :         }
     895                 :            :         else {
     896                 :          0 :           morewait();
     897                 :          0 :           print1("'My lord: Thou hast surpassed my tutelage forever.");
     898                 :          0 :           print2("Fare thee well.'");
     899                 :          0 :           print3("The oracle replaces her hood and seems to fade away....");
     900                 :            :         }
     901                 :            :       }
     902                 :            :     }
     903         [ #  # ]:          0 :     else if (response == 'm') {
     904                 :          0 :       print1("You seem to see yourself. Odd....");
     905                 :          0 :       knowledge(1);
     906                 :            :     }
     907                 :          0 :     else print2("You leave this immanent place.");
     908                 :            :   }
     909                 :          0 : }
     910                 :            : 
     911                 :          0 : void l_mansion(void)
     912                 :            : {
     913         [ #  # ]:          0 :   if (cinema_confirm("You're about to enter a palatial mansion.")=='y')
     914                 :          0 :     change_environment(E_MANSION);
     915                 :          0 : }
     916                 :            : 
     917                 :          0 : void l_house(void)
     918                 :            : {
     919         [ #  # ]:          0 :   if (cinema_confirm("You're about to walk into someone's house.")=='y')
     920                 :          0 :     change_environment(E_HOUSE);
     921                 :          0 : }
     922                 :            : 
     923                 :          0 : void l_hovel(void)
     924                 :            : {
     925         [ #  # ]:          0 :   if (cinema_confirm("You're about to duck into a hovel.")=='y')
     926                 :          0 :     change_environment(E_HOVEL);
     927                 :          0 : }
     928                 :            : 
     929                 :          0 : void l_safe(void)
     930                 :            : {
     931                 :            :   char response;
     932                 :            :   pob newitem;
     933                 :          0 :   int attempt = 0;
     934                 :          0 :   response = cinema_interact("pfqi",
     935                 :            :                   "You have discovered a safe!",
     936                 :            :                   "Pick the lock [p], Force the door [f], or ignore [ESCAPE]",
     937                 :            :                   NULL);
     938                 :            :   
     939         [ #  # ]:          0 :   if (response == 'p')
     940                 :          0 :     attempt = (2*Player.dex + Player.rank[THIEVES]*10 - random_range(100))/10;
     941         [ #  # ]:          0 :   else if (response == 'f')
     942                 :          0 :     attempt = (Player.dmg - random_range(100))/10;
     943         [ #  # ]:          0 :   if (attempt > 0) {
     944                 :          0 :     Player.alignment -= 4;
     945                 :          0 :     gain_experience(50);
     946                 :          0 :     print2("The door springs open!");
     947                 :          0 :     Level->site[Player.x][Player.y].locchar = FLOOR;
     948                 :          0 :     Level->site[Player.x][Player.y].p_locf = L_NO_OP;
     949                 :          0 :     lset(Player.x, Player.y, CHANGED);
     950         [ #  # ]:          0 :     if (random_range(2) == 1) {
     951                 :          0 :       print1("You find:");
     952                 :            :       do {
     953                 :          0 :         newitem = create_object(difficulty());
     954                 :          0 :         print2(itemid(newitem));
     955                 :          0 :         morewait();
     956                 :          0 :         gain_item(newitem);
     957         [ #  # ]:          0 :       } while (random_range(3) == 1);
     958                 :            :     }
     959                 :          0 :     else print2("The safe was empty (awwwww....)");
     960                 :            :   }
     961                 :            :   else {
     962                 :          0 :     print3("Your attempt at burglary failed!");
     963         [ #  # ]:          0 :     if (attempt == -1) {
     964                 :          0 :       print1("A siren goes off! You see flashing red lights everywhere!");
     965                 :          0 :       morewait();
     966         [ #  # ]:          0 :       if (Last_Environment == E_CITY) {
     967                 :          0 :         print2("The city guard shows up! They collar you in no time flat!");
     968                 :          0 :         change_environment(E_CITY);
     969                 :          0 :         morewait();
     970                 :          0 :         send_to_jail();
     971                 :            :       }
     972                 :            :     }
     973         [ #  # ]:          0 :     else if (attempt == -2) {
     974                 :          0 :       print1("There is a sudden flash!");
     975                 :          0 :       p_damage(random_range(25),FLAME,"a safe");
     976                 :          0 :       print2("The safe has self-destructed.");
     977                 :          0 :       Level->site[Player.x][Player.y].locchar = RUBBLE;
     978                 :          0 :       Level->site[Player.x][Player.y].p_locf = L_RUBBLE;
     979                 :          0 :       lset(Player.x, Player.y, CHANGED);
     980                 :            :     }
     981         [ #  # ]:          0 :     else if (attempt == -3) {
     982                 :          0 :       print1("The safe jolts you with electricity!");
     983                 :          0 :       lball(Player.x,Player.y,Player.x,Player.y,30);
     984                 :            :     }
     985         [ #  # ]:          0 :     else if (attempt < -3) {
     986                 :          0 :       print1("You are hit by an acid spray!");
     987         [ #  # ]:          0 :       if (Player.possessions[O_CLOAK] != NULL) {
     988                 :          0 :         print2("Your cloak is destroyed!");
     989                 :          0 :         conform_lost_object(Player.possessions[O_CLOAK]);
     990                 :          0 :         p_damage(10,ACID,"a safe");
     991                 :            :       }
     992         [ #  # ]:          0 :       else if (Player.possessions[O_ARMOR] != NULL) {
     993                 :          0 :         print2("Your armor corrodes!");
     994                 :          0 :         Player.possessions[O_ARMOR]->dmg-=3;
     995                 :          0 :         Player.possessions[O_ARMOR]->hit-=3;
     996                 :          0 :         Player.possessions[O_ARMOR]->aux-=3;
     997                 :          0 :         p_damage(10,ACID,"a safe");
     998                 :            :       }
     999                 :            :       else {
    1000                 :          0 :         print2("The acid hits your bare flesh!");
    1001                 :          0 :         p_damage(random_range(100),ACID,"a safe");
    1002                 :            :       }
    1003                 :            :     }
    1004                 :            :   }
    1005                 :          0 : }
    1006                 :            : 
    1007                 :            : 
    1008                 :          0 : void l_cartographer(void)
    1009                 :            : {
    1010                 :            :   int i,j,x,y;
    1011                 :          0 :   print1("Ye Olde Mappe Shoppe.");
    1012                 :          0 :   print2("Map of the local area: 500Au. Buy it? [yn] ");
    1013         [ #  # ]:          0 :   if (ynq2()=='y') {
    1014         [ #  # ]:          0 :     if (Player.cash < 500) 
    1015                 :          0 :       print3("Cursed be cheapskates! May you never find an aid station....");
    1016                 :            :     else {
    1017                 :          0 :       print3("You now have the local area mapped.");
    1018                 :          0 :       Player.cash -= 500;
    1019                 :          0 :       dataprint();
    1020   [ #  #  #  #  :          0 :       switch(Villagenum) {
                   #  # ]
    1021                 :          0 :       case 1: x = 56; y = 5; break;
    1022                 :          0 :       default: case 2: x = 35; y = 11; break;
    1023                 :          0 :       case 3: x = 10; y = 40; break;
    1024                 :          0 :       case 4: x = 7; y = 6; break;
    1025                 :          0 :       case 5: x = 40; y = 43; break;
    1026                 :          0 :       case 6: x = 20; y = 41; break;
    1027                 :            :       } 
    1028         [ #  # ]:          0 :       for(i=x-15;i<=x+15;i++)
    1029         [ #  # ]:          0 :         for(j=y-15;j<=y+15;j++)
    1030 [ #  # ][ #  # ]:          0 :           if ((i>=0)&&(i<64)&&(j>=0)&&(j<64)) {
         [ #  # ][ #  # ]
    1031         [ #  # ]:          0 :             if (Country[i][j].current_terrain_type !=
    1032                 :          0 :               Country[i][j].base_terrain_type) {
    1033                 :          0 :               c_set(i, j, CHANGED);
    1034                 :          0 :               Country[i][j].current_terrain_type =
    1035                 :          0 :                 Country[i][j].base_terrain_type;
    1036                 :            :             }
    1037                 :          0 :             c_set(i, j, SEEN);
    1038                 :            :           }
    1039                 :            :     }
    1040                 :            :   }
    1041                 :          0 :   else print3("Don't blame me if you get lost....");
    1042                 :          0 : }
    1043                 :            :             
    1044                 :          0 : void l_charity(void)
    1045                 :            : {
    1046                 :            :   long donation;
    1047                 :          0 :   print2("'Greetings, friend. Do you wish to make a donation?' [yn] ");
    1048         [ #  # ]:          0 :   if (ynq2()!='y') 
    1049                 :          0 :     print3("'Pinchpurse!'");
    1050                 :            :   else {
    1051                 :          0 :     clearmsg();
    1052                 :            :     //    print1("How much can you give? ");
    1053                 :          0 :     donation = parsenum("How much can you give?");
    1054         [ #  # ]:          0 :     if (donation < 1)
    1055                 :          0 :       print2("'Go stick your head in a pig.'");
    1056         [ #  # ]:          0 :     else if (donation > Player.cash)
    1057                 :          0 :       print2("'I'm afraid you're charity is bigger than your purse!'");
    1058         [ #  # ]:          0 :     else if (donation < max(100,Player.level*Player.level*100)) {
    1059                 :          0 :       print2("'Oh, can't you do better than that?'");
    1060                 :          0 :       print3("'Well, I guess we'll take it....'");
    1061         [ #  # ]:          0 :       if (Player.alignment < 10) Player.alignment++;
    1062                 :          0 :       Player.cash -= donation;
    1063                 :            :     }
    1064                 :            :     else {
    1065                 :          0 :       print2("'Oh thank you kindly, friend, and bless you!'");
    1066                 :          0 :       Player.cash -= donation;
    1067                 :          0 :       Player.alignment += 5;
    1068                 :            :     }
    1069                 :            :   }
    1070                 :          0 :   dataprint();
    1071                 :          0 : } 
    1072                 :            : 
    1073                 :          1 : void l_tourist(void)
    1074                 :            : {
    1075                 :          1 :    print1("Greetings and welcome to Rampart.");
    1076                 :          1 :    print2("Would you like the tourist guide to the city? [yn]");
    1077         [ +  - ]:          1 :    if( ynq2() == 'y' )
    1078                 :            :    {
    1079                 :          1 :      menuclear();
    1080                 :          1 :      menuprint("You now know how to find:\n\n");
    1081         [ -  + ]:          1 :      if (! CitySiteList[L_ARMORER-CITYSITEBASE][0])
    1082                 :          0 :        menuprint("Julie's Armor of Proof and Weapons of Quality\n");
    1083                 :          1 :      CitySiteList[L_ARMORER-CITYSITEBASE][0] = TRUE;
    1084                 :            : 
    1085         [ -  + ]:          1 :      if (! CitySiteList[L_CLUB-CITYSITEBASE][0])
    1086                 :          0 :        menuprint("Rampart Explorers' Club\n");
    1087                 :          1 :      CitySiteList[L_CLUB-CITYSITEBASE][0] = TRUE;
    1088                 :            : 
    1089         [ -  + ]:          1 :      if (! CitySiteList[L_GYM-CITYSITEBASE][0])
    1090                 :          0 :        menuprint("The Rampart Gymnasium\n");
    1091                 :          1 :      CitySiteList[L_GYM-CITYSITEBASE][0] = TRUE;
    1092                 :            : 
    1093         [ -  + ]:          1 :      if (! CitySiteList[L_HEALER-CITYSITEBASE][0])
    1094                 :          0 :        menuprint("Rampart Healers\n");
    1095                 :          1 :      CitySiteList[L_HEALER-CITYSITEBASE][0] = TRUE;
    1096                 :            : 
    1097         [ -  + ]:          1 :      if (! CitySiteList[L_CASINO-CITYSITEBASE][0])
    1098                 :          0 :        menuprint("Rampart Mithril Nugget Casino\n");
    1099                 :          1 :      CitySiteList[L_CASINO-CITYSITEBASE][0] = TRUE;
    1100                 :            : 
    1101         [ -  + ]:          1 :      if (! CitySiteList[L_DINER-CITYSITEBASE][0])
    1102                 :          0 :        menuprint("The Rampart Diner\n");
    1103                 :          1 :      CitySiteList[L_DINER-CITYSITEBASE][0] = TRUE;
    1104                 :            : 
    1105         [ -  + ]:          1 :      if (! CitySiteList[L_CRAP-CITYSITEBASE][0])
    1106                 :          0 :        menuprint("Les Crapeuleaux, fine dining\n");
    1107                 :          1 :      CitySiteList[L_CRAP-CITYSITEBASE][0] = TRUE;
    1108                 :            : 
    1109         [ -  + ]:          1 :      if (! CitySiteList[L_COMMANDANT-CITYSITEBASE][0])
    1110                 :          0 :        menuprint("Commandant Sonder's Rampart-fried Lyzzard partes\n");
    1111                 :          1 :      CitySiteList[L_COMMANDANT-CITYSITEBASE][0] = TRUE;
    1112                 :            : 
    1113         [ -  + ]:          1 :      if (! CitySiteList[L_TAVERN-CITYSITEBASE][0])
    1114                 :          0 :        menuprint("The Centaur and Nymph tavern\n");
    1115                 :          1 :      CitySiteList[L_TAVERN-CITYSITEBASE][0] = TRUE;
    1116                 :            : 
    1117         [ -  + ]:          1 :      if (! CitySiteList[L_ALCHEMIST-CITYSITEBASE][0])
    1118                 :          0 :        menuprint("Ambrosias' Potions et cie\n");
    1119                 :          1 :      CitySiteList[L_ALCHEMIST-CITYSITEBASE][0] = TRUE;
    1120                 :            : 
    1121         [ -  + ]:          1 :      if (! CitySiteList[L_DPW-CITYSITEBASE][0])
    1122                 :          0 :        menuprint("Rampart Department of Public Works\n");
    1123                 :          1 :      CitySiteList[L_DPW-CITYSITEBASE][0] = TRUE;
    1124                 :            : 
    1125         [ -  + ]:          1 :      if (! CitySiteList[L_LIBRARY-CITYSITEBASE][0])
    1126                 :          0 :        menuprint("Rampart Public Library\n");
    1127                 :          1 :      CitySiteList[L_LIBRARY-CITYSITEBASE][0] = TRUE;
    1128                 :            : 
    1129         [ -  + ]:          1 :      if (! CitySiteList[L_PAWN_SHOP-CITYSITEBASE][0])
    1130                 :          0 :        menuprint("Knight's Pawn Shop\n");
    1131                 :          1 :      CitySiteList[L_PAWN_SHOP-CITYSITEBASE][0] = TRUE;
    1132                 :            : 
    1133         [ -  + ]:          1 :      if (! CitySiteList[L_CONDO-CITYSITEBASE][0])
    1134                 :          0 :        menuprint("Luxury Condominiums\n");
    1135                 :          1 :      CitySiteList[L_CONDO-CITYSITEBASE][0] = TRUE;
    1136                 :            : 
    1137                 :          1 :      showmenu();
    1138                 :          1 :      morewait();
    1139                 :          1 :      clearmsg();
    1140                 :          1 :      xredraw();
    1141                 :          1 :      print1("Have a nice day.");
    1142                 :            :    } else
    1143                 :            :    {
    1144                 :          0 :      clearmsg();
    1145                 :          0 :      print1("Have a nice day then.");
    1146                 :            :    }
    1147                 :          1 : }

Generated by: LCOV version 1.11