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
+13 -13
View File
@@ -20,7 +20,7 @@ static void kops_gone(boolean);
#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 */
@@ -1108,7 +1108,7 @@ rile_shk(register struct monst* shkp)
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),
@@ -1340,7 +1340,7 @@ dopay(void)
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;
@@ -1800,7 +1800,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
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 */
@@ -1834,7 +1834,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
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 ");
@@ -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))
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 */
@@ -3520,7 +3520,7 @@ shk_impaired(struct monst *shkp)
{
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;
}
@@ -4021,7 +4021,7 @@ shopdig(register int fall)
/* 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;
@@ -4053,7 +4053,7 @@ shopdig(register int fall)
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;
@@ -4252,7 +4252,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|| !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)
@@ -4340,7 +4340,7 @@ shop_object(register xchar x, register xchar y)
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;
}
@@ -4729,7 +4729,7 @@ block_door(register xchar x, register xchar y)
*/
&& 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" : "");
@@ -4763,7 +4763,7 @@ block_entry(register xchar x, register xchar y)
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)) {