extern bool monster_can_enter(player_type *player_ptr, POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode);
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 bool monster_has_hostile_align(player_type *player_ptr, 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);
extern int get_monster_crowd_number(player_type *player_ptr, MONSTER_IDX m_idx);
/*!
* @brief モンスターがプレイヤーに対して敵意を抱くかどうかを返す
* Check if this monster race has "hostile" alignment
+ * @param player_ptr プレーヤーへの参照ポインタ
* @param m_ptr モンスター情報構造体の参照ポインタ
* @param pa_good プレイヤーの善傾向値
* @param pa_evil プレイヤーの悪傾向値
* @details
* If user is player, m_ptr == NULL.
*/
-bool monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr)
+bool monster_has_hostile_align(player_type *player_ptr, monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr)
{
byte sub_align1 = SUB_ALIGN_NEUTRAL;
byte sub_align2 = SUB_ALIGN_NEUTRAL;
}
else /* For player */
{
- if (p_ptr->align >= pa_good) sub_align1 |= SUB_ALIGN_GOOD;
- if (p_ptr->align <= pa_evil) sub_align1 |= SUB_ALIGN_EVIL;
+ if (player_ptr->align >= pa_good) sub_align1 |= SUB_ALIGN_GOOD;
+ if (player_ptr->align <= pa_evil) sub_align1 |= SUB_ALIGN_EVIL;
}
/* Racial alignment flags */
/* Not born */
if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
{
- if (monster_has_hostile_align(m_ptr, 0, 0, r_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, r_ptr)) return FALSE;
}
/* Born now */
else if (summon_specific_who > 0)
{
- if (monster_has_hostile_align(&floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, &floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
}
return TRUE;
/* Born now */
else if (summon_specific_who > 0)
{
- if (monster_has_hostile_align(&floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, &floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE;
}
return (*(get_monster_hook(p_ptr)))(r_idx);
else if ((r_ptr->flags7 & RF7_FRIENDLY) ||
(mode & PM_FORCE_FRIENDLY) || is_friendly_idx(player_ptr, who))
{
- if (!monster_has_hostile_align(NULL, 0, -1, r_ptr)) set_friendly(m_ptr);
+ if (!monster_has_hostile_align(player_ptr, NULL, 0, -1, r_ptr)) set_friendly(m_ptr);
}
/* Assume no sleeping */
if (place_monster_idx == r_idx) return FALSE;
/* Skip different alignment */
- if (monster_has_hostile_align(m_ptr, 0, 0, z_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, z_ptr)) return FALSE;
if (r_ptr->flags7 & RF7_FRIENDLY)
{
- if (monster_has_hostile_align(NULL, 1, -1, z_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, NULL, 1, -1, z_ptr)) return FALSE;
}
if ((r_ptr->flags7 & RF7_CHAMELEON) && !(z_ptr->flags7 & RF7_CHAMELEON))
/* Do not summon enemies */
/* Friendly vs. opposite aligned normal or pet */
- if (monster_has_hostile_align(m_ptr, 0, 0, r_ptr)) return FALSE;
+ if (monster_has_hostile_align(p_ptr, m_ptr, 0, 0, r_ptr)) return FALSE;
}
/* Use the player's alignment */
else if (summon_specific_who < 0)
{
/* Do not summon enemies of the pets */
- if (monster_has_hostile_align(NULL, 10, -10, r_ptr))
+ if (monster_has_hostile_align(p_ptr, NULL, 10, -10, r_ptr))
{
if (!one_in_(ABS(p_ptr->align) / 2 + 1)) return FALSE;
}
if ((summon_specific_who < 0) &&
((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) &&
- monster_has_hostile_align(NULL, 10, -10, r_ptr))
+ monster_has_hostile_align(p_ptr, NULL, 10, -10, r_ptr))
return FALSE;
if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE;
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
- if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+ if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr)) continue;
/* Accept this monster */
break;
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
- if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+ if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr)) continue;
/* Accept this monster */
break;
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
- if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+ if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr)) continue;
/* Accept this monster */
break;