Prioritize paying shopkeeper next to you even if multiple are detected

This commit is contained in:
Pasi Kallinen
2023-12-09 13:24:50 +02:00
parent 1ceb9d2d91
commit 252e661b72
2 changed files with 10 additions and 4 deletions

View File

@@ -1322,6 +1322,7 @@ change wolf and werewolf to grey, warg to black
change [master] mind flayer, the Wizard, and the riders to bright magenta
walking into a shopkeeper tries to pay the bill
show billed items in a menu when paying with non-traditional menustyle
prioritize paying shopkeeper next to you even if multiple are detected
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1442,7 +1442,7 @@ dopay(void)
struct monst *nxtm, *resident;
long ltmp;
long umoney;
int pass, tmp, sk = 0, seensk = 0;
int pass, tmp, sk = 0, seensk = 0, nexttosk = 0;
boolean paid = FALSE, stashed_gold = (hidden_gold(TRUE) > 0L);
gm.multi = 0;
@@ -1454,16 +1454,21 @@ dopay(void)
for (shkp = next_shkp(fmon, FALSE); shkp;
shkp = next_shkp(shkp->nmon, FALSE)) {
sk++;
if (ANGRY(shkp) && next2u(shkp->mx, shkp->my))
if (next2u(shkp->mx, shkp->my)) {
/* next to an irate shopkeeper? prioritize that */
if (nxtm && ANGRY(nxtm))
continue;
nexttosk++;
nxtm = shkp;
}
if (canspotmon(shkp))
seensk++;
if (inhishop(shkp) && (*u.ushops == ESHK(shkp)->shoproom))
resident = shkp;
}
if (nxtm) { /* Player should always appease an */
shkp = nxtm; /* irate shk standing next to them. */
if (nxtm && nexttosk == 1) {
shkp = nxtm;
goto proceed;
}