((m)->data->mlet == S_TROLL && (o) && (o)->oartifact == ART_TROLLSBANE)
#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,
given the current level difficulty and the hero's level. */
if (is_flyer(etmp->edata)
&& (is_u(etmp) ? !Unaware
- : (etmp->emon->mcanmove && !etmp->emon->msleeping)))
+ : !helpless(etmp->emon)))
/* flying requires mobility */
misses = 5; /* out of 8 */
else if (is_floater(etmp->edata)
int tmp = 4; /* out of 10 */
if (is_u(etmp) ? (Unaware || Fumbling)
- : (!etmp->emon->mcanmove || etmp->emon->msleeping
+ : (helpless(etmp->emon)
|| !etmp->edata->mmove || etmp->emon->wormno))
return FALSE;
&& mclass == S_WORM_TAIL))
map_monst(mtmp, TRUE);
- if (otmp && otmp->cursed
- && (mtmp->msleeping || !mtmp->mcanmove)) {
+ if (otmp && otmp->cursed && helpless(mtmp)) {
mtmp->msleeping = mtmp->mfrozen = 0;
mtmp->mcanmove = 1;
woken = TRUE;
if (!alreadynamed(mtmp, monnambuf, buf))
pline("%s doesn't like being called names!", upstart(monnambuf));
} else if (mtmp->isshk
- && !(Deaf || mtmp->msleeping || !mtmp->mcanmove
+ && !(Deaf || helpless(mtmp)
|| mtmp->data->msound <= MS_ANIMAL)) {
if (!alreadynamed(mtmp, monnambuf, buf))
verbalize("I'm %s, not %s.", shkname(mtmp), buf);
the amulet; if you don't have it, will chase you
only if in range. -3. */
|| (u.uhave.amulet && mtmp->iswiz))
- && ((!mtmp->msleeping && mtmp->mcanmove)
+ && (!helpless(mtmp)
/* eg if level teleport or new trap, steed has no control
to avoid following */
|| (mtmp == u.usteed))
int omx, omy, carryamt = 0;
struct obj *obj, *otmp;
- if (mtmp->msleeping || !mtmp->mcanmove)
+ if (helpless(mtmp))
return 0;
omx = mtmp->mx;
and also treat gems or glass shot via sling as attacks */
if (obj->oclass == GEM_CLASS && is_unicorn(mon->data)
&& objects[obj->otyp].oc_material != MINERAL && !uslinging()) {
- if (mon->msleeping || !mon->mcanmove) {
+ if (helpless(mon)) {
tmiss(obj, mon, FALSE);
return 0;
} else if (mon->mtame) {
/* target monster might decide to switch places with you... */
*displaceu = (mtmp->data == &mons[PM_DISPLACER_BEAST] && !rn2(2)
&& mtmp->mux == u.ux0 && mtmp->muy == u.uy0
- && mtmp->mcanmove && !mtmp->msleeping
+ && !helpless(mtmp)
&& !mtmp->meating && !mtmp->mtrapped
&& !u.utrap && !u.ustuck && !u.usteed
&& !(u.dx && u.dy
&& (Hallucination
|| (!mtmp->mpeaceful && !noattacks(mtmp->data)))
&& (!is_hider(mtmp->data) || !mtmp->mundetected)
- && mtmp->mcanmove && !mtmp->msleeping
+ && !helpless(mtmp)
&& !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp))
return 1;
}
if (!magr || !mdef)
return MM_MISS; /* mike@genat */
- if (!magr->mcanmove || magr->msleeping)
+ if (helpless(magr))
return MM_MISS;
pa = magr->data;
pd = mdef->data;
/* Calculate the armour class differential. */
tmp = find_mac(mdef) + magr->m_lev;
- if (mdef->mconf || !mdef->mcanmove || mdef->msleeping) {
+ if (mdef->mconf || helpless(mdef)) {
tmp += 4;
mdef->msleeping = 0;
}
if (res[i] & MM_AGR_DIED)
return res[i];
/* return if aggressor can no longer attack */
- if (!magr->mcanmove || magr->msleeping)
+ if (helpless(magr))
return res[i];
if (res[i] & MM_HIT)
struck = 1; /* at least one hit */
void
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) {
pline("%s grip relaxes.", s_suffix(Monnam(mon)));
unstuck(mon);
break;
case MMOVE_MOVED: /* monster moved */
/* Maybe it stepped on a trap and fell asleep... */
- if (mtmp->msleeping || !mtmp->mcanmove)
+ if (helpless(mtmp))
return 0;
/* Monsters can move and then shoot on same turn;
our hero can't. Is that fair? */
}
}
/* special speeches for quest monsters */
- if (!mtmp->msleeping && mtmp->mcanmove && nearby)
+ if (!helpless(mtmp) && nearby)
quest_talk(mtmp);
/* extra emotional attack for vile monsters */
if (inrange && mtmp->data->msound == MS_CUSS && !mtmp->mpeaceful
maybe_spin_web(struct monst *mtmp)
{
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)) {
struct trap *trap;
int prob = ((((mtmp->data == &mons[PM_GIANT_SPIDER]) ? 15 : 5)
underneath an immobile or hidden monster;
paralysis victims excluded */
if ((mtoo = m_at(xx, yy)) != 0
- && (mtoo->msleeping || mtoo->mundetected
+ && (helpless(mtoo) || mtoo->mundetected
|| (mtoo->mappearance && !mtoo->iswiz)
|| !mtoo->data->mmove))
continue;
(just in case the object it was hiding under went away);
usually set mundetected unless monster can't move. */
if (mtmp->mundetected
- || (mtmp->mcanmove && !mtmp->msleeping && rn2(5)))
+ || (!helpless(mtmp) && rn2(5)))
(void) hideunder(mtmp);
newsym(mtmp->mx, mtmp->my);
}
continue;
if ((mon = m_at(xx, yy)) != 0 && is_mercenary(mon->data)
&& mon->data != &mons[PM_GUARD]
- && (mon->msleeping || !mon->mcanmove)) {
+ && helpless(mon)) {
g.m.defensive = obj;
g.m.has_defense = MUSE_BUGLE;
goto toot; /* double break */
if (resists_ston(mon))
return FALSE;
- if (mon->meating || !mon->mcanmove || mon->msleeping)
+ if (mon->meating || helpless(mon))
return FALSE;
mon->mstrategy &= ~STRAT_WAITFORU;
if (slimeproof(mptr))
return FALSE;
- if (mon->meating || !mon->mcanmove || mon->msleeping)
+ if (mon->meating || helpless(mon))
return FALSE;
mon->mstrategy &= ~STRAT_WAITFORU;
continue;
}
setmangry(mtmp, TRUE);
- if (!mtmp->mcanmove || mtmp->mstun || mtmp->msleeping
+ if (helpless(mtmp) || mtmp->mstun
|| !mtmp->mcansee || !haseyes(mtmp->data)) {
looked--;
continue;
shrined = has_shrine(priest);
sanctum = (priest->data == &mons[PM_HIGH_CLERIC]
&& (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) {
unsigned save_priest = priest->ispriest;
}
/* priests don't chat unless peaceful and in their own temple */
- if (!inhistemple(priest) || !priest->mpeaceful
- || !priest->mcanmove || priest->msleeping) {
+ if (!inhistemple(priest) || !priest->mpeaceful || helpless(priest)) {
static const char *const cranky_msg[3] = {
"Thou wouldst have words, eh? I'll give thee a word or two!",
"Talk? Here is what I have to say!",
"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),
mhis(priest));
priest->mfrozen = priest->msleeping = 0;
quest_stat_check(struct monst *mtmp)
{
if (mtmp->data->msound == MS_NEMESIS)
- Qstat(in_battle) = (mtmp->mcanmove && !mtmp->msleeping
+ Qstat(in_battle) = (!helpless(mtmp)
&& monnear(mtmp, u.ux, u.uy));
}
#define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE)
#define muteshk(shkp) \
- ((shkp)->msleeping || !(shkp)->mcanmove \
+ (helpless(shkp) \
|| (shkp)->data->msound <= MS_ANIMAL)
extern const struct shclass shtypes[]; /* defined in shknam.c */
static void
rouse_shk(struct monst* shkp, boolean verbosely)
{
- if (!shkp->mcanmove || shkp->msleeping) {
+ if (helpless(shkp)) {
/* greed induced recovery... */
if (verbosely && canspotmon(shkp))
pline("%s %s.", Shknam(shkp),
if (ltmp || eshkp->billct || eshkp->debit)
rouse_shk(shkp, TRUE);
- if (!shkp->mcanmove || shkp->msleeping) { /* still asleep/paralyzed */
+ if (helpless(shkp)) { /* still asleep/paralyzed */
pline("%s %s.", Shknam(shkp),
rn2(2) ? "seems to be napping" : "doesn't respond");
return ECMD_OK;
Sprintf(takes, ", shakes %s %s,", noit_mhis(shkp),
mbodypart(shkp, HEAD));
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");
}
rouse_shk(shkp, FALSE); /* wake shk for bones */
goto skip;
umoney = money_cnt(g.invent);
takes[0] = '\0';
- if (!shkp->mcanmove || shkp->msleeping)
+ if (helpless(shkp))
Strcat(takes, "wakes up and ");
if (!next2u(shkp->mx, shkp->my))
Strcat(takes, "comes and ");
if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp))
return 0;
- if (shkp->mcanmove && !shkp->msleeping
+ if (!helpless(shkp)
&& (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy))
&& dist2(shkp->mx, shkp->my, x, y) < 3
/* if it is the shk's pos, you hit and anger him */
{
if (!shkp || !shkp->isshk || !inhishop(shkp))
return TRUE;
- if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following)
+ if (helpless(shkp) || ESHK(shkp)->following)
return TRUE;
return FALSE;
}
/* 0 == can't speak, 1 == makes animal noises, 2 == speaks */
lang = 0;
- if (shkp->msleeping || !shkp->mcanmove || is_silent(shkp->data))
+ if (helpless(shkp) || is_silent(shkp->data))
; /* lang stays 0 */
else if (shkp->data->msound <= MS_ANIMAL)
lang = 1;
adjalign(-sgn(u.ualign.type));
}
} else if (!um_dist(shkp->mx, shkp->my, 5)
- && !shkp->msleeping && shkp->mcanmove
+ && !helpless(shkp)
&& (ESHK(shkp)->billct || ESHK(shkp)->debit)) {
register struct obj *obj, *obj2;
|| !rn2(50)) {
getcad:
if (muteshk(shkp)) {
- if (animal && shkp->mcanmove && !shkp->msleeping)
+ if (animal && !helpless(shkp))
yelp(shkp);
} else if (pursue || uinshp || !um_dist(x, y, 1)) {
if (!Deaf)
break;
/* note: otmp might have ->no_charge set, but that's ok */
return (otmp && costly_spot(x, y)
- && NOTANGRY(shkp) && shkp->mcanmove && !shkp->msleeping)
+ && NOTANGRY(shkp) && !helpless(shkp))
? otmp
: (struct obj *) 0;
}
*/
&& ESHK(shkp)->shd.x == x
&& ESHK(shkp)->shd.y == y
- && shkp->mcanmove && !shkp->msleeping
+ && !helpless(shkp)
&& (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) {
pline("%s%s blocks your way!", Shknam(shkp),
Invis ? " senses your motion and" : "");
sx = ESHK(shkp)->shk.x;
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)
&& (Invis || carrying(PICK_AXE) || carrying(DWARVISH_MATTOCK)
|| u.usteed)) {
continue;
if (mtmp->ispriest && inhistemple(mtmp)
/* priest must be active */
- && mtmp->mcanmove && !mtmp->msleeping
+ && !helpless(mtmp)
/* hero must be outside this temple */
&& temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
break;
{
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;
/* presumably nearness and soundok checks have already been made */
{
register const char *yelp_verb = 0;
- if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
+ if (helpless(mtmp) || !mtmp->data->msound)
return;
/* presumably nearness and soundok checks have already been made */
{
register const char *whimper_verb = 0;
- if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
+ if (helpless(mtmp) || !mtmp->data->msound)
return;
/* presumably nearness and soundok checks have already been made */
void
beg(register struct monst* mtmp)
{
- if (mtmp->msleeping || !mtmp->mcanmove
+ if (helpless(mtmp)
|| !(carnivorous(mtmp->data) || herbivorous(mtmp->data)))
return;
}
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));
return ECMD_TIME;
} else
return ECMD_OK;
/* 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
not noticing him and just not existing, so skip the message. */
if (canspotmon(mtmp))
{
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 */
|| (Invis && !perceives(mtmp->data)) /* unseen hero */
|| (x != mtmp->mx || y != mtmp->my))) /* worm tail */
if (!u.dx && !u.dy) {
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));
else
(void) domonnoise(u.usteed);
return;
/* [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
* "You kick <steed>."
*/
u.usteed->mfrozen = 0;
u.usteed->mcanmove = 1;
}
- if (u.usteed->msleeping || !u.usteed->mcanmove)
+ if (helpless(u.usteed))
pline("%s stirs.", He);
else
/* if hallucinating, might yield "He rouses herself" or
maybewakesteed(struct monst* steed)
{
int frozen = (int) steed->mfrozen;
- boolean wasimmobile = steed->msleeping || !steed->mcanmove;
+ boolean wasimmobile = helpless(steed);
steed->msleeping = 0;
if (frozen) {
steed->mfrozen = frozen;
}
}
- if (wasimmobile && !steed->msleeping && steed->mcanmove)
+ if (wasimmobile && !helpless(steed))
pline("%s wakes up.", Monnam(steed));
/* regardless of waking, terminate any meal in progress */
finish_meating(steed);
if (steed) {
/* check whether steed can move */
- if (steed->msleeping || !steed->mcanmove) {
+ if (helpless(steed)) {
pline("%s won't move!", upstart(y_monnam(steed)));
return TRUE;
}
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (!resists_sleep(mtmp) && !breathless(mtmp->data)
- && !mtmp->msleeping && mtmp->mcanmove) {
+ && !helpless(mtmp)) {
if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!", Monnam(mtmp));
seetrap(trap);
break;
case SLP_GAS_TRAP:
if (!resists_sleep(steed) && !breathless(steed->data)
- && !steed->msleeping && steed->mcanmove) {
+ && !helpless(steed)) {
if (sleep_monst(steed, rnd(25), -1))
/* no in_sight check here; you can feel it even if blind */
pline("%s suddenly falls asleep!", Monnam(steed));
reward_untrap(struct trap* ttmp, struct monst* mtmp)
{
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->data->mlet != S_HUMAN) {
mtmp->mpeaceful = 1;
return 1;
/* 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.",
makeplural(body_part(ARM)), mon_nam(mtmp));
return 1;
if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL
&& !is_undead(mtmp->data)
- && (!mtmp->mcanmove || mtmp->msleeping
+ && (helpless(mtmp)
|| (mtmp->mflee && !mtmp->mavenge))) {
You("caitiff!");
adjalign(-1);
You("stop. %s is in the way!", buf);
end_running(TRUE);
return TRUE;
- } else if (mtmp->mfrozen || mtmp->msleeping || !mtmp->mcanmove
+ } else if (mtmp->mfrozen || helpless(mtmp)
|| (mtmp->data->mmove == 0 && rn2(6))) {
pline("%s doesn't seem to move!", Monnam(mtmp));
end_running(TRUE);
u_wipe_engr(3);
/* 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)
&& (m_move(mtmp, 0) == MMOVE_DIED /* it died */
|| mtmp->mx != u.ux + u.dx
nohandglow(mon);
if (!mon->mconf && !resist(mon, SPBOOK_CLASS, 0, NOTELL)) {
mon->mconf = 1;
- if (!mon->mstun && mon->mcanmove && !mon->msleeping
- && canseemon(mon))
+ if (!mon->mstun && !helpless(mon) && canseemon(mon))
pline("%s appears confused.", Monnam(mon));
}
}
You("miss %s.", mon_nam(mdef));
else
You("miss it.");
- if (!mdef->msleeping && mdef->mcanmove)
+ if (!helpless(mdef))
wakeup(mdef, TRUE);
}
: pmname(&mons[pm], Mgender(mon)) + 4);
set_mon_data(mon, &mons[pm]);
- if (mon->msleeping || !mon->mcanmove) {
+ if (helpless(mon)) {
/* transformation wakens and/or revitalizes */
mon->msleeping = 0;
mon->mfrozen = 0; /* not asleep or paralyzed */
if (in_w_tower != In_W_tower(mtmp->mx, mtmp->my, &u.uz))
continue;
if ((mtmp->mstrategy & STRAT_WAITFORU) != 0
- || mtmp->msleeping || !mtmp->mcanmove)
+ || helpless(mtmp))
return TRUE;
}
return FALSE;
mtmp->msleeping = 0;
if (mtmp->mfrozen == 1) /* would unfreeze on next move */
mtmp->mfrozen = 0, mtmp->mcanmove = 1;
- if (mtmp->mcanmove && !mtmp->msleeping) {
+ if (!helpless(mtmp)) {
*mmtmp = mtmp->nmon;
mon_arrive(mtmp, TRUE);
/* note: there might be a second Wizard; if so,