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(noattacks, (struct permonst *));
|
||||||
E int FDECL(sleep_monst, (struct monst *,int,int));
|
E int FDECL(sleep_monst, (struct monst *,int,int));
|
||||||
E void FDECL(slept_monst, (struct monst *));
|
E void FDECL(slept_monst, (struct monst *));
|
||||||
|
E long FDECL(attk_protection, (int));
|
||||||
|
|
||||||
/* ### mhitu.c ### */
|
/* ### 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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -563,19 +563,20 @@ mdamagem(magr, mdef, mattk)
|
|||||||
register struct monst *magr, *mdef;
|
register struct monst *magr, *mdef;
|
||||||
register struct attack *mattk;
|
register struct attack *mattk;
|
||||||
{
|
{
|
||||||
struct permonst *pa = magr->data, *pd = mdef->data;
|
|
||||||
int tmp = d((int)mattk->damn,(int)mattk->damd);
|
|
||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
int protector =
|
struct permonst *pa = magr->data, *pd = mdef->data;
|
||||||
mattk->aatyp == AT_TENT ? 0 :
|
int num, tmp = d((int)mattk->damn, (int)mattk->damd);
|
||||||
mattk->aatyp == AT_KICK ? W_ARMF : W_ARMG;
|
|
||||||
int num;
|
|
||||||
|
|
||||||
if (touch_petrifies(pd) && !resists_ston(magr) &&
|
if (touch_petrifies(pd) && !resists_ston(magr)) {
|
||||||
(mattk->aatyp != AT_WEAP || !otmp) &&
|
long protector = attk_protection(mattk->aatyp),
|
||||||
(mattk->aatyp != AT_GAZE && mattk->aatyp != AT_EXPL) &&
|
wornitems = magr->misc_worn_check;
|
||||||
!(magr->misc_worn_check & protector)) {
|
|
||||||
|
/* 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)) {
|
if (poly_when_stoned(pa)) {
|
||||||
mon_to_stone(magr);
|
mon_to_stone(magr);
|
||||||
return MM_HIT; /* no damage during the polymorph */
|
return MM_HIT; /* no damage during the polymorph */
|
||||||
@@ -586,6 +587,7 @@ mdamagem(magr, mdef, mattk)
|
|||||||
else if (magr->mtame && !vis)
|
else if (magr->mtame && !vis)
|
||||||
You(brief_feeling, "peculiarly sad");
|
You(brief_feeling, "peculiarly sad");
|
||||||
return MM_AGR_DIED;
|
return MM_AGR_DIED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(mattk->adtyp) {
|
switch(mattk->adtyp) {
|
||||||
@@ -1366,6 +1368,49 @@ int mdead;
|
|||||||
return (mdead | mhit);
|
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 */
|
#endif /* OVLB */
|
||||||
|
|
||||||
/*mhitm.c*/
|
/*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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -2390,15 +2390,16 @@ register struct attack *mattk;
|
|||||||
goto assess_dmg;
|
goto assess_dmg;
|
||||||
case AD_STON: /* cockatrice */
|
case AD_STON: /* cockatrice */
|
||||||
{
|
{
|
||||||
int protector =
|
long protector = attk_protection(mattk->aatyp),
|
||||||
mattk->aatyp == AT_TENT ? 0 :
|
wornitems = mtmp->misc_worn_check;
|
||||||
mattk->aatyp == AT_KICK ? W_ARMF : W_ARMG;
|
|
||||||
if (!resists_ston(mtmp) &&
|
/* wielded weapon gives same protection as gloves here */
|
||||||
(mattk->aatyp != AT_WEAP || !MON_WEP(mtmp)) &&
|
if (MON_WEP(mtmp) != 0) wornitems |= W_ARMG;
|
||||||
mattk->aatyp != AT_GAZE && mattk->aatyp != AT_EXPL &&
|
|
||||||
mattk->aatyp != AT_MAGC &&
|
if (!resists_ston(mtmp) && (protector == 0L ||
|
||||||
!(mtmp->misc_worn_check & protector)) {
|
(protector != ~0L &&
|
||||||
if(poly_when_stoned(mtmp->data)) {
|
(wornitems & protector) != protector))) {
|
||||||
|
if (poly_when_stoned(mtmp->data)) {
|
||||||
mon_to_stone(mtmp);
|
mon_to_stone(mtmp);
|
||||||
return (1);
|
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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -2020,21 +2020,26 @@ uchar aatyp;
|
|||||||
exercise(A_STR, FALSE);
|
exercise(A_STR, FALSE);
|
||||||
break;
|
break;
|
||||||
case AD_STON:
|
case AD_STON:
|
||||||
if(mhit) {
|
if (mhit) { /* successful attack */
|
||||||
/* mhit does not mean you physically hit; it just means the
|
long protector = attk_protection(aatyp);
|
||||||
attack was successful */
|
|
||||||
if ((aatyp == AT_KICK && !uarmf) ||
|
/* hero using monsters' AT_MAGC attack is hitting hand to
|
||||||
((aatyp == AT_WEAP || aatyp == AT_CLAW || aatyp == AT_MAGC
|
hand rather than casting a spell */
|
||||||
|| aatyp == AT_TUCH) && !uwep && !uarmg) ||
|
if (aatyp == AT_MAGC) protector = W_ARMG;
|
||||||
aatyp == AT_BITE || aatyp == AT_STNG || aatyp == AT_BUTT ||
|
|
||||||
aatyp == AT_TENT || aatyp == AT_HUGS || aatyp == AT_ENGL) {
|
if (protector == 0L || /* no protection */
|
||||||
if (!Stone_resistance &&
|
(protector == W_ARMG && !uarmg && !uwep) ||
|
||||||
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
(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...");
|
You("turn to stone...");
|
||||||
done_in_by(mon);
|
done_in_by(mon);
|
||||||
return 2;
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AD_RUST:
|
case AD_RUST:
|
||||||
|
|||||||
Reference in New Issue
Block a user