Skip to content

Commit

Permalink
shopkeeper/temple priest teleporting (trunk only)
Browse files Browse the repository at this point in the history
     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).
  • Loading branch information
nethack.rankin committed Aug 10, 2006
1 parent 075d466 commit c91c9ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/fixes35.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/teleport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c91c9ad

Please sign in to comment.