+
+/*!
+ * @brief 指定したモンスターに隣接しているモンスターの数を返す。
+ * / Count number of adjacent monsters
+ * @param m_idx 隣接数を調べたいモンスターのID
+ * @return 隣接しているモンスターの数
+ */
+int get_monster_crowd_number(MONSTER_IDX m_idx)
+{
+ floor_type *floor_ptr = p_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
+ POSITION my = m_ptr->fy;
+ POSITION mx = m_ptr->fx;
+ int i;
+ int count = 0;
+
+ for (i = 0; i < 7; i++)
+ {
+ int ay = my + ddy_ddd[i];
+ int ax = mx + ddx_ddd[i];
+
+ if (!in_bounds(floor_ptr, ay, ax)) continue;
+
+ /* Count number of monsters */
+ if (floor_ptr->grid_array[ay][ax].m_idx > 0) count++;
+ }
+
+ return count;
+}