Use macro for a location next to hero
This commit is contained in:
@@ -484,4 +484,7 @@ struct you {
|
|||||||
#define Upolyd (u.umonnum != u.umonster)
|
#define Upolyd (u.umonnum != u.umonster)
|
||||||
#define Ugender ((Upolyd ? u.mfemale : flags.female) ? 1 : 0)
|
#define Ugender ((Upolyd ? u.mfemale : flags.female) ? 1 : 0)
|
||||||
|
|
||||||
|
/* point px,py is adjacent to (or same location as) hero */
|
||||||
|
#define next2u(px,py) (distu((px),(py)) <= 2)
|
||||||
|
|
||||||
#endif /* YOU_H */
|
#endif /* YOU_H */
|
||||||
|
|||||||
+3
-3
@@ -503,7 +503,7 @@ use_magic_whistle(struct obj *obj)
|
|||||||
if (M_AP_TYPE(mtmp))
|
if (M_AP_TYPE(mtmp))
|
||||||
seemimic(mtmp);
|
seemimic(mtmp);
|
||||||
omx = mtmp->mx, omy = mtmp->my;
|
omx = mtmp->mx, omy = mtmp->my;
|
||||||
if (distu(omx, omy) > 2)
|
if (!next2u(omx, omy))
|
||||||
mnexto(mtmp, RLOC_MSG);
|
mnexto(mtmp, RLOC_MSG);
|
||||||
if (mtmp->mx != omx || mtmp->my != omy) {
|
if (mtmp->mx != omx || mtmp->my != omy) {
|
||||||
mtmp->mundetected = 0; /* reveal non-mimic hider */
|
mtmp->mundetected = 0; /* reveal non-mimic hider */
|
||||||
@@ -728,9 +728,9 @@ next_to_u(void)
|
|||||||
if (DEADMONSTER(mtmp))
|
if (DEADMONSTER(mtmp))
|
||||||
continue;
|
continue;
|
||||||
if (mtmp->mleashed) {
|
if (mtmp->mleashed) {
|
||||||
if (distu(mtmp->mx, mtmp->my) > 2)
|
if (!next2u(mtmp->mx, mtmp->my))
|
||||||
mnexto(mtmp, RLOC_NOMSG);
|
mnexto(mtmp, RLOC_NOMSG);
|
||||||
if (distu(mtmp->mx, mtmp->my) > 2) {
|
if (!next2u(mtmp->mx, mtmp->my)) {
|
||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
||||||
if (otmp->otyp == LEASH
|
if (otmp->otyp == LEASH
|
||||||
&& (unsigned) otmp->leashmon == mtmp->m_id) {
|
&& (unsigned) otmp->leashmon == mtmp->m_id) {
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ dig(void)
|
|||||||
if (u.uswallow || !uwep || (!ispick && !is_axe(uwep))
|
if (u.uswallow || !uwep || (!ispick && !is_axe(uwep))
|
||||||
|| !on_level(&g.context.digging.level, &u.uz)
|
|| !on_level(&g.context.digging.level, &u.uz)
|
||||||
|| ((g.context.digging.down ? (dpx != u.ux || dpy != u.uy)
|
|| ((g.context.digging.down ? (dpx != u.ux || dpy != u.uy)
|
||||||
: (distu(dpx, dpy) > 2))))
|
: !next2u(dpx, dpy))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (g.context.digging.down) {
|
if (g.context.digging.down) {
|
||||||
|
|||||||
+1
-1
@@ -756,7 +756,7 @@ newsym(register int x, register int y)
|
|||||||
if (Underwater && !Is_waterlevel(&u.uz)) {
|
if (Underwater && !Is_waterlevel(&u.uz)) {
|
||||||
/* when underwater, don't do anything unless <x,y> is an
|
/* when underwater, don't do anything unless <x,y> is an
|
||||||
adjacent water or lava or ice position */
|
adjacent water or lava or ice position */
|
||||||
if (!(is_pool_or_lava(x, y) || is_ice(x, y)) || distu(x, y) > 2)
|
if (!(is_pool_or_lava(x, y) || is_ice(x, y)) || !next2u(x, y))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ boulder_hits_pool(struct obj *otmp, int rx, int ry, boolean pushing)
|
|||||||
docrt();
|
docrt();
|
||||||
g.vision_full_recalc = 1;
|
g.vision_full_recalc = 1;
|
||||||
You("find yourself on dry land again!");
|
You("find yourself on dry land again!");
|
||||||
} else if (lava && distu(rx, ry) <= 2) {
|
} else if (lava && next2u(rx, ry)) {
|
||||||
int dmg;
|
int dmg;
|
||||||
You("are hit by molten %s%c",
|
You("are hit by molten %s%c",
|
||||||
hliquid("lava"), Fire_resistance ? '.' : '!');
|
hliquid("lava"), Fire_resistance ? '.' : '!');
|
||||||
@@ -1267,7 +1267,7 @@ u_collide_m(struct monst *mtmp)
|
|||||||
or else the monster to any nearby location. Prior to 3.3.0
|
or else the monster to any nearby location. Prior to 3.3.0
|
||||||
the latter was done unconditionally. */
|
the latter was done unconditionally. */
|
||||||
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
|
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
|
||||||
&& distu(cc.x, cc.y) <= 2)
|
&& next2u(cc.x, cc.y))
|
||||||
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
|
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
|
||||||
else
|
else
|
||||||
mnexto(mtmp, RLOC_NOMSG);
|
mnexto(mtmp, RLOC_NOMSG);
|
||||||
|
|||||||
+1
-1
@@ -2046,7 +2046,7 @@ distant_monnam(struct monst *mon,
|
|||||||
unless you're adjacent (overridden for hallucination which does
|
unless you're adjacent (overridden for hallucination which does
|
||||||
its own obfuscation) */
|
its own obfuscation) */
|
||||||
if (mon->data == &mons[PM_HIGH_CLERIC] && !Hallucination
|
if (mon->data == &mons[PM_HIGH_CLERIC] && !Hallucination
|
||||||
&& Is_astralevel(&u.uz) && distu(mon->mx, mon->my) > 2) {
|
&& Is_astralevel(&u.uz) && !next2u(mon->mx, mon->my)) {
|
||||||
Strcpy(outbuf, article == ARTICLE_THE ? "the " : "");
|
Strcpy(outbuf, article == ARTICLE_THE ? "the " : "");
|
||||||
Strcat(outbuf, mon->female ? "high priestess" : "high priest");
|
Strcat(outbuf, mon->female ? "high priestess" : "high priest");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -2186,7 +2186,7 @@ breakobj(
|
|||||||
obj->in_use = 1; /* in case it's fatal */
|
obj->in_use = 1; /* in case it's fatal */
|
||||||
if (obj->otyp == POT_OIL && obj->lamplit) {
|
if (obj->otyp == POT_OIL && obj->lamplit) {
|
||||||
explode_oil(obj, x, y);
|
explode_oil(obj, x, y);
|
||||||
} else if (distu(x, y) <= 2) {
|
} else if (next2u(x, y)) {
|
||||||
if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) {
|
if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) {
|
||||||
/* wet towel protects both eyes and breathing */
|
/* wet towel protects both eyes and breathing */
|
||||||
if (obj->otyp != POT_WATER && !Half_gas_damage) {
|
if (obj->otyp != POT_WATER && !Half_gas_damage) {
|
||||||
|
|||||||
+1
-1
@@ -457,7 +457,7 @@ explode(
|
|||||||
/* if grabber is reaching into hero's spot and
|
/* if grabber is reaching into hero's spot and
|
||||||
hero's spot is within explosion radius, grabber
|
hero's spot is within explosion radius, grabber
|
||||||
gets hit by double damage */
|
gets hit by double damage */
|
||||||
if (grabbed && mtmp == u.ustuck && distu(x, y) <= 2)
|
if (grabbed && mtmp == u.ustuck && next2u(x, y))
|
||||||
mdam *= 2;
|
mdam *= 2;
|
||||||
/* being resistant to opposite type of damage makes
|
/* being resistant to opposite type of damage makes
|
||||||
target more vulnerable to current type of damage
|
target more vulnerable to current type of damage
|
||||||
|
|||||||
+2
-2
@@ -1084,7 +1084,7 @@ findtravelpath(int mode)
|
|||||||
/* if travel to adjacent, reachable location, use normal movement rules */
|
/* if travel to adjacent, reachable location, use normal movement rules */
|
||||||
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1
|
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1
|
||||||
/* was '&& distmin(u.ux, u.uy, u.tx, u.ty) == 1' */
|
/* was '&& distmin(u.ux, u.uy, u.tx, u.ty) == 1' */
|
||||||
&& distu(u.tx, u.ty) <= 2 /* one step away */
|
&& next2u(u.tx, u.ty) /* one step away */
|
||||||
/* handle restricted diagonals */
|
/* handle restricted diagonals */
|
||||||
&& crawl_destination(u.tx, u.ty)) {
|
&& crawl_destination(u.tx, u.ty)) {
|
||||||
end_running(FALSE);
|
end_running(FALSE);
|
||||||
@@ -1689,7 +1689,7 @@ domove_core(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
|
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
|
||||||
if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
|
if (!next2u(u.ustuck->mx, u.ustuck->my)) {
|
||||||
/* perhaps it fled (or was teleported or ... ) */
|
/* perhaps it fled (or was teleported or ... ) */
|
||||||
set_ustuck((struct monst *) 0);
|
set_ustuck((struct monst *) 0);
|
||||||
} else if (sticks(g.youmonst.data)) {
|
} else if (sticks(g.youmonst.data)) {
|
||||||
|
|||||||
+1
-1
@@ -413,7 +413,7 @@ newmail(struct mail_info *info)
|
|||||||
if (info->response_cmd)
|
if (info->response_cmd)
|
||||||
new_omailcmd(obj, info->response_cmd);
|
new_omailcmd(obj, info->response_cmd);
|
||||||
|
|
||||||
if (distu(md->mx, md->my) > 2)
|
if (!next2u(md->mx, md->my))
|
||||||
verbalize("Catch!");
|
verbalize("Catch!");
|
||||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||||
obj = hold_another_object(obj, "Oops!", (const char *) 0,
|
obj = hold_another_object(obj, "Oops!", (const char *) 0,
|
||||||
|
|||||||
+1
-1
@@ -1430,7 +1430,7 @@ makemon(register struct permonst *ptr,
|
|||||||
if (what)
|
if (what)
|
||||||
Norep("%s%s appears%s%c", what,
|
Norep("%s%s appears%s%c", what,
|
||||||
exclaim ? " suddenly" : "",
|
exclaim ? " suddenly" : "",
|
||||||
distu(x, y) <= 2 ? " next to you"
|
next2u(x, y) ? " next to you"
|
||||||
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
|
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
|
||||||
: "",
|
: "",
|
||||||
exclaim ? '!' : '.');
|
exclaim ? '!' : '.');
|
||||||
|
|||||||
+7
-7
@@ -429,14 +429,14 @@ mattacku(register struct monst *mtmp)
|
|||||||
return 0;
|
return 0;
|
||||||
/* Orcs like to steal and eat horses and the like */
|
/* Orcs like to steal and eat horses and the like */
|
||||||
if (!rn2(is_orc(mtmp->data) ? 2 : 4)
|
if (!rn2(is_orc(mtmp->data) ? 2 : 4)
|
||||||
&& distu(mtmp->mx, mtmp->my) <= 2) {
|
&& next2u(mtmp->mx, mtmp->my)) {
|
||||||
/* Attack your steed instead */
|
/* Attack your steed instead */
|
||||||
i = mattackm(mtmp, u.usteed);
|
i = mattackm(mtmp, u.usteed);
|
||||||
if ((i & MM_AGR_DIED))
|
if ((i & MM_AGR_DIED))
|
||||||
return 1;
|
return 1;
|
||||||
/* make sure steed is still alive and within range */
|
/* make sure steed is still alive and within range */
|
||||||
if ((i & MM_DEF_DIED) || !u.usteed
|
if ((i & MM_DEF_DIED) || !u.usteed
|
||||||
|| distu(mtmp->mx, mtmp->my) > 2)
|
|| !next2u(mtmp->mx, mtmp->my))
|
||||||
return 0;
|
return 0;
|
||||||
/* Let your steed retaliate */
|
/* Let your steed retaliate */
|
||||||
return !!(mattackm(u.usteed, mtmp) & MM_DEF_DIED);
|
return !!(mattackm(u.usteed, mtmp) & MM_DEF_DIED);
|
||||||
@@ -760,7 +760,7 @@ mattacku(register struct monst *mtmp)
|
|||||||
mon_currwep = MON_WEP(mtmp);
|
mon_currwep = MON_WEP(mtmp);
|
||||||
if (mon_currwep) {
|
if (mon_currwep) {
|
||||||
boolean bash = (is_pole(mon_currwep)
|
boolean bash = (is_pole(mon_currwep)
|
||||||
&& distu(mtmp->mx, mtmp->my) <= 2);
|
&& next2u(mtmp->mx, mtmp->my));
|
||||||
|
|
||||||
hittmp = hitval(mon_currwep, &g.youmonst);
|
hittmp = hitval(mon_currwep, &g.youmonst);
|
||||||
tmp += hittmp;
|
tmp += hittmp;
|
||||||
@@ -1854,7 +1854,7 @@ doseduce(struct monst *mon)
|
|||||||
Ring_gone(uright);
|
Ring_gone(uright);
|
||||||
/* ring removal might cause loss of levitation which could
|
/* ring removal might cause loss of levitation which could
|
||||||
drop hero onto trap that transports hero somewhere else */
|
drop hero onto trap that transports hero somewhere else */
|
||||||
if (u.utotype || distu(mon->mx, mon->my) > 2)
|
if (u.utotype || !next2u(mon->mx, mon->my))
|
||||||
return 1;
|
return 1;
|
||||||
setworn(ring, RIGHT_RING);
|
setworn(ring, RIGHT_RING);
|
||||||
} else if (uleft && uleft->otyp != RIN_ADORNMENT) {
|
} else if (uleft && uleft->otyp != RIN_ADORNMENT) {
|
||||||
@@ -1862,7 +1862,7 @@ doseduce(struct monst *mon)
|
|||||||
pline("%s replaces %s with %s.",
|
pline("%s replaces %s with %s.",
|
||||||
Who, yname(uleft), yname(ring));
|
Who, yname(uleft), yname(ring));
|
||||||
Ring_gone(uleft);
|
Ring_gone(uleft);
|
||||||
if (u.utotype || distu(mon->mx, mon->my) > 2)
|
if (u.utotype || !next2u(mon->mx, mon->my))
|
||||||
return 1;
|
return 1;
|
||||||
setworn(ring, LEFT_RING);
|
setworn(ring, LEFT_RING);
|
||||||
} else
|
} else
|
||||||
@@ -1895,7 +1895,7 @@ doseduce(struct monst *mon)
|
|||||||
and changing location, so hero might not be adjacent to seducer
|
and changing location, so hero might not be adjacent to seducer
|
||||||
any more (mayberem() has its own adjacency test so we don't need
|
any more (mayberem() has its own adjacency test so we don't need
|
||||||
to check after each potential removal) */
|
to check after each potential removal) */
|
||||||
if (u.utotype || distu(mon->mx, mon->my) > 2)
|
if (u.utotype || !next2u(mon->mx, mon->my))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (uarm || uarmc) {
|
if (uarm || uarmc) {
|
||||||
@@ -2071,7 +2071,7 @@ mayberem(struct monst *mon,
|
|||||||
return;
|
return;
|
||||||
/* removal of a previous item might have sent the hero elsewhere
|
/* removal of a previous item might have sent the hero elsewhere
|
||||||
(loss of levitation that leads to landing on a transport trap) */
|
(loss of levitation that leads to landing on a transport trap) */
|
||||||
if (u.utotype || distu(mon->mx, mon->my) > 2)
|
if (u.utotype || !next2u(mon->mx, mon->my))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* being deaf overrides confirmation prompt for high charisma */
|
/* being deaf overrides confirmation prompt for high charisma */
|
||||||
|
|||||||
@@ -1024,7 +1024,7 @@ movemon(void)
|
|||||||
if (mtmp->mundetected)
|
if (mtmp->mundetected)
|
||||||
continue;
|
continue;
|
||||||
} else if (mtmp->data->mlet == S_EEL && !mtmp->mundetected
|
} else if (mtmp->data->mlet == S_EEL && !mtmp->mundetected
|
||||||
&& (mtmp->mflee || distu(mtmp->mx, mtmp->my) > 2)
|
&& (mtmp->mflee || !next2u(mtmp->mx, mtmp->my))
|
||||||
&& !canseemon(mtmp) && !rn2(4)) {
|
&& !canseemon(mtmp) && !rn2(4)) {
|
||||||
/* some eels end up stuck in isolated pools, where they
|
/* some eels end up stuck in isolated pools, where they
|
||||||
can't--or at least won't--move, so they never reach
|
can't--or at least won't--move, so they never reach
|
||||||
@@ -2846,7 +2846,7 @@ void
|
|||||||
set_ustuck(struct monst* mtmp)
|
set_ustuck(struct monst* mtmp)
|
||||||
{
|
{
|
||||||
if (iflags.sanity_check || iflags.debug_fuzzer) {
|
if (iflags.sanity_check || iflags.debug_fuzzer) {
|
||||||
if (mtmp && distu(mtmp->mx, mtmp->my) > 2)
|
if (mtmp && !next2u(mtmp->mx, mtmp->my))
|
||||||
impossible("Sticking to %s at distu %d?",
|
impossible("Sticking to %s at distu %d?",
|
||||||
mon_nam(mtmp), distu(mtmp->mx, mtmp->my));
|
mon_nam(mtmp), distu(mtmp->mx, mtmp->my));
|
||||||
}
|
}
|
||||||
@@ -3803,7 +3803,7 @@ restrap(struct monst *mtmp)
|
|||||||
/* can't hide while trapped except in pits */
|
/* can't hide while trapped except in pits */
|
||||||
|| (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0
|
|| (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0
|
||||||
&& !is_pit(t->ttyp))
|
&& !is_pit(t->ttyp))
|
||||||
|| (sensemon(mtmp) && distu(mtmp->mx, mtmp->my) <= 2))
|
|| (sensemon(mtmp) && next2u(mtmp->mx, mtmp->my)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (mtmp->data->mlet == S_MIMIC) {
|
if (mtmp->data->mlet == S_MIMIC) {
|
||||||
@@ -4704,7 +4704,7 @@ angry_guards(boolean silent)
|
|||||||
if (is_watch(mtmp->data) && mtmp->mpeaceful) {
|
if (is_watch(mtmp->data) && mtmp->mpeaceful) {
|
||||||
ct++;
|
ct++;
|
||||||
if (canspotmon(mtmp) && mtmp->mcanmove) {
|
if (canspotmon(mtmp) && mtmp->mcanmove) {
|
||||||
if (distu(mtmp->mx, mtmp->my) <= 2)
|
if (next2u(mtmp->mx, mtmp->my))
|
||||||
nct++;
|
nct++;
|
||||||
else
|
else
|
||||||
sct++;
|
sct++;
|
||||||
|
|||||||
+1
-1
@@ -728,7 +728,7 @@ dochug(register struct monst* mtmp)
|
|||||||
if (u.uswallow)
|
if (u.uswallow)
|
||||||
return mattacku(mtmp);
|
return mattacku(mtmp);
|
||||||
/* if confused grabber has wandered off, let go */
|
/* if confused grabber has wandered off, let go */
|
||||||
if (distu(mtmp->mx, mtmp->my) > 2)
|
if (!next2u(mtmp->mx, mtmp->my))
|
||||||
unstuck(mtmp);
|
unstuck(mtmp);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+1
-1
@@ -1855,7 +1855,7 @@ find_misc(struct monst* mtmp)
|
|||||||
&& uwep && !rn2(5) && obj == MON_WEP(mtmp)
|
&& uwep && !rn2(5) && obj == MON_WEP(mtmp)
|
||||||
/* hero's location must be known and adjacent */
|
/* hero's location must be known and adjacent */
|
||||||
&& mtmp->mux == u.ux && mtmp->muy == u.uy
|
&& mtmp->mux == u.ux && mtmp->muy == u.uy
|
||||||
&& distu(mtmp->mx, mtmp->my) <= 2
|
&& next2u(mtmp->mx, mtmp->my)
|
||||||
/* don't bother if it can't work (this doesn't
|
/* don't bother if it can't work (this doesn't
|
||||||
prevent cursed weapons from being targetted) */
|
prevent cursed weapons from being targetted) */
|
||||||
&& (canletgo(uwep, "")
|
&& (canletgo(uwep, "")
|
||||||
|
|||||||
+5
-5
@@ -276,7 +276,7 @@ object_from_map(int glyph, int x, int y, struct obj **obj_p)
|
|||||||
/* if located at adjacent spot, mark it as having been seen up close
|
/* if located at adjacent spot, mark it as having been seen up close
|
||||||
(corpse type will be known even if dknown is 0, so we don't need a
|
(corpse type will be known even if dknown is 0, so we don't need a
|
||||||
touch check for cockatrice corpse--we're looking without touching) */
|
touch check for cockatrice corpse--we're looking without touching) */
|
||||||
if (otmp && distu(x, y) <= 2 && !Blind && !Hallucination
|
if (otmp && next2u(x, y) && !Blind && !Hallucination
|
||||||
/* redundant: we only look for an object which matches current
|
/* redundant: we only look for an object which matches current
|
||||||
glyph among floor and buried objects; when !Blind, any buried
|
glyph among floor and buried objects; when !Blind, any buried
|
||||||
object's glyph will have been replaced by whatever is present
|
object's glyph will have been replaced by whatever is present
|
||||||
@@ -589,7 +589,7 @@ lookat(int x, int y, char *buf, char *monbuf)
|
|||||||
if (Underwater && !Is_waterlevel(&u.uz)) {
|
if (Underwater && !Is_waterlevel(&u.uz)) {
|
||||||
/* "unknown" == previously mapped but not visible when
|
/* "unknown" == previously mapped but not visible when
|
||||||
submerged; better terminology appreciated... */
|
submerged; better terminology appreciated... */
|
||||||
Strcpy(buf, (distu(x, y) <= 2) ? "land" : "unknown");
|
Strcpy(buf, (next2u(x, y)) ? "land" : "unknown");
|
||||||
} else {
|
} else {
|
||||||
Strcpy(buf, "unexplored area");
|
Strcpy(buf, "unexplored area");
|
||||||
}
|
}
|
||||||
@@ -607,7 +607,7 @@ lookat(int x, int y, char *buf, char *monbuf)
|
|||||||
Sprintf(buf, "%s %saltar",
|
Sprintf(buf, "%s %saltar",
|
||||||
/* like endgame high priests, endgame high altars
|
/* like endgame high priests, endgame high altars
|
||||||
are only recognizable when immediately adjacent */
|
are only recognizable when immediately adjacent */
|
||||||
(Is_astralevel(&u.uz) && distu(x, y) > 2)
|
(Is_astralevel(&u.uz) && !next2u(x, y))
|
||||||
? "aligned"
|
? "aligned"
|
||||||
: align_str(algn),
|
: align_str(algn),
|
||||||
((amsk & AM_SHRINE) != 0
|
((amsk & AM_SHRINE) != 0
|
||||||
@@ -640,7 +640,7 @@ lookat(int x, int y, char *buf, char *monbuf)
|
|||||||
} else if (Underwater && !Is_waterlevel(&u.uz)) {
|
} else if (Underwater && !Is_waterlevel(&u.uz)) {
|
||||||
/* "unknown" == previously mapped but not visible when
|
/* "unknown" == previously mapped but not visible when
|
||||||
submerged; better terminology appreciated... */
|
submerged; better terminology appreciated... */
|
||||||
Strcpy(buf, (distu(x, y) <= 2) ? "land" : "unknown");
|
Strcpy(buf, (next2u(x, y)) ? "land" : "unknown");
|
||||||
break;
|
break;
|
||||||
} else if (levl[x][y].typ == STONE || levl[x][y].typ == SCORR) {
|
} else if (levl[x][y].typ == STONE || levl[x][y].typ == SCORR) {
|
||||||
Strcpy(buf, "stone");
|
Strcpy(buf, "stone");
|
||||||
@@ -1100,7 +1100,7 @@ do_screen_description(coord cc, boolean looked, int sym, char *out_str,
|
|||||||
x_str = 0;
|
x_str = 0;
|
||||||
if (!looked) {
|
if (!looked) {
|
||||||
; /* skip special handling */
|
; /* skip special handling */
|
||||||
} else if (((u.uswallow || submerged) && distu(cc.x, cc.y) > 2)
|
} else if (((u.uswallow || submerged) && !next2u(cc.x, cc.y))
|
||||||
/* detection showing some category, so mostly background */
|
/* detection showing some category, so mostly background */
|
||||||
|| ((iflags.terrainmode & (TER_DETECT | TER_MAP)) == TER_DETECT
|
|| ((iflags.terrainmode & (TER_DETECT | TER_MAP)) == TER_DETECT
|
||||||
&& glyph == cmap_to_glyph(S_stone))) {
|
&& glyph == cmap_to_glyph(S_stone))) {
|
||||||
|
|||||||
+1
-1
@@ -359,7 +359,7 @@ priestname(
|
|||||||
Strcat(pname, what);
|
Strcat(pname, what);
|
||||||
/* same as distant_monnam(), more or less... */
|
/* same as distant_monnam(), more or less... */
|
||||||
if (do_hallu || !high_priest || !Is_astralevel(&u.uz)
|
if (do_hallu || !high_priest || !Is_astralevel(&u.uz)
|
||||||
|| distu(mon->mx, mon->my) <= 2 || g.program_state.gameover) {
|
|| next2u(mon->mx, mon->my) || g.program_state.gameover) {
|
||||||
Strcat(pname, " of ");
|
Strcat(pname, " of ");
|
||||||
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1247,7 +1247,7 @@ dopay(void)
|
|||||||
for (shkp = next_shkp(fmon, FALSE); shkp;
|
for (shkp = next_shkp(fmon, FALSE); shkp;
|
||||||
shkp = next_shkp(shkp->nmon, FALSE)) {
|
shkp = next_shkp(shkp->nmon, FALSE)) {
|
||||||
sk++;
|
sk++;
|
||||||
if (ANGRY(shkp) && distu(shkp->mx, shkp->my) <= 2)
|
if (ANGRY(shkp) && next2u(shkp->mx, shkp->my))
|
||||||
nxtm = shkp;
|
nxtm = shkp;
|
||||||
if (canspotmon(shkp))
|
if (canspotmon(shkp))
|
||||||
seensk++;
|
seensk++;
|
||||||
@@ -1283,7 +1283,7 @@ dopay(void)
|
|||||||
shkp = next_shkp(shkp->nmon, FALSE))
|
shkp = next_shkp(shkp->nmon, FALSE))
|
||||||
if (canspotmon(shkp))
|
if (canspotmon(shkp))
|
||||||
break;
|
break;
|
||||||
if (shkp != resident && distu(shkp->mx, shkp->my) > 2) {
|
if (shkp != resident && !next2u(shkp->mx, shkp->my)) {
|
||||||
pline("%s is not near enough to receive your payment.",
|
pline("%s is not near enough to receive your payment.",
|
||||||
Shknam(shkp));
|
Shknam(shkp));
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
@@ -1321,7 +1321,7 @@ dopay(void)
|
|||||||
pline("%s is not interested in your payment.", Monnam(mtmp));
|
pline("%s is not interested in your payment.", Monnam(mtmp));
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
}
|
}
|
||||||
if (mtmp != resident && distu(mtmp->mx, mtmp->my) > 2) {
|
if (mtmp != resident && !next2u(mtmp->mx, mtmp->my)) {
|
||||||
pline("%s is too far to receive your payment.", Shknam(mtmp));
|
pline("%s is too far to receive your payment.", Shknam(mtmp));
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
}
|
}
|
||||||
@@ -1836,7 +1836,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
|
|||||||
takes[0] = '\0';
|
takes[0] = '\0';
|
||||||
if (!shkp->mcanmove || shkp->msleeping)
|
if (!shkp->mcanmove || shkp->msleeping)
|
||||||
Strcat(takes, "wakes up and ");
|
Strcat(takes, "wakes up and ");
|
||||||
if (distu(shkp->mx, shkp->my) > 2)
|
if (!next2u(shkp->mx, shkp->my))
|
||||||
Strcat(takes, "comes and ");
|
Strcat(takes, "comes and ");
|
||||||
Strcat(takes, "takes");
|
Strcat(takes, "takes");
|
||||||
|
|
||||||
@@ -4070,10 +4070,10 @@ shopdig(register int fall)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (distu(shkp->mx, shkp->my) > 2) {
|
if (!next2u(shkp->mx, shkp->my)) {
|
||||||
mnexto(shkp, RLOC_MSG);
|
mnexto(shkp, RLOC_MSG);
|
||||||
/* for some reason the shopkeeper can't come next to you */
|
/* for some reason the shopkeeper can't come next to you */
|
||||||
if (distu(shkp->mx, shkp->my) > 2) {
|
if (!next2u(shkp->mx, shkp->my)) {
|
||||||
if (lang == 2)
|
if (lang == 2)
|
||||||
pline("%s curses you in anger and frustration!",
|
pline("%s curses you in anger and frustration!",
|
||||||
Shknam(shkp));
|
Shknam(shkp));
|
||||||
|
|||||||
+1
-1
@@ -1337,7 +1337,7 @@ tiphat(void)
|
|||||||
|
|
||||||
pline("%s %s%s%s at you...", Monnam(mtmp), reaction[which],
|
pline("%s %s%s%s at you...", Monnam(mtmp), reaction[which],
|
||||||
twice ? " and " : "", twice ? reaction[twice] : "");
|
twice ? " and " : "", twice ? reaction[twice] : "");
|
||||||
} else if (distu(x, y) <= 2 && !Deaf && domonnoise(mtmp)) {
|
} else if (next2u(x, y) && !Deaf && domonnoise(mtmp)) {
|
||||||
if (!vismon)
|
if (!vismon)
|
||||||
map_invisible(x, y);
|
map_invisible(x, y);
|
||||||
} else if (vismon) {
|
} else if (vismon) {
|
||||||
|
|||||||
+3
-3
@@ -1251,7 +1251,7 @@ rloc_to_core(struct monst* mtmp,
|
|||||||
if (u.uswallow) {
|
if (u.uswallow) {
|
||||||
u_on_newpos(mtmp->mx, mtmp->my);
|
u_on_newpos(mtmp->mx, mtmp->my);
|
||||||
docrt();
|
docrt();
|
||||||
} else if (distu(mtmp->mx, mtmp->my) > 2) {
|
} else if (!next2u(mtmp->mx, mtmp->my)) {
|
||||||
unstuck(mtmp);
|
unstuck(mtmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1264,7 +1264,7 @@ rloc_to_core(struct monst* mtmp,
|
|||||||
if (telemsg && (couldsee(x, y) || sensemon(mtmp))) {
|
if (telemsg && (couldsee(x, y) || sensemon(mtmp))) {
|
||||||
pline("%s vanishes and reappears%s.",
|
pline("%s vanishes and reappears%s.",
|
||||||
Monnam(mtmp),
|
Monnam(mtmp),
|
||||||
distu(x, y) <= 2 ? " next to you"
|
next2u(x, y) ? " next to you"
|
||||||
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
|
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
|
||||||
: (distu(x, y) < distu(oldx, oldy)) ? " closer to you"
|
: (distu(x, y) < distu(oldx, oldy)) ? " closer to you"
|
||||||
: " further away");
|
: " further away");
|
||||||
@@ -1273,7 +1273,7 @@ rloc_to_core(struct monst* mtmp,
|
|||||||
appearmsg ? Amonnam(mtmp) : Monnam(mtmp),
|
appearmsg ? Amonnam(mtmp) : Monnam(mtmp),
|
||||||
appearmsg ? "suddenly " : "",
|
appearmsg ? "suddenly " : "",
|
||||||
!Blind ? "appears" : "arrives",
|
!Blind ? "appears" : "arrives",
|
||||||
distu(x, y) <= 2 ? " next to you"
|
next2u(x, y) ? " next to you"
|
||||||
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by" : "");
|
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5178,7 +5178,7 @@ openholdingtrap(
|
|||||||
pline("%s%s opens.", upstart(strcpy(buf, which)), trapdescr);
|
pline("%s%s opens.", upstart(strcpy(buf, which)), trapdescr);
|
||||||
}
|
}
|
||||||
/* might pacify monster if adjacent */
|
/* might pacify monster if adjacent */
|
||||||
if (rn2(2) && distu(mon->mx, mon->my) <= 2)
|
if (rn2(2) && next2u(mon->mx, mon->my))
|
||||||
reward_untrap(t, mon);
|
reward_untrap(t, mon);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
+5
-5
@@ -170,7 +170,7 @@ attack_checks(
|
|||||||
if (M_AP_TYPE(mtmp) && !Protection_from_shape_changers) {
|
if (M_AP_TYPE(mtmp) && !Protection_from_shape_changers) {
|
||||||
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)
|
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)
|
||||||
/* applied pole-arm attack is too far to get stuck */
|
/* applied pole-arm attack is too far to get stuck */
|
||||||
&& distu(mtmp->mx, mtmp->my) <= 2)
|
&& next2u(mtmp->mx, mtmp->my))
|
||||||
set_ustuck(mtmp);
|
set_ustuck(mtmp);
|
||||||
}
|
}
|
||||||
/* #H7329 - if hero is on engraved "Elbereth", this will end up
|
/* #H7329 - if hero is on engraved "Elbereth", this will end up
|
||||||
@@ -1564,7 +1564,7 @@ shade_miss(struct monst *magr, struct monst *mdef, struct obj *obj,
|
|||||||
|
|
||||||
if (verbose
|
if (verbose
|
||||||
&& ((youdef || cansee(mdef->mx, mdef->my) || sensemon(mdef))
|
&& ((youdef || cansee(mdef->mx, mdef->my) || sensemon(mdef))
|
||||||
|| (magr == &g.youmonst && distu(mdef->mx, mdef->my) <= 2))) {
|
|| (magr == &g.youmonst && next2u(mdef->mx, mdef->my)))) {
|
||||||
static const char harmlessly_thru[] = " harmlessly through ";
|
static const char harmlessly_thru[] = " harmlessly through ";
|
||||||
|
|
||||||
what = (!obj || shade_aware(obj)) ? "attack" : cxname(obj);
|
what = (!obj || shade_aware(obj)) ? "attack" : cxname(obj);
|
||||||
@@ -2843,7 +2843,7 @@ mhitm_ad_stck(
|
|||||||
/* since hero can't be cancelled, only defender's armor applies */
|
/* since hero can't be cancelled, only defender's armor applies */
|
||||||
boolean negated = !(rn2(10) >= 3 * armpro);
|
boolean negated = !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
if (!negated && !sticks(pd) && distu(mdef->mx, mdef->my) <= 2)
|
if (!negated && !sticks(pd) && next2u(mdef->mx, mdef->my))
|
||||||
set_ustuck(mdef); /* it's now stuck to you */
|
set_ustuck(mdef); /* it's now stuck to you */
|
||||||
} else if (mdef == &g.youmonst) {
|
} else if (mdef == &g.youmonst) {
|
||||||
/* mhitu */
|
/* mhitu */
|
||||||
@@ -4613,7 +4613,7 @@ hmonas(struct monst *mon)
|
|||||||
boolean monster_survived;
|
boolean monster_survived;
|
||||||
|
|
||||||
/* not used here but umpteen mhitm_ad_xxxx() need this */
|
/* not used here but umpteen mhitm_ad_xxxx() need this */
|
||||||
g.vis = (canseemon(mon) || distu(mon->mx, mon->my) <= 2);
|
g.vis = (canseemon(mon) || next2u(mon->mx, mon->my));
|
||||||
|
|
||||||
/* with just one touch/claw/weapon attack, both rings matter;
|
/* with just one touch/claw/weapon attack, both rings matter;
|
||||||
with more than one, alternate right and left when checking
|
with more than one, alternate right and left when checking
|
||||||
@@ -5340,7 +5340,7 @@ stumble_onto_mimic(struct monst *mtmp)
|
|||||||
|
|
||||||
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)
|
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)
|
||||||
/* must be adjacent; attack via polearm could be from farther away */
|
/* must be adjacent; attack via polearm could be from farther away */
|
||||||
&& distu(mtmp->mx, mtmp->my) <= 2)
|
&& next2u(mtmp->mx, mtmp->my))
|
||||||
set_ustuck(mtmp);
|
set_ustuck(mtmp);
|
||||||
|
|
||||||
if (Blind) {
|
if (Blind) {
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ amulet(void)
|
|||||||
continue;
|
continue;
|
||||||
if (mtmp->iswiz && mtmp->msleeping && !rn2(40)) {
|
if (mtmp->iswiz && mtmp->msleeping && !rn2(40)) {
|
||||||
mtmp->msleeping = 0;
|
mtmp->msleeping = 0;
|
||||||
if (distu(mtmp->mx, mtmp->my) > 2)
|
if (!next2u(mtmp->mx, mtmp->my))
|
||||||
You(
|
You(
|
||||||
"get the creepy feeling that somebody noticed your taking the Amulet.");
|
"get the creepy feeling that somebody noticed your taking the Amulet.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user