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:
cohrs
2005-01-18 16:17:27 +00:00
parent c9b11cf989
commit c90746c670
5 changed files with 72 additions and 32 deletions

View File

@@ -741,6 +741,14 @@ dodown()
(u.ux == sstairs.sx && u.uy == sstairs.sy && !sstairs.up)),
ladder_down = (u.ux == xdnladder && u.uy == ydnladder);
if(!youmonst.data->mmove) {
You("are rooted %s.",
Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ?
"in place" : "to the ground");
nomul(0);
return 1;
}
#ifdef STEED
if (u.usteed && !u.usteed->mcanmove) {
pline("%s won't move!", Monnam(u.usteed));
@@ -839,6 +847,20 @@ dodown()
int
doup()
{
if(!youmonst.data->mmove) {
You("are rooted %s.",
Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) ?
"in place" : "to the ground");
nomul(0);
return 1;
}
/* "up" to get out of a pit... */
if (u.utrap && u.utraptype == TT_PIT) {
climb_pit();
return 1;
}
if( (u.ux != xupstair || u.uy != yupstair)
&& (!xupladder || u.ux != xupladder || u.uy != yupladder)
&& (!sstairs.sx || u.ux != sstairs.sx || u.uy != sstairs.sy