Fandom

Wikihack

Source:SLASH'EM 0.0.7E7F2/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 SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/wizard.c#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


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

Also on Fandom

Random Wiki