-/* NetHack 3.6 extern.h $NHDT-Date: 1456528594 2016/02/26 23:16:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.549 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1456992437 2016/03/03 08:07:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.550 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E void NDECL(u_slow_down);
E struct monst *NDECL(cloneu);
E void FDECL(expels, (struct monst *, struct permonst *, BOOLEAN_P));
-E struct attack *FDECL(getmattk,
- (struct permonst *, int, int *, struct attack *));
+E struct attack *FDECL(getmattk, (struct monst *, struct monst *,
+ int, int *, struct attack *));
E int FDECL(mattacku, (struct monst *));
E int FDECL(magic_negation, (struct monst *));
E boolean NDECL(gulp_blnd_check);
-/* NetHack 3.6 mhitm.c $NHDT-Date: 1446854229 2015/11/06 23:57:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.83 $ */
+/* NetHack 3.6 mhitm.c $NHDT-Date: 1456992461 2016/03/03 08:07:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.86 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* Now perform all attacks for the monster. */
for (i = 0; i < NATTK; i++) {
res[i] = MM_MISS;
- mattk = getmattk(pa, i, res, &alt_attk);
+ mattk = getmattk(magr, mdef, i, res, &alt_attk);
otmp = (struct obj *) 0;
attk = 1;
switch (mattk->aatyp) {
-/* NetHack 3.6 mhitu.c $NHDT-Date: 1456618997 2016/02/28 00:23:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.135 $ */
+/* NetHack 3.6 mhitu.c $NHDT-Date: 1456992469 2016/03/03 08:07:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.136 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* select a monster's next attack, possibly substituting for its usual one */
struct attack *
-getmattk(mptr, indx, prev_result, alt_attk_buf)
-struct permonst *mptr;
+getmattk(magr, mdef, indx, prev_result, alt_attk_buf)
+struct monst *magr, *mdef;
int indx, prev_result[];
struct attack *alt_attk_buf;
{
+ struct permonst *mptr = magr->data;
struct attack *attk = &mptr->mattk[indx];
+ struct obj *weap = (magr == &youmonst) ? uwep : MON_WEP(magr);
/* prevent a monster with two consecutive disease or hunger attacks
from hitting with both of them on the same turn; if the first has
attk->adtyp = AD_STUN;
/* make drain-energy damage be somewhat in proportion to energy */
- } else if (attk->adtyp == AD_DREN) {
+ } else if (attk->adtyp == AD_DREN && mdef == &youmonst) {
int ulev = max(u.ulevel, 6);
*alt_attk_buf = *attk;
attk->damd += 3; /* very high energy: 3d6 -> 3d9 */
/* note: 3d9 is slightly higher than previous 4d6 */
}
+
+ /* barrow wight, Nazgul, erinys have weapon attack for non-physical
+ damage; force physical damage if attacker has been cancelled or
+ if weapon is sufficiently interesting; a few unique creatures
+ have two weapon attacks where one does physical damage and other
+ doesn't--avoid forcing physical damage for those */
+ } else if (indx == 0 && magr != &youmonst
+ && attk->aatyp == AT_WEAP && attk->adtyp != AD_PHYS
+ && !(mptr->mattk[1].aatyp == AT_WEAP
+ && mptr->mattk[1].adtyp == AD_PHYS)
+ && (magr->mcan
+ || (weap
+ && ((weap->otyp == CORPSE
+ && touch_petrifies(&mons[weap->corpsenm]))
+ || weap->oartifact == ART_STORMBRINGER
+ || weap->oartifact == ART_VORPAL_BLADE)))) {
+ *alt_attk_buf = *attk;
+ attk = alt_attk_buf;
+ attk->adtyp = AD_PHYS;
}
return attk;
}
for (i = 0; i < NATTK; i++) {
sum[i] = 0;
- mattk = getmattk(mdat, i, sum, &alt_attk);
+ mattk = getmattk(mtmp, &youmonst, i, sum, &alt_attk);
if ((u.uswallow && mattk->aatyp != AT_ENGL)
|| (skipnonmagc && mattk->aatyp != AT_MAGC))
continue;
hitmsg(mtmp, mattk);
break;
}
- if (!uwep && !uarmu && !uarm && !uarmh && !uarms && !uarmg && !uarmc
- && !uarmf) {
+ if (!uwep && !uarmu && !uarm && !uarmc
+ && !uarms && !uarmg && !uarmf && !uarmh) {
boolean goaway = FALSE;
+
pline("%s hits! (I hope you don't mind.)", Monnam(mtmp));
if (Upolyd) {
u.mh += rnd(7);
-/* NetHack 3.6 uhitm.c $NHDT-Date: 1454664302 2016/02/05 09:25:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.154 $ */
+/* NetHack 3.6 uhitm.c $NHDT-Date: 1456992470 2016/03/03 08:07:50 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.155 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
for (i = 0; i < NATTK; i++) {
sum[i] = 0;
- mattk = getmattk(youmonst.data, i, sum, &alt_attk);
+ mattk = getmattk(&youmonst, mon, i, sum, &alt_attk);
switch (mattk->aatyp) {
case AT_WEAP:
use_weapon: