}
/* Monster must be 'an enemy' */
- if (!are_enemies(m_ptr, t_ptr)) continue;
+ if (!are_enemies(target_ptr, m_ptr, t_ptr)) continue;
/* Monster must be projectable if we can't pass through walls */
if (((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != target_ptr->riding) || target_ptr->pass_wall)) ||
/* The monster must be an enemy, and in LOS */
if (t_m_idx &&
- are_enemies(m_ptr, &floor_ptr->m_list[t_m_idx]) &&
+ are_enemies(target_ptr, m_ptr, &floor_ptr->m_list[t_m_idx]) &&
los(target_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x) &&
projectable(target_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
{
MONSTER_IDX t_m_idx = target_ptr->current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
/* The monster must be an enemy, and projectable */
- if (t_m_idx && are_enemies(m_ptr, &target_ptr->current_floor_ptr->m_list[t_m_idx]) &&
+ if (t_m_idx && are_enemies(target_ptr, m_ptr, &target_ptr->current_floor_ptr->m_list[t_m_idx]) &&
projectable(target_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x))
{
counterattack = TRUE;
if (((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW) &&
(r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level) &&
can_cross && (g_ptr->m_idx != target_ptr->riding)) ||
- are_enemies(m_ptr, y_ptr) || MON_CONFUSED(m_ptr))
+ are_enemies(target_ptr, m_ptr, y_ptr) || MON_CONFUSED(m_ptr))
{
if (!(r_ptr->flags1 & RF1_NEVER_BLOW))
{
extern bool monster_can_cross_terrain(player_type *player_ptr, FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 mode);
extern bool monster_can_enter(player_type *player_ptr, POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode);
-extern bool are_enemies(monster_type *m_ptr1, monster_type *m_ptr2);
+extern bool are_enemies(player_type *player_ptr, monster_type *m_ptr1, monster_type *m_ptr2);
extern bool monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr);
extern void dice_to_string(int base_damage, int dice_num, int dice_side, int dice_mult, int dice_div, char* msg);
extern concptr look_mon_desc(monster_type *m_ptr, BIT_FLAGS mode);
* @param n_ptr モンスター2の構造体参照ポインタ
* @return 敵対関係にあるならばTRUEを返す
*/
-bool are_enemies(monster_type *m_ptr, monster_type *n_ptr)
+bool are_enemies(player_type *player_ptr, monster_type *m_ptr, monster_type *n_ptr)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
monster_race *s_ptr = &r_info[n_ptr->r_idx];
- if (p_ptr->phase_out)
+ if (player_ptr->phase_out)
{
if (is_pet(m_ptr) || is_pet(n_ptr)) return FALSE;
return TRUE;
if (y == y2 && x == x2)
hit2 = TRUE;
else if (is_friend && floor_ptr->grid_array[y][x].m_idx > 0 &&
- !are_enemies(m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
+ !are_enemies(target_ptr, m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
{
/* Friends don't shoot friends */
return FALSE;
/* Cancel if neither enemy nor a given target */
if ((m_idx == target_idx) ||
- ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
+ ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(target_ptr, m_ptr, t_ptr)))
{
target_idx = 0;
}
if (!monster_is_valid(t_ptr)) continue;
/* Monster must be 'an enemy' */
- if ((m_idx == target_idx) || !are_enemies(m_ptr, t_ptr)) continue;
+ if ((m_idx == target_idx) || !are_enemies(target_ptr, m_ptr, t_ptr)) continue;
/* Monster must be projectable */
if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;