#include "effect/effect-processor.h"
#include "core/stuff-handler.h"
+#include "effect/attribute-types.h"
#include "effect/effect-characteristics.h"
#include "effect/effect-feature.h"
#include "effect/effect-item.h"
#include "pet/pet-fall-off.h"
#include "player/player-status.h"
#include "spell/range-calc.h"
-#include "spell/spell-types.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/monster-race-definition.h"
* @param cury 現在の鏡のy座標
* @param curx 現在の鏡のx座標
*/
-static void next_mirror(player_type *player_ptr, POSITION *next_y, POSITION *next_x, POSITION cury, POSITION curx)
+static void next_mirror(PlayerType *player_ptr, POSITION *next_y, POSITION *next_x, POSITION cury, POSITION curx)
{
POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
int mirror_num = 0; /* 鏡の数 */
* @todo 似たような処理が山ほど並んでいる、何とかならないものか
* @todo 引数にそのまま再代入していてカオスすぎる。直すのは簡単ではない
*/
-ProjectResult project(player_type *player_ptr, const MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, const HIT_POINT dam, const EFFECT_ID typ,
- BIT_FLAGS flag)
+ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, const int dam,
+ const AttributeType typ, BIT_FLAGS flag)
{
int dist;
POSITION y1;
POSITION x2;
POSITION y_saver;
POSITION x_saver;
- int msec = delay_factor * delay_factor * delay_factor;
bool visual = false;
bool drawn = false;
bool breath = false;
}
switch (typ) {
- case GF_LITE:
- case GF_LITE_WEAK:
+ case AttributeType::LITE:
+ case AttributeType::LITE_WEAK:
if (breath || (flag & PROJECT_BEAM))
flag |= (PROJECT_LOS);
break;
- case GF_DISINTEGRATE:
+ case AttributeType::DISINTEGRATE:
flag |= (PROJECT_GRID);
if (breath || (flag & PROJECT_BEAM))
flag |= (PROJECT_DISI);
break;
+ default:
+ break;
}
/* Calculate the projection path */
path_n = projection_path(player_ptr, path_g, (project_length ? project_length : get_max_range(player_ptr)), y1, x1, y2, x2, flag);
handle_stuff(player_ptr);
- if (typ == GF_SEEKER) {
+ if (typ == AttributeType::SEEKER) {
int j;
int last_i = 0;
project_m_n = 0;
gx[grids] = x;
grids++;
- if (msec > 0) {
+ if (delay_factor > 0) {
if (!blind && !(flag & (PROJECT_HIDE))) {
if (panel_contains(y, x) && player_has_los_bold(player_ptr, y, x)) {
uint16_t p = bolt_pict(oy, ox, y, x, typ);
print_rel(player_ptr, c, a, y, x);
move_cursor_relative(y, x);
term_fresh();
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
lite_spot(player_ptr, y, x);
term_fresh();
if (flag & (PROJECT_BEAM)) {
visual = true;
} else if (visual) {
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
}
}
}
- if (affect_item(player_ptr, 0, 0, y, x, dam, GF_SEEKER))
+ if (affect_item(player_ptr, 0, 0, y, x, dam, AttributeType::SEEKER))
res.notice = true;
if (!player_ptr->current_floor_ptr->grid_array[y][x].is_mirror())
continue;
for (j = last_i; j <= i; j++) {
y = get_grid_y(path_g[j]);
x = get_grid_x(path_g[j]);
- if (affect_monster(player_ptr, 0, 0, y, x, dam, GF_SEEKER, flag, true))
+ if (affect_monster(player_ptr, 0, 0, y, x, dam, AttributeType::SEEKER, flag, true))
res.notice = true;
if (!who && (project_m_n == 1) && !jump && (player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)) {
- monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
if (m_ptr->ml) {
- if (!player_ptr->image)
+ if (!player_ptr->hallucinated)
monster_race_track(player_ptr, m_ptr->ap_r_idx);
health_track(player_ptr, player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
}
}
- (void)affect_feature(player_ptr, 0, 0, y, x, dam, GF_SEEKER);
+ (void)affect_feature(player_ptr, 0, 0, y, x, dam, AttributeType::SEEKER);
}
last_i = i;
POSITION py, px;
py = get_grid_y(path_g[i]);
px = get_grid_x(path_g[i]);
- if (affect_monster(player_ptr, 0, 0, py, px, dam, GF_SEEKER, flag, true))
+ if (affect_monster(player_ptr, 0, 0, py, px, dam, AttributeType::SEEKER, flag, true))
res.notice = true;
if (!who && (project_m_n == 1) && !jump) {
if (player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
- monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
if (m_ptr->ml) {
- if (!player_ptr->image)
+ if (!player_ptr->hallucinated)
monster_race_track(player_ptr, m_ptr->ap_r_idx);
health_track(player_ptr, player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
}
}
}
- (void)affect_feature(player_ptr, 0, 0, py, px, dam, GF_SEEKER);
+ (void)affect_feature(player_ptr, 0, 0, py, px, dam, AttributeType::SEEKER);
}
return res;
- } else if (typ == GF_SUPER_RAY) {
+ } else if (typ == AttributeType::SUPER_RAY) {
int j;
int second_step = 0;
project_m_n = 0;
gx[grids] = x;
grids++;
{
- if (msec > 0) {
+ if (delay_factor > 0) {
if (panel_contains(y, x) && player_has_los_bold(player_ptr, y, x)) {
uint16_t p;
TERM_COLOR a;
print_rel(player_ptr, c, a, y, x);
move_cursor_relative(y, x);
term_fresh();
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
lite_spot(player_ptr, y, x);
term_fresh();
if (flag & (PROJECT_BEAM)) {
visual = true;
} else if (visual) {
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
}
}
}
- if (affect_item(player_ptr, 0, 0, y, x, dam, GF_SUPER_RAY))
+ if (affect_item(player_ptr, 0, 0, y, x, dam, AttributeType::SUPER_RAY))
res.notice = true;
- if (!cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, FF::PROJECT)) {
+ if (!cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, FloorFeatureType::PROJECT)) {
if (second_step)
continue;
break;
for (j = 0; j <= i; j++) {
y = get_grid_y(path_g[j]);
x = get_grid_x(path_g[j]);
- (void)affect_feature(player_ptr, 0, 0, y, x, dam, GF_SUPER_RAY);
+ (void)affect_feature(player_ptr, 0, 0, y, x, dam, AttributeType::SUPER_RAY);
}
path_n = i;
second_step = i + 1;
path_n += projection_path(
player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y - 1, x - 1, flag);
- path_n
- += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y - 1, x, flag);
+ path_n += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y - 1, x, flag);
path_n += projection_path(
player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y - 1, x + 1, flag);
- path_n
- += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y, x - 1, flag);
- path_n
- += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y, x + 1, flag);
+ path_n += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y, x - 1, flag);
+ path_n += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y, x + 1, flag);
path_n += projection_path(
player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y + 1, x - 1, flag);
- path_n
- += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y + 1, x, flag);
+ path_n += projection_path(player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y + 1, x, flag);
path_n += projection_path(
player_ptr, &(path_g[path_n + 1]), (project_length ? project_length : get_max_range(player_ptr)), y, x, y + 1, x + 1, flag);
}
for (int i = 0; i < path_n; i++) {
POSITION py = get_grid_y(path_g[i]);
POSITION px = get_grid_x(path_g[i]);
- (void)affect_monster(player_ptr, 0, 0, py, px, dam, GF_SUPER_RAY, flag, true);
+ (void)affect_monster(player_ptr, 0, 0, py, px, dam, AttributeType::SUPER_RAY, flag, true);
if (!who && (project_m_n == 1) && !jump) {
if (player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
- monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
if (m_ptr->ml) {
- if (!player_ptr->image)
+ if (!player_ptr->hallucinated)
monster_race_track(player_ptr, m_ptr->ap_r_idx);
health_track(player_ptr, player_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
}
}
}
- (void)affect_feature(player_ptr, 0, 0, py, px, dam, GF_SUPER_RAY);
+ (void)affect_feature(player_ptr, 0, 0, py, px, dam, AttributeType::SUPER_RAY);
}
return res;
if (!cave_los_bold(player_ptr->current_floor_ptr, ny, nx) && (rad > 0))
break;
} else {
- if (!cave_has_flag_bold(player_ptr->current_floor_ptr, ny, nx, FF::PROJECT) && (rad > 0))
+ if (!cave_has_flag_bold(player_ptr->current_floor_ptr, ny, nx, FloorFeatureType::PROJECT) && (rad > 0))
break;
}
grids++;
}
- if (msec > 0) {
+ if (delay_factor > 0) {
if (!blind && !(flag & (PROJECT_HIDE | PROJECT_FAST))) {
if (panel_contains(y, x) && player_has_los_bold(player_ptr, y, x)) {
uint16_t p;
print_rel(player_ptr, c, a, y, x);
move_cursor_relative(y, x);
term_fresh();
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
lite_spot(player_ptr, y, x);
term_fresh();
if (flag & (PROJECT_BEAM)) {
visual = true;
} else if (visual) {
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
}
}
}
continue;
switch (typ) {
- case GF_LITE:
- case GF_LITE_WEAK:
+ case AttributeType::LITE:
+ case AttributeType::LITE_WEAK:
if (!los(player_ptr, by, bx, y, x))
continue;
break;
- case GF_DISINTEGRATE:
+ case AttributeType::DISINTEGRATE:
if (!in_disintegration_range(player_ptr->current_floor_ptr, by, bx, y, x))
continue;
break;
if (!grids)
return res;
- if (!blind && !(flag & (PROJECT_HIDE)) && (msec > 0)) {
+ if (!blind && !(flag & (PROJECT_HIDE)) && (delay_factor > 0)) {
for (int t = 0; t <= gm_rad; t++) {
for (int i = gm[t]; i < gm[t + 1]; i++) {
y = gy[i];
move_cursor_relative(by, bx);
term_fresh();
if (visual || drawn) {
- term_xtra(TERM_XTRA_DELAY, msec);
+ term_xtra(TERM_XTRA_DELAY, delay_factor);
}
}
y = gy[i];
x = gx[i];
if (grids <= 1) {
- monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[y][x].m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[y][x].m_idx];
monster_race *ref_ptr = &r_info[m_ptr->r_idx];
- if ((flag & PROJECT_REFLECTABLE) && player_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING)
- && ((player_ptr->current_floor_ptr->grid_array[y][x].m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!who || dist_hack > 1)
- && !one_in_(10)) {
+ if ((flag & PROJECT_REFLECTABLE) && player_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && ((player_ptr->current_floor_ptr->grid_array[y][x].m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!who || dist_hack > 1) && !one_in_(10)) {
POSITION t_y, t_x;
int max_attempts = 10;
do {
x = project_m_x;
y = project_m_y;
if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) {
- monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[y][x].m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[y][x].m_idx];
if (m_ptr->ml) {
- if (!player_ptr->image)
+ if (!player_ptr->hallucinated)
monster_race_track(player_ptr, m_ptr->ap_r_idx);
health_track(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].m_idx);
}