*/
#include "angband.h"
+#include "util.h"
+
+#include "cmd-dump.h"
#include "cmd-pet.h"
+#include "dungeon.h"
+#include "floor.h"
+#include "object-flavor.h"
#include "monsterrace-hook.h"
#include "monster-status.h"
#include "monster.h"
+#include "spells.h"
#include "spells-summon.h"
#include "quest.h"
#include "grid.h"
#include "warning.h"
#include "player-status.h"
#include "monster-spell.h"
+#include "files.h"
+#include "view-mainwindow.h"
+#include "world.h"
+#include "monsterrace.h"
#define HORDE_NOGOOD 0x01 /*!< (未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? */
#define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
(void)WIPE(m_ptr, monster_type);
/* Count monsters */
- m_cnt--;
+ current_floor_ptr->m_cnt--;
lite_spot(y, x);
if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
/* Hack -- Update parent index */
if (is_pet(m_ptr))
{
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
monster_type *m2_ptr = ¤t_floor_ptr->m_list[i];
cur_dis = 5 * (20 - cnt);
/* Check all the monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Excise dead monsters (backwards!) */
- for (i = m_max - 1; i >= 1; i--)
+ for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
{
/* Get the i'th monster */
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
if (m_ptr->r_idx) continue;
/* Move last monster into open hole */
- compact_monsters_aux(m_max - 1, i);
+ compact_monsters_aux(current_floor_ptr->m_max - 1, i);
- /* Compress "m_max" */
- m_max--;
+ /* Compress "current_floor_ptr->m_max" */
+ current_floor_ptr->m_max--;
}
}
}
/* Delete all the monsters */
- for (i = m_max - 1; i >= 1; i--)
+ for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
/* Hack -- Wipe the racial counter of all monster races */
for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0;
- /* Reset "m_max" */
- m_max = 1;
+ /* Reset "current_floor_ptr->m_max" */
+ current_floor_ptr->m_max = 1;
- /* Reset "m_cnt" */
- m_cnt = 0;
+ /* Reset "current_floor_ptr->m_cnt" */
+ current_floor_ptr->m_cnt = 0;
/* Reset "current_floor_ptr->mproc_max[]" */
for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
MONSTER_IDX i;
/* Normal allocation */
- if (m_max < current_floor_ptr->max_m_idx)
+ if (current_floor_ptr->m_max < current_floor_ptr->max_m_idx)
{
/* Access the next hole */
- i = m_max;
+ i = current_floor_ptr->m_max;
/* Expand the array */
- m_max++;
+ current_floor_ptr->m_max++;
/* Count monsters */
- m_cnt++;
+ current_floor_ptr->m_cnt++;
/* Return the index */
return (i);
}
/* Recycle dead monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
monster_type *m_ptr;
if (m_ptr->r_idx) continue;
/* Count monsters */
- m_cnt++;
+ current_floor_ptr->m_cnt++;
/* Use this monster */
return (i);
MONSTER_IDX i;
/* Update each (live) monster */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
next_o_idx = o_ptr->next_o_idx;
q_ptr = &forge;
- /* Copy the object */
object_copy(q_ptr, o_ptr);
/* Forget monster */
/* Forget objects */
m_ptr->hold_o_idx = 0;
}
+
+/*!
+ * @brief 指定したモンスターに隣接しているモンスターの数を返す。
+ * / Count number of adjacent monsters
+ * @param m_idx 隣接数を調べたいモンスターのID
+ * @return 隣接しているモンスターの数
+ */
+int get_monster_crowd_number(MONSTER_IDX m_idx)
+{
+ monster_type *m_ptr = ¤t_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(ay, ax)) continue;
+
+ /* Count number of monsters */
+ if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++;
+ }
+
+ return count;
+}
\ No newline at end of file