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"
7 #include "grid/feature.h"
9 #include "io/input-key-requester.h"
10 #include "player-base/player-class.h"
11 #include "player-info/samurai-data-type.h"
12 #include "player-status/player-energy.h"
13 #include "player/attack-defense-types.h"
14 #include "player/special-defense-types.h"
15 #include "status/action-setter.h"
16 #include "system/floor-type-definition.h"
17 #include "system/grid-type-definition.h"
18 #include "system/player-type-definition.h"
19 #include "target/target-getter.h"
20 #include "util/bit-flags-calculator.h"
21 #include "view/display-messages.h"
24 * @brief 「掘る」動作コマンドのメインルーチン /
25 * Tunnels through "walls" (including rubble and closed doors)
28 * Note that you must tunnel in order to hit invisible monsters
29 * in walls, though moving into walls still takes a turn anyway.
31 * Digging is very difficult without a "digger" weapon, but can be
32 * accomplished by strong players using heavy weapons.
35 void do_cmd_tunnel(PlayerType *player_ptr)
38 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
41 command_rep = command_arg - 1;
42 player_ptr->redraw |= PR_STATE;
47 if (!get_rep_dir(player_ptr, &dir, false)) {
49 disturb(player_ptr, false, false);
54 POSITION y = player_ptr->y + ddy[dir];
55 POSITION x = player_ptr->x + ddx[dir];
57 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
58 FEAT_IDX feat = g_ptr->get_feat_mimic();
59 if (f_info[feat].flags.has(FloorFeatureType::DOOR))
60 msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
61 else if (f_info[feat].flags.has_not(FloorFeatureType::TUNNEL))
62 msg_print(_("そこは掘れない。", "You can't tunnel through that."));
63 else if (g_ptr->m_idx) {
64 PlayerEnergy(player_ptr).set_player_turn_energy(100);
65 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
66 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
68 more = exe_tunnel(player_ptr, y, x);
71 disturb(player_ptr, false, false);