OSDN Git Service

[Refactor] #2886 再描画フラグの分かりにくい単語や名詞でない単語を分かりやすい名詞にした
[hengbandforosx/hengbandosx.git] / src / cmd-action / cmd-tunnel.cpp
index 1ad42c2..b3ec8c8 100644 (file)
@@ -4,15 +4,18 @@
 #include "core/disturbance.h"
 #include "core/player-redraw-types.h"
 #include "floor/geometry.h"
-#include "grid/feature.h"
 #include "grid/grid.h"
 #include "io/input-key-requester.h"
+#include "player-base/player-class.h"
+#include "player-info/samurai-data-type.h"
 #include "player-status/player-energy.h"
 #include "player/attack-defense-types.h"
 #include "player/special-defense-types.h"
 #include "status/action-setter.h"
 #include "system/floor-type-definition.h"
+#include "system/grid-type-definition.h"
 #include "system/player-type-definition.h"
+#include "system/terrain-type-definition.h"
 #include "target/target-getter.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
  * accomplished by strong players using heavy weapons.
  * </pre>
  */
-void do_cmd_tunnel(player_type *creature_ptr)
+void do_cmd_tunnel(PlayerType *player_ptr)
 {
-    bool more = FALSE;
-    if (creature_ptr->special_defense & KATA_MUSOU)
-        set_action(creature_ptr, ACTION_NONE);
+    bool more = false;
+    PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
 
     if (command_arg) {
         command_rep = command_arg - 1;
-        creature_ptr->redraw |= PR_STATE;
+        player_ptr->redraw |= PR_ACTION;
         command_arg = 0;
     }
 
     DIRECTION dir;
-    if (!get_rep_dir(creature_ptr, &dir, FALSE)) {
-        if (!more)
-            disturb(creature_ptr, FALSE, FALSE);
+    if (!get_rep_dir(player_ptr, &dir, false)) {
+        if (!more) {
+            disturb(player_ptr, false, false);
+        }
 
         return;
     }
 
-    POSITION y = creature_ptr->y + ddy[dir];
-    POSITION x = creature_ptr->x + ddx[dir];
+    POSITION y = player_ptr->y + ddy[dir];
+    POSITION x = player_ptr->x + ddx[dir];
     grid_type *g_ptr;
-    g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
-    FEAT_IDX feat = get_feat_mimic(g_ptr);
-    if (has_flag(f_info[feat].flags, FF_DOOR))
+    g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
+    FEAT_IDX feat = g_ptr->get_feat_mimic();
+    if (terrains_info[feat].flags.has(TerrainCharacteristics::DOOR)) {
         msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
-    else if (!has_flag(f_info[feat].flags, FF_TUNNEL))
+    } else if (terrains_info[feat].flags.has_not(TerrainCharacteristics::TUNNEL)) {
         msg_print(_("そこは掘れない。", "You can't tunnel through that."));
-    else if (g_ptr->m_idx) {
-        PlayerEnergy(creature_ptr).set_player_turn_energy(100);
+    else if (g_ptr->m_idx) {
+        PlayerEnergy(player_ptr).set_player_turn_energy(100);
         msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
-        do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
-    } else
-        more = exe_tunnel(creature_ptr, y, x);
+        do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
+    } else {
+        more = exe_tunnel(player_ptr, y, x);
+    }
 
-    if (!more)
-        disturb(creature_ptr, FALSE, FALSE);
+    if (!more) {
+        disturb(player_ptr, false, false);
+    }
 }