1 #include "cmd-action/cmd-tunnel.h"
2 #include "action/tunnel-execution.h"
3 #include "cmd-action/cmd-attack.h"
4 #include "core/disturbance.h"
5 #include "core/player-redraw-types.h"
6 #include "floor/geometry.h"
8 #include "io/input-key-requester.h"
9 #include "player-base/player-class.h"
10 #include "player-info/samurai-data-type.h"
11 #include "player-status/player-energy.h"
12 #include "player/attack-defense-types.h"
13 #include "player/special-defense-types.h"
14 #include "status/action-setter.h"
15 #include "system/floor-type-definition.h"
16 #include "system/grid-type-definition.h"
17 #include "system/player-type-definition.h"
18 #include "system/redrawing-flags-updater.h"
19 #include "system/terrain-type-definition.h"
20 #include "target/target-getter.h"
21 #include "util/bit-flags-calculator.h"
22 #include "view/display-messages.h"
25 * @brief 「掘る」動作コマンドのメインルーチン /
26 * Tunnels through "walls" (including rubble and closed doors)
29 * Note that you must tunnel in order to hit invisible monsters
30 * in walls, though moving into walls still takes a turn anyway.
32 * Digging is very difficult without a "digger" weapon, but can be
33 * accomplished by strong players using heavy weapons.
36 void do_cmd_tunnel(PlayerType *player_ptr)
39 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
42 command_rep = command_arg - 1;
43 RedrawingFlagsUpdater::get_instance().set_flag(MainWindowRedrawingFlag::ACTION);
48 if (!get_rep_dir(player_ptr, &dir, false)) {
50 disturb(player_ptr, false, false);
56 POSITION y = player_ptr->y + ddy[dir];
57 POSITION x = player_ptr->x + ddx[dir];
59 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
60 FEAT_IDX feat = g_ptr->get_feat_mimic();
61 if (terrains_info[feat].flags.has(TerrainCharacteristics::DOOR)) {
62 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
63 } else if (terrains_info[feat].flags.has_not(TerrainCharacteristics::TUNNEL)) {
64 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
65 } else if (g_ptr->m_idx) {
66 PlayerEnergy(player_ptr).set_player_turn_energy(100);
67 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
68 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
70 more = exe_tunnel(player_ptr, y, x);
74 disturb(player_ptr, false, false);