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