#include "status/experience.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
-#include "system/object-type-definition.h"
+#include "system/item-entity.h"
#include "system/player-type-definition.h"
+#include "system/terrain-type-definition.h"
#include "target/target-getter.h"
#include "term/screen-processor.h"
+#include "timed-effect/player-blindness.h"
+#include "timed-effect/player-confusion.h"
+#include "timed-effect/player-hallucination.h"
+#include "timed-effect/timed-effects.h"
#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
{
bool flag = true;
bool more = false;
- ObjectType *o_ptr = &player_ptr->current_floor_ptr->o_list[o_idx];
+ auto *o_ptr = &player_ptr->current_floor_ptr->o_list[o_idx];
PlayerEnergy(player_ptr).set_player_turn_energy(100);
if (o_ptr->pval > 0) {
flag = false;
int i = player_ptr->skill_dis;
- if (player_ptr->blind || no_lite(player_ptr))
+ const auto effects = player_ptr->effects();
+ if (effects->blindness()->is_blind() || no_lite(player_ptr)) {
i = i / 10;
+ }
- if (player_ptr->confused || player_ptr->hallucinated)
+ if (effects->confusion()->is_confused() || effects->hallucination()->is_hallucinated()) {
i = i / 10;
+ }
int j = i - o_ptr->pval;
- if (j < 2)
+ if (j < 2) {
j = 2;
+ }
if (randint0(100) < j) {
msg_print(_("鍵をはずした。", "You have picked the lock."));
flag = true;
} else {
more = true;
- if (flush_failure)
+ if (flush_failure) {
flush();
+ }
msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
}
DIRECTION dir;
OBJECT_IDX o_idx;
bool more = false;
- if (player_ptr->wild_mode)
+ if (player_ptr->wild_mode) {
return;
+ }
PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
int num_chests = count_chests(player_ptr, &y, &x, false);
if (num_doors || num_chests) {
bool too_many = (num_doors && num_chests) || (num_doors > 1) || (num_chests > 1);
- if (!too_many)
+ if (!too_many) {
command_dir = coords_to_dir(player_ptr, y, x);
+ }
}
}
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
feat = g_ptr->get_feat_mimic();
o_idx = chest_check(player_ptr->current_floor_ptr, y, x, false);
- if (f_info[feat].flags.has_not(FloorFeatureType::OPEN) && !o_idx) {
+ if (terrains_info[feat].flags.has_not(TerrainCharacteristics::OPEN) && !o_idx) {
msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
} else if (g_ptr->m_idx && player_ptr->riding != g_ptr->m_idx) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
}
}
- if (!more)
+ if (!more) {
disturb(player_ptr, false, false);
+ }
}
/*!
POSITION y, x;
DIRECTION dir;
bool more = false;
- if (player_ptr->wild_mode)
+ if (player_ptr->wild_mode) {
return;
+ }
PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
- if (easy_open && (count_dt(player_ptr, &y, &x, is_open, false) == 1))
+ if (easy_open && (count_dt(player_ptr, &y, &x, is_open, false) == 1)) {
command_dir = coords_to_dir(player_ptr, y, x);
+ }
if (command_arg) {
command_rep = command_arg - 1;
x = player_ptr->x + ddx[dir];
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
feat = g_ptr->get_feat_mimic();
- if (f_info[feat].flags.has_not(FloorFeatureType::CLOSE)) {
+ if (terrains_info[feat].flags.has_not(TerrainCharacteristics::CLOSE)) {
msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
} else if (g_ptr->m_idx) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
}
}
- if (!more)
+ if (!more) {
disturb(player_ptr, false, false);
+ }
}
/*!
DIRECTION dir;
OBJECT_IDX o_idx;
bool more = false;
- if (player_ptr->wild_mode)
+ if (player_ptr->wild_mode) {
return;
+ }
PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
int num_chests = count_chests(player_ptr, &y, &x, true);
if (num_traps || num_chests) {
bool too_many = (num_traps && num_chests) || (num_traps > 1) || (num_chests > 1);
- if (!too_many)
+ if (!too_many) {
command_dir = coords_to_dir(player_ptr, y, x);
+ }
}
}
}
}
- if (!more)
+ if (!more) {
disturb(player_ptr, false, false);
+ }
}
/*!
DIRECTION dir;
grid_type *g_ptr;
bool more = false;
- if (player_ptr->wild_mode)
+ if (player_ptr->wild_mode) {
return;
+ }
PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
x = player_ptr->x + ddx[dir];
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
feat = g_ptr->get_feat_mimic();
- if (f_info[feat].flags.has_not(FloorFeatureType::BASH)) {
+ if (terrains_info[feat].flags.has_not(TerrainCharacteristics::BASH)) {
msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
} else if (g_ptr->m_idx) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
}
}
- if (!more)
+ if (!more) {
disturb(player_ptr, false, false);
+ }
}
/*!
static bool get_spike(PlayerType *player_ptr, INVENTORY_IDX *ip)
{
for (INVENTORY_IDX i = 0; i < INVEN_PACK; i++) {
- ObjectType *o_ptr = &player_ptr->inventory_list[i];
- if (!o_ptr->k_idx)
+ auto *o_ptr = &player_ptr->inventory_list[i];
+ if (!o_ptr->bi_id) {
continue;
+ }
if (o_ptr->tval == ItemKindType::SPIKE) {
*ip = i;
void do_cmd_spike(PlayerType *player_ptr)
{
DIRECTION dir;
- if (player_ptr->wild_mode)
+ if (player_ptr->wild_mode) {
return;
+ }
PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
- if (!get_rep_dir(player_ptr, &dir, false))
+ if (!get_rep_dir(player_ptr, &dir, false)) {
return;
+ }
POSITION y = player_ptr->y + ddy[dir];
POSITION x = player_ptr->x + ddx[dir];
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
FEAT_IDX feat = g_ptr->get_feat_mimic();
INVENTORY_IDX item;
- if (f_info[feat].flags.has_not(FloorFeatureType::SPIKE)) {
+ if (terrains_info[feat].flags.has_not(TerrainCharacteristics::SPIKE)) {
msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
} else if (!get_spike(player_ptr, &item)) {
msg_print(_("くさびを持っていない!", "You have no spikes!"));
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
- msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_info[feat].name.c_str());
- cave_alter_feat(player_ptr, y, x, FloorFeatureType::SPIKE);
+ msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), terrains_info[feat].name.data());
+ cave_alter_feat(player_ptr, y, x, TerrainCharacteristics::SPIKE);
vary_item(player_ptr, item, -1);
}
}