fix #K2393 - brass lantern hit by water
Don't extinguish a brass lantern when hit by water unless it is being submerged.
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.323 $ $NHDT-Date: 1602022805 2020/10/06 22:20:05 $
|
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.325 $ $NHDT-Date: 1602270140 2020/10/09 19:02:20 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -271,6 +271,7 @@ fire sources can ignite candles, lamps, and potions of oil
|
|||||||
for multiple drop ('D') with menustyle traditional or combination, if the only
|
for multiple drop ('D') with menustyle traditional or combination, if the only
|
||||||
object class player picked was '$' then it operated on all classes
|
object class player picked was '$' then it operated on all classes
|
||||||
small monsters could seep through their shirt
|
small monsters could seep through their shirt
|
||||||
|
don't snuff brass lantern when it's hit by water unless it is submerged
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 extern.h $NHDT-Date: 1600933440 2020/09/24 07:44:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.859 $ */
|
/* NetHack 3.7 extern.h $NHDT-Date: 1602270114 2020/10/09 19:01:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.867 $ */
|
||||||
/* Copyright (c) Steve Creps, 1988. */
|
/* Copyright (c) Steve Creps, 1988. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ E void FDECL(check_leash, (XCHAR_P, XCHAR_P));
|
|||||||
E boolean FDECL(um_dist, (XCHAR_P, XCHAR_P, XCHAR_P));
|
E boolean FDECL(um_dist, (XCHAR_P, XCHAR_P, XCHAR_P));
|
||||||
E boolean FDECL(snuff_candle, (struct obj *));
|
E boolean FDECL(snuff_candle, (struct obj *));
|
||||||
E boolean FDECL(snuff_lit, (struct obj *));
|
E boolean FDECL(snuff_lit, (struct obj *));
|
||||||
|
E boolean FDECL(splash_lit, (struct obj *));
|
||||||
E boolean FDECL(catch_lit, (struct obj *));
|
E boolean FDECL(catch_lit, (struct obj *));
|
||||||
E void FDECL(use_unicorn_horn, (struct obj **));
|
E void FDECL(use_unicorn_horn, (struct obj **));
|
||||||
E boolean FDECL(tinnable, (struct obj *));
|
E boolean FDECL(tinnable, (struct obj *));
|
||||||
|
|||||||
+58
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 apply.c $NHDT-Date: 1597090815 2020/08/10 20:20:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.327 $ */
|
/* NetHack 3.7 apply.c $NHDT-Date: 1602270122 2020/10/09 19:02:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.328 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1346,6 +1346,63 @@ struct obj *obj;
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called when lit object is hit by water */
|
||||||
|
boolean
|
||||||
|
splash_lit(obj)
|
||||||
|
struct obj *obj;
|
||||||
|
{
|
||||||
|
boolean result, dunk = FALSE;
|
||||||
|
|
||||||
|
/* lantern won't be extinguished by a rust trap or rust monster attack
|
||||||
|
but will be if submerged or placed into a container or swallowed by
|
||||||
|
a monster (for mobile light source handling, not because it ought
|
||||||
|
to stop being lit in all those situations...) */
|
||||||
|
if (obj->lamplit && obj->otyp == BRASS_LANTERN) {
|
||||||
|
struct monst *mtmp;
|
||||||
|
boolean useeit = FALSE, uhearit = FALSE, snuff = TRUE;
|
||||||
|
|
||||||
|
if (obj->where == OBJ_INVENT) {
|
||||||
|
useeit = !Blind;
|
||||||
|
uhearit = !Deaf;
|
||||||
|
/* underwater light sources aren't allowed but if hero
|
||||||
|
is just entering water, Underwater won't be set yet */
|
||||||
|
dunk = (is_pool(u.ux, u.uy)
|
||||||
|
&& ((!Levitation && !Flying && !Wwalking)
|
||||||
|
|| Is_waterlevel(&u.uz)));
|
||||||
|
snuff = FALSE;
|
||||||
|
} else if (obj->where == OBJ_MINVENT
|
||||||
|
/* don't assume that lit lantern has been swallowed;
|
||||||
|
a nymph might have stolen it or picked it up */
|
||||||
|
&& ((mtmp = obj->ocarry), humanoid(mtmp->data))) {
|
||||||
|
xchar x, y;
|
||||||
|
|
||||||
|
useeit = get_obj_location(obj, &x, &y, 0) && cansee(x, y);
|
||||||
|
uhearit = couldsee(x, y) && distu(x, y) < 5 * 5;
|
||||||
|
dunk = (is_pool(mtmp->mx, mtmp->my)
|
||||||
|
&& ((!is_flyer(mtmp->data) && !is_floater(mtmp->data))
|
||||||
|
|| Is_waterlevel(&u.uz)));
|
||||||
|
snuff = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useeit || uhearit)
|
||||||
|
pline("%s %s%s%s.", Yname2(obj),
|
||||||
|
uhearit ? "crackles" : "",
|
||||||
|
(uhearit && useeit) ? " and " : "",
|
||||||
|
useeit ? "flickers" : "");
|
||||||
|
if (!dunk && !snuff)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = snuff_lit(obj);
|
||||||
|
|
||||||
|
/* this is simpler when we wait until after lantern has been snuffed */
|
||||||
|
if (dunk) {
|
||||||
|
/* drain some of the battery but don't short it out entirely */
|
||||||
|
obj->age -= (obj->age > 200L) ? 100L : (obj->age / 2L);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* Called when potentially lightable object is affected by fire_damage().
|
/* Called when potentially lightable object is affected by fire_damage().
|
||||||
Return TRUE if object was lit and FALSE otherwise --ALI */
|
Return TRUE if object was lit and FALSE otherwise --ALI */
|
||||||
boolean
|
boolean
|
||||||
|
|||||||
+9
-9
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 trap.c $NHDT-Date: 1596498220 2020/08/03 23:43:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.362 $ */
|
/* NetHack 3.7 trap.c $NHDT-Date: 1602270123 2020/10/09 19:02:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.364 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1149,10 +1149,7 @@ unsigned trflags;
|
|||||||
if (u.twoweap || (uwep && bimanual(uwep)))
|
if (u.twoweap || (uwep && bimanual(uwep)))
|
||||||
(void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE);
|
(void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE);
|
||||||
glovecheck:
|
glovecheck:
|
||||||
(void) water_damage(uarmg, "gauntlets", TRUE);
|
(void) water_damage(uarmg, gloves_simple_name(uarmg), TRUE);
|
||||||
/* Not "metal gauntlets" since it gets called
|
|
||||||
* even if it's leather for the message
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pline("%s your right %s!", A_gush_of_water_hits, body_part(ARM));
|
pline("%s your right %s!", A_gush_of_water_hits, body_part(ARM));
|
||||||
@@ -1160,10 +1157,12 @@ unsigned trflags;
|
|||||||
goto glovecheck;
|
goto glovecheck;
|
||||||
default:
|
default:
|
||||||
pline("%s you!", A_gush_of_water_hits);
|
pline("%s you!", A_gush_of_water_hits);
|
||||||
|
/* note: exclude primary and seconary weapons from splashing
|
||||||
|
because cases 1 and 2 target them [via water_damage()] */
|
||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
||||||
if (otmp->lamplit && otmp != uwep
|
if (otmp->lamplit && otmp != uwep
|
||||||
&& (otmp != uswapwep || !u.twoweap))
|
&& (otmp != uswapwep || !u.twoweap))
|
||||||
(void) snuff_lit(otmp);
|
(void) splash_lit(otmp);
|
||||||
if (uarmc)
|
if (uarmc)
|
||||||
(void) water_damage(uarmc, cloak_simple_name(uarmc), TRUE);
|
(void) water_damage(uarmc, cloak_simple_name(uarmc), TRUE);
|
||||||
else if (uarm)
|
else if (uarm)
|
||||||
@@ -2344,7 +2343,7 @@ register struct monst *mtmp;
|
|||||||
(void) water_damage(target, 0, TRUE);
|
(void) water_damage(target, 0, TRUE);
|
||||||
glovecheck:
|
glovecheck:
|
||||||
target = which_armor(mtmp, W_ARMG);
|
target = which_armor(mtmp, W_ARMG);
|
||||||
(void) water_damage(target, "gauntlets", TRUE);
|
(void) water_damage(target, gloves_simple_name(target), TRUE);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (in_sight)
|
if (in_sight)
|
||||||
@@ -2357,8 +2356,9 @@ register struct monst *mtmp;
|
|||||||
pline("%s %s!", A_gush_of_water_hits, mon_nam(mtmp));
|
pline("%s %s!", A_gush_of_water_hits, mon_nam(mtmp));
|
||||||
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
|
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
|
||||||
if (otmp->lamplit
|
if (otmp->lamplit
|
||||||
|
/* exclude weapon(s) because cases 1 and 2 do them */
|
||||||
&& (otmp->owornmask & (W_WEP | W_SWAPWEP)) == 0)
|
&& (otmp->owornmask & (W_WEP | W_SWAPWEP)) == 0)
|
||||||
(void) snuff_lit(otmp);
|
(void) splash_lit(otmp);
|
||||||
if ((target = which_armor(mtmp, W_ARMC)) != 0)
|
if ((target = which_armor(mtmp, W_ARMC)) != 0)
|
||||||
(void) water_damage(target, cloak_simple_name(target),
|
(void) water_damage(target, cloak_simple_name(target),
|
||||||
TRUE);
|
TRUE);
|
||||||
@@ -3538,7 +3538,7 @@ boolean force;
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
return ER_NOTHING;
|
return ER_NOTHING;
|
||||||
|
|
||||||
if (snuff_lit(obj))
|
if (splash_lit(obj))
|
||||||
return ER_DAMAGED;
|
return ER_DAMAGED;
|
||||||
|
|
||||||
if (!ostr)
|
if (!ostr)
|
||||||
|
|||||||
Reference in New Issue
Block a user