fix #H9424 - mon vs shade damage despite harmless

Monster vs monster non-weapon attack against a shade that failed
due to non-silver and non-blessed hit was inflicting damage.
This commit is contained in:
PatR
2019-11-14 15:28:32 -08:00
parent 501541635a
commit 5abf64adaf
2 changed files with 29 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.172 $ $NHDT-Date: 1573688684 2019/11/13 23:44:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.174 $ $NHDT-Date: 1573773953 2019/11/14 23:25:53 $
This fixes36.3 file is here to capture information about updates in the 3.6.x This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -252,6 +252,7 @@ in symset:curses, symbol S_tree was accidentally set to horizontal line where
percentage highlighting for Xp broke up/down/changed highlighting for it; percentage highlighting for Xp broke up/down/changed highlighting for it;
it was flagged as having gone up every time the percentage changed it was flagged as having gone up every time the percentage changed
deaf change to zap_over_floor needed to be restricted to player actions only deaf change to zap_over_floor needed to be restricted to player actions only
monster vs shade attack inflicted damage despite "passes harmlessly through"
curses: sometimes the message window would show a blank line after a prompt curses: sometimes the message window would show a blank line after a prompt
curses: the change to show map in columns 1..79 instead of 2..80 made the curses: the change to show map in columns 1..79 instead of 2..80 made the
highlight for '@' show up in the wrong place if clipped map had been highlight for '@' show up in the wrong place if clipped map had been

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitm.c $NHDT-Date: 1573688692 2019/11/13 23:44:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */ /* NetHack 3.6 mhitm.c $NHDT-Date: 1573773926 2019/11/14 23:25:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -411,9 +411,9 @@ register struct monst *magr, *mdef;
|| mdef->data == &mons[PM_BROWN_PUDDING]) || mdef->data == &mons[PM_BROWN_PUDDING])
&& (otmp && (objects[otmp->otyp].oc_material == IRON && (otmp && (objects[otmp->otyp].oc_material == IRON
|| objects[otmp->otyp].oc_material == METAL)) || objects[otmp->otyp].oc_material == METAL))
&& mdef->mhp > 1 && mdef->mhp > 1 && !mdef->mcan) {
&& !mdef->mcan) {
struct monst *mclone; struct monst *mclone;
if ((mclone = clone_mon(mdef, 0, 0)) != 0) { if ((mclone = clone_mon(mdef, 0, 0)) != 0) {
if (vis && canspotmon(mdef)) { if (vis && canspotmon(mdef)) {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -455,6 +455,13 @@ register struct monst *magr, *mdef;
break; break;
case AT_ENGL: case AT_ENGL:
if (mdef->data == &mons[PM_SHADE]) { /* no silver teeth... */
if (vis)
pline("%s attempt to engulf %s is futile.",
s_suffix(Monnam(magr)), mon_nam(mdef));
strike = 0;
break;
}
if (u.usteed && mdef == u.usteed) { if (u.usteed && mdef == u.usteed) {
strike = 0; strike = 0;
break; break;
@@ -572,7 +579,9 @@ struct attack *mattk;
mdef->mcansee ? "smiles at" : "talks to"); mdef->mcansee ? "smiles at" : "talks to");
pline("%s %s %s.", buf, mon_nam(mdef), pline("%s %s %s.", buf, mon_nam(mdef),
compat == 2 ? "engagingly" : "seductively"); compat == 2 ? "engagingly" : "seductively");
} else if (!shade_miss(magr, mdef, otmp, FALSE, TRUE)) { } else if (shade_miss(magr, mdef, otmp, FALSE, TRUE)) {
return MM_MISS; /* bypass mdamagem() */
} else {
char magr_name[BUFSZ]; char magr_name[BUFSZ];
Strcpy(magr_name, Monnam(magr)); Strcpy(magr_name, Monnam(magr));
@@ -851,11 +860,12 @@ mdamagem(magr, mdef, mattk)
register struct monst *magr, *mdef; register struct monst *magr, *mdef;
register struct attack *mattk; register struct attack *mattk;
{ {
struct obj *obj; struct obj *obj, dmgwep;
char buf[BUFSZ]; char buf[BUFSZ];
struct permonst *pa = magr->data, *pd = mdef->data; struct permonst *pa = magr->data, *pd = mdef->data;
int armpro, num, tmp = d((int) mattk->damn, (int) mattk->damd), int armpro, num,
res = MM_MISS; tmp = d((int) mattk->damn, (int) mattk->damd),
res = MM_MISS;
boolean cancelled; boolean cancelled;
if ((touch_petrifies(pd) /* or flesh_petrifies() */ if ((touch_petrifies(pd) /* or flesh_petrifies() */
@@ -958,16 +968,19 @@ register struct attack *mattk;
case AD_HEAL: case AD_HEAL:
case AD_PHYS: case AD_PHYS:
physical: physical:
if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { /* this shade check is necessary in case any attacks which
dish out physical damage bypass hitmm() to get here */
if ((mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW) && otmp)
dmgwep = *otmp;
else
dmgwep = zeroobj;
if (shade_miss(magr, mdef, &dmgwep, FALSE, TRUE)) {
tmp = 0;
} else if (mattk->aatyp == AT_KICK && thick_skinned(pd)) {
tmp = 0; tmp = 0;
} else if (mattk->aatyp == AT_WEAP } else if (mattk->aatyp == AT_WEAP
|| (mattk->aatyp == AT_CLAW && otmp)) { || (mattk->aatyp == AT_CLAW && otmp)) {
if (mdef->data == &mons[PM_SHADE]
&& !(otmp && objects[otmp->otyp].oc_material == SILVER)) {
/* "passes harmlessly through" given by hitmm() */
tmp = 0;
break;
}
if (otmp) { if (otmp) {
struct obj *marmg; struct obj *marmg;