Annotation of 43BSDReno/games/larn/regen.c, revision 1.1.1.1

1.1       root        1: /* regen.c                     Larn is copyrighted 1986 by Noah Morgan. */
                      2: #include "header.h"
                      3: /*
                      4:        *******
                      5:        REGEN()
                      6:        *******
                      7:        regen()
                      8: 
                      9:        subroutine to regenerate player hp and spells
                     10:  */
                     11: regen()
                     12:        {
                     13:        register int i,flag;
                     14:        register long *d;
                     15:        d = c;
                     16: #ifdef EXTRA
                     17:        d[MOVESMADE]++;
                     18: #endif
                     19:        if (d[TIMESTOP])  { if(--d[TIMESTOP]<=0) bottomline();  return; }       /* for stop time spell */
                     20:        flag=0;
                     21: 
                     22:        if (d[STRENGTH]<3)      { d[STRENGTH]=3; flag=1; }
                     23:        if ((d[HASTESELF]==0) || ((d[HASTESELF] & 1) == 0))
                     24:                gtime++;
                     25: 
                     26:        if (d[HP] != d[HPMAX])
                     27:                if (d[REGENCOUNTER]-- <= 0)             /*      regenerate hit points   */
                     28:                        {
                     29:                        d[REGENCOUNTER] = 22 + (d[HARDGAME]<<1) - d[LEVEL];
                     30:                        if ((d[HP] += d[REGEN]) > d[HPMAX])  d[HP] = d[HPMAX];
                     31:                        bottomhp();
                     32:                        }
                     33: 
                     34:        if (d[SPELLS] < d[SPELLMAX])            /*      regenerate spells       */
                     35:                if (d[ECOUNTER]-- <= 0)
                     36:                        {
                     37:                        d[ECOUNTER] = 100+4*(d[HARDGAME]-d[LEVEL]-d[ENERGY]);
                     38:                        d[SPELLS]++;    bottomspell();
                     39:                        }
                     40: 
                     41:        if (d[HERO])                    if (--d[HERO]<=0) { for (i=0; i<6; i++) d[i] -= 10; flag=1; }
                     42:        if (d[ALTPRO])                  if (--d[ALTPRO]<=0)                     { d[MOREDEFENSES]-=3; flag=1; }
                     43:        if (d[PROTECTIONTIME])  if (--d[PROTECTIONTIME]<=0)     { d[MOREDEFENSES]-=2; flag=1; }
                     44:        if (d[DEXCOUNT])                if (--d[DEXCOUNT]<=0)           { d[DEXTERITY]-=3; flag=1; }
                     45:        if (d[STRCOUNT])                if (--d[STRCOUNT]<=0)           { d[STREXTRA]-=3; flag=1; }
                     46:        if (d[BLINDCOUNT])              if (--d[BLINDCOUNT]<=0)         { cursors();  lprcat("\nThe blindness lifts  "); beep(); }
                     47:        if (d[CONFUSE])                 if (--d[CONFUSE]<=0) { cursors();  lprcat("\nYou regain your senses"); beep(); }
                     48:        if (d[GIANTSTR])                if (--d[GIANTSTR]<=0) { d[STREXTRA] -= 20; flag=1; }
                     49:        if (d[CHARMCOUNT])              if ((--d[CHARMCOUNT]) <= 0) flag=1;
                     50:        if (d[INVISIBILITY])    if ((--d[INVISIBILITY]) <= 0) flag=1;
                     51:        if (d[CANCELLATION])    if ((--d[CANCELLATION]) <= 0) flag=1;
                     52:        if (d[WTW])                             if ((--d[WTW]) <= 0) flag=1;
                     53:        if (d[HASTESELF])               if ((--d[HASTESELF]) <= 0) flag=1;
                     54:        if (d[AGGRAVATE])               --d[AGGRAVATE]; 
                     55:        if (d[SCAREMONST])              if ((--d[SCAREMONST]) <= 0) flag=1; 
                     56:        if (d[STEALTH])                 if ((--d[STEALTH]) <= 0) flag=1; 
                     57:        if (d[AWARENESS])               --d[AWARENESS];
                     58:        if (d[HOLDMONST])               if ((--d[HOLDMONST]) <= 0) flag=1;
                     59:        if (d[HASTEMONST])              --d[HASTEMONST];
                     60:        if (d[FIRERESISTANCE])  if ((--d[FIRERESISTANCE]) <= 0) flag=1;
                     61:        if (d[GLOBE])                   if (--d[GLOBE]<=0) { d[MOREDEFENSES]-=10; flag=1; }
                     62:        if (d[SPIRITPRO])               if (--d[SPIRITPRO] <= 0) flag=1;
                     63:        if (d[UNDEADPRO])               if (--d[UNDEADPRO] <= 0) flag=1;
                     64:        if (d[HALFDAM])                 if (--d[HALFDAM]<=0)  { cursors();  lprcat("\nYou now feel better "); beep(); }
                     65:        if (d[SEEINVISIBLE])
                     66:          if (--d[SEEINVISIBLE]<=0)
                     67:                { monstnamelist[INVISIBLESTALKER] = ' ';
                     68:                  cursors();  lprcat("\nYou feel your vision return to normal"); beep(); }
                     69:        if (d[ITCHING])
                     70:                {
                     71:                if (d[ITCHING]>1)
                     72:                        if ((d[WEAR]!= -1) || (d[SHIELD]!= -1))
                     73:                                if (rnd(100)<50)
                     74:                                        {
                     75:                                        d[WEAR]=d[SHIELD]= -1; cursors();
                     76:                                        lprcat("\nThe hysteria of itching forces you to remove your armor!"); 
                     77:                                        beep(); recalc();  bottomline();
                     78:                                        }
                     79:                if (--d[ITCHING]<=0) { cursors();  lprcat("\nYou now feel the irritation subside!"); beep(); }
                     80:                }
                     81:        if (d[CLUMSINESS])
                     82:                {
                     83:                if (d[WIELD] != -1)
                     84:                        if (d[CLUMSINESS]>1)
                     85:                          if (item[playerx][playery]==0)        /* only if nothing there */
                     86:                                if (rnd(100)<33) /* drop your weapon due to clumsiness */
                     87:                                        drop_object((int)d[WIELD]);
                     88:                if (--d[CLUMSINESS]<=0) { cursors();  lprcat("\nYou now feel less awkward!"); beep(); }
                     89:                }
                     90:        if (flag) bottomline();
                     91:        }
                     92: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.