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

Function try_lift

src/trap.c:5676–5696  ·  view source on GitHub ↗

trying to #untrap a monster from a pit; is the weight too heavy? */

Source from the content-addressed store, hash-verified

5674
5675/* trying to #untrap a monster from a pit; is the weight too heavy? */
5676staticfn int
5677try_lift(
5678 struct monst *mtmp, /* trapped monster */
5679 struct trap *ttmp, /* pit, possibly made by hero, or spiked pit */
5680 int xtra_wt, /* monster (corpse weight) + (stuff ? minvent weight : 0) */
5681 boolean stuff) /* False: monster w/o minvent; True: w/ minvent */
5682{
5683 if (calc_capacity(xtra_wt) >= HVY_ENCUMBER) {
5684 pline("%s is %s for you to lift.", Monnam(mtmp),
5685 stuff ? "carrying too much" : "too heavy");
5686 if (!ttmp->madeby_u && !mtmp->mpeaceful && mtmp->mcanmove
5687 && !mindless(mtmp->data) && mtmp->data->mlet != S_HUMAN
5688 && rnl(10) < 3) {
5689 mtmp->mpeaceful = 1;
5690 set_malign(mtmp); /* reset alignment */
5691 pline("%s thinks it was nice of you to try.", Monnam(mtmp));
5692 }
5693 return 0;
5694 }
5695 return 1;
5696}
5697
5698/* Help trapped monster (out of a (spiked) pit) */
5699staticfn int

Callers 1

help_monster_outFunction · 0.85

Calls 5

calc_capacityFunction · 0.85
MonnamFunction · 0.85
rnlFunction · 0.85
set_malignFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected