From: nethack.rankin Date: Thu, 10 Aug 2006 00:45:32 +0000 (+0000) Subject: shopkeeper/temple priest teleporting (trunk only) X-Git-Tag: MOVE2GIT~932 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c91c9addb9fdc8cde2d4e9daf90b96447e8d2b18;p=nethack shopkeeper/temple priest teleporting (trunk only) Forwarded from the newsgroup by : temple priest might abandon his post via teleport if conditions are obscure enough. Change rloc_pos_ok() to only accept spots inside the same shop or temple when a shopkeeper or temple priest is teleported to a random destination. rloc() tries rloc_pos_ok() 500 times before reverting to goodpos(), so this will usually succeed for a large room; it may fail for a small one (reverting to the current behavior, more or less). Shopkeepers or priests who get polymorphed into a critter which teleports to the stairs when in need of healing will still leave their shop or temple if wounded (no change). Priests resist if the player tries to teleport them, but shopkeepers don't. So for direct attack by the player, this only affects shopkeeper destination. But it affects both types as far as being hit by quantum mechanics (probably caused by player's use of conflict) or if polymorphed into monsters which steal and then flee (again, probably caused by the player since those strong monsters won't voluntarily polymorph). --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0fde5dc7f..33f4c8e87 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -153,6 +153,8 @@ don't discover unknown bag of tricks when monster it releases is undetected make region ttl field a long instead of short to get rid of lint warnings about a possible loss of data pushing a boulder onto a level teleporter trap could issue repeat messages +if shopkeeper or priest gets teleported while inside his shop or temple, + give locations inside that room preference when choosing destination Platform- and/or Interface-Specific Fixes diff --git a/src/teleport.c b/src/teleport.c index aa6b7edd8..7d3f58189 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -921,6 +921,14 @@ struct monst *mtmp; !within_bounded_area(x, y, dndest.nlx, dndest.nly, dndest.nhx, dndest.nhy))); } else { + /* [try to] prevent a shopkeeper or temple priest from being + sent out of his room (caller might resort to goodpos() if + we report failure here, so this isn't full prevention) */ + if (mtmp->isshk && inhishop(mtmp)) { + if (levl[x][y].roomno != ESHK(mtmp)->shoproom) return FALSE; + } else if (mtmp->ispriest && inhistemple(mtmp)) { + if (levl[x][y].roomno != EPRI(mtmp)->shroom) return FALSE; + } /* current location is */ if (!tele_jump_ok(xx, yy, x, y)) return FALSE; }