diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/include/extern.h nethack-beartrap/include/extern.h --- nethack-3.4.3/include/extern.h 2003-12-08 10:39:13.000000000 +1100 +++ nethack-beartrap/include/extern.h 2006-09-29 10:16:24.000000000 +1000 @@ -2021,6 +2021,7 @@ E boolean NDECL(drown); E void FDECL(drain_en, (int)); E int NDECL(dountrap); E int FDECL(untrap, (BOOLEAN_P)); +E void FDECL(reward_untrap, (struct trap *, struct monst *)); E boolean FDECL(chest_trap, (struct obj *,int,BOOLEAN_P)); E void FDECL(deltrap, (struct trap *)); E boolean FDECL(delfloortrap, (struct trap *)); diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/src/trap.c nethack-beartrap/src/trap.c --- nethack-3.4.3/src/trap.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-beartrap/src/trap.c 2006-09-29 10:16:00.000000000 +1000 @@ -13,7 +13,6 @@ STATIC_DCL int FDECL(untrap_prob, (struc STATIC_DCL void FDECL(cnv_trap_obj, (int, int, struct trap *)); STATIC_DCL void FDECL(move_into_trap, (struct trap *)); STATIC_DCL int FDECL(try_disarm, (struct trap *,BOOLEAN_P)); -STATIC_DCL void FDECL(reward_untrap, (struct trap *, struct monst *)); STATIC_DCL int FDECL(disarm_holdingtrap, (struct trap *)); STATIC_DCL int FDECL(disarm_landmine, (struct trap *)); STATIC_DCL int FDECL(disarm_squeaky_board, (struct trap *)); @@ -771,10 +770,15 @@ unsigned trflags; } else #endif { - pline("%s bear trap closes on your %s!", - A_Your[trap->madeby_u], body_part(FOOT)); + /* MRKR: beartraps wound your legs */ + /* from a suggestion by Sammiel in RGRN */ + register long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE; + const char *sidestr = (side == RIGHT_SIDE) ? "right" : "left"; + pline("%s bear trap closes on your %s %s!", + A_Your[trap->madeby_u], sidestr, body_part(FOOT)); if(u.umonnum == PM_OWLBEAR || u.umonnum == PM_BUGBEAR) You("howl in anger!"); + set_wounded_legs(side, rnd(60-ACURR(A_DEX))); } exercise(A_DEX, FALSE); break; @@ -3157,7 +3161,7 @@ boolean force_failure; return 2; } -STATIC_OVL void +void reward_untrap(ttmp, mtmp) struct trap *ttmp; struct monst *mtmp; @@ -3169,8 +3173,10 @@ struct monst *mtmp; mtmp->data->mlet != S_HUMAN) { mtmp->mpeaceful = 1; set_malign(mtmp); /* reset alignment */ + if (canseemon(mtmp)) { pline("%s is grateful.", Monnam(mtmp)); } + } /* Helping someone out of a trap is a nice thing to do, * A lawful may be rewarded, but not too often. */ if (!rn2(3) && !rnl(8) && u.ualign.type == A_LAWFUL) { diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/src/zap.c nethack-beartrap/src/zap.c --- nethack-3.4.3/src/zap.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-beartrap/src/zap.c 2006-09-29 10:56:57.000000000 +1000 @@ -235,6 +235,8 @@ struct obj *otmp; break; case WAN_OPENING: case SPE_KNOCK: + { + struct trap *trap; wake = FALSE; /* don't want immediate counterattack */ if (u.uswallow && mtmp == u.ustuck) { if (is_animal(mtmp->data)) { @@ -242,6 +244,18 @@ struct obj *otmp; else pline("%s opens its mouth!", Monnam(mtmp)); } expels(mtmp, mtmp->data, TRUE); + } else if (mtmp->mtrapped && + (trap = t_at(mtmp->mx, mtmp->my)) != 0 && + trap->ttyp == BEAR_TRAP) { + + mtmp->mtrapped = 0; + if (canseemon(mtmp)) { + pline("%s beartrap opens releasing %s.", + (trap->madeby_u ? "Your" : "The"), + mon_nam(mtmp)); + } + reward_untrap(trap, mtmp); + #ifdef STEED } else if (!!(obj = which_armor(mtmp, W_SADDLE))) { mtmp->misc_worn_check &= ~obj->owornmask; @@ -253,6 +267,7 @@ struct obj *otmp; newsym(mtmp->mx, mtmp->my); #endif } + } break; case SPE_HEALING: case SPE_EXTRA_HEALING: @@ -2098,9 +2113,14 @@ boolean ordinary; damage = 0; /* reset */ break; case WAN_OPENING: - if (Punished) makeknown(WAN_OPENING); + if (Punished || u.utraptype == TT_BEARTRAP) + makeknown(WAN_OPENING); case SPE_KNOCK: if (Punished) Your("chain quivers for a moment."); + if (u.utraptype == TT_BEARTRAP) { + pline_The("bear trap opens."); + u.utrap = 0; + } break; case WAN_DIGGING: case SPE_DIG: @@ -2323,6 +2343,9 @@ struct obj *obj; /* wand or spell */ on_level(&u.uz, &qstart_level) && !ok_to_quest()) { pline_The("stairs seem to ripple momentarily."); disclose = TRUE; + } else if (u.utraptype == TT_BEARTRAP) { + pline_The("bear trap opens."); + u.utrap = 0; } break; case WAN_STRIKING: