Use grounded macro

This commit is contained in:
Pasi Kallinen
2022-02-15 18:44:56 +02:00
parent b5a4f9ca65
commit e65c921ccb
6 changed files with 8 additions and 16 deletions

View File

@@ -695,8 +695,7 @@ digactualhole(int x, int y, struct monst *madeby, int ttyp)
impact_drop((struct obj *) 0, x, y, 0);
if (mtmp) {
/*[don't we need special sokoban handling here?]*/
if (is_flyer(mtmp->data) || is_floater(mtmp->data)
|| mtmp->data == &mons[PM_WUMPUS]
if (!grounded(mtmp->data)
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|| mtmp->data->msize >= MZ_HUGE)
return;

View File

@@ -2436,9 +2436,7 @@ pooleffects(boolean newspot) /* true if called by spoteffects */
/* check for entering water or lava */
if (!u.ustuck && !Levitation && !Flying && is_pool_or_lava(u.ux, u.uy)) {
if (u.usteed
&& (is_flyer(u.usteed->data) || is_floater(u.usteed->data)
|| is_clinger(u.usteed->data))) {
if (u.usteed && !grounded(u.usteed->data)) {
/* floating or clinging steed keeps hero safe (is_flyer() test
is redundant; it can't be true since Flying yielded false) */
return FALSE;

View File

@@ -1780,12 +1780,11 @@ mfndpos(
nodiag = NODIAG(mdat - mons);
wantpool = (mdat->mlet == S_EEL);
poolok = ((!Is_waterlevel(&u.uz) && !(nowtyp != WATER)
&& (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat)))
&& !grounded(mdat))
|| (is_swimmer(mdat) && !wantpool));
/* note: floating eye is the only is_floater() so this could be
simplified, but then adding another floater would be error prone */
lavaok = (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat)
|| likes_lava(mdat));
lavaok = (!grounded(mdat) || likes_lava(mdat));
if (mdat == &mons[PM_FLOATING_EYE]) /* prefers to avoid heat */
lavaok = FALSE;
thrudoor = ((flag & (ALLOW_WALL | BUSTDOOR)) != 0L);

View File

@@ -613,7 +613,7 @@ dismount_steed(
struct permonst *mdat = mtmp->data;
/* The steed may drop into water/lava */
if (!is_flyer(mdat) && !is_floater(mdat) && !is_clinger(mdat)) {
if (grounded(mdat)) {
if (is_pool(u.ux, u.uy)) {
if (!Underwater)
pline("%s falls into the %s!", Monnam(mtmp),

View File

@@ -91,8 +91,7 @@ goodpos(int x, int y, struct monst* mtmp, long gpflags)
return (is_swimmer(mdat)
|| (!Is_waterlevel(&u.uz)
&& !(levl[x][y].typ == WATER)
&& (is_floater(mdat) || is_flyer(mdat)
|| is_clinger(mdat))));
&& !grounded(mdat)));
} else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) {
return FALSE;
} else if (is_lava(x, y)) {

View File

@@ -1641,9 +1641,7 @@ trapeffect_pit(
const char *fallverb;
fallverb = "falls";
if (is_flyer(mptr) || is_floater(mptr)
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|| is_clinger(mptr)) {
if (!grounded(mptr) || (mtmp->wormno && count_wsegs(mtmp) > 5)) {
if (g.force_mintrap && !Sokoban) {
/* openfallingtrap; not inescapable here */
if (in_sight) {
@@ -1703,8 +1701,7 @@ trapeffect_hole(
trapname(tt, TRUE));
return Trap_Effect_Finished; /* don't activate it after all */
}
if (is_flyer(mptr) || is_floater(mptr) || mptr == &mons[PM_WUMPUS]
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
if (!grounded(mptr) || (mtmp->wormno && count_wsegs(mtmp) > 5)
|| mptr->msize >= MZ_HUGE) {
if (g.force_mintrap && !Sokoban) {
/* openfallingtrap; not inescapable here */