MCPcopy Create free account
hub / github.com/NetHack/NetHack / intemple

Function intemple

src/priest.c:406–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406DISABLE_WARNING_FORMAT_NONLITERAL
407
408/* called from check_special_room() when the player enters the temple room */
409void
410intemple(int roomno)
411{
412 struct monst *priest, *mtmp;
413 struct epri *epri_p;
414 boolean shrined, sanctum, can_speak;
415 long *this_time, *other_time;
416 const char *msg1, *msg2;
417 char buf[BUFSZ];
418
419 /* don't do anything if hero is already in the room */
420 if (temple_occupied(u.urooms0))
421 return;
422
423 if ((priest = findpriest((char) roomno)) != 0) {
424 /* tended */
425 record_achievement(ACH_TMPL);
426
427 epri_p = EPRI(priest);
428 shrined = has_shrine(priest);
429 sanctum = (priest->data == &mons[PM_HIGH_CLERIC]
430 && (Is_sanctum(&u.uz) || In_endgame(&u.uz)));
431 can_speak = !helpless(priest);
432 if (can_speak && !Deaf && svm.moves >= epri_p->intone_time) {
433 unsigned save_priest = priest->ispriest;
434
435 /* don't reveal the altar's owner upon temple entry in
436 the endgame; for the Sanctum, the next message names
437 Moloch so suppress the "of Moloch" for him here too */
438 if (sanctum && !Hallucination)
439 priest->ispriest = 0;
440 pline("%s intones:",
441 canseemon(priest) ? Monnam(priest) : "A nearby voice");
442 priest->ispriest = save_priest;
443 epri_p->intone_time = svm.moves + (long) d(10, 500); /* ~2505 */
444 /* make sure that we don't suppress entry message when
445 we've just given its "priest intones" introduction */
446 epri_p->enter_time = 0L;
447 }
448 msg1 = msg2 = 0;
449 if (sanctum && Is_sanctum(&u.uz)) {
450 if (priest->mpeaceful) {
451 /* first time inside */
452 msg1 = "Infidel, you have entered Moloch's Sanctum!";
453 msg2 = "Be gone!";
454 priest->mpeaceful = 0;
455 /* became angry voluntarily; no penalty for attacking him */
456 set_malign(priest);
457 } else {
458 /* repeat visit, or attacked priest before entering */
459 msg1 = "You desecrate this place by your presence!";
460 }
461 } else if (svm.moves >= epri_p->enter_time) {
462 Sprintf(buf, "Pilgrim, you enter a %s place!",
463 !shrined ? "desecrated" : "sacred");

Callers 1

check_special_roomFunction · 0.85

Calls 15

temple_occupiedFunction · 0.85
findpriestFunction · 0.85
record_achievementFunction · 0.85
has_shrineFunction · 0.85
canseemonFunction · 0.85
MonnamFunction · 0.85
dFunction · 0.85
set_malignFunction · 0.85
p_coalignedFunction · 0.85
YouFunction · 0.85
mapseen_templeFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected