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 $ */
11 subroutine to regenerate player hp and spells
23 if (--d
[TIMESTOP
] <= 0)
26 } /* for stop time spell */
29 if (d
[STRENGTH
] < 3) {
33 if ((d
[HASTESELF
] == 0) || ((d
[HASTESELF
] & 1) == 0))
36 if (d
[HP
] != d
[HPMAX
])
37 if (d
[REGENCOUNTER
]-- <= 0) { /* regenerate hit points */
38 d
[REGENCOUNTER
] = 22 + (d
[HARDGAME
] << 1) - d
[LEVEL
];
39 if ((d
[HP
] += d
[REGEN
]) > d
[HPMAX
])
44 if (d
[SPELLS
] < d
[SPELLMAX
]) /* regenerate spells */
45 if (d
[ECOUNTER
]-- <= 0) {
46 d
[ECOUNTER
] = 100 + 4 * (d
[HARDGAME
] - d
[LEVEL
] - d
[ENERGY
]);
53 for (i
= 0; i
< 6; i
++)
58 if (--d
[ALTPRO
] <= 0) {
62 if (d
[PROTECTIONTIME
])
63 if (--d
[PROTECTIONTIME
] <= 0) {
68 if (--d
[DEXCOUNT
] <= 0) {
73 if (--d
[STRCOUNT
] <= 0) {
78 if (--d
[BLINDCOUNT
] <= 0) {
80 lprcat("\nThe blindness lifts ");
84 if (--d
[CONFUSE
] <= 0) {
86 lprcat("\nYou regain your senses");
90 if (--d
[GIANTSTR
] <= 0) {
95 if ((--d
[CHARMCOUNT
]) <= 0)
98 if ((--d
[INVISIBILITY
]) <= 0)
101 if ((--d
[CANCELLATION
]) <= 0)
107 if ((--d
[HASTESELF
]) <= 0)
112 if ((--d
[SCAREMONST
]) <= 0)
115 if ((--d
[STEALTH
]) <= 0)
120 if ((--d
[HOLDMONST
]) <= 0)
124 if (d
[FIRERESISTANCE
])
125 if ((--d
[FIRERESISTANCE
]) <= 0)
128 if (--d
[GLOBE
] <= 0) {
129 d
[MOREDEFENSES
] -= 10;
133 if (--d
[SPIRITPRO
] <= 0)
136 if (--d
[UNDEADPRO
] <= 0)
139 if (--d
[HALFDAM
] <= 0) {
141 lprcat("\nYou now feel better ");
145 if (--d
[SEEINVISIBLE
] <= 0) {
146 monstnamelist
[INVISIBLESTALKER
] = ' ';
148 lprcat("\nYou feel your vision return to normal");
153 if ((d
[WEAR
] != -1) || (d
[SHIELD
] != -1))
155 d
[WEAR
] = d
[SHIELD
] = -1;
157 lprcat("\nThe hysteria of itching forces you to remove your armor!");
162 if (--d
[ITCHING
] <= 0) {
164 lprcat("\nYou now feel the irritation subside!");
170 if (d
[CLUMSINESS
] > 1)
171 if (item
[playerx
][playery
] == 0) /* only if nothing there */
172 if (rnd(100) < 33) /* drop your weapon due to clumsiness */
173 drop_object((int)d
[WIELD
]);
174 if (--d
[CLUMSINESS
] <= 0) {
176 lprcat("\nYou now feel less awkward!");