1 #include <stdio.h>
2 #include <strings.h>
3 
4 #include "handwave.h"
5 #include "internal.h"
6 
7 extern char exbuf[2048], exbuf2[2048];
8 extern char *number_name();
9 
exec_enchants(self,fred,cnum,wizflag)10 void exec_enchants(self, fred, cnum, wizflag) /* no deaders */
11 struct realgame *self;
12 union being *fred;
13 int cnum;
14 int wizflag;
15 {
16     int handnum;
17     int *zapl = fred->both.zaplist;
18     struct permstats *perm = &(fred->both.perm);
19     /* counterspell, dispel magic, magic mirror have already been taken care of. */
20 
21     if (zapl[SP__AMNESIA]) {
22 	fred->both.mind_spell = SP__AMNESIA;
23 	/* fred->both.mind_caster = unused */
24 	if (fred->both.enchant_ppend)
25 	    perm->mind_spell = SP__AMNESIA;
26 	sprintf(exbuf2, "The Amnesia spell curls around %s's mind.\n", fred->both.name);
27 	if (wizflag)
28 	    PrintMsg2(cnum, "The Amnesia spell curls around your mind.\n", exbuf2);
29 	else
30 	    PrintMsg(exbuf2);
31     }
32 
33     if (zapl[SP__CONFUSION]) {
34 	fred->both.mind_spell = SP__CONFUSION;
35 	fred->both.mind_caster = 0;
36 	if (fred->both.enchant_ppend) {
37 	    perm->mind_spell = SP__CONFUSION;
38 	    perm->mind_detail = (-1);
39 	    fred->both.mind_caster = 1;
40 	}
41 	sprintf(exbuf2, "The Confusion spell curls around %s's mind.\n", fred->both.name);
42 	if (wizflag)
43 	    PrintMsg2(cnum, "The Confusion spell curls around your mind.\n", exbuf2);
44 	else
45 	    PrintMsg(exbuf2);
46     }
47 
48     if (zapl[SP__FEAR]) {
49 	fred->both.mind_spell = SP__FEAR;
50 	/* fred->both.mind_caster = unused */
51 	if (fred->both.enchant_ppend)
52 	    perm->mind_spell = SP__FEAR;
53 	sprintf(exbuf2, "The Fear spell curls around %s's mind.\n", fred->both.name);
54 	if (wizflag)
55 	    PrintMsg2(cnum, "The Fear spell curls around your mind.\n", exbuf2);
56 	else
57 	    PrintMsg(exbuf2);
58     }
59 
60     if (zapl[SP__PARALYSIS]) {
61 	if (wizflag) {
62 	    /* cast on a wizard */
63 	    if (fred->both.enchant_caster == (-1)) {
64 		sprintf(exbuf2, "Not knowing which of %s's hands to strike, the Paralysis spell fizzles.\n", fred->both.name);
65 		PrintMsg2(cnum, "Not knowing which of your hands to strike, the Paralysis spell fizzles.\n", exbuf2);
66 	    }
67 	    else {
68 		fred->both.mind_spell = SP__PARALYSIS;
69 
70 		if (fred->wiz.hand_paralyzed==(-1)) {
71 		    erase_queries(self);
72 		    add_query(self, fred->both.enchant_caster, Qu_ParalysisHand, cnum);
73 		    Queries(self->numqueries, self->querylist);
74 		    handnum = self->querylist[0].answer;
75 		}
76 		else
77 		    handnum = fred->wiz.hand_paralyzed;
78 
79 		fred->both.mind_caster = handnum;
80 		if (fred->both.enchant_ppend) {
81 		    perm->mind_spell = SP__PARALYSIS;
82 		    perm->mind_detail = handnum;
83 		}
84 
85 		sprintf(exbuf, "The Paralysis spell curls around your %s hand.\n", (handnum?"right":"left"));
86 		sprintf(exbuf2, "The Paralysis spell curls around %s's %s hand.\n", fred->both.name, (handnum?"right":"left"));
87 		PrintMsg2(cnum, exbuf, exbuf2);
88 	    }
89 	}
90 	else {
91 	    /* cast on a monster */
92 	    fred->both.mind_spell = SP__PARALYSIS;
93 	    /* fred->both.mind_caster = unused */
94 	    if (fred->both.enchant_ppend)
95 		perm->mind_spell = SP__PARALYSIS;
96 	    sprintf(exbuf2, "The Paralysis spell curls around %s's mind.\n", fred->both.name);
97 	    PrintMsg(exbuf2);
98 	}
99     }
100 
101     if (zapl[SP__CHARM_MONSTER]) {
102 	if (wizflag) {
103 	    /* cast on a wizard */
104 	    sprintf(exbuf2, "The Charm Monster spell swirls around %s's mind, but cannot sink in.\n", fred->both.name);
105 	    PrintMsg2(cnum, "The Charm Monster spell swirls around your mind, but cannot sink in.\n", exbuf2);
106 	}
107 	else {
108 	    /* cast on a monster */
109 	    if (fred->both.enchant_caster == (-1)) {
110 		sprintf(exbuf, "The Charm Monster spell strikes %s, and then seems to freeze. Referees stomp into the arena and glare at the spell. Then they glare at each other. Then they glare at the spell again. They huddle together, muttering and glowering. Eventually they pick the spell up bodily and carry it off the field.\n", fred->both.name);
111 		PrintMsg(exbuf);
112 	    }
113 	    else {
114 		fred->both.mind_spell = SP__CHARM_MONSTER;
115 		fred->both.mind_caster = fred->both.enchant_caster;
116 		if (fred->both.enchant_ppend) {
117 		    perm->mind_spell = SP__CHARM_MONSTER;
118 		    perm->mind_detail = fred->both.enchant_caster;
119 		}
120 		fred->cre.owner = fred->both.enchant_caster;
121 		sprintf(exbuf2, "The Charm Monster spell curls around %s, and %s smiles dopily at %s.\n", fred->both.name, pro_he(fred->both.gender), self->wiz[fred->cre.owner]->name);
122 		PrintMsg(exbuf2);
123 	    }
124 	}
125     }
126 
127     if (zapl[SP__CHARM_PERSON]) {
128 	if (wizflag) {
129 	    /* cast on a wizard */
130 	    if (fred->both.enchant_caster == (-1)) {
131 		sprintf(exbuf2, "Not knowing which of %s's hands to strike, the Charm Person spell fizzles.\n", fred->both.name);
132 		PrintMsg2(cnum, "Not knowing which of your hands to strike, the Charm Person spell fizzles.\n", exbuf2);
133 	    }
134 	    else {
135 		fred->both.mind_spell = SP__CHARM_PERSON;
136 
137 		erase_queries(self);
138 		add_query(self, fred->both.enchant_caster, Qu_CharmHand, cnum);
139 		Queries(self->numqueries, self->querylist);
140 		handnum = self->querylist[0].answer;
141 
142 		fred->both.mind_caster = fred->both.enchant_caster + 128*handnum;
143 		if (fred->both.enchant_ppend) {
144 		    perm->mind_spell = SP__CHARM_PERSON;
145 		    perm->mind_detail = (-1);
146 		    fred->both.mind_caster |= 1024;
147 		}
148 
149 		sprintf(exbuf, "The Charm Person spell curls around your %s hand.\n", (handnum?"right":"left"));
150 		sprintf(exbuf2, "The Charm Person spell curls around %s's %s hand.\n", fred->both.name, (handnum?"right":"left"));
151 		PrintMsg2(cnum, exbuf, exbuf2);
152 	    }
153 	}
154 	else {
155 	    /* cast on a monster */
156 	    sprintf(exbuf2, "The Charm Person spell swirls around %s's mind, but cannot sink in.\n", fred->both.name);
157 	    PrintMsg(exbuf2);
158 	}
159     }
160 
161     /* do PERMANENT spells */
162     if (fred->both.mind_spell == (-1)) {
163 	switch (perm->mind_spell) {
164 	    case SP__AMNESIA:
165 		fred->both.mind_spell = SP__AMNESIA;
166 		sprintf(exbuf2, "%s is still afflicted with Amnesia.\n", fred->both.name);
167 		if (wizflag)
168 		    PrintMsg2(cnum, "You are still afflicted with Amnesia.\n", exbuf2);
169 		else
170 		    PrintMsg(exbuf2);
171 		break;
172 	    case SP__FEAR:
173 		fred->both.mind_spell = SP__FEAR;
174 		sprintf(exbuf2, "%s is still afflicted with Fear.\n", fred->both.name);
175 		if (wizflag)
176 		    PrintMsg2(cnum, "You are still afflicted with Fear.\n", exbuf2);
177 		else
178 		    PrintMsg(exbuf2);
179 		break;
180 	    case SP__CHARM_MONSTER:
181 		if (!wizflag) {
182 		    fred->both.mind_spell = SP__CHARM_MONSTER;
183 		    fred->both.mind_caster = perm->mind_detail;
184 		    fred->cre.owner = perm->mind_detail;
185 		    sprintf(exbuf2, "%s is still enamoured of %s.\n", fred->both.name, self->wiz[fred->cre.owner]->name);
186 		    PrintMsg(exbuf2);
187 		}
188 		break;
189 	    case SP__CONFUSION:
190 		fred->both.mind_spell = SP__CONFUSION;
191 		fred->both.mind_caster = 1;
192 		sprintf(exbuf2, "%s is still afflicted with Confusion.\n", fred->both.name);
193 		if (wizflag)
194 		    PrintMsg2(cnum, "You are still afflicted with Confusion.\n", exbuf2);
195 		else
196 		    PrintMsg(exbuf2);
197 		break;
198 	    case SP__CHARM_PERSON:
199 		if (wizflag) {
200 		    fred->both.mind_spell = SP__CHARM_PERSON;
201 		    fred->both.mind_caster = 1024;
202 		    sprintf(exbuf2, "%s is still Charmed.\n", fred->both.name);
203 		    PrintMsg2(cnum, "You are still Charmed.\n", exbuf2);
204 		}
205 		break;
206 	    case SP__PARALYSIS:
207 		fred->both.mind_spell = SP__PARALYSIS;
208 		fred->both.mind_caster = perm->mind_detail;
209 		if (wizflag) {
210 		    sprintf(exbuf2, "%s's %s hand is still Paralyzed.\n", fred->both.name, ((perm->mind_detail)?"right":"left"));
211 		    sprintf(exbuf, "Your %s hand is still Paralyzed.\n", ((perm->mind_detail)?"right":"left"));
212 		    PrintMsg2(cnum, exbuf, exbuf2);
213 		}
214 		else {
215 		    sprintf(exbuf2, "%s is still afflicted with Paralysis.\n", fred->both.name);
216 		    PrintMsg(exbuf2);
217 		}
218 		break;
219 	    case (-1):
220 		/* no permanent mind spell */
221 		break;
222 	    default:
223 		printf("ERROR: unknown perm->mind_spell %d\n", perm->mind_spell);
224 		break;
225 	}
226     }
227 
228     if (zapl[SP__DISEASE]) {
229 	if (fred->both.disease_time == (-1)) {
230 	    /* not yet diseased */
231 	    fred->both.disease_time = 6;
232 	    sprintf(exbuf2, "%s sneezes loudly.\n", fred->both.name);
233 	    if (wizflag)
234 		PrintMsg2(cnum, "You sneeze loudly.\n", exbuf2);
235 	    else
236 		PrintMsg(exbuf2);
237 	}
238     }
239 
240     if (zapl[SP__POISON]) {
241 	if (fred->both.poison_time == (-1)) {
242 	    /* not yet poisoned */
243 	    fred->both.poison_time = 6;
244 	    sprintf(exbuf2, "%s suddenly looks somewhat pale.\n", fred->both.name);
245 	    if (wizflag)
246 		PrintMsg2(cnum, "A flash of pain lances along your bones, and then fades away.\n", exbuf2);
247 	    else
248 		PrintMsg(exbuf2);
249 	}
250     }
251 
252     if (zapl[SP__ANTI_SPELL]) {
253 	if (zapl[SP__REMOVE_ENCHANTMENT]) {
254 	    /* cancelled */
255 	    sprintf(exbuf2, "The Anti-Spell fizzes away into nothing as it approaches %s.\n", fred->both.name);
256 	    if (wizflag)
257 		PrintMsg2(cnum, "The Anti-Spell fizzes away into nothing as it approaches you.\n", exbuf2);
258 	    else
259 		PrintMsg(exbuf2);
260 	}
261 	else {
262 	    if (!wizflag) {
263 		sprintf(exbuf, "The Anti-Spell whizzes through %s without any effect.\n", fred->both.name);
264 		PrintMsg(exbuf);
265 	    }
266 	    else {
267 		struct wizard *wiz = &(fred->wiz);
268 		sprintf(exbuf2, "The Anti-Spell jolts %s, causing the magical energies around %s hands to flicker.\n", wiz->name, pro_his(wiz->gender));
269 		PrintMsg2(cnum, "The Anti-Spell jolts you, interrupting the flow of magical energy in your hands.\n", exbuf2);
270 
271 		write_gestures(self, wiz, Gesture_ANTISPELL, Gesture_ANTISPELL);
272 	    }
273 	}
274     }
275 
276     if (zapl[SP__DELAYED_EFFECT]) {
277 	if (zapl[SP__REMOVE_ENCHANTMENT]) {
278 	    /* cancelled */
279 	    sprintf(exbuf2, "The Delayed Effect fizzes away into nothing as it approaches %s.\n", fred->both.name);
280 	    if (wizflag)
281 		PrintMsg2(cnum, "The Delayed Effect fizzes away into nothing as it approaches you.\n", exbuf2);
282 	    else
283 		PrintMsg(exbuf2);
284 	}
285 	else {
286 	    if (!wizflag) {
287 		sprintf(exbuf, "The Delayed Effect whizzes through %s without any effect.\n", fred->both.name);
288 		PrintMsg(exbuf);
289 	    }
290 	    else {
291 		struct wizard *wiz = &(fred->wiz);
292 		sprintf(exbuf2, "The Delayed Effect spreads out around %s.\n", wiz->name);
293 		PrintMsg2(cnum, "The Delayed Effect spreads out in a cloud around you, waiting for you to complete a spell.\n", exbuf2);
294 		wiz->delay_time = 4;
295 	    }
296 	}
297     }
298 
299     if (zapl[SP__PERMANENCY]) {
300 	if (zapl[SP__REMOVE_ENCHANTMENT]) {
301 	    /* cancelled */
302 	    sprintf(exbuf2, "The Permanency fizzes away into nothing as it approaches %s.\n", fred->both.name);
303 	    if (wizflag)
304 		PrintMsg2(cnum, "The Permanency fizzes away into nothing as it approaches you.\n", exbuf2);
305 	    else
306 		PrintMsg(exbuf2);
307 	}
308 	else {
309 	    if (!wizflag) {
310 		sprintf(exbuf, "The Permanency whizzes through %s without any effect.\n", fred->both.name);
311 		PrintMsg(exbuf);
312 	    }
313 	    else {
314 		struct wizard *wiz = &(fred->wiz);
315 		sprintf(exbuf2, "The Permanency spreads out around %s.\n", wiz->name);
316 		PrintMsg2(cnum, "The Permanency spreads out in a cloud around you, waiting for you to complete a spell.\n", exbuf2);
317 		wiz->perm_time = 4;
318 	    }
319 	}
320     }
321 
322     if (zapl[SP__BLINDNESS] || perm->fl_blindness) {
323 	if (fred->both.blindness == 0) {
324 	    /* not yet blind */
325 	    sprintf(exbuf2, "%s blinks, then stumbles slightly as %s eyes turn milky.\n", fred->both.name, pro_his(fred->both.gender));
326 	    if (wizflag)
327 		PrintMsg2(cnum, "A haze suddenly appears before your eyes. The world dims rapidly, and you are shortly enveloped in total darkness.\n", exbuf2);
328 	    else
329 		PrintMsg(exbuf2);
330 	    fred->both.blindness = 4;
331 	}
332 	else {
333 	    sprintf(exbuf2, "%s is still blind.\n", fred->both.name);
334 	    if (wizflag)
335 		PrintMsg2(cnum, "You are still blind.\n", exbuf2);
336 	    else
337 		PrintMsg(exbuf2);
338 	    fred->both.blindness = 4;
339 	}
340     }
341 
342     if (fred->both.blindness) {
343 	fred->both.blindness--;
344 	if (fred->both.blindness==0) {
345 	    sprintf(exbuf2, "The milky cast fades from %s's eyes.\n", fred->both.name);
346 	    if (wizflag)
347 		PrintMsg2(cnum, "The dark veil falls away from your eyes.\n", exbuf2);
348 	    else
349 		PrintMsg(exbuf2);
350 	}
351     }
352 
353     if (zapl[SP__INVISIBILITY] || perm->fl_invisibility) {
354 	if (fred->both.invisibility == 0) {
355 	    /* not yet invisible */
356 	    sprintf(exbuf2, "%s turns quietly translucent, and fades from view.\n", fred->both.name);
357 	    if (wizflag)
358 		PrintMsg2(cnum, "The world becomes strangely misted in front of your eyes. Looking down, you see that your hands are no longer visible.\n", exbuf2);
359 	    else
360 		PrintMsg(exbuf2);
361 	    fred->both.invisibility = 4;
362 	}
363 	else {
364 	    sprintf(exbuf2, "%s is still invisible.\n", fred->both.name);
365 	    if (wizflag)
366 		PrintMsg2(cnum, "You are still invisible.\n", exbuf2);
367 	    else
368 		PrintMsg(exbuf2);
369 	    fred->both.invisibility = 4;
370 	}
371     }
372 
373     if (fred->both.invisibility) {
374 	fred->both.invisibility--;
375 	if (fred->both.invisibility==0) {
376 	    sprintf(exbuf2, "A %s-shaped shadow appears, and %s rapidly becomes fully visible.\n", fred->both.name, pro_he(fred->both.gender));
377 	    if (wizflag)
378 		PrintMsg2(cnum, "Your limbs have become visible again.\n", exbuf2);
379 	    else
380 		PrintMsg(exbuf2);
381 	}
382     }
383 
384     if (zapl[SP__HASTE] || perm->fl_haste) {
385 	if (fred->both.haste == 0) {
386 	    /* not yet hasted */
387 	    fred->both.haste = 5;
388 	}
389 	else {
390 	    fred->both.haste = 4;
391 	}
392     }
393 
394     if (zapl[SP__TIME_STOP]) {
395 	fred->both.timestop = 2;
396 	/* no message -- that's done later */
397     }
398 
399     if (zapl[SP__REMOVE_ENCHANTMENT] || self->fl_dispelmagic) {
400 	/* remove enchantments is obviously last. takes out mind_* also, and nowm_* for monsters. */
401 
402 	if (zapl[SP__REMOVE_ENCHANTMENT]) {
403 	    sprintf(exbuf2, "The Remove Enchantment whirls its dissipative energies around %s.\n", fred->both.name);
404 	    if (wizflag)
405 		PrintMsg2(cnum, "The Remove Enchantment whirls its dissipative energies around you.\n", exbuf2);
406 	    else
407 		PrintMsg(exbuf2);
408 	}
409 
410 	if (fred->both.mind_spell != (-1)) {
411 	    sprintf(exbuf, "You are freed of the %s.\n", spelllist[fred->both.mind_spell].name);
412 	    sprintf(exbuf2, "%s is freed of the %s.\n", fred->both.name, spelllist[fred->both.mind_spell].name);
413 	    if (wizflag)
414 		PrintMsg2(cnum, exbuf, exbuf2);
415 	    else
416 		PrintMsg(exbuf2);
417 	    fred->both.mind_spell = (-1);
418 	}
419 	if (!wizflag) {
420 	    struct creature *thud = &(fred->cre);
421 	    if (thud->nowm_spell != (-1)) {
422 		sprintf(exbuf2, "%s is freed of the %s.\n", thud->name, spelllist[thud->nowm_spell].name);
423 		PrintMsg(exbuf2);
424 		thud->nowm_spell = (-1);
425 	    }
426 	}
427 
428 	if (fred->both.resistant_heat) {
429 	    sprintf(exbuf, "Your blue aura of Resist Heat fades away.\n");
430 	    sprintf(exbuf2, "%s's blue aura of Resist Heat fades away.\n", fred->both.name);
431 	    if (wizflag)
432 		PrintMsg2(cnum, exbuf, exbuf2);
433 	    else
434 		PrintMsg(exbuf2);
435 	}
436 	fred->both.resistant_heat = 0;
437 	fred->both.fl_resist_heat = 0;
438 
439 	if (fred->both.resistant_cold) {
440 	    sprintf(exbuf, "Your pink aura of Resist Cold fades away.\n");
441 	    sprintf(exbuf2, "%s's pink aura of Resist Cold fades away.\n", fred->both.name);
442 	    if (wizflag)
443 		PrintMsg2(cnum, exbuf, exbuf2);
444 	    else
445 		PrintMsg(exbuf2);
446 	}
447 	fred->both.resistant_cold = 0;
448 	fred->both.fl_resist_cold = 0;
449 
450 	if (fred->both.disease_time != (-1)) {
451 	    sprintf(exbuf2, "%s seems to have stopped shivering, and %s skin is no longer flushed and damp.\n", fred->both.name, pro_his(fred->both.gender));
452 	    if (wizflag)
453 		PrintMsg2(cnum, "Your fever suddenly abates. You feel much better.\n", exbuf2);
454 	    else
455 		PrintMsg(exbuf2);
456 	    fred->both.disease_time = (-1);
457 	}
458 
459 	if (fred->both.poison_time != (-1)) {
460 	    sprintf(exbuf2, "%s's color improves dramatically.\n", fred->both.name);
461 	    if (wizflag)
462 		PrintMsg2(cnum, "The numbness and heaviness falls from your limbs. You feel much better.\n", exbuf2);
463 	    else
464 		PrintMsg(exbuf2);
465 	    fred->both.poison_time = (-1);
466 	}
467 
468 	if (wizflag) {
469 	    if (fred->wiz.delay_time != 0) {
470 		sprintf(exbuf2, "The Delayed Effect spell hovering around %s disintegrates.\n", fred->both.name);
471 		if (wizflag)
472 		    PrintMsg2(cnum, "The Delayed Effect spell hovering around you disintegrates.\n", exbuf2);
473 		else
474 		    PrintMsg(exbuf2);
475 		fred->wiz.delay_time = 0;
476 	    }
477 	    /* and kill any banked spell */
478 	    if (fred->wiz.delay_bank != (-1)) {
479 		sprintf(exbuf, "The %s spell that you had caught in a Delayed Effect is lost.\n", spelllist[fred->wiz.delay_bank].name);
480 		sprintf(exbuf2, "The %s spell that %s had caught in a Delayed Effect is lost.\n", spelllist[fred->wiz.delay_bank].name, fred->wiz.name);
481 		PrintMsg2(cnum, exbuf, exbuf2);
482 		fred->wiz.delay_bank = (-1);
483 	    }
484 	}
485 
486 	if (wizflag) {
487 	    if (fred->wiz.perm_time != 0) {
488 		sprintf(exbuf2, "The Permanency spell hovering around %s disintegrates.\n", fred->both.name);
489 		if (wizflag)
490 		    PrintMsg2(cnum, "The Permanency spell hovering around you disintegrates.\n", exbuf2);
491 		else
492 		    PrintMsg(exbuf2);
493 		fred->wiz.perm_time = 0;
494 	    }
495 	}
496 
497 	if (fred->both.prot_from_evil) {
498 	    sprintf(exbuf2, "%s's circle of Protection flickers out.\n", fred->both.name);
499 	    if (wizflag)
500 		PrintMsg2(cnum, "Your circle of Protection flickers out.\n", exbuf2);
501 	    else
502 		PrintMsg(exbuf2);
503 	    fred->both.prot_from_evil = 0;
504 	}
505 
506 	if (fred->both.zaplist[SP__SHIELD] >= 64) {
507 	    fred->both.zaplist[SP__SHIELD] -= 64;
508 	}
509 
510 	if (fred->both.haste) {
511 	    if (fred->both.haste!=5) {
512 		sprintf(exbuf, "%s slows down to normal speed.\n", fred->both.name);
513 		if (wizflag)
514 		    PrintMsg2(cnum, "Everyone comes back up to normal speed.\n", exbuf);
515 		else
516 		    PrintMsg(exbuf);
517 	    }
518 	    else {
519 		sprintf(exbuf, "The Haste on %s is nulled.\n", fred->both.name);
520 		if (wizflag)
521 		    PrintMsg2(cnum, "The Haste on you is nulled.\n", exbuf);
522 		else
523 		    PrintMsg(exbuf);
524 	    }
525 	    fred->both.haste = 0;
526 	}
527 
528 	if (fred->both.timestop) {
529 	    sprintf(exbuf, "The Time Stop on %s is nulled.\n", fred->both.name);
530 	    if (wizflag)
531 		PrintMsg2(cnum, "The Time Stop on you is nulled.\n", exbuf);
532 	    else
533 		PrintMsg(exbuf);
534 	    fred->both.timestop = 0;
535 	}
536 
537 	if (fred->both.invisibility) {
538 	    sprintf(exbuf2, "%s becomes visible again, rather suddenly.\n", fred->both.name);
539 	    if (wizflag)
540 		PrintMsg2(cnum, "Your body tingles and becomes visible again.\n", exbuf2);
541 	    else
542 		PrintMsg(exbuf2);
543 	    fred->both.invisibility = 0;
544 	}
545 
546 	if (fred->both.blindness) {
547 	    sprintf(exbuf2, "%s's eyes abruptly clear.\n", fred->both.name);
548 	    if (wizflag)
549 		PrintMsg2(cnum, "Sight bursts in upon you again.\n", exbuf2);
550 	    else
551 		PrintMsg(exbuf2);
552 	    fred->both.blindness = 0;
553 	}
554 
555 	clear_permstats(&(fred->both.perm));
556 
557     }
558 }
559 
exec_attacks(self,fred,cnum,wizflag)560 void exec_attacks(self, fred, cnum, wizflag) /* no deaders */
561 struct realgame *self;
562 union being *fred;
563 int cnum;
564 int wizflag;
565 {
566     int *zapl = fred->both.zaplist;
567     /* counterspell, dispel magic, magic mirror have already been taken care of. */
568 
569     if (zapl[SP__STAB]) {
570 	if (zapl[SP__SHIELD]) {
571 	    /* shield protects */
572 	    if (zapl[SP__STAB]==1) {
573 		sprintf(exbuf2, "The knife slides off of %s's Shield.\n", fred->both.name);
574 		if (wizflag)
575 		    PrintMsg2(cnum, "The knife slides off of your Shield.\n", exbuf2);
576 		else
577 		    PrintMsg(exbuf2);
578 	    }
579 	    else {
580 		sprintf(exbuf2, "The knives slide off of %s's Shield.\n", fred->both.name);
581 		if (wizflag)
582 		    PrintMsg2(cnum, "The knives slide off of your Shield.\n", exbuf2);
583 		else
584 		    PrintMsg(exbuf2);
585 	    }
586 	}
587 	else {
588 	    /* hit */
589 	    if (zapl[SP__STAB]==1) {
590 		sprintf(exbuf2, "The knife strikes %s.\n", fred->both.name);
591 		if (wizflag)
592 		    PrintMsg2(cnum, "The knife strikes you.\n", exbuf2);
593 		else
594 		    PrintMsg(exbuf2);
595 	    }
596 	    else {
597 		sprintf(exbuf, "The %s knives strike you.\n", number_name(zapl[SP__STAB]));
598 		sprintf(exbuf2, "The %s knives strike %s.\n", number_name(zapl[SP__STAB]), fred->both.name);
599 		if (wizflag)
600 		    PrintMsg2(cnum, exbuf, exbuf2);
601 		else
602 		    PrintMsg(exbuf2);
603 	    }
604 	    fred->both.hitpoints -= 1*zapl[SP__STAB];
605 	}
606     }
607 
608     if (zapl[SP__MISSILE]) {
609 	if (zapl[SP__SHIELD]) {
610 	    /* shield protects */
611 	    if (zapl[SP__MISSILE]==1) {
612 		sprintf(exbuf2, "The Missile shatters on %s's Shield.\n", fred->both.name);
613 		if (wizflag)
614 		    PrintMsg2(cnum, "The Missile shatters on your Shield.\n", exbuf2);
615 		else
616 		    PrintMsg(exbuf2);
617 	    }
618 	    else {
619 		sprintf(exbuf2, "The Missiles shatter on %s's Shield.\n", fred->both.name);
620 		if (wizflag)
621 		    PrintMsg2(cnum, "The Missiles shatter on your Shield.\n", exbuf2);
622 		else
623 		    PrintMsg(exbuf2);
624 	    }
625 	}
626 	else {
627 	    /* hit */
628 	    if (zapl[SP__MISSILE]==1) {
629 		sprintf(exbuf2, "The Missile strikes %s.\n", fred->both.name);
630 		if (wizflag)
631 		    PrintMsg2(cnum, "The Missile strikes you.\n", exbuf2);
632 		else
633 		    PrintMsg(exbuf2);
634 	    }
635 	    else {
636 		sprintf(exbuf, "The %s Missiles strike you.\n", number_name(zapl[SP__MISSILE]));
637 		sprintf(exbuf2, "The %s Missiles strike %s.\n", number_name(zapl[SP__MISSILE]), fred->both.name);
638 		if (wizflag)
639 		    PrintMsg2(cnum, exbuf, exbuf2);
640 		else
641 		    PrintMsg(exbuf2);
642 	    }
643 	    fred->both.hitpoints -= 1*zapl[SP__MISSILE];
644 	}
645     }
646 
647     if (zapl[SP__CAUSE_LIGHT_WOUNDS]) {
648 	/* hit */
649 	if (zapl[SP__CAUSE_LIGHT_WOUNDS]==1) {
650 	    sprintf(exbuf2, "The Cause Light Wounds spell tears into %s.\n", fred->both.name);
651 	    if (wizflag)
652 		PrintMsg2(cnum, "The Cause Light Wounds spell tears into you.\n", exbuf2);
653 	    else
654 		PrintMsg(exbuf2);
655 	}
656 	else {
657 	    sprintf(exbuf, "The %s Cause Light Wounds spells tear into you.\n", number_name(zapl[SP__CAUSE_LIGHT_WOUNDS]));
658 	    sprintf(exbuf2, "The %s Cause Light Wounds spells tear into %s.\n", number_name(zapl[SP__CAUSE_LIGHT_WOUNDS]), fred->both.name);
659 	    if (wizflag)
660 		PrintMsg2(cnum, exbuf, exbuf2);
661 	    else
662 		PrintMsg(exbuf2);
663 	}
664 	fred->both.hitpoints -= 2*zapl[SP__CAUSE_LIGHT_WOUNDS];
665     }
666 
667     if (zapl[SP__CAUSE_HEAVY_WOUNDS]) {
668 	/* hit */
669 	if (zapl[SP__CAUSE_HEAVY_WOUNDS]==1) {
670 	    sprintf(exbuf2, "The Cause Heavy Wounds spell tears into %s.\n", fred->both.name);
671 	    if (wizflag)
672 		PrintMsg2(cnum, "The Cause Heavy Wounds spell tears painfully into you.\n", exbuf2);
673 	    else
674 		PrintMsg(exbuf2);
675 	}
676 	else {
677 	    sprintf(exbuf, "The %s Cause Heavy Wounds spells tear painfully into you.\n", number_name(zapl[SP__CAUSE_HEAVY_WOUNDS]));
678 	    sprintf(exbuf2, "The %s Cause Heavy Wounds spells tear into %s.\n", number_name(zapl[SP__CAUSE_HEAVY_WOUNDS]), fred->both.name);
679 	    if (wizflag)
680 		PrintMsg2(cnum, exbuf, exbuf2);
681 	    else
682 		PrintMsg(exbuf2);
683 	}
684 	fred->both.hitpoints -= 3*zapl[SP__CAUSE_HEAVY_WOUNDS];
685     }
686 
687     if (zapl[SP__LIGHTNING_BOLT]) {
688 	/* hit */
689 	if (zapl[SP__LIGHTNING_BOLT]==1) {
690 	    sprintf(exbuf2, "The Lightning Bolt staggers %s.\n", fred->both.name);
691 	    if (wizflag)
692 		PrintMsg2(cnum, "The Lightning Bolt strikes you, staggering and nearly deafening you.\n", exbuf2);
693 	    else
694 		PrintMsg(exbuf2);
695 	}
696 	else {
697 	    sprintf(exbuf, "The %s Lightning Bolts crash into you; the concussions nearly knock you off your feet.\n", number_name(zapl[SP__LIGHTNING_BOLT]));
698 	    sprintf(exbuf2, "The %s Lightning Bolts strike %s, staggering %s.\n", number_name(zapl[SP__LIGHTNING_BOLT]), fred->both.name, pro_him(fred->both.gender));
699 	    if (wizflag)
700 		PrintMsg2(cnum, exbuf, exbuf2);
701 	    else
702 		PrintMsg(exbuf2);
703 	}
704 	fred->both.hitpoints -= 5*zapl[SP__LIGHTNING_BOLT];
705     }
706 
707     if (zapl[SP__FIREBALL]) {
708 	if (fred->both.fl_resist_heat) {
709 	    /* heat-resistant */
710 	    if (zapl[SP__FIREBALL]==1) {
711 		sprintf(exbuf2, "The Fireball strikes %s, but the flames slide off %s Resist Heat aura.\n", fred->both.name, pro_his(fred->both.gender));
712 		if (wizflag)
713 		    PrintMsg2(cnum, "The Fireball strikes you, but you feel only a slight warmth.\n", exbuf2);
714 		else
715 		    PrintMsg(exbuf2);
716 	    }
717 	    else {
718 		sprintf(exbuf2, "The Fireballs strike %s, but the flames slide off %s Resist Heat aura.\n", fred->both.name, pro_his(fred->both.gender));
719 		if (wizflag)
720 		    PrintMsg2(cnum, "The Fireballs strike you, but you feel only a slight warmth.\n", exbuf2);
721 		else
722 		    PrintMsg(exbuf2);
723 	    }
724 	}
725 	else {
726 	    /* hit */
727 	    if (zapl[SP__FIREBALL]==1) {
728 		sprintf(exbuf2, "The Fireball strikes %s.\n", fred->both.name);
729 		if (wizflag)
730 		    PrintMsg2(cnum, "The Fireball strikes you with a roar of flame.\n", exbuf2);
731 		else
732 		    PrintMsg(exbuf2);
733 	    }
734 	    else {
735 		sprintf(exbuf, "The %s Fireballs blast into you, surrounding you with blinding flame.\n", number_name(zapl[SP__FIREBALL]));
736 		sprintf(exbuf2, "The %s Fireballs strike %s.\n", number_name(zapl[SP__FIREBALL]), fred->both.name);
737 		if (wizflag)
738 		    PrintMsg2(cnum, exbuf, exbuf2);
739 		else
740 		    PrintMsg(exbuf2);
741 	    }
742 	    fred->both.hitpoints -= 5*zapl[SP__FIREBALL];
743 	}
744     }
745 
746     if (self->fl_firestorm) {
747 	if (zapl[SP__COUNTER_SPELL]) {
748 	    /* counterspelled */
749 	    sprintf(exbuf2, "The Counter-Spell around %s cancels the Fire Storm near %s.\n", fred->both.name, pro_him(fred->both.gender));
750 	    if (wizflag)
751 		PrintMsg2(cnum, "The Counter-Spell cancels the Fire Storm in your vicinity.\n", exbuf2);
752 	    else
753 		PrintMsg(exbuf2);
754 	}
755 	else if (fred->both.fl_resist_heat) {
756 	    /* heat-resistant */
757 	    sprintf(exbuf2, "The Fire Storm washes over %s, who remains unharmed inside %s blue aura.\n", fred->both.name, pro_his(fred->both.gender));
758 	    if (wizflag)
759 		PrintMsg2(cnum, "The Fire Storm washes over you, but you feel only a gentle warmth.\n", exbuf2);
760 	    else
761 		PrintMsg(exbuf2);
762 	}
763 	else {
764 	    /* hit */
765 	    sprintf(exbuf2, "The Fire Storm washes over %s.\n", fred->both.name);
766 	    if (wizflag)
767 		PrintMsg2(cnum, "The Fire Storm washes over you.\n", exbuf2);
768 	    else
769 		PrintMsg(exbuf2);
770 	    fred->both.hitpoints -= 5;
771 	}
772     }
773 
774     if (self->fl_icestorm) {
775 	if (zapl[SP__COUNTER_SPELL]) {
776 	    /* counterspelled */
777 	    sprintf(exbuf2, "The Counter-Spell around %s cancels the Ice Storm near %s.\n", fred->both.name, pro_him(fred->both.gender));
778 	    if (wizflag)
779 		PrintMsg2(cnum, "The Counter-Spell cancels the Ice Storm in your vicinity.\n", exbuf2);
780 	    else
781 		PrintMsg(exbuf2);
782 	}
783 	else if (fred->both.fl_resist_icestorm) {
784 	    /* resistant due to fireball hit -- message already printed */
785 	}
786 	else if (fred->both.fl_resist_cold) {
787 	    /* cold-resistant */
788 	    sprintf(exbuf2, "The Ice Storm washes over %s, who remains unharmed inside %s pink aura.\n", fred->both.name, pro_his(fred->both.gender));
789 	    if (wizflag)
790 		PrintMsg2(cnum, "The Ice Storm washes over you, but you feel only a gentle coolness.\n", exbuf2);
791 	    else
792 		PrintMsg(exbuf2);
793 	}
794 	else {
795 	    /* hit */
796 	    sprintf(exbuf2, "The Ice Storm lashes at %s.\n", fred->both.name);
797 	    if (wizflag)
798 		PrintMsg2(cnum, "The Ice Storm lashes at you.\n", exbuf2);
799 	    else
800 		PrintMsg(exbuf2);
801 	    fred->both.hitpoints -= 5;
802 	}
803     }
804 
805     if (zapl[SP__FINGER_OF_DEATH]) {
806 	/* hit */
807 	sprintf(exbuf2, "%s turns very pale and drops to %s knees, clutching at %s chest....\n", fred->both.name, pro_his(fred->both.gender), pro_his(fred->both.gender));
808 	if (wizflag)
809 	    PrintMsg2(cnum, "You feel a sudden pressure in your chest, as if an iron band was squeezing your heart. You fall to your knees as the world dims....\n", exbuf2);
810 	else
811 	    PrintMsg(exbuf2);
812 	fred->both.hitpoints = (-100);
813     }
814 
815 
816 }
817 
exec_heals(self,fred,cnum,wizflag)818 void exec_heals(self, fred, cnum, wizflag) /* deaders ARE allowed */
819 struct realgame *self;
820 union being *fred;
821 int cnum;
822 int wizflag;
823 {
824     int *zapl = fred->both.zaplist;
825     int orighp;
826     /* counterspell, dispel magic, magic mirror have already been taken care of. */
827 
828     if (fred->both.alive) {
829 	orighp = fred->both.hitpoints;
830 
831 	if (zapl[SP__CURE_LIGHT_WOUNDS]) {
832 	    if (zapl[SP__CURE_LIGHT_WOUNDS]==1) {
833 		sprintf(exbuf2, "The Cure Light Wounds spell weaves around %s, and %s wounds fade.\n", fred->both.name, pro_his(fred->both.gender));
834 		if (wizflag)
835 		    PrintMsg2(cnum, "The Cure Light Wounds spell weaves around you, and the pain of your wounds lessens.\n", exbuf2);
836 		else
837 		    PrintMsg(exbuf2);
838 	    }
839 	    else {
840 		sprintf(exbuf, "The %s Cure Light Wounds spells weave around you, and the pain of your wounds lessens.\n", number_name(zapl[SP__CURE_LIGHT_WOUNDS]));
841 		sprintf(exbuf2, "The %s Cure Light Wounds spells weave around %s, and %s wounds fade.\n", number_name(zapl[SP__CURE_LIGHT_WOUNDS]), fred->both.name, pro_his(fred->both.gender));
842 		if (wizflag)
843 		    PrintMsg2(cnum, exbuf, exbuf2);
844 		else
845 		    PrintMsg(exbuf2);
846 	    }
847 	    fred->both.hitpoints += 1*zapl[SP__CURE_LIGHT_WOUNDS];
848 
849 	}
850 
851 	if (zapl[SP__CURE_HEAVY_WOUNDS]) {
852 	    if (zapl[SP__CURE_HEAVY_WOUNDS]==1) {
853 		sprintf(exbuf2, "The Cure Heavy Wounds spell weaves around %s, and %s wounds heal.\n", fred->both.name, pro_his(fred->both.gender));
854 		if (wizflag)
855 		    PrintMsg2(cnum, "The Cure Heavy Wounds spell weaves around you, and your wounds heal considerably.\n", exbuf2);
856 		else
857 		    PrintMsg(exbuf2);
858 	    }
859 	    else {
860 		sprintf(exbuf, "The %s Cure Heavy Wounds spells weave around you, and your wounds heal considerably.\n", number_name(zapl[SP__CURE_HEAVY_WOUNDS]));
861 		sprintf(exbuf2, "The %s Cure Heavy Wounds spells weave around %s, and %s wounds heal.\n", number_name(zapl[SP__CURE_HEAVY_WOUNDS]), fred->both.name, pro_his(fred->both.gender));
862 		if (wizflag)
863 		    PrintMsg2(cnum, exbuf, exbuf2);
864 		else
865 		    PrintMsg(exbuf2);
866 	    }
867 	    fred->both.hitpoints += 2*zapl[SP__CURE_HEAVY_WOUNDS];
868 
869 	    /* cure disease (not poison) */
870 	    if (fred->both.disease_time != (-1)) {
871 		sprintf(exbuf2, "%s seems to have stopped shivering, and %s skin is no longer flushed and damp.\n", fred->both.name, pro_his(fred->both.gender));
872 		if (wizflag)
873 		    PrintMsg2(cnum, "Your fever suddenly abates. You feel much better.\n", exbuf2);
874 		else
875 		    PrintMsg(exbuf2);
876 		fred->both.disease_time = (-1);
877 	    }
878 	}
879 
880 	if (zapl[SP__RAISE_DEAD]) {
881 	    if (zapl[SP__RAISE_DEAD]==1) {
882 		sprintf(exbuf2, "The Raise Dead spell burns through %s. Although %s is not dead, the spell has a powerful healing effect.\n", fred->both.name, pro_he(fred->both.gender));
883 		if (wizflag)
884 		    PrintMsg2(cnum, "The Raise Dead spell burns through you. Although you aren't dead, the spell has a powerful healing influence.\n", exbuf2);
885 		else
886 		    PrintMsg(exbuf2);
887 	    }
888 	    else {
889 		sprintf(exbuf, "The %s Raise Dead spells burn through you. Although you aren't dead, the spells have a powerful healing influence.\n", number_name(zapl[SP__RAISE_DEAD]));
890 		sprintf(exbuf2, "The %s Raise Dead spells burn through %s. Although %s is not dead, the spells have a powerful healing effect.\n", number_name(zapl[SP__RAISE_DEAD]), fred->both.name, pro_he(fred->both.gender));
891 		if (wizflag)
892 		    PrintMsg2(cnum, exbuf, exbuf2);
893 		else
894 		    PrintMsg(exbuf2);
895 	    }
896 	    fred->both.hitpoints += 5*zapl[SP__RAISE_DEAD];
897 
898 	}
899 
900 	if ((fred->both.hitpoints > fred->both.max_hitpoints)
901 	    || (fred->both.hitpoints == fred->both.max_hitpoints && fred->both.hitpoints != orighp)) {
902 	    fred->both.hitpoints = fred->both.max_hitpoints;
903 	    sprintf(exbuf2, "%s is in perfect health again.\n", fred->both.name);
904 	    if (wizflag)
905 		PrintMsg2(cnum, "You are in perfect health again.\n", exbuf2);
906 	    else
907 		PrintMsg(exbuf2);
908 	}
909     }
910     else {
911 	/* not alive */
912 	if (zapl[SP__RAISE_DEAD]) {
913 	    sprintf(exbuf2, "%s twitches, glows, and then jumps to %s feet! Except for a bit of incipient mold, %s is in perfect health again.\n", fred->both.name, pro_his(fred->both.gender), pro_he(fred->both.gender));
914 	    if (wizflag)
915 		PrintMsg2(cnum, "You are suddenly aware of a blast of energy running down every nerve! This is something of a shock, since you had just gotten used to being dead. Oh, well -- you'll be back eventually.\n", exbuf2);
916 	    else
917 		PrintMsg(exbuf2);
918 	    fred->both.alive = 1;
919 	    fred->both.hitpoints = fred->both.max_hitpoints;
920 	    clear_out_spells(fred, wizflag);
921 	    if (!wizflag) {
922 		fred->cre.nocorpse = 0;
923 		fred->cre.owner = fred->both.raisedead_caster;
924 	    }
925 	    else {
926 	    }
927 	}
928     }
929 }
930