OSDN Git Service

[Refactor] #2355 Moved place_mirror() from mind-mirror-master.cpp/h to spells-mirror...
authorHourier <66951241+Hourier@users.noreply.github.com>
Wed, 2 Mar 2022 13:20:32 +0000 (22:20 +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/spell-class/spells-mirror-master.cpp
src/spell-class/spells-mirror-master.h

index b04378a..9ea23f5 100644 (file)
@@ -237,31 +237,6 @@ bool confusing_light(PlayerType *player_ptr)
     return true;
 }
 
-/*!
- * @brief 鏡設置処理
- * @return 実際に設置が行われた場合TRUEを返す
- */
-bool place_mirror(PlayerType *player_ptr)
-{
-    if (!cave_clean_bold(player_ptr->current_floor_ptr, player_ptr->y, player_ptr->x)) {
-        msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
-        return false;
-    }
-
-    /* Create a mirror */
-    player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].info |= CAVE_OBJECT;
-    player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].mimic = feat_mirror;
-
-    /* Turn on the light */
-    player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].info |= CAVE_GLOW;
-
-    note_spot(player_ptr, player_ptr->y, player_ptr->x);
-    lite_spot(player_ptr, player_ptr->y, player_ptr->x);
-    update_local_illumination(player_ptr, player_ptr->y, player_ptr->x);
-
-    return true;
-}
-
 /*
  * Set "multishadow", notice observable changes
  */
@@ -406,7 +381,7 @@ bool cast_mirror_spell(PlayerType *player_ptr, mind_mirror_master_type spell)
         break;
     case MAKE_MIRROR:
         if (number_of_mirrors(player_ptr->current_floor_ptr) < 4 + plev / 10) {
-            place_mirror(player_ptr);
+            SpellsMirrorMaster(player_ptr).place_mirror();
         } else {
             msg_format(_("これ以上鏡は制御できない!", "There are too many mirrors to control!"));
         }
index 189528d..ce9c5d6 100644 (file)
@@ -8,7 +8,6 @@ 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);
-bool place_mirror(PlayerType *player_ptr);
 bool set_multishadow(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec);
 bool set_dustrobe(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec);
 
index 1adf1a9..242fbd5 100644 (file)
@@ -4,7 +4,9 @@
 #include "effect/attribute-types.h"
 #include "effect/effect-characteristics.h"
 #include "effect/effect-processor.h"
+#include "floor/cave.h"
 #include "game-option/map-screen-options.h"
+#include "grid/feature.h"
 #include "grid/grid.h"
 #include "monster/monster-update.h"
 #include "spell-kind/spells-teleport.h"
@@ -87,3 +89,29 @@ bool SpellsMirrorMaster::mirror_tunnel()
     msg_print(_("鏡の世界をうまく通れなかった!", "You could not enter the mirror!"));
     return true;
 }
+
+/*!
+ * @brief 鏡設置処理
+ * @return 実際に設置が行われた場合TRUEを返す
+ */
+bool SpellsMirrorMaster::place_mirror()
+{
+    auto y = this->player_ptr->y;
+    auto x = this->player_ptr->x;
+    if (!cave_clean_bold(this->player_ptr->current_floor_ptr, y, x)) {
+        msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
+        return false;
+    }
+
+    /* Create a mirror */
+    this->player_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_OBJECT;
+    this->player_ptr->current_floor_ptr->grid_array[y][x].mimic = feat_mirror;
+
+    /* Turn on the light */
+    this->player_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_GLOW;
+
+    note_spot(this->player_ptr, y, x);
+    lite_spot(this->player_ptr, y, x);
+    update_local_illumination(this->player_ptr, y, x);
+    return true;
+}
index e94abde..926e5fa 100644 (file)
@@ -7,6 +7,7 @@ public:
     void remove_all_mirrors(bool explode);
     void remove_mirror(int y, int x);
     bool mirror_tunnel();
+    bool place_mirror();
 
 private:
     PlayerType *player_ptr;