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

Function reward_untrap

src/trap.c:5529–5548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5527}
5528
5529staticfn void
5530reward_untrap(struct trap *ttmp, struct monst *mtmp)
5531{
5532 if (!ttmp->madeby_u) {
5533 if (rnl(10) < 8 && !mtmp->mpeaceful && !helpless(mtmp)
5534 && !mtmp->mfrozen && !mindless(mtmp->data)
5535 && !unique_corpstat(mtmp->data)
5536 && mtmp->data->mlet != S_HUMAN) {
5537 mtmp->mpeaceful = 1;
5538 set_malign(mtmp); /* reset alignment */
5539 pline("%s is grateful.", Monnam(mtmp));
5540 }
5541 /* Helping someone out of a trap is a nice thing to do.
5542 A lawful may be rewarded, but not too often. */
5543 if (!rn2(3) && !rnl(8) && u.ualign.type == A_LAWFUL) {
5544 adjalign(1);
5545 You_feel("that you did the right thing.");
5546 }
5547 }
5548}
5549
5550/* Help a monster out of a bear trap or web, or if no monster is
5551 present, disarm a bear trap or destroy a web. Helge Hafting */

Callers 3

disarm_holdingtrapFunction · 0.85
help_monster_outFunction · 0.85
openholdingtrapFunction · 0.85

Calls 7

rnlFunction · 0.85
set_malignFunction · 0.85
MonnamFunction · 0.85
rn2Function · 0.85
adjalignFunction · 0.85
You_feelFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected