Fix dmonsfree warning caused by knockback
When a monster being attacked was knocked back into a level teleport trap, the attacker could still hit the defender. If the second hit then killed the defender, this could result in dmonsfree warning.
This commit is contained in:
@@ -241,6 +241,8 @@ struct monst {
|
|||||||
#define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon)))
|
#define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon)))
|
||||||
#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove)
|
#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove)
|
||||||
|
|
||||||
|
#define mon_offmap(mon) (((mon)->mstate & (MON_DETACH|MON_MIGRATING|MON_LIMBO|MON_OFFMAP)) != 0)
|
||||||
|
|
||||||
/* Get the maximum difficulty monsters that can currently be generated,
|
/* Get the maximum difficulty monsters that can currently be generated,
|
||||||
given the current level difficulty and the hero's level. */
|
given the current level difficulty and the hero's level. */
|
||||||
#define monmax_difficulty(levdif) (((levdif) + u.ulevel) / 2)
|
#define monmax_difficulty(levdif) (((levdif) + u.ulevel) / 2)
|
||||||
|
|||||||
@@ -559,6 +559,9 @@ mattackm(register struct monst *magr, register struct monst *mdef)
|
|||||||
/* return if aggressor can no longer attack */
|
/* return if aggressor can no longer attack */
|
||||||
if (helpless(magr))
|
if (helpless(magr))
|
||||||
return res[i];
|
return res[i];
|
||||||
|
/* eg. defender was knocked into a level teleport trap */
|
||||||
|
if (mon_offmap(mdef))
|
||||||
|
return res[i];
|
||||||
if (res[i] & M_ATTK_HIT)
|
if (res[i] & M_ATTK_HIT)
|
||||||
struck = 1; /* at least one hit */
|
struck = 1; /* at least one hit */
|
||||||
} /* for (;i < NATTK;) loop */
|
} /* for (;i < NATTK;) loop */
|
||||||
|
|||||||
@@ -989,7 +989,7 @@ movemon_singlemon(struct monst *mtmp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* monster isn't on this map anymore */
|
/* monster isn't on this map anymore */
|
||||||
if ((mtmp->mstate & (MON_DETACH|MON_MIGRATING|MON_LIMBO|MON_OFFMAP)) != 0)
|
if (mon_offmap(mtmp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Find a monster that we have not treated yet. */
|
/* Find a monster that we have not treated yet. */
|
||||||
|
|||||||
Reference in New Issue
Block a user