diff --git a/src/uhitm.c b/src/uhitm.c index 20d41f710..63cb1c02b 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 uhitm.c $NHDT-Date: 1625838649 2021/07/09 13:50:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.312 $ */ +/* NetHack 3.7 uhitm.c $NHDT-Date: 1641668224 2022/01/08 18:57:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.328 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -511,10 +511,16 @@ do_attack(struct monst *mtmp) /* really hit target monster; returns TRUE if it still lives */ static boolean -known_hitum(struct monst *mon, struct obj *weapon, int *mhit, int rollneeded, - int armorpenalty, /* for monks */ - struct attack *uattk, - int dieroll) +known_hitum( + struct monst *mon, /* target */ + struct obj *weapon, /* uwep or uswapwep */ + int *mhit, /* *mhit is 1 or 0; hit (1) gets changed to miss (0) + * for decapitation attack against headless target */ + int rollneeded, /* rollneeded and armorpenalty are used for monks +*/ + int armorpenalty, /*+ wearing suits so miss message can vary for missed + * because of penalty vs would have missed anyway */ + struct attack *uattk, + int dieroll) { boolean malive = TRUE, /* hmon() might destroy weapon; remember aspect for cutworm */ @@ -654,9 +660,10 @@ hitum(struct monst *mon, struct attack *uattk) { boolean malive, wep_was_destroyed = FALSE; struct obj *wepbefore = uwep; - int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy, - tmp = find_roll_to_hit(mon, uattk->aatyp, uwep, - &attknum, &armorpenalty); + int armorpenalty, attknum = 0, + x = u.ux + u.dx, y = u.uy + u.dy, + tmp = find_roll_to_hit(mon, uattk->aatyp, uwep, + &attknum, &armorpenalty); int dieroll = rnd(20); int mhit = (tmp > dieroll || u.uswallow); @@ -4536,18 +4543,10 @@ hmonas(struct monst *mon) struct attack *mattk, alt_attk; struct obj *weapon, **originalweapon; boolean altwep = FALSE, weapon_used = FALSE, odd_claw = TRUE; - int i, tmp, armorpenalty, sum[NATTK], nsum = MM_MISS, - dhit = 0, attknum = 0; - int dieroll, multi_claw = 0; + int i, tmp, dieroll, armorpenalty, sum[NATTK], + dhit = 0, attknum = 0, multi_claw = 0; boolean monster_survived; - /* FIXME: One compiler was getting a - variable nsum set but not used [-Werror,-Wunused-but-set-variable] - For now, I'm working around it with nhUse() but it should be - investigated when someone has the time. - */ - nhUse(nsum); - /* not used here but umpteen mhitm_ad_xxxx() need this */ g.vis = (canseemon(mon) || distu(mon->mx, mon->my) <= 2); @@ -4909,11 +4908,9 @@ hmonas(struct monst *mon) if (sum[i] == MM_DEF_DIED) { /* defender dead */ (void) passive(mon, weapon, 1, 0, mattk->aatyp, FALSE); - nsum = MM_MISS; /* return value below used to be 'nsum > 0' */ } else { (void) passive(mon, weapon, (sum[i] != MM_MISS), 1, mattk->aatyp, FALSE); - nsum |= sum[i]; } /* don't use sum[i] beyond this point;