Source:NetHack 3.2.0/priest.c

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

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

1.   /*	SCCS Id: @(#)priest.c	3.2	96/03/28	*/ 2.   /* Copyright (c) Izchak Miller, Steve Linhart, 1989. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    #include "hack.h"  6.    #include "mfndpos.h"  7.    #include "eshk.h"  8.    #include "epri.h"  9.    #include "emin.h"  10. 11.  #ifdef OVLB 12.   13.   static boolean FDECL(histemple_at,(struct monst *,XCHAR_P,XCHAR_P)); 14.  static boolean FDECL(has_shrine,(struct monst *)); 15.   16.   /*  17.    * Move for priests and shopkeepers. Called from shk_move and pri_move. 18.   * Valid returns are  1: moved  0: didn't  -1: let m_move do it  -2: died. 19.   */  20.   int 21.  move_special(mtmp,in_his_shop,appr,uondoor,avoid,omx,omy,gx,gy) 22.  register struct monst *mtmp; 23.  boolean in_his_shop; 24.  schar appr; 25.  boolean uondoor,avoid; 26.  register xchar omx,omy,gx,gy; 27.  {  28.   	register xchar nx,ny,nix,niy; 29.  	register schar i;  30. schar chcnt,cnt; 31.  	coord poss[9]; 32.  	long info[9]; 33.  	long allowflags; 34.  	struct obj *ib = (struct obj *)0; 35.   36.   	if(omx == gx && omy == gy) 37.  		return(0); 38.  	if(mtmp->mconf) { 39.  		avoid = FALSE; 40.  		appr = 0; 41.  	}  42.    43.   	nix = omx; 44.  	niy = omy; 45.  	if (mtmp->isshk) allowflags = ALLOW_SSM; 46.  	else allowflags = ALLOW_SSM | ALLOW_SANCT; 47.  	if (passes_walls(mtmp->data)) allowflags |= (ALLOW_ROCK|ALLOW_WALL); 48.  	if (throws_rocks(mtmp->data)) allowflags |= ALLOW_ROCK; 49.  	if (tunnels(mtmp->data) &&  50.   		    (!needspick(mtmp->data) || m_carrying(mtmp, PICK_AXE))) 51.  		allowflags |= ALLOW_DIG; 52.  	if (!nohands(mtmp->data) && !verysmall(mtmp->data)) { 53.  		allowflags |= OPENDOOR; 54.  		if (m_carrying(mtmp, SKELETON_KEY)) allowflags |= BUSTDOOR; 55.  	}  56.   	if (is_giant(mtmp->data)) allowflags |= BUSTDOOR; 57.  	cnt = mfndpos(mtmp, poss, info, allowflags); 58.   59.   	if(mtmp->isshk && avoid && uondoor) { /* perhaps we cannot avoid him */ 60.  		for(i=0; iispriest && 73.  			    levl[nx][ny].typ == ALTAR) ||  74.   			(mtmp->isshk && 75.  			    (!in_his_shop || ESHK(mtmp)->following))) { 76.  		    if(avoid && (info[i] & NOTONL)) 77.  			continue; 78.  		    if((!appr && !rn2(++chcnt)) ||  79.   			(appr && GDIST(nx,ny) < GDIST(nix,niy))) { 80.  			    nix = nx; 81.  			    niy = ny; 82.  		    }  83.   		}  84.   	}  85.   	if(mtmp->ispriest && avoid &&  86.   			nix == omx && niy == omy && onlineu(omx,omy)) { 87.  		/* might as well move closer as long it's going to stay 88.  		 * lined up */ 89.  		avoid = FALSE; 90.  		goto pick_move; 91.  	}  92.    93.   	if(nix != omx || niy != omy) { 94.  		remove_monster(omx, omy); 95.  		place_monster(mtmp, nix, niy); 96.  		newsym(nix,niy); 97.  		if (mtmp->isshk && !in_his_shop && inhishop(mtmp)) 98.  		    check_special_room(FALSE); 99.  		if(ib) { 100. 			if (cansee(mtmp->mx,mtmp->my)) 101. 			    pline("%s picks up %s.", Monnam(mtmp),  102.  				distant_name(ib,doname)); 103. 			obj_extract_self(ib); 104. 			mpickobj(mtmp, ib); 105. 		}  106.  		return(1); 107. 	}  108.  	return(0); 109. }  110.   111.  #endif /* OVLB */ 112.  113.  #ifdef OVL0 114.  115.  char 116. temple_occupied(array) 117. register char *array; 118. {  119.  	register char *ptr; 120.  121.  	for (ptr = array; *ptr; ptr++) 122. 		if (rooms[*ptr - ROOMOFFSET].rtype == TEMPLE) 123. 			return(*ptr); 124. 	return('\0'); 125. }  126.   127.  #endif /* OVL0 */ 128. #ifdef OVLB 129.  130.  static boolean 131. histemple_at(priest, x, y)  132. register struct monst *priest; 133. register xchar x, y;  134. { 135.  	return((boolean)((EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE)) && 136. 	       on_level(&(EPRI(priest)->shrlevel), &u.uz))); 137. }  138.   139.  /*  140.   * pri_move: return 1: moved  0: didn't  -1: let m_move do it  -2: died 141.  */  142.  int 143. pri_move(priest) 144. register struct monst *priest; 145. {  146.  	register xchar gx,gy,omx,omy; 147. 	schar temple; 148. 	boolean avoid = TRUE; 149.  150.  	omx = priest->mx; 151. 	omy = priest->my; 152.  153.  	if(!histemple_at(priest, omx, omy)) return(-1); 154.  155.  	temple = EPRI(priest)->shroom; 156.  157.  	gx = EPRI(priest)->shrpos.x;  158. gy = EPRI(priest)->shrpos.y; 159. 160. 	gx += rn1(3,-1);	/* mill around the altar */ 161. 	gy += rn1(3,-1); 162.  163.  	if(!priest->mpeaceful ||  164.  	   (Conflict && !resist(priest, RING_CLASS, 0, 0))) { 165. 		if(monnear(priest, u.ux, u.uy)) { 166. 			if(Displaced) 167. 				Your("displaced image doesn't fool %s!",  168.  					mon_nam(priest)); 169. 			(void) mattacku(priest); 170. 			return(0); 171. 		} else if(index(u.urooms, temple)) { 172. 			/* chase player if inside temple & can see him */ 173. 			if(priest->mcansee && m_canseeu(priest)) { 174. 				gx = u.ux; 175. 				gy = u.uy; 176. 			}  177.  			avoid = FALSE; 178. 		}  179.  	} else if(Invis) avoid = FALSE; 180.  181.  	return(move_special(priest,FALSE,TRUE,FALSE,avoid,omx,omy,gx,gy)); 182. }  183.   184.  /* exclusively for mktemple */ 185. void 186. priestini(lvl, sroom, sx, sy, sanctum) 187. d_level	*lvl; 188. struct mkroom *sroom; 189. int sx, sy; 190. boolean sanctum;   /* is it the seat of the high priest? */ 191.  {  192.  	register struct monst *priest; 193. 	register struct obj *otmp; 194. 	register int cnt; 195.  196.  	if(MON_AT(sx+1, sy)) 197. 		rloc(m_at(sx+1, sy)); /* insurance */ 198.  199.  	priest = (sanctum ? makemon(&mons[PM_HIGH_PRIEST], sx+1, sy)  200.  			  : makemon(&mons[PM_ALIGNED_PRIEST], sx+1, sy)); 201. 	if (priest) { 202. 		EPRI(priest)->shroom = (sroom - rooms) + ROOMOFFSET; 203. 		EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask); 204. 		EPRI(priest)->shrpos.x = sx; 205. 		EPRI(priest)->shrpos.y = sy; 206. 		assign_level(&(EPRI(priest)->shrlevel), lvl); 207. 		priest->mtrapseen = ~0;	/* traps are known */ 208. 		priest->mpeaceful = 1; 209. 		priest->ispriest = 1; 210. 		priest->msleep = 0; 211. 		set_malign(priest); /* mpeaceful may have changed */ 212.  213.  		/* now his/her goodies... */ 214.  		if(sanctum && EPRI(priest)->shralign == A_NONE &&  215.  		     on_level(&sanctum_level, &u.uz)) 216. 			(void) mongets(priest, AMULET_OF_YENDOR); 217. 		/* Do NOT put the rest in m_initinv. */ 218.  		/* Priests created elsewhere than in a  */ 219. 		/* temple should not carry these items, */ 220. 		cnt = rn1(2,3); 221. 		while(cnt) { 222. 		    otmp = mkobj(SPBOOK_CLASS, FALSE); 223. 		    if(otmp) mpickobj(priest, otmp); 224. 		    cnt--; 225. 		}  226.  		if(p_coaligned(priest)) 227. 		    (void) mongets(priest, rn2(2) ? CLOAK_OF_PROTECTION  228.  						  : CLOAK_OF_MAGIC_RESISTANCE); 229. 		else { 230. 		    if(!rn2(5)) 231. 			otmp = mksobj(CLOAK_OF_MAGIC_RESISTANCE, TRUE, FALSE); 232. 		    else otmp = mksobj(CLOAK_OF_PROTECTION, TRUE, FALSE); 233. 		    if(otmp) { 234. 			if(!rn2(2)) curse(otmp); 235. 			mpickobj(priest, otmp); 236. 		    }  237.  		}  238.  		m_dowear(priest, TRUE); 239. 	}  240.  }  241.   242.  /*  243.   * Specially aligned monsters are named specially. 244.  *	- aligned priests with ispriest and high priests have shrines 245.  *		they retain ispriest and epri when polymorphed 246.  *	- aligned priests without ispriest and Angels are roamers 247.  *		they retain isminion and access epri as emin when polymorphed 248.  *		(coaligned Angels are also created as minions, but they  249.   *		use the same naming convention) 250.  *	- minions do not have ispriest but have isminion and emin 251.  */  252.  char * 253. priestname(mon) 254. register struct monst *mon; 255. {  256.  	static NEARDATA char pname[PL_NSIZ]; 257.  258.  	Strcpy(pname, "the "); 259. 	if (mon->minvis) Strcat(pname, "invisible "); 260. 	if (mon->ispriest || mon->data == &mons[PM_ALIGNED_PRIEST] ||  261.  					mon->data == &mons[PM_ANGEL]) { 262. 		/* use epri */ 263. 		if (mon->mtame && mon->data == &mons[PM_ANGEL]) 264. 			Strcat(pname, "guardian "); 265. 		if (mon->data != &mons[PM_ALIGNED_PRIEST] &&  266.  				mon->data != &mons[PM_HIGH_PRIEST]) { 267. 			Strcat(pname, mon->data->mname); 268. 			Strcat(pname, " "); 269. 		}  270.  		if (mon->data != &mons[PM_ANGEL]) { 271. 			if (!mon->ispriest && EPRI(mon)->renegade) 272. 				Strcat(pname, "renegade "); 273. 			if (mon->data == &mons[PM_HIGH_PRIEST]) 274. 				Strcat(pname, "high "); 275. 			if (mon->female) 276. 				Strcat(pname, "priestess "); 277. 			else 278. 				Strcat(pname, "priest "); 279. 		}  280.  		Strcat(pname, "of "); 281. 		Strcat(pname, align_gname((int)EPRI(mon)->shralign)); 282. 		return(pname); 283. 	}  284.  	/* use emin instead of epri */ 285. 	Strcat(pname, mon->data->mname); 286. 	Strcat(pname, " of "); 287. 	Strcat(pname, align_gname(EMIN(mon)->min_align)); 288. 	return(pname); 289. }  290.   291.  boolean 292. p_coaligned(priest) 293. struct monst *priest; 294. {  295.  	return((boolean)(u.ualign.type == ((int)EPRI(priest)->shralign))); 296. }  297.   298.  static boolean 299. has_shrine(pri) 300. struct monst *pri; 301. {  302.  	struct rm *lev; 303.  304.  	if(!pri) 305. 		return(FALSE); 306. 	lev = &levl[EPRI(pri)->shrpos.x][EPRI(pri)->shrpos.y]; 307. 	if (!IS_ALTAR(lev->typ) || !(lev->altarmask & AM_SHRINE)) 308. 		return(FALSE); 309. 	return((boolean)(EPRI(pri)->shralign == Amask2align(lev->altarmask & ~AM_SHRINE))); 310. }  311.   312.  struct monst * 313. findpriest(roomno) 314. char roomno; 315. {  316.  	register struct monst *mtmp; 317.  318.  	for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) 319. 	    if(mtmp->ispriest && (EPRI(mtmp)->shroom == roomno) &&  320.  	       histemple_at(mtmp,mtmp->mx,mtmp->my)) 321. 		return(mtmp); 322. 	return (struct monst *)0; 323. }  324.   325.  /* called from check_special_room when the player enters the temple room */ 326. void 327. intemple(roomno) 328. register int roomno; 329. {  330.  	register struct monst *priest = findpriest((char)roomno); 331. 	boolean tended = (priest != (struct monst *)0); 332. 	boolean shrined, sanctum, can_speak; 333. 	const char *msg1, *msg2; 334. 	char buf[BUFSZ]; 335.  336.  	if(!temple_occupied(u.urooms0)) { 337. 	    if(tended) { 338. 		shrined = has_shrine(priest); 339. 		sanctum = (priest->data == &mons[PM_HIGH_PRIEST] &&  340.  			   (Is_sanctum(&u.uz) || In_endgame(&u.uz))); 341. 		can_speak = (priest->mcanmove && !priest->msleep); 342. 		if (can_speak) 343. 		    pline("%s intones:",  344.  			  (!Blind ? Monnam(priest) : "A nearby voice")); 345. 		msg2 = 0; 346. 		if(sanctum && Is_sanctum(&u.uz)) { 347. 		    if(priest->mpeaceful) { 348. 			msg1 = "Infidel, you entered Moloch's Sanctum!"; 349. 			msg2 = "Be gone!"; 350. 			priest->mpeaceful = 0; 351. 			set_malign(priest); 352. 		    } else 353. 			msg1 = "You desecrate this place by your presence!"; 354. 		} else { 355. 		    Sprintf(buf, "Pilgrim, you enter a %s place!",  356.  			    !shrined ? "desecrated" : "sacred"); 357. 		    msg1 = buf; 358. 		}  359.  		if (can_speak) { 360. 		    verbalize(msg1); 361. 		    if (msg2) verbalize(msg2); 362. 		}  363.  		if(!sanctum) { 364. 		    /* !tended -> !shrined */ 365. 		    if(!shrined || !p_coaligned(priest) ||  366.  						   u.ualign.record < -5) 367. 			You("have a%s forbidding feeling...",  368.  				(!shrined) ? "" : " strange"); 369. 		    else You("experience a strange sense of peace."); 370. 		}  371.  	    } else { 372. 		switch(rn2(3)) { 373. 		  case 0: You("have an eerie feeling..."); break; 374. 		  case 1: You_feel("like you are being watched."); break; 375. 		  default: pline("A shiver runs down your %s.",  376.  			body_part(SPINE)); break; 377. 		}  378.  		if(!rn2(5)) { 379. 		    struct monst *mtmp; 380.  381.  		    if(!(mtmp = makemon(&mons[PM_GHOST],u.ux,u.uy))) return; 382. 		    pline("An enormous ghost appears next to you!"); 383. 		    mtmp->mpeaceful = 0; 384. 		    set_malign(mtmp); 385. 		    if(flags.verbose) 386. 			You("are frightened to death, and unable to move."); 387. 		    nomul(-3); 388. 		    nomovemsg = "You regain your composure."; 389. 	       }  390.  	   }  391.         }  392.  }  393.   394.  void 395. priest_talk(priest) 396. register struct monst *priest; 397. {  398.  	boolean coaligned = p_coaligned(priest); 399. 	boolean strayed = (u.ualign.record < 0); 400.  401.  	if(priest->mflee || (!priest->ispriest && coaligned && strayed)) { 402. 	    pline("%s doesn't want anything to do with you!",  403.  				Monnam(priest)); 404. 	    priest->mpeaceful = 0; 405. 	    return; 406. 	}  407.   408.  	/* priests don't chat unless peaceful and in their own temple */ 409. 	if(!histemple_at(priest,priest->mx,priest->my) ||  410.  		 !priest->mpeaceful || !priest->mcanmove || priest->msleep) { 411. 	    static const char *cranky_msg[3] = { 412. 		"Thou wouldst have words, eh?  I'll give thee a word or two!", 413. 		"Talk?  Here is what I have to say!", 414. 		"Pilgrim, I would speak no longer with thee." 415. 	    };  416.   417.  	    if(!priest->mcanmove || priest->msleep) { 418. 		pline("%s breaks out of %s reverie!",  419.  		      Monnam(priest), his[pronoun_gender(priest)]); 420. 		priest->mfrozen = priest->msleep = 0; 421. 		priest->mcanmove = 1; 422. 	    }  423.  	    priest->mpeaceful = 0; 424. 	    verbalize(cranky_msg[rn2(3)]); 425. 	    return; 426. 	}  427.   428.  	/* you desecrated the temple and now you want to chat? */ 429.  	if(priest->mpeaceful && *in_rooms(priest->mx, priest->my, TEMPLE) &&  430.  		  !has_shrine(priest)) { 431. 	    verbalize("Begone!  Thou desecratest this holy place with thy presence."); 432. 	    priest->mpeaceful = 0; 433. 	    return; 434. 	}  435.   436.  	if(!u.ugold) { 437. 	    if(coaligned && !strayed) { 438. 		if (priest->mgold > 0L) { 439. 		    /* Note: two bits is actually 25 cents. Hmm. */ 440.  		    pline("%s gives you %s for an ale.", Monnam(priest),  441.  			(priest->mgold == 1L) ? "one bit" : "two bits"); 442. 		    if (priest->mgold > 1L) 443. 			u.ugold = 2L; 444. 		    else 445. 			u.ugold = 1L; 446. 		    priest->mgold -= u.ugold; 447. 		    flags.botl = 1; 448. 		} else 449. 		    pline("%s preaches the virtues of poverty.", Monnam(priest)); 450. 		exercise(A_WIS, TRUE); 451. 	    } else 452. 		pline("%s is not interested.", Monnam(priest)); 453. 	    return; 454. 	} else { 455. 	    long offer; 456.  457.  	    pline("%s asks you for a contribution for the temple.",  458.  			Monnam(priest)); 459. 	    if((offer = bribe(priest)) == 0) { 460. 		verbalize("Thou shalt regret thine action!"); 461. 		if(coaligned) adjalign(-1); 462. 	    } else if(offer < (u.ulevel * 200)) { 463. 		if(u.ugold > (offer * 2L)) verbalize("Cheapskate."); 464. 		else { 465. 		    verbalize("I thank thee for thy contribution."); 466. 		    /*  give player some token  */ 467. 		    exercise(A_WIS, TRUE); 468. 		}  469.  	    } else if(offer < (u.ulevel * 400)) { 470. 		verbalize("Thou art indeed a pious individual."); 471. 		if(u.ugold < (offer * 2L)) { 472. 		    if(coaligned && u.ualign.record < -5) adjalign(1); 473. 		    verbalize("I bestow upon thee a blessing."); 474. 		    HClairvoyant += rn1(500,500); 475. 		}  476.  	    } else if(offer < (u.ulevel * 600) &&  477.  		      u.ublessed < 20 &&  478.  		      (u.ublessed < 9 || !rn2(u.ublessed))) { 479. 		verbalize("Thy devotion has been rewarded."); 480. 		if (!(Protection & INTRINSIC))  { 481. 			Protection |= FROMOUTSIDE; 482. 			if (!u.ublessed)  u.ublessed = rn1(3, 2); 483. 		} else u.ublessed++; 484. 	    } else { 485. 		verbalize("Thy selfless generosity is deeply appreciated."); 486. 		if(u.ugold < (offer * 2L) && coaligned) { 487. 		    if(strayed && (moves - u.ucleansed) > 5000L) { 488. 			u.ualign.record = 0; /* cleanse thee */ 489. 			u.ucleansed = moves; 490. 		    } else { 491. 			adjalign(2); 492. 		    }  493.  		}  494.  	    }  495.  	}  496.  }  497.   498.  struct monst * 499. mk_roamer(ptr, alignment, x, y, peaceful) 500. register struct permonst *ptr; 501. aligntyp alignment; 502. xchar x, y;  503. boolean peaceful; 504. {  505.  	register struct monst *roamer; 506. 	register boolean coaligned = (u.ualign.type == alignment); 507.  508.  	if (ptr != &mons[PM_ALIGNED_PRIEST] && ptr != &mons[PM_ANGEL]) 509. 		return((struct monst *)0); 510. 	  511.  	if (MON_AT(x, y)) rloc(m_at(x, y));	/* insurance */ 512.  513.  	if (!(roamer = makemon(ptr, x, y))) 514. 		return((struct monst *)0); 515.  516.  	EPRI(roamer)->shralign = alignment; 517. 	if (coaligned && !peaceful) 518. 		EPRI(roamer)->renegade = TRUE; 519. 	/* roamer->ispriest == FALSE naturally */ 520. 	roamer->isminion = TRUE;	/* borrowing this bit */ 521. 	roamer->mtrapseen = ~0;		/* traps are known */ 522. 	roamer->mpeaceful = peaceful; 523. 	roamer->msleep = 0; 524. 	set_malign(roamer); /* peaceful may have changed */ 525.  526.  	/* MORE TO COME */ 527. 	return(roamer); 528. }  529.   530.  void 531. reset_hostility(roamer) 532. register struct monst *roamer; 533. {  534.  	if(!(roamer->isminion && (roamer->data == &mons[PM_ALIGNED_PRIEST] ||  535.  				  roamer->data == &mons[PM_ANGEL]))) 536. 	        return; 537.  538.  	if(EPRI(roamer)->shralign != u.ualign.type) { 539. 	    roamer->mpeaceful = roamer->mtame = 0; 540. 	    set_malign(roamer); 541. 	}  542.  	newsym(roamer->mx, roamer->my); 543. }  544.   545.  boolean 546. in_your_sanctuary(x, y)  547. xchar x, y; 548. { 549.  	register char roomno; 550. 	register struct monst *priest; 551.  552.  	if ((u.ualign.record < -5) || !(roomno = temple_occupied(u.urooms)) ||  553.  	    (roomno != *in_rooms(x, y, TEMPLE)) ||  554.  	    !(priest = findpriest(roomno))) 555. 		return(FALSE); 556. 	return((boolean)(has_shrine(priest) && p_coaligned(priest) && priest->mpeaceful)); 557. }  558.   559.  void 560. ghod_hitsu(priest)	/* when attacking "priest" in his temple */ 561. struct monst *priest; 562. {  563.  	int x, y, ax, ay, roomno = (int)temple_occupied(u.urooms); 564. 	struct mkroom *troom; 565.  566.  	if (!roomno || !has_shrine(priest)) 567. 		return; 568.  569.  	ax = x = EPRI(priest)->shrpos.x;  570. ay = y = EPRI(priest)->shrpos.y; 571. troom = &rooms[roomno - ROOMOFFSET]; 572.  573.  	if((u.ux == x && u.uy == y) || !linedup(u.ux, u.uy, x, y)) { 574. 	    if(IS_DOOR(levl[u.ux][u.uy].typ)) { 575.  576.  		if(u.ux == troom->lx - 1) { 577. 		    x = troom->hx; 578. 		    y = u.uy; 579. 		} else if(u.ux == troom->hx + 1) { 580. 		    x = troom->lx; 581. 		    y = u.uy; 582. 		} else if(u.uy == troom->ly - 1) { 583. 		    x = u.ux; 584. 		    y = troom->hy; 585. 		} else if(u.uy == troom->hy + 1) { 586. 		    x = u.ux; 587. 		    y = troom->ly; 588. 		}  589.  	    } else { 590. 		switch(rn2(4)) { 591. 		case 0:  x = u.ux; y = troom->ly; break; 592. 		case 1:  x = u.ux; y = troom->hy; break; 593. 		case 2:  x = troom->lx; y = u.uy; break; 594. 		default: x = troom->hx; y = u.uy; break; 595. 		}  596.  	    }  597.  	    if(!linedup(u.ux, u.uy, x, y)) return; 598. 	}  599.   600.  	switch(rn2(3)) { 601. 	case 0: 602. 	    pline("%s roars in anger:  \"Thou shalt suffer!\"",  603.  			a_gname_at(ax, ay)); 604. 	    break; 605. 	case 1: 606. 	    pline("%s voice booms:  \"How darest thou harm my servant!\"",  607.  			s_suffix(a_gname_at(ax, ay))); 608. 	    break; 609. 	default: 610. 	    pline("%s roars:  \"Thou dost profane my shrine!\"",  611.  			a_gname_at(ax, ay)); 612. 	    break; 613. 	}  614.   615.  	buzz(-10-(AD_ELEC-1), 6, x, y, sgn(tbx), sgn(tby)); /* bolt of lightning */ 616. 	exercise(A_WIS, FALSE); 617. }  618.   619.  void 620. angry_priest 621. {  622.  	register struct monst *priest; 623. 	struct rm *lev; 624.  625.  	if ((priest = findpriest(temple_occupied(u.urooms))) != 0) { 626. 	    wakeup(priest); 627. 	    /*  628.  	     * If the altar has been destroyed or converted, let the 629. 	     * priest run loose. 630. 	     * (When it's just a conversion and there happens to be  631.  	     *	a fresh corpse nearby, the priest ought to have an  632.  	     *	opportunity to try converting it back; maybe someday...) 633. 	     */  634.  	    lev = &levl[EPRI(priest)->shrpos.x][EPRI(priest)->shrpos.y]; 635. 	    if (!IS_ALTAR(lev->typ) ||  636.  		((aligntyp)Amask2align(lev->altarmask & AM_MASK) != 637. 			EPRI(priest)->shralign)) { 638. 		priest->ispriest = 0;		/* now a roamer */ 639. 		priest->isminion = 1;		/* but still aligned */ 640. 		/* this overloads the `shroom' field, which is now clobbered */ 641. 		EPRI(priest)->renegade = 0; 642. 	    }  643.  	}  644.  }  645.   646.  /*  647.   * When saving bones, find priests that aren't on their shrine level, 648.  * and remove them. This avoids big problems when restoring bones. 649.  */  650.  void 651. clearpriests 652. {  653.      register struct monst *mtmp, *mtmp2; 654.  655.      for(mtmp = fmon; mtmp; mtmp = mtmp2) { 656. 	mtmp2 = mtmp->nmon; 657. 	if (mtmp->ispriest && !on_level(&(EPRI(mtmp)->shrlevel), &u.uz)) 658. 	    mongone(mtmp); 659.     }  660.  }  661.   662.  /* munge priest-specific structure when restoring -dlc */ 663. void 664. restpriest(mtmp, ghostly) 665. register struct monst *mtmp; 666. boolean ghostly; 667. {  668.      if(u.uz.dlevel) { 669. 	if (ghostly) 670. 	    assign_level(&(EPRI(mtmp)->shrlevel), &u.uz); 671.     }  672.  }  673.   674.  #endif /* OVLB */ 675.  676.  /*priest.c*/