OSDN Git Service

[Refactpr] #40466 Moved set_tim_sh_force() from player-effects.c/h to mind-force...
authorHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 11:48:27 +0000 (20:48 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 11:48:27 +0000 (20:48 +0900)
src/core/magic-effects-timeout-reducer.c
src/mind/mind-force-trainer.c
src/mind/mind-force-trainer.h
src/mind/mind.c
src/player/player-effects.c
src/player/player-effects.h

index 76638ec..6df5d3c 100644 (file)
@@ -1,5 +1,6 @@
 #include "core/magic-effects-timeout-reducer.h"
 #include "game-option/birth-options.h"
+#include "mind/mind-force-trainer.h"
 #include "mind/mind-mirror-master.h"
 #include "mind/racial-kutar.h"
 #include "player/player-effects.h"
@@ -68,7 +69,7 @@ void reduce_magic_effects_timeout(player_type *creature_ptr)
     }
 
     if (creature_ptr->tim_sh_touki) {
-        (void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
+        (void)set_tim_sh_force(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
     }
 
     if (creature_ptr->tim_sh_fire) {
index 118cd95..f798805 100644 (file)
@@ -96,3 +96,44 @@ void set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
     creature_ptr->update |= (PU_BONUS);
     handle_stuff(creature_ptr);
 }
+
+/*!
+ * @brief 一時的闘気のオーラの継続時間をセットする / Set "tim_sh_touki", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tim_sh_force(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (creature_ptr->tim_sh_touki && !do_dec) {
+            if (creature_ptr->tim_sh_touki > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_sh_touki) {
+            msg_print(_("体が闘気のオーラで覆われた。", "You are enveloped by an aura of the Force!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_sh_touki) {
+            msg_print(_("闘気が消えた。", "The aura of the Force disappeared."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_sh_touki = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
index 1530296..800c7d3 100644 (file)
@@ -6,3 +6,4 @@ MAGIC_NUM1 get_current_ki(player_type *caster_ptr);
 void set_current_ki(player_type *caster_ptr, bool is_reset, MAGIC_NUM1 ki);
 bool clear_mind(player_type *creature_ptr);
 void set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tim_sh_force(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
index d156aa9..b45e706 100644 (file)
@@ -1260,7 +1260,7 @@ static bool cast_force_spell(player_type *caster_ptr, int spell)
                else return TRUE;
                break;
        case 6:
-               set_tim_sh_touki(caster_ptr, randint1(plev / 2) + 15 + boost / 7, FALSE);
+               set_tim_sh_force(caster_ptr, randint1(plev / 2) + 15 + boost / 7, FALSE);
                break;
        case 7:
                return shock_power(caster_ptr);
index 8704af7..14850b4 100644 (file)
@@ -199,7 +199,7 @@ void dispel_player(player_type *creature_ptr)
     (void)set_tim_regen(creature_ptr, 0, TRUE);
     (void)set_tim_stealth(creature_ptr, 0, TRUE);
     (void)set_tim_levitation(creature_ptr, 0, TRUE);
-    (void)set_tim_sh_touki(creature_ptr, 0, TRUE);
+    (void)set_tim_sh_force(creature_ptr, 0, TRUE);
     (void)set_tim_sh_fire(creature_ptr, 0, TRUE);
     (void)set_tim_sh_holy(creature_ptr, 0, TRUE);
     (void)set_tim_eyeeye(creature_ptr, 0, TRUE);
@@ -529,47 +529,6 @@ bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 一時的闘気のオーラの継続時間をセットする / Set "tim_sh_touki", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tim_sh_touki(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (creature_ptr->tim_sh_touki && !do_dec) {
-            if (creature_ptr->tim_sh_touki > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_sh_touki) {
-            msg_print(_("体が闘気のオーラで覆われた。", "You are enveloped by an aura of the Force!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_sh_touki) {
-            msg_print(_("闘気が消えた。", "The aura of the Force disappeared."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_sh_touki = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief 一時的火炎のオーラの継続時間をセットする / Set "tim_sh_fire", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
index b19a62d..bccf6cd 100644 (file)
@@ -9,7 +9,6 @@ bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_sh_touki(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_sh_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_sh_holy(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_eyeeye(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);