OSDN Git Service

[Refactor] #2355 Moved mirror_concentration() from mind-mirror-master.cpp/h to spells...
authorHourier <66951241+Hourier@users.noreply.github.com>
Wed, 2 Mar 2022 13:24:03 +0000 (22:24 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Mon, 7 Mar 2022 14:41:03 +0000 (23:41 +0900)
src/mind/mind-mirror-master.cpp
src/mind/mind-mirror-master.h
src/racial/racial-switcher.cpp
src/spell-class/spells-mirror-master.cpp
src/spell-class/spells-mirror-master.h

index 9ea23f5..665d1de 100644 (file)
@@ -53,35 +53,6 @@ bool check_multishadow(PlayerType *player_ptr)
 }
 
 /*!
- * 静水
- * @param player_ptr プレイヤーへの参照ポインタ
- * @return ペットを操っている場合を除きTRUE
- */
-bool mirror_concentration(PlayerType *player_ptr)
-{
-    if (total_friends) {
-        msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
-        return false;
-    }
-
-    if (!player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].is_mirror()) {
-        msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
-        return true;
-    }
-
-    msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
-
-    player_ptr->csp += (5 + player_ptr->lev * player_ptr->lev / 100);
-    if (player_ptr->csp >= player_ptr->msp) {
-        player_ptr->csp = player_ptr->msp;
-        player_ptr->csp_frac = 0;
-    }
-
-    player_ptr->redraw |= PR_MANA;
-    return true;
-}
-
-/*!
  * @brief 鏡魔法「封魔結界」の効果処理
  * @param dam ダメージ量
  * @return 効果があったらTRUEを返す
index ce9c5d6..bc55499 100644 (file)
@@ -4,7 +4,6 @@
 
 class PlayerType;
 bool check_multishadow(PlayerType *player_ptr);
-bool mirror_concentration(PlayerType *player_ptr);
 bool binding_field(PlayerType *player_ptr, int dam);
 void seal_of_mirror(PlayerType *player_ptr, int dam);
 bool confusing_light(PlayerType *player_ptr);
index 016ad75..fa25d45 100644 (file)
@@ -264,17 +264,19 @@ bool switch_class_racial_execution(PlayerType *player_ptr, const int32_t command
         }
 
         return identify_fully(player_ptr, true);
-    case PlayerClassType::MIRROR_MASTER:
+    case PlayerClassType::MIRROR_MASTER: {
+        SpellsMirrorMaster smm(player_ptr);
         if (command == -3) {
-            SpellsMirrorMaster(player_ptr).remove_all_mirrors(true);
+            smm.remove_all_mirrors(true);
             return true;
         }
 
         if (command == -4) {
-            return mirror_concentration(player_ptr);
+            return smm.mirror_concentration();
         }
 
         return true;
+    }
     case PlayerClassType::NINJA:
         return hayagake(player_ptr);
     case PlayerClassType::ELEMENTALIST:
index 242fbd5..9bfb5e0 100644 (file)
@@ -1,4 +1,5 @@
 #include "spell-class/spells-mirror-master.h"
+#include "core/player-redraw-types.h"
 #include "dungeon/dungeon-flag-types.h"
 #include "dungeon/dungeon.h"
 #include "effect/attribute-types.h"
@@ -9,6 +10,7 @@
 #include "grid/feature.h"
 #include "grid/grid.h"
 #include "monster/monster-update.h"
+#include "pet/pet-util.h"
 #include "spell-kind/spells-teleport.h"
 #include "system/floor-type-definition.h"
 #include "system/grid-type-definition.h"
@@ -115,3 +117,31 @@ bool SpellsMirrorMaster::place_mirror()
     update_local_illumination(this->player_ptr, y, x);
     return true;
 }
+
+/*!
+ * @brief 静水
+ * @param player_ptr プレイヤーへの参照ポインタ
+ * @return ペットを操っている場合を除きTRUE
+ */
+bool SpellsMirrorMaster::mirror_concentration()
+{
+    if (total_friends) {
+        msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
+        return false;
+    }
+
+    if (!this->player_ptr->current_floor_ptr->grid_array[this->player_ptr->y][this->player_ptr->x].is_mirror()) {
+        msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
+        return true;
+    }
+
+    msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
+    this->player_ptr->csp += (5 + this->player_ptr->lev * this->player_ptr->lev / 100);
+    if (this->player_ptr->csp >= this->player_ptr->msp) {
+        this->player_ptr->csp = this->player_ptr->msp;
+        this->player_ptr->csp_frac = 0;
+    }
+
+    this->player_ptr->redraw |= PR_MANA;
+    return true;
+}
index 926e5fa..01a88bf 100644 (file)
@@ -8,6 +8,7 @@ public:
     void remove_mirror(int y, int x);
     bool mirror_tunnel();
     bool place_mirror();
+    bool mirror_concentration();
 
 private:
     PlayerType *player_ptr;