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 $ */
10 subroutine to regenerate player hp and spells
20 if (d[TIMESTOP]) { if(--d[TIMESTOP]<=0) bottomline(); return; } /* for stop time spell */
23 if (d[STRENGTH]<3) { d[STRENGTH]=3; flag=1; }
24 if ((d[HASTESELF]==0) || ((d[HASTESELF] & 1) == 0))
27 if (d[HP] != d[HPMAX])
28 if (d[REGENCOUNTER]-- <= 0) /* regenerate hit points */
30 d[REGENCOUNTER] = 22 + (d[HARDGAME]<<1) - d[LEVEL];
31 if ((d[HP] += d[REGEN]) > d[HPMAX]) d[HP] = d[HPMAX];
35 if (d[SPELLS] < d[SPELLMAX]) /* regenerate spells */
36 if (d[ECOUNTER]-- <= 0)
38 d[ECOUNTER] = 100+4*(d[HARDGAME]-d[LEVEL]-d[ENERGY]);
39 d[SPELLS]++; bottomspell();
42 if (d[HERO]) if (--d[HERO]<=0) { for (i=0; i<6; i++) d[i] -= 10; flag=1; }
43 if (d[ALTPRO]) if (--d[ALTPRO]<=0) { d[MOREDEFENSES]-=3; flag=1; }
44 if (d[PROTECTIONTIME]) if (--d[PROTECTIONTIME]<=0) { d[MOREDEFENSES]-=2; flag=1; }
45 if (d[DEXCOUNT]) if (--d[DEXCOUNT]<=0) { d[DEXTERITY]-=3; flag=1; }
46 if (d[STRCOUNT]) if (--d[STRCOUNT]<=0) { d[STREXTRA]-=3; flag=1; }
47 if (d[BLINDCOUNT]) if (--d[BLINDCOUNT]<=0) { cursors(); lprcat("\nThe blindness lifts "); beep(); }
48 if (d[CONFUSE]) if (--d[CONFUSE]<=0) { cursors(); lprcat("\nYou regain your senses"); beep(); }
49 if (d[GIANTSTR]) if (--d[GIANTSTR]<=0) { d[STREXTRA] -= 20; flag=1; }
50 if (d[CHARMCOUNT]) if ((--d[CHARMCOUNT]) <= 0) flag=1;
51 if (d[INVISIBILITY]) if ((--d[INVISIBILITY]) <= 0) flag=1;
52 if (d[CANCELLATION]) if ((--d[CANCELLATION]) <= 0) flag=1;
53 if (d[WTW]) if ((--d[WTW]) <= 0) flag=1;
54 if (d[HASTESELF]) if ((--d[HASTESELF]) <= 0) flag=1;
55 if (d[AGGRAVATE]) --d[AGGRAVATE];
56 if (d[SCAREMONST]) if ((--d[SCAREMONST]) <= 0) flag=1;
57 if (d[STEALTH]) if ((--d[STEALTH]) <= 0) flag=1;
58 if (d[AWARENESS]) --d[AWARENESS];
59 if (d[HOLDMONST]) if ((--d[HOLDMONST]) <= 0) flag=1;
60 if (d[HASTEMONST]) --d[HASTEMONST];
61 if (d[FIRERESISTANCE]) if ((--d[FIRERESISTANCE]) <= 0) flag=1;
62 if (d[GLOBE]) if (--d[GLOBE]<=0) { d[MOREDEFENSES]-=10; flag=1; }
63 if (d[SPIRITPRO]) if (--d[SPIRITPRO] <= 0) flag=1;
64 if (d[UNDEADPRO]) if (--d[UNDEADPRO] <= 0) flag=1;
65 if (d[HALFDAM]) if (--d[HALFDAM]<=0) { cursors(); lprcat("\nYou now feel better "); beep(); }
67 if (--d[SEEINVISIBLE]<=0)
68 { monstnamelist[INVISIBLESTALKER] = ' ';
69 cursors(); lprcat("\nYou feel your vision return to normal"); beep(); }
73 if ((d[WEAR]!= -1) || (d[SHIELD]!= -1))
76 d[WEAR]=d[SHIELD]= -1; cursors();
77 lprcat("\nThe hysteria of itching forces you to remove your armor!");
78 beep(); recalc(); bottomline();
80 if (--d[ITCHING]<=0) { cursors(); lprcat("\nYou now feel the irritation subside!"); beep(); }
86 if (item[playerx][playery]==0) /* only if nothing there */
87 if (rnd(100)<33) /* drop your weapon due to clumsiness */
88 drop_object((int)d[WIELD]);
89 if (--d[CLUMSINESS]<=0) { cursors(); lprcat("\nYou now feel less awkward!"); beep(); }
91 if (flag) bottomline();