Fandom

Wikihack

Source:NetHack 3.4.0/wizard.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to wizard.c from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/wizard.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)wizard.c	3.4	2001/12/06	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
6.    /*	       - heavily modified to give the wiz balls.  (genat!mike)   */
7.    /*	       - dewimped and given some maledictions. -3. */
8.    /*	       - generalized for 3.1 (mike@bullns.on01.bull.ca) */
9.    
10.   #include "hack.h"
11.   #include "qtext.h"
12.   
13.   #ifdef OVLB
14.   
15.   STATIC_DCL short FDECL(which_arti, (int));
16.   STATIC_DCL boolean FDECL(mon_has_arti, (struct monst *,SHORT_P));
17.   STATIC_DCL struct monst *FDECL(other_mon_has_arti, (struct monst *,SHORT_P));
18.   STATIC_DCL struct obj *FDECL(on_ground, (SHORT_P));
19.   STATIC_DCL boolean FDECL(you_have, (int));
20.   STATIC_DCL long FDECL(target_on, (int,struct monst *));
21.   STATIC_DCL long FDECL(strategy, (struct monst *));
22.   
23.   static NEARDATA const int nasties[] = {
24.   	PM_COCKATRICE, PM_ETTIN, PM_STALKER, PM_MINOTAUR, PM_RED_DRAGON,
25.   	PM_BLACK_DRAGON, PM_GREEN_DRAGON, PM_OWLBEAR, PM_PURPLE_WORM,
26.   	PM_ROCK_TROLL, PM_XAN, PM_GREMLIN, PM_UMBER_HULK, PM_VAMPIRE_LORD,
27.   	PM_XORN, PM_ZRUTY, PM_ELF_LORD, PM_ELVENKING, PM_YELLOW_DRAGON,
28.   	PM_LEOCROTTA, PM_BALUCHITHERIUM, PM_CARNIVOROUS_APE, PM_FIRE_GIANT,
29.   	PM_COUATL, PM_CAPTAIN, PM_WINGED_GARGOYLE, PM_MASTER_MIND_FLAYER,
30.   	PM_FIRE_ELEMENTAL, PM_JABBERWOCK, PM_ARCH_LICH, PM_OGRE_KING,
31.   	PM_OLOG_HAI, PM_IRON_GOLEM, PM_OCHRE_JELLY, PM_GREEN_SLIME,
32.   	PM_DISENCHANTER
33.   	};
34.   
35.   static NEARDATA const unsigned wizapp[] = {
36.   	PM_HUMAN, PM_WATER_DEMON, PM_VAMPIRE,
37.   	PM_RED_DRAGON, PM_TROLL, PM_UMBER_HULK,
38.   	PM_XORN, PM_XAN, PM_COCKATRICE,
39.   	PM_FLOATING_EYE,
40.   	PM_GUARDIAN_NAGA,
41.   	PM_TRAPPER
42.   };
43.   
44.   #endif /* OVLB */
45.   #ifdef OVL0
46.   
47.   /* If you've found the Amulet, make the Wizard appear after some time */
48.   /* Also, give hints about portal locations, if amulet is worn/wielded -dlc */
49.   void
50.   amulet()
51.   {
52.   	struct monst *mtmp;
53.   	struct trap *ttmp;
54.   	struct obj *amu;
55.   
56.   #if 0		/* caller takes care of this check */
57.   	if (!u.uhave.amulet)
58.   		return;
59.   #endif
60.   	if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR) ||
61.   	     ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR))
62.   	    && !rn2(15)) {
63.   	    for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) {
64.   		if(ttmp->ttyp == MAGIC_PORTAL) {
65.   		    int du = distu(ttmp->tx, ttmp->ty);
66.   		    if (du <= 9)
67.   			pline("%s hot!", Tobjnam(amu, "feel"));
68.   		    else if (du <= 64)
69.   			pline("%s very warm.", Tobjnam(amu, "feel"));
70.   		    else if (du <= 144)
71.   			pline("%s warm.", Tobjnam(amu, "feel"));
72.   		    /* else, the amulet feels normal */
73.   		    break;
74.   		}
75.   	    }
76.   	}
77.   
78.   	if (!flags.no_of_wizards)
79.   		return;
80.   	/* find Wizard, and wake him if necessary */
81.   	for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
82.   	    if (!DEADMONSTER(mtmp) && mtmp->iswiz && mtmp->msleeping && !rn2(40)) {
83.   		mtmp->msleeping = 0;
84.   		if (distu(mtmp->mx,mtmp->my) > 2)
85.   		    You(
86.       "get the creepy feeling that somebody noticed your taking the Amulet."
87.   		    );
88.   		return;
89.   	    }
90.   }
91.   
92.   #endif /* OVL0 */
93.   #ifdef OVLB
94.   
95.   int
96.   mon_has_amulet(mtmp)
97.   register struct monst *mtmp;
98.   {
99.   	register struct obj *otmp;
100.  
101.  	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
102.  		if(otmp->otyp == AMULET_OF_YENDOR) return(1);
103.  	return(0);
104.  }
105.  
106.  int
107.  mon_has_special(mtmp)
108.  register struct monst *mtmp;
109.  {
110.  	register struct obj *otmp;
111.  
112.  	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
113.  		if(otmp->otyp == AMULET_OF_YENDOR ||
114.  			is_quest_artifact(otmp) ||
115.  			otmp->otyp == BELL_OF_OPENING ||
116.  			otmp->otyp == CANDELABRUM_OF_INVOCATION ||
117.  			otmp->otyp == SPE_BOOK_OF_THE_DEAD) return(1);
118.  	return(0);
119.  }
120.  
121.  /*
122.   *	New for 3.1  Strategy / Tactics for the wiz, as well as other
123.   *	monsters that are "after" something (defined via mflag3).
124.   *
125.   *	The strategy section decides *what* the monster is going
126.   *	to attempt, the tactics section implements the decision.
127.   */
128.  #define STRAT(w, x, y, typ) (w | ((long)(x)<<16) | ((long)(y)<<8) | (long)typ)
129.  
130.  #define M_Wants(mask)	(mtmp->data->mflags3 & (mask))
131.  
132.  STATIC_OVL short
133.  which_arti(mask)
134.  	register int mask;
135.  {
136.  	switch(mask) {
137.  	    case M3_WANTSAMUL:	return(AMULET_OF_YENDOR);
138.  	    case M3_WANTSBELL:	return(BELL_OF_OPENING);
139.  	    case M3_WANTSCAND:	return(CANDELABRUM_OF_INVOCATION);
140.  	    case M3_WANTSBOOK:	return(SPE_BOOK_OF_THE_DEAD);
141.  	    default:		break;	/* 0 signifies quest artifact */
142.  	}
143.  	return(0);
144.  }
145.  
146.  /*
147.   *	If "otyp" is zero, it triggers a check for the quest_artifact,
148.   *	since bell, book, candle, and amulet are all objects, not really
149.   *	artifacts right now.	[MRS]
150.   */
151.  STATIC_OVL boolean
152.  mon_has_arti(mtmp, otyp)
153.  	register struct monst *mtmp;
154.  	register short	otyp;
155.  {
156.  	register struct obj *otmp;
157.  
158.  	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
159.  	    if(otyp) {
160.  		if(otmp->otyp == otyp)
161.  			return(1);
162.  	    }
163.  	     else if(is_quest_artifact(otmp)) return(1);
164.  	}
165.  	return(0);
166.  
167.  }
168.  
169.  STATIC_OVL struct monst *
170.  other_mon_has_arti(mtmp, otyp)
171.  	register struct monst *mtmp;
172.  	register short	otyp;
173.  {
174.  	register struct monst *mtmp2;
175.  
176.  	for(mtmp2 = fmon; mtmp2; mtmp2 = mtmp2->nmon)
177.  	    /* no need for !DEADMONSTER check here since they have no inventory */
178.  	    if(mtmp2 != mtmp)
179.  		if(mon_has_arti(mtmp2, otyp)) return(mtmp2);
180.  
181.  	return((struct monst *)0);
182.  }
183.  
184.  STATIC_OVL struct obj *
185.  on_ground(otyp)
186.  	register short	otyp;
187.  {
188.  	register struct obj *otmp;
189.  
190.  	for (otmp = fobj; otmp; otmp = otmp->nobj)
191.  	    if (otyp) {
192.  		if (otmp->otyp == otyp)
193.  		    return(otmp);
194.  	    } else if (is_quest_artifact(otmp))
195.  		return(otmp);
196.  	return((struct obj *)0);
197.  }
198.  
199.  STATIC_OVL boolean
200.  you_have(mask)
201.  	register int mask;
202.  {
203.  	switch(mask) {
204.  	    case M3_WANTSAMUL:	return(boolean)(u.uhave.amulet);
205.  	    case M3_WANTSBELL:	return(boolean)(u.uhave.bell);
206.  	    case M3_WANTSCAND:	return(boolean)(u.uhave.menorah);
207.  	    case M3_WANTSBOOK:	return(boolean)(u.uhave.book);
208.  	    case M3_WANTSARTI:	return(boolean)(u.uhave.questart);
209.  	    default:		break;
210.  	}
211.  	return(0);
212.  }
213.  
214.  STATIC_OVL long
215.  target_on(mask, mtmp)
216.  	register int mask;
217.  	register struct monst *mtmp;
218.  {
219.  	register short	otyp;
220.  	register struct obj *otmp;
221.  	register struct monst *mtmp2;
222.  
223.  	if(!M_Wants(mask))	return(STRAT_NONE);
224.  
225.  	otyp = which_arti(mask);
226.  	if(!mon_has_arti(mtmp, otyp)) {
227.  	    if(you_have(mask))
228.  		return(STRAT(STRAT_PLAYER, u.ux, u.uy, mask));
229.  	    else if((otmp = on_ground(otyp)))
230.  		return(STRAT(STRAT_GROUND, otmp->ox, otmp->oy, mask));
231.  	    else if((mtmp2 = other_mon_has_arti(mtmp, otyp)))
232.  		return(STRAT(STRAT_MONSTR, mtmp2->mx, mtmp2->my, mask));
233.  	}
234.  	return(STRAT_NONE);
235.  }
236.  
237.  STATIC_OVL long
238.  strategy(mtmp)
239.  	register struct monst *mtmp;
240.  {
241.  	long strat, dstrat;
242.  
243.  	if (!is_covetous(mtmp->data) ||
244.  		/* perhaps a shopkeeper has been polymorphed into a master
245.  		   lich; we don't want it teleporting to the stairs to heal
246.  		   because that will leave its shop untended */
247.  		(mtmp->isshk && inhishop(mtmp)))
248.  	    return STRAT_NONE;
249.  
250.  	switch((mtmp->mhp*3)/mtmp->mhpmax) {	/* 0-3 */
251.  
252.  	   default:
253.  	    case 0:	/* panic time - mtmp is almost snuffed */
254.  			return(STRAT_HEAL);
255.  
256.  	    case 1:	/* the wiz is less cautious */
257.  			if(mtmp->data != &mons[PM_WIZARD_OF_YENDOR])
258.  			    return(STRAT_HEAL);
259.  			/* else fall through */
260.  
261.  	    case 2:	dstrat = STRAT_HEAL;
262.  			break;
263.  
264.  	    case 3:	dstrat = STRAT_NONE;
265.  			break;
266.  	}
267.  
268.  	if(flags.made_amulet)
269.  	    if((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
270.  		return(strat);
271.  
272.  	if(u.uevent.invoked) {		/* priorities change once gate opened */
273.  
274.  	    if((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
275.  		return(strat);
276.  	    if((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
277.  		return(strat);
278.  	    if((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
279.  		return(strat);
280.  	    if((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
281.  		return(strat);
282.  	} else {
283.  
284.  	    if((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
285.  		return(strat);
286.  	    if((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
287.  		return(strat);
288.  	    if((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
289.  		return(strat);
290.  	    if((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
291.  		return(strat);
292.  	}
293.  	return(dstrat);
294.  }
295.  
296.  int
297.  tactics(mtmp)
298.  	register struct monst *mtmp;
299.  {
300.  	long strat = strategy(mtmp);
301.  
302.  	mtmp->mstrategy = (mtmp->mstrategy & STRAT_WAITMASK) | strat;
303.  
304.  	switch (strat) {
305.  	    case STRAT_HEAL:	/* hide and recover */
306.  		/* if wounded, hole up on or near the stairs (to block them) */
307.  		/* unless, of course, there are no stairs (e.g. endlevel) */
308.  		if (In_W_tower(mtmp->mx, mtmp->my, &u.uz) ||
309.  			(mtmp->iswiz && !xupstair && !mon_has_amulet(mtmp))) {
310.  		    if (!rn2(3 + mtmp->mhp/10)) rloc(mtmp);
311.  		} else if (xupstair &&
312.  			 (mtmp->mx != xupstair || mtmp->my != yupstair)) {
313.  		    (void) mnearto(mtmp, xupstair, yupstair, TRUE);
314.  		}
315.  		/* if you're not around, cast healing spells */
316.  		if (distu(mtmp->mx,mtmp->my) > (BOLT_LIM * BOLT_LIM))
317.  		    if(mtmp->mhp <= mtmp->mhpmax - 8) {
318.  			mtmp->mhp += rnd(8);
319.  			return(1);
320.  		    }
321.  		/* fall through :-) */
322.  
323.  	    case STRAT_NONE:	/* harrass */
324.  	        if(!rn2(5)) mnexto(mtmp);
325.  		return(0);
326.  
327.  	    default:		/* kill, maim, pillage! */
328.  	    {
329.  		long  where = (strat & STRAT_STRATMASK);
330.  		xchar tx = STRAT_GOALX(strat),
331.  		      ty = STRAT_GOALY(strat);
332.  		int   targ = strat & STRAT_GOAL;
333.  		struct obj *otmp;
334.  
335.  		if(!targ) { /* simply wants you to close */
336.  		    return(0);
337.  		}
338.  		if((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
339.  		    /* player is standing on it (or has it) */
340.  		    mnexto(mtmp);
341.  		    return(0);
342.  		}
343.  		if(where == STRAT_GROUND) {
344.  		    if(!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
345.  			/* teleport to it and pick it up */
346.  			rloc_to(mtmp, tx, ty);	/* clean old pos */
347.  
348.  			if ((otmp = on_ground(which_arti(targ))) != 0) {
349.  			    if (cansee(mtmp->mx, mtmp->my))
350.  				pline("%s picks up %s.",
351.  				    Monnam(mtmp),
352.  				    (distu(mtmp->my, mtmp->my) <= 5) ?
353.  				     doname(otmp) : distant_name(otmp, doname));
354.  			    obj_extract_self(otmp);
355.  			    (void) mpickobj(mtmp, otmp);
356.  			    return(1);
357.  			} else return(0);
358.  		    } else {
359.  			/* a monster is standing on it - cause some trouble */
360.  			if (!rn2(5)) mnexto(mtmp);
361.  			return(0);
362.  		    }
363.  	        } else { /* a monster has it - 'port beside it. */
364.  		    (void) mnearto(mtmp, tx, ty, TRUE);
365.  		    return(0);
366.  		}
367.  	    }
368.  	}
369.  	/*NOTREACHED*/
370.  	return(0);
371.  }
372.  
373.  void
374.  aggravate()
375.  {
376.  	register struct monst *mtmp;
377.  
378.  	for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
379.  	    if (!DEADMONSTER(mtmp)) {
380.  		mtmp->msleeping = 0;
381.  		if(!mtmp->mcanmove && !rn2(5)) {
382.  			mtmp->mfrozen = 0;
383.  			mtmp->mcanmove = 1;
384.  		}
385.  	    }
386.  }
387.  
388.  void
389.  clonewiz()
390.  {
391.  	register struct monst *mtmp2;
392.  
393.  	if ((mtmp2 = makemon(&mons[PM_WIZARD_OF_YENDOR],
394.  				u.ux, u.uy, NO_MM_FLAGS)) != 0) {
395.  	    mtmp2->msleeping = mtmp2->mtame = mtmp2->mpeaceful = 0;
396.  	    if (!u.uhave.amulet && rn2(2)) {  /* give clone a fake */
397.  		(void) add_to_minv(mtmp2, mksobj(FAKE_AMULET_OF_YENDOR,
398.  					TRUE, FALSE));
399.  	    }
400.  	    mtmp2->m_ap_type = M_AP_MONSTER;
401.  	    mtmp2->mappearance = wizapp[rn2(SIZE(wizapp))];
402.  	    newsym(mtmp2->mx,mtmp2->my);
403.  	}
404.  }
405.  
406.  /* also used by newcham() */
407.  int
408.  pick_nasty()
409.  {
410.      /* To do?  Possibly should filter for appropriate forms when
411.         in the elemental planes or surrounded by water or lava. */
412.      return nasties[rn2(SIZE(nasties))];
413.  }
414.  
415.  /* create some nasty monsters, aligned or neutral with the caster */
416.  /* a null caster defaults to a chaotic caster (e.g. the wizard) */
417.  int
418.  nasty(mcast)
419.  	struct monst *mcast;
420.  {
421.      register struct monst	*mtmp;
422.      register int	i, j, tmp;
423.      int castalign = (mcast ? mcast->data->maligntyp : -1);
424.      coord bypos;
425.      int count=0;
426.  
427.      if(!rn2(10) && Inhell) {
428.  	msummon(&mons[PM_WIZARD_OF_YENDOR]);
429.  	count++;
430.      } else {
431.  	tmp = (u.ulevel > 3) ? u.ulevel/3 : 1; /* just in case -- rph */
432.  	/* if we don't have a casting monster, the nasties appear around you */
433.  	bypos.x = u.ux;
434.  	bypos.y = u.uy;
435.  	for(i = rnd(tmp); i > 0; --i)
436.  	    for(j=0; j<20; j++) {
437.  		if (mcast &&
438.  			!enexto(&bypos, mcast->mux, mcast->muy, mcast->data))
439.  		    continue;
440.  		if ((mtmp = makemon(&mons[pick_nasty()],
441.  				    bypos.x, bypos.y, NO_MM_FLAGS)) != 0) {
442.  		    mtmp->msleeping = mtmp->mpeaceful = mtmp->mtame = 0;
443.  		    set_malign(mtmp);
444.  		} else /* GENOD? */
445.  		    mtmp = makemon((struct permonst *)0,
446.  					bypos.x, bypos.y, NO_MM_FLAGS);
447.  		if(mtmp && (mtmp->data->maligntyp == 0 ||
448.  		            sgn(mtmp->data->maligntyp) == sgn(castalign)) ) {
449.  		    count++;
450.  		    break;
451.  		}
452.  	    }
453.      }
454.      return count;
455.  }
456.  
457.  /*	Let's resurrect the wizard, for some unexpected fun.	*/
458.  void
459.  resurrect()
460.  {
461.  	struct monst *mtmp, **mmtmp;
462.  	long elapsed;
463.  	const char *verb;
464.  
465.  	if (!flags.no_of_wizards) {
466.  	    /* make a new Wizard */
467.  	    verb = "kill";
468.  	    mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT);
469.  	} else {
470.  	    /* look for a migrating Wizard */
471.  	    verb = "elude";
472.  	    mmtmp = &migrating_mons;
473.  	    while ((mtmp = *mmtmp) != 0) {
474.  		if (mtmp->iswiz &&
475.  			/* if he has the Amulet, he won't bring it to you */
476.  			!mon_has_amulet(mtmp) &&
477.  			(elapsed = monstermoves - mtmp->mlstmv) > 0L) {
478.  		    mon_catchup_elapsed_time(mtmp, elapsed);
479.  		    if (elapsed >= LARGEST_INT) elapsed = LARGEST_INT - 1;
480.  		    elapsed /= 50L;
481.  		    if (mtmp->msleeping && rn2((int)elapsed + 1))
482.  			mtmp->msleeping = 0;
483.  		    if (mtmp->mfrozen == 1) /* would unfreeze on next move */
484.  			mtmp->mfrozen = 0,  mtmp->mcanmove = 1;
485.  		    if (mtmp->mcanmove && !mtmp->msleeping) {
486.  			*mmtmp = mtmp->nmon;
487.  			mon_arrive(mtmp, TRUE);
488.  			/* note: there might be a second Wizard; if so,
489.  			   he'll have to wait til the next resurrection */
490.  			break;
491.  		    }
492.  		}
493.  		mmtmp = &mtmp->nmon;
494.  	    }
495.  	}
496.  
497.  	if (mtmp) {
498.  		mtmp->msleeping = mtmp->mtame = mtmp->mpeaceful = 0;
499.  		set_malign(mtmp);
500.  		pline("A voice booms out...");
501.  		verbalize("So thou thought thou couldst %s me, fool.", verb);
502.  	}
503.  
504.  }
505.  
506.  /*	Here, we make trouble for the poor shmuck who actually	*/
507.  /*	managed to do in the Wizard.				*/
508.  void
509.  intervene()
510.  {
511.  	int which = Is_astralevel(&u.uz) ? rnd(4) : rn2(6);
512.  	/* cases 0 and 5 don't apply on the Astral level */
513.  	switch (which) {
514.  	    case 0:
515.  	    case 1:	You_feel("vaguely nervous.");
516.  			break;
517.  	    case 2:	if (!Blind)
518.  			    You("notice a %s glow surrounding you.",
519.  				  hcolor(Black));
520.  			rndcurse();
521.  			break;
522.  	    case 3:	aggravate();
523.  			break;
524.  	    case 4:	(void)nasty((struct monst *)0);
525.  			break;
526.  	    case 5:	resurrect();
527.  			break;
528.  	}
529.  }
530.  
531.  void
532.  wizdead()
533.  {
534.  	flags.no_of_wizards--;
535.  	if (!u.uevent.udemigod) {
536.  		u.uevent.udemigod = TRUE;
537.  		u.udg_cnt = rn1(250, 50);
538.  	}
539.  }
540.  
541.  const char *random_insult[] = {
542.  	"antic",
543.  	"blackguard",
544.  	"caitiff",
545.  	"chucklehead",
546.  	"coistrel",
547.  	"craven",
548.  	"cretin",
549.  	"cur",
550.  	"dastard",
551.  	"demon fodder",
552.  	"dimwit",
553.  	"dolt",
554.  	"fool",
555.  	"footpad",
556.  	"imbecile",
557.  	"knave",
558.  	"maledict",
559.  	"miscreant",
560.  	"niddering",
561.  	"poltroon",
562.  	"rattlepate",
563.  	"reprobate",
564.  	"scapegrace",
565.  	"varlet",
566.  	"villein",	/* (sic.) */
567.  	"wittol",
568.  	"worm",
569.  	"wretch",
570.  };
571.  
572.  const char *random_malediction[] = {
573.  	"Hell shall soon claim thy remains,",
574.  	"I chortle at thee, thou pathetic",
575.  	"Prepare to die, thou",
576.  	"Resistance is useless,",
577.  	"Surrender or die, thou",
578.  	"There shall be no mercy, thou",
579.  	"Thou shalt repent of thy cunning,",
580.  	"Thou art as a flea to me,",
581.  	"Thou art doomed,",
582.  	"Thy fate is sealed,",
583.  	"Verily, thou shalt be one dead"
584.  };
585.  
586.  /* Insult or intimidate the player */
587.  void
588.  cuss(mtmp)
589.  register struct monst	*mtmp;
590.  {
591.  	if (mtmp->iswiz) {
592.  	    if (!rn2(5))  /* typical bad guy action */
593.  		pline("%s laughs fiendishly.", Monnam(mtmp));
594.  	    else
595.  		if (u.uhave.amulet && !rn2(SIZE(random_insult)))
596.  		    verbalize("Relinquish the amulet, %s!",
597.  			  random_insult[rn2(SIZE(random_insult))]);
598.  		else if (u.uhp < 5 && !rn2(2))	/* Panic */
599.  		    verbalize(rn2(2) ?
600.  			  "Even now thy life force ebbs, %s!" :
601.  			  "Savor thy breath, %s, it be thy last!",
602.  			  random_insult[rn2(SIZE(random_insult))]);
603.  		else if (mtmp->mhp < 5 && !rn2(2))	/* Parthian shot */
604.  		    verbalize(rn2(2) ?
605.  			      "I shall return." :
606.  			      "I'll be back.");
607.  		else
608.  		    verbalize("%s %s!",
609.  			  random_malediction[rn2(SIZE(random_malediction))],
610.  			  random_insult[rn2(SIZE(random_insult))]);
611.  	} else if(is_lminion(mtmp->data)) {
612.  		com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0)) +
613.  			      QT_ANGELIC);
614.  	} else {
615.  	    if (!rn2(5))
616.  		pline("%s casts aspersions on your ancestry.", Monnam(mtmp));
617.  	    else
618.  	        com_pager(rn2(QTN_DEMONIC) + QT_DEMONIC);
619.  	}
620.  }
621.  
622.  #endif /* OVLB */
623.  
624.  /*wizard.c*/

Also on Fandom

Random Wiki