Add helpless monster macro

This commit is contained in:
Pasi Kallinen
2022-03-18 10:19:04 +02:00
parent 480ba917a1
commit 39acd095b2
21 changed files with 66 additions and 68 deletions
+1
View File
@@ -234,6 +234,7 @@ struct monst {
((m)->data->mlet == S_TROLL && (o) && (o)->oartifact == ART_TROLLSBANE) ((m)->data->mlet == S_TROLL && (o) && (o)->oartifact == ART_TROLLSBANE)
#define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon))) #define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon)))
#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove)
/* Get the maximum difficulty monsters that can currently be generated, /* Get the maximum difficulty monsters that can currently be generated,
given the current level difficulty and the hero's level. */ given the current level difficulty and the hero's level. */
+2 -2
View File
@@ -477,7 +477,7 @@ e_missed(struct entity *etmp, boolean chunks)
if (is_flyer(etmp->edata) if (is_flyer(etmp->edata)
&& (is_u(etmp) ? !Unaware && (is_u(etmp) ? !Unaware
: (etmp->emon->mcanmove && !etmp->emon->msleeping))) : !helpless(etmp->emon)))
/* flying requires mobility */ /* flying requires mobility */
misses = 5; /* out of 8 */ misses = 5; /* out of 8 */
else if (is_floater(etmp->edata) else if (is_floater(etmp->edata)
@@ -505,7 +505,7 @@ e_jumps(struct entity *etmp)
int tmp = 4; /* out of 10 */ int tmp = 4; /* out of 10 */
if (is_u(etmp) ? (Unaware || Fumbling) if (is_u(etmp) ? (Unaware || Fumbling)
: (!etmp->emon->mcanmove || etmp->emon->msleeping : (helpless(etmp->emon)
|| !etmp->edata->mmove || etmp->emon->wormno)) || !etmp->edata->mmove || etmp->emon->wormno))
return FALSE; return FALSE;
+1 -2
View File
@@ -800,8 +800,7 @@ monster_detect(struct obj *otmp, /* detecting object (if any) */
&& mclass == S_WORM_TAIL)) && mclass == S_WORM_TAIL))
map_monst(mtmp, TRUE); map_monst(mtmp, TRUE);
if (otmp && otmp->cursed if (otmp && otmp->cursed && helpless(mtmp)) {
&& (mtmp->msleeping || !mtmp->mcanmove)) {
mtmp->msleeping = mtmp->mfrozen = 0; mtmp->msleeping = mtmp->mfrozen = 0;
mtmp->mcanmove = 1; mtmp->mcanmove = 1;
woken = TRUE; woken = TRUE;
+1 -1
View File
@@ -1213,7 +1213,7 @@ do_mgivenname(void)
if (!alreadynamed(mtmp, monnambuf, buf)) if (!alreadynamed(mtmp, monnambuf, buf))
pline("%s doesn't like being called names!", upstart(monnambuf)); pline("%s doesn't like being called names!", upstart(monnambuf));
} else if (mtmp->isshk } else if (mtmp->isshk
&& !(Deaf || mtmp->msleeping || !mtmp->mcanmove && !(Deaf || helpless(mtmp)
|| mtmp->data->msound <= MS_ANIMAL)) { || mtmp->data->msound <= MS_ANIMAL)) {
if (!alreadynamed(mtmp, monnambuf, buf)) if (!alreadynamed(mtmp, monnambuf, buf))
verbalize("I'm %s, not %s.", shkname(mtmp), buf); verbalize("I'm %s, not %s.", shkname(mtmp), buf);
+1 -1
View File
@@ -608,7 +608,7 @@ keepdogs(boolean pets_only) /* true for ascension or final escape */
the amulet; if you don't have it, will chase you the amulet; if you don't have it, will chase you
only if in range. -3. */ only if in range. -3. */
|| (u.uhave.amulet && mtmp->iswiz)) || (u.uhave.amulet && mtmp->iswiz))
&& ((!mtmp->msleeping && mtmp->mcanmove) && (!helpless(mtmp)
/* eg if level teleport or new trap, steed has no control /* eg if level teleport or new trap, steed has no control
to avoid following */ to avoid following */
|| (mtmp == u.usteed)) || (mtmp == u.usteed))
+1 -1
View File
@@ -426,7 +426,7 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist)
int omx, omy, carryamt = 0; int omx, omy, carryamt = 0;
struct obj *obj, *otmp; struct obj *obj, *otmp;
if (mtmp->msleeping || !mtmp->mcanmove) if (helpless(mtmp))
return 0; return 0;
omx = mtmp->mx; omx = mtmp->mx;
+1 -1
View File
@@ -1848,7 +1848,7 @@ thitmonst(
and also treat gems or glass shot via sling as attacks */ and also treat gems or glass shot via sling as attacks */
if (obj->oclass == GEM_CLASS && is_unicorn(mon->data) if (obj->oclass == GEM_CLASS && is_unicorn(mon->data)
&& objects[obj->otyp].oc_material != MINERAL && !uslinging()) { && objects[obj->otyp].oc_material != MINERAL && !uslinging()) {
if (mon->msleeping || !mon->mcanmove) { if (helpless(mon)) {
tmiss(obj, mon, FALSE); tmiss(obj, mon, FALSE);
return 0; return 0;
} else if (mon->mtame) { } else if (mon->mtame) {
+2 -2
View File
@@ -1655,7 +1655,7 @@ domove_attackmon_at(struct monst *mtmp, xchar x, xchar y, boolean *displaceu)
/* target monster might decide to switch places with you... */ /* target monster might decide to switch places with you... */
*displaceu = (mtmp->data == &mons[PM_DISPLACER_BEAST] && !rn2(2) *displaceu = (mtmp->data == &mons[PM_DISPLACER_BEAST] && !rn2(2)
&& mtmp->mux == u.ux0 && mtmp->muy == u.uy0 && mtmp->mux == u.ux0 && mtmp->muy == u.uy0
&& mtmp->mcanmove && !mtmp->msleeping && !helpless(mtmp)
&& !mtmp->meating && !mtmp->mtrapped && !mtmp->meating && !mtmp->mtrapped
&& !u.utrap && !u.ustuck && !u.usteed && !u.utrap && !u.ustuck && !u.usteed
&& !(u.dx && u.dy && !(u.dx && u.dy
@@ -3410,7 +3410,7 @@ monster_nearby(void)
&& (Hallucination && (Hallucination
|| (!mtmp->mpeaceful && !noattacks(mtmp->data))) || (!mtmp->mpeaceful && !noattacks(mtmp->data)))
&& (!is_hider(mtmp->data) || !mtmp->mundetected) && (!is_hider(mtmp->data) || !mtmp->mundetected)
&& mtmp->mcanmove && !mtmp->msleeping && !helpless(mtmp)
&& !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp)) && !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp))
return 1; return 1;
} }
+4 -4
View File
@@ -301,7 +301,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
if (!magr || !mdef) if (!magr || !mdef)
return MM_MISS; /* mike@genat */ return MM_MISS; /* mike@genat */
if (!magr->mcanmove || magr->msleeping) if (helpless(magr))
return MM_MISS; return MM_MISS;
pa = magr->data; pa = magr->data;
pd = mdef->data; pd = mdef->data;
@@ -313,7 +313,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
/* Calculate the armour class differential. */ /* Calculate the armour class differential. */
tmp = find_mac(mdef) + magr->m_lev; tmp = find_mac(mdef) + magr->m_lev;
if (mdef->mconf || !mdef->mcanmove || mdef->msleeping) { if (mdef->mconf || helpless(mdef)) {
tmp += 4; tmp += 4;
mdef->msleeping = 0; mdef->msleeping = 0;
} }
@@ -540,7 +540,7 @@ mattackm(register struct monst *magr, register struct monst *mdef)
if (res[i] & MM_AGR_DIED) if (res[i] & MM_AGR_DIED)
return res[i]; return res[i];
/* return if aggressor can no longer attack */ /* return if aggressor can no longer attack */
if (!magr->mcanmove || magr->msleeping) if (helpless(magr))
return res[i]; return res[i];
if (res[i] & MM_HIT) if (res[i] & MM_HIT)
struck = 1; /* at least one hit */ struck = 1; /* at least one hit */
@@ -1091,7 +1091,7 @@ sleep_monst(struct monst *mon, int amt, int how)
void void
slept_monst(struct monst *mon) slept_monst(struct monst *mon)
{ {
if ((mon->msleeping || !mon->mcanmove) && mon == u.ustuck if (helpless(mon) && mon == u.ustuck
&& !sticks(g.youmonst.data) && !u.uswallow) { && !sticks(g.youmonst.data) && !u.uswallow) {
pline("%s grip relaxes.", s_suffix(Monnam(mon))); pline("%s grip relaxes.", s_suffix(Monnam(mon)));
unstuck(mon); unstuck(mon);
+5 -5
View File
@@ -714,7 +714,7 @@ dochug(register struct monst* mtmp)
break; break;
case MMOVE_MOVED: /* monster moved */ case MMOVE_MOVED: /* monster moved */
/* Maybe it stepped on a trap and fell asleep... */ /* Maybe it stepped on a trap and fell asleep... */
if (mtmp->msleeping || !mtmp->mcanmove) if (helpless(mtmp))
return 0; return 0;
/* Monsters can move and then shoot on same turn; /* Monsters can move and then shoot on same turn;
our hero can't. Is that fair? */ our hero can't. Is that fair? */
@@ -754,7 +754,7 @@ dochug(register struct monst* mtmp)
} }
} }
/* special speeches for quest monsters */ /* special speeches for quest monsters */
if (!mtmp->msleeping && mtmp->mcanmove && nearby) if (!helpless(mtmp) && nearby)
quest_talk(mtmp); quest_talk(mtmp);
/* extra emotional attack for vile monsters */ /* extra emotional attack for vile monsters */
if (inrange && mtmp->data->msound == MS_CUSS && !mtmp->mpeaceful if (inrange && mtmp->data->msound == MS_CUSS && !mtmp->mpeaceful
@@ -970,7 +970,7 @@ static void
maybe_spin_web(struct monst *mtmp) maybe_spin_web(struct monst *mtmp)
{ {
if (webmaker(mtmp->data) if (webmaker(mtmp->data)
&& mtmp->mcanmove && !mtmp->msleeping && !mtmp->mspec_used && !helpless(mtmp) && !mtmp->mspec_used
&& !t_at(mtmp->mx, mtmp->my) && soko_allow_web(mtmp)) { && !t_at(mtmp->mx, mtmp->my) && soko_allow_web(mtmp)) {
struct trap *trap; struct trap *trap;
int prob = ((((mtmp->data == &mons[PM_GIANT_SPIDER]) ? 15 : 5) int prob = ((((mtmp->data == &mons[PM_GIANT_SPIDER]) ? 15 : 5)
@@ -1226,7 +1226,7 @@ m_move(register struct monst* mtmp, register int after)
underneath an immobile or hidden monster; underneath an immobile or hidden monster;
paralysis victims excluded */ paralysis victims excluded */
if ((mtoo = m_at(xx, yy)) != 0 if ((mtoo = m_at(xx, yy)) != 0
&& (mtoo->msleeping || mtoo->mundetected && (helpless(mtoo) || mtoo->mundetected
|| (mtoo->mappearance && !mtoo->iswiz) || (mtoo->mappearance && !mtoo->iswiz)
|| !mtoo->data->mmove)) || !mtoo->data->mmove))
continue; continue;
@@ -1686,7 +1686,7 @@ m_move(register struct monst* mtmp, register int after)
(just in case the object it was hiding under went away); (just in case the object it was hiding under went away);
usually set mundetected unless monster can't move. */ usually set mundetected unless monster can't move. */
if (mtmp->mundetected if (mtmp->mundetected
|| (mtmp->mcanmove && !mtmp->msleeping && rn2(5))) || (!helpless(mtmp) && rn2(5)))
(void) hideunder(mtmp); (void) hideunder(mtmp);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} }
+3 -3
View File
@@ -527,7 +527,7 @@ find_defensive(struct monst* mtmp)
continue; continue;
if ((mon = m_at(xx, yy)) != 0 && is_mercenary(mon->data) if ((mon = m_at(xx, yy)) != 0 && is_mercenary(mon->data)
&& mon->data != &mons[PM_GUARD] && mon->data != &mons[PM_GUARD]
&& (mon->msleeping || !mon->mcanmove)) { && helpless(mon)) {
g.m.defensive = obj; g.m.defensive = obj;
g.m.has_defense = MUSE_BUGLE; g.m.has_defense = MUSE_BUGLE;
goto toot; /* double break */ goto toot; /* double break */
@@ -2521,7 +2521,7 @@ munstone(struct monst* mon, boolean by_you)
if (resists_ston(mon)) if (resists_ston(mon))
return FALSE; return FALSE;
if (mon->meating || !mon->mcanmove || mon->msleeping) if (mon->meating || helpless(mon))
return FALSE; return FALSE;
mon->mstrategy &= ~STRAT_WAITFORU; mon->mstrategy &= ~STRAT_WAITFORU;
@@ -2675,7 +2675,7 @@ munslime(struct monst* mon, boolean by_you)
if (slimeproof(mptr)) if (slimeproof(mptr))
return FALSE; return FALSE;
if (mon->meating || !mon->mcanmove || mon->msleeping) if (mon->meating || helpless(mon))
return FALSE; return FALSE;
mon->mstrategy &= ~STRAT_WAITFORU; mon->mstrategy &= ~STRAT_WAITFORU;
+1 -1
View File
@@ -1490,7 +1490,7 @@ dogaze(void)
continue; continue;
} }
setmangry(mtmp, TRUE); setmangry(mtmp, TRUE);
if (!mtmp->mcanmove || mtmp->mstun || mtmp->msleeping if (helpless(mtmp) || mtmp->mstun
|| !mtmp->mcansee || !haseyes(mtmp->data)) { || !mtmp->mcansee || !haseyes(mtmp->data)) {
looked--; looked--;
continue; continue;
+3 -4
View File
@@ -428,7 +428,7 @@ intemple(int roomno)
shrined = has_shrine(priest); shrined = has_shrine(priest);
sanctum = (priest->data == &mons[PM_HIGH_CLERIC] sanctum = (priest->data == &mons[PM_HIGH_CLERIC]
&& (Is_sanctum(&u.uz) || In_endgame(&u.uz))); && (Is_sanctum(&u.uz) || In_endgame(&u.uz)));
can_speak = (priest->mcanmove && !priest->msleeping); can_speak = !helpless(priest);
if (can_speak && !Deaf && g.moves >= epri_p->intone_time) { if (can_speak && !Deaf && g.moves >= epri_p->intone_time) {
unsigned save_priest = priest->ispriest; unsigned save_priest = priest->ispriest;
@@ -572,15 +572,14 @@ priest_talk(struct monst *priest)
} }
/* priests don't chat unless peaceful and in their own temple */ /* priests don't chat unless peaceful and in their own temple */
if (!inhistemple(priest) || !priest->mpeaceful if (!inhistemple(priest) || !priest->mpeaceful || helpless(priest)) {
|| !priest->mcanmove || priest->msleeping) {
static const char *const cranky_msg[3] = { static const char *const cranky_msg[3] = {
"Thou wouldst have words, eh? I'll give thee a word or two!", "Thou wouldst have words, eh? I'll give thee a word or two!",
"Talk? Here is what I have to say!", "Talk? Here is what I have to say!",
"Pilgrim, I would speak no longer with thee." "Pilgrim, I would speak no longer with thee."
}; };
if (!priest->mcanmove || priest->msleeping) { if (helpless(priest)) {
pline("%s breaks out of %s reverie!", Monnam(priest), pline("%s breaks out of %s reverie!", Monnam(priest),
mhis(priest)); mhis(priest));
priest->mfrozen = priest->msleeping = 0; priest->mfrozen = priest->msleeping = 0;
+1 -1
View File
@@ -453,7 +453,7 @@ void
quest_stat_check(struct monst *mtmp) quest_stat_check(struct monst *mtmp)
{ {
if (mtmp->data->msound == MS_NEMESIS) if (mtmp->data->msound == MS_NEMESIS)
Qstat(in_battle) = (mtmp->mcanmove && !mtmp->msleeping Qstat(in_battle) = (!helpless(mtmp)
&& monnear(mtmp, u.ux, u.uy)); && monnear(mtmp, u.ux, u.uy));
} }
+13 -13
View File
@@ -20,7 +20,7 @@ static void kops_gone(boolean);
#define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE) #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE)
#define muteshk(shkp) \ #define muteshk(shkp) \
((shkp)->msleeping || !(shkp)->mcanmove \ (helpless(shkp) \
|| (shkp)->data->msound <= MS_ANIMAL) || (shkp)->data->msound <= MS_ANIMAL)
extern const struct shclass shtypes[]; /* defined in shknam.c */ extern const struct shclass shtypes[]; /* defined in shknam.c */
@@ -1108,7 +1108,7 @@ rile_shk(register struct monst* shkp)
static void static void
rouse_shk(struct monst* shkp, boolean verbosely) rouse_shk(struct monst* shkp, boolean verbosely)
{ {
if (!shkp->mcanmove || shkp->msleeping) { if (helpless(shkp)) {
/* greed induced recovery... */ /* greed induced recovery... */
if (verbosely && canspotmon(shkp)) if (verbosely && canspotmon(shkp))
pline("%s %s.", Shknam(shkp), pline("%s %s.", Shknam(shkp),
@@ -1340,7 +1340,7 @@ dopay(void)
if (ltmp || eshkp->billct || eshkp->debit) if (ltmp || eshkp->billct || eshkp->debit)
rouse_shk(shkp, TRUE); rouse_shk(shkp, TRUE);
if (!shkp->mcanmove || shkp->msleeping) { /* still asleep/paralyzed */ if (helpless(shkp)) { /* still asleep/paralyzed */
pline("%s %s.", Shknam(shkp), pline("%s %s.", Shknam(shkp),
rn2(2) ? "seems to be napping" : "doesn't respond"); rn2(2) ? "seems to be napping" : "doesn't respond");
return ECMD_OK; return ECMD_OK;
@@ -1800,7 +1800,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
Sprintf(takes, ", shakes %s %s,", noit_mhis(shkp), Sprintf(takes, ", shakes %s %s,", noit_mhis(shkp),
mbodypart(shkp, HEAD)); mbodypart(shkp, HEAD));
pline("%s %slooks at your corpse%s and %s.", Shknam(shkp), pline("%s %slooks at your corpse%s and %s.", Shknam(shkp),
(!shkp->mcanmove || shkp->msleeping) ? "wakes up, " : "", helpless(shkp) ? "wakes up, " : "",
takes, !inhishop(shkp) ? "disappears" : "sighs"); takes, !inhishop(shkp) ? "disappears" : "sighs");
} }
rouse_shk(shkp, FALSE); /* wake shk for bones */ rouse_shk(shkp, FALSE); /* wake shk for bones */
@@ -1834,7 +1834,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
goto skip; goto skip;
umoney = money_cnt(g.invent); umoney = money_cnt(g.invent);
takes[0] = '\0'; takes[0] = '\0';
if (!shkp->mcanmove || shkp->msleeping) if (helpless(shkp))
Strcat(takes, "wakes up and "); Strcat(takes, "wakes up and ");
if (!next2u(shkp->mx, shkp->my)) if (!next2u(shkp->mx, shkp->my))
Strcat(takes, "comes and "); Strcat(takes, "comes and ");
@@ -3449,7 +3449,7 @@ shkcatch(register struct obj* obj, register xchar x, register xchar y)
if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp)) if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp))
return 0; return 0;
if (shkp->mcanmove && !shkp->msleeping if (!helpless(shkp)
&& (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy)) && (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy))
&& dist2(shkp->mx, shkp->my, x, y) < 3 && dist2(shkp->mx, shkp->my, x, y) < 3
/* if it is the shk's pos, you hit and anger him */ /* if it is the shk's pos, you hit and anger him */
@@ -3520,7 +3520,7 @@ shk_impaired(struct monst *shkp)
{ {
if (!shkp || !shkp->isshk || !inhishop(shkp)) if (!shkp || !shkp->isshk || !inhishop(shkp))
return TRUE; return TRUE;
if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following) if (helpless(shkp) || ESHK(shkp)->following)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@@ -4021,7 +4021,7 @@ shopdig(register int fall)
/* 0 == can't speak, 1 == makes animal noises, 2 == speaks */ /* 0 == can't speak, 1 == makes animal noises, 2 == speaks */
lang = 0; lang = 0;
if (shkp->msleeping || !shkp->mcanmove || is_silent(shkp->data)) if (helpless(shkp) || is_silent(shkp->data))
; /* lang stays 0 */ ; /* lang stays 0 */
else if (shkp->data->msound <= MS_ANIMAL) else if (shkp->data->msound <= MS_ANIMAL)
lang = 1; lang = 1;
@@ -4053,7 +4053,7 @@ shopdig(register int fall)
adjalign(-sgn(u.ualign.type)); adjalign(-sgn(u.ualign.type));
} }
} else if (!um_dist(shkp->mx, shkp->my, 5) } else if (!um_dist(shkp->mx, shkp->my, 5)
&& !shkp->msleeping && shkp->mcanmove && !helpless(shkp)
&& (ESHK(shkp)->billct || ESHK(shkp)->debit)) { && (ESHK(shkp)->billct || ESHK(shkp)->debit)) {
register struct obj *obj, *obj2; register struct obj *obj, *obj2;
@@ -4252,7 +4252,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|| !rn2(50)) { || !rn2(50)) {
getcad: getcad:
if (muteshk(shkp)) { if (muteshk(shkp)) {
if (animal && shkp->mcanmove && !shkp->msleeping) if (animal && !helpless(shkp))
yelp(shkp); yelp(shkp);
} else if (pursue || uinshp || !um_dist(x, y, 1)) { } else if (pursue || uinshp || !um_dist(x, y, 1)) {
if (!Deaf) if (!Deaf)
@@ -4340,7 +4340,7 @@ shop_object(register xchar x, register xchar y)
break; break;
/* note: otmp might have ->no_charge set, but that's ok */ /* note: otmp might have ->no_charge set, but that's ok */
return (otmp && costly_spot(x, y) return (otmp && costly_spot(x, y)
&& NOTANGRY(shkp) && shkp->mcanmove && !shkp->msleeping) && NOTANGRY(shkp) && !helpless(shkp))
? otmp ? otmp
: (struct obj *) 0; : (struct obj *) 0;
} }
@@ -4729,7 +4729,7 @@ block_door(register xchar x, register xchar y)
*/ */
&& ESHK(shkp)->shd.x == x && ESHK(shkp)->shd.x == x
&& ESHK(shkp)->shd.y == y && ESHK(shkp)->shd.y == y
&& shkp->mcanmove && !shkp->msleeping && !helpless(shkp)
&& (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) { && (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) {
pline("%s%s blocks your way!", Shknam(shkp), pline("%s%s blocks your way!", Shknam(shkp),
Invis ? " senses your motion and" : ""); Invis ? " senses your motion and" : "");
@@ -4763,7 +4763,7 @@ block_entry(register xchar x, register xchar y)
sx = ESHK(shkp)->shk.x; sx = ESHK(shkp)->shk.x;
sy = ESHK(shkp)->shk.y; sy = ESHK(shkp)->shk.y;
if (shkp->mx == sx && shkp->my == sy && shkp->mcanmove && !shkp->msleeping if (shkp->mx == sx && shkp->my == sy && !helpless(shkp)
&& (x == sx - 1 || x == sx + 1 || y == sy - 1 || y == sy + 1) && (x == sx - 1 || x == sx + 1 || y == sy - 1 || y == sy + 1)
&& (Invis || carrying(PICK_AXE) || carrying(DWARVISH_MATTOCK) && (Invis || carrying(PICK_AXE) || carrying(DWARVISH_MATTOCK)
|| u.usteed)) { || u.usteed)) {
+9 -9
View File
@@ -222,7 +222,7 @@ dosounds(void)
continue; continue;
if (mtmp->ispriest && inhistemple(mtmp) if (mtmp->ispriest && inhistemple(mtmp)
/* priest must be active */ /* priest must be active */
&& mtmp->mcanmove && !mtmp->msleeping && !helpless(mtmp)
/* hero must be outside this temple */ /* hero must be outside this temple */
&& temple_occupied(u.urooms) != EPRI(mtmp)->shroom) && temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
break; break;
@@ -351,7 +351,7 @@ growl(register struct monst* mtmp)
{ {
register const char *growl_verb = 0; register const char *growl_verb = 0;
if (mtmp->msleeping || !mtmp->mcanmove || mtmp->data->msound == MS_SILENT) if (helpless(mtmp) || mtmp->data->msound == MS_SILENT)
return; return;
/* presumably nearness and soundok checks have already been made */ /* presumably nearness and soundok checks have already been made */
@@ -376,7 +376,7 @@ yelp(register struct monst* mtmp)
{ {
register const char *yelp_verb = 0; register const char *yelp_verb = 0;
if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound) if (helpless(mtmp) || !mtmp->data->msound)
return; return;
/* presumably nearness and soundok checks have already been made */ /* presumably nearness and soundok checks have already been made */
@@ -418,7 +418,7 @@ whimper(register struct monst* mtmp)
{ {
register const char *whimper_verb = 0; register const char *whimper_verb = 0;
if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound) if (helpless(mtmp) || !mtmp->data->msound)
return; return;
/* presumably nearness and soundok checks have already been made */ /* presumably nearness and soundok checks have already been made */
@@ -449,7 +449,7 @@ whimper(register struct monst* mtmp)
void void
beg(register struct monst* mtmp) beg(register struct monst* mtmp)
{ {
if (mtmp->msleeping || !mtmp->mcanmove if (helpless(mtmp)
|| !(carnivorous(mtmp->data) || herbivorous(mtmp->data))) || !(carnivorous(mtmp->data) || herbivorous(mtmp->data)))
return; return;
@@ -1117,7 +1117,7 @@ dochat(void)
} }
if (u.usteed && u.dz > 0) { if (u.usteed && u.dz > 0) {
if (!u.usteed->mcanmove || u.usteed->msleeping) { if (helpless(u.usteed)) {
pline("%s seems not to notice you.", Monnam(u.usteed)); pline("%s seems not to notice you.", Monnam(u.usteed));
return ECMD_TIME; return ECMD_TIME;
} else } else
@@ -1198,7 +1198,7 @@ dochat(void)
return ECMD_OK; return ECMD_OK;
/* sleeping monsters won't talk, except priests (who wake up) */ /* sleeping monsters won't talk, except priests (who wake up) */
if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) { if (helpless(mtmp) && !mtmp->ispriest) {
/* If it is unseen, the player can't tell the difference between /* If it is unseen, the player can't tell the difference between
not noticing him and just not existing, so skip the message. */ not noticing him and just not existing, so skip the message. */
if (canspotmon(mtmp)) if (canspotmon(mtmp))
@@ -1235,7 +1235,7 @@ responsive_mon_at(int x, int y)
{ {
struct monst *mtmp = isok(x, y) ? m_at(x, y) : 0; struct monst *mtmp = isok(x, y) ? m_at(x, y) : 0;
if (mtmp && (!mtmp->mcanmove || mtmp->msleeping /* immobilized monst */ if (mtmp && (helpless(mtmp) /* immobilized monst */
|| !mtmp->mcansee || !haseyes(mtmp->data) /* blind monst */ || !mtmp->mcansee || !haseyes(mtmp->data) /* blind monst */
|| (Invis && !perceives(mtmp->data)) /* unseen hero */ || (Invis && !perceives(mtmp->data)) /* unseen hero */
|| (x != mtmp->mx || y != mtmp->my))) /* worm tail */ || (x != mtmp->mx || y != mtmp->my))) /* worm tail */
@@ -1271,7 +1271,7 @@ tiphat(void)
if (!u.dx && !u.dy) { if (!u.dx && !u.dy) {
if (u.usteed && u.dz > 0) { if (u.usteed && u.dz > 0) {
if (!u.usteed->mcanmove || u.usteed->msleeping) if (helpless(u.usteed))
pline("%s doesn't notice.", Monnam(u.usteed)); pline("%s doesn't notice.", Monnam(u.usteed));
else else
(void) domonnoise(u.usteed); (void) domonnoise(u.usteed);
+5 -5
View File
@@ -383,7 +383,7 @@ kick_steed(void)
return; return;
/* [ALI] Various effects of kicking sleeping/paralyzed steeds */ /* [ALI] Various effects of kicking sleeping/paralyzed steeds */
if (u.usteed->msleeping || !u.usteed->mcanmove) { if (helpless(u.usteed)) {
/* We assume a message has just been output of the form /* We assume a message has just been output of the form
* "You kick <steed>." * "You kick <steed>."
*/ */
@@ -398,7 +398,7 @@ kick_steed(void)
u.usteed->mfrozen = 0; u.usteed->mfrozen = 0;
u.usteed->mcanmove = 1; u.usteed->mcanmove = 1;
} }
if (u.usteed->msleeping || !u.usteed->mcanmove) if (helpless(u.usteed))
pline("%s stirs.", He); pline("%s stirs.", He);
else else
/* if hallucinating, might yield "He rouses herself" or /* if hallucinating, might yield "He rouses herself" or
@@ -707,7 +707,7 @@ static void
maybewakesteed(struct monst* steed) maybewakesteed(struct monst* steed)
{ {
int frozen = (int) steed->mfrozen; int frozen = (int) steed->mfrozen;
boolean wasimmobile = steed->msleeping || !steed->mcanmove; boolean wasimmobile = helpless(steed);
steed->msleeping = 0; steed->msleeping = 0;
if (frozen) { if (frozen) {
@@ -721,7 +721,7 @@ maybewakesteed(struct monst* steed)
steed->mfrozen = frozen; steed->mfrozen = frozen;
} }
} }
if (wasimmobile && !steed->msleeping && steed->mcanmove) if (wasimmobile && !helpless(steed))
pline("%s wakes up.", Monnam(steed)); pline("%s wakes up.", Monnam(steed));
/* regardless of waking, terminate any meal in progress */ /* regardless of waking, terminate any meal in progress */
finish_meating(steed); finish_meating(steed);
@@ -736,7 +736,7 @@ stucksteed(boolean checkfeeding)
if (steed) { if (steed) {
/* check whether steed can move */ /* check whether steed can move */
if (steed->msleeping || !steed->mcanmove) { if (helpless(steed)) {
pline("%s won't move!", upstart(y_monnam(steed))); pline("%s won't move!", upstart(y_monnam(steed)));
return TRUE; return TRUE;
} }
+4 -4
View File
@@ -1325,7 +1325,7 @@ trapeffect_slp_gas_trap(
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (!resists_sleep(mtmp) && !breathless(mtmp->data) if (!resists_sleep(mtmp) && !breathless(mtmp->data)
&& !mtmp->msleeping && mtmp->mcanmove) { && !helpless(mtmp)) {
if (sleep_monst(mtmp, rnd(25), -1) && in_sight) { if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!", Monnam(mtmp)); pline("%s suddenly falls asleep!", Monnam(mtmp));
seetrap(trap); seetrap(trap);
@@ -2581,7 +2581,7 @@ steedintrap(struct trap* trap, struct obj* otmp)
break; break;
case SLP_GAS_TRAP: case SLP_GAS_TRAP:
if (!resists_sleep(steed) && !breathless(steed->data) if (!resists_sleep(steed) && !breathless(steed->data)
&& !steed->msleeping && steed->mcanmove) { && !helpless(steed)) {
if (sleep_monst(steed, rnd(25), -1)) if (sleep_monst(steed, rnd(25), -1))
/* no in_sight check here; you can feel it even if blind */ /* no in_sight check here; you can feel it even if blind */
pline("%s suddenly falls asleep!", Monnam(steed)); pline("%s suddenly falls asleep!", Monnam(steed));
@@ -4687,7 +4687,7 @@ static void
reward_untrap(struct trap* ttmp, struct monst* mtmp) reward_untrap(struct trap* ttmp, struct monst* mtmp)
{ {
if (!ttmp->madeby_u) { if (!ttmp->madeby_u) {
if (rnl(10) < 8 && !mtmp->mpeaceful && !mtmp->msleeping if (rnl(10) < 8 && !mtmp->mpeaceful && !helpless(mtmp)
&& !mtmp->mfrozen && !mindless(mtmp->data) && !mtmp->mfrozen && !mindless(mtmp->data)
&& mtmp->data->mlet != S_HUMAN) { && mtmp->data->mlet != S_HUMAN) {
mtmp->mpeaceful = 1; mtmp->mpeaceful = 1;
@@ -4868,7 +4868,7 @@ help_monster_out(
return 1; return 1;
/* Will our hero succeed? */ /* Will our hero succeed? */
if ((uprob = untrap_prob(ttmp)) && !mtmp->msleeping && mtmp->mcanmove) { if ((uprob = untrap_prob(ttmp)) && !helpless(mtmp)) {
You("try to reach out your %s, but %s backs away skeptically.", You("try to reach out your %s, but %s backs away skeptically.",
makeplural(body_part(ARM)), mon_nam(mtmp)); makeplural(body_part(ARM)), mon_nam(mtmp));
return 1; return 1;
+5 -6
View File
@@ -269,7 +269,7 @@ check_caitiff(struct monst *mtmp)
if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL
&& !is_undead(mtmp->data) && !is_undead(mtmp->data)
&& (!mtmp->mcanmove || mtmp->msleeping && (helpless(mtmp)
|| (mtmp->mflee && !mtmp->mavenge))) { || (mtmp->mflee && !mtmp->mavenge))) {
You("caitiff!"); You("caitiff!");
adjalign(-1); adjalign(-1);
@@ -432,7 +432,7 @@ do_attack(struct monst *mtmp)
You("stop. %s is in the way!", buf); You("stop. %s is in the way!", buf);
end_running(TRUE); end_running(TRUE);
return TRUE; return TRUE;
} else if (mtmp->mfrozen || mtmp->msleeping || !mtmp->mcanmove } else if (mtmp->mfrozen || helpless(mtmp)
|| (mtmp->data->mmove == 0 && rn2(6))) { || (mtmp->data->mmove == 0 && rn2(6))) {
pline("%s doesn't seem to move!", Monnam(mtmp)); pline("%s doesn't seem to move!", Monnam(mtmp));
end_running(TRUE); end_running(TRUE);
@@ -485,7 +485,7 @@ do_attack(struct monst *mtmp)
u_wipe_engr(3); u_wipe_engr(3);
/* Is the "it died" check actually correct? */ /* Is the "it died" check actually correct? */
if (mdat->mlet == S_LEPRECHAUN && !mtmp->mfrozen && !mtmp->msleeping if (mdat->mlet == S_LEPRECHAUN && !mtmp->mfrozen && !helpless(mtmp)
&& !mtmp->mconf && mtmp->mcansee && !rn2(7) && !mtmp->mconf && mtmp->mcansee && !rn2(7)
&& (m_move(mtmp, 0) == MMOVE_DIED /* it died */ && (m_move(mtmp, 0) == MMOVE_DIED /* it died */
|| mtmp->mx != u.ux + u.dx || mtmp->mx != u.ux + u.dx
@@ -1473,8 +1473,7 @@ hmon_hitmon(
nohandglow(mon); nohandglow(mon);
if (!mon->mconf && !resist(mon, SPBOOK_CLASS, 0, NOTELL)) { if (!mon->mconf && !resist(mon, SPBOOK_CLASS, 0, NOTELL)) {
mon->mconf = 1; mon->mconf = 1;
if (!mon->mstun && mon->mcanmove && !mon->msleeping if (!mon->mstun && !helpless(mon) && canseemon(mon))
&& canseemon(mon))
pline("%s appears confused.", Monnam(mon)); pline("%s appears confused.", Monnam(mon));
} }
} }
@@ -4603,7 +4602,7 @@ missum(struct monst *mdef, struct attack *mattk, boolean wouldhavehit)
You("miss %s.", mon_nam(mdef)); You("miss %s.", mon_nam(mdef));
else else
You("miss it."); You("miss it.");
if (!mdef->msleeping && mdef->mcanmove) if (!helpless(mdef))
wakeup(mdef, TRUE); wakeup(mdef, TRUE);
} }
+1 -1
View File
@@ -106,7 +106,7 @@ new_were(struct monst *mon)
: pmname(&mons[pm], Mgender(mon)) + 4); : pmname(&mons[pm], Mgender(mon)) + 4);
set_mon_data(mon, &mons[pm]); set_mon_data(mon, &mons[pm]);
if (mon->msleeping || !mon->mcanmove) { if (helpless(mon)) {
/* transformation wakens and/or revitalizes */ /* transformation wakens and/or revitalizes */
mon->msleeping = 0; mon->msleeping = 0;
mon->mfrozen = 0; /* not asleep or paralyzed */ mon->mfrozen = 0; /* not asleep or paralyzed */
+2 -2
View File
@@ -456,7 +456,7 @@ has_aggravatables(struct monst *mon)
if (in_w_tower != In_W_tower(mtmp->mx, mtmp->my, &u.uz)) if (in_w_tower != In_W_tower(mtmp->mx, mtmp->my, &u.uz))
continue; continue;
if ((mtmp->mstrategy & STRAT_WAITFORU) != 0 if ((mtmp->mstrategy & STRAT_WAITFORU) != 0
|| mtmp->msleeping || !mtmp->mcanmove) || helpless(mtmp))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@@ -706,7 +706,7 @@ resurrect(void)
mtmp->msleeping = 0; mtmp->msleeping = 0;
if (mtmp->mfrozen == 1) /* would unfreeze on next move */ if (mtmp->mfrozen == 1) /* would unfreeze on next move */
mtmp->mfrozen = 0, mtmp->mcanmove = 1; mtmp->mfrozen = 0, mtmp->mcanmove = 1;
if (mtmp->mcanmove && !mtmp->msleeping) { if (!helpless(mtmp)) {
*mmtmp = mtmp->nmon; *mmtmp = mtmp->nmon;
mon_arrive(mtmp, TRUE); mon_arrive(mtmp, TRUE);
/* note: there might be a second Wizard; if so, /* note: there might be a second Wizard; if so,