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
|
make the raven medusa level shortsighted
|
||||||
fix possible segfault in lev_comp when map was too tall
|
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
|
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
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
@@ -1172,6 +1172,9 @@ long flag;
|
|||||||
boolean wantpool, poolok, lavaok, nodiag;
|
boolean wantpool, poolok, lavaok, nodiag;
|
||||||
boolean rockok = FALSE, treeok = FALSE, thrudoor;
|
boolean rockok = FALSE, treeok = FALSE, thrudoor;
|
||||||
int maxx, maxy;
|
int maxx, maxy;
|
||||||
|
boolean poisongas_ok, in_poisongas;
|
||||||
|
NhRegion *gas_reg;
|
||||||
|
int gas_glyph = cmap_to_glyph(S_poisoncloud);
|
||||||
|
|
||||||
x = mon->mx;
|
x = mon->mx;
|
||||||
y = mon->my;
|
y = mon->my;
|
||||||
@@ -1183,6 +1186,11 @@ long flag;
|
|||||||
|| (is_swimmer(mdat) && !wantpool));
|
|| (is_swimmer(mdat) && !wantpool));
|
||||||
lavaok = (is_flyer(mdat) || is_clinger(mdat) || likes_lava(mdat));
|
lavaok = (is_flyer(mdat) || is_clinger(mdat) || likes_lava(mdat));
|
||||||
thrudoor = ((flag & (ALLOW_WALL | BUSTDOOR)) != 0L);
|
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) {
|
if (flag & ALLOW_DIG) {
|
||||||
struct obj *mw_tmp;
|
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)
|
|| ((levl[nx][ny].doormask & D_LOCKED)
|
||||||
&& !(flag & UNLOCKDOOR))) && !thrudoor)
|
&& !(flag & UNLOCKDOOR))) && !thrudoor)
|
||||||
continue;
|
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) */
|
/* first diagonal checks (tight squeezes handled below) */
|
||||||
if (nx != x && ny != y
|
if (nx != x && ny != y
|
||||||
&& (nodiag
|
&& (nodiag
|
||||||
|
|||||||
Reference in New Issue
Block a user