rolling boulder trap's boulder can be generated in lava

> On 01/30/2012 08:20 PM, <Someone> wrote:
> The boulder from a rolling boulder trap can be generated on a
> lava pool. mkroll_launch() in trap.c, line 1584 checks only for pools
> of water.
This commit is contained in:
nethack.allison
2012-02-01 00:49:16 +00:00
parent 28aace3fd4
commit e701a68175
8 changed files with 23 additions and 13 deletions
+1
View File
@@ -223,6 +223,7 @@ E boolean FDECL(paranoid_query, (BOOLEAN_P,const char *));
E boolean FDECL(is_pool, (int,int)); E boolean FDECL(is_pool, (int,int));
E boolean FDECL(is_lava, (int,int)); E boolean FDECL(is_lava, (int,int));
E boolean FDECL(is_pool_or_lava, (int,int));
E boolean FDECL(is_ice, (int,int)); E boolean FDECL(is_ice, (int,int));
E int FDECL(is_drawbridge_wall, (int,int)); E int FDECL(is_drawbridge_wall, (int,int));
E boolean FDECL(is_db_wall, (int,int)); E boolean FDECL(is_db_wall, (int,int));
+10
View File
@@ -64,6 +64,16 @@ int x,y;
return FALSE; return FALSE;
} }
boolean
is_pool_or_lava(x,y)
int x,y;
{
if (is_pool(x,y) || is_lava(x,y))
return TRUE;
else
return FALSE;
}
boolean boolean
is_ice(x,y) is_ice(x,y)
int x,y; int x,y;
+3 -3
View File
@@ -202,7 +202,7 @@ dig_check(madeby, verbose, x, y)
} else if (madeby == BY_OBJECT && } else if (madeby == BY_OBJECT &&
/* the block against existing traps is mainly to /* the block against existing traps is mainly to
prevent broken wands from turning holes into pits */ prevent broken wands from turning holes into pits */
(ttmp || is_pool(x,y) || is_lava(x,y))) { (ttmp || is_pool_or_lava(x,y))) {
/* digging by player handles pools separately */ /* digging by player handles pools separately */
return FALSE; return FALSE;
} }
@@ -747,7 +747,7 @@ coord *cc;
surface(dig_x,dig_y), surface(dig_x,dig_y),
(dig_x != u.ux || dig_y != u.uy) ? "t" : ""); (dig_x != u.ux || dig_y != u.uy) ? "t" : "");
} else if (is_pool(dig_x, dig_y) || is_lava(dig_x, dig_y)) { } else if (is_pool_or_lava(dig_x, dig_y)) {
pline_The("%s sloshes furiously for a moment, then subsides.", pline_The("%s sloshes furiously for a moment, then subsides.",
is_lava(dig_x, dig_y) ? "lava" : "water"); is_lava(dig_x, dig_y) ? "lava" : "water");
wake_nearby(); /* splashing */ wake_nearby(); /* splashing */
@@ -1117,7 +1117,7 @@ struct obj *obj;
You("swing %s through thin air.", yobjnam(obj, (char *)0)); You("swing %s through thin air.", yobjnam(obj, (char *)0));
} else if (!can_reach_floor(FALSE)) { } else if (!can_reach_floor(FALSE)) {
cant_reach_floor(u.ux, u.uy, FALSE, FALSE); cant_reach_floor(u.ux, u.uy, FALSE, FALSE);
} else if (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) { } else if (is_pool_or_lava(u.ux, u.uy)) {
/* Monsters which swim also happen not to be able to dig */ /* Monsters which swim also happen not to be able to dig */
You("cannot stay under%s long enough.", You("cannot stay under%s long enough.",
is_pool(u.ux, u.uy) ? "water" : " the lava"); is_pool(u.ux, u.uy) ? "water" : " the lava");
+1 -1
View File
@@ -53,7 +53,7 @@ boolean pushing;
{ {
if (!otmp || otmp->otyp != BOULDER) if (!otmp || otmp->otyp != BOULDER)
impossible("Not a boulder?"); impossible("Not a boulder?");
else if (!Is_waterlevel(&u.uz) && (is_pool(rx,ry) || is_lava(rx,ry))) { else if (!Is_waterlevel(&u.uz) && is_pool_or_lava(rx,ry)) {
boolean lava = is_lava(rx,ry), fills_up; boolean lava = is_lava(rx,ry), fills_up;
const char *what = waterbody_name(rx,ry); const char *what = waterbody_name(rx,ry);
schar ltyp = levl[rx][ry].typ; schar ltyp = levl[rx][ry].typ;
+1 -1
View File
@@ -2846,7 +2846,7 @@ floorfood(verb,corpsecheck) /* get food from floor or pack */
#ifdef STEED #ifdef STEED
(feeding && u.usteed) || /* can't eat off floor while riding */ (feeding && u.usteed) || /* can't eat off floor while riding */
#endif #endif
((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) && (is_pool_or_lava(u.ux, u.uy) &&
(Wwalking || is_clinger(youmonst.data) || (Wwalking || is_clinger(youmonst.data) ||
(Flying && !Breathless)))) (Flying && !Breathless))))
goto skipfloor; goto skipfloor;
+4 -4
View File
@@ -725,7 +725,7 @@ int mode;
if ((t && t->tseen) || if ((t && t->tseen) ||
(!Levitation && !Flying && (!Levitation && !Flying &&
!is_clinger(youmonst.data) && !is_clinger(youmonst.data) &&
(is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv)) is_pool_or_lava(x, y) && levl[x][y].seenv))
return FALSE; return FALSE;
} }
@@ -1222,7 +1222,7 @@ domove()
if (((trap = t_at(x, y)) && trap->tseen) || if (((trap = t_at(x, y)) && trap->tseen) ||
(Blind && !Levitation && !Flying && (Blind && !Levitation && !Flying &&
!is_clinger(youmonst.data) && !is_clinger(youmonst.data) &&
(is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv)) { is_pool_or_lava(x, y) && levl[x][y].seenv)) {
if(context.run >= 2) { if(context.run >= 2) {
nomul(0); nomul(0);
context.move = 0; context.move = 0;
@@ -1718,7 +1718,7 @@ boolean newspot; /* true if called by spoteffects */
/* check for entering water or lava */ /* check for entering water or lava */
if (!u.ustuck && !Levitation && !Flying && if (!u.ustuck && !Levitation && !Flying &&
(is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))) { is_pool_or_lava(u.ux, u.uy)) {
#ifdef STEED #ifdef STEED
if (u.usteed && (is_flyer(u.usteed->data) || if (u.usteed && (is_flyer(u.usteed->data) ||
is_floater(u.usteed->data) || is_clinger(u.usteed->data))) { is_floater(u.usteed->data) || is_clinger(u.usteed->data))) {
@@ -2309,7 +2309,7 @@ bcorr:
if(context.run == 1) goto bcorr; /* if you must */ if(context.run == 1) goto bcorr; /* if you must */
if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop; if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop;
continue; continue;
} else if (is_pool(x,y) || is_lava(x,y)) { } else if (is_pool_or_lava(x,y)) {
/* water and lava only stop you if directly in front, and stop /* water and lava only stop you if directly in front, and stop
* you even if you are running * you even if you are running
*/ */
+2 -3
View File
@@ -199,8 +199,7 @@ const char *fmt, *arg;
} }
check_strangling(TRUE); check_strangling(TRUE);
if(!Levitation && !u.ustuck && if(!Levitation && !u.ustuck && is_pool_or_lava(u.ux,u.uy))
(is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy)))
spoteffects(TRUE); spoteffects(TRUE);
see_monsters(); see_monsters();
@@ -746,7 +745,7 @@ int mntmp;
} }
find_ac(); find_ac();
if((!Levitation && !u.ustuck && !Flying && if((!Levitation && !u.ustuck && !Flying &&
(is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy))) || is_pool_or_lava(u.ux,u.uy)) ||
(Underwater && !Swimming)) (Underwater && !Swimming))
spoteffects(TRUE); spoteffects(TRUE);
if (Passes_walls && u.utrap && if (Passes_walls && u.utrap &&
+1 -1
View File
@@ -1843,7 +1843,7 @@ long ocount;
cc.x = x; cc.y = y; cc.x = x; cc.y = y;
/* Prevent boulder from being placed on water */ /* Prevent boulder from being placed on water */
if (ttmp->ttyp == ROLLING_BOULDER_TRAP if (ttmp->ttyp == ROLLING_BOULDER_TRAP
&& is_pool(x+distance*dx,y+distance*dy)) && is_pool_or_lava(x+distance*dx,y+distance*dy))
success = FALSE; success = FALSE;
else success = isclearpath(&cc, distance, dx, dy); else success = isclearpath(&cc, distance, dx, dy);
if (ttmp->ttyp == ROLLING_BOULDER_TRAP) { if (ttmp->ttyp == ROLLING_BOULDER_TRAP) {