Fix bz62: Pets walk into poison clouds
Makes monsters who would be damaged by the poison cloud not walk into it
This commit is contained in:
@@ -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
|
||||
|
||||
13
src/mon.c
13
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
|
||||
|
||||
Reference in New Issue
Block a user