OSDN Git Service

状態変数の処理ループをさらに細分化. その状態になっているモンスターが1
[hengband/hengband.git] / src / mind.c
index 413530c..47607b3 100644 (file)
@@ -1167,19 +1167,20 @@ static bool cast_force_spell(int spell)
        case 9:
        {
                monster_type *m_ptr;
-               bool need_mproc_remove = FALSE;
+               int m_idx;
                char m_name[80];
 
                if (!target_set(TARGET_KILL)) return FALSE;
-               if (!cave[target_row][target_col].m_idx) break;
+               m_idx = cave[target_row][target_col].m_idx;
+               if (!m_idx) break;
                if (!player_has_los_bold(target_row, target_col)) break;
                if (!projectable(py, px, target_row, target_col)) break;
-               m_ptr = &m_list[cave[target_row][target_col].m_idx];
+               m_ptr = &m_list[m_idx];
                monster_desc(m_name, m_ptr, 0);
                if (m_ptr->invulner)
                {
                        m_ptr->invulner = 0;
-                       need_mproc_remove = TRUE;
+                       mproc_remove(m_idx, m_ptr->mproc_idx[MPROC_INVULNER], MPROC_INVULNER);
                        if (m_ptr->ml)
                        {
 #ifdef JP
@@ -1188,14 +1189,14 @@ static bool cast_force_spell(int spell)
                                msg_format("%^s is no longer invulnerable.", m_name);
 #endif
                                p_ptr->redraw |= (PR_HEALTH);
-                               if (p_ptr->riding == cave[target_row][target_col].m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
                        }
                        m_ptr->energy_need += ENERGY_NEED();
                }
                if (m_ptr->fast)
                {
                        m_ptr->fast = 0;
-                       need_mproc_remove = TRUE;
+                       mproc_remove(m_idx, m_ptr->mproc_idx[MPROC_FAST], MPROC_FAST);
 #ifdef JP
                        if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
 #else
@@ -1205,15 +1206,13 @@ static bool cast_force_spell(int spell)
                if (m_ptr->slow)
                {
                        m_ptr->slow = 0;
-                       need_mproc_remove = TRUE;
+                       mproc_remove(m_idx, m_ptr->mproc_idx[MPROC_SLOW], MPROC_SLOW);
 #ifdef JP
                        if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
 #else
                        if (m_ptr->ml) msg_format("%^s is no longer slow.", m_name);
 #endif
                }
-
-               if (need_mproc_remove && !need_mproc(m_ptr)) mproc_remove(m_ptr->mproc_idx);
                break;
        }
        case 10:
@@ -1745,7 +1744,7 @@ msg_print("
                {
                        /* Wake the monster up */
                        m_ptr->csleep = 0;
-                       if (!need_mproc(m_ptr)) mproc_remove(m_ptr->mproc_idx);
+                       mproc_remove(m_idx, m_ptr->mproc_idx[MPROC_CSLEEP], MPROC_CSLEEP);
                }
 
                /* Update the monster (new location) */