-$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.85 $ $NHDT-Date: 1580608377 2020/02/02 01:52:57 $
+$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ $NHDT-Date: 1580633720 2020/02/02 08:55:20 $
General Fixes and Modified Features
-----------------------------------
throttle long worm growth rate and HP accumulation
poly'd hero was able to zap wands, apply tools, and #rub objects without
having any hands
+spellcasting monster got an extra move after casting
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
-/* NetHack 3.6 extern.h $NHDT-Date: 1580044333 2020/01/26 13:12:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.786 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1580633720 2020/02/02 08:55:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.787 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E void FDECL(worm_move, (struct monst *));
E void FDECL(worm_nomove, (struct monst *));
E void FDECL(wormgone, (struct monst *));
-E void FDECL(wormhitu, (struct monst *));
+E int FDECL(wormhitu, (struct monst *));
E void FDECL(cutworm, (struct monst *, XCHAR_P, XCHAR_P, BOOLEAN_P));
E void FDECL(see_wsegs, (struct monst *));
E void FDECL(detect_wsegs, (struct monst *, BOOLEAN_P));
-/* NetHack 3.6 mcastu.c $NHDT-Date: 1567418129 2019/09/02 09:55:29 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.55 $ */
+/* NetHack 3.6 mcastu.c $NHDT-Date: 1580633721 2020/02/02 08:55:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.64 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
choose_magic_spell(spellval)
int spellval;
{
- /* for 3.4.3 and earlier, val greater than 22 selected the default spell
- */
+ /* for 3.4.3 and earlier, val greater than 22 selected default spell */
while (spellval > 24 && rn2(25))
spellval = rn2(spellval);
/* monster unable to cast spells? */
if (mtmp->mcan || mtmp->mspec_used || !ml) {
cursetxt(mtmp, is_undirected_spell(mattk->adtyp, spellnum));
- return (0);
+ return 0;
}
if (mattk->adtyp == AD_SPEL || mattk->adtyp == AD_CLRC) {
canseemon(mtmp) ? Monnam(mtmp) : "Something",
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
: "thin air");
- return (0);
+ return 0;
}
nomul(0);
if (rn2(ml * 10) < (mtmp->mconf ? 100 : 20)) { /* fumbled attack */
if (canseemon(mtmp) && !Deaf)
pline_The("air crackles around %s.", mon_nam(mtmp));
- return (0);
+ return 0;
}
if (canspotmon(mtmp) || !is_undirected_spell(mattk->adtyp, spellnum)) {
pline("%s casts a spell%s!",
impossible(
"%s casting non-hand-to-hand version of hand-to-hand spell %d?",
Monnam(mtmp), mattk->adtyp);
- return (0);
+ return 0;
}
} else if (mattk->damd)
dmg = d((int) ((ml / 2) + mattk->damn), (int) mattk->damd);
dmg = (dmg + 1) / 2;
ret = 1;
-
switch (mattk->adtyp) {
case AD_FIRE:
pline("You're enveloped in flames.");
}
if (dmg)
mdamageu(mtmp, dmg);
- return (ret);
+ return ret;
}
static int
/* don't print constant stream of curse messages for 'normal'
spellcasting monsters at range */
if (mattk->adtyp > AD_SPC2)
- return (0);
+ return 0;
if (mtmp->mcan) {
cursetxt(mtmp, FALSE);
- return (0);
+ return 0;
}
if (lined_up(mtmp) && rn2(3)) {
nomul(0);
} else
impossible("Monster spell %d cast", mattk->adtyp - 1);
}
- return (1);
+ return 1;
}
/*mcastu.c*/
-/* NetHack 3.6 monmove.c $NHDT-Date: 1579616424 2020/01/21 14:20:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.128 $ */
+/* NetHack 3.6 monmove.c $NHDT-Date: 1580633722 2020/02/02 08:55:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.129 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
/* arbitrary distance restriction to keep monster far away
from you from having cast dozens of sticks-to-snakes
or similar spells by the time you reach it */
- if (dist2(mtmp->mx, mtmp->my, u.ux, u.uy) <= 49
- && !mtmp->mspec_used) {
+ if (!mtmp->mspec_used
+ && dist2(mtmp->mx, mtmp->my, u.ux, u.uy) <= 49) {
struct attack *a;
for (a = &mdat->mattk[0]; a < &mdat->mattk[NATTK]; a++) {
if (a->aatyp == AT_MAGC
&& (a->adtyp == AD_SPEL || a->adtyp == AD_CLRC)) {
if (castmu(mtmp, a, FALSE, FALSE)) {
- tmp = 3;
+ tmp = 3; /* bypass m_move() */
break;
}
}
}
}
- tmp = m_move(mtmp, 0);
+ if (!tmp)
+ tmp = m_move(mtmp, 0);
if (tmp != 2)
distfleeck(mtmp, &inrange, &nearby, &scared); /* recalc */
/* Now, attack the player if possible - one attack set per monst
*/
- if (!mtmp->mpeaceful || (Conflict && !resist(mtmp, RING_CLASS, 0, 0))) {
- if (inrange && !noattacks(mdat)
- && (Upolyd ? u.mh : u.uhp) > 0 && !scared && tmp != 3)
+ if (tmp != 3 && (!mtmp->mpeaceful
+ || (Conflict && !resist(mtmp, RING_CLASS, 0, 0)))) {
+ if (inrange && !scared && !noattacks(mdat)
+ /* [is this hp check really needed?] */
+ && (Upolyd ? u.mh : u.uhp) > 0) {
if (mattacku(mtmp))
return 1; /* monster died (e.g. exploded) */
-
- if (mtmp->wormno)
- wormhitu(mtmp);
+ }
+ if (mtmp->wormno) {
+ if (wormhitu(mtmp))
+ return 1; /* worm died (poly'd hero passive counter-attack) */
+ }
}
/* special speeches for quest monsters */
if (!mtmp->msleeping && mtmp->mcanmove && nearby)
&& couldsee(mtmp->mx, mtmp->my) && !mtmp->minvis && !rn2(5))
cuss(mtmp);
+ /* note: can't get here when tmp==2 so this always returns 0 */
return (tmp == 2);
}
-/* NetHack 3.6 worm.c $NHDT-Date: 1580043421 2020/01/26 12:57:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ */
+/* NetHack 3.6 worm.c $NHDT-Date: 1580633722 2020/02/02 08:55:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2009. */
/* NetHack may be freely redistributed. See license for details. */
* Check for mon->wormno before calling this function!
*
* If the hero is near any part of the worm, the worm will try to attack.
+ * Returns 1 if the worm dies (poly'd hero with passive counter-attack)
+ * or 0 if it doesn't.
*/
-void
+int
wormhitu(worm)
struct monst *worm;
{
* is out of range of the player. We might try to kludge, and bring
* the head within range for a tiny moment, but this needs a bit more
* looking at before we decide to do this.
+ *
+ * Head has already had a chance to attack, so the dummy tail segment
+ * sharing its location should be skipped.
*/
- for (seg = wtails[wnum]; seg; seg = seg->nseg)
+ for (seg = wtails[wnum]; seg != wheads[wnum]; seg = seg->nseg)
if (distu(seg->wx, seg->wy) < 3)
if (mattacku(worm))
- return; /* your passive ability killed the worm */
+ return 1; /* your passive ability killed the worm */
+ return 0;
}
/* cutworm()