OSDN Git Service

入身で、暗い場所に居るモンスターを攻撃した時、視界内のはずなのに
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 23 Nov 2003 14:43:21 +0000 (14:43 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 23 Nov 2003 14:43:21 +0000 (14:43 +0000)
update_mon()を先にしない為、「何かを攻撃した」と表示されていたバグを修正。

src/spells2.c

index 90ac369..31c2c12 100644 (file)
@@ -7539,7 +7539,7 @@ void kawarimi(bool success)
 bool rush_attack(bool *mdeath)
 {
        int dir;
-       int tx, ty, nx, ny;
+       int tx, ty;
        int tm_idx = 0;
        u16b path_g[32];
        int path_n, i;
@@ -7576,70 +7576,78 @@ bool rush_attack(bool *mdeath)
        /* Project along the path */
        for (i = 0; i < path_n; i++)
        {
-               ny = GRID_Y(path_g[i]);
-               nx = GRID_X(path_g[i]);
+               monster_type *m_ptr;
+
+               int ny = GRID_Y(path_g[i]);
+               int nx = GRID_X(path_g[i]);
 
-               if (!cave_empty_bold(ny, nx) || !player_can_enter(cave[ny][nx].feat, 0))
+               if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
                {
-                       if (cave[ny][nx].m_idx)
-                       {
-                               monster_type *m_ptr = &m_list[cave[ny][nx].m_idx];
+                       ty = ny;
+                       tx = nx;
 
-                               if (tm_idx != cave[ny][nx].m_idx)
-                               {
-#ifdef JP
-                                       msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "",
-                                               m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«");
-#else
-                                       msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") :
-                                               "someone");
-#endif
-                               }
-                               else
-                               {
-                                       if (!player_bold(ty, tx))
-                                       {
-                                               /* Hold the monster name */
-                                               char m_name[80];
+                       /* Go to next grid */
+                       continue;
+               }
 
-                                               /* Get the monster name (BEFORE polymorphing) */
-                                               monster_desc(m_name, m_ptr, 0);
+               if (!cave[ny][nx].m_idx)
+               {
+                       if (tm_idx)
+                       {
 #ifdef JP
-                                               msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name);
+                               msg_print("¼ºÇÔ¡ª");
 #else
-                                               msg_format("You quickly jump in and attack %s!", m_name);
+                               msg_print("Failed!");
 #endif
-                                       }
-                               }
-
-                               tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
                        }
                        else
                        {
-                               if (tm_idx)
-                               {
 #ifdef JP
-                                       msg_print("¼ºÇÔ¡ª");
+                               msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£");
 #else
-                                       msg_print("Failed!");
+                               msg_print("You can't move to that place.");
 #endif
-                               }
-                               else
-                               {
+                       }
+
+                       /* Exit loop */
+                       break;
+               }
+
+               /* Move player before updating the monster */
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+
+               /* Update the monster */
+               update_mon(cave[ny][nx].m_idx, TRUE);
+
+               /* Found a monster */
+               m_ptr = &m_list[cave[ny][nx].m_idx];
+
+               if (tm_idx != cave[ny][nx].m_idx)
+               {
 #ifdef JP
-                                       msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£");
+                       msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "",
+                                  m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«");
 #else
-                                       msg_print("You can't move to that place.");
+                       msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
 #endif
-                               }
-                       }
-                       break;
                }
-               else
+               else if (!player_bold(ty, tx))
                {
-                       ty = ny;
-                       tx = nx;
+                       /* Hold the monster name */
+                       char m_name[80];
+
+                       /* Get the monster name (BEFORE polymorphing) */
+                       monster_desc(m_name, m_ptr, 0);
+#ifdef JP
+                       msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name);
+#else
+                       msg_format("You quickly jump in and attack %s!", m_name);
+#endif
                }
+
+               tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
+
+               break;
        }
 
        if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);