fix #H8215 - monster intrinsics from worn gear
Fixes #177 The monst struct has 'mintrinsics' field which attempts to handle both mon->data->mresists and extrinsics supplied by worn armor, but polymorph/shape-change was clobbering the extrinsics side of things. Potentially fixing that by changing newcham() to use set_mon_data(...,1) instead of (...,0) solved that but exposed two other bugs. Intrinsics from the old form carried over to the new form along with extrinsics from worn armor, and update_mon_intrinsics() for armor being destroyed or dropped only worked as intended if the armor->owornmask was cleared beforehand--some places were clearing it after, so extrinsics from worn gear could persist even after that gear was gone. So, fixing the set_mon_data() call in newcham() was a no go. This fixes update_mon_intrinsics() and adopts the suggested code from github pull request #177 to have mon->mintrinsics only handle worn gear instead of trying to overload innate intrinsics with that. This is a superset of that; the flag argument to set_mon_data() is gone and mon->mintrinsics has been renamed mon->mextrinsics. (The routine update_mon_intrinsics() ought to be renamed too, but I didn't do that.)
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 extern.h $NHDT-Date: 1549921169 2019/02/11 21:39:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.693 $ */
|
/* NetHack 3.6 extern.h $NHDT-Date: 1550524545 2019/02/18 21:15:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.694 $ */
|
||||||
/* Copyright (c) Steve Creps, 1988. */
|
/* Copyright (c) Steve Creps, 1988. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1437,7 +1437,7 @@ E boolean FDECL(vamp_stone, (struct monst *));
|
|||||||
|
|
||||||
/* ### mondata.c ### */
|
/* ### mondata.c ### */
|
||||||
|
|
||||||
E void FDECL(set_mon_data, (struct monst *, struct permonst *, int));
|
E void FDECL(set_mon_data, (struct monst *, struct permonst *));
|
||||||
E struct attack *FDECL(attacktype_fordmg, (struct permonst *, int, int));
|
E struct attack *FDECL(attacktype_fordmg, (struct permonst *, int, int));
|
||||||
E boolean FDECL(attacktype, (struct permonst *, int));
|
E boolean FDECL(attacktype, (struct permonst *, int));
|
||||||
E boolean FDECL(noattacks, (struct permonst *));
|
E boolean FDECL(noattacks, (struct permonst *));
|
||||||
|
|||||||
+17
-9
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mondata.h $NHDT-Date: 1548209737 2019/01/23 02:15:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.36 $ */
|
/* NetHack 3.6 mondata.h $NHDT-Date: 1550524558 2019/02/18 21:15:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.37 $ */
|
||||||
/* Copyright (c) 1989 Mike Threepoint */
|
/* Copyright (c) 1989 Mike Threepoint */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -10,14 +10,22 @@
|
|||||||
|
|
||||||
#define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0)
|
#define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0)
|
||||||
|
|
||||||
#define resists_fire(mon) (((mon)->mintrinsics & MR_FIRE) != 0)
|
#define resists_fire(mon) \
|
||||||
#define resists_cold(mon) (((mon)->mintrinsics & MR_COLD) != 0)
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_FIRE) != 0)
|
||||||
#define resists_sleep(mon) (((mon)->mintrinsics & MR_SLEEP) != 0)
|
#define resists_cold(mon) \
|
||||||
#define resists_disint(mon) (((mon)->mintrinsics & MR_DISINT) != 0)
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_COLD) != 0)
|
||||||
#define resists_elec(mon) (((mon)->mintrinsics & MR_ELEC) != 0)
|
#define resists_sleep(mon) \
|
||||||
#define resists_poison(mon) (((mon)->mintrinsics & MR_POISON) != 0)
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_SLEEP) != 0)
|
||||||
#define resists_acid(mon) (((mon)->mintrinsics & MR_ACID) != 0)
|
#define resists_disint(mon) \
|
||||||
#define resists_ston(mon) (((mon)->mintrinsics & MR_STONE) != 0)
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_DISINT) != 0)
|
||||||
|
#define resists_elec(mon) \
|
||||||
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_ELEC) != 0)
|
||||||
|
#define resists_poison(mon) \
|
||||||
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_POISON) != 0)
|
||||||
|
#define resists_acid(mon) \
|
||||||
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_ACID) != 0)
|
||||||
|
#define resists_ston(mon) \
|
||||||
|
((((mon)->data->mresists | (mon)->mextrinsics) & MR_STONE) != 0)
|
||||||
|
|
||||||
#define is_lminion(mon) \
|
#define is_lminion(mon) \
|
||||||
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
(is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL)
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 monst.h $NHDT-Date: 1547428769 2019/01/14 01:19:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.27 $ */
|
/* NetHack 3.6 monst.h $NHDT-Date: 1550524559 2019/02/18 21:15:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2016. */
|
/*-Copyright (c) Robert Patrick Rankin, 2016. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -70,7 +70,7 @@ struct monst {
|
|||||||
uchar m_ap_type; /* what mappearance is describing, m_ap_types */
|
uchar m_ap_type; /* what mappearance is describing, m_ap_types */
|
||||||
|
|
||||||
schar mtame; /* level of tameness, implies peaceful */
|
schar mtame; /* level of tameness, implies peaceful */
|
||||||
unsigned short mintrinsics; /* low 8 correspond to mresists */
|
unsigned short mextrinsics; /* low 8 correspond to mresists */
|
||||||
int mspec_used; /* monster's special ability attack timeout */
|
int mspec_used; /* monster's special ability attack timeout */
|
||||||
|
|
||||||
Bitfield(female, 1); /* is female */
|
Bitfield(female, 1); /* is female */
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 makemon.c $NHDT-Date: 1544998885 2018/12/16 22:21:25 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */
|
/* NetHack 3.6 makemon.c $NHDT-Date: 1550524560 2019/02/18 21:16:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.132 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1200,7 +1200,7 @@ int mmflags;
|
|||||||
mtmp->m_id = context.ident++;
|
mtmp->m_id = context.ident++;
|
||||||
if (!mtmp->m_id)
|
if (!mtmp->m_id)
|
||||||
mtmp->m_id = context.ident++; /* ident overflowed */
|
mtmp->m_id = context.ident++; /* ident overflowed */
|
||||||
set_mon_data(mtmp, ptr, 0);
|
set_mon_data(mtmp, ptr); /* mtmp->data = ptr; */
|
||||||
if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
|
if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx)
|
||||||
quest_status.leader_m_id = mtmp->m_id;
|
quest_status.leader_m_id = mtmp->m_id;
|
||||||
mtmp->mnum = mndx;
|
mtmp->mnum = mndx;
|
||||||
@@ -1863,7 +1863,7 @@ struct monst *mtmp, *victim;
|
|||||||
pline("As %s grows up into %s, %s %s!", mon_nam(mtmp),
|
pline("As %s grows up into %s, %s %s!", mon_nam(mtmp),
|
||||||
an(ptr->mname), mhe(mtmp),
|
an(ptr->mname), mhe(mtmp),
|
||||||
nonliving(ptr) ? "expires" : "dies");
|
nonliving(ptr) ? "expires" : "dies");
|
||||||
set_mon_data(mtmp, ptr, -1); /* keep mvitals[] accurate */
|
set_mon_data(mtmp, ptr); /* keep mvitals[] accurate */
|
||||||
mondied(mtmp);
|
mondied(mtmp);
|
||||||
return (struct permonst *) 0;
|
return (struct permonst *) 0;
|
||||||
} else if (canspotmon(mtmp)) {
|
} else if (canspotmon(mtmp)) {
|
||||||
@@ -1886,7 +1886,7 @@ struct monst *mtmp, *victim;
|
|||||||
: "grows up into",
|
: "grows up into",
|
||||||
an(buf));
|
an(buf));
|
||||||
}
|
}
|
||||||
set_mon_data(mtmp, ptr, 1); /* preserve intrinsics */
|
set_mon_data(mtmp, ptr);
|
||||||
newsym(mtmp->mx, mtmp->my); /* color may change */
|
newsym(mtmp->mx, mtmp->my); /* color may change */
|
||||||
lev_limit = (int) mtmp->m_lev; /* never undo increment */
|
lev_limit = (int) mtmp->m_lev; /* never undo increment */
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mon.c $NHDT-Date: 1548937318 2019/01/31 12:21:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.278 $ */
|
/* NetHack 3.6 mon.c $NHDT-Date: 1550524562 2019/02/18 21:16:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.279 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1991,14 +1991,14 @@ register struct monst *mtmp;
|
|||||||
mptr = mtmp->data; /* save this for m_detach() */
|
mptr = mtmp->data; /* save this for m_detach() */
|
||||||
/* restore chameleon, lycanthropes to true form at death */
|
/* restore chameleon, lycanthropes to true form at death */
|
||||||
if (mtmp->cham >= LOW_PM) {
|
if (mtmp->cham >= LOW_PM) {
|
||||||
set_mon_data(mtmp, &mons[mtmp->cham], -1);
|
set_mon_data(mtmp, &mons[mtmp->cham]);
|
||||||
mtmp->cham = NON_PM;
|
mtmp->cham = NON_PM;
|
||||||
} else if (mtmp->data == &mons[PM_WEREJACKAL])
|
} else if (mtmp->data == &mons[PM_WEREJACKAL])
|
||||||
set_mon_data(mtmp, &mons[PM_HUMAN_WEREJACKAL], -1);
|
set_mon_data(mtmp, &mons[PM_HUMAN_WEREJACKAL]);
|
||||||
else if (mtmp->data == &mons[PM_WEREWOLF])
|
else if (mtmp->data == &mons[PM_WEREWOLF])
|
||||||
set_mon_data(mtmp, &mons[PM_HUMAN_WEREWOLF], -1);
|
set_mon_data(mtmp, &mons[PM_HUMAN_WEREWOLF]);
|
||||||
else if (mtmp->data == &mons[PM_WERERAT])
|
else if (mtmp->data == &mons[PM_WERERAT])
|
||||||
set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT], -1);
|
set_mon_data(mtmp, &mons[PM_HUMAN_WERERAT]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mvitals[].died does double duty as total number of dead monsters
|
* mvitals[].died does double duty as total number of dead monsters
|
||||||
@@ -3573,7 +3573,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
mtmp->mhp = 1;
|
mtmp->mhp = 1;
|
||||||
|
|
||||||
/* take on the new form... */
|
/* take on the new form... */
|
||||||
set_mon_data(mtmp, mdat, 0);
|
set_mon_data(mtmp, mdat);
|
||||||
|
|
||||||
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
||||||
/* used to give light, now doesn't, or vice versa,
|
/* used to give light, now doesn't, or vice versa,
|
||||||
|
|||||||
+2
-10
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mondata.c $NHDT-Date: 1546465283 2019/01/02 21:41:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.70 $ */
|
/* NetHack 3.6 mondata.c $NHDT-Date: 1550524563 2019/02/18 21:16:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -10,22 +10,14 @@
|
|||||||
|
|
||||||
/* set up an individual monster's base type (initial creation, shapechange) */
|
/* set up an individual monster's base type (initial creation, shapechange) */
|
||||||
void
|
void
|
||||||
set_mon_data(mon, ptr, flag)
|
set_mon_data(mon, ptr)
|
||||||
struct monst *mon;
|
struct monst *mon;
|
||||||
struct permonst *ptr;
|
struct permonst *ptr;
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
int new_speed, old_speed = mon->data ? mon->data->mmove : 0;
|
int new_speed, old_speed = mon->data ? mon->data->mmove : 0;
|
||||||
|
|
||||||
mon->data = ptr;
|
mon->data = ptr;
|
||||||
mon->mnum = (short) monsndx(ptr);
|
mon->mnum = (short) monsndx(ptr);
|
||||||
if (flag == -1)
|
|
||||||
return; /* "don't care" */
|
|
||||||
|
|
||||||
if (flag == 1)
|
|
||||||
mon->mintrinsics |= (ptr->mresists & 0x00FF);
|
|
||||||
else
|
|
||||||
mon->mintrinsics = (ptr->mresists & 0x00FF);
|
|
||||||
|
|
||||||
if (mon->movement) { /* same adjustment as poly'd hero undergoes */
|
if (mon->movement) { /* same adjustment as poly'd hero undergoes */
|
||||||
new_speed = ptr->mmove;
|
new_speed = ptr->mmove;
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mplayer.c $NHDT-Date: 1545964576 2018/12/28 02:36:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */
|
/* NetHack 3.6 mplayer.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.26 $ */
|
||||||
/* Copyright (c) Izchak Miller, 1992. */
|
/* Copyright (c) Izchak Miller, 1992. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ boolean special;
|
|||||||
|
|
||||||
/* roll for character class */
|
/* roll for character class */
|
||||||
pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
|
pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
|
||||||
set_mon_data(&fakemon, &mons[pm], -1);
|
set_mon_data(&fakemon, &mons[pm]);
|
||||||
|
|
||||||
/* roll for an available location */
|
/* roll for an available location */
|
||||||
do {
|
do {
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 polyself.c $NHDT-Date: 1548208238 2019/01/23 01:50:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.126 $ */
|
/* NetHack 3.6 polyself.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */
|
||||||
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
|
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ set_uasmon()
|
|||||||
struct permonst *mdat = &mons[u.umonnum];
|
struct permonst *mdat = &mons[u.umonnum];
|
||||||
int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0;
|
int new_speed, old_speed = youmonst.data ? youmonst.data->mmove : 0;
|
||||||
|
|
||||||
set_mon_data(&youmonst, mdat, 0);
|
set_mon_data(&youmonst, mdat);
|
||||||
|
|
||||||
#define PROPSET(PropIndx, ON) \
|
#define PROPSET(PropIndx, ON) \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1545946257 2018/12/27 21:30:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.109 $ */
|
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1550524566 2019/02/18 21:16:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */
|
||||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1754,7 +1754,7 @@ struct mkroom *croom;
|
|||||||
struct permonst *olddata = mtmp->data;
|
struct permonst *olddata = mtmp->data;
|
||||||
|
|
||||||
mgender_from_permonst(mtmp, mdat);
|
mgender_from_permonst(mtmp, mdat);
|
||||||
set_mon_data(mtmp, mdat, 0);
|
set_mon_data(mtmp, mdat);
|
||||||
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
||||||
/* used to give light, now doesn't, or vice versa,
|
/* used to give light, now doesn't, or vice versa,
|
||||||
or light's range has changed */
|
or light's range has changed */
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 teleport.c $NHDT-Date: 1549157815 2019/02/03 01:36:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */
|
/* NetHack 3.6 teleport.c $NHDT-Date: 1550524567 2019/02/18 21:16:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -130,7 +130,7 @@ unsigned entflags;
|
|||||||
mdat = &mons[u.umonster];
|
mdat = &mons[u.umonster];
|
||||||
}
|
}
|
||||||
fakemon = zeromonst;
|
fakemon = zeromonst;
|
||||||
set_mon_data(&fakemon, mdat, -1); /* set up for goodpos */
|
set_mon_data(&fakemon, mdat); /* set up for goodpos */
|
||||||
|
|
||||||
good_ptr = good;
|
good_ptr = good;
|
||||||
range = 1;
|
range = 1;
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 were.c $NHDT-Date: 1505214877 2017/09/12 11:14:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
|
/* NetHack 3.6 were.c $NHDT-Date: 1550524568 2019/02/18 21:16:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.23 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -107,7 +107,7 @@ register struct monst *mon;
|
|||||||
pline("%s changes into a %s.", Monnam(mon),
|
pline("%s changes into a %s.", Monnam(mon),
|
||||||
is_human(&mons[pm]) ? "human" : mons[pm].mname + 4);
|
is_human(&mons[pm]) ? "human" : mons[pm].mname + 4);
|
||||||
|
|
||||||
set_mon_data(mon, &mons[pm], 0);
|
set_mon_data(mon, &mons[pm]);
|
||||||
if (mon->msleeping || !mon->mcanmove) {
|
if (mon->msleeping || !mon->mcanmove) {
|
||||||
/* transformation wakens and/or revitalizes */
|
/* transformation wakens and/or revitalizes */
|
||||||
mon->msleeping = 0;
|
mon->msleeping = 0;
|
||||||
|
|||||||
+14
-16
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 worn.c $NHDT-Date: 1537234121 2018/09/18 01:28:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.55 $ */
|
/* NetHack 3.6 worn.c $NHDT-Date: 1550524569 2019/02/18 21:16:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -317,7 +317,8 @@ struct obj *obj; /* item to make known if effect can be seen */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* armor put on or taken off; might be magical variety */
|
/* armor put on or taken off; might be magical variety
|
||||||
|
[TODO: rename to 'update_mon_extrinsics()' and change all callers...] */
|
||||||
void
|
void
|
||||||
update_mon_intrinsics(mon, obj, on, silently)
|
update_mon_intrinsics(mon, obj, on, silently)
|
||||||
struct monst *mon;
|
struct monst *mon;
|
||||||
@@ -369,7 +370,7 @@ boolean on, silently;
|
|||||||
if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */
|
if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */
|
||||||
/* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */
|
/* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */
|
||||||
mask = (uchar) (1 << (which - 1));
|
mask = (uchar) (1 << (which - 1));
|
||||||
mon->mintrinsics |= (unsigned short) mask;
|
mon->mextrinsics |= (unsigned short) mask;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -395,25 +396,22 @@ boolean on, silently;
|
|||||||
case ACID_RES:
|
case ACID_RES:
|
||||||
case STONE_RES:
|
case STONE_RES:
|
||||||
mask = (uchar) (1 << (which - 1));
|
mask = (uchar) (1 << (which - 1));
|
||||||
/* If the monster doesn't have this resistance intrinsically,
|
/* update monster's extrinsics (for worn objects only;
|
||||||
check whether any other worn item confers it. Note that
|
'obj' itself might still be worn or already unworn) */
|
||||||
we don't currently check for anything conferred via simply
|
for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
|
||||||
carrying an object. */
|
if (otmp != obj
|
||||||
if (!(mon->data->mresists & mask)) {
|
&& otmp->owornmask
|
||||||
for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
|
&& (int) objects[otmp->otyp].oc_oprop == which)
|
||||||
if (otmp->owornmask
|
break;
|
||||||
&& (int) objects[otmp->otyp].oc_oprop == which)
|
if (!otmp)
|
||||||
break;
|
mon->mextrinsics &= ~((unsigned short) mask);
|
||||||
if (!otmp)
|
|
||||||
mon->mintrinsics &= ~((unsigned short) mask);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_blocks:
|
maybe_blocks:
|
||||||
/* obj->owornmask has been cleared by this point, so we can't use it.
|
/* obj->owornmask has been cleared by this point, so we can't use it.
|
||||||
However, since monsters don't wield armor, we don't have to guard
|
However, since monsters don't wield armor, we don't have to guard
|
||||||
against that and can get away with a blanket worn-mask value. */
|
against that and can get away with a blanket worn-mask value. */
|
||||||
|
|||||||
Reference in New Issue
Block a user