LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - guild1.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 14 417 3.4 %
Date: 2017-09-08 22:00:26 Functions: 1 3 33.3 %
Branches: 5 158 3.2 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* guild1.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                 :            : int merc_xps [COMMANDANT] =
      12                 :            : {
      13                 :            :   0, 400, 1500, 4000, -1
      14                 :            : };
      15                 :            : 
      16                 :          1 : void l_merc_guild(void)
      17                 :            : {
      18                 :          1 :   print1("Legion of Destiny, Mercenary Guild, Inc.");
      19                 :            : 
      20         [ -  + ]:          1 :   if (nighttime())
      21                 :            :     {
      22                 :          0 :       print2("The barracks are under curfew right now.");
      23                 :          0 :       return;
      24                 :            :     }
      25                 :            : 
      26                 :          1 :   print2("You enter Legion HQ, ");
      27         [ -  + ]:          1 :   if (Player.rank[LEGION] == COMMANDANT)
      28                 :            :     {
      29                 :          0 :       nprint2("Your aide follows you to the staff room.");
      30                 :          0 :       morewait();
      31                 :          0 :       clearmsg();
      32                 :            :     }
      33         [ +  - ]:          1 :   else if (Player.rank[LEGION] > 0)
      34                 :            :     {
      35                 :          1 :       nprint2("and report to your commander.");
      36                 :          1 :       morewait();
      37                 :            :     }
      38                 :            : 
      39   [ -  -  -  -  :          1 :   switch (Player.rank[LEGION])
                -  +  - ]
      40                 :            :     {
      41                 :            :     case 0:
      42                 :          0 :       nprint2("and see the Recruiting Centurion.");
      43                 :          0 :       morewait();
      44                 :          0 :       print2("Do you wish to join the Legion? [yn] ");
      45                 :            : 
      46         [ #  # ]:          0 :       if ('y' == ynq2())
      47                 :            :         {
      48                 :          0 :           clearmsg();
      49         [ #  # ]:          0 :           if (Player.rank[ARENA] > 0)
      50                 :            :             {
      51                 :          0 :               print1("The Centurion checks your record, and gets angry:");
      52                 :          0 :               print2("'The legion don't need any Arena Jocks. Git!'");
      53                 :            :             }
      54         [ #  # ]:          0 :           else if (Player.rank[ORDER] > 0)
      55                 :            :             {
      56                 :          0 :               print1("The Centurion checks your record, and is amused:");
      57                 :          0 :               print2("'A paladin in the ranks? You must be joking.'");
      58                 :            :             }
      59         [ #  # ]:          0 :           else if (Player.con < 12)
      60                 :            :             {
      61                 :          0 :               print1("The Centurion looks you over, sadly.");
      62                 :          0 :               print2("You are too fragile to join the legion.");
      63                 :            :             }
      64         [ #  # ]:          0 :           else if (Player.str < 10)
      65                 :            :             {
      66                 :          0 :               print1("The Centurion looks at you contemptuously.");
      67                 :          0 :               print2("Your strength is too low to pass the physical!");
      68                 :            :             }
      69                 :            :           else
      70                 :            :             {
      71                 :            :               pob newitem;
      72                 :            :               bank_account * account;
      73                 :            : 
      74                 :          0 :               print1("You are tested for strength and stamina...");
      75                 :          0 :               morewait();
      76                 :          0 :               nprint1(" and you pass!");
      77                 :            : 
      78                 :          0 :               print2("Commandant ");
      79                 :          0 :               nprint2(Commandant);
      80                 :          0 :               nprint2(" shakes your hand.");
      81                 :          0 :               morewait();
      82                 :            : 
      83                 :          0 :               print1("You are also issued a shortsword and leather.");
      84                 :          0 :               print2("You are now a Legionaire.");
      85                 :          0 :               morewait();
      86                 :          0 :               clearmsg();
      87                 :            : 
      88                 :            :               /* gain shortsword */
      89                 :          0 :               newitem = checkmalloc(sizeof(struct object));
      90                 :          0 :               *newitem = Objects[OB_SHORT_SWORD];
      91                 :          0 :               gain_item(newitem);
      92                 :            : 
      93                 :            :               /* gain leather armor */
      94                 :          0 :               newitem = checkmalloc(sizeof(struct object));
      95                 :          0 :               *newitem = Objects[OB_LEATHER];
      96                 :          0 :               gain_item(newitem);
      97                 :            : 
      98                 :          0 :               cinema_scene("Your starting salary will be 500 AU per month paid into an account the",
      99                 :            :                            "legion has set up for you. The password is \"loyalty\". Don't lose your card!", 0);
     100                 :            : 
     101                 :            :               /* gain bank card for salary account */
     102                 :          0 :               account = bank_create_account(TRUE, 0, "loyalty");
     103                 :          0 :               account->balance = 500;
     104                 :            : 
     105                 :          0 :               Objects[OB_DEBIT_CARD].known = 1;
     106                 :          0 :               newitem = bank_create_card(account->number, OB_DEBIT_CARD);
     107                 :          0 :               gain_item(newitem);
     108                 :            : 
     109                 :          0 :               clearmsg();
     110                 :            : 
     111                 :          0 :               SalaryAmount = 500;
     112                 :          0 :               SalaryAccount = account->number;
     113                 :            : 
     114                 :          0 :               Player.rank[LEGION] = LEGIONAIRE;
     115                 :          0 :               Player.guildxp[LEGION] = 1;
     116                 :          0 :               Player.str++;
     117                 :          0 :               Player.con++;
     118                 :          0 :               Player.maxstr++;
     119                 :          0 :               Player.maxcon++;
     120                 :            :             }
     121                 :            :         }
     122                 :          0 :       break;
     123                 :            : 
     124                 :            :     case COMMANDANT:
     125                 :          0 :       print1("You find the disposition of your forces satisfactory.");
     126                 :          0 :       break;
     127                 :            : 
     128                 :            :     case COLONEL:
     129         [ #  # ]:          0 :       if ((Player.level > Commandantlevel)
     130         [ #  # ]:          0 :           && find_and_remove_item(CORPSEID, DEMON_EMP))
     131                 :            :         {  
     132                 :          0 :           print1("You liberated the Demon Emperor's Regalia!");
     133                 :          0 :           morewait();
     134                 :          0 :           clearmsg();
     135                 :            : 
     136                 :          0 :           print1("The Legion is assembled in salute to you!");
     137                 :          0 :           print2("The Regalia is held high for all to see and admire.");
     138                 :          0 :           morewait();
     139                 :          0 :           clearmsg(); 
     140                 :            : 
     141                 :          0 :           print1("Commandant ");
     142                 :          0 :           nprint1(Commandant);
     143                 :          0 :           nprint1(" promotes you to replace him,");
     144                 :          0 :           print2("and announces his own overdue retirement.");
     145                 :          0 :           morewait();
     146                 :          0 :           clearmsg();
     147                 :            : 
     148                 :          0 :           print1("You are the new Commandant of the Legion!");
     149                 :          0 :           print2("The Emperor's Regalia is sold for a ridiculous sum.");
     150                 :          0 :           morewait();
     151                 :          0 :           clearmsg();
     152                 :            : 
     153                 :          0 :           print1("You now know the Spell of Regeneration.");
     154                 :          0 :           print2("Your training is complete. You get top salary.");
     155                 :            : 
     156                 :          0 :           strcpy(Commandant, Player.name);
     157                 :          0 :           Commandantlevel = Player.level;
     158                 :          0 :           Commandantbehavior = fixnpc(4);
     159                 :          0 :           save_hiscore_npc(8);
     160                 :            : 
     161                 :          0 :           Spells[S_REGENERATE].known = TRUE;
     162                 :          0 :           Player.rank[LEGION] = COMMANDANT;
     163                 :          0 :           Player.str += 2;
     164                 :          0 :           Player.con += 2;
     165                 :          0 :           Player.maxstr += 2;
     166                 :          0 :           Player.maxcon += 2;
     167                 :            : 
     168                 :          0 :           SalaryAmount = 10000;
     169                 :            :         }
     170         [ #  # ]:          0 :       else if (Player.level <= Commandantlevel)
     171                 :            :         {
     172                 :          0 :           clearmsg();
     173                 :          0 :           print1("Your CO expresses satisfaction with your progress.");
     174                 :          0 :           print2("But your service record does not yet permit promotion.");
     175                 :            :         }
     176                 :            :       else
     177                 :            :         {
     178                 :          0 :           clearmsg();
     179                 :          0 :           print1("Why do you come empty handed?"); 
     180                 :          0 :           print2("You must return with the Regalia of the Demon Emperor!");
     181                 :            :         }
     182                 :          0 :       break;
     183                 :            : 
     184                 :            :     case FORCE_LEADER:
     185                 :          0 :       clearmsg();
     186                 :          0 :       print1("Your CO expresses satisfaction with your progress.");
     187                 :            : 
     188         [ #  # ]:          0 :       if (Player.guildxp[LEGION] < merc_xps[Player.rank[LEGION]])
     189                 :            :         {
     190                 :          0 :           print2("But your service record does not yet permit promotion.");
     191                 :            :         }
     192                 :            :       else
     193                 :            :         {
     194                 :          0 :           print2("You have been promoted to Legion Colonel!");
     195                 :          0 :           morewait();
     196                 :            : 
     197                 :          0 :           print1("Your next promotion is contingent on the return of");
     198                 :          0 :           print2("the Regalia of the Demon Emperor.");
     199                 :          0 :           morewait();
     200                 :            : 
     201                 :          0 :           print1("The Demon Emperor holds court at the base of a volcano");
     202                 :          0 :           print2("to the far south, in the heart of a swamp.");
     203                 :          0 :           morewait();
     204                 :          0 :           clearmsg();
     205                 :            : 
     206                 :          0 :           print1("You have been taught the spell of heroism!");
     207                 :          0 :           print2("You are given advanced training, and a raise.");
     208                 :            : 
     209                 :          0 :           Spells[S_HERO].known = TRUE;
     210                 :          0 :           Player.rank[LEGION]=COLONEL;
     211                 :          0 :           Player.str++;
     212                 :          0 :           Player.con++;
     213                 :          0 :           Player.maxstr++;
     214                 :          0 :           Player.maxcon++;
     215                 :            : 
     216                 :          0 :           SalaryAmount = 5000;
     217                 :            :         }
     218                 :          0 :       break;
     219                 :            : 
     220                 :            :     case CENTURION:
     221                 :          0 :       clearmsg();
     222                 :          0 :       print1("Your CO expresses satisfaction with your progress.");
     223                 :            : 
     224         [ #  # ]:          0 :       if (Player.guildxp[LEGION] < merc_xps[Player.rank[LEGION]])
     225                 :            :         {
     226                 :          0 :           print2("But your service record does not yet permit promotion.");
     227                 :            :         }
     228                 :            :       else
     229                 :            :         {
     230                 :          0 :           print2("You are now a Legion Force-Leader!");
     231                 :          0 :           morewait();
     232                 :          0 :           clearmsg();
     233                 :            : 
     234                 :          0 :           print1("You receive more training, and another raise.");
     235                 :            : 
     236                 :          0 :           Player.rank[LEGION]=FORCE_LEADER;
     237                 :          0 :           Player.maxstr++;
     238                 :          0 :           Player.str++;
     239                 :            : 
     240                 :          0 :           SalaryAmount = 2000;
     241                 :            :         }
     242                 :          0 :       break;
     243                 :            : 
     244                 :            :     case LEGIONAIRE:
     245                 :          1 :       clearmsg();
     246                 :          1 :       print1("Your CO expresses satisfaction with your progress.");
     247                 :            : 
     248         [ +  - ]:          1 :       if (Player.guildxp[LEGION] < merc_xps[Player.rank[LEGION]])
     249                 :            :         {
     250                 :          1 :           print2("But your service record does not yet permit promotion.");
     251                 :            :         }
     252                 :            :       else
     253                 :            :         {
     254                 :          0 :           print2("You are promoted to Legion Centurion!");
     255                 :          0 :           morewait();
     256                 :          0 :           clearmsg();
     257                 :            : 
     258                 :          0 :           print1("You get advanced training, and a higher salary.");
     259                 :            : 
     260                 :          0 :           Player.rank[LEGION] = CENTURION;
     261                 :          0 :           Player.maxcon++;
     262                 :          0 :           Player.con++;
     263                 :            : 
     264                 :          0 :           SalaryAmount = 1000;
     265                 :            :         }
     266                 :          1 :       break;
     267                 :            :     }
     268                 :            : }
     269                 :            : 
     270                 :          0 : void l_castle(void)
     271                 :            : {
     272                 :            :   pob o;
     273                 :            :   int x, y;
     274                 :            : 
     275         [ #  # ]:          0 :   if (Player.level < 3) {
     276                 :          0 :     print1("You can't possibly enter the castle, you nobody!");
     277                 :          0 :     print2("Come back when you are famous.");
     278                 :            :   }
     279                 :            :   else {
     280                 :          0 :     print1("You are ushered into the castle.");
     281         [ #  # ]:          0 :     if (Player.rank[NOBILITY]<DUKE) {
     282                 :          0 :       print2("His Grace, ");
     283                 :          0 :       nprint2(Duke);
     284                 :          0 :       nprint2("-- Duke of Rampart! <fanfare>");
     285                 :          0 :       morewait();
     286                 :          0 :       clearmsg();
     287                 :            :     }
     288         [ #  # ]:          0 :     if (Player.rank[NOBILITY]==0) {
     289                 :          0 :       print1("Well, sirrah, wouldst embark on a quest? [yn] ");
     290         [ #  # ]:          0 :       if (ynq1() == 'y') {
     291                 :          0 :         print2("Splendid. Bring me the head of the Goblin King.");
     292                 :          0 :         Player.rank[NOBILITY]=COMMONER;
     293                 :            :       }
     294                 :            :       else {
     295                 :          0 :         print1("You scoundrel! Guards! Take this blackguard away!");
     296                 :          0 :         morewait();
     297                 :          0 :         p_damage(25,UNSTOPPABLE,"castle guards for lese majeste");
     298                 :          0 :         send_to_jail();
     299                 :            :       }
     300                 :            :     }
     301         [ #  # ]:          0 :     else if (Player.rank[NOBILITY]==COMMONER) {
     302         [ #  # ]:          0 :       if (find_and_remove_item(CORPSEID,GOBLIN_KING)) {
     303                 :          0 :         print1("Good job, sirrah! I promote you to the rank of esquire.");
     304                 :          0 :         Player.rank[NOBILITY]=ESQUIRE;
     305                 :          0 :         gain_experience(100);
     306                 :          0 :         print2("Now that you have proved yourself true, another quest!");
     307                 :          0 :         morewait();
     308                 :          0 :         print1("Bring to me a Holy Defender!");
     309                 :          0 :         print2("One is said to be in the possession of the Great Wyrm");
     310                 :          0 :         morewait();
     311                 :          0 :         clearmsg();
     312                 :          0 :         print1("in the depths of the sewers below the city.");
     313                 :            :       }
     314                 :          0 :       else print2("Do not return until you achieve the quest, caitiff!");
     315                 :            :     }
     316         [ #  # ]:          0 :     else if (Player.rank[NOBILITY]==ESQUIRE) {
     317         [ #  # ]:          0 :       if (find_and_remove_item(OB_DEFENDER,-1)) {
     318                 :          0 :         print1("My thanks, squire. In return, I dub thee knight!");
     319                 :          0 :         Player.rank[NOBILITY]=KNIGHT;
     320                 :          0 :         gain_experience(1000);
     321                 :          0 :         print2("If thou wouldst please me further...");
     322                 :          0 :         morewait();
     323                 :          0 :         print1("Bring me a suit of dragonscale armor.");
     324                 :          0 :         print2("You might have to kill a dragon to get one....");
     325                 :            :       }
     326                 :          0 :       else print2("Greetings, squire. My sword? What, you don't have it?");
     327                 :            :     }
     328         [ #  # ]:          0 :     else if (Player.rank[NOBILITY]==KNIGHT) {
     329         [ #  # ]:          0 :       if (find_and_remove_item(OB_DRAGONSCALE,-1)) {
     330                 :          0 :         print1("Thanks, good sir knight.");
     331                 :          0 :         print2("Here are letters patent to a peerage!");
     332                 :          0 :         Player.rank[NOBILITY]=LORD;
     333                 :          0 :         gain_experience(10000);
     334                 :          0 :         morewait();
     335                 :          0 :         print1("If you would do me a final service...");
     336                 :          0 :         print2("I require the Orb of Mastery. If you would be so kind...");
     337                 :          0 :         morewait();
     338                 :          0 :         print1("By the way, you might find the Orb in the possession");
     339                 :          0 :         print2("Of the Elemental Master on the Astral Plane");
     340                 :            :       }
     341                 :          0 :       else print2("Your quest is not yet complete, sir knight.");
     342                 :            :     }
     343         [ #  # ]:          0 :     else if (Player.rank[NOBILITY]==LORD) {
     344         [ #  # ]:          0 :       if (find_item(&o,OB_ORB_MASTERY,-1)) {
     345                 :          0 :         print1("My sincerest thanks, my lord.");
     346                 :          0 :         print2("You have proved yourself a true paragon of chivalry");
     347                 :          0 :         morewait();
     348                 :          0 :         print1("I abdicate the Duchy in your favor....");
     349                 :          0 :         print2("Oh, you can keep the Orb, by the way....");
     350                 :          0 :         Player.rank[NOBILITY]=DUKE;
     351                 :          0 :         gain_experience(10000);
     352                 :          0 :         strcpy(Duke,Player.name);
     353                 :          0 :         morewait();
     354                 :          0 :         Dukebehavior = fixnpc(4);
     355                 :          0 :         save_hiscore_npc(12);
     356         [ #  # ]:          0 :         for (y = 52; y < 63; y++)
     357         [ #  # ]:          0 :             for (x = 2; x < 52; x++) {
     358         [ #  # ]:          0 :                 if (Level->site[x][y].p_locf == L_TRAP_SIREN) {
     359                 :          0 :                     Level->site[x][y].p_locf = L_NO_OP;
     360                 :          0 :                     lset(x, y, CHANGED);
     361                 :            :                 }
     362 [ #  # ][ #  # ]:          0 :                 if (x >= 12 && loc_statusp(x, y, SECRET)) {
     363                 :          0 :                     lreset(x, y, SECRET);
     364                 :          0 :                     lset(x, y, CHANGED);
     365                 :            :                 }
     366 [ #  # ][ #  # ]:          0 :                 if (x >= 20 && x <= 23 && y == 56) {
                 [ #  # ]
     367                 :          0 :                     Level->site[x][y].locchar = FLOOR;
     368                 :          0 :                     lset(x, y, CHANGED);
     369                 :            :                 }
     370                 :            :             }
     371                 :            : 
     372                 :            :       }
     373                 :          0 :       else print2("I didn't really think you were up to the task....");
     374                 :            :     }
     375                 :            :   }
     376                 :          0 : }
     377                 :            : 
     378                 :            : 
     379                 :          0 : void l_arena(void)
     380                 :            : {
     381                 :            :   char response;
     382                 :            :   pob newitem;
     383                 :            :   int i,prize,monsterlevel;
     384                 :          0 :   char *melee = NULL;
     385                 :            : 
     386                 :          0 :   print1("Rampart Coliseum");
     387         [ #  # ]:          0 :   if (Player.rank[ARENA] == 0) {
     388                 :          0 :     print2("Enter the games, or Register as a Gladiator? [e,r,ESCAPE] ");
     389                 :          0 :     do response = (char) mcigetc();
     390 [ #  # ][ #  # ]:          0 :     while ((response != 'e') && (response != 'r') && (response != ESCAPE));
                 [ #  # ]
     391                 :            :   }
     392                 :            :   else {
     393                 :          0 :     print2("Enter the games? [yn] ");
     394                 :          0 :     response = ynq2();
     395         [ #  # ]:          0 :     if (response == 'y') response = 'e';
     396                 :          0 :     else response = ESCAPE;
     397                 :            :   }
     398         [ #  # ]:          0 :   if (response == 'r') {
     399         [ #  # ]:          0 :     if (Player.rank[ARENA]>0)
     400                 :          0 :       print2("You're already a gladiator....");
     401         [ #  # ]:          0 :     else if (Player.rank[ORDER]>0)
     402                 :          0 :       print2("We don't let Paladins into our Guild.");
     403         [ #  # ]:          0 :     else if (Player.rank[LEGION]>0)
     404                 :          0 :       print2("We don't train no stinkin' mercs!");
     405         [ #  # ]:          0 :     else if (Player.str < 13)
     406                 :          0 :       print2("Yer too weak to train!");
     407         [ #  # ]:          0 :     else if (Player.agi < 12)
     408                 :          0 :       print2("Too clumsy to be a gladiator!");
     409                 :            :     else {
     410                 :          0 :       print1("Ok, yer now an Arena Trainee.");
     411                 :          0 :       print2("Here's a wooden sword, and a shield");
     412                 :          0 :       morewait();
     413                 :          0 :       clearmsg();
     414                 :          0 :       newitem = ((pob) checkmalloc(sizeof(objtype)));
     415                 :          0 :       *newitem = Objects[OB_CLUB]; /* club */
     416                 :          0 :       gain_item(newitem);
     417                 :          0 :       newitem = ((pob) checkmalloc(sizeof(objtype)));
     418                 :          0 :       *newitem = Objects[OB_LRG_RND_SHIELD]; /* shield */
     419                 :          0 :       gain_item(newitem);
     420                 :          0 :       Player.rank[ARENA] = TRAINEE;
     421                 :          0 :       Arena_Opponent = 3;
     422                 :          0 :       morewait();
     423                 :          0 :       clearmsg();
     424                 :          0 :       print1("You've got 5000Au credit at the Gym.");
     425                 :          0 :       Gymcredit+=5000;
     426                 :            :     }
     427                 :            :   }
     428         [ #  # ]:          0 :   else if (response == 'e') {
     429                 :          0 :     print1("OK, we're arranging a match....");
     430                 :          0 :     morewait();
     431                 :          0 :     Arena_Monster = ((pmt) checkmalloc(sizeof(montype)));
     432                 :          0 :     Arena_Victory = FALSE;
     433   [ #  #  #  #  :          0 :     switch(Arena_Opponent) {
          #  #  #  #  #  
          #  #  #  #  #  
                #  #  # ]
     434                 :            :     case 0: 
     435                 :          0 :       *Arena_Monster = Monsters[GEEK];
     436                 :          0 :       break;
     437                 :            :     case 1:
     438                 :          0 :       *Arena_Monster = Monsters[HORNET];
     439                 :          0 :       break;
     440                 :            :     case 2:
     441                 :          0 :       *Arena_Monster = Monsters[HYENA];
     442                 :          0 :       break;
     443                 :            :     case 3:
     444                 :          0 :       *Arena_Monster = Monsters[GOBLIN];
     445                 :          0 :       break;
     446                 :            :     case 4:
     447                 :          0 :       *Arena_Monster = Monsters[GRUNT];
     448                 :          0 :       break;
     449                 :            :     case 5:
     450                 :          0 :       *Arena_Monster = Monsters[TOVE];
     451                 :          0 :       break;      
     452                 :            :     case 6:
     453                 :          0 :       *Arena_Monster = Monsters[APPR_NINJA];
     454                 :          0 :       break;
     455                 :            :     case 7:
     456                 :          0 :       *Arena_Monster = Monsters[SALAMANDER];
     457                 :          0 :       break;
     458                 :            :     case 8:
     459                 :          0 :       *Arena_Monster = Monsters[ANT];
     460                 :          0 :       break;
     461                 :            :     case 9:
     462                 :          0 :       *Arena_Monster = Monsters[MANTICORE];
     463                 :          0 :       break;
     464                 :            :     case 10:
     465                 :          0 :       *Arena_Monster = Monsters[SPECTRE];
     466                 :          0 :       break;
     467                 :            :     case 11:
     468                 :          0 :       *Arena_Monster = Monsters[BANDERSNATCH];
     469                 :          0 :       break;
     470                 :            :     case 12:
     471                 :          0 :       *Arena_Monster = Monsters[LICHE];
     472                 :          0 :       break;
     473                 :            :     case 13: 
     474                 :          0 :       *Arena_Monster = Monsters[AUTO_MAJOR];
     475                 :          0 :       break;
     476                 :            :     case 14:
     477                 :          0 :       *Arena_Monster = Monsters[JABBERWOCK];
     478                 :          0 :       break;
     479                 :            :     case 15:
     480                 :          0 :       *Arena_Monster = Monsters[JOTUN];
     481                 :          0 :       break;
     482                 :            :     default:
     483 [ #  # ][ #  # ]:          0 :       if ((Player.rank[ARENA] < 5) && (Player.rank[ARENA] > 0)) {
     484                 :          0 :         strcpy(Str1,Champion);
     485                 :          0 :         strcat(Str1,", the arena champion");
     486                 :          0 :         *Arena_Monster = Monsters[HISCORE_NPC];
     487                 :          0 :         Arena_Monster->monstring = salloc(Str1);
     488                 :          0 :         strcpy(Str2,"The corpse of ");
     489                 :          0 :         strcat(Str2,Str1);
     490                 :          0 :         Arena_Monster->corpsestr = salloc(Str2);
     491                 :          0 :         m_status_set( Arena_Monster, ALLOC );
     492                 :          0 :         Arena_Monster->level = 20;
     493                 :          0 :         Arena_Monster->hp = Championlevel*Championlevel*5;
     494                 :          0 :         Arena_Monster->hit = Championlevel*4;
     495                 :          0 :         Arena_Monster->ac = Championlevel*3;
     496                 :          0 :         Arena_Monster->dmg = 100+Championlevel*2;
     497                 :          0 :         Arena_Monster->xpv = Championlevel*Championlevel*5;
     498                 :          0 :         Arena_Monster->speed = 3;
     499                 :          0 :         melee = Arena_Monster->meleestr = (char *) checkmalloc(30*sizeof(char));
     500                 :          0 :         strcpy(Arena_Monster->meleestr,"");
     501         [ #  # ]:          0 :         for(i=0;i<Championlevel/5;i++)
     502                 :          0 :           strcat(Arena_Monster->meleestr,"L?R?");
     503                 :          0 :         m_status_set(Arena_Monster, MOBILE);
     504                 :          0 :         m_status_set(Arena_Monster, HOSTILE);
     505                 :            :       }
     506                 :            :       else {
     507                 :            :         do 
     508                 :          0 :           i = random_range(ML9 - ML0) + ML0;
     509 [ #  # ][ #  # ]:          0 :         while (i == NPC || i == HISCORE_NPC || i == ZERO_NPC ||
                 [ #  # ]
     510         [ #  # ]:          0 :                (Monsters[i].uniqueness != COMMON) || 
     511         [ #  # ]:          0 :                (Monsters[i].dmg == 0));
     512                 :          0 :         *Arena_Monster = Monsters[i];
     513                 :            :       }
     514                 :          0 :       break;
     515                 :            :     }
     516                 :          0 :     monsterlevel = Arena_Monster->level;
     517         [ #  # ]:          0 :     if (Arena_Monster->level != 20) {
     518                 :          0 :       strcpy(Str1,nameprint());
     519                 :          0 :       strcat(Str1," the ");
     520                 :          0 :       strcat(Str1,Arena_Monster->monstring);
     521                 :          0 :       Arena_Monster->monstring = salloc(Str1);
     522                 :          0 :       strcpy(Str2,"The corpse of ");
     523                 :          0 :       strcat(Str2,Str1);
     524                 :          0 :       Arena_Monster->corpsestr = salloc(Str2);
     525                 :          0 :       m_status_set( Arena_Monster, ALLOC );
     526                 :            :     }
     527                 :          0 :     Arena_Monster->uniqueness = UNIQUE_MADE;
     528                 :          0 :     print1("You have a challenger: ");
     529                 :          0 :     print2(Arena_Monster->monstring);
     530                 :          0 :     Arena_Monster->attacked = TRUE;
     531                 :          0 :     m_status_set(Arena_Monster,HOSTILE);
     532                 :            : /* DAG  pump up the stats of the arena monster; from env.c */
     533                 :            : /* DAG should we even do this for the champion? */
     534                 :          0 :     Arena_Monster->hp += Arena_Monster->level*10;
     535                 :          0 :     Arena_Monster->hit += Arena_Monster->hit;
     536                 :          0 :     Arena_Monster->dmg += Arena_Monster->dmg/2;
     537                 :            : 
     538                 :          0 :     morewait();
     539                 :          0 :     clearmsg();
     540                 :          0 :     change_environment(E_ARENA);
     541                 :          0 :     print1("Let the battle begin....");
     542                 :            : 
     543                 :          0 :     time_clock(TRUE);
     544         [ #  # ]:          0 :     while (Current_Environment == E_ARENA) 
     545                 :          0 :       time_clock(FALSE);
     546                 :            : 
     547                 :            :     /* DAG all this nasty mess cleaned up...  */
     548                 :            :     /* one process with m_status_set( Arena_Monster, ALLOC) */
     549                 :            : 
     550                 :            :     /* free(name); */
     551                 :            :     /* free(corpse); */
     552                 :            : 
     553         [ #  # ]:          0 :     if (melee)
     554                 :          0 :       free(melee);
     555         [ #  # ]:          0 :     if (! Arena_Victory) {
     556                 :          0 :       print1("The crowd boos your craven behavior!!!");
     557         [ #  # ]:          0 :       if (Player.rank[ARENA] > 0) {
     558                 :          0 :         print2("You are thrown out of the Gladiator's Guild!");
     559                 :          0 :         morewait();
     560                 :          0 :         clearmsg();
     561         [ #  # ]:          0 :         if (Gymcredit > 0) print1("Your credit at the gym is cut off!");
     562                 :          0 :         Gymcredit = 0;
     563                 :          0 :         Player.rank[ARENA] = -1;
     564                 :            :       }
     565                 :            :     }      
     566                 :            :     else {
     567                 :          0 :       Arena_Opponent++;
     568         [ #  # ]:          0 :       if (monsterlevel == 20) {
     569                 :          0 :         print1("The crowd roars its approval!");
     570         [ #  # ]:          0 :         if (Player.rank[ARENA]) {
     571                 :          0 :           print2("You are the new Arena Champion!");
     572                 :          0 :           Championlevel = Player.level;
     573                 :          0 :           strcpy(Champion,Player.name);
     574                 :          0 :           Player.rank[ARENA] = 5;
     575                 :          0 :           morewait();
     576                 :          0 :           Championbehavior = fixnpc(4);
     577                 :          0 :           save_hiscore_npc(11);
     578                 :          0 :           print1("You are awarded the Champion's Spear: Victrix!");
     579                 :          0 :           morewait();
     580                 :          0 :           newitem = ((pob) checkmalloc(sizeof(objtype)));
     581                 :          0 :           *newitem = Objects[OB_VICTRIX];
     582                 :          0 :           gain_item(newitem);
     583                 :            :           
     584                 :            :         }
     585                 :            :         else {
     586                 :          0 :           print1("As you are not an official gladiator,");
     587                 :          0 :           nprint1("you are not made Champion.");
     588                 :          0 :           morewait();
     589                 :            :         }
     590                 :            :       }
     591                 :          0 :       morewait();
     592                 :          0 :       clearmsg();
     593                 :          0 :       print1("Good fight! ");
     594                 :          0 :       nprint1("Your prize is: ");
     595                 :          0 :       prize = max(25,monsterlevel * 50);
     596         [ #  # ]:          0 :       if (Player.rank[ARENA] > 0) prize *= 2;
     597                 :          0 :       mnumprint(prize);
     598                 :          0 :       nprint1("Au.");
     599                 :          0 :       Player.cash+=prize;
     600 [ #  # ][ #  # ]:          0 :       if ((Player.rank[ARENA]<4) &&
     601         [ #  # ]:          0 :           (Arena_Opponent>5) &&
     602                 :          0 :           (Arena_Opponent % 3 == 0)) {
     603         [ #  # ]:          0 :         if (Player.rank[ARENA]>0) {
     604                 :          0 :           Player.rank[ARENA]++;
     605                 :          0 :           morewait();
     606                 :          0 :           print1("You've been promoted to a stronger class!");
     607                 :          0 :           print2("You are also entitled to additional training.");
     608                 :          0 :           Gymcredit+=Arena_Opponent*1000;
     609                 :            :         }
     610                 :            :       }
     611                 :            :     }
     612                 :          0 :     xredraw();
     613                 :            :   }
     614                 :          0 :   else clearmsg();
     615                 :          0 : }

Generated by: LCOV version 1.11