Cursed magic whistle can teleport you to your pet
This commit is contained in:
@@ -1510,6 +1510,7 @@ if a tree and a boulder or statue were at the same location, applying an axe
|
||||
would break the boulder or statue rather than chop the tree
|
||||
avoid premapping outside Sokoban map to prevent showing stone glyphs
|
||||
Grimtooth is permanently poisoned, protects from poison, and can fling poison
|
||||
cursed magic whistle can teleport you to your pet
|
||||
|
||||
|
||||
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
||||
|
||||
@@ -3124,6 +3124,7 @@ extern int collect_coords(coord *, coordxy, coordxy, int, unsigned,
|
||||
boolean (*)(coordxy, coordxy)) NONNULLARG1;
|
||||
extern boolean safe_teleds(int);
|
||||
extern boolean teleport_pet(struct monst *, boolean) NONNULLARG1;
|
||||
extern void tele_to_rnd_pet(void);
|
||||
extern void tele(void);
|
||||
extern void scrolltele(struct obj *) NO_NNARGS;
|
||||
extern int dotelecmd(void);
|
||||
|
||||
@@ -498,6 +498,8 @@ use_magic_whistle(struct obj *obj)
|
||||
You("produce a %shigh-%s.", Underwater ? "very " : "",
|
||||
Deaf ? "frequency vibration" : "pitched humming noise");
|
||||
wake_nearby(TRUE);
|
||||
if (!rn2(2))
|
||||
tele_to_rnd_pet();
|
||||
} else {
|
||||
/* it's magic! it works underwater too (at a higher pitch) */
|
||||
You(Deaf ? alt_whistle_str : whistle_str,
|
||||
|
||||
@@ -804,6 +804,28 @@ teleport_pet(struct monst *mtmp, boolean force_it)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* teleport to random pet, if valid location next to it */
|
||||
void
|
||||
tele_to_rnd_pet(void)
|
||||
{
|
||||
struct monst *mtmp, *pet = (struct monst *) 0;
|
||||
int cnt = 0;
|
||||
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
||||
if (!DEADMONSTER(mtmp) && mtmp->mtame && !mon_offmap(mtmp)) {
|
||||
cnt++;
|
||||
if (!rn2(cnt))
|
||||
pet = mtmp;
|
||||
}
|
||||
if (pet && !m_next2u(pet)) {
|
||||
coordxy tx = pet->mx + rn2(3) - 1,
|
||||
ty = pet->my + rn2(3) - 1;
|
||||
|
||||
if (isok(tx, ty) && teleok(tx, ty, FALSE))
|
||||
teleds(tx, ty, TELEDS_TELEPORT);
|
||||
}
|
||||
}
|
||||
|
||||
/* teleport the hero via some method other than scroll of teleport */
|
||||
void
|
||||
tele(void)
|
||||
|
||||
Reference in New Issue
Block a user