Source:NetHack 3.4.3/src/wizard.c

From NetHackWiki
(Redirected from Source:Ref/you have)
Jump to: navigation, search

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

Top of file

  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. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1. /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
  2. /*	       - heavily modified to give the wiz balls.  (genat!mike)   */
  3. /*	       - dewimped and given some maledictions. -3. */
  4. /*	       - generalized for 3.1 (mike@bullns.on01.bull.ca) */
  5.  
  6. #include "hack.h"
  7. #include "qtext.h"
  8. #include "epri.h"
  9.  
  10. extern const int monstr[];
  11.  
  12. #ifdef OVLB
  13.  
  14. STATIC_DCL short FDECL(which_arti, (int));
  15. STATIC_DCL boolean FDECL(mon_has_arti, (struct monst *,SHORT_P));
  16. STATIC_DCL struct monst *FDECL(other_mon_has_arti, (struct monst *,SHORT_P));
  17. STATIC_DCL struct obj *FDECL(on_ground, (SHORT_P));
  18. STATIC_DCL boolean FDECL(you_have, (int));
  19. STATIC_DCL long FDECL(target_on, (int,struct monst *));
  20. STATIC_DCL long FDECL(strategy, (struct monst *));

nasties

  1. static NEARDATA const int nasties[] = {
  2. 	PM_COCKATRICE, PM_ETTIN, PM_STALKER, PM_MINOTAUR, PM_RED_DRAGON,
  3. 	PM_BLACK_DRAGON, PM_GREEN_DRAGON, PM_OWLBEAR, PM_PURPLE_WORM,
  4. 	PM_ROCK_TROLL, PM_XAN, PM_GREMLIN, PM_UMBER_HULK, PM_VAMPIRE_LORD,
  5. 	PM_XORN, PM_ZRUTY, PM_ELF_LORD, PM_ELVENKING, PM_YELLOW_DRAGON,
  6. 	PM_LEOCROTTA, PM_BALUCHITHERIUM, PM_CARNIVOROUS_APE, PM_FIRE_GIANT,
  7. 	PM_COUATL, PM_CAPTAIN, PM_WINGED_GARGOYLE, PM_MASTER_MIND_FLAYER,
  8. 	PM_FIRE_ELEMENTAL, PM_JABBERWOCK, PM_ARCH_LICH, PM_OGRE_KING,
  9. 	PM_OLOG_HAI, PM_IRON_GOLEM, PM_OCHRE_JELLY, PM_GREEN_SLIME,
  10. 	PM_DISENCHANTER
  11. 	};

wizapp

  1. static NEARDATA const unsigned wizapp[] = {
  2. 	PM_HUMAN, PM_WATER_DEMON, PM_VAMPIRE,
  3. 	PM_RED_DRAGON, PM_TROLL, PM_UMBER_HULK,
  4. 	PM_XORN, PM_XAN, PM_COCKATRICE,
  5. 	PM_FLOATING_EYE,
  6. 	PM_GUARDIAN_NAGA,
  7. 	PM_TRAPPER
  8. };
  9.  
  10. #endif /* OVLB */
  11. #ifdef OVL0

amulet

  1. /* If you've found the Amulet, make the Wizard appear after some time */
  2. /* Also, give hints about portal locations, if amulet is worn/wielded -dlc */
  3. void
  4. amulet()
  5. {
  6. 	struct monst *mtmp;
  7. 	struct trap *ttmp;
  8. 	struct obj *amu;
  9.  
  10. #if 0		/* caller takes care of this check */
  11. 	if (!u.uhave.amulet)
  12. 		return;
  13. #endif
  14. 	if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR) ||
  15. 	     ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR))
  16. 	    && !rn2(15)) {
  17. 	    for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) {
  18. 		if(ttmp->ttyp == MAGIC_PORTAL) {
  19. 		    int du = distu(ttmp->tx, ttmp->ty);
  20. 		    if (du <= 9)
  21. 			pline("%s hot!", Tobjnam(amu, "feel"));
  22. 		    else if (du <= 64)
  23. 			pline("%s very warm.", Tobjnam(amu, "feel"));
  24. 		    else if (du <= 144)
  25. 			pline("%s warm.", Tobjnam(amu, "feel"));
  26. 		    /* else, the amulet feels normal */
  27. 		    break;
  28. 		}
  29. 	    }
  30. 	}
  31.  
  32. 	if (!flags.no_of_wizards)
  33. 		return;
  34. 	/* find Wizard, and wake him if necessary */
  35. 	for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
  36. 	    if (!DEADMONSTER(mtmp) && mtmp->iswiz && mtmp->msleeping && !rn2(40)) {
  37. 		mtmp->msleeping = 0;
  38. 		if (distu(mtmp->mx,mtmp->my) > 2)
  39. 		    You(
  40. "get the creepy feeling that somebody noticed your taking the Amulet."
  41. 		    );
  42. 		return;
  43. 	    }
  44. }
  45.  
  46. #endif /* OVL0 */
  47. #ifdef OVLB

mon_has_amulet

  1. int
  2. mon_has_amulet(mtmp)
  3. register struct monst *mtmp;
  4. {
  5. 	register struct obj *otmp;
  6.  
  7. 	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
  8. 		if(otmp->otyp == AMULET_OF_YENDOR) return(1);
  9. 	return(0);
  10. }

mon_has_special

  1. int
  2. mon_has_special(mtmp)
  3. register struct monst *mtmp;
  4. {
  5. 	register struct obj *otmp;
  6.  
  7. 	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
  8. 		if(otmp->otyp == AMULET_OF_YENDOR ||
  9. 			is_quest_artifact(otmp) ||
  10. 			otmp->otyp == BELL_OF_OPENING ||
  11. 			otmp->otyp == CANDELABRUM_OF_INVOCATION ||
  12. 			otmp->otyp == SPE_BOOK_OF_THE_DEAD) return(1);
  13. 	return(0);
  14. }
  1. /*
  2. *	New for 3.1  Strategy / Tactics for the wiz, as well as other
  3. *	monsters that are "after" something (defined via mflag3).
  4. *
  5. *	The strategy section decides *what* the monster is going
  6. *	to attempt, the tactics section implements the decision.
  7. */
  8. #define STRAT(w, x, y, typ) (w | ((long)(x)<<16) | ((long)(y)<<8) | (long)typ)
  9.  
  10. #define M_Wants(mask)	(mtmp->data->mflags3 & (mask))

which_arti

  1. STATIC_OVL short
  2. which_arti(mask)
  3. 	register int mask;
  4. {
  5. 	switch(mask) {
  6. 	    case M3_WANTSAMUL:	return(AMULET_OF_YENDOR);
  7. 	    case M3_WANTSBELL:	return(BELL_OF_OPENING);
  8. 	    case M3_WANTSCAND:	return(CANDELABRUM_OF_INVOCATION);
  9. 	    case M3_WANTSBOOK:	return(SPE_BOOK_OF_THE_DEAD);
  10. 	    default:		break;	/* 0 signifies quest artifact */
  11. 	}
  12. 	return(0);
  13. }

mon_has_arti

  1. /*
  2. *	If "otyp" is zero, it triggers a check for the quest_artifact,
  3. *	since bell, book, candle, and amulet are all objects, not really
  4. *	artifacts right now.	[MRS]
  5. */
  6. STATIC_OVL boolean
  7. mon_has_arti(mtmp, otyp)
  8. 	register struct monst *mtmp;
  9. 	register short	otyp;
  10. {
  11. 	register struct obj *otmp;
  12.  
  13. 	for(otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
  14. 	    if(otyp) {
  15. 		if(otmp->otyp == otyp)
  16. 			return(1);
  17. 	    }
  18. 	     else if(is_quest_artifact(otmp)) return(1);
  19. 	}
  20. 	return(0);
  21.  
  22. }

other_mon_has_arti

  1. STATIC_OVL struct monst *
  2. other_mon_has_arti(mtmp, otyp)
  3. 	register struct monst *mtmp;
  4. 	register short	otyp;
  5. {
  6. 	register struct monst *mtmp2;
  7.  
  8. 	for(mtmp2 = fmon; mtmp2; mtmp2 = mtmp2->nmon)
  9. 	    /* no need for !DEADMONSTER check here since they have no inventory */
  10. 	    if(mtmp2 != mtmp)
  11. 		if(mon_has_arti(mtmp2, otyp)) return(mtmp2);
  12.  
  13. 	return((struct monst *)0);
  14. }

on_ground

  1. STATIC_OVL struct obj *
  2. on_ground(otyp)
  3. 	register short	otyp;
  4. {
  5. 	register struct obj *otmp;
  6.  
  7. 	for (otmp = fobj; otmp; otmp = otmp->nobj)
  8. 	    if (otyp) {
  9. 		if (otmp->otyp == otyp)
  10. 		    return(otmp);
  11. 	    } else if (is_quest_artifact(otmp))
  12. 		return(otmp);
  13. 	return((struct obj *)0);
  14. }

you_have

  1. STATIC_OVL boolean
  2. you_have(mask)
  3. 	register int mask;
  4. {
  5. 	switch(mask) {
  6. 	    case M3_WANTSAMUL:	return(boolean)(u.uhave.amulet);
  7. 	    case M3_WANTSBELL:	return(boolean)(u.uhave.bell);
  8. 	    case M3_WANTSCAND:	return(boolean)(u.uhave.menorah);
  9. 	    case M3_WANTSBOOK:	return(boolean)(u.uhave.book);
  10. 	    case M3_WANTSARTI:	return(boolean)(u.uhave.questart);
  11. 	    default:		break;
  12. 	}
  13. 	return(0);
  14. }

target_on

  1. STATIC_OVL long
  2. target_on(mask, mtmp)
  3. 	register int mask;
  4. 	register struct monst *mtmp;
  5. {
  6. 	register short	otyp;
  7. 	register struct obj *otmp;
  8. 	register struct monst *mtmp2;
  9.  
  10. 	if(!M_Wants(mask))	return(STRAT_NONE);
  11.  
  12. 	otyp = which_arti(mask);
  13. 	if(!mon_has_arti(mtmp, otyp)) {
  14. 	    if(you_have(mask))
  15. 		return(STRAT(STRAT_PLAYER, u.ux, u.uy, mask));
  16. 	    else if((otmp = on_ground(otyp)))
  17. 		return(STRAT(STRAT_GROUND, otmp->ox, otmp->oy, mask));
  18. 	    else if((mtmp2 = other_mon_has_arti(mtmp, otyp)))
  19. 		return(STRAT(STRAT_MONSTR, mtmp2->mx, mtmp2->my, mask));
  20. 	}
  21. 	return(STRAT_NONE);
  22. }

strategy

  1. STATIC_OVL long
  2. strategy(mtmp)
  3. 	register struct monst *mtmp;
  4. {
  5. 	long strat, dstrat;
  6.  
  7. 	if (!is_covetous(mtmp->data) ||
  8. 		/* perhaps a shopkeeper has been polymorphed into a master
  9. 		   lich; we don't want it teleporting to the stairs to heal
  10. 		   because that will leave its shop untended */
  11. 		(mtmp->isshk && inhishop(mtmp)))
  12. 	    return STRAT_NONE;
  13.  
  14. 	switch((mtmp->mhp*3)/mtmp->mhpmax) {	/* 0-3 */
  15.  
  16. 	   default:
  17. 	    case 0:	/* panic time - mtmp is almost snuffed */
  18. 			return(STRAT_HEAL);
  19.  
  20. 	    case 1:	/* the wiz is less cautious */
  21. 			if(mtmp->data != &mons[PM_WIZARD_OF_YENDOR])
  22. 			    return(STRAT_HEAL);
  23. 			/* else fall through */
  24.  
  25. 	    case 2:	dstrat = STRAT_HEAL;
  26. 			break;
  27.  
  28. 	    case 3:	dstrat = STRAT_NONE;
  29. 			break;
  30. 	}
  31.  
  32. 	if(flags.made_amulet)
  33. 	    if((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
  34. 		return(strat);
  35.  
  36. 	if(u.uevent.invoked) {		/* priorities change once gate opened */
  37.  
  38. 	    if((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
  39. 		return(strat);
  40. 	    if((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
  41. 		return(strat);
  42. 	    if((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
  43. 		return(strat);
  44. 	    if((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
  45. 		return(strat);
  46. 	} else {
  47.  
  48. 	    if((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
  49. 		return(strat);
  50. 	    if((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
  51. 		return(strat);
  52. 	    if((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
  53. 		return(strat);
  54. 	    if((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
  55. 		return(strat);
  56. 	}
  57. 	return(dstrat);
  58. }

tactics

  1. int
  2. tactics(mtmp)
  3. 	register struct monst *mtmp;
  4. {
  5. 	long strat = strategy(mtmp);
  6.  
  7. 	mtmp->mstrategy = (mtmp->mstrategy & STRAT_WAITMASK) | strat;
  8.  
  9. 	switch (strat) {
  10. 	    case STRAT_HEAL:	/* hide and recover */
  11. 		/* if wounded, hole up on or near the stairs (to block them) */
  12. 		/* unless, of course, there are no stairs (e.g. endlevel) */
  13. 		mtmp->mavenge = 1; /* covetous monsters attack while fleeing */
  14. 		if (In_W_tower(mtmp->mx, mtmp->my, &u.uz) ||
  15. 			(mtmp->iswiz && !xupstair && !mon_has_amulet(mtmp))) {
  16. 		    if (!rn2(3 + mtmp->mhp/10)) (void) rloc(mtmp, FALSE);
  17. 		} else if (xupstair &&
  18. 			 (mtmp->mx != xupstair || mtmp->my != yupstair)) {
  19. 		    (void) mnearto(mtmp, xupstair, yupstair, TRUE);
  20. 		}
  21. 		/* if you're not around, cast healing spells */
  22. 		if (distu(mtmp->mx,mtmp->my) > (BOLT_LIM * BOLT_LIM))
  23. 		    if(mtmp->mhp <= mtmp->mhpmax - 8) {
  24. 			mtmp->mhp += rnd(8);
  25. 			return(1);
  26. 		    }
  27. 		/* fall through :-) */
  28.  
  29. 	    case STRAT_NONE:	/* harrass */
  30. 		if (!rn2(!mtmp->mflee ? 5 : 33)) mnexto(mtmp);
  31. 		return(0);
  32.  
  33. 	    default:		/* kill, maim, pillage! */
  34. 	    {
  35. 		long  where = (strat & STRAT_STRATMASK);
  36. 		xchar tx = STRAT_GOALX(strat),
  37. 		      ty = STRAT_GOALY(strat);
  38. 		int   targ = strat & STRAT_GOAL;
  39. 		struct obj *otmp;
  40.  
  41. 		if(!targ) { /* simply wants you to close */
  42. 		    return(0);
  43. 		}
  44. 		if((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
  45. 		    /* player is standing on it (or has it) */
  46. 		    mnexto(mtmp);
  47. 		    return(0);
  48. 		}
  49. 		if(where == STRAT_GROUND) {
  50. 		    if(!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
  51. 			/* teleport to it and pick it up */
  52. 			rloc_to(mtmp, tx, ty);	/* clean old pos */
  53.  
  54. 			if ((otmp = on_ground(which_arti(targ))) != 0) {
  55. 			    if (cansee(mtmp->mx, mtmp->my))
  56. 				pline("%s picks up %s.",
  57. 				    Monnam(mtmp),
  58. 				    (distu(mtmp->mx, mtmp->my) <= 5) ?
  59. 				     doname(otmp) : distant_name(otmp, doname));
  60. 			    obj_extract_self(otmp);
  61. 			    (void) mpickobj(mtmp, otmp);
  62. 			    return(1);
  63. 			} else return(0);
  64. 		    } else {
  65. 			/* a monster is standing on it - cause some trouble */
  66. 			if (!rn2(5)) mnexto(mtmp);
  67. 			return(0);
  68. 		    }
  69. 	        } else { /* a monster has it - 'port beside it. */
  70. 		    (void) mnearto(mtmp, tx, ty, FALSE);
  71. 		    return(0);
  72. 		}
  73. 	    }
  74. 	}
  75. 	/*NOTREACHED*/
  76. 	return(0);
  77. }

aggravate

  1. void
  2. aggravate()
  3. {
  4. 	register struct monst *mtmp;
  5.  
  6. 	for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
  7. 	    if (!DEADMONSTER(mtmp)) {
  8. 		mtmp->msleeping = 0;
  9. 		if(!mtmp->mcanmove && !rn2(5)) {
  10. 			mtmp->mfrozen = 0;
  11. 			mtmp->mcanmove = 1;
  12. 		}
  13. 	    }
  14. }

clonewiz

  1. void
  2. clonewiz()
  3. {
  4. 	register struct monst *mtmp2;
  5.  
  6. 	if ((mtmp2 = makemon(&mons[PM_WIZARD_OF_YENDOR],
  7. 				u.ux, u.uy, NO_MM_FLAGS)) != 0) {
  8. 	    mtmp2->msleeping = mtmp2->mtame = mtmp2->mpeaceful = 0;
  9. 	    if (!u.uhave.amulet && rn2(2)) {  /* give clone a fake */
  10. 		(void) add_to_minv(mtmp2, mksobj(FAKE_AMULET_OF_YENDOR,
  11. 					TRUE, FALSE));
  12. 	    }
  13. 	    mtmp2->m_ap_type = M_AP_MONSTER;
  14. 	    mtmp2->mappearance = wizapp[rn2(SIZE(wizapp))];
  15. 	    newsym(mtmp2->mx,mtmp2->my);
  16. 	}
  17. }

pick_nasty

  1. /* also used by newcham() */
  2. int
  3. pick_nasty()
  4. {
  5. /* To do?  Possibly should filter for appropriate forms when
  6. in the elemental planes or surrounded by water or lava. */
  7. return nasties[rn2(SIZE(nasties))];
  8. }

nasty

  1. /* create some nasty monsters, aligned or neutral with the caster */
  2. /* a null caster defaults to a chaotic caster (e.g. the wizard) */
  3. int
  4. nasty(mcast)
  5. 	struct monst *mcast;
  6. {
  7. register struct monst	*mtmp;
  8. register int	i, j, tmp;
  9. int castalign = (mcast ? mcast->data->maligntyp : -1);
  10. coord bypos;
  11. int count=0;
  12.  
  13. if(!rn2(10) && Inhell) {
  14. 	msummon((struct monst *) 0);	/* summons like WoY */
  15. 	count++;
  16. } else {
  17. 	tmp = (u.ulevel > 3) ? u.ulevel/3 : 1; /* just in case -- rph */
  18. 	/* if we don't have a casting monster, the nasties appear around you */
  19. 	bypos.x = u.ux;
  20. 	bypos.y = u.uy;
  21. 	for(i = rnd(tmp); i > 0; --i)
  22. 	    for(j=0; j<20; j++) {
  23. 		int makeindex;
  24.  
  25. 		/* Don't create more spellcasters of the monsters' level or
  26. 		 * higher--avoids chain summoners filling up the level.
  27. 		 */
  28. 		do {
  29. 		    makeindex = pick_nasty();
  30. 		} while(mcast && attacktype(&mons[makeindex], AT_MAGC) &&
  31. 			monstr[makeindex] >= monstr[mcast->mnum]);
  32. 		/* do this after picking the monster to place */
  33. 		if (mcast &&
  34. 		    !enexto(&bypos, mcast->mux, mcast->muy, &mons[makeindex]))
  35. 		    continue;
  36. 		if ((mtmp = makemon(&mons[makeindex],
  37. 				    bypos.x, bypos.y, NO_MM_FLAGS)) != 0) {
  38. 		    mtmp->msleeping = mtmp->mpeaceful = mtmp->mtame = 0;
  39. 		    set_malign(mtmp);
  40. 		} else /* GENOD? */
  41. 		    mtmp = makemon((struct permonst *)0,
  42. 					bypos.x, bypos.y, NO_MM_FLAGS);
  43. 		if(mtmp && (mtmp->data->maligntyp == 0 ||
  44. 		            sgn(mtmp->data->maligntyp) == sgn(castalign)) ) {
  45. 		    count++;
  46. 		    break;
  47. 		}
  48. 	    }
  49. }
  50. return count;
  51. }

resurrect

  1. /*	Let's resurrect the wizard, for some unexpected fun.	*/
  2. void
  3. resurrect()
  4. {
  5. 	struct monst *mtmp, **mmtmp;
  6. 	long elapsed;
  7. 	const char *verb;
  8.  
  9. 	if (!flags.no_of_wizards) {
  10. 	    /* make a new Wizard */
  11. 	    verb = "kill";
  12. 	    mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT);
  13. 	} else {
  14. 	    /* look for a migrating Wizard */
  15. 	    verb = "elude";
  16. 	    mmtmp = &migrating_mons;
  17. 	    while ((mtmp = *mmtmp) != 0) {
  18. 		if (mtmp->iswiz &&
  19. 			/* if he has the Amulet, he won't bring it to you */
  20. 			!mon_has_amulet(mtmp) &&
  21. 			(elapsed = monstermoves - mtmp->mlstmv) > 0L) {
  22. 		    mon_catchup_elapsed_time(mtmp, elapsed);
  23. 		    if (elapsed >= LARGEST_INT) elapsed = LARGEST_INT - 1;
  24. 		    elapsed /= 50L;
  25. 		    if (mtmp->msleeping && rn2((int)elapsed + 1))
  26. 			mtmp->msleeping = 0;
  27. 		    if (mtmp->mfrozen == 1) /* would unfreeze on next move */
  28. 			mtmp->mfrozen = 0,  mtmp->mcanmove = 1;
  29. 		    if (mtmp->mcanmove && !mtmp->msleeping) {
  30. 			*mmtmp = mtmp->nmon;
  31. 			mon_arrive(mtmp, TRUE);
  32. 			/* note: there might be a second Wizard; if so,
  33. 			   he'll have to wait til the next resurrection */
  34. 			break;
  35. 		    }
  36. 		}
  37. 		mmtmp = &mtmp->nmon;
  38. 	    }
  39. 	}
  40.  
  41. 	if (mtmp) {
  42. 		mtmp->msleeping = mtmp->mtame = mtmp->mpeaceful = 0;
  43. 		set_malign(mtmp);
  44. 		pline("A voice booms out...");
  45. 		verbalize("So thou thought thou couldst %s me, fool.", verb);
  46. 	}
  47.  
  48. }

intervene

  1. /*	Here, we make trouble for the poor shmuck who actually	*/
  2. /*	managed to do in the Wizard.				*/
  3. void
  4. intervene()
  5. {
  6. 	int which = Is_astralevel(&u.uz) ? rnd(4) : rn2(6);
  7. 	/* cases 0 and 5 don't apply on the Astral level */
  8. 	switch (which) {
  9. 	    case 0:
  10. 	    case 1:	You_feel("vaguely nervous.");
  11. 			break;
  12. 	    case 2:	if (!Blind)
  13. 			    You("notice a %s glow surrounding you.",
  14. 				  hcolor(NH_BLACK));
  15. 			rndcurse();
  16. 			break;
  17. 	    case 3:	aggravate();
  18. 			break;
  19. 	    case 4:	(void)nasty((struct monst *)0);
  20. 			break;
  21. 	    case 5:	resurrect();
  22. 			break;
  23. 	}
  24. }

wizdead

  1. void
  2. wizdead()
  3. {
  4. 	flags.no_of_wizards--;
  5. 	if (!u.uevent.udemigod) {
  6. 		u.uevent.udemigod = TRUE;
  7. 		u.udg_cnt = rn1(250, 50);
  8. 	}
  9. }

random_insult

  1. const char * const random_insult[] = {
  2. 	"antic",
  3. 	"blackguard",
  4. 	"caitiff",
  5. 	"chucklehead",
  6. 	"coistrel",
  7. 	"craven",
  8. 	"cretin",
  9. 	"cur",
  10. 	"dastard",
  11. 	"demon fodder",
  12. 	"dimwit",
  13. 	"dolt",
  14. 	"fool",
  15. 	"footpad",
  16. 	"imbecile",
  17. 	"knave",
  18. 	"maledict",
  19. 	"miscreant",
  20. 	"niddering",
  21. 	"poltroon",
  22. 	"rattlepate",
  23. 	"reprobate",
  24. 	"scapegrace",
  25. 	"varlet",
  26. 	"villein",	/* (sic.) */
  27. 	"wittol",
  28. 	"worm",
  29. 	"wretch",
  30. };

Many of these words are archaic and some explanation is in order:

Word Definition used here
antic A performer of a ludicrous part
caitiff Despicable coward
coistrel A mean fellow
footpad Highwayman, robber
maledict Accursed
niddering Coward, wretch
poltroon Base coward
varlet Knave; also a knight's attendant
villein A peasant who must serve a feudal lord but is free with respect to others
wittol A man whose wife is unfaithful and who consents to her infidelity

random_malediction

  1. const char * const random_malediction[] = {
  2. 	"Hell shall soon claim thy remains,",
  3. 	"I chortle at thee, thou pathetic",
  4. 	"Prepare to die, thou",
  5. 	"Resistance is useless,",
  6. 	"Surrender or die, thou",
  7. 	"There shall be no mercy, thou",
  8. 	"Thou shalt repent of thy cunning,",
  9. 	"Thou art as a flea to me,",
  10. 	"Thou art doomed,",
  11. 	"Thy fate is sealed,",
  12. 	"Verily, thou shalt be one dead"
  13. };

cuss

  1. /* Insult or intimidate the player */
  2. void
  3. cuss(mtmp)
  4. register struct monst	*mtmp;
  5. {
  6. 	if (mtmp->iswiz) {
  7. 	    if (!rn2(5))  /* typical bad guy action */
  8. 		pline("%s laughs fiendishly.", Monnam(mtmp));
  9. 	    else
  10. 		if (u.uhave.amulet && !rn2(SIZE(random_insult)))
  11. 		    verbalize("Relinquish the amulet, %s!",
  12. 			  random_insult[rn2(SIZE(random_insult))]);
  13. 		else if (u.uhp < 5 && !rn2(2))	/* Panic */
  14. 		    verbalize(rn2(2) ?
  15. 			  "Even now thy life force ebbs, %s!" :
  16. 			  "Savor thy breath, %s, it be thy last!",
  17. 			  random_insult[rn2(SIZE(random_insult))]);
  18. 		else if (mtmp->mhp < 5 && !rn2(2))	/* Parthian shot */
  19. 		    verbalize(rn2(2) ?
  20. 			      "I shall return." :
  21. 			      "I'll be back.");
  22. 		else
  23. 		    verbalize("%s %s!",
  24. 			  random_malediction[rn2(SIZE(random_malediction))],
  25. 			  random_insult[rn2(SIZE(random_insult))]);
  26. 	} else if(is_lminion(mtmp)) {
  27. 		com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0)) +
  28. 			      QT_ANGELIC);
  29. 	} else {
  30. 	    if (!rn2(5))
  31. 		pline("%s casts aspersions on your ancestry.", Monnam(mtmp));
  32. 	    else
  33. 	        com_pager(rn2(QTN_DEMONIC) + QT_DEMONIC);
  34. 	}
  35. }
  36.  
  37. #endif /* OVLB */
  38.  
  39. /*wizard.c*/