teleport feedback for STRAT_APPEARMSG mon

Reported by entrez:  if a monster with the STRAT_APPEARMSG flag is
seen to teleport away from its current position, an arrival message
would always be given too.  If you couldn't see that arrival, you'd
get nonsensical "It suddenly appears!".

Minor fix:  when a monster is seen to vanish at one spot and appear
at another, if it was not close you'd get either "appears closer to
you" or "appears farther from you" even if the new spot was the same
distance as the old spot.
This commit is contained in:
PatR
2022-07-01 15:53:53 -07:00
parent dda4cd0530
commit 0bd5b3d39e
2 changed files with 17 additions and 7 deletions

View File

@@ -1280,6 +1280,8 @@ earlier fix for prices of unpaid objects going away in persistent inventory
when inventory got updated to reflect transfer of hero's gold to shk
save files created with SCORE_ON_BOTL disabled were erroneously being rejected
if the program was rebuilt with it enabled and vice versa
avoid "It suddenly appears!" if a monster with the STRAT_APPEARMSG attribute
is seen to teleport away then not seen at its destination
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -1297,6 +1297,11 @@ rloc_to_core(
} else {
pline("%s vanishes!", Monnam(mtmp));
}
/* avoid "It suddenly appears!" for a STRAT_APPEARMSG monster
that has just teleported away if we won't see it after this
vanishing (the regular appears message will be given if we
do see it) */
appearmsg = FALSE;
}
if (mtmp->wormno) {
@@ -1327,22 +1332,25 @@ rloc_to_core(
newsym(x, y); /* update new location */
set_apparxy(mtmp); /* orient monster */
if (domsg && (canspotmon(mtmp) || appearmsg)) {
int du = distu(x, y), olddu;
const char *next = (du <= 2) ? " next to you" : 0, /* next2u() */
*near = (du <= BOLT_LIM * BOLT_LIM) ? " close by" : 0;
mtmp->mstrategy &= ~STRAT_APPEARMSG; /* one chance only */
if (telemsg && (couldsee(x, y) || sensemon(mtmp))) {
pline("%s vanishes and reappears%s.",
Monnam(mtmp),
next2u(x, y) ? " next to you"
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
: (distu(x, y) < distu(oldx, oldy)) ? " closer to you"
: " further away");
next ? next
: near ? near
: ((olddu = distu(oldx, oldy)) == du) ? ""
: (du < olddu) ? " closer to you"
: " farther away");
} else {
pline("%s %s%s%s!",
appearmsg ? Amonnam(mtmp) : Monnam(mtmp),
appearmsg ? "suddenly " : "",
!Blind ? "appears" : "arrives",
next2u(x, y) ? " next to you"
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
: "");
next ? next : near ? near : "");
}
}