Cursed magic whistle can teleport you to your pet
This commit is contained in:
@@ -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