Source:NetHack 5.0.0/src/insight.c
Jump to navigation
Jump to search
Below is the full text to insight.c from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/src/insight.c#line12]], for example.
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. /* NetHack 5.0 insight.c $NHDT-Date: 1777004419 2026/04/23 20:20:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. /* 6. * Enlightenment and Conduct+Achievements and Vanquished+Extinct+Geno'd 7. * and stethoscope/probing feedback. 8. * 9. * Most code used to reside in cmd.c, presumably because ^X was originally 10. * a wizard mode command and the majority of those are in that file. 11. * Some came from end.c where it is used during end of game disclosure. 12. * And some came from priest.c that had once been in pline.c. 13. */ 14. 15. #include "hack.h" 16. 17. staticfn void enlght_out(const char *); 18. staticfn void enlght_line(const char *, const char *, const char *, 19. const char *); 20. staticfn char *enlght_combatinc(const char *, int, int, char *); 21. staticfn void enlght_halfdmg(int, int); 22. staticfn boolean walking_on_water(void); 23. staticfn boolean cause_known(int); 24. staticfn char *attrval(int, int, char *); 25. staticfn char *fmt_elapsed_time(char *, int); 26. staticfn char *N_times(long, char *) NONNULL NONNULLARG2; 27. staticfn void background_enlightenment(int, int); 28. staticfn void basics_enlightenment(int, int); 29. staticfn void characteristics_enlightenment(int, int); 30. staticfn void one_characteristic(int, int, int); 31. staticfn void status_enlightenment(int, int); 32. staticfn void weapon_insight(int); 33. staticfn void attributes_enlightenment(int, int); 34. staticfn void show_achievements(int); 35. staticfn int QSORTCALLBACK vanqsort_cmp(const genericptr, const genericptr); 36. staticfn int num_extinct(void); 37. staticfn int num_gone(int, int *); 38. staticfn char *size_str(int); 39. staticfn void item_resistance_message(int, const char *, int); 40. 41. extern const char *const hu_stat[]; /* hunger status from eat.c */ 42. extern const char *const enc_stat[]; /* encumbrance status from botl.c */ 43. 44. static const char You_[] = "You ", are[] = "are ", were[] = "were ", 45. have[] = "have ", had[] = "had ", can[] = "can ", 46. could[] = "could "; 47. static const char have_been[] = "have been ", have_never[] = "have never ", 48. never[] = "never "; 49. 50. /* for livelogging: */ 51. struct ll_achieve_msg { 52. long llflag; 53. const char *msg; 54. }; 55. /* ordered per 'enum achievements' in you.h */ 56. /* take care to keep them in sync! */ 57. static struct ll_achieve_msg achieve_msg [] = { 58. { 0, "" }, /* actual achievements are numbered from 1 */ 59. { LL_ACHIEVE, "acquired the Bell of Opening" }, 60. { LL_ACHIEVE, "entered Gehennom" }, 61. { LL_ACHIEVE, "acquired the Candelabrum of Invocation" }, 62. { LL_ACHIEVE, "acquired the Book of the Dead" }, 63. { LL_ACHIEVE, "performed the invocation" }, 64. { LL_ACHIEVE, "acquired The Amulet of Yendor" }, 65. { LL_ACHIEVE, "entered the Elemental Planes" }, 66. { LL_ACHIEVE, "entered the Astral Plane" }, 67. { LL_ACHIEVE, "ascended" }, 68. /* if the type of item isn't discovered yet, disclosing the event 69. via #chronicle would be a spoiler (particularly for gray stone); 70. the ID'd name for the type of item will be appended to the next 71. two messages, for display via livelog and/or dumplog */ 72. { LL_ACHIEVE | LL_SPOILER, "acquired the Mines' End" }, /* " luckstone" */ 73. { LL_ACHIEVE | LL_SPOILER, "acquired the Sokoban" }, /* " <item>" */ 74. { LL_ACHIEVE | LL_UMONST, "killed Medusa" }, 75. /* these two are not logged */ 76. { 0, "hero was always blond, no, blind" }, 77. { 0, "hero never wore armor" }, 78. /* */ 79. { LL_MINORAC | LL_DUMP, "entered the Gnomish Mines" }, 80. { LL_ACHIEVE, "reached Mine Town" }, /* probably minor, but dnh logs it */ 81. { LL_MINORAC, "entered a shop" }, 82. { LL_MINORAC, "entered a temple" }, 83. { LL_ACHIEVE, "consulted the Oracle" }, /* minor, but rare enough */ 84. { LL_MINORAC | LL_DUMP, "read a Discworld novel" }, /* even more so */ 85. { LL_ACHIEVE, "entered Sokoban" }, /* keep as major for turn comparison 86. * with completed sokoban */ 87. { LL_ACHIEVE, "entered the Bigroom" }, 88. /* The following 8 are for advancing through the ranks 89. and messages differ by role so are created on the fly; 90. rank 0 (Xp 1 and 2) isn't an achievement */ 91. { LL_MINORAC | LL_DUMP, "" }, /* Xp 3 */ 92. { LL_MINORAC | LL_DUMP, "" }, /* Xp 6 */ 93. { LL_MINORAC | LL_DUMP, "" }, /* Xp 10 */ 94. { LL_ACHIEVE, "" }, /* Xp 14, so able to attempt the quest */ 95. { LL_ACHIEVE, "" }, /* Xp 18 */ 96. { LL_ACHIEVE, "" }, /* Xp 22 */ 97. { LL_ACHIEVE, "" }, /* Xp 26 */ 98. { LL_ACHIEVE, "" }, /* Xp 30 */ 99. { LL_MINORAC, "learned castle drawbridge's tune" }, /* achievement #31 */ 100. { 0, "" } /* keep this one at the end */ 101. }; 102. 103. /* macros to simplify output of enlightenment messages; also used by 104. conduct and achievements */ 105. #define enl_msg(prefix, present, past, suffix, ps) \ 106. enlght_line((prefix), final ? (past) : (present), (suffix), (ps)) 107. #define you_are(attr, ps) enl_msg(You_, are, were, (attr), (ps)) 108. #define you_have(attr, ps) enl_msg(You_, have, had, (attr), (ps)) 109. #define you_can(attr, ps) enl_msg(You_, can, could, (attr), (ps)) 110. #define you_have_been(goodthing) \ 111. enl_msg(You_, have_been, were, (goodthing), "") 112. #define you_have_never(badthing) \ 113. enl_msg(You_, have_never, never, (badthing), "") 114. #define you_have_X(something) \ 115. enl_msg(You_, have, (const char *) "", (something), "") 116. 117. staticfn void 118. enlght_out(const char *buf) 119. { 120. if (ge.en_via_menu) { 121. add_menu_str(ge.en_win, buf); 122. } else 123. putstr(ge.en_win, 0, buf); 124. } 125. 126. staticfn void 127. enlght_line( 128. const char *start, 129. const char *middle, 130. const char *end, 131. const char *ps) 132. { 133. #ifndef NO_ENLGHT_CONTRACTIONS 134. static const struct contrctn { 135. const char *twowords, *contrctn; 136. } contra[] = { 137. { " are not ", " aren't " }, 138. { " were not ", " weren't " }, 139. { " have not ", " haven't " }, 140. { " had not ", " hadn't " }, 141. { " can not ", " can't " }, 142. { " could not ", " couldn't " }, 143. }; 144. int i; 145. #endif 146. char buf[BUFSZ]; 147. 148. Sprintf(buf, " %s%s%s%s.", start, middle, end, ps); 149. #ifndef NO_ENLGHT_CONTRACTIONS 150. if (strstri(buf, " not ")) { /* TODO: switch to libc strstr() */ 151. for (i = 0; i < SIZE(contra); ++i) 152. (void) strsubst(buf, contra[i].twowords, contra[i].contrctn); 153. } 154. #endif 155. enlght_out(buf); 156. } 157. 158. /* format increased chance to hit or damage or defense (Protection) */ 159. staticfn char * 160. enlght_combatinc( 161. const char *inctyp, /* "to hit" or "damage" or "defense" */ 162. int incamt, /* amount of increment (negative if decrement) */ 163. int final, /* ENL_{GAMEINPROGRESS,GAMEOVERALIVE,GAMEOVERDEAD} */ 164. char *outbuf) 165. { 166. const char *modif, *bonus; 167. boolean invrt; 168. int absamt; 169. 170. absamt = abs(incamt); 171. /* Protection amount is typically larger than damage or to-hit; 172. reduce magnitude by a third in order to stretch modifier ranges 173. (small:1..5, moderate:6..10, large:11..19, huge:20+) */ 174. if (!strcmp(inctyp, "defense")) 175. absamt = (absamt * 2) / 3; 176. 177. if (absamt <= 3) 178. modif = "small"; 179. else if (absamt <= 6) 180. modif = "moderate"; 181. else if (absamt <= 12) 182. modif = "large"; 183. else 184. modif = "huge"; 185. 186. modif = !incamt ? "no" : an(modif); /* ("no" case shouldn't happen) */ 187. bonus = (incamt >= 0) ? "bonus" : "penalty"; 188. /* "bonus <foo>" (to hit) vs "<bar> bonus" (damage, defense) */ 189. invrt = strcmp(inctyp, "to hit") ? TRUE : FALSE; 190. 191. Sprintf(outbuf, "%s %s %s", modif, invrt ? inctyp : bonus, 192. invrt ? bonus : inctyp); 193. if (final || wizard) 194. Sprintf(eos(outbuf), " (%s%d)", (incamt > 0) ? "+" : "", incamt); 195. 196. return outbuf; 197. } 198. 199. /* report half physical or half spell damage */ 200. staticfn void 201. enlght_halfdmg(int category, int final) 202. { 203. const char *category_name; 204. char buf[BUFSZ]; 205. 206. switch (category) { 207. case HALF_PHDAM: 208. category_name = "physical"; 209. break; 210. case HALF_SPDAM: 211. category_name = "spell"; 212. break; 213. default: 214. category_name = "unknown"; 215. break; 216. } 217. Sprintf(buf, " %s %s damage", (final || wizard) ? "half" : "reduced", 218. category_name); 219. enl_msg(You_, "take", "took", buf, from_what(category)); 220. } 221. 222. /* is hero actively using water walking capability on water (or lava)? */ 223. staticfn boolean 224. walking_on_water(void) 225. { 226. if (u.uinwater || Levitation || Flying) 227. return FALSE; 228. return (boolean) (Wwalking && is_pool_or_lava(u.ux, u.uy)); 229. } 230. 231. /* describe u.utraptype; used by status_enlightenment() and self_lookat() */ 232. char * 233. trap_predicament(char *outbuf, int final, boolean wizxtra) 234. { 235. struct trap *t; 236. 237. /* caller has verified u.utrap */ 238. *outbuf = '\0'; 239. switch (u.utraptype) { 240. case TT_BURIEDBALL: 241. Strcpy(outbuf, "tethered to something buried"); 242. break; 243. case TT_LAVA: 244. Sprintf(outbuf, "sinking into %s", final ? "lava" : hliquid("lava")); 245. break; 246. case TT_INFLOOR: 247. Sprintf(outbuf, "stuck in %s", the(surface(u.ux, u.uy))); 248. break; 249. default: /* TT_BEARTRAP, TT_PIT, or TT_WEB */ 250. Strcpy(outbuf, "trapped"); 251. if ((t = t_at(u.ux, u.uy)) != 0) /* should never be null */ 252. Sprintf(eos(outbuf), " in %s", an(trapname(t->ttyp, FALSE))); 253. break; 254. } 255. if (wizxtra) { /* give extra information for wizard mode enlightenment */ 256. /* curly braces: u.utrap is an escape attempt counter rather than a 257. turn timer so use different ornamentation than usual parentheses */ 258. Sprintf(eos(outbuf), " {%u}", u.utrap); 259. } 260. return outbuf; 261. } 262. 263. /* check whether hero is wearing something that player definitely knows 264. confers the target property; item must have been seen and its type 265. discovered but it doesn't necessarily have to be fully identified */ 266. staticfn boolean 267. cause_known( 268. int propindx) /* index of a property which can be conveyed by worn item */ 269. { 270. struct obj *o; 271. long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL; 272. 273. /* simpler than from_what()/what_gives(); we don't attempt to 274. handle artifacts and we deliberately ignore wielded items */ 275. for (o = gi.invent; o; o = o->nobj) { 276. if (!(o->owornmask & mask)) 277. continue; 278. if ((int) objects[o->otyp].oc_oprop == propindx 279. && objects[o->otyp].oc_name_known && o->dknown) 280. return TRUE; 281. } 282. return FALSE; 283. } 284. 285. /* format a characteristic value, accommodating Strength's strangeness */ 286. staticfn char * 287. attrval( 288. int attrindx, 289. int attrvalue, 290. char resultbuf[]) /* should be at least [7] to hold "18/100\0" */ 291. { 292. if (attrindx != A_STR || attrvalue <= 18) 293. Sprintf(resultbuf, "%d", attrvalue); 294. else if (attrvalue > STR18(100)) /* 19 to 25 */ 295. Sprintf(resultbuf, "%d", attrvalue - 100); 296. else /* simplify "18/\**" to be "18/100" */ 297. Sprintf(resultbuf, "18/%02d", attrvalue - 18); 298. return resultbuf; 299. } 300. 301. /* format urealtime.realtime as 302. " D days, H hours, M minutes and S seconds" 303. with any fields having a value of 0 omitted: 304. 0-00:00:20 => " 20 seconds" 305. 0-00:15:05 => " 15 minutes and 5 seconds" 306. 0-00:16:00 => " 16 minutes" 307. 0-01:15:10 => " 1 hour, 15 minutes and 10 seconds" 308. 0-02:00:01 => " 2 hours and 1 second" 309. 3-00:25:40 => " 3 days, 25 minutes and 40 seconds" 310. (note: for a list of more than two entries, nethack usually includes the 311. [style-wise] optional comma before "and" but in this instance it does not) 312. */ 313. staticfn char * 314. fmt_elapsed_time(char *outbuf, int final) 315. { 316. int fieldcnt; 317. long edays, ehours, eminutes, eseconds; 318. /* for a game that's over, reallydone() has updated urealtime.realtime 319. to its final value before calling us during end of game disclosure; 320. for a game that's still in progress, it holds the amount of elapsed 321. game time from previous sessions up through most recent save/restore 322. (or up through latest level change when 'checkpoint' is On); 323. '.start_timing' has a non-zero value even if '.realtime' is 0 */ 324. long etim = urealtime.realtime; 325. 326. if (!final) 327. etim += timet_delta(getnow(), urealtime.start_timing); 328. /* we could use localtime() to convert the value into a 'struct tm' 329. to get date and time fields but this is simple and straightforward */ 330. eseconds = etim % 60L, etim /= 60L; 331. eminutes = etim % 60L, etim /= 60L; 332. ehours = etim % 24L; 333. edays = etim / 24L; 334. fieldcnt = !!edays + !!ehours + !!eminutes + !!eseconds; 335. 336. Strcpy(outbuf, fieldcnt ? "" : " none"); /* 'none' should never happen */ 337. if (edays) { 338. Sprintf(eos(outbuf), " %ld day%s", edays, plur(edays)); 339. if (fieldcnt > 1) /* hours and/or minutes and/or seconds to follow */ 340. Strcat(outbuf, (fieldcnt == 2) ? " and" : ","); 341. --fieldcnt; /* edays has been processed */ 342. } 343. if (ehours) { 344. Sprintf(eos(outbuf), " %ld hour%s", ehours, plur(ehours)); 345. if (fieldcnt > 1) /* minutes and/or seconds to follow */ 346. Strcat(outbuf, (fieldcnt == 2) ? " and" : ","); 347. --fieldcnt; /* ehours has been processed */ 348. } 349. if (eminutes) { 350. Sprintf(eos(outbuf), " %ld minute%s", eminutes, plur(eminutes)); 351. if (fieldcnt > 1) /* seconds to follow */ 352. Strcat(outbuf, " and"); 353. /* eminutes has been processed but no need to decrement fieldcnt */ 354. } 355. if (eseconds) 356. Sprintf(eos(outbuf), " %ld second%s", eseconds, plur(eseconds)); 357. return outbuf; 358. } 359. 360. /* "once" vs "twice" vs "17 times", used in several places */ 361. staticfn char * 362. N_times(long n, char *outbuf) 363. { 364. switch (n) { 365. case 0: 366. default: 367. Sprintf(outbuf, "%ld times", n); 368. break; 369. case 1: 370. Strcpy(outbuf, "once"); 371. break; 372. case 2: 373. Strcpy(outbuf, "twice"); 374. break; 375. case 3: 376. Strcpy(outbuf, "thrice"); 377. break; 378. } 379. return outbuf; 380. } 381. 382. void 383. enlightenment( 384. int mode, /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */ 385. int final) /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */ 386. { 387. char buf[BUFSZ], tmpbuf[BUFSZ]; 388. 389. ge.en_win = create_nhwindow(NHW_MENU); 390. ge.en_via_menu = !final; 391. if (ge.en_via_menu) 392. start_menu(ge.en_win, MENU_BEHAVE_STANDARD); 393. 394. Strcpy(tmpbuf, svp.plname); 395. *tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */ 396. /* as in background_enlightenment, when poly'd we need to use the saved 397. gender in u.mfemale rather than the current you-as-monster gender */ 398. Snprintf(buf, sizeof(buf), "%s the %s's attributes:", tmpbuf, 399. ((Upolyd ? u.mfemale : flags.female) && gu.urole.name.f) 400. ? gu.urole.name.f 401. : gu.urole.name.m); 402. 403. /* title */ 404. enlght_out(buf); /* "Conan the Archeologist's attributes:" */ 405. /* background and characteristics; ^X or end-of-game disclosure */ 406. if (mode & BASICENLIGHTENMENT) { 407. /* role, race, alignment, deities, dungeon level, time, experience */ 408. background_enlightenment(mode, final); 409. /* hit points, energy points, armor class, gold */ 410. basics_enlightenment(mode, final); 411. /* strength, dexterity, &c */ 412. characteristics_enlightenment(mode, final); 413. } 414. /* expanded status line information, including things which aren't 415. included there due to space considerations; 416. shown for both basic and magic enlightenment */ 417. status_enlightenment(mode, final); 418. /* remaining attributes; shown for potion,&c or wizard mode and 419. explore mode ^X or end of game disclosure */ 420. if (mode & MAGICENLIGHTENMENT) { 421. /* intrinsics and other traditional enlightenment feedback */ 422. attributes_enlightenment(mode, final); 423. } 424. 425. enlght_out(""); /* separator */ 426. enlght_out("Miscellaneous:"); 427. /* reminder to player and/or information for dumplog */ 428. if ((mode & BASICENLIGHTENMENT) != 0 && (wizard || discover || final)) { 429. if (wizard || discover) { 430. Sprintf(buf, "running in %s mode", wizard ? "debug" : "explore"); 431. you_are(buf, ""); 432. } 433. 434. if (!flags.bones) { 435. /* mention not saving bones iff hero just died */ 436. Sprintf(buf, "disabled loading%s of bones levels", 437. (final == ENL_GAMEOVERDEAD) ? " and storing" : ""); 438. you_have_X(buf); 439. } else if (!u.uroleplay.numbones) { 440. enl_msg(You_, "haven't encountered", "didn't encounter", 441. " any bones levels", ""); 442. } else { 443. Sprintf(buf, "encountered %ld bones level%s", 444. u.uroleplay.numbones, plur(u.uroleplay.numbones)); 445. you_have_X(buf); 446. } 447. } 448. (void) fmt_elapsed_time(buf, final); 449. enl_msg("Total elapsed playing time ", "is", "was", buf, ""); 450. 451. if (!ge.en_via_menu) { 452. display_nhwindow(ge.en_win, TRUE); 453. } else { 454. menu_item *selected = 0; 455. 456. end_menu(ge.en_win, (char *) 0); 457. if (select_menu(ge.en_win, PICK_NONE, &selected) > 0) 458. free((genericptr_t) selected); 459. ge.en_via_menu = FALSE; 460. } 461. destroy_nhwindow(ge.en_win); 462. ge.en_win = WIN_ERR; 463. } 464. 465. /*ARGSUSED*/ 466. /* display role, race, alignment and such to en_win */ 467. staticfn void 468. background_enlightenment(int unused_mode UNUSED, int final) 469. { 470. const char *role_titl, *rank_titl; 471. int innategend, difgend, difalgn; 472. char buf[BUFSZ], tmpbuf[BUFSZ]; 473. 474. /* note that if poly'd, we need to use u.mfemale instead of flags.female 475. to access hero's saved gender-as-human/elf/&c rather than current */ 476. innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0; 477. role_titl = (innategend && gu.urole.name.f) ? gu.urole.name.f 478. : gu.urole.name.m; 479. rank_titl = rank_of(u.ulevel, Role_switch, innategend); 480. 481. enlght_out(""); /* separator after title */ 482. enlght_out("Background:"); 483. 484. /* if polymorphed, report current shape before underlying role; 485. will be repeated as first status: "you are transformed" and also 486. among various attributes: "you are in beast form" (after being 487. told about lycanthropy) or "you are polymorphed into <a foo>" 488. (with countdown timer appended for wizard mode); we really want 489. the player to know he's not a samurai at the moment... */ 490. if (Upolyd) { 491. char anbuf[20]; /* includes trailing space; [4] suffices */ 492. struct permonst *uasmon = gy.youmonst.data; 493. boolean altphrasing = vampshifted(&gy.youmonst); 494. 495. tmpbuf[0] = '\0'; 496. /* here we always use current gender, not saved role gender */ 497. if (!is_male(uasmon) && !is_female(uasmon) && !is_neuter(uasmon)) 498. Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj); 499. if (altphrasing) 500. Sprintf(eos(tmpbuf), "%s in ", 501. pmname(&mons[gy.youmonst.cham], 502. flags.female ? FEMALE : MALE)); 503. Snprintf(buf, sizeof(buf), "%s%s%s%s form", 504. !final ? "currently " : "", 505. altphrasing ? just_an(anbuf, tmpbuf) : "in ", 506. tmpbuf, pmname(uasmon, flags.female ? FEMALE : MALE)); 507. you_are(buf, ""); 508. } 509. 510. /* report role; omit gender if it's redundant (eg, "female priestess") */ 511. tmpbuf[0] = '\0'; 512. if (!gu.urole.name.f 513. && ((gu.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE) 514. || innategend != flags.initgend)) 515. Sprintf(tmpbuf, "%s ", genders[innategend].adj); 516. buf[0] = '\0'; 517. if (Upolyd) 518. Strcpy(buf, "actually "); /* "You are actually a ..." */ 519. if (!strcmpi(rank_titl, role_titl)) { 520. /* omit role when rank title matches it */ 521. Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel, 522. tmpbuf, gu.urace.noun); 523. } else { 524. Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel, 525. tmpbuf, gu.urace.adj, role_titl); 526. } 527. you_are(buf, ""); 528. 529. /* report alignment (bypass you_are() in order to omit ending period); 530. adverb is used to distinguish between temporary change (helm of opp. 531. alignment), permanent change (one-time conversion), and original */ 532. Sprintf(buf, " %s%s%s, %son a mission for %s", 533. You_, !final ? are : were, 534. align_str(u.ualign.type), 535. /* helm of opposite alignment (might hide conversion) */ 536. (u.ualign.type != u.ualignbase[A_CURRENT]) 537. /* what's the past tense of "currently"? if we used "formerly" 538. it would sound like a reference to the original alignment */ 539. ? (!final ? "currently " : "temporarily ") 540. /* permanent conversion */ 541. : (u.ualign.type != u.ualignbase[A_ORIGINAL]) 542. /* and what's the past tense of "now"? certainly not "then" 543. in a context like this...; "belatedly" == weren't that 544. way sooner (in other words, didn't start that way) */ 545. ? (!final ? "now " : "belatedly ") 546. /* atheist (ignored in very early game) */ 547. : (!u.uconduct.gnostic && svm.moves > 1000L) 548. ? "nominally " 549. /* lastly, normal case */ 550. : "", 551. u_gname()); 552. enlght_out(buf); 553. /* show the rest of this game's pantheon (finishes previous sentence) 554. [appending "also Moloch" at the end would allow for straightforward 555. trailing "and" on all three aligned entries but looks too verbose] */ 556. Sprintf(buf, " who %s opposed by", !final ? "is" : "was"); 557. if (u.ualign.type != A_LAWFUL) 558. Sprintf(eos(buf), " %s (%s) and", align_gname(A_LAWFUL), 559. align_str(A_LAWFUL)); 560. if (u.ualign.type != A_NEUTRAL) 561. Sprintf(eos(buf), " %s (%s)%s", align_gname(A_NEUTRAL), 562. align_str(A_NEUTRAL), 563. (u.ualign.type != A_CHAOTIC) ? " and" : ""); 564. if (u.ualign.type != A_CHAOTIC) 565. Sprintf(eos(buf), " %s (%s)", align_gname(A_CHAOTIC), 566. align_str(A_CHAOTIC)); 567. Strcat(buf, "."); /* terminate sentence */ 568. enlght_out(buf); 569. 570. /* show original alignment,gender,race,role if any have been changed; 571. giving separate message for temporary alignment change bypasses need 572. for tricky phrasing otherwise necessitated by possibility of having 573. helm of opposite alignment mask a permanent alignment conversion */ 574. difgend = (innategend != flags.initgend); 575. difalgn = (((u.ualign.type != u.ualignbase[A_CURRENT]) ? 1 : 0) 576. + ((u.ualignbase[A_CURRENT] != u.ualignbase[A_ORIGINAL]) 577. ? 2 : 0)); 578. if (difalgn & 1) { /* have temporary alignment so report permanent one */ 579. Sprintf(buf, "actually %s", align_str(u.ualignbase[A_CURRENT])); 580. you_are(buf, ""); 581. difalgn &= ~1; /* suppress helm from "started out <foo>" message */ 582. } 583. if (difgend || difalgn) { /* sex change or perm align change or both */ 584. Sprintf(buf, " You started out %s%s%s.", 585. difgend ? genders[flags.initgend].adj : "", 586. (difgend && difalgn) ? " and " : "", 587. difalgn ? align_str(u.ualignbase[A_ORIGINAL]) : ""); 588. enlght_out(buf); 589. } 590. 591. /* "You are left-handed." won't work well if polymorphed into something 592. without hands; use "You are normally left-handed." in that situation */ 593. Sprintf(buf, "%s%s-handed", 594. !strcmp(body_part(HANDED), "handed") ? "" : "normally ", 595. URIGHTY ? "right" : "left"); 596. you_are(buf, ""); 597. 598. /* As of 3.6.2: dungeon level, so that ^X really has all status info as 599. claimed by the comment below; this reveals more information than 600. the basic status display, but that's one of the purposes of ^X; 601. similar information is revealed by #overview; the "You died in 602. <location>" given by really_done() is more rudimentary than this */ 603. *buf = *tmpbuf = '\0'; 604. if (In_endgame(&u.uz)) { 605. int egdepth = observable_depth(&u.uz); 606. 607. (void) endgamelevelname(tmpbuf, egdepth); 608. Snprintf(buf, sizeof(buf), "in the endgame, on the %s%s", 609. !strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf); 610. } else if (Is_knox(&u.uz)) { 611. /* this gives away the fact that the knox branch is only 1 level */ 612. Sprintf(buf, "on the %s level", svd.dungeons[u.uz.dnum].dname); 613. /* TODO? maybe phrase it differently when actually inside the fort, 614. if we're able to determine that (not trivial) */ 615. } else { 616. char dgnbuf[QBUFSZ]; 617. 618. Strcpy(dgnbuf, svd.dungeons[u.uz.dnum].dname); 619. if (!strncmpi(dgnbuf, "The ", 4)) 620. *dgnbuf = lowc(*dgnbuf); 621. Sprintf(tmpbuf, "level %d", 622. In_quest(&u.uz) ? dunlev(&u.uz) : depth(&u.uz)); 623. /* TODO? maybe extend this bit to include various other automatic 624. annotations from the dungeon overview code */ 625. if (Is_rogue_level(&u.uz)) 626. Strcat(tmpbuf, ", a primitive area"); 627. else if (Is_bigroom(&u.uz) && !Blind) 628. Strcat(tmpbuf, ", a very big room"); 629. Snprintf(buf, sizeof(buf), "in %s, on %s", dgnbuf, tmpbuf); 630. } 631. you_are(buf, ""); 632. 633. /* this is shown even if the 'time' option is off */ 634. if (svm.moves == 1L) { 635. you_have("just started your adventure", ""); 636. } else { 637. /* 'turns' grates on the nerves in this context... */ 638. Sprintf(buf, "the dungeon %ld turn%s ago", 639. svm.moves, plur(svm.moves)); 640. /* same phrasing for current and final: "entered" is unconditional */ 641. enlght_line(You_, "entered ", buf, ""); 642. } 643. 644. /* for gameover, these have been obtained in really_done() so that they 645. won't vary if user leaves a disclosure prompt or --More-- unanswered 646. long enough for the dynamic value to change between then and now */ 647. if (final ? iflags.at_midnight : midnight()) { 648. enl_msg("It ", "is ", "was ", "the midnight hour", ""); 649. } else if (final ? iflags.at_night : night()) { 650. enl_msg("It ", "is ", "was ", "nighttime", ""); 651. } 652. /* other environmental factors */ 653. if (flags.moonphase == FULL_MOON || flags.moonphase == NEW_MOON) { 654. /* [This had "tonight" but has been changed to "in effect". 655. There is a similar issue to Friday the 13th--it's the value 656. at the start of the current session but that session might 657. have dragged on for an arbitrary amount of time. We want to 658. report the values that currently affect play--or affected 659. play when game ended--rather than actual outside situation.] */ 660. Sprintf(buf, "a %s moon in effect%s", 661. (flags.moonphase == FULL_MOON) ? "full" 662. : (flags.moonphase == NEW_MOON) ? "new" 663. /* showing these would probably just lead to confusion 664. since they have no effect on game play... */ 665. : (flags.moonphase < FULL_MOON) ? "first quarter" 666. : "last quarter", 667. /* we don't have access to 'how' here--aside from survived 668. vs died--so settle for general platitude */ 669. final ? " when your adventure ended" : ""); 670. enl_msg("There ", "is ", "was ", buf, ""); 671. } 672. if (flags.friday13) { 673. /* let player know that friday13 penalty is/was in effect; 674. we don't say "it is/was Friday the 13th" because that was at 675. the start of the session and it might be past midnight (or 676. days later if the game has been paused without save/restore), 677. so phrase this similar to the start up message */ 678. Sprintf(buf, " Bad things %s on Friday the 13th.", 679. !final ? "can happen" 680. : (final == ENL_GAMEOVERALIVE) ? "could have happened" 681. /* there's no may to tell whether -1 Luck made a 682. difference but hero has died... */ 683. : "happened"); 684. enlght_out(buf); 685. } 686. 687. if (!Upolyd) { 688. int ulvl = (int) u.ulevel; 689. /* [flags.showexp currently does not matter; should it?] */ 690. 691. /* experience level is already shown above */ 692. Sprintf(buf, "%-1ld experience point%s", u.uexp, plur(u.uexp)); 693. /* TODO? 694. * Remove wizard-mode restriction since patient players can 695. * determine the numbers needed without resorting to spoilers 696. * (even before this started being disclosed for 'final'; 697. * just enable 'showexp' and look at normal status lines 698. * after drinking gain level potions or eating wraith corpses 699. * or being level-drained by vampires). 700. */ 701. if (ulvl < 30 && (final || wizard)) { 702. long nxtlvl = newuexp(ulvl), delta = nxtlvl - u.uexp; 703. 704. Sprintf(eos(buf), ", %ld %s%sneeded %s level %d", 705. delta, (u.uexp > 0) ? "more " : "", 706. /* present tense=="needed", past tense=="were needed" */ 707. !final ? "" : (delta == 1L) ? "was " : "were ", 708. /* "for": grammatically iffy but less likely to wrap */ 709. (ulvl < 18) ? "to attain" : "for", (ulvl + 1)); 710. } 711. you_have(buf, ""); 712. } 713. #ifdef SCORE_ON_BOTL 714. if (flags.showscore) { 715. /* describes what's shown on status line, which is an approximation; 716. only show it here if player has the 'showscore' option enabled */ 717. Sprintf(buf, "%ld%s", botl_score(), 718. !final ? "" : " before end-of-game adjustments"); 719. enl_msg("Your score ", "is ", "was ", buf, ""); 720. } 721. #endif 722. } 723. 724. /* hit points, energy points, armor class -- essential information which 725. doesn't fit very well in other categories */ 726. /*ARGSUSED*/ 727. staticfn void 728. basics_enlightenment(int mode UNUSED, int final) 729. { 730. static char Power[] = "energy points (spell power)"; 731. char buf[BUFSZ]; 732. int pw = u.uen, hp = (Upolyd ? u.mh : u.uhp), 733. pwmax = u.uenmax, hpmax = (Upolyd ? u.mhmax : u.uhpmax); 734. 735. enlght_out(""); /* separator after background */ 736. enlght_out("Basics:"); 737. 738. if (hp < 0) 739. hp = 0; 740. /* "1 out of 1" rather than "all" if max is only 1; should never happen */ 741. if (hp == hpmax && hpmax > 1) 742. Sprintf(buf, "all %d hit points", hpmax); 743. else 744. Sprintf(buf, "%d out of %d hit point%s", hp, hpmax, plur(hpmax)); 745. you_have(buf, ""); 746. 747. /* low max energy is feasible, so handle couple of extra special cases */ 748. if (pwmax == 0 || (pw == pwmax && pwmax == 2)) /* both: not "all 2" */ 749. Sprintf(buf, "%s %s", !pwmax ? "no" : "both", Power); 750. else if (pw == pwmax && pwmax > 2) 751. Sprintf(buf, "all %d %s", pwmax, Power); 752. else 753. Sprintf(buf, "%d out of %d %s", pw, pwmax, Power); 754. you_have(buf, ""); 755. 756. if (Upolyd) { 757. switch (mons[u.umonnum].mlevel) { 758. case 0: 759. /* status line currently being explained shows "HD:0" */ 760. Strcpy(buf, "0 hit dice (actually 1/2)"); 761. break; 762. case 1: 763. Strcpy(buf, "1 hit die"); 764. break; 765. default: 766. Sprintf(buf, "%d hit dice", mons[u.umonnum].mlevel); 767. break; 768. } 769. you_have(buf, ""); 770. } 771. 772. find_ac(); /* enforces AC_MAX cap */ 773. Sprintf(buf, "%d", u.uac); 774. if (abs(u.uac) == AC_MAX) 775. Sprintf(eos(buf), ", the %s possible", 776. (u.uac < 0) ? "best" : "worst"); 777. enl_msg("Your armor class ", "is ", "was ", buf, ""); 778. 779. /* gold; similar to doprgold (#showgold) but without shop billing info; 780. includes container contents, unlike status line but like doprgold */ 781. { 782. long umoney = money_cnt(gi.invent), hmoney = hidden_gold(final); 783. 784. if (!umoney) { 785. Sprintf(buf, " Your wallet %s empty", !final ? "is" : "was"); 786. } else { 787. Sprintf(buf, " Your wallet contain%s %ld %s", !final ? "s" : "ed", 788. umoney, currency(umoney)); 789. } 790. /* terminate the wallet line if appropriate, otherwise add an 791. introduction to subsequent continuation; output now either way */ 792. Strcat(buf, !hmoney ? "." : !umoney ? ", but" : ", and"); 793. enlght_out(buf); 794. 795. /* put contained gold on its own line to avoid excessive width; it's 796. phrased as a continuation of the wallet line so not capitalized */ 797. if (hmoney) { 798. Sprintf(buf, "%ld %s stashed away in your pack", 799. hmoney, umoney ? "more" : currency(hmoney)); 800. enl_msg("you ", "have ", "had ", buf, ""); 801. } 802. } 803. 804. if (flags.pickup) { 805. char ocl[MAXOCLASSES + 1]; 806. 807. Strcpy(buf, "on"); 808. if (costly_spot(u.ux, u.uy)) { 809. /* being in a shop inhibits autopickup, even 'pickup_thrown' */ 810. Strcat(buf, ", but temporarily disabled while inside the shop"); 811. } else { 812. oc_to_str(flags.pickup_types, ocl); 813. Sprintf(eos(buf), " for %s%s%s", *ocl ? "'" : "", 814. *ocl ? ocl : "all types", *ocl ? "'" : ""); 815. if (flags.pickup_thrown && *ocl) 816. Strcat(buf, " plus thrown"); /* show when not 'all types' */ 817. if (ga.apelist) 818. Strcat(buf, ", with exceptions"); 819. } 820. } else 821. Strcpy(buf, "off"); 822. enl_msg("Autopickup ", "is ", "was ", buf, ""); 823. } 824. 825. /* characteristics: expanded version of bottom line strength, dexterity, &c */ 826. staticfn void 827. characteristics_enlightenment(int mode, int final) 828. { 829. char buf[BUFSZ]; 830. 831. enlght_out(""); 832. Sprintf(buf, "%sCharacteristics:", !final ? "" : "Final "); 833. enlght_out(buf); 834. 835. /* bottom line order */ 836. one_characteristic(mode, final, A_STR); /* strength */ 837. one_characteristic(mode, final, A_DEX); /* dexterity */ 838. one_characteristic(mode, final, A_CON); /* constitution */ 839. one_characteristic(mode, final, A_INT); /* intelligence */ 840. one_characteristic(mode, final, A_WIS); /* wisdom */ 841. one_characteristic(mode, final, A_CHA); /* charisma */ 842. } 843. 844. /* display one attribute value for characteristics_enlightenment() */ 845. staticfn void 846. one_characteristic(int mode, int final, int attrindx) 847. { 848. extern const char *const attrname[]; /* attrib.c */ 849. boolean hide_innate_value = FALSE, interesting_alimit; 850. int acurrent, abase, apeak, alimit; 851. const char *paren_pfx; 852. char subjbuf[BUFSZ], valubuf[BUFSZ], valstring[32]; 853. 854. /* being polymorphed or wearing certain cursed items prevents 855. hero from reliably tracking changes to characteristics so 856. we don't show base & peak values then; when the items aren't 857. cursed, hero could take them off to check underlying values 858. and we show those in such case so that player doesn't need 859. to actually resort to doing that */ 860. if (Upolyd) { 861. hide_innate_value = TRUE; 862. } else if (Fixed_abil) { 863. if (stuck_ring(uleft, RIN_SUSTAIN_ABILITY) 864. || stuck_ring(uright, RIN_SUSTAIN_ABILITY)) 865. hide_innate_value = TRUE; 866. } 867. switch (attrindx) { 868. case A_STR: 869. if (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER && uarmg->cursed) 870. hide_innate_value = TRUE; 871. break; 872. case A_DEX: 873. break; 874. case A_CON: 875. if (u_wield_art(ART_OGRESMASHER) && uwep->cursed) 876. hide_innate_value = TRUE; 877. break; 878. case A_INT: 879. if (uarmh && uarmh->otyp == DUNCE_CAP && uarmh->cursed) 880. hide_innate_value = TRUE; 881. break; 882. case A_WIS: 883. if (uarmh && uarmh->otyp == DUNCE_CAP && uarmh->cursed) 884. hide_innate_value = TRUE; 885. break; 886. case A_CHA: 887. break; 888. default: 889. return; /* impossible */ 890. }; 891. /* note: final disclosure includes MAGICENLIGHTENTMENT */ 892. if ((mode & MAGICENLIGHTENMENT) && !Upolyd) 893. hide_innate_value = FALSE; 894. 895. acurrent = ACURR(attrindx); 896. (void) attrval(attrindx, acurrent, valubuf); /* Sprintf(valubuf,"%d",) */ 897. Sprintf(subjbuf, "Your %s ", attrname[attrindx]); 898. 899. if (!hide_innate_value) { 900. /* show abase, amax, and/or attrmax if acurr doesn't match abase 901. (a magic bonus or penalty is in effect) or abase doesn't match 902. amax (some points have been lost to poison or exercise abuse 903. and are restorable) or attrmax is different from normal human 904. (while game is in progress; trying to reduce dependency on 905. spoilers to keep track of such stuff) or attrmax was different 906. from abase (at end of game; this attribute wasn't maxed out) */ 907. abase = ABASE(attrindx); 908. apeak = AMAX(attrindx); 909. alimit = ATTRMAX(attrindx); 910. /* criterium for whether the limit is interesting varies */ 911. interesting_alimit = 912. final ? TRUE /* was originally `(abase != alimit)' */ 913. : (alimit != (attrindx != A_STR ? 18 : STR18(100))); 914. paren_pfx = final ? " (" : " (current; "; 915. if (acurrent != abase) { 916. Sprintf(eos(valubuf), "%sbase:%s", paren_pfx, 917. attrval(attrindx, abase, valstring)); 918. paren_pfx = ", "; 919. } 920. if (abase != apeak) { 921. Sprintf(eos(valubuf), "%speak:%s", paren_pfx, 922. attrval(attrindx, apeak, valstring)); 923. paren_pfx = ", "; 924. } 925. if (interesting_alimit) { 926. Sprintf(eos(valubuf), "%s%slimit:%s", paren_pfx, 927. /* more verbose if exceeding 'limit' due to magic bonus */ 928. (acurrent > alimit) ? "innate " : "", 929. attrval(attrindx, alimit, valstring)); 930. /* paren_pfx = ", "; */ 931. } 932. if (acurrent != abase || abase != apeak || interesting_alimit) 933. Strcat(valubuf, ")"); 934. } 935. enl_msg(subjbuf, "is ", "was ", valubuf, ""); 936. } 937. 938. /* status: selected obvious capabilities, assorted troubles */ 939. staticfn void 940. status_enlightenment(int mode, int final) 941. { 942. boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE; 943. int cap; 944. char buf[BUFSZ], youtoo[BUFSZ], heldmon[BUFSZ]; 945. boolean Riding = (u.usteed 946. /* if hero dies while dismounting, u.usteed will still 947. be set; we want to ignore steed in that situation */ 948. && !(final == ENL_GAMEOVERDEAD 949. && !strcmp(svk.killer.name, "riding accident"))); 950. const char *steedname = (!Riding ? (char *) 0 951. : x_monnam(u.usteed, 952. u.usteed->mtame ? ARTICLE_YOUR : ARTICLE_THE, 953. (char *) 0, 954. (SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION), 955. FALSE)); 956. 957. /*\ 958. * Status (many are abbreviated on bottom line; others are or 959. * should be discernible to the hero hence to the player) 960. \*/ 961. enlght_out(""); /* separator after title or characteristics */ 962. enlght_out(final ? "Final Status:" : "Status:"); 963. 964. Strcpy(youtoo, You_); 965. /* not a traditional status but inherently obvious to player; more 966. detail given below (attributes section) for magic enlightenment */ 967. if (Upolyd) { 968. Strcpy(buf, "transformed"); 969. if (ugenocided()) 970. Sprintf(eos(buf), " and %s %s inside", 971. final ? "felt" : "feel", udeadinside()); 972. you_are(buf, ""); 973. } 974. /* not a trouble, but we want to display riding status before maybe 975. reporting steed as trapped or hero stuck to cursed saddle */ 976. if (Riding) { 977. Sprintf(buf, "riding %s", steedname); 978. you_are(buf, ""); 979. Sprintf(eos(youtoo), "and %s ", steedname); 980. } 981. /* other movement situations that hero should always know */ 982. if (Levitation) { 983. if (Lev_at_will && magic) 984. you_are("levitating, at will", ""); 985. else 986. enl_msg(youtoo, are, were, "levitating", from_what(LEVITATION)); 987. } else if (Flying) { /* can only fly when not levitating */ 988. enl_msg(youtoo, are, were, "flying", from_what(FLYING)); 989. } 990. if (Underwater) { 991. you_are("underwater", ""); 992. } else if (u.uinwater) { 993. you_are(Swimming ? "swimming" : "in water", from_what(SWIMMING)); 994. } else if (walking_on_water()) { 995. /* show active Wwalking here, potential Wwalking elsewhere */ 996. Sprintf(buf, "walking on %s", 997. is_pool(u.ux, u.uy) ? "water" 998. : is_lava(u.ux, u.uy) ? "lava" 999. : surface(u.ux, u.uy)); /* catchall; shouldn't happen */ 1000. you_are(buf, from_what(WWALKING)); 1001. } 1002. if (Upolyd && (u.uundetected || U_AP_TYPE != M_AP_NOTHING)) 1003. youhiding(TRUE, final); 1004. 1005. /* internal troubles, mostly in the order that prayer ranks them */ 1006. if (Stoned) { 1007. if (final && (Stoned & I_SPECIAL)) 1008. enlght_out(" You turned into stone."); 1009. else 1010. you_are("turning to stone", ""); 1011. } 1012. if (Slimed) { 1013. if (final && (Slimed & I_SPECIAL)) 1014. enlght_out(" You turned into slime."); 1015. else 1016. you_are("turning into slime", ""); 1017. } 1018. if (Strangled) { 1019. if (u.uburied) { 1020. you_are("buried", ""); 1021. } else { 1022. if (final && (Strangled & I_SPECIAL)) { 1023. enlght_out(" You died from strangulation."); 1024. } else { 1025. Strcpy(buf, "being strangled"); 1026. if (wizard) 1027. Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT)); 1028. you_are(buf, from_what(STRANGLED)); 1029. } 1030. } 1031. } 1032. if (Sick) { 1033. /* the two types of sickness are lumped together; hero can be 1034. afflicted by both but there is only one timeout; botl status 1035. puts TermIll before FoodPois and death due to timeout reports 1036. terminal illness if both are in effect, so do the same here */ 1037. if (final && (Sick & I_SPECIAL)) { 1038. Sprintf(buf, " %sdied from %s.", You_, /* has trailing space */ 1039. (u.usick_type & SICK_NONVOMITABLE) 1040. ? "terminal illness" : "food poisoning"); 1041. enlght_out(buf); 1042. } else { 1043. /* unlike death due to sickness, report the two cases separately 1044. because it is possible to cure one without curing the other */ 1045. if (u.usick_type & SICK_NONVOMITABLE) 1046. you_are("terminally sick from illness", ""); 1047. if (u.usick_type & SICK_VOMITABLE) 1048. you_are("terminally sick from food poisoning", ""); 1049. } 1050. } 1051. if (Vomiting) 1052. you_are("nauseated", ""); 1053. if (Stunned) 1054. you_are("stunned", ""); 1055. if (Confusion) 1056. you_are("confused", ""); 1057. if (Hallucination) 1058. you_are("hallucinating", ""); 1059. if (Blind) { 1060. /* check the reasons in same order as from_what() */ 1061. Sprintf(buf, "%s blind", 1062. (HBlinded & FROMOUTSIDE) != 0L ? "permanently" 1063. : (HBlinded & FROMFORM) ? "innately" 1064. /* better phrasing desperately wanted... */ 1065. : Blindfolded_only ? "deliberately" 1066. /* timed, possibly combined with blindfold */ 1067. : "temporarily"); 1068. if (wizard && (HBlinded == BlindedTimeout && !Blindfolded)) 1069. Sprintf(eos(buf), " (%ld)", BlindedTimeout); 1070. /* !haseyes: avoid "you are innately blind innately" */ 1071. you_are(buf, !haseyes(gy.youmonst.data) ? "" : from_what(BLINDED)); 1072. } 1073. if (Deaf) 1074. you_are("deaf", from_what(DEAF)); 1075. 1076. /* external troubles, more or less */ 1077. if (Punished) { 1078. if (uball) { 1079. Sprintf(buf, "chained to %s", ansimpleoname(uball)); 1080. } else { 1081. impossible("Punished without uball?"); 1082. Strcpy(buf, "punished"); 1083. } 1084. you_are(buf, ""); 1085. } 1086. if (u.utrap) { 1087. char predicament[BUFSZ]; 1088. boolean anchored = (u.utraptype == TT_BURIEDBALL); 1089. 1090. (void) trap_predicament(predicament, final, wizard); 1091. if (u.usteed) { /* not `Riding' here */ 1092. Sprintf(buf, "%s%s ", anchored ? "you and " : "", steedname); 1093. *buf = highc(*buf); 1094. enl_msg(buf, (anchored ? "are " : "is "), 1095. (anchored ? "were " : "was "), predicament, ""); 1096. } else 1097. you_are(predicament, ""); 1098. } /* (u.utrap) */ 1099. heldmon[0] = '\0'; /* lint suppression */ 1100. if (u.ustuck) { /* includes u.uswallow */ 1101. Strcpy(heldmon, a_monnam(u.ustuck)); 1102. if (!strcmp(heldmon, "it") 1103. && (!has_mgivenname(u.ustuck) 1104. || strcmp(MGIVENNAME(u.ustuck), "it") != 0)) 1105. Strcpy(heldmon, "an unseen creature"); 1106. } 1107. if (u.uswallow) { 1108. assert(u.ustuck != NULL); /* implied by u.uswallow */ 1109. Snprintf(buf, sizeof buf, "%s by %s", 1110. digests(u.ustuck->data) ? "swallowed" : "engulfed", 1111. heldmon); 1112. if (dmgtype(u.ustuck->data, AD_DGST)) { 1113. /* if final, death via digestion can be deduced by u.uswallow 1114. still being True and u.uswldtim having been decremented to 0 */ 1115. if (final && !u.uswldtim) 1116. Strcat(buf, " and got totally digested"); 1117. else 1118. Sprintf(eos(buf), " and %s being digested", 1119. final ? "were" : "are"); 1120. } 1121. if (wizard) 1122. Sprintf(eos(buf), " (%u)", u.uswldtim); 1123. you_are(buf, ""); 1124. } else if (u.ustuck) { 1125. boolean ustick = (Upolyd && sticks(gy.youmonst.data)); 1126. int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy; 1127. 1128. Snprintf(buf, sizeof buf, "%s %s (%s)", 1129. ustick ? "holding" : "held by", 1130. heldmon, dxdy_to_dist_descr(dx, dy, TRUE)); 1131. you_are(buf, ""); 1132. } 1133. if (Riding) { 1134. struct obj *saddle = which_armor(u.usteed, W_SADDLE); 1135. 1136. if (saddle && saddle->cursed) { 1137. Sprintf(buf, "stuck to %s %s", s_suffix(steedname), 1138. simpleonames(saddle)); 1139. you_are(buf, ""); 1140. } 1141. } 1142. if (Wounded_legs) { 1143. /* EWounded_legs is used to track left/right/both rather than some 1144. form of extrinsic impairment; HWounded_legs is used for timeout; 1145. both apply to steed instead of hero when mounted */ 1146. long whichleg = (EWounded_legs & BOTH_SIDES); 1147. const char *bp = u.usteed ? mbodypart(u.usteed, LEG) : body_part(LEG), 1148. *article = "a ", /* precedes "wounded", so never "an " */ 1149. *leftright = ""; 1150. 1151. if (whichleg == BOTH_SIDES) 1152. bp = makeplural(bp), article = ""; 1153. else 1154. leftright = (whichleg == LEFT_SIDE) ? "left " : "right "; 1155. Sprintf(buf, "%swounded %s%s", article, leftright, bp); 1156. 1157. /* when mounted, Wounded_legs applies to steed rather than to 1158. hero; we only report steed's wounded legs in wizard mode */ 1159. if (u.usteed) { /* not `Riding' here */ 1160. if (wizard && steedname) { 1161. char steednambuf[BUFSZ]; 1162. 1163. Strcpy(steednambuf, steedname); 1164. *steednambuf = highc(*steednambuf); 1165. enl_msg(steednambuf, " has ", " had ", buf, ""); 1166. } 1167. } else { 1168. you_have(buf, ""); 1169. } 1170. } 1171. if (Glib) { 1172. Sprintf(buf, "slippery %s", fingers_or_gloves(TRUE)); 1173. if (wizard) 1174. Sprintf(eos(buf), " (%ld)", (Glib & TIMEOUT)); 1175. you_have(buf, ""); 1176. } 1177. if (Fumbling) { 1178. if (magic || cause_known(FUMBLING)) 1179. enl_msg(You_, "fumble", "fumbled", "", from_what(FUMBLING)); 1180. } 1181. if (Sleepy) { 1182. if (magic || cause_known(SLEEPY)) { 1183. Strcpy(buf, from_what(SLEEPY)); 1184. if (wizard) 1185. Sprintf(eos(buf), " (%ld)", (HSleepy & TIMEOUT)); 1186. enl_msg("You ", "fall", "fell", " asleep uncontrollably", buf); 1187. } 1188. } 1189. /* hunger/nutrition */ 1190. if (Hunger) { 1191. if (magic || cause_known(HUNGER)) 1192. enl_msg(You_, "hunger", "hungered", " rapidly", 1193. from_what(HUNGER)); 1194. } 1195. Strcpy(buf, hu_stat[u.uhs]); /* hunger status; omitted if "normal" */ 1196. mungspaces(buf); /* strip trailing spaces */ 1197. /* status line doesn't show hunger when state is "not hungry", we do; 1198. needed for wizard mode's reveal of u.uhunger but add it for everyone */ 1199. if (!*buf) 1200. Strcpy(buf, "not hungry"); 1201. if (*buf) { /* (since "not hungry" was added, this will always be True) */ 1202. *buf = lowc(*buf); /* override capitalization */ 1203. if (!strcmp(buf, "weak")) 1204. Strcat(buf, " from severe hunger"); 1205. else if (!strncmp(buf, "faint", 5)) /* fainting, fainted */ 1206. Strcat(buf, " due to starvation"); 1207. if (wizard) 1208. Sprintf(eos(buf), " <%d>", u.uhunger); 1209. you_are(buf, ""); 1210. } 1211. /* encumbrance */ 1212. if ((cap = near_capacity()) > UNENCUMBERED) { 1213. const char *adj = "?_?"; /* (should always get overridden) */ 1214. 1215. Strcpy(buf, enc_stat[cap]); 1216. *buf = lowc(*buf); 1217. switch (cap) { 1218. case SLT_ENCUMBER: 1219. adj = "slightly"; 1220. break; /* burdened */ 1221. case MOD_ENCUMBER: 1222. adj = "moderately"; 1223. break; /* stressed */ 1224. case HVY_ENCUMBER: 1225. adj = "very"; 1226. break; /* strained */ 1227. case EXT_ENCUMBER: 1228. adj = "extremely"; 1229. break; /* overtaxed */ 1230. case OVERLOADED: 1231. adj = "not possible"; 1232. break; 1233. } 1234. if (wizard) 1235. Sprintf(eos(buf), " <%d>", inv_weight()); 1236. Sprintf(eos(buf), "; movement %s %s%s", !final ? "is" : "was", adj, 1237. (cap < OVERLOADED) ? " slowed" : ""); 1238. you_are(buf, ""); 1239. } else { 1240. /* last resort entry, guarantees Status section is non-empty 1241. (no longer needed for that purpose since weapon status added; 1242. still useful though) */ 1243. Strcpy(buf, "unencumbered"); 1244. if (wizard) 1245. Sprintf(eos(buf), " <%d>", inv_weight()); 1246. you_are(buf, ""); 1247. } 1248. /* current weapon(s) and corresponding skill level(s) */ 1249. weapon_insight(final); 1250. /* unlike ring of increase accuracy's effect, the monk's suit penalty 1251. is too blatant to be restricted to magical enlightenment */ 1252. if (iflags.tux_penalty && !Upolyd) { 1253. (void) enlght_combatinc("to hit", -gu.urole.spelarmr, final, buf); 1254. /* if from_what() ever gets extended from wizard mode to normal 1255. play, it could be adapted to handle this */ 1256. Sprintf(eos(buf), " due to your %s", suit_simple_name(uarm)); 1257. you_have(buf, ""); 1258. } 1259. /* report 'nudity' */ 1260. if (!uarm && !uarmu && !uarmc && !uarms && !uarmg && !uarmf && !uarmh) { 1261. if (u.uroleplay.nudist) 1262. enl_msg(You_, "do", "did", " not wear any armor", ""); 1263. else 1264. you_are("not wearing any armor", ""); 1265. } 1266. } 1267. 1268. /* extracted from status_enlightenment() to reduce clutter there */ 1269. staticfn void 1270. weapon_insight(int final) 1271. { 1272. char buf[BUFSZ]; 1273. int wtype; 1274. 1275. /* report being weaponless; distinguish whether gloves are worn 1276. [perhaps mention silver ring(s) when not wearing gloves?] */ 1277. if (!uwep) { 1278. you_are(empty_handed(), ""); 1279. 1280. /* two-weaponing implies hands and 1281. a weapon or wep-tool (not other odd stuff) in each hand */ 1282. } else if (u.twoweap) { 1283. you_are("wielding two weapons at once", ""); 1284. 1285. /* report most weapons by their skill class (so a katana will be 1286. described as a long sword, for instance; mattock, hook, and aklys 1287. are exceptions), or wielded non-weapon item by its object class */ 1288. } else { 1289. const char *what = weapon_descr(uwep); 1290. 1291. /* [what about other silver items?] */ 1292. if (uwep->otyp == SHIELD_OF_REFLECTION) 1293. what = shield_simple_name(uwep); /* silver|smooth shield */ 1294. else if (is_wet_towel(uwep)) 1295. what = /* (uwep->spe < 3) ? "moist towel" : */ "wet towel"; 1296. 1297. if (!strcmpi(what, "armor") || !strcmpi(what, "food") 1298. || !strcmpi(what, "venom")) 1299. Sprintf(buf, "wielding some %s", what); 1300. else 1301. /* [maybe include known blessed?] */ 1302. Sprintf(buf, "wielding %s", 1303. (uwep->quan == 1L) ? an(what) : makeplural(what)); 1304. you_are(buf, ""); 1305. } 1306. 1307. /* 1308. * Skill with current weapon. Might help players who've never 1309. * noticed #enhance or decided that it was pointless. 1310. */ 1311. if ((wtype = weapon_type(uwep)) != P_NONE && (!uwep || !is_ammo(uwep))) { 1312. char sklvlbuf[20]; 1313. int sklvl = P_SKILL(wtype); 1314. boolean hav = (sklvl != P_UNSKILLED && sklvl != P_SKILLED); 1315. 1316. if (sklvl == P_ISRESTRICTED) 1317. Strcpy(sklvlbuf, "no"); 1318. else 1319. (void) lcase(skill_level_name(wtype, sklvlbuf)); 1320. /* "you have no/basic/expert/master/grand-master skill with <skill>" 1321. or "you are unskilled/skilled in <skill>" */ 1322. Sprintf(buf, "%s %s %s", sklvlbuf, 1323. hav ? "skill with" : "in", skill_name(wtype)); 1324. 1325. if (!u.twoweap) { 1326. if (can_advance(wtype, FALSE)) 1327. Sprintf(eos(buf), " and %s that", 1328. !final ? "can enhance" : "could have enhanced"); 1329. if (hav) 1330. you_have(buf, ""); 1331. else 1332. you_are(buf, ""); 1333. 1334. } else { /* two-weapon */ 1335. static const char also_[] = "also "; 1336. char pfx[QBUFSZ], sfx[QBUFSZ], 1337. sknambuf2[20], sklvlbuf2[20], twobuf[20]; 1338. const char *also = "", *also2 = "", *also3 = (char *) 0, 1339. *verb_present, *verb_past; 1340. int wtype2 = weapon_type(uswapwep), 1341. sklvl2 = P_SKILL(wtype2), 1342. twoskl = P_SKILL(P_TWO_WEAPON_COMBAT); 1343. boolean a1, a2, ab, 1344. hav2 = (sklvl2 != P_UNSKILLED && sklvl2 != P_SKILLED); 1345. 1346. /* normally hero must have access to two-weapon skill in 1347. order to initiate u.twoweap, but not if polymorphed into 1348. a form which has multiple weapon attacks, so we need to 1349. avoid getting bitten by unexpected skill value */ 1350. if (twoskl == P_ISRESTRICTED) { 1351. twoskl = P_UNSKILLED; 1352. /* restricted is the same as unskilled as far as bonus 1353. or penalty goes, and it isn't ordinarily seen so 1354. skill_level_name() returns "Unknown" for it */ 1355. Strcpy(twobuf, "restricted"); 1356. } else { 1357. (void) lcase(skill_level_name(P_TWO_WEAPON_COMBAT, twobuf)); 1358. } 1359. 1360. /* keep buf[] from above in case skill levels match */ 1361. pfx[0] = sfx[0] = '\0'; 1362. if (twoskl < sklvl) { 1363. /* twoskil won't be restricted so sklvl is at least basic */ 1364. Sprintf(pfx, "Your skill in %s ", skill_name(wtype)); 1365. Sprintf(sfx, " limited by being %s with two weapons", twobuf); 1366. also = also_; 1367. } else if (twoskl > sklvl) { 1368. /* sklvl might be restricted */ 1369. Strcpy(pfx, "Your two weapon skill "); 1370. Strcpy(sfx, " limited by "); 1371. if (sklvl > P_ISRESTRICTED) 1372. Sprintf(eos(sfx), "being %s", sklvlbuf); 1373. else 1374. Sprintf(eos(sfx), "having no skill"); 1375. Sprintf(eos(sfx), " with %s", skill_name(wtype)); 1376. also2 = also_; 1377. } else { 1378. Strcat(buf, " and two weapons"); 1379. also3 = also_; 1380. } 1381. if (*pfx) 1382. enl_msg(pfx, "is", "was", sfx, ""); 1383. else if (hav) 1384. you_have(buf, ""); 1385. else 1386. you_are(buf, ""); 1387. 1388. /* skip comparison between secondary and two-weapons if it is 1389. identical to the comparison between primary and twoweap */ 1390. if (wtype2 != wtype) { 1391. Strcpy(sknambuf2, skill_name(wtype2)); 1392. (void) lcase(skill_level_name(wtype2, sklvlbuf2)); 1393. verb_present = "is", verb_past = "was"; 1394. pfx[0] = sfx[0] = buf[0] = '\0'; 1395. if (twoskl < sklvl2) { 1396. /* twoskil is at least unskilled, sklvl2 at least basic */ 1397. Sprintf(pfx, "Your skill in %s ", sknambuf2); 1398. Sprintf(sfx, " %slimited by being %s with two weapons", 1399. also, twobuf); 1400. } else if (twoskl > sklvl2) { 1401. /* sklvl2 might be restricted */ 1402. Strcpy(pfx, "Your two weapon skill "); 1403. Sprintf(sfx, " %slimited by ", also2); 1404. if (sklvl2 > P_ISRESTRICTED) 1405. Sprintf(eos(sfx), "being %s", sklvlbuf2); 1406. else 1407. Strcat(eos(sfx), "having no skill"); 1408. Sprintf(eos(sfx), " with %s", sknambuf2); 1409. } else { 1410. /* equal; two-weapon is at least unskilled, so sklvl2 is 1411. too; "you [also] have basic/expert/master/grand-master 1412. skill with <skill>" or "you [also] are unskilled/ 1413. skilled in <skill> */ 1414. Sprintf(buf, "%s %s %s", sklvlbuf2, 1415. hav2 ? "skill with" : "in", sknambuf2); 1416. Strcat(buf, " and two weapons"); 1417. if (also3) { 1418. Strcpy(pfx, "You also "); 1419. Snprintf(sfx, sizeof(sfx), " %s", buf), buf[0] = '\0'; 1420. verb_present = hav2 ? "have" : "are"; 1421. verb_past = hav2 ? "had" : "were"; 1422. } 1423. } 1424. if (*pfx) 1425. enl_msg(pfx, verb_present, verb_past, sfx, ""); 1426. else if (hav2) 1427. you_have(buf, ""); 1428. else 1429. you_are(buf, ""); 1430. } /* wtype2 != wtype */ 1431. 1432. /* if training and available skill credits already allow 1433. #enhance for any of primary, secondary, or two-weapon, 1434. tell the player; avoid attempting figure out whether 1435. spending skill credits enhancing one might make either 1436. or both of the others become ineligible for enhancement */ 1437. a1 = can_advance(wtype, FALSE); 1438. a2 = (wtype2 != wtype) ? can_advance(wtype2, FALSE) : FALSE; 1439. ab = can_advance(P_TWO_WEAPON_COMBAT, FALSE); 1440. if (a1 || a2 || ab) { 1441. static const char also_wik_[] = " and also with "; 1442. 1443. /* for just one, the conditionals yield 1444. 1) "skill with <that one>"; for more than one: 1445. 2) "skills with <primary> and also with <secondary>" or 1446. 3) "skills with <primary> and also with two-weapons" or 1447. 4) "skills with <secondary> and also with two-weapons" or 1448. 5) "skills with <primary>, <secondary>, and two-weapons" 1449. (no 'also's or extra 'with's for case 5); when primary 1450. and secondary use the same skill, only cases 1 and 3 are 1451. possible because 'a2' gets forced to False above */ 1452. Sprintf(sfx, " skill%s with %s%s%s%s%s", 1453. ((int) a1 + (int) a2 + (int) ab > 1) ? "s" : "", 1454. a1 ? skill_name(wtype) : "", 1455. ((a1 && a2 && ab) ? ", " 1456. : (a1 && (a2 || ab)) ? also_wik_ : ""), 1457. a2 ? skill_name(wtype2) : "", 1458. ((a1 && a2 && ab) ? ", and " 1459. : (a2 && ab) ? also_wik_ : ""), 1460. ab ? "two weapons" : ""); 1461. enl_msg(You_, "can enhance", "could have enhanced", sfx, ""); 1462. } 1463. } /* two-weapon */ 1464. } /* skill applies */ 1465. } 1466. 1467. staticfn void 1468. item_resistance_message( 1469. int adtyp, 1470. const char *prot_message, 1471. int final) 1472. { 1473. int protection = u_adtyp_resistance_obj(adtyp); 1474. 1475. if (protection) { 1476. boolean somewhat = protection < 99; 1477. 1478. enl_msg("Your items ", 1479. somewhat ? "are somewhat" : "are", 1480. somewhat ? "were somewhat" : "were", 1481. prot_message, item_what(adtyp)); 1482. } 1483. } 1484. 1485. /* attributes: intrinsics and the like, other non-obvious capabilities */ 1486. staticfn void 1487. attributes_enlightenment( 1488. int unused_mode UNUSED, 1489. int final) 1490. { 1491. static NEARDATA const char 1492. if_surroundings_permitted[] = " if surroundings permitted"; 1493. int ltmp, armpro, warnspecies; 1494. char buf[BUFSZ]; 1495. 1496. /*\ 1497. * Attributes 1498. \*/ 1499. enlght_out(""); 1500. enlght_out(final ? "Final Attributes:" : "Attributes:"); 1501. 1502. if (u.uevent.uhand_of_elbereth) { 1503. static const char *const hofe_titles[3] = { "the Hand of Elbereth", 1504. "the Envoy of Balance", 1505. "the Glory of Arioch" }; 1506. you_are(hofe_titles[u.uevent.uhand_of_elbereth - 1], ""); 1507. } 1508. 1509. Sprintf(buf, "%s", piousness(TRUE, "aligned")); 1510. if (u.ualign.record >= 0) 1511. you_are(buf, ""); 1512. else 1513. you_have(buf, ""); 1514. 1515. if (wizard) { 1516. Sprintf(buf, " %d", u.ualign.record); 1517. enl_msg("Your alignment ", "is", "was", buf, ""); 1518. } 1519. 1520. /*** Resistances to troubles ***/ 1521. if (Invulnerable) 1522. you_are("invulnerable", from_what(INVULNERABLE)); 1523. if (Antimagic) 1524. you_are("magic-protected", from_what(ANTIMAGIC)); 1525. if (Fire_resistance) 1526. you_are("fire resistant", from_what(FIRE_RES)); 1527. item_resistance_message(AD_FIRE, " protected from fire", final); 1528. if (Cold_resistance) 1529. you_are("cold resistant", from_what(COLD_RES)); 1530. item_resistance_message(AD_COLD, " protected from cold", final); 1531. if (Sleep_resistance) 1532. you_are("sleep resistant", from_what(SLEEP_RES)); 1533. if (Disint_resistance) 1534. you_are("disintegration resistant", from_what(DISINT_RES)); 1535. item_resistance_message(AD_DISN, " protected from disintegration", final); 1536. if (Shock_resistance) 1537. you_are("shock resistant", from_what(SHOCK_RES)); 1538. item_resistance_message(AD_ELEC, " protected from electric shocks", 1539. final); 1540. if (Poison_resistance) 1541. you_are("poison resistant", from_what(POISON_RES)); 1542. if (Acid_resistance) { 1543. Sprintf(buf, "%.20s%.30s", 1544. temp_resist(ACID_RES) ? "temporarily " : "", 1545. "acid resistant"); 1546. you_are(buf, from_what(ACID_RES)); 1547. } 1548. item_resistance_message(AD_ACID, " protected from acid", final); 1549. if (Drain_resistance) 1550. you_are("level-drain resistant", from_what(DRAIN_RES)); 1551. if (Sick_resistance) 1552. you_are("immune to sickness", from_what(SICK_RES)); 1553. if (Stone_resistance) { 1554. Sprintf(buf, "%.20s%.30s", 1555. temp_resist(STONE_RES) ? "temporarily " : "", 1556. "petrification resistant"); 1557. you_are(buf, from_what(STONE_RES)); 1558. } 1559. if (Halluc_resistance) 1560. enl_msg(You_, "resist", "resisted", " hallucinations", 1561. from_what(HALLUC_RES)); 1562. if (u.uedibility) 1563. you_can("recognize detrimental food", ""); 1564. 1565. /*** Vision and senses ***/ 1566. if ((HBlinded || EBlinded) && BBlinded) /* blind w/ blindness blocked */ 1567. you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */ 1568. if (Blnd_resist && !Blind) /* skip if no eyes or blindfolded */ 1569. you_are("not subject to light-induced blindness", 1570. from_what(BLND_RES)); 1571. if (See_invisible) { 1572. if (!Blind) 1573. enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS)); 1574. else if (!PermaBlind) 1575. enl_msg(You_, "will see", "would have seen", 1576. " invisible when not blind", ""); 1577. else 1578. enl_msg(You_, "would see", "would have seen", 1579. " invisible if not blind", ""); 1580. } 1581. if (Blind_telepat) 1582. you_are("telepathic", from_what(TELEPAT)); 1583. if (Warning) 1584. you_are("warned", from_what(WARNING)); 1585. if (Warn_of_mon && svc.context.warntype.obj) { 1586. Sprintf(buf, "aware of the presence of %s", 1587. (svc.context.warntype.obj & M2_ORC) ? "orcs" 1588. : (svc.context.warntype.obj & M2_ELF) ? "elves" 1589. : (svc.context.warntype.obj & M2_DEMON) ? "demons" 1590. : something); 1591. you_are(buf, from_what(WARN_OF_MON)); 1592. } 1593. if (Warn_of_mon && svc.context.warntype.polyd) { 1594. Sprintf(buf, "aware of the presence of %s", 1595. ((svc.context.warntype.polyd & (M2_HUMAN | M2_ELF)) 1596. == (M2_HUMAN | M2_ELF)) ? "humans and elves" 1597. : (svc.context.warntype.polyd & M2_HUMAN) ? "humans" 1598. : (svc.context.warntype.polyd & M2_ELF) ? "elves" 1599. : (svc.context.warntype.polyd & M2_ORC) ? "orcs" 1600. : (svc.context.warntype.polyd & M2_DEMON) ? "demons" 1601. : "certain monsters"); 1602. you_are(buf, ""); 1603. } 1604. warnspecies = svc.context.warntype.speciesidx; 1605. if (Warn_of_mon && ismnum(warnspecies)) { 1606. Sprintf(buf, "aware of the presence of %s", 1607. makeplural(mons[warnspecies].pmnames[NEUTRAL])); 1608. you_are(buf, from_what(WARN_OF_MON)); 1609. } 1610. if (Undead_warning) 1611. you_are("warned of undead", from_what(WARN_UNDEAD)); 1612. if (Searching) 1613. you_have("automatic searching", from_what(SEARCHING)); 1614. if (Clairvoyant) { 1615. you_are("clairvoyant", from_what(CLAIRVOYANT)); 1616. } else if ((HClairvoyant || EClairvoyant) && BClairvoyant) { 1617. Strcpy(buf, from_what(-CLAIRVOYANT)); 1618. (void) strsubst(buf, " because of ", " if not for "); 1619. enl_msg(You_, "could be", "could have been", " clairvoyant", buf); 1620. } 1621. if (Infravision) 1622. you_have("infravision", from_what(INFRAVISION)); 1623. if (Detect_monsters) { 1624. Strcpy(buf, "sensing the presence of monsters"); 1625. if (wizard) { 1626. long detectmon_timeout = (HDetect_monsters & TIMEOUT); 1627. 1628. if (detectmon_timeout) 1629. Sprintf(eos(buf), " (%ld)", detectmon_timeout); 1630. } 1631. you_are(buf, ""); 1632. } 1633. if (u.umconf) { /* 'u.umconf' is a counter rather than a timeout */ 1634. Strcpy(buf, " monsters when hitting them"); 1635. if (wizard && !final) { 1636. if (u.umconf == 1) 1637. Strcat(buf, " (next hit only)"); 1638. else /* u.umconf > 1 */ 1639. Sprintf(eos(buf), " (next %u hits)", u.umconf); 1640. } 1641. enl_msg(You_, "will confuse", "would have confused", buf, ""); 1642. } 1643. 1644. /*** Appearance and behavior ***/ 1645. if (Adornment) { 1646. int adorn = 0; 1647. 1648. if (uleft && uleft->otyp == RIN_ADORNMENT) 1649. adorn += uleft->spe; 1650. if (uright && uright->otyp == RIN_ADORNMENT) 1651. adorn += uright->spe; 1652. /* the sum might be 0 (+0 ring or two which negate each other); 1653. that yields "you are charismatic" (which isn't pointless 1654. because it potentially impacts seduction attacks) */ 1655. Sprintf(buf, "%scharismatic", 1656. (adorn > 0) ? "more " : (adorn < 0) ? "less " : ""); 1657. you_are(buf, from_what(ADORNED)); 1658. } 1659. if (Invisible) 1660. you_are("invisible", from_what(INVIS)); 1661. else if (Invis) 1662. you_are("invisible to others", from_what(INVIS)); 1663. /* ordinarily "visible" is redundant; this is a special case for 1664. the situation when invisibility would be an expected attribute */ 1665. else if ((HInvis || EInvis) && BInvis) 1666. you_are("visible", from_what(-INVIS)); 1667. if (Displaced) 1668. you_are("displaced", from_what(DISPLACED)); 1669. if (Stealth) { 1670. you_are("stealthy", from_what(STEALTH)); 1671. } else if (BStealth && (HStealth || EStealth)) { 1672. Sprintf(buf, " stealthy%s", 1673. (BStealth == FROMOUTSIDE) ? " if not mounted" : ""); 1674. enl_msg(You_, "would be", "would have been", buf, ""); 1675. } 1676. if (Aggravate_monster) 1677. enl_msg("You aggravate", "", "d", " monsters", 1678. from_what(AGGRAVATE_MONSTER)); 1679. if (Conflict) 1680. enl_msg("You cause", "", "d", " conflict", from_what(CONFLICT)); 1681. 1682. /*** Transportation ***/ 1683. if (Jumping) 1684. you_can("jump", from_what(JUMPING)); 1685. if (Teleportation) 1686. you_can("teleport", from_what(TELEPORT)); 1687. if (Teleport_control) 1688. you_have("teleport control", from_what(TELEPORT_CONTROL)); 1689. /* actively levitating handled earlier as a status condition */ 1690. if (BLevitation) { /* levitation is blocked */ 1691. long save_BLev = BLevitation; 1692. 1693. BLevitation = 0L; 1694. if (Levitation) { 1695. /* either trapped in the floor or inside solid rock 1696. (or both if chained to buried iron ball and have 1697. moved one step into solid rock somehow) */ 1698. boolean trapped = (save_BLev & I_SPECIAL) != 0L, 1699. terrain = (save_BLev & FROMOUTSIDE) != 0L; 1700. 1701. Sprintf(buf, "%s%s%s", 1702. trapped ? " if not trapped" : "", 1703. (trapped && terrain) ? " and" : "", 1704. terrain ? if_surroundings_permitted : ""); 1705. enl_msg(You_, "would levitate", "would have levitated", buf, ""); 1706. } 1707. BLevitation = save_BLev; 1708. } 1709. /* actively flying handled earlier as a status condition */ 1710. if (BFlying) { /* flight is blocked */ 1711. long save_BFly = BFlying; 1712. 1713. BFlying = 0L; 1714. if (Flying) { 1715. enl_msg(You_, "would fly", "would have flown", 1716. /* wording quibble: for past tense, "hadn't been" 1717. would sound better than "weren't" (and 1718. "had permitted" better than "permitted"), but 1719. "weren't" and "permitted" are adequate so the 1720. extra complexity to handle that isn't worth it */ 1721. Levitation 1722. ? " if you weren't levitating" 1723. : (save_BFly == I_SPECIAL) 1724. /* this is an oversimplification; being trapped 1725. might also be blocking levitation so flight 1726. would still be blocked after escaping trap */ 1727. ? " if you weren't trapped" 1728. : (save_BFly == FROMOUTSIDE) 1729. ? if_surroundings_permitted 1730. /* two or more of levitation, surroundings, 1731. and being trapped in the floor */ 1732. : " if circumstances permitted", 1733. ""); 1734. } 1735. BFlying = save_BFly; 1736. } 1737. /* including this might bring attention to the fact that ceiling 1738. clinging has inconsistencies... */ 1739. if (is_clinger(gy.youmonst.data)) { 1740. boolean has_lid = has_ceiling(&u.uz); 1741. 1742. if (has_lid && !u.uinwater) { 1743. you_can("cling to the ceiling", ""); 1744. } else { 1745. Sprintf(buf, " to the ceiling if %s%s%s", 1746. !has_lid ? "there was one" : "", 1747. (!has_lid && u.uinwater) ? " and " : "", 1748. u.uinwater ? (Underwater ? "you weren't underwater" 1749. : "you weren't in the water") : ""); 1750. /* past tense is applicable for death while Unchanging */ 1751. enl_msg(You_, "could cling", "could have clung", buf, ""); 1752. } 1753. } 1754. /* actively walking on water handled earlier as a status condition */ 1755. if (Wwalking && !walking_on_water()) 1756. you_can("walk on water", from_what(WWALKING)); 1757. /* actively swimming (in water but not under it) handled earlier */ 1758. if (Swimming && (Underwater || !u.uinwater)) 1759. you_can("swim", from_what(SWIMMING)); 1760. if (Breathless) 1761. you_can("survive without air", from_what(MAGICAL_BREATHING)); 1762. else if (Amphibious) 1763. you_can("breathe water", from_what(MAGICAL_BREATHING)); 1764. if (Passes_walls) 1765. you_can("walk through walls", from_what(PASSES_WALLS)); 1766. 1767. /*** Physical attributes ***/ 1768. if (Regeneration) 1769. enl_msg("You regenerate", "", "d", "", from_what(REGENERATION)); 1770. if (Slow_digestion) 1771. you_have("slower digestion", from_what(SLOW_DIGESTION)); 1772. if (u.uhitinc) { 1773. (void) enlght_combatinc("to hit", u.uhitinc, final, buf); 1774. if (iflags.tux_penalty && !Upolyd) 1775. Sprintf(eos(buf), " %s your suit's penalty", 1776. (u.uhitinc < 0) ? "increasing" 1777. : (u.uhitinc < 4 * gu.urole.spelarmr / 5) 1778. ? "partly offsetting" 1779. : (u.uhitinc < gu.urole.spelarmr) ? "nearly offsetting" 1780. : "overcoming"); 1781. you_have(buf, ""); 1782. } 1783. if (u.udaminc) 1784. you_have(enlght_combatinc("damage", u.udaminc, final, buf), ""); 1785. if (u.uspellprot || Protection) { 1786. int prot = 0; 1787. 1788. if (uleft && uleft->otyp == RIN_PROTECTION) 1789. prot += uleft->spe; 1790. if (uright && uright->otyp == RIN_PROTECTION) 1791. prot += uright->spe; 1792. if (uamul && uamul->otyp == AMULET_OF_GUARDING) 1793. prot += 2; 1794. if (HProtection & INTRINSIC) 1795. prot += u.ublessed; 1796. prot += u.uspellprot; 1797. if (prot) 1798. you_have(enlght_combatinc("defense", prot, final, buf), ""); 1799. } 1800. if ((armpro = magic_negation(&gy.youmonst)) > 0) { 1801. /* magic cancellation factor, conferred by worn armor */ 1802. static const char *const mc_types[] = { 1803. "" /*ordinary*/, "warded", "guarded", "protected", 1804. }; 1805. /* sanity check */ 1806. if (armpro >= SIZE(mc_types)) 1807. armpro = SIZE(mc_types) - 1; 1808. you_are(mc_types[armpro], ""); 1809. } 1810. if (Half_physical_damage) 1811. enlght_halfdmg(HALF_PHDAM, final); 1812. if (Half_spell_damage) 1813. enlght_halfdmg(HALF_SPDAM, final); 1814. if (Half_gas_damage) 1815. enl_msg(You_, "take", "took", " reduced poison gas damage", ""); 1816. if (spellid(0) > NO_SPELL) { /* skip if no spells are known yet */ 1817. /* greatly simplified edition of percent_success(spell.c)--may need 1818. to be suppressed if oversimplification leads to player confusion */ 1819. char cast_adj[QBUFSZ]; 1820. boolean suit = uarm && is_metallic(uarm), 1821. robe = uarmc && uarmc->otyp == ROBE; 1822. 1823. *cast_adj = '\0'; 1824. if (suit) /* omit "wearing" to shorten the text */ 1825. Sprintf(cast_adj, " impaired by metallic armor%s", 1826. robe ? ", mitigated by your robe" : ""); 1827. else if (robe) 1828. Strcpy(cast_adj, " enhanced by wearing a robe"); 1829. 1830. if (*cast_adj) 1831. enl_msg("Your spell casting ", "is", "was", cast_adj, ""); 1832. } 1833. /* polymorph and other shape change */ 1834. if (Protection_from_shape_changers) 1835. you_are("protected from shape changers", 1836. from_what(PROT_FROM_SHAPE_CHANGERS)); 1837. if (Unchanging) { 1838. const char *what = 0; 1839. 1840. if (!Upolyd) /* Upolyd handled below after current form */ 1841. you_can("not change from your current form", 1842. from_what(UNCHANGING)); 1843. /* blocked shape changes */ 1844. if (Polymorph) 1845. what = !final ? "polymorph" : "have polymorphed"; 1846. else if (ismnum(u.ulycn)) 1847. what = !final ? "change shape" : "have changed shape"; 1848. if (what) { 1849. Sprintf(buf, "would %s periodically", what); 1850. /* omit from_what(UNCHANGING); too verbose */ 1851. enl_msg(You_, buf, buf, " if not locked into your current form", 1852. ""); 1853. } 1854. } else if (Polymorph) { 1855. you_are("polymorphing periodically", from_what(POLYMORPH)); 1856. } 1857. if (Polymorph_control) 1858. you_have("polymorph control", from_what(POLYMORPH_CONTROL)); 1859. if (Upolyd && u.umonnum != u.ulycn 1860. /* if we've died from turning into slime, we're polymorphed 1861. right now but don't want to list it as a temporary attribute 1862. [we need a more reliable way to detect this situation] */ 1863. && !(final == ENL_GAMEOVERDEAD 1864. && u.umonnum == PM_GREEN_SLIME && !Unchanging)) { 1865. /* foreign shape (except were-form which is handled below) */ 1866. if (!vampshifted(&gy.youmonst)) 1867. Sprintf(buf, "polymorphed into %s", 1868. an(pmname(gy.youmonst.data, 1869. flags.female ? FEMALE : MALE))); 1870. else 1871. Sprintf(buf, "polymorphed into %s in %s form", 1872. an(pmname(&mons[gy.youmonst.cham], 1873. flags.female ? FEMALE : MALE)), 1874. pmname(gy.youmonst.data, flags.female ? FEMALE : MALE)); 1875. if (wizard) 1876. Sprintf(eos(buf), " (%d)", u.mtimedone); 1877. you_are(buf, ""); 1878. } 1879. if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */ 1880. you_can("lay eggs", ""); 1881. if (ismnum(u.ulycn)) { 1882. /* "you are a werecreature [in beast form]" */ 1883. Strcpy(buf, an(pmname(&mons[u.ulycn], 1884. flags.female ? FEMALE : MALE))); 1885. if (u.umonnum == u.ulycn) { 1886. Strcat(buf, " in beast form"); 1887. if (wizard) 1888. Sprintf(eos(buf), " (%d)", u.mtimedone); 1889. } 1890. you_are(buf, ""); 1891. } 1892. if (Unchanging && Upolyd) /* !Upolyd handled above */ 1893. you_can("not change from your current form", from_what(UNCHANGING)); 1894. if (Hate_silver) 1895. you_are("harmed by silver", ""); 1896. /* movement and non-armor-based protection */ 1897. if (Fast) 1898. you_are(Very_fast ? "very fast" : "fast", from_what(FAST)); 1899. if (Reflecting) 1900. you_have("reflection", from_what(REFLECTING)); 1901. if (Free_action) 1902. you_have("free action", from_what(FREE_ACTION)); 1903. if (Fixed_abil) 1904. you_have("fixed abilities", from_what(FIXED_ABIL)); 1905. if (Lifesaved) 1906. enl_msg("Your life ", "will be", "would have been", " saved", ""); 1907. 1908. /*** Miscellany ***/ 1909. if (Luck) { 1910. ltmp = abs((int) Luck); 1911. Sprintf(buf, "%s%slucky", 1912. ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "", 1913. Luck < 0 ? "un" : ""); 1914. if (wizard) 1915. Sprintf(eos(buf), " (%d)", Luck); 1916. you_are(buf, ""); 1917. } else if (wizard) 1918. enl_msg("Your luck ", "is", "was", " zero", ""); 1919. if (u.moreluck > 0) 1920. you_have("extra luck", ""); 1921. else if (u.moreluck < 0) 1922. you_have("reduced luck", ""); 1923. if (carrying(LUCKSTONE) || stone_luck(TRUE)) { 1924. ltmp = stone_luck(FALSE); 1925. if (ltmp <= 0) 1926. enl_msg("Bad luck ", "does", "did", " not time out for you", ""); 1927. if (ltmp >= 0) 1928. enl_msg("Good luck ", "does", "did", " not time out for you", ""); 1929. } 1930. 1931. if (u.ugangr) { 1932. Sprintf(buf, " %sangry with you", 1933. u.ugangr > 6 ? "extremely " : u.ugangr > 3 ? "very " : ""); 1934. if (wizard) 1935. Sprintf(eos(buf), " (%d)", u.ugangr); 1936. enl_msg(u_gname(), " is", " was", buf, ""); 1937. } else { 1938. /* 1939. * We need to suppress this when the game is over, because death 1940. * can change the value calculated by can_pray(), potentially 1941. * resulting in a false claim that you could have prayed safely. 1942. */ 1943. if (!final) { 1944. #if 0 1945. /* "can [not] safely pray" vs "could [not] have safely prayed" */ 1946. Sprintf(buf, "%s%ssafely pray%s", can_pray(FALSE) ? "" : "not ", 1947. final ? "have " : "", final ? "ed" : ""); 1948. #else 1949. Sprintf(buf, "%ssafely pray", can_pray(FALSE) ? "" : "not "); 1950. #endif 1951. if (wizard) 1952. Sprintf(eos(buf), " (%d)", u.ublesscnt); 1953. you_can(buf, ""); 1954. } 1955. } 1956. 1957. #ifdef DEBUG 1958. /* named fruit debugging (doesn't really belong here...); to enable, 1959. include 'fruit' in DEBUGFILES list (even though it isn't a file...) */ 1960. if (wizard && explicitdebug("fruit")) { 1961. struct fruit *f; 1962. 1963. reorder_fruit(TRUE); /* sort by fruit index, from low to high; 1964. * this modifies the gf.ffruit chain, so could 1965. * possibly mask or even introduce a problem, 1966. * but it does useful sanity checking */ 1967. for (f = gf.ffruit; f; f = f->nextf) { 1968. Sprintf(buf, "Fruit #%d ", f->fid); 1969. enl_msg(buf, "is ", "was ", f->fname, ""); 1970. } 1971. enl_msg("The current fruit ", "is ", "was ", svp.pl_fruit, ""); 1972. Sprintf(buf, "%d", flags.made_fruit); 1973. enl_msg("The made fruit flag ", "is ", "was ", buf, ""); 1974. } 1975. #endif 1976. 1977. { 1978. const char *p; 1979. 1980. buf[0] = '\0'; 1981. if (final < 2) { /* still in progress, or quit/escaped/ascended */ 1982. p = "survived after being killed "; 1983. if (!u.umortality) 1984. p = !final ? (char *) 0 : "survived"; 1985. else 1986. (void) N_times((long) u.umortality, buf); 1987. } else { /* game ended in character's death */ 1988. p = "are dead"; 1989. switch (u.umortality) { 1990. case 0: 1991. impossible("dead without dying?"); 1992. FALLTHROUGH; 1993. /* FALLTHRU */ 1994. case 1: 1995. break; /* just "are dead" */ 1996. default: 1997. Sprintf(buf, " (%d%s time!)", u.umortality, 1998. ordin(u.umortality)); 1999. break; 2000. } 2001. } 2002. if (p) 2003. enl_msg(You_, "have been killed ", p, buf, ""); 2004. } 2005. } 2006. 2007. /* ^X command */ 2008. int 2009. doattributes(void) 2010. { 2011. int mode = BASICENLIGHTENMENT; 2012. 2013. /* show more--as if final disclosure--for wizard and explore modes */ 2014. if (wizard || discover) 2015. mode |= MAGICENLIGHTENMENT; 2016. 2017. enlightenment(mode, ENL_GAMEINPROGRESS); 2018. return ECMD_OK; 2019. } 2020. 2021. void 2022. youhiding(boolean via_enlghtmt, /* enlightenment line vs topl message */ 2023. int msgflag) /* for variant message phrasing */ 2024. { 2025. char *bp, buf[BUFSZ]; 2026. 2027. Strcpy(buf, "hiding"); 2028. if (U_AP_TYPE != M_AP_NOTHING) { 2029. /* mimic; hero is only able to mimic a strange object or gold 2030. or hallucinatory alternative to gold, so we skip the details 2031. for the hypothetical furniture and monster cases */ 2032. bp = eos(strcpy(buf, "mimicking")); 2033. if (U_AP_TYPE == M_AP_OBJECT) { 2034. Sprintf(bp, " %s", an(simple_typename(gy.youmonst.mappearance))); 2035. } else if (U_AP_TYPE == M_AP_FURNITURE) { 2036. Strcpy(bp, " something"); 2037. } else if (U_AP_TYPE == M_AP_MONSTER) { 2038. Strcpy(bp, " someone"); 2039. } else { 2040. ; /* something unexpected; leave 'buf' as-is */ 2041. } 2042. } else if (u.uundetected) { 2043. bp = eos(buf); /* points past "hiding" */ 2044. if (gy.youmonst.data->mlet == S_EEL) { 2045. if (is_pool(u.ux, u.uy)) 2046. Sprintf(bp, " in the %s", waterbody_name(u.ux, u.uy)); 2047. } else if (hides_under(gy.youmonst.data)) { 2048. struct obj *o = svl.level.objects[u.ux][u.uy]; 2049. 2050. if (o) 2051. Sprintf(bp, " underneath %s", ansimpleoname(o)); 2052. } else if (is_clinger(gy.youmonst.data) || Flying) { 2053. /* Flying: 'lurker above' hides on ceiling but doesn't cling */ 2054. Sprintf(bp, " on the %s", ceiling(u.ux, u.uy)); 2055. } else { 2056. /* on floor; is_hider() but otherwise not special: 'trapper' */ 2057. if (u.utrap && u.utraptype == TT_PIT) { 2058. struct trap *t = t_at(u.ux, u.uy); 2059. 2060. Sprintf(bp, " in a %spit", 2061. (t && t->ttyp == SPIKED_PIT) ? "spiked " : ""); 2062. } else 2063. Sprintf(bp, " on the %s", surface(u.ux, u.uy)); 2064. } 2065. } else { 2066. ; /* shouldn't happen; will result in generic "you are hiding" */ 2067. } 2068. 2069. if (via_enlghtmt) { 2070. int final = msgflag; /* 'final' is used by you_are() macro */ 2071. 2072. you_are(buf, ""); 2073. } else { 2074. /* for dohide(), when player uses '#monster' command */ 2075. You("are %s %s.", msgflag ? "already" : "now", buf); 2076. } 2077. } 2078. 2079. /* #conduct command [KMH]; shares enlightenment's tense handling */ 2080. int 2081. doconduct(void) 2082. { 2083. show_conduct(ENL_GAMEINPROGRESS); 2084. return ECMD_OK; 2085. } 2086. 2087. /* display conducts; for doconduct(), also disclose() and dump_everything() */ 2088. void 2089. show_conduct(int final) 2090. { 2091. char buf[BUFSZ], bufN[40]; 2092. int ngenocided; 2093. 2094. /* Create the conduct window */ 2095. ge.en_win = create_nhwindow(NHW_MENU); 2096. putstr(ge.en_win, 0, "Voluntary challenges:"); 2097. 2098. /* rerolling; "You <this or that>" is about the character, rerolling 2099. is about the player so phrase it differently; 2100. also, always use past tense since the chance to do something with it 2101. is gone by time player can issue #conduct command or see disclosure */ 2102. if (!u.uroleplay.reroll) 2103. Strcpy(buf, " Character rerolling was not enabled."); 2104. else if (!u.uroleplay.numrerolls) 2105. Strcpy(buf, " Your character was not rerolled."); 2106. else 2107. Sprintf(buf, " Your character was rerolled %s.", 2108. N_times(u.uroleplay.numrerolls, bufN)); 2109. enlght_out(buf); 2110. 2111. if (u.uroleplay.blind) 2112. you_have_been("blind from birth"); 2113. if (u.uroleplay.deaf) 2114. you_have_been("deaf from birth"); 2115. /* note: we don't report "you are without possessions" unless the 2116. game started with the pauper option set */ 2117. if (u.uroleplay.pauper) 2118. enl_msg(You_, gi.invent ? "started" : "are", "started out", 2119. " without possessions", ""); 2120. /* nudist is far more than a subset of possessionless, and a much 2121. more impressive accomplishment, but showing "started out without 2122. possessions" before "faithfully nudist" looks more logical */ 2123. if (u.uroleplay.nudist) 2124. you_have_been("faithfully nudist"); 2125. 2126. if (!u.uconduct.food) 2127. enl_msg(You_, "have gone", "went", " without food", ""); 2128. /* but beverages are okay */ 2129. else if (!u.uconduct.unvegan) 2130. you_have_X("followed a strict vegan diet"); 2131. else if (!u.uconduct.unvegetarian) 2132. you_have_been("vegetarian"); 2133. 2134. if (!u.uconduct.gnostic) 2135. you_have_been("an atheist"); 2136. 2137. if (!u.uconduct.weaphit) { 2138. you_have_never("hit with a wielded weapon"); 2139. } else if (wizard) { 2140. Sprintf(buf, "hit with a wielded weapon %ld time%s", 2141. u.uconduct.weaphit, plur(u.uconduct.weaphit)); 2142. you_have_X(buf); 2143. } 2144. if (!u.uconduct.killer) 2145. you_have_been("a pacifist"); 2146. 2147. if (!u.uconduct.literate) { 2148. you_have_been("illiterate"); 2149. } else if (wizard) { 2150. Sprintf(buf, "read items or engraved %ld time%s", u.uconduct.literate, 2151. plur(u.uconduct.literate)); 2152. you_have_X(buf); 2153. } 2154. 2155. if (!u.uconduct.pets) 2156. you_have_never("had a pet"); 2157. 2158. ngenocided = num_genocides(); 2159. if (ngenocided == 0) { 2160. you_have_never("genocided any monsters"); 2161. } else { 2162. Sprintf(buf, "genocided %d type%s of monster%s", ngenocided, 2163. plur(ngenocided), plur(ngenocided)); 2164. you_have_X(buf); 2165. } 2166. 2167. if (!u.uconduct.polypiles) { 2168. you_have_never("polymorphed an object"); 2169. } else if (wizard) { 2170. Sprintf(buf, "polymorphed %ld item%s", u.uconduct.polypiles, 2171. plur(u.uconduct.polypiles)); 2172. you_have_X(buf); 2173. } 2174. 2175. if (!u.uconduct.polyselfs) { 2176. you_have_never("changed form"); 2177. } else if (wizard) { 2178. Sprintf(buf, "changed form %ld time%s", u.uconduct.polyselfs, 2179. plur(u.uconduct.polyselfs)); 2180. you_have_X(buf); 2181. } 2182. 2183. if (!u.uconduct.wishes) { 2184. you_have_X("used no wishes"); 2185. } else { 2186. Sprintf(buf, "used %ld wish%s", u.uconduct.wishes, 2187. (u.uconduct.wishes > 1L) ? "es" : ""); 2188. if (u.uconduct.wisharti) { 2189. /* if wisharti == wishes 2190. * 1 wish (for an artifact) 2191. * 2 wishes (both for artifacts) 2192. * N wishes (all for artifacts) 2193. * else (N is at least 2 in order to get here; M < N) 2194. * N wishes (1 for an artifact) 2195. * N wishes (M for artifacts) 2196. */ 2197. if (u.uconduct.wisharti == u.uconduct.wishes) 2198. Sprintf(eos(buf), " (%s", 2199. (u.uconduct.wisharti > 2L) ? "all " 2200. : (u.uconduct.wisharti == 2L) ? "both " : ""); 2201. else 2202. Sprintf(eos(buf), " (%ld ", u.uconduct.wisharti); 2203. 2204. Sprintf(eos(buf), "for %s)", 2205. (u.uconduct.wisharti == 1L) ? "an artifact" 2206. : "artifacts"); 2207. } 2208. you_have_X(buf); 2209. 2210. if (!u.uconduct.wisharti) 2211. enl_msg(You_, "have not wished", "did not wish", 2212. " for any artifacts", ""); 2213. } 2214. 2215. /* only report Sokoban conduct if the Sokoban branch has been entered */ 2216. if (sokoban_in_play()) { 2217. const char *presentverb = "have violated", *pastverb = "violated"; 2218. 2219. if (!u.uconduct.sokocheat) { 2220. presentverb = "have not violated"; 2221. pastverb = "did not violate"; 2222. Strcpy(buf, " any of the special Sokoban rules"); 2223. } else { 2224. Strcpy(buf, " the special Sokoban rules "); 2225. Strcat(buf, N_times(u.uconduct.sokocheat, bufN)); 2226. } 2227. enl_msg(You_, presentverb, pastverb, buf, ""); 2228. } 2229. 2230. show_achievements(final); 2231. 2232. /* Pop up the window and wait for a key */ 2233. display_nhwindow(ge.en_win, TRUE); 2234. destroy_nhwindow(ge.en_win); 2235. ge.en_win = WIN_ERR; 2236. } 2237. 2238. /* 2239. * Achievements (see 'enum achievements' in you.h). 2240. */ 2241. 2242. staticfn void 2243. show_achievements( 2244. int final) /* 'final' is used "behind the curtain" by enl_foo() macros */ 2245. { 2246. int i, achidx, absidx, acnt; 2247. char title[QBUFSZ], buf[QBUFSZ]; 2248. winid awin = WIN_ERR; 2249. 2250. /* unfortunately we can't show the achievements (at least not all of 2251. them) while the game is in progress because it would give away the 2252. ID of luckstone (at Mine's End) and of real Amulet of Yendor */ 2253. if (!final && !wizard) 2254. return; 2255. 2256. /* first, figure whether any achievements have been accomplished 2257. so that we don't show the header for them if the resulting list 2258. below it would be empty */ 2259. if ((acnt = count_achievements()) == 0) 2260. return; 2261. 2262. if (ge.en_win != WIN_ERR) { 2263. awin = ge.en_win; /* end of game disclosure window */ 2264. putstr(awin, 0, ""); 2265. } else { 2266. awin = create_nhwindow(NHW_MENU); 2267. } 2268. Sprintf(title, "Achievement%s:", plur(acnt)); 2269. putstr(awin, 0, title); 2270. 2271. /* display achievements in the order in which they were recorded; 2272. lone exception is to defer the Amulet if we just ascended; 2273. it warrants alternate wording when given away during ascension, 2274. but the Amulet achievement is always attained before entering 2275. endgame and the alternate wording looks strange if shown before 2276. "reached endgame" and "reached Astral" */ 2277. if (remove_achievement(ACH_UWIN)) { /* UWIN == Ascended! */ 2278. /* for ascension, force it to be last and Amulet next to last 2279. by taking them out and then adding them back */ 2280. if (remove_achievement(ACH_AMUL)) /* should always be True here */ 2281. record_achievement(ACH_AMUL); 2282. record_achievement(ACH_UWIN); 2283. } 2284. for (i = 0; i < acnt; ++i) { 2285. achidx = u.uachieved[i]; 2286. absidx = abs(achidx); 2287. 2288. switch (absidx) { 2289. case ACH_BLND: 2290. enl_msg(You_, "are exploring", "explored", 2291. " without being able to see", ""); 2292. break; 2293. case ACH_NUDE: 2294. enl_msg(You_, "have gone", "went", " without any armor", ""); 2295. break; 2296. case ACH_MINE: 2297. you_have_X("entered the Gnomish Mines"); 2298. break; 2299. case ACH_TOWN: 2300. you_have_X("entered Minetown"); 2301. break; 2302. case ACH_SHOP: 2303. you_have_X("entered a shop"); 2304. break; 2305. case ACH_TMPL: 2306. you_have_X("entered a temple"); 2307. break; 2308. case ACH_ORCL: 2309. you_have_X("consulted the Oracle of Delphi"); 2310. break; 2311. case ACH_NOVL: 2312. you_have_X("read from a Discworld novel"); 2313. break; 2314. case ACH_SOKO: 2315. you_have_X("entered Sokoban"); 2316. break; 2317. case ACH_SOKO_PRIZE: /* hard to reach guaranteed bag or amulet */ 2318. you_have_X("completed Sokoban"); 2319. break; 2320. case ACH_MINE_PRIZE: /* hidden guaranteed luckstone */ 2321. you_have_X("completed the Gnomish Mines"); 2322. break; 2323. case ACH_BGRM: 2324. you_have_X("entered the Big Room"); 2325. break; 2326. case ACH_MEDU: 2327. you_have_X("defeated Medusa"); 2328. break; 2329. case ACH_TUNE: 2330. you_have_X( 2331. "learned the tune to open and close the Castle's drawbridge"); 2332. break; 2333. case ACH_BELL: 2334. /* alternate phrasing for present vs past and also for 2335. possessing the item vs once held it */ 2336. enl_msg(You_, 2337. u.uhave.bell ? "have" : "have handled", 2338. u.uhave.bell ? "had" : "handled", 2339. " the Bell of Opening", ""); 2340. break; 2341. case ACH_HELL: 2342. enl_msg(You_, "have ", "", "entered Gehennom", ""); 2343. break; 2344. case ACH_CNDL: 2345. enl_msg(You_, 2346. u.uhave.menorah ? "have" : "have handled", 2347. u.uhave.menorah ? "had" : "handled", 2348. " the Candelabrum of Invocation", ""); 2349. break; 2350. case ACH_BOOK: 2351. enl_msg(You_, 2352. u.uhave.book ? "have" : "have handled", 2353. u.uhave.book ? "had" : "handled", 2354. " the Book of the Dead", ""); 2355. break; 2356. case ACH_INVK: 2357. you_have_X("gained access to Moloch's Sanctum"); 2358. break; 2359. case ACH_AMUL: 2360. /* alternate wording for ascended (always past tense) since 2361. hero had it until #offer forced it to be relinquished */ 2362. enl_msg(You_, 2363. u.uhave.amulet ? "have" : "have obtained", 2364. u.uevent.ascended ? "delivered" 2365. : u.uhave.amulet ? "had" : "had obtained", 2366. " the Amulet of Yendor", ""); 2367. break; 2368. 2369. /* reaching Astral makes feedback about reaching the Planes 2370. be redundant and ascending makes both be redundant, but 2371. we display all that apply */ 2372. case ACH_ENDG: 2373. you_have_X("reached the Elemental Planes"); 2374. break; 2375. case ACH_ASTR: 2376. you_have_X("reached the Astral Plane"); 2377. break; 2378. case ACH_UWIN: 2379. /* the ultimate achievement... */ 2380. enlght_out(" You ascended!"); 2381. break; 2382. 2383. /* rank 0 is the starting condition, not an achievement; 8 is Xp 30 */ 2384. case ACH_RNK1: case ACH_RNK2: case ACH_RNK3: case ACH_RNK4: 2385. case ACH_RNK5: case ACH_RNK6: case ACH_RNK7: case ACH_RNK8: 2386. Sprintf(buf, "attained the rank of %s", 2387. rank_of(rank_to_xlev(absidx - (ACH_RNK1 - 1)), 2388. Role_switch, (achidx < 0) ? TRUE : FALSE)); 2389. you_have_X(buf); 2390. break; 2391. 2392. default: 2393. Sprintf(buf, " [Unexpected achievement #%d.]", achidx); 2394. enlght_out(buf); 2395. break; 2396. } /* switch */ 2397. } /* for */ 2398. 2399. if (awin != ge.en_win) { 2400. display_nhwindow(awin, TRUE); 2401. destroy_nhwindow(awin); 2402. } 2403. } 2404. 2405. /* record an achievement (add at end of list unless already present) */ 2406. void 2407. record_achievement(schar achidx) 2408. { 2409. int i, absidx; 2410. int repeat_achievement = 0; 2411. 2412. absidx = abs(achidx); 2413. /* valid achievements range from 1 to N_ACH-1; however, ranks can be 2414. stored as the complement (ie, negative) to track gender */ 2415. if ((achidx < 1 && (absidx < ACH_RNK1 || absidx > ACH_RNK8)) 2416. || achidx >= N_ACH) { 2417. impossible("Achievement #%d is out of range.", achidx); 2418. return; 2419. } 2420. 2421. /* the list has an extra slot so there is always at least one 0 at 2422. its end (more than one unless all N_ACH-1 possible achievements 2423. have been recorded); find first empty slot or achievement #achidx; 2424. an attempt to duplicate an achievement can happen if any of Bell, 2425. Candelabrum, Book, or Amulet is dropped then picked up again */ 2426. for (i = 0; u.uachieved[i]; ++i) 2427. if (abs(u.uachieved[i]) == absidx) { 2428. repeat_achievement = 1; 2429. break; 2430. } 2431. 2432. /* 2433. * We do the sound for an achievement, even if it has already been 2434. * achieved before. Some players might have set up level-based 2435. * theme music or something. We do let the sound interface know 2436. * that it's not the original achievement though. 2437. */ 2438. SoundAchievement(achidx, 0, repeat_achievement); 2439. 2440. if (repeat_achievement) 2441. return; /* already recorded, don't duplicate it */ 2442. u.uachieved[i] = achidx; 2443. 2444. /* avoid livelog for achievements recorded during final disclosure: 2445. nudist and blind-from-birth; also ascension which is suppressed 2446. by this gets logged separately in really_done() */ 2447. if (program_state.gameover) 2448. return; 2449. 2450. if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) { 2451. livelog_printf(achieve_msg[absidx].llflag, 2452. "attained the rank of %s (level %d)", 2453. rank_of(rank_to_xlev(absidx - (ACH_RNK1 - 1)), 2454. Role_switch, (achidx < 0) ? TRUE : FALSE), 2455. u.ulevel); 2456. } else if (achidx == ACH_SOKO_PRIZE 2457. || achidx == ACH_MINE_PRIZE) { 2458. /* need to supply extra information for these two */ 2459. short otyp = ((achidx == ACH_SOKO_PRIZE) 2460. ? svc.context.achieveo.soko_prize_otyp 2461. : svc.context.achieveo.mines_prize_otyp); 2462. 2463. /* note: OBJ_NAME() works here because both "bag of holding" and 2464. "amulet of reflection" are fully named in their objects[] entry 2465. but that's not true in the general case */ 2466. livelog_printf(achieve_msg[achidx].llflag, "%s %s", 2467. achieve_msg[achidx].msg, OBJ_NAME(objects[otyp])); 2468. } else { 2469. livelog_printf(achieve_msg[absidx].llflag, "%s", 2470. achieve_msg[absidx].msg); 2471. } 2472. } 2473. 2474. /* discard a recorded achievement; return True if removed, False otherwise */ 2475. boolean 2476. remove_achievement(schar achidx) 2477. { 2478. int i; 2479. 2480. for (i = 0; u.uachieved[i]; ++i) 2481. if (abs(u.uachieved[i]) == abs(achidx)) 2482. break; /* stop when found */ 2483. if (!u.uachieved[i]) /* not found */ 2484. return FALSE; 2485. /* list is 0 terminated so any beyond the removed one move up a slot */ 2486. do { 2487. u.uachieved[i] = u.uachieved[i + 1]; 2488. } while (u.uachieved[++i]); 2489. return TRUE; 2490. } 2491. 2492. /* used to decide whether there are any achievements to display */ 2493. int 2494. count_achievements(void) 2495. { 2496. int i, acnt = 0; 2497. 2498. for (i = 0; u.uachieved[i]; ++i) 2499. ++acnt; 2500. return acnt; 2501. } 2502. 2503. /* convert a rank index to an achievement number; encode it when female 2504. in order to subsequently report gender-specific ranks accurately */ 2505. schar 2506. achieve_rank(int rank) /* 1..8 */ 2507. { 2508. schar achidx = (schar) ((rank - 1) + ACH_RNK1); 2509. 2510. if (flags.female) 2511. achidx = -achidx; 2512. return achidx; 2513. } 2514. 2515. /* return True if sokoban branch has been entered, False otherwise */ 2516. boolean 2517. sokoban_in_play(void) 2518. { 2519. int achidx; 2520. 2521. /* TODO? move this to dungeon.c and test furthest level reached of the 2522. sokoban branch instead of relying on the entered-sokoban achievement */ 2523. 2524. for (achidx = 0; u.uachieved[achidx]; ++achidx) 2525. if (u.uachieved[achidx] == ACH_SOKO) 2526. return TRUE; 2527. return FALSE; 2528. } 2529. 2530. /* #chronicle command */ 2531. int 2532. do_gamelog(void) 2533. { 2534. #ifdef CHRONICLE 2535. if (gg.gamelog) { 2536. show_gamelog(ENL_GAMEINPROGRESS); 2537. } else { 2538. pline("No chronicled events."); 2539. } 2540. #else 2541. pline("Chronicle was turned off during compile-time."); 2542. #endif /* !CHRONICLE */ 2543. return ECMD_OK; 2544. } 2545. 2546. /* 'major' events for dumplog; inclusion or exclusion here may need tuning */ 2547. #define LL_majors (0L \ 2548. | LL_WISH \ 2549. | LL_ACHIEVE \ 2550. | LL_UMONST \ 2551. | LL_DIVINEGIFT \ 2552. | LL_LIFESAVE \ 2553. | LL_ARTIFACT \ 2554. | LL_GENOCIDE \ 2555. | LL_DUMP) /* explicitly for dumplog */ 2556. #define majorevent(llmsg) (((llmsg)->flags & LL_majors) != 0) 2557. #define spoilerevent(llmsg) (((llmsg)->flags & LL_SPOILER) != 0) 2558. 2559. /* #chronicle details */ 2560. void 2561. show_gamelog(int final) 2562. { 2563. #ifdef CHRONICLE 2564. struct gamelog_line *llmsg; 2565. winid win; 2566. char buf[BUFSZ]; 2567. int eventcnt = 0; 2568. 2569. win = create_nhwindow(NHW_TEXT); 2570. Sprintf(buf, "%s events:", final ? "Major" : "Logged"); 2571. putstr(win, 0, buf); 2572. for (llmsg = gg.gamelog; llmsg; llmsg = llmsg->next) { 2573. if (final && !majorevent(llmsg)) 2574. continue; 2575. if (!final && !wizard && spoilerevent(llmsg)) 2576. continue; 2577. if (!eventcnt++) 2578. putstr(win, 0, " Turn"); 2579. Snprintf(buf, sizeof buf, "%5ld: %s", llmsg->turn, llmsg->text); 2580. putstr(win, 0, buf); 2581. } 2582. /* since start of game is logged as a major event, 'eventcnt' should 2583. never end up as 0; for 'final', end of game is a major event too */ 2584. if (!eventcnt) 2585. putstr(win, 0, " none"); 2586. 2587. display_nhwindow(win, TRUE); 2588. destroy_nhwindow(win); 2589. #else 2590. nhUse(final); 2591. #endif /* !CHRONICLE */ 2592. return; 2593. } 2594. 2595. /* 2596. * Vanquished monsters. 2597. */ 2598. 2599. /* the two uppercase choices are implemented but suppressed from menu. 2600. also used in options.c */ 2601. const char *const vanqorders[NUM_VANQ_ORDER_MODES][3] = { 2602. { "t", "traditional: by monster level", 2603. "traditional: by monster level, by internal monster index" }, 2604. { "d", "by monster difficulty rating", 2605. "by monster difficulty rating, by internal monster index" }, 2606. { "a", "alphabetically, unique monsters separate", 2607. "alphabetically, first unique monsters, then others" }, 2608. { "A", "alphabetically, unique monsters intermixed", 2609. "alphabetically, unique monsters and others intermixed" }, 2610. { "C", "by monster class, high to low level in class", 2611. "by monster class, high to low level within class" }, 2612. { "c", "by monster class, low to high level in class", 2613. "by monster class, low to high level within class" }, 2614. { "n", "by count, high to low", 2615. "by count, high to low, by internal index within tied count" }, 2616. { "z", "by count, low to high", 2617. "by count, low to high, by internal index within tied count" }, 2618. }; 2619. 2620. staticfn int QSORTCALLBACK 2621. vanqsort_cmp( 2622. const genericptr vptr1, 2623. const genericptr vptr2) 2624. { 2625. int indx1 = *(short *) vptr1, indx2 = *(short *) vptr2, 2626. mlev1, mlev2, mstr1, mstr2, uniq1, uniq2, died1, died2, res; 2627. const char *name1, *name2, *punct; 2628. schar mcls1, mcls2; 2629. 2630. switch (flags.vanq_sortmode) { 2631. default: 2632. case VANQ_MLVL_MNDX: 2633. /* sort by monster level */ 2634. mlev1 = mons[indx1].mlevel; 2635. mlev2 = mons[indx2].mlevel; 2636. res = mlev2 - mlev1; /* mlevel high to low */ 2637. break; 2638. case VANQ_MSTR_MNDX: 2639. /* sort by monster toughness */ 2640. mstr1 = mons[indx1].difficulty; 2641. mstr2 = mons[indx2].difficulty; 2642. res = mstr2 - mstr1; /* monstr high to low */ 2643. break; 2644. case VANQ_ALPHA_SEP: 2645. uniq1 = ((mons[indx1].geno & G_UNIQ) && indx1 != PM_HIGH_CLERIC); 2646. uniq2 = ((mons[indx2].geno & G_UNIQ) && indx2 != PM_HIGH_CLERIC); 2647. if (uniq1 ^ uniq2) { /* one or other uniq, but not both */ 2648. res = uniq2 - uniq1; 2649. break; 2650. } /* else both unique or neither unique */ 2651. FALLTHROUGH; 2652. /*FALLTHRU*/ 2653. case VANQ_ALPHA_MIX: 2654. name1 = mons[indx1].pmnames[NEUTRAL]; 2655. name2 = mons[indx2].pmnames[NEUTRAL]; 2656. res = strcmpi(name1, name2); /* caseblind alpha, low to high */ 2657. break; 2658. case VANQ_MCLS_HTOL: 2659. case VANQ_MCLS_LTOH: 2660. /* mons[].mlet is a small integer, 1..N, of type plain char; 2661. if 'char' happens to be unsigned, (mlet1 - mlet2) would yield 2662. an inappropriate result when mlet2 is greater than mlet1, 2663. so force our copies (mcls1, mcls2) to be signed */ 2664. mcls1 = (schar) mons[indx1].mlet; 2665. mcls2 = (schar) mons[indx2].mlet; 2666. /* S_ANT through S_ZRUTY correspond to lowercase monster classes, 2667. S_ANGEL through S_ZOMBIE correspond to uppercase, and various 2668. punctuation characters are used for classes beyond those */ 2669. if (mcls1 > S_ZOMBIE && mcls2 > S_ZOMBIE) { 2670. /* force a specific order to the punctuation classes that's 2671. different from the internal order; 2672. internal order is ok if neither or just one is punctuation 2673. since letters have lower values so come out before punct */ 2674. static const char punctclasses[] = { 2675. S_LIZARD, S_EEL, S_GOLEM, S_GHOST, S_DEMON, S_HUMAN, '\0' 2676. }; 2677. 2678. if ((punct = strchr(punctclasses, mcls1)) != 0) 2679. mcls1 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses)); 2680. if ((punct = strchr(punctclasses, mcls2)) != 0) 2681. mcls2 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses)); 2682. } 2683. res = mcls1 - mcls2; /* class */ 2684. if (res == 0) { 2685. /* Riders are in the same class as major demons, yielding res==0 2686. above when both mcls1 and mcls2 are either Riders or demons or 2687. one of each; force Riders to be sorted before demons */ 2688. res = is_rider(&mons[indx2]) - is_rider(&mons[indx1]); 2689. /* res -1 => #1 is a Rider, #2 isn't; 2690. 0 => both Riders or neither; 2691. +1 => #2 is a Rider, #1 isn't */ 2692. if (res) 2693. break; 2694. mlev1 = mons[indx1].mlevel; 2695. mlev2 = mons[indx2].mlevel; 2696. res = mlev1 - mlev2; /* mlevel low to high */ 2697. if (flags.vanq_sortmode == VANQ_MCLS_HTOL) 2698. res = -res; /* mlevel high to low */ 2699. } 2700. break; 2701. case VANQ_COUNT_H_L: 2702. case VANQ_COUNT_L_H: 2703. died1 = svm.mvitals[indx1].died; 2704. died2 = svm.mvitals[indx2].died; 2705. res = died2 - died1; /* dead count high to low */ 2706. if (flags.vanq_sortmode == VANQ_COUNT_L_H) 2707. res = -res; /* dead count low to high */ 2708. break; 2709. } 2710. /* tiebreaker: internal mons[] index */ 2711. if (res == 0) 2712. res = indx1 - indx2; /* mndx low to high */ 2713. return res; 2714. } 2715. 2716. /* returns -1 if cancelled via ESC */ 2717. int 2718. set_vanq_order(boolean for_vanq) 2719. { 2720. winid tmpwin; 2721. menu_item *selected; 2722. anything any; 2723. char buf[BUFSZ]; 2724. const char *desc; 2725. int i, n, choice, 2726. clr = NO_COLOR; 2727. 2728. tmpwin = create_nhwindow(NHW_MENU); 2729. start_menu(tmpwin, MENU_BEHAVE_STANDARD); 2730. any = cg.zeroany; /* zero out all bits */ 2731. for (i = 0; i < SIZE(vanqorders); i++) { 2732. if (i == VANQ_ALPHA_MIX || i == VANQ_MCLS_HTOL) /* skip these */ 2733. continue; 2734. /* suppress some orderings if this menu if for 'm #genocided' */ 2735. if (!for_vanq && (i == VANQ_COUNT_H_L || i == VANQ_COUNT_L_H)) 2736. continue; 2737. desc = vanqorders[i][2]; 2738. /* unique monsters can't be genocided so "alpha, unique separate" 2739. and "alpha, unique intermixed" are confusing descriptions when 2740. this menu is for #genocided rather than for #vanquished */ 2741. if (!for_vanq && i == VANQ_ALPHA_SEP) 2742. desc = "alphabetically"; 2743. any.a_int = i + 1; 2744. add_menu(tmpwin, &nul_glyphinfo, &any, *vanqorders[i][0], 0, 2745. ATR_NONE, clr, desc, 2746. (i == flags.vanq_sortmode) ? MENU_ITEMFLAGS_SELECTED 2747. : MENU_ITEMFLAGS_NONE); 2748. } 2749. Sprintf(buf, "Sort order for %s", 2750. for_vanq ? "vanquished monster counts (also genocided types)" 2751. : "genocided monster types (also vanquished counts)"); 2752. end_menu(tmpwin, buf); 2753. 2754. n = select_menu(tmpwin, PICK_ONE, &selected); 2755. destroy_nhwindow(tmpwin); 2756. if (n > 0) { 2757. choice = selected[0].item.a_int - 1; 2758. /* skip preselected entry if we have more than one item chosen */ 2759. if (n > 1 && choice == flags.vanq_sortmode) 2760. choice = selected[1].item.a_int - 1; 2761. free((genericptr_t) selected); 2762. flags.vanq_sortmode = choice; 2763. } 2764. return (n < 0) ? -1 : flags.vanq_sortmode; 2765. } 2766. 2767. /* #vanquished command */ 2768. int 2769. dovanquished(void) 2770. { 2771. list_vanquished(iflags.menu_requested ? 'A' : 'y', FALSE); 2772. iflags.menu_requested = FALSE; 2773. return ECMD_OK; 2774. } 2775. 2776. /* high priests aren't unique but are flagged as such to simplify something */ 2777. #define UniqCritterIndx(mndx) \ 2778. ((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC) 2779. 2780. #define done_stopprint program_state.stopprint 2781. 2782. /* used for #vanquished and end of game disclosure and end of game dumplog */ 2783. void 2784. list_vanquished(char defquery, boolean ask) 2785. { 2786. int i; 2787. int pfx, nkilled; 2788. unsigned ntypes, ni; 2789. long total_killed = 0L; 2790. winid klwin; 2791. short mindx[NUMMONS]; 2792. char c, buf[BUFSZ], buftoo[BUFSZ]; 2793. /* 'A' is only supplied by 'm #vanquished'; 'd' is only supplied by 2794. dump_everything() when writing dumplog, so won't happen if built 2795. without '#define DUMPLOG' but there's no need for conditionals here */ 2796. boolean force_sort = (defquery == 'A'), 2797. dumping = (defquery == 'd'); 2798. 2799. /* normally we don't ask about sort order for the vanquished list unless 2800. it contains at least two entries; however, if player has used explicit 2801. 'm #vanquished', choose order no matter what it contains so far */ 2802. if (force_sort) { /* iflags.menu_requested via dovanquished() */ 2803. /* choose value for vanq_sortmode via menu; ESC cancels choosing 2804. sort order but continues with vanquishd monsters display */ 2805. (void) set_vanq_order(TRUE); 2806. } 2807. if (dumping || force_sort) { 2808. /* switch from 'A' or 'd' to 'y'; 'ask' is already False for the 2809. cases that might supply 'A' or 'd' */ 2810. defquery = 'y'; 2811. ask = FALSE; /* redundant */ 2812. } 2813. 2814. /* get totals first */ 2815. ntypes = 0; 2816. for (i = LOW_PM; i < NUMMONS; i++) { 2817. if ((nkilled = (int) svm.mvitals[i].died) == 0) 2818. continue; 2819. mindx[ntypes++] = i; 2820. total_killed += (long) nkilled; 2821. } 2822. 2823. /* vanquished creatures list; 2824. * includes all dead monsters, not just those killed by the player 2825. */ 2826. if (ntypes != 0) { 2827. char mlet, prev_mlet = 0; /* used as small integer, not character */ 2828. boolean class_header, uniq_header, Rider, 2829. was_uniq = FALSE, special_hdr = FALSE; 2830. 2831. if (ask) { 2832. char allow_yn[10]; 2833. 2834. if (ntypes > 1) { 2835. Strcpy(allow_yn, ynaqchars); 2836. } else { 2837. Strcpy(allow_yn, ynqchars); /* don't include 'a', but */ 2838. Strcat(allow_yn, "\033a"); /* allow user to answer 'a' */ 2839. if (defquery == 'a') /* potential default from 'disclose' */ 2840. defquery = 'y'; 2841. } 2842. c = yn_function("Do you want an account of creatures vanquished?", 2843. allow_yn, defquery, TRUE); 2844. } else { 2845. c = defquery; 2846. } 2847. 2848. if (c == 'q') 2849. done_stopprint++; 2850. if (c == 'y' || c == 'a') { 2851. if (c == 'a' && ntypes > 1) { /* ask user to choose sort order */ 2852. /* choose value for vanq_sortmode via menu; ESC cancels list 2853. of vanquished monsters but does not set 'done_stopprint' */ 2854. if (set_vanq_order(TRUE) < 0) 2855. return; 2856. } 2857. uniq_header = (flags.vanq_sortmode == VANQ_ALPHA_SEP); 2858. class_header = ((flags.vanq_sortmode == VANQ_MCLS_LTOH 2859. || flags.vanq_sortmode == VANQ_MCLS_HTOL) 2860. && ntypes > 1); 2861. 2862. klwin = create_nhwindow(NHW_MENU); 2863. putstr(klwin, 0, "Vanquished creatures:"); 2864. if (!dumping) 2865. putstr(klwin, 0, ""); 2866. 2867. qsort((genericptr_t) mindx, ntypes, sizeof *mindx, vanqsort_cmp); 2868. for (ni = 0; ni < ntypes; ni++) { 2869. i = mindx[ni]; 2870. nkilled = svm.mvitals[i].died; 2871. Rider = is_rider(&mons[i]); 2872. mlet = mons[i].mlet; 2873. if (class_header 2874. && (mlet != prev_mlet || (special_hdr && !Rider))) { 2875. if (!Rider) { 2876. Strcpy(buf, def_monsyms[(int) mlet].explain); 2877. special_hdr = FALSE; 2878. } else { 2879. Strcpy(buf, "Rider"); 2880. special_hdr = TRUE; 2881. } 2882. /* 'ask' implies final disclosure, where highlighting 2883. of various header lines is suppressed */ 2884. putstr(klwin, ask ? ATR_NONE : iflags.menu_headings.attr, 2885. upstart(buf)); 2886. prev_mlet = mlet; 2887. } 2888. if (UniqCritterIndx(i)) { 2889. Sprintf(buf, "%s%s", 2890. !type_is_pname(&mons[i]) ? "the " : "", 2891. mons[i].pmnames[NEUTRAL]); 2892. if (nkilled > 1) 2893. Sprintf(eos(buf), " (%s)", 2894. N_times((long) nkilled, buftoo)); 2895. was_uniq = TRUE; 2896. } else { 2897. if (uniq_header && was_uniq) { 2898. putstr(klwin, 0, ""); 2899. was_uniq = FALSE; 2900. } 2901. /* trolls or undead might have come back, 2902. but we don't keep track of that */ 2903. if (nkilled == 1) 2904. Strcpy(buf, an(mons[i].pmnames[NEUTRAL])); 2905. else 2906. Sprintf(buf, "%3d %s", nkilled, 2907. makeplural(mons[i].pmnames[NEUTRAL])); 2908. } 2909. /* number of leading spaces to match 3 digit prefix */ 2910. pfx = !strncmpi(buf, "the ", 4) ? 0 2911. : !strncmpi(buf, "an ", 3) ? 1 2912. : !strncmpi(buf, "a ", 2) ? 2 2913. : !digit(buf[2]) ? 4 : 0; 2914. if (class_header) 2915. ++pfx; 2916. Snprintf(buftoo, sizeof buftoo, "%*s%s", pfx, "", buf); 2917. putstr(klwin, 0, buftoo); 2918. } 2919. /* 2920. * if (Hallucination) 2921. * putstr(klwin, 0, "and a partridge in a pear tree"); 2922. */ 2923. if (ntypes > 1) { 2924. if (!dumping) 2925. putstr(klwin, 0, ""); 2926. Sprintf(buf, "%ld creatures vanquished.", total_killed); 2927. putstr(klwin, 0, buf); 2928. } 2929. display_nhwindow(klwin, TRUE); 2930. destroy_nhwindow(klwin); 2931. } 2932. 2933. /* 2934. * For end-of-game disclosure, we're only called when some monsters 2935. * were vanquished and won't reach these 'else-if's. 2936. * 2937. * If no monsters have been vanquished, we're either called for game 2938. * still in progress, so use present tense via pline(), or for dumplog 2939. * which needs putstr() and past tense. 2940. */ 2941. } else if (!program_state.gameover) { 2942. /* #vanquished rather than final disclosure, so pline() is ok */ 2943. pline("No creatures have been vanquished."); 2944. #ifdef DUMPLOG 2945. } else if (dumping) { 2946. putstr(0, 0, "No creatures were vanquished."); /* not pline() */ 2947. #endif 2948. } 2949. } 2950. 2951. /* number of monster species which have been genocided */ 2952. int 2953. num_genocides(void) 2954. { 2955. int i, n = 0; 2956. 2957. for (i = LOW_PM; i < NUMMONS; ++i) { 2958. if (svm.mvitals[i].mvflags & G_GENOD) { 2959. ++n; 2960. if (UniqCritterIndx(i)) 2961. impossible("unique creature '%d: %s' genocided?", 2962. i, mons[i].pmnames[NEUTRAL]); 2963. } 2964. } 2965. return n; 2966. } 2967. 2968. /* return a count of the number of extinct species */ 2969. staticfn int 2970. num_extinct(void) 2971. { 2972. int i, n = 0; 2973. 2974. for (i = LOW_PM; i < NUMMONS; ++i) { 2975. if (UniqCritterIndx(i)) 2976. continue; 2977. if ((svm.mvitals[i].mvflags & G_GONE) == G_EXTINCT) 2978. ++n; 2979. } 2980. return n; 2981. } 2982. 2983. /* collect both genocides and extinctions, skipping uniques */ 2984. staticfn int 2985. num_gone(int mvflags, int *mindx) 2986. { 2987. uchar mflg = (uchar) mvflags; 2988. int i, n = 0; 2989. 2990. (void) memset((genericptr_t) mindx, 0, NUMMONS * sizeof *mindx); 2991. 2992. for (i = LOW_PM; i < NUMMONS; ++i) { 2993. /* uniques can't be genocided but can become extinct; 2994. however, they're never reported as extinct, so skip them */ 2995. if (UniqCritterIndx(i)) 2996. continue; 2997. 2998. if ((svm.mvitals[i].mvflags & mflg) != 0) 2999. mindx[n++] = i; 3000. } 3001. return n; 3002. } 3003. 3004. /* show genocided and extinct monster types for final disclosure/dumplog 3005. or for the #genocided command */ 3006. void 3007. list_genocided(char defquery, boolean ask) 3008. { 3009. int i, mndx; 3010. int ngenocided, nextinct, ngone, mvflags, mindx[NUMMONS]; 3011. char c; 3012. winid klwin; 3013. char buf[BUFSZ]; 3014. boolean genoing, /* prompting for genocide or class genocide */ 3015. dumping; /* for DUMPLOG; doesn't need to be conditional */ 3016. boolean both = (program_state.gameover || wizard || discover); 3017. 3018. dumping = (defquery == 'd'); 3019. genoing = (defquery == 'g'); 3020. if (dumping || genoing) 3021. defquery = 'y'; 3022. if (genoing) 3023. both = FALSE; /* genocides only, not extinctions */ 3024. 3025. /* this goes through the whole monster list up to three times but will 3026. happen rarely and is simpler than a more general single pass check; 3027. extinctions are only revealed during end of game disclosure or when 3028. running in wizard or explore mode */ 3029. ngenocided = num_genocides(); 3030. nextinct = both ? num_extinct() : 0; 3031. mvflags = G_GENOD | (both ? G_EXTINCT : 0); 3032. ngone = num_gone(mvflags, mindx); 3033. 3034. /* genocided or extinct species list */ 3035. if (ngone > 0) { 3036. Sprintf(buf, "Do you want a list of %sspecies%s%s?", 3037. (nextinct && !ngenocided) ? "extinct " : "", 3038. (ngenocided) ? " genocided" : "", 3039. (nextinct && ngenocided) ? " and extinct" : ""); 3040. c = ask ? yn_function(buf, (ngone > 1) ? "ynaq" : "ynq\033a", 3041. defquery, TRUE) 3042. : defquery; 3043. if (c == 'q') 3044. done_stopprint++; 3045. if (c == 'y' || c == 'a') { 3046. int save_sortmode; 3047. char mlet, prev_mlet = 0; 3048. boolean class_header = FALSE; 3049. 3050. if (ngone > 1) { 3051. if (c == 'a') { /* ask player to choose sort order */ 3052. /* #genocided shares #vanquished's sort order */ 3053. if (set_vanq_order(FALSE) < 0) 3054. return; 3055. } 3056. /* sort orderings count-high-to-low or count-low-to-high 3057. don't make sense for genocides; if the preferred order 3058. to set to either of those, use alphabetical instead; 3059. note: the tie breaker for by-class is level-high-to-low 3060. or level-low-to-high rather than count so is ok as-is */ 3061. save_sortmode = flags.vanq_sortmode; 3062. if (flags.vanq_sortmode == VANQ_COUNT_H_L 3063. || flags.vanq_sortmode == VANQ_COUNT_L_H) 3064. flags.vanq_sortmode = VANQ_ALPHA_MIX; 3065. qsort((genericptr_t) mindx, ngone, 3066. sizeof *mindx, vanqsort_cmp); 3067. class_header = (flags.vanq_sortmode == VANQ_MCLS_LTOH 3068. || flags.vanq_sortmode == VANQ_MCLS_HTOL); 3069. flags.vanq_sortmode = save_sortmode; 3070. } 3071. 3072. klwin = create_nhwindow(NHW_MENU); 3073. Sprintf(buf, "%s%s species:", 3074. (ngenocided) ? "Genocided" : "Extinct", 3075. (nextinct && ngenocided) ? " or extinct" : ""); 3076. putstr(klwin, 0, buf); 3077. if (!dumping) 3078. putstr(klwin, 0, ""); 3079. 3080. for (i = 0; i < ngone; ++i) { 3081. mndx = mindx[i]; 3082. mlet = mons[mndx].mlet; 3083. if (class_header && mlet != prev_mlet) { 3084. Strcpy(buf, def_monsyms[(int) mlet].explain); 3085. /* 'ask' implies final disclosure, where highlighting 3086. of various header lines is suppressed */ 3087. putstr(klwin, ask ? ATR_NONE : iflags.menu_headings.attr, 3088. upstart(buf)); 3089. prev_mlet = mlet; 3090. } 3091. Sprintf(buf, " %s", makeplural(mons[mndx].pmnames[NEUTRAL])); 3092. /* 3093. * "Extinct" is unfortunate terminology. A species 3094. * is marked extinct when its birth limit is reached, 3095. * but there might be members of the species still 3096. * alive, contradicting the meaning of the word. 3097. * 3098. * We only append "(extinct)" if the G_GENOD bit is 3099. * clear. During normal play, 'mndx' won't be in the 3100. * collected list unless that bit is set. 3101. */ 3102. if ((svm.mvitals[mndx].mvflags & G_GONE) == G_EXTINCT) 3103. Strcat(buf, " (extinct)"); 3104. putstr(klwin, 0, buf); 3105. } 3106. if (!dumping) 3107. putstr(klwin, 0, ""); 3108. if (ngenocided > 0) { 3109. Sprintf(buf, "%d species genocided.", ngenocided); 3110. putstr(klwin, 0, buf); 3111. } 3112. if (nextinct > 0) { 3113. Sprintf(buf, "%d species extinct.", nextinct); 3114. putstr(klwin, 0, buf); 3115. } 3116. 3117. display_nhwindow(klwin, TRUE); 3118. destroy_nhwindow(klwin); 3119. } 3120. 3121. /* See the comment for similar code near the end of list_vanquished(). */ 3122. } else if (!program_state.gameover) { 3123. /* #genocided rather than final disclosure, so pline() is ok and 3124. extinction has been ignored */ 3125. pline("No creatures have been genocided%s.", genoing ? " yet" : ""); 3126. #ifdef DUMPLOG 3127. } else if (dumping) { /* 'gameover' is True if we make it here */ 3128. putstr(0, 0, "No species were genocided or became extinct."); 3129. #endif 3130. } 3131. } 3132. 3133. /* M-g - #genocided command */ 3134. int 3135. dogenocided(void) 3136. { 3137. list_genocided(iflags.menu_requested ? 'a' : 'y', FALSE); 3138. return ECMD_OK; 3139. } 3140. 3141. DISABLE_WARNING_FORMAT_NONLITERAL 3142. 3143. /* #wizborn extended command */ 3144. int 3145. doborn(void) 3146. { 3147. static const char fmt[] = "%4i %4i %c %-30s"; 3148. int i; 3149. winid datawin = create_nhwindow(NHW_TEXT); 3150. char buf[BUFSZ]; 3151. int nborn = 0, ndied = 0; 3152. 3153. putstr(datawin, 0, "died born"); 3154. for (i = LOW_PM; i < NUMMONS; i++) 3155. if (svm.mvitals[i].born || svm.mvitals[i].died 3156. || (svm.mvitals[i].mvflags & G_GONE) != 0) { 3157. Sprintf(buf, fmt, 3158. svm.mvitals[i].died, svm.mvitals[i].born, 3159. ((svm.mvitals[i].mvflags & G_GONE) == G_EXTINCT) ? 'E' 3160. : ((svm.mvitals[i].mvflags & G_GONE) == G_GENOD) ? 'G' 3161. : ((svm.mvitals[i].mvflags & G_GONE) != 0) ? 'X' 3162. : ' ', 3163. mons[i].pmnames[NEUTRAL]); 3164. putstr(datawin, 0, buf); 3165. nborn += svm.mvitals[i].born; 3166. ndied += svm.mvitals[i].died; 3167. } 3168. 3169. putstr(datawin, 0, ""); 3170. Sprintf(buf, fmt, ndied, nborn, ' ', ""); 3171. 3172. display_nhwindow(datawin, FALSE); 3173. destroy_nhwindow(datawin); 3174. 3175. return ECMD_OK; 3176. } 3177. 3178. RESTORE_WARNING_FORMAT_NONLITERAL 3179. 3180. /* 3181. * align_str(), piousness(), mstatusline() and ustatusline() once resided 3182. * in pline.c, then got moved to priest.c just to be out of there. They 3183. * fit better here. 3184. */ 3185. 3186. const char * 3187. align_str(aligntyp alignment) 3188. { 3189. switch ((int) alignment) { 3190. case A_CHAOTIC: 3191. return "chaotic"; 3192. case A_NEUTRAL: 3193. return "neutral"; 3194. case A_LAWFUL: 3195. return "lawful"; 3196. case A_NONE: 3197. return "unaligned"; 3198. } 3199. return "unknown"; 3200. } 3201. 3202. staticfn char * 3203. size_str(int msize) 3204. { 3205. static char outbuf[40]; 3206. 3207. switch (msize) { 3208. case MZ_TINY: 3209. Strcpy(outbuf, "tiny"); 3210. break; 3211. case MZ_SMALL: 3212. Strcpy(outbuf, "small"); 3213. break; 3214. case MZ_MEDIUM: 3215. Strcpy(outbuf, "medium"); 3216. break; 3217. case MZ_LARGE: 3218. Strcpy(outbuf, "large"); 3219. break; 3220. case MZ_HUGE: 3221. Strcpy(outbuf, "huge"); 3222. break; 3223. case MZ_GIGANTIC: 3224. Strcpy(outbuf, "gigantic"); 3225. break; 3226. default: 3227. Sprintf(outbuf, "unknown size (%d)", msize); 3228. break; 3229. } 3230. return outbuf; 3231. } 3232. 3233. /* used for self-probing */ 3234. char * 3235. piousness(boolean showneg, const char *suffix) 3236. { 3237. static char buf[32]; /* bigger than "insufficiently neutral" */ 3238. const char *pio; 3239. 3240. /* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */ 3241. if (u.ualign.record >= 20) 3242. pio = "piously"; 3243. else if (u.ualign.record > 13) 3244. pio = "devoutly"; 3245. else if (u.ualign.record > 8) 3246. pio = "fervently"; 3247. else if (u.ualign.record > 3) 3248. pio = "stridently"; 3249. else if (u.ualign.record == 3) 3250. pio = ""; 3251. else if (u.ualign.record > 0) 3252. pio = "haltingly"; 3253. else if (u.ualign.record == 0) 3254. pio = "nominally"; 3255. else if (!showneg) 3256. pio = "insufficiently"; 3257. else if (u.ualign.record >= -3) 3258. pio = "strayed"; 3259. else if (u.ualign.record >= -8) 3260. pio = "sinned"; 3261. else 3262. pio = "transgressed"; 3263. 3264. Sprintf(buf, "%s", pio); 3265. if (suffix && (!showneg || u.ualign.record >= 0)) { 3266. if (u.ualign.record != 3) 3267. Strcat(buf, " "); 3268. Strcat(buf, suffix); 3269. } 3270. return buf; 3271. } 3272. 3273. /* stethoscope or probing applied to monster -- one-line feedback */ 3274. void 3275. mstatusline(struct monst *mtmp) 3276. { 3277. aligntyp alignment = mon_aligntyp(mtmp); 3278. char info[BUFSZ], monnambuf[BUFSZ]; 3279. 3280. info[0] = 0; 3281. if (mtmp->mtame) { 3282. Strcat(info, ", tame"); 3283. if (wizard) { 3284. Sprintf(eos(info), " (%d", mtmp->mtame); 3285. if (!mtmp->isminion) 3286. Sprintf(eos(info), "; hungry %ld; apport %d", 3287. EDOG(mtmp)->hungrytime, EDOG(mtmp)->apport); 3288. Strcat(info, ")"); 3289. } 3290. } else if (mtmp->mpeaceful) 3291. Strcat(info, ", peaceful"); 3292. 3293. if (mtmp->data == &mons[PM_LONG_WORM]) { 3294. int segndx, nsegs = count_wsegs(mtmp); 3295. 3296. /* the worm code internals don't consider the head to be one of 3297. the worm's segments, but we count it as such when presenting 3298. worm feedback to the player */ 3299. if (!nsegs) { 3300. Strcat(info, ", single segment"); 3301. } else { 3302. ++nsegs; /* include head in the segment count */ 3303. segndx = wseg_at(mtmp, gb.bhitpos.x, gb.bhitpos.y); 3304. Sprintf(eos(info), ", %d%s of %d segments", 3305. segndx, ordin(segndx), nsegs); 3306. } 3307. } 3308. if (ismnum(mtmp->cham) && mtmp->data != &mons[mtmp->cham]) 3309. /* don't reveal the innate form (chameleon, vampire, &c), 3310. just expose the fact that this current form isn't it */ 3311. Strcat(info, ", shapechanger"); 3312. /* pets eating mimic corpses mimic while eating, so this comes first */ 3313. if (mtmp->meating) 3314. Strcat(info, ", eating"); 3315. /* a stethoscope exposes mimic before getting here so this 3316. won't be relevant for it, but wand of probing doesn't */ 3317. if (mtmp->mundetected || mtmp->m_ap_type 3318. || visible_region_at(gb.bhitpos.x, gb.bhitpos.y)) 3319. mhidden_description(mtmp, 3320. MHID_PREFIX | MHID_ARTICLE | MHID_ALTMON | MHID_REGION, 3321. eos(info)); 3322. if (mtmp->mcan) 3323. Strcat(info, ", cancelled"); 3324. if (mtmp->mconf) 3325. Strcat(info, ", confused"); 3326. if (mtmp->mblinded || !mtmp->mcansee) 3327. Strcat(info, ", blind"); 3328. if (mtmp->mstun) 3329. Strcat(info, ", stunned"); 3330. if (mtmp->msleeping) 3331. Strcat(info, ", asleep"); 3332. #if 0 /* unfortunately mfrozen covers temporary sleep and being busy 3333. * (donning armor, for instance) as well as paralysis */ 3334. else if (mtmp->mfrozen) 3335. Strcat(info, ", paralyzed"); 3336. #else 3337. else if (mtmp->mfrozen || !mtmp->mcanmove) 3338. Strcat(info, ", can't move"); 3339. #endif 3340. /* [arbitrary reason why it isn't moving] */ 3341. else if ((mtmp->mstrategy & STRAT_WAITMASK) != 0) 3342. Strcat(info, ", meditating"); 3343. if (mtmp->mflee) 3344. Strcat(info, ", scared"); 3345. if (mtmp->mtrapped) 3346. Strcat(info, ", trapped"); 3347. if (mtmp->mspeed) 3348. Strcat(info, (mtmp->mspeed == MFAST) ? ", fast" 3349. : (mtmp->mspeed == MSLOW) ? ", slow" 3350. : ", [? speed]"); 3351. if (mtmp->minvis) 3352. Strcat(info, ", invisible"); 3353. if (mtmp == u.ustuck) { 3354. struct permonst *pm = u.ustuck->data; 3355. 3356. /* being swallowed/engulfed takes priority over sticks(youmonst); 3357. this used to have that backwards and checked sticks() first */ 3358. Strcat(info, u.uswallow ? (digests(pm) 3359. ? ", digesting you" 3360. /* note: the "swallowing you" case won't 3361. happen because all animal engulfers 3362. either digest their victims (purple 3363. worm) or enfold them (trappers and 3364. lurkers above) */ 3365. : (is_animal(pm) && !enfolds(pm)) 3366. ? ", swallowing you" 3367. : ", engulfing you") 3368. /* !u.uswallow; if both youmonst and ustuck are holders, 3369. youmonst wins */ 3370. : (!sticks(gy.youmonst.data) ? ", holding you" 3371. : ", held by you")); 3372. } 3373. if (mtmp == u.usteed) { 3374. Strcat(info, ", carrying you"); 3375. if (Wounded_legs) { 3376. /* EWounded_legs is used to track left/right/both rather than 3377. some form of extrinsic impairment; HWounded_legs is used for 3378. timeout; both apply to steed instead of hero when mounted */ 3379. long legs = (EWounded_legs & BOTH_SIDES); 3380. const char *what = mbodypart(mtmp, LEG); 3381. 3382. if (legs == BOTH_SIDES) 3383. what = makeplural(what); 3384. Sprintf(eos(info), ", injured %s", what); 3385. } 3386. } 3387. if (mtmp->mleashed) 3388. Strcat(info, ", leashed"); 3389. 3390. /* avoid "Status of the invisible newt ..., invisible" */ 3391. /* and unlike a normal mon_nam, use "saddled" even if it has a name */ 3392. Strcpy(monnambuf, x_monnam(mtmp, ARTICLE_YOUR, (char *) 0, 3393. (SUPPRESS_IT | SUPPRESS_INVISIBLE), FALSE)); 3394. 3395. pline("Status of %s (%s, %s): Level %d HP %d(%d) AC %d%s.", 3396. monnambuf, align_str(alignment), size_str(mtmp->data->msize), 3397. mtmp->m_lev, mtmp->mhp, mtmp->mhpmax, find_mac(mtmp), info); 3398. } 3399. 3400. /* stethoscope or probing applied to hero -- one-line feedback */ 3401. void 3402. ustatusline(void) 3403. { 3404. NhRegion *reg; 3405. char info[BUFSZ]; 3406. size_t ln; 3407. 3408. info[0] = '\0'; 3409. if (Sick) { 3410. Strcat(info, ", dying from"); 3411. if (u.usick_type & SICK_VOMITABLE) 3412. Strcat(info, " food poisoning"); 3413. if (u.usick_type & SICK_NONVOMITABLE) { 3414. if (u.usick_type & SICK_VOMITABLE) 3415. Strcat(info, " and"); 3416. Strcat(info, " illness"); 3417. } 3418. } 3419. if (Stoned) 3420. Strcat(info, ", solidifying"); 3421. if (Slimed) 3422. Strcat(info, ", becoming slimy"); 3423. if (Strangled) 3424. Strcat(info, ", being strangled"); 3425. if (Vomiting) 3426. Strcat(info, ", nauseated"); /* !"nauseous" */ 3427. if (Confusion) 3428. Strcat(info, ", confused"); 3429. if (Blind) { 3430. Strcat(info, ", blind"); 3431. if (u.ucreamed) { 3432. if ((long) u.ucreamed < BlindedTimeout || Blindfolded 3433. || !haseyes(gy.youmonst.data)) 3434. Strcat(info, ", cover"); 3435. Strcat(info, "ed by sticky goop"); 3436. } /* note: "goop" == "glop"; variation is intentional */ 3437. } 3438. if (Stunned) 3439. Strcat(info, ", stunned"); 3440. if (Wounded_legs && !u.usteed) { 3441. /* EWounded_legs is used to track left/right/both rather than some 3442. form of extrinsic impairment; HWounded_legs is used for timeout; 3443. both apply to steed instead of hero when mounted */ 3444. long legs = (EWounded_legs & BOTH_SIDES); 3445. const char *what = body_part(LEG); 3446. 3447. if (legs == BOTH_SIDES) 3448. what = makeplural(what); 3449. /* when it's just one leg, ^X reports which, left or right; 3450. ustatusline() doesn't, in order to keep the output a bit shorter */ 3451. Sprintf(eos(info), ", injured %s", what); 3452. } 3453. if (Glib) 3454. Sprintf(eos(info), ", slippery %s", fingers_or_gloves(TRUE)); 3455. if (u.utrap) 3456. Strcat(info, ", trapped"); 3457. if (Fast) 3458. Strcat(info, Very_fast ? ", very fast" : ", fast"); 3459. if (u.uundetected) 3460. Strcat(info, ", concealed"); 3461. else if (U_AP_TYPE != M_AP_NOTHING) 3462. Strcat(info, ", disguised"); 3463. if (Invis) 3464. Strcat(info, ", invisible"); 3465. if (u.ustuck) { 3466. if (u.uswallow) 3467. Strcat(info, digests(u.ustuck->data) ? ", being digested by " 3468. : ", engulfed by "); 3469. else if (!sticks(gy.youmonst.data)) 3470. Strcat(info, ", held by "); 3471. else 3472. Strcat(info, ", holding "); 3473. /* FIXME? a_monnam() uses x_monnam() which has a special case that 3474. forces "the" instead of "a" when formatting u.ustuck while hero 3475. is swallowed; we don't really want that here but it isn't worth 3476. fiddling with just for self-probing while engulfed */ 3477. Strcat(info, a_monnam(u.ustuck)); 3478. } 3479. if (!u.uswallow 3480. && (reg = visible_region_at(u.ux, u.uy)) != 0 3481. && (ln = strlen(info)) < sizeof info) 3482. Snprintf(eos(info), sizeof info - ln, ", in a cloud of %s", 3483. reg_damg(reg) ? "poison gas" : "vapor"); 3484. 3485. pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", svp.plname, 3486. piousness(FALSE, align_str(u.ualign.type)), 3487. Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp, 3488. Upolyd ? u.mhmax : u.uhpmax, u.uac, info); 3489. } 3490. 3491. /* for 'onefile' processing where end of this file isn't necessarily the 3492. end of the source code seen by the compiler */ 3493. #undef enl_msg 3494. #undef you_are 3495. #undef you_have 3496. #undef you_can 3497. #undef you_have_been 3498. #undef you_have_never 3499. #undef you_have_X 3500. #undef LL_majors 3501. #undef majorevent 3502. #undef spoilerevent 3503. #undef UniqCritterIndx 3504. #undef done_stopprint 3505. 3506. /*insight.c*/