LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - guild2.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 873 0.0 %
Date: 2017-08-31 19:31:11 Functions: 0 5 0.0 %
Branches: 0 382 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* guild2.c */
       3                 :            : /* L_ functions  */ 
       4                 :            : 
       5                 :            : /* These functions implement the various guilds. */
       6                 :            : /* They are all l_ functions since they are basically activated*/
       7                 :            : /* at some site or other. */
       8                 :            : 
       9                 :            : #include "glob.h"
      10                 :            : 
      11                 :            : 
      12                 :          0 : void l_thieves_guild(void)
      13                 :            : {
      14                 :          0 :   int fee,count,i,number,done=FALSE,dues=1000;
      15                 :            :   char c,action;
      16                 :            :   pob lockpick;
      17                 :          0 :   print1("You have penetrated to the Lair of the Thieves' Guild.");
      18         [ #  # ]:          0 :   if (! nighttime()) 
      19                 :          0 :     print2("There aren't any thieves around in the daytime.");
      20                 :            :   else {
      21 [ #  # ][ #  # ]:          0 :     if ((Player.rank[THIEVES]==TMASTER) &&
      22         [ #  # ]:          0 :         (Player.level > Shadowlordlevel) &&
      23                 :          0 :         find_and_remove_item(OB_JUSTICIAR_BADGE,-1)) {
      24                 :          0 :       print2("You nicked the Justiciar's Badge!");
      25                 :          0 :       morewait();
      26                 :          0 :       print1("The Badge is put in a place of honor in the Guild Hall.");
      27                 :          0 :       print2("You are now the Shadowlord of the Thieves' Guild!");
      28                 :          0 :       morewait();
      29                 :          0 :       print1("Who says there's no honor among thieves?");
      30                 :          0 :       strcpy(Shadowlord,Player.name);
      31                 :          0 :       Shadowlordlevel = Player.level;
      32                 :          0 :       morewait();
      33                 :          0 :       Shadowlordbehavior = fixnpc(4);
      34                 :          0 :       save_hiscore_npc(7);
      35                 :          0 :       clearmsg();
      36                 :          0 :       print1("You learn the Spell of Shadowform.");
      37                 :          0 :       Spells[S_SHADOWFORM].known = TRUE;
      38                 :          0 :       morewait();
      39                 :          0 :       clearmsg();
      40                 :          0 :       Player.rank[THIEVES]=SHADOWLORD;
      41                 :          0 :       Player.maxagi += 2;
      42                 :          0 :       Player.maxdex += 2;
      43                 :          0 :       Player.agi += 2;
      44                 :          0 :       Player.dex += 2;
      45                 :            :     }
      46         [ #  # ]:          0 :     while (! done) {
      47                 :          0 :       menuclear();
      48         [ #  # ]:          0 :       if (Player.rank[THIEVES] == 0)
      49                 :          0 :         menuprint("a: Join the Thieves' Guild.\n");
      50                 :            :       else
      51                 :          0 :         menuprint("b: Raise your Guild rank.\n");
      52                 :          0 :       menuprint("c: Get an item identified.\n");
      53         [ #  # ]:          0 :       if (Player.rank[THIEVES] > 0)
      54                 :          0 :         menuprint("d: Fence an item.\n");
      55                 :          0 :       menuprint("ESCAPE: Leave this Den of Iniquity.");
      56                 :          0 :       showmenu();
      57                 :          0 :       action = mgetc();
      58         [ #  # ]:          0 :       if (action == ESCAPE) done = TRUE;
      59         [ #  # ]:          0 :       else if (action == 'a') {
      60                 :          0 :         done = TRUE;
      61         [ #  # ]:          0 :         if (Player.rank[THIEVES]> 0)
      62                 :          0 :           print2("You are already a member!");
      63         [ #  # ]:          0 :         else if (Player.alignment > 10) 
      64                 :          0 :           print2("You are too lawful to be a thief!");
      65                 :            :         else {
      66                 :          0 :           dues += dues*(12-Player.dex)/9;
      67                 :          0 :           dues += Player.alignment*5;
      68                 :          0 :           dues = max(100,dues);
      69                 :          0 :           clearmsg();
      70                 :          0 :           mprint("Dues are");
      71                 :          0 :           mnumprint(dues);
      72                 :          0 :           mprint(" Au. Pay it? [yn] ");
      73         [ #  # ]:          0 :           if (ynq1() =='y') {
      74         [ #  # ]:          0 :             if (Player.cash < dues) {
      75                 :          0 :               print1("You can't cheat the Thieves' Guild!");
      76                 :          0 :               print2("... but the Thieves' Guild can cheat you....");
      77                 :          0 :               Player.cash = 0;
      78                 :            :             }
      79                 :            :             else {
      80                 :          0 :               print1("Shadowlord ");
      81                 :          0 :               nprint1(Shadowlord);
      82                 :          0 :               print2("enters your name into the roll of the Guild."); 
      83                 :          0 :               morewait();
      84                 :          0 :               clearmsg();
      85                 :          0 :               print1("As a special bonus, you get a free lockpick.");
      86                 :          0 :               print2("You are taught the spell of Object Detection.");
      87                 :          0 :               morewait();
      88                 :          0 :               Spells[S_OBJ_DET].known = TRUE; 
      89                 :          0 :               lockpick = ((pob) checkmalloc(sizeof(objtype)));
      90                 :          0 :               *lockpick = Objects[OB_LOCK_PICK]; /* lock pick */
      91                 :          0 :               gain_item(lockpick);
      92                 :          0 :               Player.cash -= dues;
      93                 :          0 :               dataprint();
      94                 :          0 :               Player.guildxp[THIEVES]=1;
      95                 :          0 :               Player.rank[THIEVES]=TMEMBER;
      96                 :          0 :               Player.maxdex++;Player.dex++;Player.agi++;Player.maxagi++;
      97                 :            :             }
      98                 :            :           }
      99                 :            :         }
     100                 :            :       }
     101         [ #  # ]:          0 :       else if (action == 'b') {
     102         [ #  # ]:          0 :         if (Player.rank[THIEVES]==0)
     103                 :          0 :           print2("You are not even a member!");
     104         [ #  # ]:          0 :         else if (Player.rank[THIEVES]==SHADOWLORD) 
     105                 :          0 :           print2("You can't get any higher than this!");
     106         [ #  # ]:          0 :         else if (Player.rank[THIEVES]==TMASTER) {
     107         [ #  # ]:          0 :           if (Player.level <= Shadowlordlevel)
     108                 :          0 :             print2("You are not experienced enough to advance.");
     109                 :          0 :           else print2("You must bring back the Justiciar's Badge!");
     110                 :            :         }
     111         [ #  # ]:          0 :         else if (Player.rank[THIEVES]==THIEF) {
     112         [ #  # ]:          0 :           if (Player.guildxp[THIEVES] < 4000)
     113                 :          0 :             print2("You are not experienced enough to advance.");
     114                 :            :           else  {
     115                 :          0 :             print1("You are now a Master Thief of the Guild!");
     116                 :          0 :             print2("You are taught the Spell of Apportation.");
     117                 :          0 :             morewait();
     118                 :          0 :             print1("To advance to the next level you must return with");
     119                 :          0 :             print2("the badge of the Justiciar (cursed be his name).");
     120                 :          0 :             morewait();
     121                 :          0 :             clearmsg();
     122                 :          0 :             print1("The Justiciar's office is just south of the gaol.");
     123                 :          0 :             Spells[S_APPORT].known = TRUE;
     124                 :          0 :             Player.rank[THIEVES]=TMASTER;
     125                 :          0 :             Player.maxagi++;
     126                 :          0 :             Player.maxdex++;
     127                 :          0 :             Player.agi++;
     128                 :          0 :             Player.dex++;
     129                 :            :           }
     130                 :            :         }
     131         [ #  # ]:          0 :         else if (Player.rank[THIEVES]==ATHIEF) {        
     132         [ #  # ]:          0 :           if (Player.guildxp[THIEVES] < 1500)
     133                 :          0 :             print2("You are not experienced enough to advance.");
     134                 :            :           else  {
     135                 :          0 :             print1("You are now a ranking Thief of the Guild!");
     136                 :          0 :             print2("You learn the Spell of Invisibility.");
     137                 :          0 :             Spells[S_INVISIBLE].known = TRUE;
     138                 :          0 :             Player.rank[THIEVES]=THIEF;
     139                 :          0 :             Player.agi++;
     140                 :          0 :             Player.maxagi++;
     141                 :            :           }
     142                 :            :         }
     143         [ #  # ]:          0 :         else if (Player.rank[THIEVES]==TMEMBER) {
     144         [ #  # ]:          0 :           if (Player.guildxp[THIEVES] < 400)
     145                 :          0 :             print2("You are not experienced enough to advance.");
     146                 :            :           else {
     147                 :          0 :             print1("You are now an Apprentice Thief!");
     148                 :          0 :             print2("You are taught the Spell of Levitation.");
     149                 :          0 :             Spells[S_LEVITATE].known = TRUE;
     150                 :          0 :             Player.rank[THIEVES]=ATHIEF;
     151                 :          0 :             Player.dex++;
     152                 :          0 :             Player.maxdex++;
     153                 :            :           }
     154                 :            :         }
     155                 :            :       }
     156         [ #  # ]:          0 :       else if (action == 'c') {
     157         [ #  # ]:          0 :         if (Player.rank[THIEVES]==0) {
     158                 :          0 :           print1("RTG, Inc, Appraisers. Identification Fee: 50Au/item.");
     159                 :          0 :           fee = 50;
     160                 :            :         }
     161                 :            :         else {
     162                 :          0 :           fee = 5;
     163                 :          0 :           print1("The fee is 5Au per item.");
     164                 :            :         }
     165                 :          0 :         print2("Identify one item, or all possessions? [ip] ");
     166         [ #  # ]:          0 :         if ((char) mcigetc()=='i') {
     167         [ #  # ]:          0 :           if (Player.cash < fee)
     168                 :          0 :             print2("Try again when you have the cash.");
     169                 :            :           else {
     170                 :          0 :             Player.cash -= fee;
     171                 :          0 :             dataprint();
     172                 :          0 :             identify(0);
     173                 :            :           }
     174                 :            :         }
     175                 :            :         else {
     176                 :          0 :           count = 0;
     177         [ #  # ]:          0 :           for(i=1;i<MAXITEMS;i++)
     178         [ #  # ]:          0 :             if (Player.possessions[i] != NULL)
     179         [ #  # ]:          0 :               if (Player.possessions[i]->known < 2)
     180                 :          0 :                 count++;
     181         [ #  # ]:          0 :           for(i=0;i<Player.packptr;i++)
     182         [ #  # ]:          0 :             if (Player.pack[i] != NULL)
     183         [ #  # ]:          0 :               if (Player.pack[i]->known < 2)
     184                 :          0 :                 count++;
     185                 :          0 :           clearmsg();
     186                 :          0 :           print1("The fee will be: ");
     187                 :          0 :           mnumprint(max(count*fee,fee));
     188                 :          0 :           nprint1("Au. Pay it? [yn] ");
     189         [ #  # ]:          0 :           if (ynq1()=='y')
     190                 :            :           {
     191         [ #  # ]:          0 :             if (Player.cash < max(count*fee,fee))
     192                 :          0 :               print2("Try again when you have the cash.");
     193                 :            :             else {
     194                 :          0 :               Player.cash -= max(count*fee,fee);
     195                 :          0 :               dataprint();
     196                 :          0 :               identify(1);
     197                 :            :             }
     198                 :            :           }
     199                 :            :         }
     200                 :            :       }
     201         [ #  # ]:          0 :       else if (action == 'd') {
     202         [ #  # ]:          0 :         if (Player.rank[THIEVES]==0)
     203                 :          0 :           print2("Fence? Who said anything about a fence?");
     204                 :            :         else {
     205                 :          0 :           print1("Fence one item or go through pack? [ip] ");
     206         [ #  # ]:          0 :           if ((char) mcigetc()=='i') {
     207                 :          0 :             i = getitem(NULL_ITEM);
     208 [ #  # ][ #  # ]:          0 :             if ((i==ABORT) || (Player.possessions[i] == NULL))
     209                 :          0 :               print2("Huh, Is this some kind of set-up?");
     210         [ #  # ]:          0 :             else if (Player.possessions[i]->blessing < 0) 
     211                 :          0 :               print2("I don't want to buy a cursed item!");
     212                 :            :             else {
     213                 :          0 :               clearmsg();
     214                 :          0 :               print1("I'll give you ");
     215                 :          0 :               mlongprint(2 * item_value(Player.possessions[i]) / 3);
     216                 :          0 :               nprint1("Au each. OK? [yn] ");
     217         [ #  # ]:          0 :               if (ynq1() == 'y') {
     218                 :          0 :                 number = getnumber(Player.possessions[i]->number);
     219 [ #  # ][ #  # ]:          0 :                 if ((number >= Player.possessions[i]->number) &&
     220                 :          0 :                     Player.possessions[i]->used) {
     221                 :          0 :                   Player.possessions[i]->used = FALSE;
     222                 :          0 :                   item_use(Player.possessions[i]);
     223                 :            :                 }
     224                 :          0 :                 Player.cash += number*2*item_value(Player.possessions[i])/3;
     225                 :            :                 /* Fenced artifacts could turn up anywhere, really... */
     226         [ #  # ]:          0 :                 if (Objects[Player.possessions[i]->id].uniqueness >
     227                 :            :                     UNIQUE_UNMADE)
     228                 :          0 :                   Objects[Player.possessions[i]->id].uniqueness = UNIQUE_UNMADE;
     229                 :          0 :                 dispose_lost_objects(number,Player.possessions[i]);
     230                 :          0 :                 dataprint();
     231                 :            :               }
     232                 :          0 :               else print2("Hey, gimme a break, it was a fair price!");
     233                 :            :             }
     234                 :            :           }
     235                 :            :           else {
     236         [ #  # ]:          0 :             for(i=0;i<Player.packptr;i++) {
     237         [ #  # ]:          0 :               if (Player.pack[i]->blessing > -1) {
     238                 :          0 :                 clearmsg();
     239                 :          0 :                 print1("Sell ");
     240                 :          0 :                 nprint1(itemid(Player.pack[i]));
     241                 :          0 :                 nprint1(" for ");
     242                 :          0 :                 mlongprint(2*item_value(Player.pack[i])/3);
     243                 :          0 :                 nprint1("Au each? [ynq] ");
     244         [ #  # ]:          0 :                 if ((c=ynq1())=='y') {
     245                 :          0 :                   number = getnumber(Player.pack[i]->number);
     246                 :          0 :                   Player.cash += 2*number * item_value(Player.pack[i]) / 3;
     247                 :          0 :                   Player.pack[i]->number -= number;
     248         [ #  # ]:          0 :                   if (Player.pack[i]->number < 1) {
     249                 :            :                     /* Fenced an artifact?  You just might see it again. */
     250         [ #  # ]:          0 :                     if (Objects[Player.pack[i]->id].uniqueness > UNIQUE_UNMADE)
     251                 :          0 :                       Objects[Player.pack[i]->id].uniqueness = UNIQUE_UNMADE;
     252                 :          0 :                     free((char *)Player.pack[i]);
     253                 :          0 :                     Player.pack[i] = NULL;
     254                 :            :                   }
     255                 :          0 :                   dataprint();
     256                 :            :                 }
     257         [ #  # ]:          0 :                 else if (c=='q') break;
     258                 :            :               }
     259                 :            :             }
     260                 :          0 :             fixpack();
     261                 :            :           }
     262                 :            :         }
     263                 :            :       }
     264                 :            :     }
     265                 :            :   }
     266                 :          0 :   xredraw();
     267                 :          0 : }
     268                 :            : 
     269                 :          0 : void l_college(void)
     270                 :            : {
     271                 :            :   char action;
     272                 :          0 :   int done=FALSE,enrolled = FALSE;
     273                 :          0 :   print1("The Collegium Magii. Founded 16937, AOF.");
     274         [ #  # ]:          0 :   if (nighttime())
     275                 :          0 :     print2("The Registration desk is closed at night....");
     276                 :            :   else {
     277         [ #  # ]:          0 :     while (! done) {
     278 [ #  # ][ #  # ]:          0 :       if ((Player.rank[COLLEGE]==MAGE) &&
     279         [ #  # ]:          0 :           (Player.level > Archmagelevel) &&
     280                 :          0 :           find_and_remove_item(CORPSEID,EATER)) {
     281                 :          0 :         print1("You brought back the heart of the Eater of Magic!");
     282                 :          0 :         morewait();
     283                 :          0 :         print1("The Heart is sent to the labs for analysis.");
     284                 :          0 :         print2("The Board of Trustees appoints you Archmage!");
     285                 :          0 :         morewait();
     286                 :          0 :         clearmsg();
     287                 :          0 :         strcpy(Archmage,Player.name);
     288                 :          0 :         Archmagelevel = Player.level;
     289                 :          0 :         Player.rank[COLLEGE] = ARCHMAGE;
     290                 :          0 :         Player.maxiq += 5;
     291                 :          0 :         Player.iq += 5;
     292                 :          0 :         Player.maxpow += 5;
     293                 :          0 :         Player.pow += 5;
     294                 :          0 :         morewait();
     295                 :          0 :         Archmagebehavior = fixnpc(4);
     296                 :          0 :         save_hiscore_npc(9);
     297                 :            :       }
     298                 :          0 :       menuclear();
     299                 :          0 :       menuprint("May we help you?\n\n");
     300                 :          0 :       menuprint("a: Enroll in the College.\n");
     301                 :          0 :       menuprint("b: Raise your College rank.\n");
     302                 :          0 :       menuprint("c: Do spell research.\n");
     303                 :          0 :       menuprint("ESCAPE: Leave these hallowed halls.\n");
     304                 :          0 :       showmenu();
     305                 :          0 :       action = mgetc();
     306         [ #  # ]:          0 :       if (action == ESCAPE) done = TRUE;
     307         [ #  # ]:          0 :       else if (action == 'a') {
     308         [ #  # ]:          0 :         if (Player.rank[COLLEGE] > 0)
     309                 :          0 :           print2("You are already enrolled!");
     310         [ #  # ]:          0 :         else if (Player.iq < 13) 
     311                 :          0 :           print2("Your low IQ renders you incapable of being educated.");
     312         [ #  # ]:          0 :         else if (Player.rank[CIRCLE] > 0)
     313                 :          0 :           print2("Sorcery and our Magic are rather incompatible, no?");
     314                 :            : #ifdef INCLUDE_MONKS
     315         [ #  # ]:          0 :         else if (Player.rank[MONKS] > 0)
     316                 :          0 :           print2("Meditation will not leave you enough time for studies.");
     317                 :            : #endif
     318                 :            :         else {
     319         [ #  # ]:          0 :           if (Player.iq > 17) {
     320                 :          0 :             print2("You are given a scholarship!");
     321                 :          0 :             morewait();
     322                 :          0 :             enrolled=TRUE;
     323                 :            :           }
     324                 :            :           else {
     325                 :          0 :             print1("Tuition is 1000Au. ");
     326                 :          0 :             nprint1("Pay it? [yn] ");
     327         [ #  # ]:          0 :             if (ynq1() =='y') {
     328         [ #  # ]:          0 :               if (Player.cash < 1000)
     329                 :          0 :                 print2("You don't have the funds!");
     330                 :            :               else {
     331                 :          0 :                 Player.cash -= 1000;
     332                 :          0 :                 enrolled = TRUE;
     333                 :          0 :                 dataprint();
     334                 :            :               }         
     335                 :            :             }
     336                 :            :           }
     337         [ #  # ]:          0 :           if (enrolled) {
     338                 :          0 :             print1("Archmage ");
     339                 :          0 :             nprint1(Archmage);
     340                 :          0 :             nprint1(" greets you and congratulates you on your acceptance.");
     341                 :          0 :             print2("You are now enrolled in the Collegium Magii!");
     342                 :          0 :             morewait();
     343                 :          0 :             print1("You are now a Novice.");
     344                 :          0 :             print2("You may research 1 spell, for your intro class.");
     345                 :          0 :             Spellsleft = 1;
     346                 :          0 :             Player.rank[COLLEGE] = INITIATE;
     347                 :          0 :             Player.guildxp[COLLEGE] = 1;
     348                 :          0 :             Player.maxiq += 1;
     349                 :          0 :             Player.iq += 1;
     350                 :          0 :             Player.maxpow += 1;
     351                 :          0 :             Player.pow += 1;
     352                 :            :           }
     353                 :            :         }
     354                 :            :       }
     355         [ #  # ]:          0 :       else if (action == 'b') {
     356         [ #  # ]:          0 :         if (Player.rank[COLLEGE] == 0)
     357                 :          0 :           print2("You have not even been initiated, yet!");
     358         [ #  # ]:          0 :         else if (Player.rank[COLLEGE]==ARCHMAGE) 
     359                 :          0 :           print2("You are at the pinnacle of mastery in the Collegium.");
     360         [ #  # ]:          0 :         else if (Player.rank[COLLEGE]==MAGE) {
     361         [ #  # ]:          0 :           if (Player.level <= Archmagelevel)
     362                 :          0 :             print2("You are not experienced enough to advance.");
     363                 :            :           else
     364                 :          0 :             print2("You must return with the heart of the Eater of Magic!");
     365                 :            :         }
     366         [ #  # ]:          0 :         else if (Player.rank[COLLEGE]==PRECEPTOR) {
     367         [ #  # ]:          0 :           if (Player.guildxp[COLLEGE] < 4000)
     368                 :          0 :             print2("You are not experienced enough to advance.");
     369                 :            :           else  {
     370                 :          0 :             print1("You are now a Mage of the Collegium Magii!");
     371                 :          0 :             print2("You may research 6 spells for postdoctoral research.");
     372                 :          0 :             Spellsleft += 6;
     373                 :          0 :             morewait();
     374                 :          0 :             print1("To become Archmage, you must return with the");
     375                 :          0 :             print2("heart of the Eater of Magic");
     376                 :          0 :             morewait();
     377                 :          0 :             clearmsg();
     378                 :          0 :             print1("The Eater may be found on a desert isle somewhere.");
     379                 :          0 :             Player.rank[COLLEGE] = MAGE;
     380                 :          0 :             Player.maxiq += 2;
     381                 :          0 :             Player.iq += 2;
     382                 :          0 :             Player.maxpow += 2;
     383                 :          0 :             Player.pow += 2;
     384                 :            :           }
     385                 :            :         }
     386         [ #  # ]:          0 :         else if (Player.rank[COLLEGE]==STUDENT) {
     387         [ #  # ]:          0 :           if (Player.guildxp[COLLEGE] < 1500)
     388                 :          0 :             print2("You are not experienced enough to advance.");
     389                 :            :           else  {
     390                 :          0 :             print1("You are now a Preceptor of the Collegium Magii!");
     391                 :          0 :             print2("You are taught the basics of ritual magic.");
     392                 :          0 :             morewait();
     393                 :          0 :             clearmsg();
     394                 :          0 :             print1("Your position allows you to research 4 spells.");
     395                 :          0 :             Spellsleft +=4;
     396                 :          0 :             Spells[S_RITUAL].known = TRUE;
     397                 :          0 :             Player.rank[COLLEGE] = PRECEPTOR;
     398                 :          0 :             Player.maxiq += 1;
     399                 :          0 :             Player.iq += 1;
     400                 :          0 :             Player.maxpow += 1;
     401                 :          0 :             Player.pow += 1;
     402                 :            :           }
     403                 :            :         }
     404         [ #  # ]:          0 :         else if (Player.rank[COLLEGE]==NOVICE) {
     405         [ #  # ]:          0 :           if (Player.guildxp[COLLEGE] < 400)
     406                 :          0 :             print2("You are not experienced enough to advance.");
     407                 :            :           else  {
     408                 :          0 :             print1("You are now a Student at the Collegium Magii!");
     409                 :          0 :             print2("You are taught the spell of identification.");
     410                 :          0 :             morewait();
     411                 :          0 :             clearmsg();
     412                 :          0 :             print1("Thesis research credit is 2 spells.");
     413                 :          0 :             Spellsleft+=2;
     414                 :          0 :             Spells[S_IDENTIFY].known = TRUE;
     415                 :          0 :             Player.rank[COLLEGE] = STUDENT;
     416                 :          0 :             Player.maxiq += 1;
     417                 :          0 :             Player.iq += 1;
     418                 :          0 :             Player.maxpow += 1;
     419                 :          0 :             Player.pow += 1;
     420                 :            :           }
     421                 :            :         }
     422                 :            :       }
     423         [ #  # ]:          0 :       else if (action == 'c') {
     424                 :          0 :         clearmsg();
     425         [ #  # ]:          0 :         if (Spellsleft > 0) {
     426                 :          0 :           print1("Research permitted: ");
     427                 :          0 :           mnumprint(Spellsleft);
     428                 :          0 :           nprint1(" Spells.");
     429                 :          0 :           morewait();
     430                 :            :         }
     431         [ #  # ]:          0 :         if (Spellsleft < 1) {
     432                 :          0 :           print1("Extracurricular Lab fee: 2000 Au. ");
     433                 :          0 :           nprint1("Pay it? [yn] ");
     434         [ #  # ]:          0 :           if (ynq1()=='y') {
     435         [ #  # ]:          0 :             if (Player.cash < 2000) 
     436                 :          0 :               print1("Try again when you have the cash.");
     437                 :            :             else {
     438                 :          0 :               Player.cash -= 2000;
     439                 :          0 :               dataprint();
     440                 :          0 :               Spellsleft = 1;
     441                 :            :             }
     442                 :            :           }
     443                 :            :         }
     444         [ #  # ]:          0 :         if (Spellsleft > 0) {
     445                 :          0 :           learnspell(0);
     446                 :          0 :           Spellsleft--;
     447                 :            :         }
     448                 :            :       }
     449                 :            :     }
     450                 :            :   }
     451                 :          0 :   xredraw();
     452                 :          0 : }
     453                 :            : 
     454                 :            : #ifdef INCLUDE_MONKS
     455                 :          0 : void l_monastery(void)
     456                 :            : {
     457                 :            :   char action;
     458                 :          0 :   int done=FALSE,enrolled = FALSE;
     459                 :          0 :   print1("Tholian Monastery of Rampart. Founded 12031, AOF.");
     460                 :          0 :   print2("Welcome to our humble hovel.");
     461         [ #  # ]:          0 :   if (nighttime())
     462                 :          0 :     print2("The monastery doors are sealed until dawn.");
     463                 :            :   else {
     464         [ #  # ]:          0 :     while (! done) {
     465                 :          0 :       menuclear();
     466                 :          0 :       menuprint("Find your True Course:\n\n");
     467                 :          0 :       menuprint("a: Discover the Way.\n");
     468                 :          0 :       menuprint("b: Meditate on the Path.\n");
     469                 :          0 :       menuprint("c: Meditate on Knowledge.\n");
     470                 :          0 :       menuprint("d: Take an extended Meditation.\n");
     471                 :          0 :       menuprint("ESCAPE: Re-enter the World.\n");
     472                 :          0 :       showmenu();
     473                 :          0 :       action = mgetc();
     474         [ #  # ]:          0 :       if (action == ESCAPE) {
     475                 :          0 :         done = TRUE;
     476                 :          0 :         calc_melee();
     477                 :            :       }
     478         [ #  # ]:          0 :       else if (action == 'a') {
     479         [ #  # ]:          0 :         if (Player.rank[MONKS] > 0)
     480                 :          0 :           print2("You are already initiated, Brother.");
     481         [ #  # ]:          0 :         else if (Player.con < 13) 
     482                 :          0 :           print2("Your body is too fragile to walk the Path, child.");
     483         [ #  # ]:          0 :         else if (Player.pow < 13) 
     484                 :          0 :           print2("Your mind is too fragile to follow the Path, child.");
     485         [ #  # ]:          0 :         else if (Player.rank[COLLEGE] > 0)
     486                 :          0 :           print2("The Collegium has corruputed your spirit, child.");
     487         [ #  # ]:          0 :         else if (Player.rank[CIRCLE] > 0)
     488                 :          0 :           print2("The Circle has corruputed your spirit, child.");
     489                 :            :         else {
     490         [ #  # ]:          0 :           if (Player.pow > 17) {
     491                 :          0 :             print2("Your spirit is strong. You may study the Path with us.");
     492                 :          0 :             morewait();
     493                 :          0 :             enrolled=TRUE;
     494                 :            :           }
     495                 :            :           else {
     496                 :          0 :             print1("A substantial cash sacrifice will cleanse your spirit.. ");
     497                 :          0 :             print2("Donate your worldly goods? [yn] ");
     498         [ #  # ]:          0 :             if (ynq1() =='y') {
     499         [ #  # ]:          0 :               if (Player.cash < 1000)
     500                 :            :                 {
     501                 :            :                   /* WDT HACK! I'd rather the monks have some other
     502                 :            :                    * criteria for joining. */
     503                 :          0 :                   print2("You have not much to give.");
     504                 :            :                 }
     505                 :            :               else {
     506                 :          0 :                 Player.cash = 0;
     507                 :          0 :                 enrolled = TRUE;
     508                 :          0 :                 dataprint();
     509                 :            :               }         
     510                 :            :             }
     511                 :            :           }
     512         [ #  # ]:          0 :           if (enrolled) {
     513                 :          0 :             print1("Grandmaster ");
     514                 :          0 :             nprint1(Grandmaster);
     515                 :          0 :             nprint1(" welcomes you to the Brotherhood.");
     516                 :          0 :             print2("You are now a Tholian Monk trainee!");
     517                 :          0 :             morewait();
     518                 :          0 :             print2("You may study the Way with us.");
     519                 :          0 :             Studiesleft = 1;
     520                 :          0 :             Player.rank[MONKS] = MONK_TRAINEE;
     521                 :          0 :             Player.guildxp[MONKS] = 1;
     522                 :          0 :             Player.maxpow += 1;
     523                 :          0 :             Player.pow += 1;
     524                 :            :           }
     525                 :            :         }
     526                 :            :       }
     527         [ #  # ]:          0 :       else if (action == 'b') {
     528         [ #  # ]:          0 :         if (Player.rank[MONKS] == 0)
     529                 :          0 :           print2("You are not yet initiated, child.");
     530         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_GRANDMASTER) 
     531                 :          0 :           print2("Your advancement lies within, Grandmaster.");
     532         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_MASTER_TEARS) {
     533         [ #  # ]:          0 :           if (Player.level <= Grandmasterlevel)
     534                 :          0 :             print2("Seek more experience, Master.");
     535 [ #  # ][ #  # ]:          0 :           else if ((Player.rank[MONKS]==MONK_MASTER_TEARS) &&
     536         [ #  # ]:          0 :                    (Player.level > Grandmasterlevel) &&
     537                 :          0 :                    find_and_remove_item(CORPSEID,EATER))
     538                 :            :             {
     539                 :          0 :               print1("You brought back the heart of the Eater of Magic!");
     540                 :          0 :               morewait();
     541                 :          0 :               print1("The Heart is sent to the placed in the kitchen cauldron.");
     542                 :          0 :               print2("The Grandmaster steps down. You are the new Grandmaster.");
     543                 :          0 :               morewait();
     544                 :          0 :               clearmsg();
     545                 :          0 :               strcpy(Grandmaster,Player.name);
     546                 :          0 :               Grandmasterlevel = Player.level;
     547                 :          0 :               Player.rank[MONKS] = MONK_GRANDMASTER;
     548                 :          0 :               Player.maxhp += (Player.maxpow * 3);
     549                 :          0 :               Player.maxiq += 5;
     550                 :          0 :               Player.iq+= 5;
     551                 :          0 :               Player.maxpow += 3;
     552                 :          0 :               Player.pow += 3;
     553                 :          0 :               Player.maxstr += 3;
     554                 :          0 :               Player.str += 3;
     555                 :          0 :               morewait();
     556                 :          0 :               Grandmasterbehavior = fixnpc(4);
     557                 :          0 :               save_hiscore_npc(16);
     558                 :            :             }
     559                 :            :           else
     560                 :          0 :             print2("You must return with the heart of the Eater of Magic!");
     561                 :            : 
     562                 :            :         }
     563         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_MASTER_PAINS) {
     564         [ #  # ]:          0 :           if (Player.guildxp[MONKS] < 40000)
     565                 :          0 :             print2("Seek more experience, Master.");
     566                 :            :           else  {
     567                 :          0 :             print1("You have travelled far, Master.");
     568                 :          0 :             print2("You are now Master of Tears.");
     569                 :          0 :             Studiesleft += 6;
     570                 :          0 :             morewait();
     571                 :          0 :             print1("To become Grandmaster, you must return with the");
     572                 :          0 :             print2("heart of the Eater of Magic");
     573                 :          0 :             morewait();
     574                 :          0 :             clearmsg();
     575                 :          0 :             print1("The Eater may be found on a desert isle somewhere.");
     576                 :          0 :             Spells[S_REGENERATE].known = TRUE;
     577                 :          0 :             Player.rank[MONKS] = MONK_MASTER_TEARS;
     578                 :          0 :             Player.maxhp += (Player.maxpow * 2);
     579                 :          0 :             Player.maxpow += 2;
     580                 :          0 :             Player.pow += 2;
     581                 :          0 :             Player.maxstr += 2;
     582                 :          0 :             Player.str += 2;
     583                 :          0 :             Player.maxagi += 2;
     584                 :          0 :             Player.agi += 2;
     585                 :            :           }
     586                 :            :         }
     587         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_MASTER_SIGHS) {
     588         [ #  # ]:          0 :           if (Player.guildxp[MONKS] < 15000)
     589                 :          0 :             print2("Seek more experience, Master.");
     590                 :            :           else  {
     591                 :          0 :             print1("The Path is long, Master.");
     592                 :          0 :             print2("You are now Master of Pain.");
     593                 :          0 :             morewait();
     594                 :          0 :             print1("You feel enlightened.");
     595                 :          0 :             morewait();
     596                 :          0 :             clearmsg();
     597                 :          0 :             Studiesleft +=4;
     598                 :          0 :             Spells[S_RITUAL].known = TRUE;
     599                 :          0 :             Spells[S_RESTORE].known = TRUE;
     600                 :          0 :             Player.status[ILLUMINATION] = 1500;  /* enlightened */
     601                 :          0 :             Player.rank[MONKS] = MONK_MASTER_PAINS;
     602                 :          0 :             Player.maxhp += Player.maxpow;
     603                 :          0 :             Player.maxcon += 1;
     604                 :          0 :             Player.con += 1;
     605                 :          0 :             Player.maxdex += 2;
     606                 :          0 :             Player.dex += 2;
     607                 :            :           }
     608                 :            :         }
     609         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_MASTER) {
     610         [ #  # ]:          0 :           if (Player.guildxp[MONKS] < 9000)
     611                 :          0 :             print2("Seek more experience, Master.");
     612                 :            :           else  {
     613                 :          0 :             print1("Drink, weary Master.");
     614                 :          0 :             print2("You are now Master of Sighs.");
     615                 :          0 :             morewait();
     616                 :          0 :             clearmsg();
     617                 :          0 :             Studiesleft +=2;
     618                 :          0 :             Spells[S_HASTE].known = TRUE;
     619                 :          0 :             Player.rank[MONKS] = MONK_MASTER_SIGHS;
     620                 :          0 :             Player.maxhp += Player.maxpow;
     621                 :          0 :             Player.maxcon += 1;
     622                 :          0 :             Player.con += 1;
     623                 :          0 :             Player.maxiq += 2;
     624                 :          0 :             Player.iq += 2;
     625                 :            :           }
     626                 :            :         }
     627         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_MONK) {
     628         [ #  # ]:          0 :           if (Player.guildxp[MONKS] < 3000)
     629                 :          0 :             print2("Seek more experience, Brother.");
     630                 :            :           else  {
     631                 :          0 :             print1("A thousand steps on the path, Brother.");
     632                 :          0 :             print2("You are now a Master.");
     633                 :          0 :             morewait();
     634                 :          0 :             clearmsg();
     635                 :          0 :             Studiesleft +=2;
     636                 :          0 :             Spells[S_HEAL].known = TRUE;
     637                 :          0 :             Player.rank[MONKS] = MONK_MASTER;
     638                 :          0 :             Player.maxhp += Player.maxpow;
     639                 :          0 :             Player.maxcon += 1;
     640                 :          0 :             Player.con += 1;
     641                 :          0 :             Player.maxpow += 2;
     642                 :          0 :             Player.pow += 5; /* [sic] */
     643                 :            :           }
     644                 :            :         }
     645         [ #  # ]:          0 :         else if (Player.rank[MONKS]==MONK_TRAINEE) {
     646         [ #  # ]:          0 :           if (Player.guildxp[MONKS] < 1500)
     647                 :          0 :             print2("Seek more experience, Brother.");
     648                 :            :           else  {
     649                 :          0 :             print1("You have sought wisdom, Brother.");
     650                 :          0 :             print2("You are now a Tholian Monk.");
     651                 :          0 :             morewait();
     652                 :          0 :             clearmsg();
     653                 :          0 :             Studiesleft +=2;
     654                 :          0 :             Spells[S_CURE].known = TRUE;
     655                 :          0 :             Player.rank[MONKS] = MONK_MONK;
     656                 :          0 :             Player.maxhp += Player.maxpow;
     657                 :          0 :             Player.maxcon += 1;
     658                 :          0 :             Player.con += 1;
     659                 :          0 :             Player.maxpow += 1;
     660                 :          0 :             Player.pow += 1; 
     661                 :            :           }
     662                 :            :         }
     663                 :            :       }
     664         [ #  # ]:          0 :       else if (action == 'c') {
     665                 :          0 :         clearmsg();
     666         [ #  # ]:          0 :         if (Studiesleft > 0) {
     667                 :          0 :           print1("Studies permitted: ");
     668                 :          0 :           mnumprint(Studiesleft);
     669                 :          0 :           nprint1(" Studies.");
     670                 :          0 :           morewait();
     671                 :            :         }
     672         [ #  # ]:          0 :         if (Studiesleft < 1) {
     673                 :          0 :           print1("Sacrifice clears a cluttered heart. ");
     674                 :          0 :           nprint1("Donate your worldly cash? [yn] ");
     675         [ #  # ]:          0 :           if (ynq1()=='y') {
     676         [ #  # ]:          0 :             if (Player.cash < 2000)
     677                 :            :               {
     678         [ #  # ]:          0 :                 if ( Player.rank[MONKS] >= MONK_GRANDMASTER )
     679                 :          0 :                   print2("You have not much to give, Grandmaster.");
     680         [ #  # ]:          0 :                 else if ( Player.rank[MONKS] >= MONK_MASTER )
     681                 :          0 :                   print2("You have not much to give, Master.");
     682                 :            :                 else
     683                 :          0 :                   print2("You have not much to give, Brother.");
     684                 :            :               }
     685                 :            :             else {
     686                 :          0 :               Player.cash = 0;
     687                 :          0 :               dataprint();
     688                 :          0 :               Studiesleft = 1;
     689                 :            :             }
     690                 :            :           }
     691                 :            :         }
     692         [ #  # ]:          0 :         if (Studiesleft > 0) {
     693                 :          0 :           learnspell(0);
     694                 :          0 :           Studiesleft--;
     695                 :            :         }
     696                 :            :       }
     697         [ #  # ]:          0 :       else if (action == 'd') {
     698         [ #  # ]:          0 :         if (Player.rank[MONKS] < MONK_MASTER) {
     699                 :          0 :           clearmsg();
     700                 :          0 :           print1("Only Masters can achieve extended meditation, child.");
     701                 :          0 :           print2(" ");
     702                 :            :         }
     703                 :            :         else {
     704                 :          0 :           int i = 0;
     705                 :          0 :           clearmsg();
     706                 :          0 :           print1("Seeking inner truth...");
     707                 :          0 :           morewait();
     708                 :          0 :           clearmsg();
     709                 :          0 :           morewait();
     710                 :          0 :           toggle_item_use(TRUE);
     711                 :          0 :           Player.cash = 0;
     712                 :          0 :           Player.hp = Player.maxhp;
     713                 :          0 :           Player.str = Player.maxstr;
     714                 :          0 :           Player.agi = Player.maxagi;
     715                 :          0 :           Player.con = Player.maxcon;
     716                 :          0 :           Player.dex = Player.maxdex;
     717                 :          0 :           Player.iq = Player.maxiq;
     718                 :          0 :           Player.pow = Player.maxpow;
     719         [ #  # ]:          0 :           for (i=0;i<NUMSTATI;i++)
     720         [ #  # ]:          0 :             if (Player.status[i]<1000) Player.status[i]=0;
     721                 :          0 :           toggle_item_use(FALSE);
     722                 :          0 :           Player.food = 43;
     723                 :          0 :           print2("Your body and mind are whole.");
     724         [ #  # ]:          0 :           if (random_range(2) == 1) {
     725                 :          0 :             morewait();
     726                 :          0 :             print1("Extra whole!");
     727                 :          0 :             Player.maxhp += 1;
     728                 :            :           }
     729                 :            :         }
     730                 :          0 :         Time += 60*24*7;
     731                 :          0 :         Date += 7;
     732                 :          0 :         moon_check();
     733                 :          0 :         timeprint();
     734                 :            :       }
     735                 :            : 
     736                 :            :     }
     737                 :            :   }
     738                 :          0 :   xredraw();
     739                 :          0 : }
     740                 :            : #endif
     741                 :            : 
     742                 :            : 
     743                 :          0 : void l_sorcerors(void)
     744                 :            : {
     745                 :            :   char action;
     746                 :          0 :   int done=FALSE,fee;
     747                 :            :   long total;
     748                 :          0 :   print1("The Circle of Sorcerors.");
     749         [ #  # ]:          0 :   if (Player.rank[CIRCLE] == -1) {
     750                 :          0 :     print2("Fool! Didn't we tell you to go away?");
     751                 :          0 :     Player.mana = 0;
     752                 :          0 :     dataprint();
     753                 :            :   }
     754         [ #  # ]:          0 :   else  while (! done) {
     755 [ #  # ][ #  # ]:          0 :     if ((Player.rank[CIRCLE]==HIGHSORCEROR) &&
     756         [ #  # ]:          0 :         (Player.level > Primelevel) &&
     757                 :          0 :         find_and_remove_item(CORPSEID,LAWBRINGER)) {
     758                 :          0 :       print2("You obtained the Crown of the Lawgiver!");
     759                 :          0 :       morewait();
     760                 :          0 :       print1("The Crown is ritually sacrificed to the Lords of Chaos.");
     761                 :          0 :       print2("You are now the Prime Sorceror of the Inner Circle!");
     762                 :          0 :       strcpy(Prime,Player.name);
     763                 :          0 :       Primelevel = Player.level;
     764                 :          0 :       morewait();
     765                 :          0 :       Primebehavior = fixnpc(4);
     766                 :          0 :       save_hiscore_npc(10);
     767                 :          0 :       clearmsg();
     768                 :          0 :       print1("You learn the Spell of Disintegration!");
     769                 :          0 :       morewait();
     770                 :          0 :       clearmsg();
     771                 :          0 :       Spells[S_DISINTEGRATE].known = TRUE;
     772                 :          0 :       Player.rank[CIRCLE] = PRIME;
     773                 :          0 :       Player.maxpow += 10;
     774                 :          0 :       Player.pow += 10;
     775                 :            :     }
     776                 :          0 :     menuclear();
     777                 :          0 :     menuprint("May we help you?\n\n");
     778                 :          0 :     menuprint("a: Become an Initiate of the Circle.\n");
     779                 :          0 :     menuprint("b: Raise your rank in the Circle.\n");
     780                 :          0 :     menuprint("c: Restore mana points\n");
     781                 :          0 :     menuprint("ESCAPE: Leave these Chambers of Power.\n");
     782                 :          0 :     showmenu();
     783                 :          0 :     action = mgetc();
     784         [ #  # ]:          0 :     if (action == ESCAPE) done = TRUE;
     785         [ #  # ]:          0 :     else if (action == 'a') {
     786         [ #  # ]:          0 :       if (Player.rank[CIRCLE] > 0)
     787                 :          0 :           print2("You are already an initiate!");
     788         [ #  # ]:          0 :       else if (Player.alignment > 0)
     789                 :          0 :         print2("You may not join -- you reek of Law!");
     790         [ #  # ]:          0 :       else if (Player.rank[COLLEGE] > 0)
     791                 :          0 :         print2("Foolish Mage!  You don't have the right attitude to Power!");
     792                 :            : #ifdef INCLUDE_MONKS
     793         [ #  # ]:          0 :       else if (Player.rank[MONKS] > 0)
     794                 :          0 :         print2("Stupid monk. Go Meditate on this!");
     795                 :            : #endif
     796                 :            :       else {
     797                 :          0 :         fee = 3000;
     798                 :          0 :         fee += Player.alignment*100;
     799                 :          0 :         fee += fee*(12 - Player.pow)/9;
     800                 :          0 :         fee = max(100,fee);
     801                 :          0 :         clearmsg();
     802                 :          0 :         mprint("For you, there is an initiation fee of");
     803                 :          0 :         mnumprint(fee);
     804                 :          0 :         mprint(" Au.");
     805                 :          0 :         print2("Pay it? [yn] ");
     806         [ #  # ]:          0 :         if (ynq2() =='y') {
     807         [ #  # ]:          0 :           if (Player.cash < fee) 
     808                 :          0 :             print3("Try again when you have the cash!");
     809                 :            :           else {
     810                 :          0 :             print1("Prime Sorceror ");
     811                 :          0 :             nprint1(Prime);
     812                 :          0 :             print2("conducts your initiation into the circle of novices.");
     813                 :          0 :             morewait();
     814                 :          0 :             clearmsg();
     815                 :          0 :             print1("You learn the Spell of Magic Missiles.");
     816                 :          0 :             Spells[S_MISSILE].known = TRUE;
     817                 :          0 :             Player.cash -= fee;
     818                 :          0 :             dataprint();
     819                 :          0 :             Player.rank[CIRCLE] = INITIATE;
     820                 :          0 :             Player.guildxp[CIRCLE] = 1;
     821                 :          0 :             Player.maxpow++;
     822                 :          0 :             Player.pow++;
     823                 :            :           }
     824                 :            :         }
     825                 :            :       }
     826                 :            :     }
     827         [ #  # ]:          0 :     else if (action == 'b') {
     828         [ #  # ]:          0 :       if (Player.rank[CIRCLE] == 0)
     829                 :          0 :         print2("You have not even been initiated, yet!");
     830         [ #  # ]:          0 :       else if (Player.alignment > -1) {
     831                 :          0 :         print1("Ahh! You have grown too lawful!!!");
     832                 :          0 :         print2("You are hereby blackballed from the Circle!");
     833                 :          0 :         Player.rank[CIRCLE] = -1;
     834                 :          0 :         morewait();
     835                 :          0 :         clearmsg();
     836                 :          0 :         print1("A pox upon thee!");
     837         [ #  # ]:          0 :         if (! Player.immunity[INFECTION])
     838                 :          0 :           Player.status[DISEASED]+=100;
     839                 :          0 :         print2("And a curse on your possessions!");
     840                 :          0 :         morewait();
     841                 :          0 :         clearmsg();
     842                 :          0 :         acquire(-1);
     843                 :          0 :         clearmsg();
     844                 :          0 :         enchant(-1);
     845                 :          0 :         bless(-1);
     846                 :          0 :         print3("Die, false sorceror!");
     847                 :          0 :         p_damage(25,UNSTOPPABLE,"a sorceror's curse");
     848                 :          0 :         done = TRUE;
     849                 :            :       }
     850         [ #  # ]:          0 :       else if (Player.rank[CIRCLE]==PRIME) 
     851                 :          0 :         print2("You are at the pinnacle of mastery in the Circle.");
     852         [ #  # ]:          0 :       else if (Player.rank[CIRCLE]==HIGHSORCEROR) {
     853         [ #  # ]:          0 :         if (Player.level <= Primelevel)
     854                 :          0 :           print2("You are not experienced enough to advance.");
     855                 :            :         else 
     856                 :          0 :           print2("You must return with the Crown of the LawBringer!");
     857                 :            :       }
     858         [ #  # ]:          0 :       else if (Player.rank[CIRCLE]==SORCEROR) {
     859         [ #  # ]:          0 :         if (Player.guildxp[CIRCLE] < 4000)
     860                 :          0 :           print2("You are not experienced enough to advance.");
     861                 :            :         else  {
     862                 :          0 :           print1("You are now a High Sorceror of the Inner Circle!");
     863                 :          0 :           print2("You learn the Spell of Disruption!");
     864                 :          0 :           morewait();
     865                 :          0 :           clearmsg();
     866                 :          0 :           print1("To advance you must return with the LawBringer's Crown!");
     867                 :          0 :           print2("The LawBringer resides on Star Peak.");
     868                 :          0 :           Spells[S_DISRUPT].known = TRUE;
     869                 :          0 :           Player.rank[CIRCLE] = HIGHSORCEROR;
     870                 :          0 :           Player.maxpow += 5;
     871                 :          0 :           Player.pow += 5;
     872                 :            :         }
     873                 :            :       }
     874         [ #  # ]:          0 :       else if (Player.rank[CIRCLE]==ENCHANTER) {
     875         [ #  # ]:          0 :         if (Player.guildxp[CIRCLE] < 1500)
     876                 :          0 :           print2("You are not experienced enough to advance.");
     877                 :            :         else  {
     878                 :          0 :           print1("You are now a member of the Circle of Sorcerors!");
     879                 :          0 :           print2("You learn the Spell of Ball Lightning!");
     880                 :          0 :           Spells[S_LBALL].known = TRUE;
     881                 :          0 :           Player.rank[CIRCLE] = SORCEROR;
     882                 :          0 :           Player.maxpow += 2; 
     883                 :          0 :           Player.pow+=2;
     884                 :            :         }
     885                 :            :       }
     886         [ #  # ]:          0 :       else if (Player.rank[CIRCLE]==INITIATE) {
     887         [ #  # ]:          0 :         if (Player.guildxp[CIRCLE] < 400)
     888                 :          0 :           print2("You are not experienced enough to advance.");
     889                 :            :         else  {
     890                 :          0 :           print1("You are now a member of the Circle of Enchanters!");
     891                 :          0 :           print2("You learn the Spell of Firebolts.");
     892                 :          0 :           Spells[S_FIREBOLT].known = TRUE;
     893                 :          0 :           Player.rank[CIRCLE] = ENCHANTER;
     894                 :          0 :           Player.maxpow+=2;
     895                 :          0 :           Player.pow+=2;
     896                 :            :         }
     897                 :            :       }
     898                 :            :     }
     899         [ #  # ]:          0 :     else if (action == 'c') {
     900                 :          0 :       done = TRUE;
     901                 :          0 :       fee = Player.level*100;
     902         [ #  # ]:          0 :       if (Player.rank[CIRCLE]) fee = fee / 2;
     903                 :          0 :       clearmsg();
     904                 :          0 :       print1("That will be: ");
     905                 :          0 :       mnumprint(fee);
     906                 :          0 :       nprint1("Au. Pay it? [yn] ");
     907         [ #  # ]:          0 :       if (ynq1()=='y') {
     908         [ #  # ]:          0 :         if (Player.cash < fee) 
     909                 :          0 :           print2("Begone, deadbeat, or face the wrath of the Circle!");
     910                 :            :         else {
     911                 :          0 :           Player.cash -= fee;
     912                 :          0 :           total = calcmana();
     913         [ #  # ]:          0 :           while (Player.mana < total) {
     914                 :          0 :             Player.mana++;
     915                 :          0 :             dataprint();
     916                 :            :           }
     917                 :          0 :           print2("Have a sorcerous day, now!");
     918                 :            :         }
     919                 :            :       }
     920                 :          0 :       else print2("Be seeing you!");
     921                 :            :     }
     922                 :            :   }
     923                 :          0 :   xredraw();
     924                 :          0 : }
     925                 :            : 
     926                 :            : 
     927                 :            : 
     928                 :            : 
     929                 :          0 : void l_order(void)
     930                 :            : {
     931                 :            :   pob newitem;
     932                 :            :   pml ml;
     933                 :          0 :   print1("The Headquarters of the Order of Paladins.");
     934                 :          0 :   morewait();
     935 [ #  # ][ #  # ]:          0 :   if ((Player.rank[ORDER]==PALADIN) &&
     936         [ #  # ]:          0 :       (Player.level > Justiciarlevel) &&
     937         [ #  # ]:          0 :       gamestatusp(GAVE_STARGEM) &&
     938                 :          0 :       Player.alignment > 300) {
     939                 :          0 :     print1("You have succeeded in your quest!");
     940                 :          0 :     morewait();
     941                 :          0 :     print1("The previous Justiciar steps down in your favor.");
     942                 :          0 :     print2("You are now the Justiciar of Rampart and the Order!");
     943                 :          0 :     strcpy(Justiciar,Player.name);
     944 [ #  # ][ #  # ]:          0 :     for (ml = Level->mlist; ml && (ml->m->id != HISCORE_NPC ||
                 [ #  # ]
     945                 :          0 :         ml->m->aux2 != 15); ml = ml->next)
     946                 :            :       /* just scan for current Justicar */;
     947         [ #  # ]:          0 :     if (ml) {
     948                 :          0 :       m_remove(ml->m); /* signals "death" -- no credit to player, though */
     949                 :            :     }
     950                 :          0 :     Justiciarlevel = Player.level;
     951                 :          0 :     morewait();
     952                 :          0 :     Justiciarbehavior = fixnpc(4);
     953                 :          0 :     save_hiscore_npc(15);
     954                 :          0 :     clearmsg();
     955                 :          0 :     print1("You are awarded a blessed shield of deflection!");
     956                 :          0 :     morewait();
     957                 :          0 :     newitem = ((pob) checkmalloc(sizeof(objtype)));
     958                 :          0 :     *newitem = Objects[OB_DEFLECT]; /* shield of deflection */
     959                 :          0 :     newitem->blessing = 9;
     960                 :          0 :     gain_item(newitem);
     961                 :          0 :     morewait();
     962                 :          0 :     Player.rank[ORDER] = JUSTICIAR;
     963                 :          0 :     Player.maxstr += 5;
     964                 :          0 :     Player.str += 5;
     965                 :          0 :     Player.maxpow += 5;
     966                 :          0 :     Player.pow += 5;
     967                 :            :   }
     968         [ #  # ]:          0 :   if (Player.alignment < 1) {
     969         [ #  # ]:          0 :     if (Player.rank[ORDER] > 0) {
     970                 :          0 :       print1("You have been tainted by chaos!");
     971                 :          0 :       print2("You are stripped of your rank in the Order!");
     972                 :          0 :       morewait();
     973                 :          0 :       Player.rank[ORDER]= -1;
     974                 :          0 :       send_to_jail();
     975                 :            :     }
     976                 :            :     else
     977                 :          0 :       print1("Get thee hence, minion of chaos!");
     978                 :            :   }
     979         [ #  # ]:          0 :   else if (Player.rank[ORDER] == -1)
     980                 :          0 :     print1("Thou again?  Get thee hence, minion of chaos!");
     981         [ #  # ]:          0 :   else if (Player.rank[ORDER] == 0) {
     982         [ #  # ]:          0 :     if (Player.rank[ARENA] != 0) 
     983                 :          0 :       print1("We do not accept bloodstained gladiators into our Order.");
     984         [ #  # ]:          0 :     else if (Player.rank[LEGION] != 0) 
     985                 :          0 :       print1("Go back to your barracks, mercenary!");
     986                 :            :     else {
     987                 :          0 :       print1("Dost thou wish to join our Order? [yn] ");
     988         [ #  # ]:          0 :       if (ynq1()=='y') {
     989                 :          0 :         print1("Justiciar ");
     990                 :          0 :         nprint1(Justiciar);
     991                 :          0 :         nprint1(" welcomes you to the Order.");
     992                 :          0 :         print2("'Mayest thou always follow the sublime path of Law.'");
     993                 :          0 :         morewait();
     994                 :          0 :         print1("You are now a Gallant in the Order.");
     995                 :          0 :         print2("You are given a horse and a blessed spear.");
     996                 :          0 :         morewait();
     997                 :          0 :         Player.rank[ORDER] = GALLANT;
     998                 :          0 :         Player.guildxp[ORDER] = 1;
     999                 :          0 :         setgamestatus(MOUNTED);
    1000                 :          0 :         newitem = ((pob) checkmalloc(sizeof(objtype)));
    1001                 :          0 :         *newitem = Objects[OB_SPEAR]; /* spear */
    1002                 :          0 :         newitem->blessing = 9;
    1003                 :          0 :         newitem->plus = 1;
    1004                 :          0 :         newitem->known = 2;
    1005                 :          0 :         gain_item(newitem);
    1006                 :            :       }
    1007                 :            :     }
    1008                 :            :   } else {
    1009                 :          0 :       print1("'Welcome back, Paladin.'");
    1010         [ #  # ]:          0 :       if (!gamestatusp(MOUNTED)) {
    1011                 :          0 :         print2("You are given a new steed.");
    1012                 :          0 :         setgamestatus(MOUNTED);
    1013                 :            :       }
    1014                 :          0 :       morewait();
    1015                 :          0 :       clearmsg();
    1016 [ #  # ][ #  # ]:          0 :       if ((Player.hp < Player.maxhp) || (Player.status[DISEASED]) ||
                 [ #  # ]
    1017                 :          0 :         (Player.status[POISONED]))
    1018                 :          0 :         print1("Your wounds are treated by a medic.");
    1019                 :          0 :       cleanse(0);
    1020                 :          0 :       Player.hp = Player.maxhp;
    1021         [ #  # ]:          0 :       if ( Player.food <= 40 )
    1022                 :            :       {
    1023                 :          0 :         Player.food = 40;
    1024                 :          0 :         print2("You get a hot meal from the refectory.");
    1025                 :            :       }
    1026                 :          0 :       morewait();
    1027                 :          0 :       clearmsg();
    1028         [ #  # ]:          0 :       if (Player.rank[ORDER]==PALADIN) {
    1029         [ #  # ]:          0 :         if (Player.level <= Justiciarlevel)
    1030                 :          0 :           print2("You are not experienced enough to advance.");
    1031         [ #  # ]:          0 :         else if (Player.alignment < 300)
    1032                 :          0 :           print2("You are not sufficiently Lawful as yet to advance.");
    1033                 :          0 :         else print2("You must give the Star Gem to the LawBringer.");
    1034                 :            :       }
    1035         [ #  # ]:          0 :       else if (Player.rank[ORDER]==CHEVALIER) {
    1036         [ #  # ]:          0 :         if (Player.guildxp[ORDER] < 4000)
    1037                 :          0 :           print2("You are not experienced enough to advance.");
    1038         [ #  # ]:          0 :         else if (Player.alignment < 200)
    1039                 :          0 :           print2("You are not sufficiently Lawful as yet to advance.");
    1040                 :            :         else {
    1041                 :          0 :           print1("You are made a Paladin of the Order!");
    1042                 :          0 :           print2("You learn the Spell of Heroism and get Mithril Plate!");
    1043                 :          0 :           morewait();
    1044                 :          0 :           newitem = ((pob) checkmalloc(sizeof(objtype)));
    1045                 :          0 :           *newitem = Objects[OB_MITHRIL_PLATE]; /* mithril plate armor */
    1046                 :          0 :           newitem->blessing = 9;
    1047                 :          0 :           newitem->known = 2;
    1048                 :          0 :           gain_item(newitem);
    1049                 :          0 :           morewait();
    1050                 :          0 :           clearmsg();
    1051                 :          0 :           print1("To advance you must rescue the Star Gem and return it");
    1052                 :          0 :           print2("to its owner, the LawBringer, who resides on Star Peak.");
    1053                 :          0 :           morewait();
    1054                 :          0 :           print1("The Star Gem was stolen by the cursed Prime Sorceror,");
    1055                 :          0 :           print2("whose headquarters may be found beyond the Astral Plane.");
    1056                 :          0 :           morewait();
    1057                 :          0 :           print1("The Oracle will send you to the Astral Plane if you");
    1058                 :          0 :           print2("prove yourself worthy to her.");
    1059                 :          0 :           morewait();
    1060                 :          0 :           Spells[S_HERO].known = TRUE;
    1061                 :          0 :           Player.rank[ORDER] = PALADIN;
    1062                 :            :         }
    1063                 :            :       }
    1064         [ #  # ]:          0 :       else if (Player.rank[ORDER]==GUARDIAN) {
    1065         [ #  # ]:          0 :         if (Player.guildxp[ORDER] < 1500)
    1066                 :          0 :           print2("You are not experienced enough to advance.");
    1067         [ #  # ]:          0 :         else if (Player.alignment < 125)
    1068                 :          0 :           print2("You are not yet sufficiently Lawful to advance.");
    1069                 :            :         else {
    1070                 :          0 :           Player.rank[ORDER] = CHEVALIER;
    1071                 :          0 :           print1("You are made a Chevalier of the Order!");
    1072                 :          0 :           print2("You are given a Mace of Disruption!");
    1073                 :          0 :           morewait();
    1074                 :          0 :           clearmsg();
    1075                 :          0 :           newitem = ((pob) checkmalloc(sizeof(objtype)));
    1076                 :          0 :           *newitem = Objects[OB_MACE_DISRUPT]; /* mace of disruption */
    1077                 :          0 :           newitem->known = 2;
    1078                 :          0 :           gain_item(newitem);
    1079                 :            :         }
    1080                 :            :       }
    1081         [ #  # ]:          0 :       else if (Player.rank[ORDER]==GALLANT) {
    1082         [ #  # ]:          0 :         if (Player.guildxp[ORDER] < 400)
    1083                 :          0 :           print2("You are not experienced enough to advance.");
    1084         [ #  # ]:          0 :         else if (Player.alignment < 50)
    1085                 :          0 :           print2("You are not Lawful enough to advance.");
    1086                 :            :         else  {
    1087                 :          0 :           print1("You are made a Guardian of the Order of Paladins!");
    1088                 :          0 :           print2("You are given a Holy Hand Grenade (of Antioch).");
    1089                 :          0 :           morewait();
    1090                 :          0 :           print1("You hear a nasal monotone in the distance....");
    1091                 :          0 :           print2("'...and the number of thy counting shall be 3...'");
    1092                 :          0 :           morewait();
    1093                 :          0 :           clearmsg();
    1094                 :          0 :           Player.rank[ORDER] = GUARDIAN;
    1095                 :          0 :           newitem = ((pob) checkmalloc(sizeof(objtype)));
    1096                 :          0 :           *newitem = Objects[OB_ANTIOCH]; /* holy hand grenade. */
    1097                 :          0 :           newitem->known = 2;
    1098                 :          0 :           gain_item(newitem);
    1099                 :            :         }
    1100                 :            :       }
    1101                 :            :   }
    1102                 :          0 :   showflags();
    1103                 :          0 : }

Generated by: LCOV version 1.11