locking/unlocking vs traps (trunk only)

About six weeks back, <email deleted> suggested that
bear traps should deal out damage and be escapable via opening magic.
This doesn't do anything about the first part, but it does allow opening
magic (wand of opening, spell of knock, blessed Bell of Opening) to get
the hero out of bear traps and webs if zapped either at self or downwards.
Zaps across the floor which hit monsters will free them from such traps,
with a chance that releasing a hostile monster will pacify it (using
existing #untrap code).  Conversely, if you are at a web or bear trap
location but not currently trapped, closing magic (wand of locking, spell
of wizard lock) will cause the trap to activate; you may or may not become
trapped.  Likewise for zaps at monsters who are at such locations, which
is treated as an attack.

     Opening magic which hits the hero or a monster located at a trap door
or falling rock trap spot will cause the trap to activate; as above, it's
an attack for the monster case.  At the moment, zapping opening magic
downwards at the hero's location (but not zapping at self or at monsters)
will also cause holes, pits, and spiked pits to activate.  (Zapping down
triggers falling rock traps and zapping up doesn't; that'll need to be
changed.)  Zapping opening down while mounted will untrap, if stuck in a
web or bear trap, and will trap, for the falling cases, in precedence over
releasing the saddle and forcibly dismounting.  The latter still occurs
when there is no applicable trap present though.

     Zapping locking magic downwards at a hole location will convert the
hole into a trap door.  Zapping breaking magic (wand of striking, spell of
force bolt) down at a trap door location will convert the trap door into a
hole.  (Neither conversion currently alters the made-by-you flag for the
trap.  However, the rationalization that distinctive style is what makes
made-by-you recognizable suggests that conversion should clear the flag.)
Lastly, the old behavior (which pre-dated bare holes) of destroying trap
doors when zapping down at them with locking magic has been removed--it
didn't seem to fit very well with the new cases.  I'm starting to have
second thoughts about that but am going to commit this before discovery of
some more niggling details drags it out for another six weeks.
This commit is contained in:
nethack.rankin
2006-10-01 05:24:28 +00:00
parent d526b4f32f
commit fb8261769a
5 changed files with 276 additions and 35 deletions

View File

@@ -270,10 +270,9 @@ struct obj *otmp;
}
break;
}
case WAN_NOTHING:
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
wake = FALSE;
wake = closeholdingtrap(mtmp, &learn_it);
break;
case WAN_PROBING:
wake = FALSE;
@@ -290,8 +289,16 @@ struct obj *otmp;
else pline("%s opens its mouth!", Monnam(mtmp));
}
expels(mtmp, mtmp->data, TRUE);
/* zap which hits steed will only release saddle if it
doesn't hit a holding or falling trap; playability
here overrides the more logical target ordering */
} else if (openholdingtrap(mtmp, &learn_it)) {
break;
} else if (openfallingtrap(mtmp, TRUE, &learn_it)) {
/* mtmp might now be on the migrating monsters list */
break;
#ifdef STEED
} else if (!!(obj = which_armor(mtmp, W_SADDLE))) {
} else if ((obj = which_armor(mtmp, W_SADDLE)) != 0) {
mtmp->misc_worn_check &= ~obj->owornmask;
update_mon_intrinsics(mtmp, obj, FALSE, FALSE);
obj->owornmask = 0L;
@@ -384,6 +391,9 @@ struct obj *otmp;
}
}
break;
case WAN_NOTHING:
wake = FALSE;
break;
default:
impossible("What an interesting effect (%d)", otyp);
break;
@@ -2198,13 +2208,22 @@ boolean ordinary;
learn_it = TRUE;
unpunish();
}
if (u.utrap) { /* escape web or bear trap */
(void) openholdingtrap(&youmonst, &learn_it);
} else { /* trigger previously escaped trapdoor */
(void) openfallingtrap(&youmonst, TRUE, &learn_it);
}
break;
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
if (!u.utrap) {
(void) closeholdingtrap(&youmonst, &learn_it);
}
break;
case WAN_DIGGING:
case SPE_DIG:
case SPE_DETECT_UNSEEN:
case WAN_NOTHING:
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
break;
case WAN_PROBING:
{
@@ -2445,6 +2464,13 @@ struct obj *obj; /* wand or spell */
pline_The("stairs seem to ripple momentarily.");
disclose = TRUE;
}
/* down will release you from bear trap or web */
if (u.dz > 0 && u.utrap) {
(void) openholdingtrap(&youmonst, &disclose);
/* down will trigger trapdoor, hole, or [spiked-] pit */
} else if (u.dz > 0 && !u.utrap) {
(void) openfallingtrap(&youmonst, FALSE, &disclose);
}
break;
case WAN_STRIKING:
case SPE_FORCE_BOLT:
@@ -2453,8 +2479,8 @@ struct obj *obj; /* wand or spell */
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
/* down at open bridge or up or down at open portcullis */
if ((levl[x][y].typ == DRAWBRIDGE_DOWN) ? (u.dz > 0) :
(is_drawbridge_wall(x,y) && !is_db_wall(x,y)) &&
if (((levl[x][y].typ == DRAWBRIDGE_DOWN) ? (u.dz > 0) :
(is_drawbridge_wall(x,y) && !is_db_wall(x,y))) &&
find_drawbridge(&xx, &yy)) {
if (!striking)
close_drawbridge(xx, yy);
@@ -2476,21 +2502,38 @@ struct obj *obj; /* wand or spell */
stackobj(otmp);
}
newsym(x, y);
} else if (!striking && ttmp && ttmp->ttyp == TRAPDOOR && u.dz > 0) {
if (!Blind) {
if (ttmp->tseen) {
pline("A trap door beneath you closes up then vanishes.");
disclose = TRUE;
} else {
You_see("a swirl of %s beneath you.",
is_ice(x,y) ? "frost" : "dust");
}
} else {
You_hear("a twang followed by a thud.");
} else if (u.dz > 0 && ttmp) {
if (!striking && closeholdingtrap(&youmonst, &disclose)) {
; /* now stuck in web or bear trap */
} else if (striking && ttmp->ttyp == TRAPDOOR) {
/* striking transforms trapdoor into hole */
if (Blind && !ttmp->tseen) {
pline("%s beneath you shatters.", Something);
} else if (!ttmp->tseen) { /* => !Blind */
pline("There's a trapdoor beneath you; it shatters.");
} else {
pline("The trapdoor beneath you shatters.");
disclose = TRUE;
}
ttmp->ttyp = HOLE;
ttmp->tseen = 1;
newsym(x, y);
/* might fall down hole */
dotrap(ttmp, 0);
} else if (!striking && ttmp->ttyp == HOLE) {
/* locking transforms hole into trapdoor */
ttmp->ttyp = TRAPDOOR;
if (Blind || !ttmp->tseen) {
pline("Some %s swirls beneath you.",
is_ice(x,y) ? "frost" : "dust");
} else {
ttmp->tseen = 1;
newsym(x, y);
pline("A trapdoor appears beneath you.");
disclose = TRUE;
}
/* hadn't fallen down hole; won't fall now */
}
deltrap(ttmp);
ttmp = (struct trap *)0;
newsym(x, y);
}
break;
case SPE_STONE_TO_FLESH: