]> granicus.if.org Git - nethack/commitdiff
shopkeeper/temple priest teleporting (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 10 Aug 2006 00:45:32 +0000 (00:45 +0000)
committernethack.rankin <nethack.rankin>
Thu, 10 Aug 2006 00:45:32 +0000 (00:45 +0000)
     Forwarded from the newsgroup by <Someone>:  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).

doc/fixes35.0
src/teleport.c

index 0fde5dc7fd7a092ff037b4356fccc0398bf57ece..33f4c8e87ac80caadce60ecb6a07448c55ab5711 100644 (file)
@@ -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
index aa6b7edd8bbf95dabb13d46669eed9284739f181..7d3f581897a6185e331cfd2d59d86522e470cc5d 100644 (file)
@@ -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 <xx,yy> */
            if (!tele_jump_ok(xx, yy, x, y)) return FALSE;
        }