fix #H7618 - gas cloud affects underwater monsters

Stinking cloud placed near water or poison gas breathed across it
would affect and potentially kill underwater monsters.  Most swimmers
are on the surface and should be affected, but eels and other fish
shouldn't be.

This also changes minliquid() to not treat flying and levitating as
ways to survive water when on the Plane of Water.

I think goodpos() needs to be taught about that Plane (where many ways
of existing at a water location don't apply).  This doesn't do that.
This commit is contained in:
PatR
2018-11-28 17:43:53 -08:00
parent 8d1aa429ca
commit 234bf7b1b6
3 changed files with 23 additions and 6 deletions

View File

@@ -225,6 +225,7 @@ scattering of objects might leave source location with wrong thing displayed
for configurations with 'long int' larger than 'int', lev_comp wrote some
garbage into the *.lev files, but nethack seemed unaffected by that
(at least on little-endian hardare) and loaded the levels successfully
stinking cloud placed near water could kill underwater creatures
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1543100460 2018/11/24 23:01:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.271 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1543455827 2018/11/29 01:43:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.272 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -483,13 +483,18 @@ register struct monst *mtmp;
/* [what about ceiling clingers?] */
inpool = (is_pool(mtmp->mx, mtmp->my)
&& !(is_flyer(mtmp->data) || is_floater(mtmp->data)));
&& (!(is_flyer(mtmp->data) || is_floater(mtmp->data))
/* there's no "above the surface" on the plane of water */
|| Is_waterlevel(&u.uz)));
inlava = (is_lava(mtmp->mx, mtmp->my)
&& !(is_flyer(mtmp->data) || is_floater(mtmp->data)));
infountain = IS_FOUNTAIN(levl[mtmp->mx][mtmp->my].typ);
/* Flying and levitation keeps our steed out of the liquid */
/* (but not water-walking or swimming) */
/* Flying and levitation keeps our steed out of the liquid
(but not water-walking or swimming; note: if hero is in a
water location on the Plane of Water, flight and levitating
are blocked so this (Flying || Levitation) test fails there
and steed will be subject to water effects, as intended) */
if (mtmp == u.usteed && (Flying || Levitation))
return 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 region.c $NHDT-Date: 1542765361 2018/11/21 01:56:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.42 $ */
/* NetHack 3.6 region.c $NHDT-Date: 1543455828 2018/11/29 01:43:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */
/* Copyright (c) 1996 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -947,10 +947,16 @@ genericptr_t p2;
struct monst *mtmp;
int dam;
/*
* Gas clouds can't be targetted at water locations, but they can
* start next to water and spread over it.
*/
reg = (NhRegion *) p1;
dam = reg->arg.a_int;
if (p2 == (genericptr_t) 0) { /* This means *YOU* Bozo! */
if (u.uinvulnerable || nonliving(youmonst.data) || Breathless)
if (u.uinvulnerable || nonliving(youmonst.data) || Breathless
|| Underwater)
return FALSE;
if (!Blind) {
Your("%s sting.", makeplural(body_part(EYE)));
@@ -973,6 +979,11 @@ genericptr_t p2;
adult green dragon is not affected by gas cloud, baby one is */
if (!(nonliving(mtmp->data) || is_vampshifter(mtmp))
&& !breathless(mtmp->data)
/* not is_swimmer(); assume that non-fish are swimming on
the surface and breathing the air above it periodically
unless located at water spot on plane of water */
&& !((mtmp->data->mlet == S_EEL || Is_waterlevel(&u.uz))
&& is_pool(mtmp->mx, mtmp->my))
/* exclude monsters with poison gas breath attack:
adult green dragon and Chromatic Dragon (and iron golem,
but nonliving() and breathless() tests also catch that) */