}
case SV_ROD_TELEPORT_AWAY: {
- int distance = MAX_SIGHT * (powerful ? 8 : 5);
+ int distance = MAX_PLAYER_SIGHT * (powerful ? 8 : 5);
if (teleport_monster(player_ptr, dir, distance)) {
ident = true;
}
}
case SV_WAND_TELEPORT_AWAY: {
- int distance = MAX_SIGHT * (powerful ? 8 : 5);
+ int distance = MAX_PLAYER_SIGHT * (powerful ? 8 : 5);
if (teleport_monster(player_ptr, dir, distance)) {
ident = true;
}
em_ptr->seen_msg = is_seen(player_ptr, em_ptr->m_ptr);
em_ptr->slept = em_ptr->m_ptr->is_asleep();
em_ptr->obvious = false;
- em_ptr->known = ((em_ptr->m_ptr->cdis <= MAX_SIGHT) || player_ptr->phase_out);
+ em_ptr->known = ((em_ptr->m_ptr->cdis <= MAX_PLAYER_SIGHT) || player_ptr->phase_out);
em_ptr->skipped = false;
em_ptr->get_angry = false;
em_ptr->do_polymorph = false;
has_pet = true;
}
- if (m_ptr->is_asleep() || (m_ptr->cdis > MAX_SIGHT) || !m_ptr->is_hostile()) {
+ if (m_ptr->is_asleep() || (m_ptr->cdis > MAX_PLAYER_SIGHT) || !m_ptr->is_hostile()) {
continue;
}
mam_pp_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
mam_pp_ptr->seen = is_seen(player_ptr, mam_pp_ptr->m_ptr);
mam_pp_ptr->dam = dam;
- mam_pp_ptr->known = mam_pp_ptr->m_ptr->cdis <= MAX_SIGHT;
+ mam_pp_ptr->known = mam_pp_ptr->m_ptr->cdis <= MAX_PLAYER_SIGHT;
mam_pp_ptr->dead = dead;
mam_pp_ptr->fear = fear;
mam_pp_ptr->note = note;
mam_ptr->do_silly_attack = (one_in_(2) && player_ptr->effects()->hallucination()->is_hallucinated());
mam_ptr->power = 0;
mam_ptr->obvious = false;
- mam_ptr->known = (mam_ptr->m_ptr->cdis <= MAX_SIGHT) || (mam_ptr->t_ptr->cdis <= MAX_SIGHT);
+ mam_ptr->known = (mam_ptr->m_ptr->cdis <= MAX_PLAYER_SIGHT) || (mam_ptr->t_ptr->cdis <= MAX_PLAYER_SIGHT);
mam_ptr->fear = false;
mam_ptr->dead = false;
return mam_ptr;
player_ptr->current_floor_ptr->monster_noise = true;
}
- teleport_away(player_ptr, mam_ptr->m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
+ teleport_away(player_ptr, mam_ptr->m_idx, MAX_PLAYER_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
}
}
std::vector<Pos2D> points;
void (*add_mon_lite)(PlayerType *, std::vector<Pos2D> &, const POSITION, const POSITION, const monster_lite_type *);
- int dis_lim = (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::DARKNESS) && !player_ptr->see_nocto) ? (MAX_SIGHT / 2 + 1) : (MAX_SIGHT + 3);
+ int dis_lim = (dungeons_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::DARKNESS) && !player_ptr->see_nocto) ? (MAX_PLAYER_SIGHT / 2 + 1) : (MAX_PLAYER_SIGHT + 3);
auto *floor_ptr = player_ptr->current_floor_ptr;
for (int i = 0; i < floor_ptr->mon_lite_n; i++) {
grid_type *g_ptr;
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- if (m_ptr->ap_r_idx == MonsterRaceId::CYBER && one_in_(CYBERNOISE) && !m_ptr->ml && (m_ptr->cdis <= MAX_SIGHT)) {
+ if (m_ptr->ap_r_idx == MonsterRaceId::CYBER && one_in_(CYBERNOISE) && !m_ptr->ml && (m_ptr->cdis <= MAX_PLAYER_SIGHT)) {
if (disturb_minor) {
disturb(player_ptr, false, false);
}
return (this->player_ptr->pet_follow_distance < 0) && (m_ptr->cdis <= (0 - this->player_ptr->pet_follow_distance));
}
- if (m_ptr->cdis > MAX_SIGHT + 5) {
+ if (m_ptr->cdis > MAX_PLAYER_SIGHT + 5) {
return false;
}
}
if ((!los(this->player_ptr, m_ptr->fy, m_ptr->fx, this->player_ptr->y, this->player_ptr->x) || !projectable(this->player_ptr, m_ptr->fy, m_ptr->fx, this->player_ptr->y, this->player_ptr->x))) {
- if (floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].get_distance(r_ptr) >= MAX_SIGHT / 2) {
+ if (floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].get_distance(r_ptr) >= MAX_PLAYER_SIGHT / 2) {
return;
}
}
continue;
}
- if ((m_ptr->cdis >= AAF_LIMIT) || !decide_process_continue(player_ptr, m_ptr)) {
+ if ((m_ptr->cdis >= MAX_MONSTER_SENSING) || !decide_process_continue(player_ptr, m_ptr)) {
continue;
}
m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
}
- if (m_ptr->cdis <= (m_ptr->is_pet() ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
+ if (m_ptr->cdis <= (m_ptr->is_pet() ? (r_ptr->aaf > MAX_PLAYER_SIGHT ? MAX_PLAYER_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
return true;
}
- if ((m_ptr->cdis <= MAX_SIGHT || player_ptr->phase_out) && (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx) || has_aggravate(player_ptr))) {
+ if ((m_ptr->cdis <= MAX_PLAYER_SIGHT || player_ptr->phase_out) && (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx) || has_aggravate(player_ptr))) {
return true;
}
case MTIMED_CSLEEP: {
auto *r_ptr = &monraces_info[m_ptr->r_idx];
auto is_wakeup = false;
- if (m_ptr->cdis < AAF_LIMIT) {
+ if (m_ptr->cdis < MAX_MONSTER_SENSING) {
/* Handle "sensing radius" */
- if (m_ptr->cdis <= (m_ptr->is_pet() ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
+ if (m_ptr->cdis <= (m_ptr->is_pet() ? ((r_ptr->aaf > MAX_PLAYER_SIGHT) ? MAX_PLAYER_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
is_wakeup = true;
}
/* Handle "sight" and "aggravation" */
- else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx))) {
+ else if ((m_ptr->cdis <= MAX_PLAYER_SIGHT) && (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx))) {
is_wakeup = true;
}
}
/* Hack -- amount of "waking" */
/* Wake up faster near the player */
- auto d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
+ auto d = (m_ptr->cdis < MAX_MONSTER_SENSING / 2) ? (MAX_MONSTER_SENSING / m_ptr->cdis) : 1;
/* Hack -- amount of "waking" is affected by speed of player */
d = (d * speed_to_energy(player_ptr->pspeed)) / 10;
m_ptr->mflag.reset(MonsterTemporaryFlagType::ESP);
- if (distance > (um_ptr->in_darkness ? MAX_SIGHT / 2 : MAX_SIGHT)) {
+ if (distance > (um_ptr->in_darkness ? MAX_PLAYER_SIGHT / 2 : MAX_PLAYER_SIGHT)) {
return;
}
- if (!um_ptr->in_darkness || (distance <= MAX_SIGHT / 4)) {
+ if (!um_ptr->in_darkness || (distance <= MAX_PLAYER_SIGHT / 4)) {
update_telepathy_sight(player_ptr, um_ptr, m_idx);
update_specific_race_telepathy(player_ptr, um_ptr);
}
}
if (t_idx == player_ptr->riding) {
- teleport_player_away(m_idx, player_ptr, MAX_SIGHT * 2 + 5, false);
+ teleport_player_away(m_idx, player_ptr, MAX_PLAYER_SIGHT * 2 + 5, false);
} else {
- teleport_away(player_ptr, t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
+ teleport_away(player_ptr, t_idx, MAX_PLAYER_SIGHT * 2 + 5, TELEPORT_PASSIVE);
}
set_monster_csleep(player_ptr, t_idx, 0);
{
monster_type *m_ptr = &floor_ptr->m_list[m_idx];
monster_type *t_ptr = &floor_ptr->m_list[t_idx];
- return (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT);
+ return (m_ptr->cdis <= MAX_PLAYER_SIGHT) || (t_ptr->cdis <= MAX_PLAYER_SIGHT);
}
/*!
grid_type *g_ptr;
if (view_reduce_view && !floor_ptr->dun_level) {
- full = MAX_SIGHT / 2;
- over = MAX_SIGHT * 3 / 4;
+ full = MAX_PLAYER_SIGHT / 2;
+ over = MAX_PLAYER_SIGHT * 3 / 4;
} else {
- full = MAX_SIGHT;
- over = MAX_SIGHT * 3 / 2;
+ full = MAX_PLAYER_SIGHT;
+ over = MAX_PLAYER_SIGHT * 3 / 2;
}
for (n = 0; n < floor_ptr->view_n; n++) {
}
{
- int power = MAX_SIGHT * 5;
+ int power = MAX_PLAYER_SIGHT * 5;
if (info) {
return info_power(power);
}
return _("周囲の邪悪なモンスターを感知する。", "Detects evil monsters.");
}
if (info) {
- return info_range(MAX_SIGHT);
+ return info_range(MAX_PLAYER_SIGHT);
}
if (cast) {
msg_print(_("邪悪な生物の存在を感じ取ろうとした。", "You sense the presence of evil creatures."));
return nullptr;
}
- if (!cave_player_teleportable_bold(player_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, player_ptr->y, player_ptr->x) > MAX_SIGHT / 2) || !projectable(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
+ if (!cave_player_teleportable_bold(player_ptr, y, x, TELEPORT_SPONTANEOUS) || (distance(y, x, player_ptr->y, player_ptr->x) > MAX_PLAYER_SIGHT / 2) || !projectable(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
msg_print(_("失敗!", "You cannot move to that place!"));
break;
}
if (!m_ptr->is_valid()) {
continue;
}
- if (m_ptr->cdis > MAX_SIGHT) {
+ if (m_ptr->cdis > MAX_PLAYER_SIGHT) {
continue;
}
if (r_ptr->kind_flags.has_not(MonsterKindType::UNDEAD)) {
continue;
}
- if (m_ptr->cdis > MAX_SIGHT) {
+ if (m_ptr->cdis > MAX_PLAYER_SIGHT) {
continue;
}
continue;
}
- if (m_ptr->cdis < MAX_SIGHT * 2) {
+ if (m_ptr->cdis < MAX_PLAYER_SIGHT * 2) {
if (m_ptr->is_asleep()) {
(void)set_monster_csleep(player_ptr, i, 0);
sleep = true;
bool old_ml = m_ptr->ml;
POSITION old_cdis = m_ptr->cdis;
- teleport_away(player_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
+ teleport_away(player_ptr, m_idx, MAX_PLAYER_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
bool is_followable = old_ml;
- is_followable &= old_cdis <= MAX_SIGHT;
+ is_followable &= old_cdis <= MAX_PLAYER_SIGHT;
is_followable &= w_ptr->timewalk_m_idx == 0;
is_followable &= !player_ptr->phase_out;
is_followable &= los(player_ptr, player_ptr->y, player_ptr->x, oldfy, oldfx);
msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But a magic barrier obstructs it."));
} else {
msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
- teleport_away(this->player_ptr, this->monap_ptr->m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
+ teleport_away(this->player_ptr, this->monap_ptr->m_idx, MAX_PLAYER_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
}
}
#define FUEL_TORCH 5000 /*!< 松明の基本寿命値 / Maximum amount of fuel in a torch */
#define FUEL_LAMP 15000 /*!< ランタンの基本寿命値 / Maximum amount of fuel in a lantern */
-/*
- * More maximum values
- */
-#define MAX_SIGHT 20 /*!< プレイヤーの最大視界範囲(マス) / Maximum view distance */
-
-#define AAF_LIMIT 100 /*!< モンスターの限界感知範囲(マス) Limit of sensing radius */
-
#define MAX_SKILLS 10
#define TY_CURSE_CHANCE 200 /*!<太古の怨念の1ターン毎の発動確率(1/n)*/
#define MON_DRAIN_LIFE 2 /*!< モンスターの打撃によるプレイヤーの経験値吸収基本倍率(%) / Percent of player exp drained per hit */
#define USE_DEVICE 3 /*!< 魔道具の最低失敗基準値 x> Harder devices x< Easier devices */
+constexpr auto MAX_PLAYER_SIGHT = 20; /*!< プレイヤーの最大視界グリッド数 */
+constexpr auto MAX_MONSTER_SENSING = 100; /*!< モンスターの最大感知グリッド数 */
+
/*!
* @brief 1フロアに存在可能な、増殖フラグ付きモンスター実体の最大数
* @details 呪術や突然変異で増殖阻止状態にすると、
{
for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_SIGHT)) {
+ if (!m_ptr->is_valid() || (i == player_ptr->riding) || (m_ptr->cdis > MAX_PLAYER_SIGHT)) {
continue;
}
should_alloc &= !inside_quest(floor_ptr->quest_number);
should_alloc &= !this->player_ptr->phase_out;
if (should_alloc) {
- (void)alloc_monster(this->player_ptr, MAX_SIGHT + 5, 0, summon_specific);
+ (void)alloc_monster(this->player_ptr, MAX_PLAYER_SIGHT + 5, 0, summon_specific);
}
}