issue #1447 - physical damage when polymorphed

Isssue reported by Tomsod:  hero-as-target section of mhitm_ad_phys()
was not handling hero's Half_physical_damage attribute.

The issue was about cloning a pet from hero who is poly'd into a
pudding but it was more general than that.  Half_physical_damage was
ignored for any hit by a monster-wielded weapon against poly'd hero.

It took a while to convince myself that Half_physical_damage wasn't
aleady being applied elsewhere but it doesn't seem to be.

Fixes #1447
This commit is contained in:
PatR
2025-09-25 09:59:15 -07:00
parent d0b79912ed
commit edd11009e9
3 changed files with 11 additions and 5 deletions

View File

@@ -2132,6 +2132,7 @@ don't try to split a pudding that got jousted into a hole and is off the map
mounted hero was able to deliver joust hits when trapped
timer sanity check for melting ice gave false complaint about non-ice for
frozen moat under open drawbridge
mhitm_ad_phys() was not applying Half_physical_damage when hero was target
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository

View File

@@ -1199,7 +1199,8 @@ hitmu(struct monst *mtmp, struct attack *mattk)
mhm.damage = 1;
}
if (mhm.damage) {
if (mhm.damage > 0) {
/* [Half_physical_damage isn't applied to mhm.permdmg] */
if (Half_physical_damage
/* Mitre of Holiness, even if not currently blessed */
|| (Role_if(PM_CLERIC) && uarmh && is_quest_artifact(uarmh)

View File

@@ -4008,7 +4008,8 @@ mhitm_ad_phys(
if (mattk->aatyp == AT_WEAP && otmp) {
struct obj *marmg;
int tmp;
boolean was_poisoned = (otmp->opoisoned || permapoisoned(otmp));
boolean was_poisoned = (otmp->opoisoned
|| permapoisoned(otmp));
if (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm])) {
@@ -4051,6 +4052,9 @@ mhitm_ad_phys(
tmp -= rnd(-u.uac);
if (tmp < 1)
tmp = 1;
if (Half_physical_damage)
tmp = (tmp + 1) / 2;
if (u.mh - tmp > 1
&& (objects[otmp->otyp].oc_material == IRON
/* relevant 'metal' objects are scalpel and tsurugi */
@@ -4071,13 +4075,13 @@ mhitm_ad_phys(
char buf[BUFSZ];
/* similar to mhitm_really_poison, but we don't use the
* exact same values, nor do we want the same 1/8 chance of
* the poison taking (use 1/4, same as in the mhitm case). */
* exact same values, nor do we want same 1/8 chance of
* poison taking (use 1/4, same as in the mhitm case). */
Sprintf(buf, "%s %s", s_suffix(Monnam(magr)),
mpoisons_subj(magr, mattk));
/* arbitrary, but most poison sources in the game are
* strength-based. With hpdamchance = 10, HP damage occurs
* 1/2 of the time and it will hit Str the rest of the time.
* 1/2 of the time and it will hit Str rest of the time.
* (This is the same as poisoned ammo.) */
poisoned(buf, A_STR, pmname(magr->data, Mgender(magr)),
10, FALSE);