From d3682dd5ca549daf2971db6655d7cef9213417ac Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 21 Dec 2018 14:36:55 -0800 Subject: [PATCH 1/2] monsters on melting ice Reported seven years ago, when ice melts underneath a monster, it hovers there until its next move, then falls in and drowns. Dunk it immediately, and give hero credit/blame if it happens during the hero's turn (so presumably the melting was caused by the hero). Also, let monster with teleport capability who gets dunked teleport away from the water before getting wet, the way hero does. --- doc/fixes36.2 | 2 ++ src/mon.c | 36 +++++++++++++++++++++++++++++++----- src/zap.c | 15 +++++++++++++-- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index e9484a622..68894447e 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -297,6 +297,8 @@ for '/?' information lookup, "item named The Artifact" failed to find info about "Artifact" due to presence of "The" identifying or forgetting gem types now adjusts prices for gems already on shopping bill +when fire converts an ice location into a water location, dunk any monster on + that spot immediately instead of waiting until its next move Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/mon.c b/src/mon.c index 88aaf3dce..73df0bcd8 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mon.c $NHDT-Date: 1545259929 2018/12/19 22:52:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.275 $ */ +/* NetHack 3.6 mon.c $NHDT-Date: 1545430257 2018/12/21 22:10:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.276 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -541,6 +541,12 @@ register struct monst *mtmp; * themselves --ALI */ if (!is_clinger(mtmp->data) && !likes_lava(mtmp->data)) { + /* not fair...? hero doesn't automatically teleport away + from lava, just from water */ + if (can_teleport(mtmp->data) && !tele_restrict(mtmp)) { + if (rloc(mtmp, TRUE)) + return 0; + } if (!resists_fire(mtmp)) { if (cansee(mtmp->mx, mtmp->my)) { struct attack *dummy = &mtmp->data->mattk[0]; @@ -551,7 +557,14 @@ register struct monst *mtmp; : !strcmp(how, "melting") ? "melts away" : "burns to a crisp"); } - mondead(mtmp); + /* unlike fire -> melt ice -> pool, there's no way for the + hero to create lava beneath a monster, so the !mon_moving + case is not expected to happen (and we haven't made a + player-against-monster variation of the message above) */ + if (context.mon_moving) + mondead(mtmp); + else + xkilled(mtmp, XKILL_NOMSG); } else { mtmp->mhp -= 1; if (DEADMONSTER(mtmp)) { @@ -576,16 +589,29 @@ register struct monst *mtmp; */ if (!is_clinger(mtmp->data) && !is_swimmer(mtmp->data) && !amphibious(mtmp->data)) { + /* like hero with teleport intrinsic or spell, teleport away + if possible */ + if (can_teleport(mtmp->data) && !tele_restrict(mtmp)) { + if (rloc(mtmp, TRUE)) + return 0; + } if (cansee(mtmp->mx, mtmp->my)) { - pline("%s drowns.", Monnam(mtmp)); + if (context.mon_moving) + pline("%s drowns.", Monnam(mtmp)); + else + /* hero used fire to melt ice that monster was on */ + You("drown %s.", mon_nam(mtmp)); } if (u.ustuck && u.uswallow && u.ustuck == mtmp) { /* This can happen after a purple worm plucks you off a - flying steed while you are over water. */ + flying steed while you are over water. */ pline("%s sinks as %s rushes in and flushes you out.", Monnam(mtmp), hliquid("water")); } - mondead(mtmp); + if (context.mon_moving) + mondead(mtmp); + else + xkilled(mtmp, XKILL_NOMSG); if (!DEADMONSTER(mtmp)) { water_damage_chain(mtmp->minvent, FALSE); (void) rloc(mtmp, FALSE); diff --git a/src/zap.c b/src/zap.c index 6907880e4..eb61a261c 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1544442714 2018/12/10 11:51:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.302 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1545431660 2018/12/21 22:34:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.303 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4040,8 +4040,12 @@ boolean say; /* Announce out of sight hit/miss events if true */ /* hit() and miss() need bhitpos to match the target */ bhitpos.x = sx, bhitpos.y = sy; /* Fireballs only damage when they explode */ - if (type != ZT_SPELL(ZT_FIRE)) + if (type != ZT_SPELL(ZT_FIRE)) { range += zap_over_floor(sx, sy, type, &shopdamage, 0); + /* zap with fire -> melt ice -> drown monster, so monster + found and cached above might not be here any more */ + mon = m_at(sx, sy); + } if (mon) { if (type == ZT_SPELL(ZT_FIRE)) @@ -4244,6 +4248,7 @@ const char *msg; { struct rm *lev = &levl[x][y]; struct obj *otmp; + struct monst *mtmp; if (!msg) msg = "The ice crackles and melts."; @@ -4281,6 +4286,8 @@ const char *msg; } if (x == u.ux && y == u.uy) spoteffects(TRUE); /* possibly drown, notice objects */ + else if (is_pool(x, y) && (mtmp = m_at(x, y)) != 0) + (void) minliquid(mtmp); } #define MIN_ICE_TIME 50 @@ -4327,11 +4334,15 @@ long timeout UNUSED; { xchar x, y; long where = arg->a_long; + boolean save_mon_moving = context.mon_moving; /* will be False */ + /* melt_ice -> minliquid -> mondead|xkilled shouldn't credit/blame hero */ + context.mon_moving = TRUE; /* hero isn't causing this ice to melt */ y = (xchar) (where & 0xFFFF); x = (xchar) ((where >> 16) & 0xFFFF); /* melt_ice does newsym when appropriate */ melt_ice(x, y, "Some ice melts away."); + context.mon_moving = save_mon_moving; } /* Burn floor scrolls, evaporate pools, etc... in a single square. From 8dfc10d8c62e94c42f0f35a9e43d4f20464579af Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 21 Dec 2018 17:11:22 -0800 Subject: [PATCH 2/2] fix #H2709 - exercise_steed() for riding skill Code appears to intend that riding for 100 turns be treated like a successful weapon hit as far as skill training goes, but it was actually requiring 101 turns each time. It's conceivable that that was intentional, but unlikely. --- doc/fixes36.2 | 1 + src/steed.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 68894447e..d891d6e63 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -299,6 +299,7 @@ identifying or forgetting gem types now adjusts prices for gems already on shopping bill when fire converts an ice location into a water location, dunk any monster on that spot immediately instead of waiting until its next move +training riding skill had an off-by-one bug when counting turns riding Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/steed.c b/src/steed.c index a90a0ce86..feede89c5 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steed.c $NHDT-Date: 1544666049 2018/12/13 01:54:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 steed.c $NHDT-Date: 1545441042 2018/12/22 01:10:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.62 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -366,7 +366,7 @@ exercise_steed() return; /* It takes many turns of riding to exercise skill */ - if (u.urideturns++ >= 100) { + if (++u.urideturns >= 100) { u.urideturns = 0; use_skill(P_RIDING, 1); }