fix U100 - vampire stoning buf
Fix the reported bug of a vampire that is wearing gloves being able to bite a cockatrice without becoming petrified.
This commit is contained in:
@@ -941,6 +941,7 @@ E int FDECL(mattackm, (struct monst *,struct monst *));
|
||||
E int FDECL(noattacks, (struct permonst *));
|
||||
E int FDECL(sleep_monst, (struct monst *,int,int));
|
||||
E void FDECL(slept_monst, (struct monst *));
|
||||
E long FDECL(attk_protection, (int));
|
||||
|
||||
/* ### mhitu.c ### */
|
||||
|
||||
|
||||
67
src/mhitm.c
67
src/mhitm.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)mhitm.c 3.4 2002/09/08 */
|
||||
/* SCCS Id: @(#)mhitm.c 3.4 2002/10/17 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -563,19 +563,20 @@ mdamagem(magr, mdef, mattk)
|
||||
register struct monst *magr, *mdef;
|
||||
register struct attack *mattk;
|
||||
{
|
||||
struct permonst *pa = magr->data, *pd = mdef->data;
|
||||
int tmp = d((int)mattk->damn,(int)mattk->damd);
|
||||
struct obj *obj;
|
||||
char buf[BUFSZ];
|
||||
int protector =
|
||||
mattk->aatyp == AT_TENT ? 0 :
|
||||
mattk->aatyp == AT_KICK ? W_ARMF : W_ARMG;
|
||||
int num;
|
||||
struct permonst *pa = magr->data, *pd = mdef->data;
|
||||
int num, tmp = d((int)mattk->damn, (int)mattk->damd);
|
||||
|
||||
if (touch_petrifies(pd) && !resists_ston(magr) &&
|
||||
(mattk->aatyp != AT_WEAP || !otmp) &&
|
||||
(mattk->aatyp != AT_GAZE && mattk->aatyp != AT_EXPL) &&
|
||||
!(magr->misc_worn_check & protector)) {
|
||||
if (touch_petrifies(pd) && !resists_ston(magr)) {
|
||||
long protector = attk_protection(mattk->aatyp),
|
||||
wornitems = magr->misc_worn_check;
|
||||
|
||||
/* wielded weapon gives same protection as gloves here */
|
||||
if (otmp != 0) wornitems |= W_ARMG;
|
||||
|
||||
if (protector == 0L ||
|
||||
(protector != ~0L && (wornitems & protector) != protector)) {
|
||||
if (poly_when_stoned(pa)) {
|
||||
mon_to_stone(magr);
|
||||
return MM_HIT; /* no damage during the polymorph */
|
||||
@@ -586,6 +587,7 @@ mdamagem(magr, mdef, mattk)
|
||||
else if (magr->mtame && !vis)
|
||||
You(brief_feeling, "peculiarly sad");
|
||||
return MM_AGR_DIED;
|
||||
}
|
||||
}
|
||||
|
||||
switch(mattk->adtyp) {
|
||||
@@ -1366,6 +1368,49 @@ int mdead;
|
||||
return (mdead | mhit);
|
||||
}
|
||||
|
||||
/* "aggressive defense"; what type of armor prevents specified attack
|
||||
from touching its target? */
|
||||
long
|
||||
attk_protection(aatyp)
|
||||
int aatyp;
|
||||
{
|
||||
long w_mask = 0L;
|
||||
|
||||
switch (aatyp) {
|
||||
case AT_NONE:
|
||||
case AT_SPIT:
|
||||
case AT_EXPL:
|
||||
case AT_BOOM:
|
||||
case AT_GAZE:
|
||||
case AT_BREA:
|
||||
case AT_MAGC:
|
||||
w_mask = ~0L; /* special case; no defense needed */
|
||||
break;
|
||||
case AT_CLAW:
|
||||
case AT_TUCH:
|
||||
case AT_WEAP:
|
||||
w_mask = W_ARMG; /* caller needs to check for weapon */
|
||||
break;
|
||||
case AT_KICK:
|
||||
w_mask = W_ARMF;
|
||||
break;
|
||||
case AT_BUTT:
|
||||
w_mask = W_ARMH;
|
||||
break;
|
||||
case AT_HUGS:
|
||||
w_mask = (W_ARMC|W_ARMG); /* attacker needs both to be protected */
|
||||
break;
|
||||
case AT_BITE:
|
||||
case AT_STNG:
|
||||
case AT_ENGL:
|
||||
case AT_TENT:
|
||||
default:
|
||||
w_mask = 0L; /* no defense available */
|
||||
break;
|
||||
}
|
||||
return w_mask;
|
||||
}
|
||||
|
||||
#endif /* OVLB */
|
||||
|
||||
/*mhitm.c*/
|
||||
|
||||
21
src/mhitu.c
21
src/mhitu.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)mhitu.c 3.4 2002/03/29 */
|
||||
/* SCCS Id: @(#)mhitu.c 3.4 2002/10/17 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2390,15 +2390,16 @@ register struct attack *mattk;
|
||||
goto assess_dmg;
|
||||
case AD_STON: /* cockatrice */
|
||||
{
|
||||
int protector =
|
||||
mattk->aatyp == AT_TENT ? 0 :
|
||||
mattk->aatyp == AT_KICK ? W_ARMF : W_ARMG;
|
||||
if (!resists_ston(mtmp) &&
|
||||
(mattk->aatyp != AT_WEAP || !MON_WEP(mtmp)) &&
|
||||
mattk->aatyp != AT_GAZE && mattk->aatyp != AT_EXPL &&
|
||||
mattk->aatyp != AT_MAGC &&
|
||||
!(mtmp->misc_worn_check & protector)) {
|
||||
if(poly_when_stoned(mtmp->data)) {
|
||||
long protector = attk_protection(mattk->aatyp),
|
||||
wornitems = mtmp->misc_worn_check;
|
||||
|
||||
/* wielded weapon gives same protection as gloves here */
|
||||
if (MON_WEP(mtmp) != 0) wornitems |= W_ARMG;
|
||||
|
||||
if (!resists_ston(mtmp) && (protector == 0L ||
|
||||
(protector != ~0L &&
|
||||
(wornitems & protector) != protector))) {
|
||||
if (poly_when_stoned(mtmp->data)) {
|
||||
mon_to_stone(mtmp);
|
||||
return (1);
|
||||
}
|
||||
|
||||
29
src/uhitm.c
29
src/uhitm.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)uhitm.c 3.4 2002/09/08 */
|
||||
/* SCCS Id: @(#)uhitm.c 3.4 2002/10/17 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2020,21 +2020,26 @@ uchar aatyp;
|
||||
exercise(A_STR, FALSE);
|
||||
break;
|
||||
case AD_STON:
|
||||
if(mhit) {
|
||||
/* mhit does not mean you physically hit; it just means the
|
||||
attack was successful */
|
||||
if ((aatyp == AT_KICK && !uarmf) ||
|
||||
((aatyp == AT_WEAP || aatyp == AT_CLAW || aatyp == AT_MAGC
|
||||
|| aatyp == AT_TUCH) && !uwep && !uarmg) ||
|
||||
aatyp == AT_BITE || aatyp == AT_STNG || aatyp == AT_BUTT ||
|
||||
aatyp == AT_TENT || aatyp == AT_HUGS || aatyp == AT_ENGL) {
|
||||
if (!Stone_resistance &&
|
||||
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
||||
if (mhit) { /* successful attack */
|
||||
long protector = attk_protection(aatyp);
|
||||
|
||||
/* hero using monsters' AT_MAGC attack is hitting hand to
|
||||
hand rather than casting a spell */
|
||||
if (aatyp == AT_MAGC) protector = W_ARMG;
|
||||
|
||||
if (protector == 0L || /* no protection */
|
||||
(protector == W_ARMG && !uarmg && !uwep) ||
|
||||
(protector == W_ARMF && !uarmf) ||
|
||||
(protector == W_ARMH && !uarmh) ||
|
||||
(protector == (W_ARMC|W_ARMG) && (!uarmc || !uarmg))) {
|
||||
if (!Stone_resistance &&
|
||||
!(poly_when_stoned(youmonst.data) &&
|
||||
polymon(PM_STONE_GOLEM))) {
|
||||
You("turn to stone...");
|
||||
done_in_by(mon);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AD_RUST:
|
||||
|
||||
Reference in New Issue
Block a user