I came across an old bug report which stated that steeds missed out
on their chance to counterattack if the hero had just taken some action
other than moving.
[1: monster attacks steed instead of hero ]
[2: if monster died while attacking, return 1 ]
if (i & MM_DEF_DIED || u.ux != u.ux0 || u.uy != u.uy0)
return (0);
[4: otherwise, steed counterattacks monster ]
Sometime since whatever version the 2001 report was for, but before the
current cvs repository was set up someone addressed this by changing it
to be
if (i & MM_DEF_DIED || !u.umoved)
return (0);
but I think that fixed the wrong thing. I believe that the original code
was attempting to make sure that the steed was still in position to be
able to counterattack. There's no reason to care about the hero's most
recent action; he had to have done something that caused time to elapse
in order for the other monster to have initiated an attack in the first.
(The new range check is actually redundant; mattackm() also enforces it.)
-/* SCCS Id: @(#)mhitu.c 3.5 2007/03/09 */
+/* SCCS Id: @(#)mhitu.c 3.5 2007/06/02 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
i = mattackm(mtmp, u.usteed);
if ((i & MM_AGR_DIED))
return (1);
- if (i & MM_DEF_DIED || u.umoved)
+ /* make sure steed is still alive and within range */
+ if ((i & MM_DEF_DIED) || !u.usteed ||
+ distu(mtmp->mx, mtmp->my) > 2)
return (0);
/* Let your steed retaliate */
return (!!(mattackm(u.usteed, mtmp) & MM_DEF_DIED));