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

Function fix_worst_trouble

src/pray.c:372–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372staticfn void
373fix_worst_trouble(int trouble)
374{
375 int i, maxhp;
376 struct obj *otmp = 0;
377 const char *what = (const char *) 0;
378 static NEARDATA const char leftglow[] = "Your left ring softly glows",
379 rightglow[] = "Your right ring softly glows";
380
381 switch (trouble) {
382 case TROUBLE_STONED:
383 make_stoned(0L, "You feel more limber.", 0, (char *) 0);
384 break;
385 case TROUBLE_SLIMED:
386 make_slimed(0L, "The slime disappears.");
387 break;
388 case TROUBLE_STRANGLED:
389 if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) {
390 Your("amulet vanishes!");
391 useup(uamul);
392 }
393 You("can breathe again.");
394 Strangled = 0;
395 disp.botl = TRUE;
396 break;
397 case TROUBLE_LAVA:
398 /* teleport should always succeed, but if not, just untrap them */
399 if (!safe_teleds(TELEDS_NO_FLAGS))
400 reset_utrap(TRUE);
401 rescued_from_terrain(DISSOLVED); /* DISSOLVED: pending cause of death
402 * if trouble didn't get cured */
403 break;
404 case TROUBLE_STARVING:
405 /* temporarily lost strength recovery now handled by init_uhunger() */
406 FALLTHROUGH;
407 /* FALLTHRU*/
408 case TROUBLE_HUNGRY:
409 Your("%s feels content.", body_part(STOMACH));
410 init_uhunger();
411 disp.botl = TRUE;
412 break;
413 case TROUBLE_SICK:
414 You_feel("better.");
415 make_sick(0L, (char *) 0, FALSE, SICK_ALL);
416 break;
417 case TROUBLE_REGION:
418 /* stinking cloud, with hero vulnerable to HP loss */
419 region_safety();
420 break;
421 case TROUBLE_HIT:
422 /* "fix all troubles" will keep trying if hero has
423 5 or less hit points, so make sure they're always
424 boosted to be more than that */
425 You_feel("much better.");
426 if (Upolyd) {
427 maxhp = u.mhmax + rnd(5);
428 setuhpmax(max(maxhp, 5 + 1), FALSE); /* acts as setmhmax() */
429 u.mh = u.mhmax;

Callers 1

pleasedFunction · 0.85

Calls 15

make_stonedFunction · 0.85
make_slimedFunction · 0.85
YourFunction · 0.85
useupFunction · 0.85
YouFunction · 0.85
safe_teledsFunction · 0.85
reset_utrapFunction · 0.85
rescued_from_terrainFunction · 0.85
body_partFunction · 0.85
init_uhungerFunction · 0.85
You_feelFunction · 0.85
make_sickFunction · 0.85

Tested by

no test coverage detected