OSDN Git Service

モンスターのテレポートに次のようなバグがあった.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 20 Jan 2004 14:32:06 +0000 (14:32 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 20 Jan 2004 14:32:06 +0000 (14:32 +0000)
* プレイヤーの視界に入っていない位置でテレポートしても, los()が通れば
  追える.
* 対プレイヤーでテレポートを使った場合は元位置を見るのに, モンスター
  同士の戦いでテレポートを使った場合はテレポート先の位置を見て追撃を
  判定していた.
* 全身に呪われたアイテムを装備していた場合はテレポート制御の変異やも
  のまね師の能力としてのテレポート追撃が無効になっていた.
追尾可能なモンスターのテレポートを関数にまとめ, これらのバグを修正.

src/externs.h
src/mspells1.c
src/mspells2.c
src/spells3.c

index 28c664e..ad3d6ff 100644 (file)
@@ -1145,6 +1145,7 @@ extern void teleport_monster_to(int m_idx, int ty, int tx, int power, bool passi
 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);
index 927f141..fd885b0 100644 (file)
@@ -3408,56 +3408,14 @@ msg_format("%^s
                /* 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;
                }
 
index da40f28..a5d90b0 100644 (file)
@@ -3077,45 +3077,7 @@ bool monst_spell_monst(int m_idx)
 #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 */
index 64e5f12..ee82b18 100644 (file)
@@ -498,6 +498,66 @@ void teleport_player_to(int ny, int nx, bool no_tele, bool passive)
 }
 
 
+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)