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

Function priestname

src/priest.c:301–367  ·  view source on GitHub ↗

* Specially aligned monsters are named specially. * - aligned priests with ispriest and high priests have shrines * they retain ispriest and epri when polymorphed * - aligned priests without ispriest are roamers * they have isminion set and use emin rather than epri * - minions do not have ispriest but have isminion and emin * - caller needs to i

Source from the content-addressed store, hash-verified

299 * the true name even when under that influence
300 */
301char *
302priestname(
303 struct monst *mon,
304 int article,
305 boolean reveal_high_priest,
306 char *pname) /* caller-supplied output buffer */
307{
308 boolean do_hallu = Hallucination,
309 aligned_priest = mon->data == &mons[PM_ALIGNED_CLERIC],
310 high_priest = mon->data == &mons[PM_HIGH_CLERIC];
311 char whatcode = '\0';
312 const char *what = do_hallu ? rndmonnam(&whatcode) : mon_pmname(mon);
313
314 if (!mon->ispriest && !mon->isminion) /* should never happen... */
315 return strcpy(pname, what); /* caller must be confused */
316
317 /* for high priest(ess), "high" (or "grand" for poohbah) will be inserted
318 [this was done near the end but we want 'what' to be updated sooner] */
319 if (mon->ispriest || aligned_priest || high_priest)
320 what = do_hallu ? "poohbah" : mon->female ? "priestess" : "priest";
321
322 *pname = '\0';
323 if (article != ARTICLE_NONE && (!do_hallu || !bogon_is_pname(whatcode))) {
324 if (article == ARTICLE_YOUR || (article == ARTICLE_A && high_priest))
325 article = ARTICLE_THE;
326 if (article == ARTICLE_THE) {
327 Strcpy(pname, "the ");
328 } else if (!strcmp(what, "Angel")) {
329 /* bypass just_an(); it would yield "" due to treating capital A
330 as indicating a personal name */
331 Strcpy(pname, "an ");
332 } else {
333 (void) just_an(pname, what);
334 }
335 }
336 /* pname[] contains "" or {"a ","an ","the "} */
337 if (mon->minvis) {
338 /* avoid "a invisible priest" */
339 if (!strcmp(pname, "a "))
340 Strcpy(pname, "an ");
341 Strcat(pname, "invisible ");
342 }
343 if (mon->isminion && EMIN(mon)->renegade) {
344 /* avoid "an renegade Angel" */
345 if (!strcmp(pname, "an ") && !mon->minvis)
346 Strcpy(pname, "a ");
347 Strcat(pname, "renegade ");
348 }
349
350 if (mon->ispriest || aligned_priest) {
351 if (high_priest)
352 Strcat(pname, do_hallu ? "grand " : "high ");
353 } else {
354 if (mon->mtame && !strcmpi(what, "Angel"))
355 Strcat(pname, "guardian ");
356 }
357
358 Strcat(pname, what);

Callers 1

do_name.cFile · 0.85

Calls 6

rndmonnamFunction · 0.85
mon_pmnameFunction · 0.85
bogon_is_pnameFunction · 0.85
just_anFunction · 0.85
halu_gnameFunction · 0.85
mon_aligntypFunction · 0.85

Tested by

no test coverage detected