polymorphing into a flyer while in a pit
<Someone> reported that if you polymorph into a flying monster while in a pit, you must take u.utrap turns to first climb out before you can fly. Of course, once you're out, you can swoop down into the pit to pick things up w/o delay. Rather that have you automatically fly out (e.g. like quaffing a potion of levitation), I thought it was better to take a turn to fly out, so that's what I've implemented. The code to deal with exiting a pit is moved to a new climb_pit function and the "up" command now lets you climb from a pit too (something I've found non-intuitive in the past). Finally, I noticed that non-moving monsters could still go up/down even though they couldn't move around. Added non-moving checks in doup/dodown.
This commit is contained in:
46
src/trap.c
46
src/trap.c
@@ -2503,6 +2503,52 @@ long hmask, emask; /* might cancel timeout */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* shared code for climbing out of a pit */
|
||||
void
|
||||
climb_pit()
|
||||
{
|
||||
if (!u.utrap || u.utraptype != TT_PIT) return;
|
||||
|
||||
if (Passes_walls) {
|
||||
/* marked as trapped so they can pick things up */
|
||||
You("ascend from the pit.");
|
||||
u.utrap = 0;
|
||||
fill_pit(u.ux, u.uy);
|
||||
vision_full_recalc = 1; /* vision limits change */
|
||||
} else if (!rn2(2) && sobj_at(BOULDER, u.ux, u.uy)) {
|
||||
Your("%s gets stuck in a crevice.", body_part(LEG));
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
You("free your %s.", body_part(LEG));
|
||||
} else if (Flying && !In_sokoban(&u.uz)) {
|
||||
/* eg fell in pit, poly'd to a flying monster */
|
||||
You("fly from the pit.");
|
||||
u.utrap = 0;
|
||||
fill_pit(u.ux, u.uy);
|
||||
vision_full_recalc = 1; /* vision limits change */
|
||||
} else if (!(--u.utrap)) {
|
||||
You("%s to the edge of the pit.",
|
||||
(In_sokoban(&u.uz) && Levitation) ?
|
||||
"struggle against the air currents and float" :
|
||||
#ifdef STEED
|
||||
u.usteed ? "ride" :
|
||||
#endif
|
||||
"crawl");
|
||||
fill_pit(u.ux, u.uy);
|
||||
vision_full_recalc = 1; /* vision limits change */
|
||||
} else if (flags.verbose) {
|
||||
#ifdef STEED
|
||||
if (u.usteed)
|
||||
Norep("%s is still in a pit.",
|
||||
upstart(y_monnam(u.usteed)));
|
||||
else
|
||||
#endif
|
||||
Norep( (Hallucination && !rn2(5)) ?
|
||||
"You've fallen, and you can't get up." :
|
||||
"You are still in a pit." );
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
dofiretrap(box)
|
||||
struct obj *box; /* null for floor trap */
|
||||
|
||||
Reference in New Issue
Block a user