diff --git a/doc/fixes36.1 b/doc/fixes36.1 index a58c4c95e..936bce369 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -99,6 +99,7 @@ fix weight of containers in special levels make the raven medusa level shortsighted fix possible segfault in lev_comp when map was too tall fix "the ice is bridged with ice" when freezing castle's moat or Medusa's sea +make monsters and pets avoid poison gas clouds if it would damage them Platform- and/or Interface-Specific Fixes diff --git a/src/mon.c b/src/mon.c index 08333c250..5978f1c20 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1172,6 +1172,9 @@ long flag; boolean wantpool, poolok, lavaok, nodiag; boolean rockok = FALSE, treeok = FALSE, thrudoor; int maxx, maxy; + boolean poisongas_ok, in_poisongas; + NhRegion *gas_reg; + int gas_glyph = cmap_to_glyph(S_poisoncloud); x = mon->mx; y = mon->my; @@ -1183,6 +1186,11 @@ long flag; || (is_swimmer(mdat) && !wantpool)); lavaok = (is_flyer(mdat) || is_clinger(mdat) || likes_lava(mdat)); thrudoor = ((flag & (ALLOW_WALL | BUSTDOOR)) != 0L); + poisongas_ok = ((nonliving(mdat) || is_vampshifter(mon) + || breathless(mdat)) || resists_poison(mon)); + in_poisongas = ((gas_reg = visible_region_at(x,y)) != 0 + && gas_reg->glyph == gas_glyph); + if (flag & ALLOW_DIG) { struct obj *mw_tmp; @@ -1231,6 +1239,11 @@ nexttry: /* eels prefer the water, but if there is no water nearby, || ((levl[nx][ny].doormask & D_LOCKED) && !(flag & UNLOCKDOOR))) && !thrudoor) continue; + /* avoid poison gas? */ + if (!poisongas_ok && !in_poisongas + && (gas_reg = visible_region_at(nx,ny)) != 0 + && gas_reg->glyph == gas_glyph) + continue; /* first diagonal checks (tight squeezes handled below) */ if (nx != x && ny != y && (nodiag