Fix: repeated 'hit with a wielded weapon' logging

The "hit with a wielded weapon for the first time" livelog line could be
produced repeatedly: it was triggered by hitting a monster with a
wielded object of any sort, but the u.uconduct.weaphit counter was only
incremented if hitting with an actual 'weapon' (a WEAPON_CLASS or
is_weptool item).  As a result, if a non-weapon-using hero whipped out a
non-weapon item -- a cockatrice corpse, for example -- and started going
to town on some monsters, the livelog message would be repeated with
every hit.
This commit is contained in:
Michael Meyer
2022-03-19 15:33:13 -04:00
committed by PatR
parent 7840ef9554
commit fb512bac4f

View File

@@ -1323,6 +1323,8 @@ hmon_hitmon(
if (!already_killed) {
if (obj && (obj == uwep || (obj == uswapwep && u.twoweap))
/* known_hitum 'what counts as a weapon' criteria */
&& (obj->oclass == WEAPON_CLASS || is_weptool(obj))
&& (thrown == HMON_MELEE || thrown == HMON_APPLIED)
/* note: caller has already incremented u.uconduct.weaphit
so we test for 1; 0 shouldn't be able to happen here... */