{
success = FALSE;
if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
- if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
+ if (monster_can_enter(user_ptr, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
{
if (place_monster_aux(user_ptr, 0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
{
f_ptr = &f_info[g_ptr->feat];
if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue;
- if (!monster_can_enter(y, x, r_ptr, 0)) continue;
+ if (!monster_can_enter(creature_ptr, y, x, r_ptr, 0)) continue;
if (distance(y, x, creature_ptr->y, creature_ptr->x) < 10) continue;
if (g_ptr->info & CAVE_ICKY) continue;
else break;
for (j = 1000; j > 0; j--)
{
scatter(master_ptr, &cy, &cx, master_ptr->y, master_ptr->x, d, 0);
- if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
+ if (monster_can_enter(master_ptr, cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
}
if (j) break;
}
if (is_closed_door(player_ptr, g_ptr->feat)) continue;
}
- if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0)))
+ if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(player_ptr, feat, &r_info[floor_ptr->m_list[g_ptr->m_idx].r_idx], 0)))
{
/* Delete the monster (if any) */
delete_monster(player_ptr, ty, tx);
if (!(mode & TELEPORT_PASSIVE))
{
- if (!monster_can_cross_terrain(g_ptr->feat, &r_info[m_ptr->r_idx], 0)) return FALSE;
+ if (!monster_can_cross_terrain(player_ptr, g_ptr->feat, &r_info[m_ptr->r_idx], 0)) return FALSE;
}
return TRUE;
{
feature_type *f_ptr = &f_info[feature];
- if (creature_ptr->riding) return monster_can_cross_terrain(feature, &r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx], mode | CEM_RIDING);
+ if (creature_ptr->riding) return monster_can_cross_terrain(creature_ptr, feature, &r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx], mode | CEM_RIDING);
if (have_flag(f_ptr->flags, FF_PATTERN))
{
g_ptr = &floor_ptr->grid_array[y][x];
/* Skip locations in a wall */
- if (!monster_can_cross_terrain(g_ptr->feat, &r_info[m_ptr->r_idx], (m_idx == target_ptr->riding) ? CEM_RIDING : 0)) continue;
+ if (!monster_can_cross_terrain(target_ptr, g_ptr->feat, &r_info[m_ptr->r_idx], (m_idx == target_ptr->riding) ? CEM_RIDING : 0)) continue;
/* Check for "availability" (if monsters can flow) */
if (!(m_ptr->mflag2 & MFLAG2_NOFLOW))
if (!in_bounds(floor_ptr, y, x)) continue;
/* Skip occupied locations */
- if (!monster_can_enter(y, x, r_ptr, 0)) continue;
+ if (!monster_can_enter(target_ptr, y, x, r_ptr, 0)) continue;
/* Check for hidden, available grid */
if (projectable(target_ptr, target_ptr->y, target_ptr->x, y, x) && clean_shot(target_ptr, fy, fx, y, x, FALSE))
g_ptr = &floor_ptr->grid_array[yy][xx];
/* Check grid */
- if (monster_can_cross_terrain(g_ptr->feat, r_ptr, 0))
+ if (monster_can_cross_terrain(target_ptr, g_ptr->feat, r_ptr, 0))
{
/* One more room grid */
room++;
if (!in_bounds2(floor_ptr, y2, x2)) continue;
/* Ignore filled grids */
- if (!monster_can_enter(y2, x2, r_ptr, 0)) continue;
+ if (!monster_can_enter(target_ptr, y2, x2, r_ptr, 0)) continue;
/* Try to fill this hole */
break;
/* Access that grid */
g_ptr = &target_ptr->current_floor_ptr->grid_array[ny][nx];
f_ptr = &f_info[g_ptr->feat];
- can_cross = monster_can_cross_terrain(g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0);
+ can_cross = monster_can_cross_terrain(target_ptr, g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0);
/* Access that grid's contents */
y_ptr = &target_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) &&
(r_ptr->mexp > z_ptr->mexp) &&
can_cross && (g_ptr->m_idx != target_ptr->riding) &&
- monster_can_cross_terrain(target_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
+ monster_can_cross_terrain(target_ptr, target_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
{
/* Allow movement */
do_move = TRUE;
if (must_alter_to_move && (r_ptr->flags7 & RF7_AQUATIC))
{
- if (!monster_can_cross_terrain(g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0))
+ if (!monster_can_cross_terrain(target_ptr, g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0))
{
/* Assume no move allowed */
do_move = FALSE;
*/
#define CEM_RIDING 0x0001
#define CEM_P_CAN_ENTER_PATTERN 0x0002
-extern bool monster_can_cross_terrain(FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 mode);
-extern bool monster_can_enter(POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode);
+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 monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr);
/*!
* @brief モンスターが地形を踏破できるかどうかを返す
* Check if monster can cross terrain
+ * @param player_ptr プレーヤーへの参照ポインタ
* @param feat 地形ID
* @param r_ptr モンスター種族構造体の参照ポインタ
* @param mode オプション
* @return 踏破可能ならばTRUEを返す
*/
-bool monster_can_cross_terrain(FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 mode)
+bool monster_can_cross_terrain(player_type *player_ptr, FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 mode)
{
feature_type *f_ptr = &f_info[feat];
if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (r_ptr->flags7 & RF7_CAN_SWIM)) return TRUE;
if (have_flag(f_ptr->flags, FF_CAN_PASS))
{
- if ((r_ptr->flags2 & RF2_PASS_WALL) && (!(mode & CEM_RIDING) || p_ptr->pass_wall)) return TRUE;
+ if ((r_ptr->flags2 & RF2_PASS_WALL) && (!(mode & CEM_RIDING) || player_ptr->pass_wall)) return TRUE;
}
if (!have_flag(f_ptr->flags, FF_MOVE)) return FALSE;
/*!
* @brief 指定された座標の地形をモンスターが踏破できるかどうかを返す
* Strictly check if monster can enter the grid
+ * @param player_ptr プレーヤーへの参照ポインタ
* @param y 地形のY座標
* @param x 地形のX座標
* @param r_ptr モンスター種族構造体の参照ポインタ
* @param mode オプション
* @return 踏破可能ならばTRUEを返す
*/
-bool monster_can_enter(POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode)
+bool monster_can_enter(player_type *player_ptr, POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode)
{
- grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
- if (player_bold(p_ptr, y, x)) return FALSE;
+ grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
+ if (player_bold(player_ptr, y, x)) return FALSE;
if (g_ptr->m_idx) return FALSE;
- return monster_can_cross_terrain(g_ptr->feat, r_ptr, mode);
+ return monster_can_cross_terrain(player_ptr, g_ptr->feat, r_ptr, mode);
}
if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
return FALSE;
- if (!monster_can_cross_terrain(floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
+ if (!monster_can_cross_terrain(p_ptr, floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
/* Not born */
if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
return FALSE;
- if (!monster_can_cross_terrain(floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
+ if (!monster_can_cross_terrain(p_ptr, floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
/* Not born */
if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
if (pattern_tile(y, x)) return FALSE;
/* Require empty space (if not ghostly) */
- if (!monster_can_enter(y, x, r_ptr, 0)) return FALSE;
+ if (!monster_can_enter(player_ptr, y, x, r_ptr, 0)) return FALSE;
}
if (!player_ptr->phase_out)
monster_race *r_ptr = &r_info[r_idx];
/* Require empty space (if not ghostly) */
- if (!monster_can_enter(ny, nx, r_ptr, 0))
+ if (!monster_can_enter(player_ptr, ny, nx, r_ptr, 0))
continue;
}
else
continue;
}
- if (!monster_can_cross_terrain(floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0))
+ if (!monster_can_cross_terrain(player_ptr, floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0))
{
try_count++;
continue;
py_attack(creature_ptr, y, x, 0);
can_move = FALSE;
}
- else if (monster_can_cross_terrain(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
+ else if (monster_can_cross_terrain(creature_ptr, floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
{
do_past = TRUE;
}
m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
/* Monster cannot move back? */
- if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0))
+ if (!monster_can_enter(caster_ptr, ny, nx, &r_info[m_ptr->r_idx], 0))
{
/* -more- */
if (i < 2) msg_print(NULL);