extern bool cave_player_teleportable_bold(int y, int x, bool passive, bool nonmagical);
extern void teleport_player(int dis, bool passive);
extern void teleport_player_to(int ny, int nx, bool no_tele, bool passive);
+extern void teleport_away_followable(int m_idx);
extern void teleport_level(int m_idx);
extern int choose_dungeon(cptr note, int y, int x);
extern bool recall_player(int turns);
/* RF6_TPORT */
case 160+5:
{
- int i, oldfy, oldfx;
- u32b flgs[TR_FLAG_SIZE];
- object_type *o_ptr;
-
- oldfy = m_ptr->fy;
- oldfx = m_ptr->fx;
-
disturb(1, 0);
#ifdef JP
-msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
+ msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
#else
msg_format("%^s teleports away.", m_name);
#endif
- teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE, FALSE);
-
- if (los(py, px, oldfy, oldfx) && !world_monster)
- {
- for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
- {
- o_ptr = &inventory[i];
- if (!object_is_cursed(o_ptr))
- {
- object_flags(o_ptr, flgs);
-
- if ((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
- {
-#ifdef JP
- if (get_check_strict("¤Ä¤¤¤Æ¤¤¤¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
-#else
- if (get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
-#endif
- {
- if (one_in_(3))
- {
- teleport_player(200, TRUE);
-#ifdef JP
- msg_print("¼ºÇÔ¡ª");
-#else
- msg_print("Failed!");
-#endif
- }
- else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, FALSE);
- p_ptr->energy_need += ENERGY_NEED();
- }
- break;
- }
- }
- }
- }
+ teleport_away_followable(m_idx);
break;
}
#endif
}
- teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE, FALSE);
-
- if (los(py, px, m_ptr->fy, m_ptr->fx) && !world_monster && m_ptr->ml)
- {
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
- {
- u32b flgs[TR_FLAG_SIZE];
- object_type *o_ptr = &inventory[i];
-
- if (object_is_cursed(o_ptr)) continue;
-
- object_flags(o_ptr, flgs);
-
- if ((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
- {
-#ifdef JP
- cptr msg = "¤Ä¤¤¤Æ¤¤¤¤Þ¤¹¤«¡©";
-#else
- cptr msg = "Do you follow it? ";
-#endif
-
- if (get_check_strict(msg, CHECK_OKAY_CANCEL))
- {
- if (one_in_(3))
- {
- teleport_player(200, TRUE);
-#ifdef JP
- msg_print("¼ºÇÔ¡ª");
-#else
- msg_print("Failed!");
-#endif
- }
- else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, FALSE);
- p_ptr->energy_need = ENERGY_NEED();
- }
- break;
- }
- }
- }
+ teleport_away_followable(m_idx);
break;
/* RF6_WORLD */
}
+void teleport_away_followable(int m_idx)
+{
+ monster_type *m_ptr = &m_list[m_idx];
+ int oldfy = m_ptr->fy;
+ int oldfx = m_ptr->fx;
+ bool old_ml = m_ptr->ml;
+ int old_cdis = m_ptr->cdis;
+
+ teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE, FALSE);
+
+ if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && los(py, px, oldfy, oldfx))
+ {
+ bool follow = FALSE;
+
+ if ((p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR)) follow = TRUE;
+ else
+ {
+ u32b flgs[TR_FLAG_SIZE];
+ object_type *o_ptr;
+ int i;
+
+ for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ {
+ o_ptr = &inventory[i];
+ if (o_ptr->k_idx && !object_is_cursed(o_ptr))
+ {
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, TR_TELEPORT))
+ {
+ follow = TRUE;
+ break;
+ }
+ }
+ }
+ }
+
+ if (follow)
+ {
+#ifdef JP
+ if (get_check_strict("¤Ä¤¤¤Æ¤¤¤¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
+#else
+ if (get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
+#endif
+ {
+ if (one_in_(3))
+ {
+ teleport_player(200, TRUE);
+#ifdef JP
+ msg_print("¼ºÇÔ¡ª");
+#else
+ msg_print("Failed!");
+#endif
+ }
+ else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, FALSE);
+ p_ptr->energy_need += ENERGY_NEED();
+ }
+ }
+ }
+}
+
/*
* Teleport the player one level up or down (random when legal)