replace x >= LOW_PM with ismnum(x) shorthand macro
This commit is contained in:
@@ -285,4 +285,7 @@ struct monst {
|
|||||||
#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)
|
||||||
|
|
||||||
|
/* x is a valid index into mons[] array */
|
||||||
|
#define ismnum(x) ((x) >= LOW_PM && (x) < NUMMONS)
|
||||||
|
|
||||||
#endif /* MONST_H */
|
#endif /* MONST_H */
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ enum monnums {
|
|||||||
NUMMONS,
|
NUMMONS,
|
||||||
NON_PM = -1, /* "not a monster */
|
NON_PM = -1, /* "not a monster */
|
||||||
LOW_PM = NON_PM + 1, /* first monster in mons */
|
LOW_PM = NON_PM + 1, /* first monster in mons */
|
||||||
|
LEAVESTATUE = NON_PM - 1, /* leave statue instead of corpse;
|
||||||
|
* there are two lower values assigned
|
||||||
|
* in end.c so that (x == LEAVESTATUE)
|
||||||
|
* will test FALSE in bones.c:
|
||||||
|
* (NON_PM - 2) for no corpse
|
||||||
|
* (NON_PM - 3) for no corpse, no grave */
|
||||||
|
HIGH_PM = NUMMONS - 1,
|
||||||
SPECIAL_PM = PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */
|
SPECIAL_PM = PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */
|
||||||
/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are
|
/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are
|
||||||
never generated randomly and cannot be polymorphed into */
|
never generated randomly and cannot be polymorphed into */
|
||||||
|
|||||||
+1
-1
@@ -297,7 +297,7 @@ moveloop_core(void)
|
|||||||
mvl_change = 0;
|
mvl_change = 0;
|
||||||
if (Polymorph && !rn2(100))
|
if (Polymorph && !rn2(100))
|
||||||
mvl_change = 1;
|
mvl_change = 1;
|
||||||
else if (u.ulycn >= LOW_PM && !Upolyd
|
else if (ismnum(u.ulycn) && !Upolyd
|
||||||
&& !rn2(80 - (20 * night())))
|
&& !rn2(80 - (20 * night())))
|
||||||
mvl_change = 2;
|
mvl_change = 2;
|
||||||
if (mvl_change && !Unchanging) {
|
if (mvl_change && !Unchanging) {
|
||||||
|
|||||||
+1
-1
@@ -930,7 +930,7 @@ spec_applies(const struct artifact *weap, struct monst *mtmp)
|
|||||||
return ((ptr->mflags2 & weap->mtype)
|
return ((ptr->mflags2 & weap->mtype)
|
||||||
|| (yours
|
|| (yours
|
||||||
&& ((!Upolyd && (gu.urace.selfmask & weap->mtype))
|
&& ((!Upolyd && (gu.urace.selfmask & weap->mtype))
|
||||||
|| ((weap->mtype & M2_WERE) && u.ulycn >= LOW_PM))));
|
|| ((weap->mtype & M2_WERE) && ismnum(u.ulycn)))));
|
||||||
} else if (weap->spfx & SPFX_DALIGN) {
|
} else if (weap->spfx & SPFX_DALIGN) {
|
||||||
return yours ? (u.ualign.type != weap->alignment)
|
return yours ? (u.ualign.type != weap->alignment)
|
||||||
: (ptr->maligntyp == A_NONE
|
: (ptr->maligntyp == A_NONE
|
||||||
|
|||||||
+2
-2
@@ -338,7 +338,7 @@ poisoned(
|
|||||||
|
|
||||||
/* suppress killer prefix if it already has one */
|
/* suppress killer prefix if it already has one */
|
||||||
i = name_to_mon(pkiller, (int *) 0);
|
i = name_to_mon(pkiller, (int *) 0);
|
||||||
if (i >= LOW_PM && (mons[i].geno & G_UNIQ)) {
|
if (ismnum(i) && (mons[i].geno & G_UNIQ)) {
|
||||||
kprefix = KILLED_BY;
|
kprefix = KILLED_BY;
|
||||||
if (!type_is_pname(&mons[i]))
|
if (!type_is_pname(&mons[i]))
|
||||||
pkiller = the(pkiller);
|
pkiller = the(pkiller);
|
||||||
@@ -837,7 +837,7 @@ is_innate(int propidx)
|
|||||||
int innateness;
|
int innateness;
|
||||||
|
|
||||||
/* innately() would report FROM_FORM for this; caller wants specificity */
|
/* innately() would report FROM_FORM for this; caller wants specificity */
|
||||||
if (propidx == DRAIN_RES && u.ulycn >= LOW_PM)
|
if (propidx == DRAIN_RES && ismnum(u.ulycn))
|
||||||
return FROM_LYCN;
|
return FROM_LYCN;
|
||||||
if (propidx == FAST && Very_fast)
|
if (propidx == FAST && Very_fast)
|
||||||
return FROM_NONE; /* can't become very fast innately */
|
return FROM_NONE; /* can't become very fast innately */
|
||||||
|
|||||||
+27
-27
@@ -139,7 +139,7 @@ resetobjs(struct obj *ochain, boolean restore)
|
|||||||
otmp->spe = 0; /* not "laid by you" in next game */
|
otmp->spe = 0; /* not "laid by you" in next game */
|
||||||
} else if (otmp->otyp == TIN) {
|
} else if (otmp->otyp == TIN) {
|
||||||
/* make tins of unique monster's meat be empty */
|
/* make tins of unique monster's meat be empty */
|
||||||
if (otmp->corpsenm >= LOW_PM
|
if (ismnum(otmp->corpsenm)
|
||||||
&& unique_corpstat(&mons[otmp->corpsenm]))
|
&& unique_corpstat(&mons[otmp->corpsenm]))
|
||||||
otmp->corpsenm = NON_PM;
|
otmp->corpsenm = NON_PM;
|
||||||
} else if (otmp->otyp == CORPSE || otmp->otyp == STATUE) {
|
} else if (otmp->otyp == CORPSE || otmp->otyp == STATUE) {
|
||||||
@@ -451,32 +451,7 @@ savebones(int how, time_t when, struct obj *corpse)
|
|||||||
|
|
||||||
set_ghostly_objlist(gi.invent);
|
set_ghostly_objlist(gi.invent);
|
||||||
/* dispose of your possessions, usually cursed */
|
/* dispose of your possessions, usually cursed */
|
||||||
if (u.ugrave_arise == (NON_PM - 1)) {
|
if (ismnum(u.ugrave_arise)) {
|
||||||
struct obj *otmp;
|
|
||||||
|
|
||||||
/* embed your possessions in your statue */
|
|
||||||
otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy,
|
|
||||||
gp.plname);
|
|
||||||
|
|
||||||
drop_upon_death((struct monst *) 0, otmp, u.ux, u.uy);
|
|
||||||
if (!otmp)
|
|
||||||
return; /* couldn't make statue */
|
|
||||||
mtmp = (struct monst *) 0;
|
|
||||||
} else if (u.ugrave_arise < LOW_PM) {
|
|
||||||
/* drop everything */
|
|
||||||
drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy);
|
|
||||||
/* trick makemon() into allowing monster creation
|
|
||||||
* on your location
|
|
||||||
*/
|
|
||||||
gi.in_mklev = TRUE;
|
|
||||||
mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NONAME);
|
|
||||||
gi.in_mklev = FALSE;
|
|
||||||
if (!mtmp)
|
|
||||||
return;
|
|
||||||
mtmp = christen_monst(mtmp, gp.plname);
|
|
||||||
if (corpse)
|
|
||||||
(void) obj_attach_mid(corpse, mtmp->m_id);
|
|
||||||
} else {
|
|
||||||
/* give your possessions to the monster you become */
|
/* give your possessions to the monster you become */
|
||||||
gi.in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
|
gi.in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
|
||||||
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
|
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
|
||||||
@@ -498,6 +473,31 @@ savebones(int how, time_t when, struct obj *corpse)
|
|||||||
if (mtmp->data->mlet == S_MUMMY && !m_carrying(mtmp, MUMMY_WRAPPING))
|
if (mtmp->data->mlet == S_MUMMY && !m_carrying(mtmp, MUMMY_WRAPPING))
|
||||||
(void) mongets(mtmp, MUMMY_WRAPPING);
|
(void) mongets(mtmp, MUMMY_WRAPPING);
|
||||||
m_dowear(mtmp, TRUE);
|
m_dowear(mtmp, TRUE);
|
||||||
|
} else if (u.ugrave_arise == LEAVESTATUE) {
|
||||||
|
struct obj *otmp;
|
||||||
|
|
||||||
|
/* embed your possessions in your statue */
|
||||||
|
otmp = mk_named_object(STATUE, &mons[u.umonnum], u.ux, u.uy,
|
||||||
|
gp.plname);
|
||||||
|
|
||||||
|
drop_upon_death((struct monst *) 0, otmp, u.ux, u.uy);
|
||||||
|
if (!otmp)
|
||||||
|
return; /* couldn't make statue */
|
||||||
|
mtmp = (struct monst *) 0;
|
||||||
|
} else { /* u.ugrave_arise < LEAVESTATUE */
|
||||||
|
/* drop everything */
|
||||||
|
drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy);
|
||||||
|
/* trick makemon() into allowing monster creation
|
||||||
|
* on your location
|
||||||
|
*/
|
||||||
|
gi.in_mklev = TRUE;
|
||||||
|
mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NONAME);
|
||||||
|
gi.in_mklev = FALSE;
|
||||||
|
if (!mtmp)
|
||||||
|
return;
|
||||||
|
mtmp = christen_monst(mtmp, gp.plname);
|
||||||
|
if (corpse)
|
||||||
|
(void) obj_attach_mid(corpse, mtmp->m_id);
|
||||||
}
|
}
|
||||||
if (mtmp) {
|
if (mtmp) {
|
||||||
mtmp->m_lev = (u.ulevel ? u.ulevel : 1);
|
mtmp->m_lev = (u.ulevel ? u.ulevel : 1);
|
||||||
|
|||||||
+2
-2
@@ -2419,12 +2419,12 @@ obj_pmname(struct obj *obj)
|
|||||||
struct monst *m = OMONST(obj);
|
struct monst *m = OMONST(obj);
|
||||||
|
|
||||||
/* obj->oextra->omonst->data is Null but ...->mnum is set */
|
/* obj->oextra->omonst->data is Null but ...->mnum is set */
|
||||||
if (m->mnum >= LOW_PM)
|
if (ismnum(m->mnum))
|
||||||
return pmname(&mons[m->mnum], m->female ? FEMALE : MALE);
|
return pmname(&mons[m->mnum], m->female ? FEMALE : MALE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((obj->otyp == CORPSE || obj->otyp == STATUE || obj->otyp == FIGURINE)
|
if ((obj->otyp == CORPSE || obj->otyp == STATUE || obj->otyp == FIGURINE)
|
||||||
&& obj->corpsenm >= LOW_PM) {
|
&& ismnum(obj->corpsenm)) {
|
||||||
int cgend = (obj->spe & CORPSTAT_GENDER),
|
int cgend = (obj->spe & CORPSTAT_GENDER),
|
||||||
mgend = ((cgend == CORPSTAT_MALE) ? MALE
|
mgend = ((cgend == CORPSTAT_MALE) ? MALE
|
||||||
: (cgend == CORPSTAT_FEMALE) ? FEMALE
|
: (cgend == CORPSTAT_FEMALE) ? FEMALE
|
||||||
|
|||||||
@@ -933,7 +933,7 @@ dogfood(struct monst *mon, struct obj *obj)
|
|||||||
? obj->corpsenm
|
? obj->corpsenm
|
||||||
: NON_PM;
|
: NON_PM;
|
||||||
/* mons[NUMMONS] is valid; predicate tests against it will fail */
|
/* mons[NUMMONS] is valid; predicate tests against it will fail */
|
||||||
fptr = &mons[(fx >= LOW_PM) ? fx : NUMMONS];
|
fptr = &mons[(ismnum(fx)) ? fx : NUMMONS];
|
||||||
|
|
||||||
if (obj->otyp == CORPSE && is_rider(fptr))
|
if (obj->otyp == CORPSE && is_rider(fptr))
|
||||||
return TABU;
|
return TABU;
|
||||||
@@ -1103,7 +1103,7 @@ tamedog(struct monst *mtmp, struct obj *obj)
|
|||||||
/* pet will "catch" and eat this thrown food */
|
/* pet will "catch" and eat this thrown food */
|
||||||
if (canseemon(mtmp)) {
|
if (canseemon(mtmp)) {
|
||||||
boolean big_corpse =
|
boolean big_corpse =
|
||||||
(obj->otyp == CORPSE && obj->corpsenm >= LOW_PM
|
(obj->otyp == CORPSE && ismnum(obj->corpsenm)
|
||||||
&& mons[obj->corpsenm].msize > mtmp->data->msize);
|
&& mons[obj->corpsenm].msize > mtmp->data->msize);
|
||||||
pline("%s catches %s%s", Monnam(mtmp), the(xname(obj)),
|
pline("%s catches %s%s", Monnam(mtmp), the(xname(obj)),
|
||||||
!big_corpse ? "." : ", or vice versa!");
|
!big_corpse ? "." : ", or vice versa!");
|
||||||
|
|||||||
+2
-2
@@ -440,7 +440,7 @@ container_impact_dmg(
|
|||||||
|
|
||||||
/* eggs laid by you. penalty is -1 per egg, max 5,
|
/* eggs laid by you. penalty is -1 per egg, max 5,
|
||||||
* but it's always exactly 1 that breaks */
|
* but it's always exactly 1 that breaks */
|
||||||
if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM)
|
if (otmp->otyp == EGG && otmp->spe && ismnum(otmp->corpsenm))
|
||||||
change_luck(-1);
|
change_luck(-1);
|
||||||
if (otmp->otyp == EGG) {
|
if (otmp->otyp == EGG) {
|
||||||
Soundeffect(se_egg_cracking, 25);
|
Soundeffect(se_egg_cracking, 25);
|
||||||
@@ -1699,7 +1699,7 @@ ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj)
|
|||||||
result = "crash";
|
result = "crash";
|
||||||
} else {
|
} else {
|
||||||
/* penalty for breaking eggs laid by you */
|
/* penalty for breaking eggs laid by you */
|
||||||
if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM)
|
if (otmp->otyp == EGG && otmp->spe && ismnum(otmp->corpsenm))
|
||||||
change_luck((schar) -min(otmp->quan, 5L));
|
change_luck((schar) -min(otmp->quan, 5L));
|
||||||
result = "splat";
|
result = "splat";
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1263,7 +1263,7 @@ toss_up(struct obj *obj, boolean hitsroof)
|
|||||||
const char *action;
|
const char *action;
|
||||||
int otyp = obj->otyp;
|
int otyp = obj->otyp;
|
||||||
boolean petrifier = ((otyp == EGG || otyp == CORPSE)
|
boolean petrifier = ((otyp == EGG || otyp == CORPSE)
|
||||||
&& obj->corpsenm >= LOW_PM
|
&& ismnum(obj->corpsenm)
|
||||||
&& touch_petrifies(&mons[obj->corpsenm]));
|
&& touch_petrifies(&mons[obj->corpsenm]));
|
||||||
/* note: obj->quan == 1 */
|
/* note: obj->quan == 1 */
|
||||||
|
|
||||||
@@ -2479,7 +2479,7 @@ breakobj(
|
|||||||
break;
|
break;
|
||||||
case EGG:
|
case EGG:
|
||||||
/* breaking your own eggs is bad luck */
|
/* breaking your own eggs is bad luck */
|
||||||
if (hero_caused && obj->spe && obj->corpsenm >= LOW_PM)
|
if (hero_caused && obj->spe && ismnum(obj->corpsenm))
|
||||||
change_luck((schar) -min(obj->quan, 5L));
|
change_luck((schar) -min(obj->quan, 5L));
|
||||||
break;
|
break;
|
||||||
case BOULDER:
|
case BOULDER:
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ maybe_cannibal(int pm, boolean allowmsg)
|
|||||||
about cannibalism--hero's innate traits aren't altered) */
|
about cannibalism--hero's innate traits aren't altered) */
|
||||||
&& (your_race(fptr)
|
&& (your_race(fptr)
|
||||||
|| (Upolyd && same_race(gy.youmonst.data, fptr))
|
|| (Upolyd && same_race(gy.youmonst.data, fptr))
|
||||||
|| (u.ulycn >= LOW_PM && were_beastie(pm) == u.ulycn))) {
|
|| (ismnum(u.ulycn) && were_beastie(pm) == u.ulycn))) {
|
||||||
if (allowmsg) {
|
if (allowmsg) {
|
||||||
if (Upolyd && your_race(fptr))
|
if (Upolyd && your_race(fptr))
|
||||||
You("have a bad feeling deep inside.");
|
You("have a bad feeling deep inside.");
|
||||||
@@ -1272,7 +1272,7 @@ cpostfx(int pm)
|
|||||||
givit(tmp, ptr);
|
givit(tmp, ptr);
|
||||||
} /* check_intrinsics */
|
} /* check_intrinsics */
|
||||||
|
|
||||||
if (catch_lycanthropy >= LOW_PM) {
|
if (ismnum(catch_lycanthropy)) {
|
||||||
set_ulycn(catch_lycanthropy);
|
set_ulycn(catch_lycanthropy);
|
||||||
retouch_equipment(2);
|
retouch_equipment(2);
|
||||||
}
|
}
|
||||||
@@ -1431,7 +1431,7 @@ set_tin_variety(struct obj *obj, int forcetype)
|
|||||||
r = forcetype;
|
r = forcetype;
|
||||||
} else { /* RANDOM_TIN */
|
} else { /* RANDOM_TIN */
|
||||||
r = rn2(TTSZ - 1); /* take your pick */
|
r = rn2(TTSZ - 1); /* take your pick */
|
||||||
if (r == ROTTEN_TIN && (mnum >= LOW_PM && nonrotting_corpse(mnum)))
|
if (r == ROTTEN_TIN && (ismnum(mnum) && nonrotting_corpse(mnum)))
|
||||||
r = HOMEMADE_TIN; /* lizards don't rot */
|
r = HOMEMADE_TIN; /* lizards don't rot */
|
||||||
}
|
}
|
||||||
obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
|
obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
|
||||||
@@ -1458,7 +1458,7 @@ tin_variety(
|
|||||||
if (!displ && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
|
if (!displ && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
|
||||||
r = ROTTEN_TIN; /* some homemade tins go bad */
|
r = ROTTEN_TIN; /* some homemade tins go bad */
|
||||||
|
|
||||||
if (r == ROTTEN_TIN && (mnum >= LOW_PM && nonrotting_corpse(mnum)))
|
if (r == ROTTEN_TIN && (ismnum(mnum) && nonrotting_corpse(mnum)))
|
||||||
r = HOMEMADE_TIN; /* lizards don't rot */
|
r = HOMEMADE_TIN; /* lizards don't rot */
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -1766,7 +1766,7 @@ eatcorpse(struct obj *otmp)
|
|||||||
&& !slimeproof(gy.youmonst.data)),
|
&& !slimeproof(gy.youmonst.data)),
|
||||||
glob = otmp->globby ? TRUE : FALSE;
|
glob = otmp->globby ? TRUE : FALSE;
|
||||||
|
|
||||||
assert(mnum >= LOW_PM);
|
assert(ismnum(mnum));
|
||||||
stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
|
stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
|
||||||
&& !poly_when_stoned(gy.youmonst.data));
|
&& !poly_when_stoned(gy.youmonst.data));
|
||||||
|
|
||||||
@@ -2398,7 +2398,7 @@ fpostfx(struct obj *otmp)
|
|||||||
{
|
{
|
||||||
switch (otmp->otyp) {
|
switch (otmp->otyp) {
|
||||||
case SPRIG_OF_WOLFSBANE:
|
case SPRIG_OF_WOLFSBANE:
|
||||||
if (u.ulycn >= LOW_PM || is_were(gy.youmonst.data))
|
if (ismnum(u.ulycn) || is_were(gy.youmonst.data))
|
||||||
you_unwere(TRUE);
|
you_unwere(TRUE);
|
||||||
break;
|
break;
|
||||||
case CARROT:
|
case CARROT:
|
||||||
@@ -2445,7 +2445,7 @@ fpostfx(struct obj *otmp)
|
|||||||
heal_legs(0);
|
heal_legs(0);
|
||||||
break;
|
break;
|
||||||
case EGG:
|
case EGG:
|
||||||
if (otmp->corpsenm >= LOW_PM
|
if (ismnum(otmp->corpsenm)
|
||||||
&& flesh_petrifies(&mons[otmp->corpsenm])) {
|
&& flesh_petrifies(&mons[otmp->corpsenm])) {
|
||||||
if (!Stone_resistance
|
if (!Stone_resistance
|
||||||
&& !(poly_when_stoned(gy.youmonst.data)
|
&& !(poly_when_stoned(gy.youmonst.data)
|
||||||
@@ -2529,7 +2529,7 @@ edibility_prompts(struct obj *otmp)
|
|||||||
if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN
|
if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN
|
||||||
|| otmp->otyp == GLOB_OF_GREEN_SLIME) {
|
|| otmp->otyp == GLOB_OF_GREEN_SLIME) {
|
||||||
/* These checks must match those in eatcorpse() */
|
/* These checks must match those in eatcorpse() */
|
||||||
stoneorslime = (mnum >= LOW_PM
|
stoneorslime = (ismnum(mnum)
|
||||||
&& flesh_petrifies(&mons[mnum])
|
&& flesh_petrifies(&mons[mnum])
|
||||||
&& !Stone_resistance
|
&& !Stone_resistance
|
||||||
&& !poly_when_stoned(gy.youmonst.data));
|
&& !poly_when_stoned(gy.youmonst.data));
|
||||||
@@ -3808,7 +3808,7 @@ Popeye(int threat)
|
|||||||
return (boolean) (mndx != NON_PM || otin->spe == 1);
|
return (boolean) (mndx != NON_PM || otin->spe == 1);
|
||||||
/* flesh from lizards and acidic critters stops petrification */
|
/* flesh from lizards and acidic critters stops petrification */
|
||||||
case STONED:
|
case STONED:
|
||||||
return (boolean) (mndx >= LOW_PM
|
return (boolean) (ismnum(mndx)
|
||||||
&& (mndx == PM_LIZARD || acidic(&mons[mndx])));
|
&& (mndx == PM_LIZARD || acidic(&mons[mndx])));
|
||||||
/* polymorph into a fiery monster */
|
/* polymorph into a fiery monster */
|
||||||
case SLIMED:
|
case SLIMED:
|
||||||
|
|||||||
@@ -671,8 +671,8 @@ done_in_by(struct monst *mtmp, int how)
|
|||||||
{
|
{
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
struct permonst *mptr = mtmp->data,
|
struct permonst *mptr = mtmp->data,
|
||||||
*champtr = (mtmp->cham >= LOW_PM) ? &mons[mtmp->cham]
|
*champtr = ismnum(mtmp->cham) ? &mons[mtmp->cham]
|
||||||
: mptr;
|
: mptr;
|
||||||
boolean distorted = (boolean) (Hallucination && canspotmon(mtmp)),
|
boolean distorted = (boolean) (Hallucination && canspotmon(mtmp)),
|
||||||
mimicker = (M_AP_TYPE(mtmp) == M_AP_MONSTER),
|
mimicker = (M_AP_TYPE(mtmp) == M_AP_MONSTER),
|
||||||
imitator = (mptr != champtr || mimicker);
|
imitator = (mptr != champtr || mimicker);
|
||||||
@@ -1438,7 +1438,7 @@ fuzzer_savelife(int how)
|
|||||||
|
|
||||||
/* get rid of temporary potion with obfree() rather than useup()
|
/* get rid of temporary potion with obfree() rather than useup()
|
||||||
because it doesn't get entered into inventory */
|
because it doesn't get entered into inventory */
|
||||||
if (u.ulycn >= LOW_PM && !rn2(3)) {
|
if (ismnum(u.ulycn) && !rn2(3)) {
|
||||||
potion = mksobj(POT_WATER, TRUE, FALSE);
|
potion = mksobj(POT_WATER, TRUE, FALSE);
|
||||||
bless(potion);
|
bless(potion);
|
||||||
(void) peffects(potion);
|
(void) peffects(potion);
|
||||||
@@ -1671,7 +1671,7 @@ really_done(int how)
|
|||||||
else if (how == BURNING || how == DISSOLVED) /* corpse burns up too */
|
else if (how == BURNING || how == DISSOLVED) /* corpse burns up too */
|
||||||
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
|
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
|
||||||
else if (how == STONING)
|
else if (how == STONING)
|
||||||
u.ugrave_arise = (NON_PM - 1); /* statue instead of corpse */
|
u.ugrave_arise = LEAVESTATUE; /* statue instead of corpse */
|
||||||
else if (how == TURNED_SLIME
|
else if (how == TURNED_SLIME
|
||||||
/* it's possible to turn into slime even though green slimes
|
/* it's possible to turn into slime even though green slimes
|
||||||
have been genocided: genocide could occur after hero is
|
have been genocided: genocide could occur after hero is
|
||||||
@@ -1808,7 +1808,7 @@ really_done(int how)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u.ugrave_arise >= LOW_PM && !done_stopprint) {
|
if (ismnum(u.ugrave_arise) && !done_stopprint) {
|
||||||
/* give this feedback even if bones aren't going to be created,
|
/* give this feedback even if bones aren't going to be created,
|
||||||
so that its presence or absence doesn't tip off the player to
|
so that its presence or absence doesn't tip off the player to
|
||||||
new bones or their lack; it might be a lie if makemon fails */
|
new bones or their lack; it might be a lie if makemon fails */
|
||||||
|
|||||||
+4
-4
@@ -1567,7 +1567,7 @@ attributes_enlightenment(
|
|||||||
you_are(buf, "");
|
you_are(buf, "");
|
||||||
}
|
}
|
||||||
warnspecies = gc.context.warntype.speciesidx;
|
warnspecies = gc.context.warntype.speciesidx;
|
||||||
if (Warn_of_mon && warnspecies >= LOW_PM) {
|
if (Warn_of_mon && ismnum(warnspecies)) {
|
||||||
Sprintf(buf, "aware of the presence of %s",
|
Sprintf(buf, "aware of the presence of %s",
|
||||||
makeplural(mons[warnspecies].pmnames[NEUTRAL]));
|
makeplural(mons[warnspecies].pmnames[NEUTRAL]));
|
||||||
you_are(buf, from_what(WARN_OF_MON));
|
you_are(buf, from_what(WARN_OF_MON));
|
||||||
@@ -1791,7 +1791,7 @@ attributes_enlightenment(
|
|||||||
/* blocked shape changes */
|
/* blocked shape changes */
|
||||||
if (Polymorph)
|
if (Polymorph)
|
||||||
what = !final ? "polymorph" : "have polymorphed";
|
what = !final ? "polymorph" : "have polymorphed";
|
||||||
else if (u.ulycn >= LOW_PM)
|
else if (ismnum(u.ulycn))
|
||||||
what = !final ? "change shape" : "have changed shape";
|
what = !final ? "change shape" : "have changed shape";
|
||||||
if (what) {
|
if (what) {
|
||||||
Sprintf(buf, "would %s periodically", what);
|
Sprintf(buf, "would %s periodically", what);
|
||||||
@@ -1826,7 +1826,7 @@ attributes_enlightenment(
|
|||||||
}
|
}
|
||||||
if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */
|
if (lays_eggs(gy.youmonst.data) && flags.female) /* Upolyd */
|
||||||
you_can("lay eggs", "");
|
you_can("lay eggs", "");
|
||||||
if (u.ulycn >= LOW_PM) {
|
if (ismnum(u.ulycn)) {
|
||||||
/* "you are a werecreature [in beast form]" */
|
/* "you are a werecreature [in beast form]" */
|
||||||
Strcpy(buf, an(pmname(&mons[u.ulycn],
|
Strcpy(buf, an(pmname(&mons[u.ulycn],
|
||||||
flags.female ? FEMALE : MALE)));
|
flags.female ? FEMALE : MALE)));
|
||||||
@@ -3215,7 +3215,7 @@ mstatusline(struct monst *mtmp)
|
|||||||
segndx, ordin(segndx), nsegs);
|
segndx, ordin(segndx), nsegs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mtmp->cham >= LOW_PM && mtmp->data != &mons[mtmp->cham])
|
if (ismnum(mtmp->cham) && mtmp->data != &mons[mtmp->cham])
|
||||||
/* don't reveal the innate form (chameleon, vampire, &c),
|
/* don't reveal the innate form (chameleon, vampire, &c),
|
||||||
just expose the fact that this current form isn't it */
|
just expose the fact that this current form isn't it */
|
||||||
Strcat(info, ", shapechanger");
|
Strcat(info, ", shapechanger");
|
||||||
|
|||||||
+1
-1
@@ -393,7 +393,7 @@ death_inflicted_by(
|
|||||||
Strcpy(outbuf, deathreason);
|
Strcpy(outbuf, deathreason);
|
||||||
if (mtmp) {
|
if (mtmp) {
|
||||||
struct permonst *mptr = mtmp->data,
|
struct permonst *mptr = mtmp->data,
|
||||||
*champtr = (mtmp->cham >= LOW_PM) ? &mons[mtmp->cham] : mptr;
|
*champtr = (ismnum(mtmp->cham)) ? &mons[mtmp->cham] : mptr;
|
||||||
const char *realnm = pmname(champtr, Mgender(mtmp)),
|
const char *realnm = pmname(champtr, Mgender(mtmp)),
|
||||||
*fakenm = pmname(mptr, Mgender(mtmp));
|
*fakenm = pmname(mptr, Mgender(mtmp));
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1084,7 +1084,7 @@ mdamagem(
|
|||||||
if (mattk->adtyp == AD_DGST) {
|
if (mattk->adtyp == AD_DGST) {
|
||||||
/* various checks similar to dog_eat and meatobj.
|
/* various checks similar to dog_eat and meatobj.
|
||||||
* after monkilled() to provide better message ordering */
|
* after monkilled() to provide better message ordering */
|
||||||
if (mdef->cham >= LOW_PM) {
|
if (ismnum(mdef->cham)) {
|
||||||
(void) newcham(magr, (struct permonst *) 0, NC_SHOW_MSG);
|
(void) newcham(magr, (struct permonst *) 0, NC_SHOW_MSG);
|
||||||
} else if (pd == &mons[PM_GREEN_SLIME] && !slimeproof(pa)) {
|
} else if (pd == &mons[PM_GREEN_SLIME] && !slimeproof(pa)) {
|
||||||
(void) newcham(magr, &mons[PM_GREEN_SLIME], NC_SHOW_MSG);
|
(void) newcham(magr, &mons[PM_GREEN_SLIME], NC_SHOW_MSG);
|
||||||
|
|||||||
+2
-2
@@ -1840,7 +1840,7 @@ weight(struct obj *obj)
|
|||||||
struct obj *contents;
|
struct obj *contents;
|
||||||
int cwt;
|
int cwt;
|
||||||
|
|
||||||
if (obj->otyp == STATUE && obj->corpsenm >= LOW_PM) {
|
if (obj->otyp == STATUE && ismnum(obj->corpsenm)) {
|
||||||
int msize = (int) mons[obj->corpsenm].msize, /* 0..7 */
|
int msize = (int) mons[obj->corpsenm].msize, /* 0..7 */
|
||||||
minwt = (msize + msize + 1) * 100;
|
minwt = (msize + msize + 1) * 100;
|
||||||
|
|
||||||
@@ -1882,7 +1882,7 @@ weight(struct obj *obj)
|
|||||||
|
|
||||||
return wt + cwt;
|
return wt + cwt;
|
||||||
}
|
}
|
||||||
if (obj->otyp == CORPSE && obj->corpsenm >= LOW_PM) {
|
if (obj->otyp == CORPSE && ismnum(obj->corpsenm)) {
|
||||||
long long_wt = obj->quan * (long) mons[obj->corpsenm].cwt;
|
long long_wt = obj->quan * (long) mons[obj->corpsenm].cwt;
|
||||||
|
|
||||||
wt = (long_wt > LARGEST_INT) ? LARGEST_INT : (int) long_wt;
|
wt = (long_wt > LARGEST_INT) ? LARGEST_INT : (int) long_wt;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ sanity_check_single_mon(
|
|||||||
struct permonst *mptr = mtmp->data;
|
struct permonst *mptr = mtmp->data;
|
||||||
coordxy mx = mtmp->mx, my = mtmp->my;
|
coordxy mx = mtmp->mx, my = mtmp->my;
|
||||||
|
|
||||||
if (!mptr || mptr < &mons[LOW_PM] || mptr >= &mons[NUMMONS]) {
|
if (!mptr || mptr < &mons[LOW_PM] || mptr > &mons[HIGH_PM]) {
|
||||||
/* most sanity checks issue warnings if they detect a problem,
|
/* most sanity checks issue warnings if they detect a problem,
|
||||||
but this would be too extreme to keep going */
|
but this would be too extreme to keep going */
|
||||||
panic("illegal mon data %s; mnum=%d (%s)",
|
panic("illegal mon data %s; mnum=%d (%s)",
|
||||||
@@ -466,7 +466,7 @@ genus(int mndx, int mode)
|
|||||||
mndx = mode ? PM_VALKYRIE : PM_HUMAN;
|
mndx = mode ? PM_VALKYRIE : PM_HUMAN;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (mndx >= LOW_PM && mndx < NUMMONS) {
|
if (ismnum(mndx)) {
|
||||||
struct permonst *ptr = &mons[mndx];
|
struct permonst *ptr = &mons[mndx];
|
||||||
|
|
||||||
if (is_human(ptr))
|
if (is_human(ptr))
|
||||||
@@ -495,7 +495,7 @@ pm_to_cham(int mndx)
|
|||||||
* As of 3.6.0 we just check M2_SHAPESHIFTER instead of having a
|
* As of 3.6.0 we just check M2_SHAPESHIFTER instead of having a
|
||||||
* big switch statement with hardcoded shapeshifter types here.
|
* big switch statement with hardcoded shapeshifter types here.
|
||||||
*/
|
*/
|
||||||
if (mndx >= LOW_PM && is_shapeshifter(&mons[mndx]))
|
if (ismnum(mndx) && is_shapeshifter(&mons[mndx]))
|
||||||
mcham = mndx;
|
mcham = mndx;
|
||||||
return mcham;
|
return mcham;
|
||||||
}
|
}
|
||||||
@@ -961,7 +961,7 @@ m_calcdistress(struct monst *mtmp)
|
|||||||
mon_regen(mtmp, FALSE);
|
mon_regen(mtmp, FALSE);
|
||||||
|
|
||||||
/* possibly polymorph shapechangers and lycanthropes */
|
/* possibly polymorph shapechangers and lycanthropes */
|
||||||
if (mtmp->cham >= LOW_PM)
|
if (ismnum(mtmp->cham))
|
||||||
decide_to_shapeshift(mtmp, (canspotmon(mtmp)
|
decide_to_shapeshift(mtmp, (canspotmon(mtmp)
|
||||||
|| engulfing_u(mtmp))
|
|| engulfing_u(mtmp))
|
||||||
? SHIFT_MSG : 0);
|
? SHIFT_MSG : 0);
|
||||||
@@ -1157,7 +1157,7 @@ meatbox(struct monst *mon, struct obj *otmp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define mstoning(obj) \
|
#define mstoning(obj) \
|
||||||
(ofood(obj) && obj->corpsenm >= LOW_PM \
|
(ofood(obj) && ismnum(obj->corpsenm) \
|
||||||
&& flesh_petrifies(&mons[obj->corpsenm]))
|
&& flesh_petrifies(&mons[obj->corpsenm]))
|
||||||
|
|
||||||
/* Monster mtmp consumes an object.
|
/* Monster mtmp consumes an object.
|
||||||
@@ -2641,7 +2641,7 @@ vamprises(struct monst *mtmp)
|
|||||||
{
|
{
|
||||||
int mndx = mtmp->cham;
|
int mndx = mtmp->cham;
|
||||||
|
|
||||||
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
|
if (ismnum(mndx) && mndx != monsndx(mtmp->data)
|
||||||
&& !(gm.mvitals[mndx].mvflags & G_GENOD)) {
|
&& !(gm.mvitals[mndx].mvflags & G_GENOD)) {
|
||||||
coord new_xy;
|
coord new_xy;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
@@ -2823,7 +2823,7 @@ mondead(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 (ismnum(mtmp->cham)) {
|
||||||
set_mon_data(mtmp, &mons[mtmp->cham]);
|
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])
|
||||||
@@ -3499,7 +3499,7 @@ vamp_stone(struct monst *mtmp)
|
|||||||
newsym(mtmp->mx, mtmp->my);
|
newsym(mtmp->mx, mtmp->my);
|
||||||
return FALSE; /* didn't petrify */
|
return FALSE; /* didn't petrify */
|
||||||
}
|
}
|
||||||
} else if (mtmp->cham >= LOW_PM
|
} else if (ismnum(mtmp->cham)
|
||||||
&& (mons[mtmp->cham].mresists & MR_STONE)) {
|
&& (mons[mtmp->cham].mresists & MR_STONE)) {
|
||||||
/* sandestins are stoning-immune so if hit by stoning damage
|
/* sandestins are stoning-immune so if hit by stoning damage
|
||||||
they revert to innate shape rather than become a statue */
|
they revert to innate shape rather than become a statue */
|
||||||
@@ -4090,7 +4090,7 @@ normal_shape(struct monst *mon)
|
|||||||
{
|
{
|
||||||
int mcham = (int) mon->cham;
|
int mcham = (int) mon->cham;
|
||||||
|
|
||||||
if (mcham >= LOW_PM) {
|
if (ismnum(mcham)) {
|
||||||
unsigned mcan = mon->mcan;
|
unsigned mcan = mon->mcan;
|
||||||
|
|
||||||
(void) newcham(mon, &mons[mcham], NC_SHOW_MSG);
|
(void) newcham(mon, &mons[mcham], NC_SHOW_MSG);
|
||||||
@@ -4469,7 +4469,7 @@ decide_to_shapeshift(struct monst *mon, int shiftflags)
|
|||||||
*/
|
*/
|
||||||
if (mon->data->mlet != S_VAMPIRE) {
|
if (mon->data->mlet != S_VAMPIRE) {
|
||||||
if ((mon->mhp <= (mon->mhpmax + 5) / 6) && rn2(4)
|
if ((mon->mhp <= (mon->mhpmax + 5) / 6) && rn2(4)
|
||||||
&& mon->cham >= LOW_PM) {
|
&& ismnum(mon->cham)) {
|
||||||
ptr = &mons[mon->cham];
|
ptr = &mons[mon->cham];
|
||||||
dochng = TRUE;
|
dochng = TRUE;
|
||||||
} else if (mon->data == &mons[PM_FOG_CLOUD]
|
} else if (mon->data == &mons[PM_FOG_CLOUD]
|
||||||
@@ -4481,7 +4481,7 @@ decide_to_shapeshift(struct monst *mon, int shiftflags)
|
|||||||
tame--and then switch back to vampire; they'll also
|
tame--and then switch back to vampire; they'll also
|
||||||
switch to fog cloud if they encounter a closed door */
|
switch to fog cloud if they encounter a closed door */
|
||||||
mndx = pickvampshape(mon);
|
mndx = pickvampshape(mon);
|
||||||
if (mndx >= LOW_PM) {
|
if (ismnum(mndx)) {
|
||||||
ptr = &mons[mndx];
|
ptr = &mons[mndx];
|
||||||
dochng = (ptr != mon->data);
|
dochng = (ptr != mon->data);
|
||||||
}
|
}
|
||||||
@@ -4605,7 +4605,7 @@ validvamp(struct monst* mon, int* mndx_p, int monclass)
|
|||||||
*mndx_p = PM_VLAD_THE_IMPALER;
|
*mndx_p = PM_VLAD_THE_IMPALER;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (*mndx_p >= LOW_PM && is_shapeshifter(&mons[*mndx_p])) {
|
if (ismnum(*mndx_p) && is_shapeshifter(&mons[*mndx_p])) {
|
||||||
/* player picked some type of shapeshifter; use mon's self
|
/* player picked some type of shapeshifter; use mon's self
|
||||||
(vampire or chameleon) */
|
(vampire or chameleon) */
|
||||||
*mndx_p = mon->cham;
|
*mndx_p = mon->cham;
|
||||||
@@ -4693,7 +4693,7 @@ wiz_force_cham_form(struct monst *mon)
|
|||||||
if (monclass && mndx == NON_PM)
|
if (monclass && mndx == NON_PM)
|
||||||
mndx = mkclass_poly(monclass);
|
mndx = mkclass_poly(monclass);
|
||||||
}
|
}
|
||||||
if (mndx >= LOW_PM) {
|
if (ismnum(mndx)) {
|
||||||
/* got a specific type of monster; use it if we can */
|
/* got a specific type of monster; use it if we can */
|
||||||
if (validvamp(mon, &mndx, monclass))
|
if (validvamp(mon, &mndx, monclass))
|
||||||
break;
|
break;
|
||||||
@@ -4745,6 +4745,7 @@ select_newcham_form(struct monst* mon)
|
|||||||
tryct = 5;
|
tryct = 5;
|
||||||
do {
|
do {
|
||||||
mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
||||||
|
/* assert(ismnum(mndx)); */
|
||||||
if (humanoid(&mons[mndx]) && polyok(&mons[mndx]))
|
if (humanoid(&mons[mndx]) && polyok(&mons[mndx]))
|
||||||
break;
|
break;
|
||||||
} while (--tryct > 0);
|
} while (--tryct > 0);
|
||||||
@@ -4782,6 +4783,7 @@ select_newcham_form(struct monst* mon)
|
|||||||
tryct = 50;
|
tryct = 50;
|
||||||
do {
|
do {
|
||||||
mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
||||||
|
/* assert(ismnum(mndx); */
|
||||||
} while (--tryct > 0 && !validspecmon(mon, mndx)
|
} while (--tryct > 0 && !validspecmon(mon, mndx)
|
||||||
/* try harder to select uppercase monster on rogue level */
|
/* try harder to select uppercase monster on rogue level */
|
||||||
&& (tryct > 40 && Is_rogue_level(&u.uz)
|
&& (tryct > 40 && Is_rogue_level(&u.uz)
|
||||||
@@ -4811,7 +4813,7 @@ accept_newcham_form(struct monst *mon, int mndx)
|
|||||||
/* shapeshifters are rejected by polyok() but allow a shapeshifter
|
/* shapeshifters are rejected by polyok() but allow a shapeshifter
|
||||||
to take on its 'natural' form */
|
to take on its 'natural' form */
|
||||||
if (is_shapeshifter(mdat)
|
if (is_shapeshifter(mdat)
|
||||||
&& mon->cham >= LOW_PM && mdat == &mons[mon->cham])
|
&& ismnum(mon->cham) && mdat == &mons[mon->cham])
|
||||||
return mdat;
|
return mdat;
|
||||||
/* polyok() rules out M2_PNAME, M2_WERE, and all humans except Kops */
|
/* polyok() rules out M2_PNAME, M2_WERE, and all humans except Kops */
|
||||||
return polyok(mdat) ? mdat : 0;
|
return polyok(mdat) ? mdat : 0;
|
||||||
@@ -5142,6 +5144,7 @@ dead_species(int m_idx, boolean egg)
|
|||||||
* fortunately, none of them have eggs. Species extinction due to
|
* fortunately, none of them have eggs. Species extinction due to
|
||||||
* overpopulation does not kill eggs.
|
* overpopulation does not kill eggs.
|
||||||
*/
|
*/
|
||||||
|
/* assert(ismnum(m_idx)); */
|
||||||
alt_idx = egg ? big_to_little(m_idx) : m_idx;
|
alt_idx = egg ? big_to_little(m_idx) : m_idx;
|
||||||
return (boolean) ((gm.mvitals[m_idx].mvflags & G_GENOD) != 0
|
return (boolean) ((gm.mvitals[m_idx].mvflags & G_GENOD) != 0
|
||||||
|| (gm.mvitals[alt_idx].mvflags & G_GENOD) != 0);
|
|| (gm.mvitals[alt_idx].mvflags & G_GENOD) != 0);
|
||||||
@@ -5201,10 +5204,10 @@ kill_genocided_monsters(void)
|
|||||||
if (DEADMONSTER(mtmp))
|
if (DEADMONSTER(mtmp))
|
||||||
continue;
|
continue;
|
||||||
mndx = monsndx(mtmp->data);
|
mndx = monsndx(mtmp->data);
|
||||||
kill_cham = (mtmp->cham >= LOW_PM
|
kill_cham = (ismnum(mtmp->cham)
|
||||||
&& (gm.mvitals[mtmp->cham].mvflags & G_GENOD));
|
&& (gm.mvitals[mtmp->cham].mvflags & G_GENOD));
|
||||||
if ((gm.mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
|
if ((gm.mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
|
||||||
if (mtmp->cham >= LOW_PM && !kill_cham)
|
if (ismnum(mtmp->cham) && !kill_cham)
|
||||||
(void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG);
|
(void) newcham(mtmp, (struct permonst *) 0, NC_SHOW_MSG);
|
||||||
else
|
else
|
||||||
mondead(mtmp);
|
mondead(mtmp);
|
||||||
|
|||||||
+1
-1
@@ -2648,7 +2648,7 @@ searches_for_item(struct monst *mon, struct obj *obj)
|
|||||||
return (boolean) (mcould_eat_tin(mon)
|
return (boolean) (mcould_eat_tin(mon)
|
||||||
&& (!resists_ston(mon)
|
&& (!resists_ston(mon)
|
||||||
&& cures_stoning(mon, obj, TRUE)));
|
&& cures_stoning(mon, obj, TRUE)));
|
||||||
if (typ == EGG && obj->corpsenm >= LOW_PM)
|
if (typ == EGG && ismnum(obj->corpsenm))
|
||||||
return (boolean) touch_petrifies(&mons[obj->corpsenm]);
|
return (boolean) touch_petrifies(&mons[obj->corpsenm]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+3
-3
@@ -1362,7 +1362,7 @@ doname_base(
|
|||||||
if (known && stale_egg(obj))
|
if (known && stale_egg(obj))
|
||||||
Strcat(prefix, "stale ");
|
Strcat(prefix, "stale ");
|
||||||
#endif
|
#endif
|
||||||
if (omndx >= LOW_PM
|
if (ismnum(omndx)
|
||||||
&& (known || (gm.mvitals[omndx].mvflags & MV_KNOWS_EGG))) {
|
&& (known || (gm.mvitals[omndx].mvflags & MV_KNOWS_EGG))) {
|
||||||
Strcat(prefix, mons[omndx].pmnames[NEUTRAL]);
|
Strcat(prefix, mons[omndx].pmnames[NEUTRAL]);
|
||||||
Strcat(prefix, " ");
|
Strcat(prefix, " ");
|
||||||
@@ -4838,7 +4838,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
|||||||
case STATUE: /* otmp->cobj already done in mksobj() */
|
case STATUE: /* otmp->cobj already done in mksobj() */
|
||||||
case FIGURINE:
|
case FIGURINE:
|
||||||
case CORPSE: {
|
case CORPSE: {
|
||||||
struct permonst *P = (d.mntmp >= LOW_PM) ? &mons[d.mntmp] : 0;
|
struct permonst *P = (ismnum(d.mntmp)) ? &mons[d.mntmp] : 0;
|
||||||
|
|
||||||
d.otmp->spe = !P ? CORPSTAT_RANDOM
|
d.otmp->spe = !P ? CORPSTAT_RANDOM
|
||||||
/* if neuter, force neuter regardless of wish request */
|
/* if neuter, force neuter regardless of wish request */
|
||||||
@@ -4878,7 +4878,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set otmp->corpsenm or dragon scale [mail] */
|
/* set otmp->corpsenm or dragon scale [mail] */
|
||||||
if (d.mntmp >= LOW_PM) {
|
if (ismnum(d.mntmp)) {
|
||||||
int humanwere;
|
int humanwere;
|
||||||
|
|
||||||
if (d.mntmp == PM_LONG_WORM_TAIL)
|
if (d.mntmp == PM_LONG_WORM_TAIL)
|
||||||
|
|||||||
+2
-2
@@ -8220,13 +8220,13 @@ fruitadd(char *str, struct fruit *replace_fruit)
|
|||||||
|| !strncmp(gp.pl_fruit, "partly eaten ", 13)
|
|| !strncmp(gp.pl_fruit, "partly eaten ", 13)
|
||||||
|| (!strncmp(gp.pl_fruit, "tin of ", 7)
|
|| (!strncmp(gp.pl_fruit, "tin of ", 7)
|
||||||
&& (!strcmp(gp.pl_fruit + 7, "spinach")
|
&& (!strcmp(gp.pl_fruit + 7, "spinach")
|
||||||
|| name_to_mon(gp.pl_fruit + 7, (int *) 0) >= LOW_PM))
|
|| ismnum(name_to_mon(gp.pl_fruit + 7, (int *) 0))))
|
||||||
|| !strcmp(gp.pl_fruit, "empty tin")
|
|| !strcmp(gp.pl_fruit, "empty tin")
|
||||||
|| (!strcmp(gp.pl_fruit, "glob")
|
|| (!strcmp(gp.pl_fruit, "glob")
|
||||||
|| (globpfx > 0 && !strcmp("glob", &gp.pl_fruit[globpfx])))
|
|| (globpfx > 0 && !strcmp("glob", &gp.pl_fruit[globpfx])))
|
||||||
|| ((str_end_is(gp.pl_fruit, " corpse")
|
|| ((str_end_is(gp.pl_fruit, " corpse")
|
||||||
|| str_end_is(gp.pl_fruit, " egg"))
|
|| str_end_is(gp.pl_fruit, " egg"))
|
||||||
&& name_to_mon(gp.pl_fruit, (int *) 0) >= LOW_PM)) {
|
&& ismnum(name_to_mon(gp.pl_fruit, (int *) 0)))) {
|
||||||
Strcpy(buf, gp.pl_fruit);
|
Strcpy(buf, gp.pl_fruit);
|
||||||
Strcpy(gp.pl_fruit, "candied ");
|
Strcpy(gp.pl_fruit, "candied ");
|
||||||
nmcpy(gp.pl_fruit + 8, buf, PL_FSIZ - 8);
|
nmcpy(gp.pl_fruit + 8, buf, PL_FSIZ - 8);
|
||||||
|
|||||||
+3
-3
@@ -464,7 +464,7 @@ polyself(int psflags)
|
|||||||
monsterpoly = ((psflags & POLY_MONSTER) != 0),
|
monsterpoly = ((psflags & POLY_MONSTER) != 0),
|
||||||
formrevert = ((psflags & POLY_REVERT) != 0),
|
formrevert = ((psflags & POLY_REVERT) != 0),
|
||||||
draconian = (uarm && Is_dragon_armor(uarm)),
|
draconian = (uarm && Is_dragon_armor(uarm)),
|
||||||
iswere = (u.ulycn >= LOW_PM),
|
iswere = (ismnum(u.ulycn)),
|
||||||
isvamp = (is_vampire(gy.youmonst.data)
|
isvamp = (is_vampire(gy.youmonst.data)
|
||||||
|| is_vampshifter(&gy.youmonst)),
|
|| is_vampshifter(&gy.youmonst)),
|
||||||
controllable_poly = Polymorph_control && !(Stunned || Unaware);
|
controllable_poly = Polymorph_control && !(Stunned || Unaware);
|
||||||
@@ -663,7 +663,7 @@ polyself(int psflags)
|
|||||||
&& !rn2(10)) ? PM_WOLF
|
&& !rn2(10)) ? PM_WOLF
|
||||||
: !rn2(4) ? PM_FOG_CLOUD
|
: !rn2(4) ? PM_FOG_CLOUD
|
||||||
: PM_VAMPIRE_BAT;
|
: PM_VAMPIRE_BAT;
|
||||||
if (gy.youmonst.cham >= LOW_PM
|
if (ismnum(gy.youmonst.cham)
|
||||||
&& !is_vampire(gy.youmonst.data) && !rn2(2))
|
&& !is_vampire(gy.youmonst.data) && !rn2(2))
|
||||||
mntmp = gy.youmonst.cham;
|
mntmp = gy.youmonst.cham;
|
||||||
}
|
}
|
||||||
@@ -2230,7 +2230,7 @@ polysense(void)
|
|||||||
HWarn_of_mon |= FROMRACE;
|
HWarn_of_mon |= FROMRACE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (warnidx >= LOW_PM) {
|
if (ismnum(warnidx)) {
|
||||||
gc.context.warntype.speciesidx = warnidx;
|
gc.context.warntype.speciesidx = warnidx;
|
||||||
gc.context.warntype.species = &mons[warnidx];
|
gc.context.warntype.species = &mons[warnidx];
|
||||||
HWarn_of_mon |= FROMRACE;
|
HWarn_of_mon |= FROMRACE;
|
||||||
|
|||||||
+5
-5
@@ -713,7 +713,7 @@ peffect_water(struct obj *otmp)
|
|||||||
if (otmp->blessed) {
|
if (otmp->blessed) {
|
||||||
pline("This burns like %s!", hliquid("acid"));
|
pline("This burns like %s!", hliquid("acid"));
|
||||||
exercise(A_CON, FALSE);
|
exercise(A_CON, FALSE);
|
||||||
if (u.ulycn >= LOW_PM) {
|
if (ismnum(u.ulycn)) {
|
||||||
Your("affinity to %s disappears!",
|
Your("affinity to %s disappears!",
|
||||||
makeplural(mons[u.ulycn].pmnames[NEUTRAL]));
|
makeplural(mons[u.ulycn].pmnames[NEUTRAL]));
|
||||||
if (gy.youmonst.data == &mons[u.ulycn])
|
if (gy.youmonst.data == &mons[u.ulycn])
|
||||||
@@ -725,7 +725,7 @@ peffect_water(struct obj *otmp)
|
|||||||
} else if (otmp->cursed) {
|
} else if (otmp->cursed) {
|
||||||
You_feel("quite proud of yourself.");
|
You_feel("quite proud of yourself.");
|
||||||
healup(d(2, 6), 0, 0, 0);
|
healup(d(2, 6), 0, 0, 0);
|
||||||
if (u.ulycn >= LOW_PM && !Upolyd)
|
if (ismnum(u.ulycn) && !Upolyd)
|
||||||
you_were();
|
you_were();
|
||||||
exercise(A_CON, TRUE);
|
exercise(A_CON, TRUE);
|
||||||
}
|
}
|
||||||
@@ -735,7 +735,7 @@ peffect_water(struct obj *otmp)
|
|||||||
make_sick(0L, (char *) 0, TRUE, SICK_ALL);
|
make_sick(0L, (char *) 0, TRUE, SICK_ALL);
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
exercise(A_CON, TRUE);
|
exercise(A_CON, TRUE);
|
||||||
if (u.ulycn >= LOW_PM)
|
if (ismnum(u.ulycn))
|
||||||
you_unwere(TRUE); /* "Purified" */
|
you_unwere(TRUE); /* "Purified" */
|
||||||
/* make_confused(0L, TRUE); */
|
/* make_confused(0L, TRUE); */
|
||||||
} else {
|
} else {
|
||||||
@@ -745,7 +745,7 @@ peffect_water(struct obj *otmp)
|
|||||||
KILLED_BY_AN);
|
KILLED_BY_AN);
|
||||||
} else
|
} else
|
||||||
You_feel("full of dread.");
|
You_feel("full of dread.");
|
||||||
if (u.ulycn >= LOW_PM && !Upolyd)
|
if (ismnum(u.ulycn) && !Upolyd)
|
||||||
you_were();
|
you_were();
|
||||||
exercise(A_CON, FALSE);
|
exercise(A_CON, FALSE);
|
||||||
}
|
}
|
||||||
@@ -2047,7 +2047,7 @@ potionbreathe(struct obj *obj)
|
|||||||
case POT_WATER:
|
case POT_WATER:
|
||||||
if (u.umonnum == PM_GREMLIN) {
|
if (u.umonnum == PM_GREMLIN) {
|
||||||
(void) split_mon(&gy.youmonst, (struct monst *) 0);
|
(void) split_mon(&gy.youmonst, (struct monst *) 0);
|
||||||
} else if (u.ulycn >= LOW_PM) {
|
} else if (ismnum(u.ulycn)) {
|
||||||
/* vapor from [un]holy water will trigger
|
/* vapor from [un]holy water will trigger
|
||||||
transformation but won't cure lycanthropy */
|
transformation but won't cure lycanthropy */
|
||||||
if (obj->blessed && gy.youmonst.data == &mons[u.ulycn])
|
if (obj->blessed && gy.youmonst.data == &mons[u.ulycn])
|
||||||
|
|||||||
+1
-1
@@ -209,7 +209,7 @@ in_trouble(void)
|
|||||||
return TROUBLE_REGION;
|
return TROUBLE_REGION;
|
||||||
if (critically_low_hp(FALSE))
|
if (critically_low_hp(FALSE))
|
||||||
return TROUBLE_HIT;
|
return TROUBLE_HIT;
|
||||||
if (u.ulycn >= LOW_PM)
|
if (ismnum(u.ulycn))
|
||||||
return TROUBLE_LYCANTHROPE;
|
return TROUBLE_LYCANTHROPE;
|
||||||
if (near_capacity() >= EXT_ENCUMBER && AMAX(A_STR) - ABASE(A_STR) > 3)
|
if (near_capacity() >= EXT_ENCUMBER && AMAX(A_STR) - ABASE(A_STR) > 3)
|
||||||
return TROUBLE_COLLAPSING;
|
return TROUBLE_COLLAPSING;
|
||||||
|
|||||||
+2
-2
@@ -3086,11 +3086,11 @@ create_particular_parse(
|
|||||||
} else { /* no explicit gender term was specified */
|
} else { /* no explicit gender term was specified */
|
||||||
d->fem = gender_name_var;
|
d->fem = gender_name_var;
|
||||||
}
|
}
|
||||||
if (d->which >= LOW_PM)
|
if (ismnum(d->which))
|
||||||
return TRUE; /* got one */
|
return TRUE; /* got one */
|
||||||
d->monclass = name_to_monclass(bufp, &d->which);
|
d->monclass = name_to_monclass(bufp, &d->which);
|
||||||
|
|
||||||
if (d->which >= LOW_PM) {
|
if (ismnum(d->which)) {
|
||||||
d->monclass = MAXMCLASSES; /* matters below */
|
d->monclass = MAXMCLASSES; /* matters below */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (d->monclass == S_invisible) { /* not an actual monster class */
|
} else if (d->monclass == S_invisible) { /* not an actual monster class */
|
||||||
|
|||||||
+1
-1
@@ -531,7 +531,7 @@ restgamestate(NHFILE *nhfp)
|
|||||||
newgamecontext = gc.context; /* copy statically init'd context */
|
newgamecontext = gc.context; /* copy statically init'd context */
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
Mread(nhfp->fd, &gc.context, sizeof gc.context);
|
Mread(nhfp->fd, &gc.context, sizeof gc.context);
|
||||||
gc.context.warntype.species = (gc.context.warntype.speciesidx >= LOW_PM)
|
gc.context.warntype.species = (ismnum(gc.context.warntype.speciesidx))
|
||||||
? &mons[gc.context.warntype.speciesidx]
|
? &mons[gc.context.warntype.speciesidx]
|
||||||
: (struct permonst *) 0;
|
: (struct permonst *) 0;
|
||||||
/* gc.context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
|
/* gc.context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
|
||||||
|
|||||||
@@ -3706,7 +3706,7 @@ corpsenm_price_adj(struct obj *obj)
|
|||||||
long val = 0L;
|
long val = 0L;
|
||||||
|
|
||||||
if ((obj->otyp == TIN || obj->otyp == EGG || obj->otyp == CORPSE)
|
if ((obj->otyp == TIN || obj->otyp == EGG || obj->otyp == CORPSE)
|
||||||
&& obj->corpsenm >= LOW_PM) {
|
&& ismnum(obj->corpsenm)) {
|
||||||
int i;
|
int i;
|
||||||
long tmp = 1L;
|
long tmp = 1L;
|
||||||
struct permonst *ptr = &mons[obj->corpsenm];
|
struct permonst *ptr = &mons[obj->corpsenm];
|
||||||
@@ -5279,7 +5279,7 @@ block_entry(register coordxy x, register coordxy y)
|
|||||||
char *
|
char *
|
||||||
shk_your(char *buf, struct obj *obj)
|
shk_your(char *buf, struct obj *obj)
|
||||||
{
|
{
|
||||||
boolean chk_pm = obj->otyp == CORPSE && obj->corpsenm >= LOW_PM;
|
boolean chk_pm = obj->otyp == CORPSE && ismnum(obj->corpsenm);
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
if (chk_pm && type_is_pname(&mons[obj->corpsenm]))
|
if (chk_pm && type_is_pname(&mons[obj->corpsenm]))
|
||||||
|
|||||||
+1
-2
@@ -395,8 +395,7 @@ veggy_item(struct obj* obj, int otyp /* used iff obj is null */)
|
|||||||
if (otyp == TIN && corpsenm == NON_PM) /* implies obj is non-null */
|
if (otyp == TIN && corpsenm == NON_PM) /* implies obj is non-null */
|
||||||
return (boolean) (obj->spe == 1); /* 0 = empty, 1 = spinach */
|
return (boolean) (obj->spe == 1); /* 0 = empty, 1 = spinach */
|
||||||
if (otyp == TIN || otyp == CORPSE)
|
if (otyp == TIN || otyp == CORPSE)
|
||||||
return (boolean) (corpsenm >= LOW_PM
|
return (boolean) (ismnum(corpsenm) && vegetarian(&mons[corpsenm]));
|
||||||
&& vegetarian(&mons[corpsenm]));
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1977,7 +1977,7 @@ create_monster(monster *m, struct mkroom *croom)
|
|||||||
if (m->appear_as.str
|
if (m->appear_as.str
|
||||||
&& ((mtmp->data->mlet == S_MIMIC)
|
&& ((mtmp->data->mlet == S_MIMIC)
|
||||||
/* shapechanger (chameleons, et al, and vampires) */
|
/* shapechanger (chameleons, et al, and vampires) */
|
||||||
|| (mtmp->cham >= LOW_PM && m->appear == M_AP_MONSTER))
|
|| (ismnum(mtmp->cham) && m->appear == M_AP_MONSTER))
|
||||||
&& !Protection_from_shape_changers) {
|
&& !Protection_from_shape_changers) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -741,7 +741,7 @@ animate_statue(
|
|||||||
mon = makemon(&mons[PM_DOPPELGANGER], x, y, mmflags);
|
mon = makemon(&mons[PM_DOPPELGANGER], x, y, mmflags);
|
||||||
/* if hero has protection from shape changers, cham field will
|
/* if hero has protection from shape changers, cham field will
|
||||||
be NON_PM; otherwise, set form to match the statue */
|
be NON_PM; otherwise, set form to match the statue */
|
||||||
if (mon && mon->cham >= LOW_PM)
|
if (mon && ismnum(mon->cham))
|
||||||
(void) newcham(mon, mptr, NO_NC_FLAGS);
|
(void) newcham(mon, mptr, NO_NC_FLAGS);
|
||||||
} else {
|
} else {
|
||||||
if (cause == ANIMATE_SPELL)
|
if (cause == ANIMATE_SPELL)
|
||||||
|
|||||||
+4
-4
@@ -1127,7 +1127,7 @@ hmon_hitmon_misc_obj(
|
|||||||
; /* maybe turn the corpse into a statue? */
|
; /* maybe turn the corpse into a statue? */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
hmd->dmg = (obj->corpsenm >= LOW_PM ? mons[obj->corpsenm].msize
|
hmd->dmg = (ismnum(obj->corpsenm) ? mons[obj->corpsenm].msize
|
||||||
: 0) + 1;
|
: 0) + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1149,14 +1149,14 @@ hmon_hitmon_misc_obj(
|
|||||||
hand-to-hand attack should yield a "bashing" mesg */
|
hand-to-hand attack should yield a "bashing" mesg */
|
||||||
if (obj == uwep)
|
if (obj == uwep)
|
||||||
gu.unweapon = TRUE;
|
gu.unweapon = TRUE;
|
||||||
if (obj->spe && obj->corpsenm >= LOW_PM) {
|
if (obj->spe && ismnum(obj->corpsenm)) {
|
||||||
if (obj->quan < 5L)
|
if (obj->quan < 5L)
|
||||||
change_luck((schar) - (obj->quan));
|
change_luck((schar) - (obj->quan));
|
||||||
else
|
else
|
||||||
change_luck(-5);
|
change_luck(-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->corpsenm >= LOW_PM
|
if (ismnum(obj->corpsenm)
|
||||||
&& touch_petrifies(&mons[obj->corpsenm])) {
|
&& touch_petrifies(&mons[obj->corpsenm])) {
|
||||||
/*learn_egg_type(obj->corpsenm);*/
|
/*learn_egg_type(obj->corpsenm);*/
|
||||||
pline("Splat! You hit %s with %s %s egg%s!",
|
pline("Splat! You hit %s with %s %s egg%s!",
|
||||||
@@ -1178,7 +1178,7 @@ hmon_hitmon_misc_obj(
|
|||||||
} else { /* ordinary egg(s) */
|
} else { /* ordinary egg(s) */
|
||||||
enum monnums mnum = obj->corpsenm;
|
enum monnums mnum = obj->corpsenm;
|
||||||
const char *eggp =
|
const char *eggp =
|
||||||
(mnum >= LOW_PM && mnum < NUMMONS && obj->known)
|
(ismnum(mnum) && obj->known)
|
||||||
? the(mons[mnum].pmnames[NEUTRAL])
|
? the(mons[mnum].pmnames[NEUTRAL])
|
||||||
: (cnt > 1L) ? "some" : "an";
|
: (cnt > 1L) ? "some" : "an";
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ bhitm(struct monst *mtmp, struct obj *otmp)
|
|||||||
/* if shapechange failed because there aren't
|
/* if shapechange failed because there aren't
|
||||||
enough eligible candidates (most likely for
|
enough eligible candidates (most likely for
|
||||||
vampshifter), try reverting to original form */
|
vampshifter), try reverting to original form */
|
||||||
|| (mtmp->cham >= LOW_PM
|
|| (ismnum(mtmp->cham)
|
||||||
&& newcham(mtmp, &mons[mtmp->cham],
|
&& newcham(mtmp, &mons[mtmp->cham],
|
||||||
ncflags) != 0)) {
|
ncflags) != 0)) {
|
||||||
if (give_msg && (canspotmon(mtmp)
|
if (give_msg && (canspotmon(mtmp)
|
||||||
@@ -5719,7 +5719,7 @@ destroy_item(int osym, int dmgtyp)
|
|||||||
|| objects[obj->otyp].oc_oprop == FLYING))
|
|| objects[obj->otyp].oc_oprop == FLYING))
|
||||||
/* destroyed wands and potions of polymorph don't trigger
|
/* destroyed wands and potions of polymorph don't trigger
|
||||||
polymorph so don't need to be deferred */
|
polymorph so don't need to be deferred */
|
||||||
|| (obj->otyp == POT_WATER && u.ulycn >= LOW_PM
|
|| (obj->otyp == POT_WATER && ismnum(u.ulycn)
|
||||||
&& (Upolyd ? obj->blessed : obj->cursed)))) {
|
&& (Upolyd ? obj->blessed : obj->cursed)))) {
|
||||||
deferrals[deferral_indx++] = obj->o_id;
|
deferrals[deferral_indx++] = obj->o_id;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user