OSDN Git Service

[Refactor] #40466 Moved set_lightspeed() from player-effects.c/h to mind-force-traine...
authorHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 11:40:24 +0000 (20:40 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 11:40:24 +0000 (20:40 +0900)
src/core/player-processor.c
src/mind/mind-force-trainer.c
src/mind/mind-force-trainer.h
src/player/player-effects.c
src/player/player-effects.h

index bd8c134..c3e0a06 100644 (file)
@@ -184,9 +184,8 @@ void process_player(player_type *creature_ptr)
     }
 
     load = FALSE;
-    if (creature_ptr->lightspeed) {
-        (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
-    }
+    if (creature_ptr->lightspeed)
+        set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
 
     if ((creature_ptr->pclass == CLASS_FORCETRAINER) && get_current_ki(creature_ptr)) {
         if (get_current_ki(creature_ptr) < 40)
index 93fbe7c..118cd95 100644 (file)
@@ -1,5 +1,9 @@
 #include "mind/mind-force-trainer.h"
 #include "cmd-action/cmd-pet.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "player/avatar.h"
+#include "player/player-move.h"
 #include "view/display-messages.h"
 
 /*!
@@ -47,3 +51,48 @@ bool clear_mind(player_type *creature_ptr)
     creature_ptr->redraw |= (PR_MANA);
     return TRUE;
 }
+
+/*!
+ * @brief 光速移動の継続時間をセットする / Set "lightspeed", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return なし
+ */
+void set_lightspeed(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;
+
+    if (creature_ptr->wild_mode)
+        v = 0;
+
+    if (v) {
+        if (creature_ptr->lightspeed && !do_dec) {
+            if (creature_ptr->lightspeed > v)
+                return;
+        } else if (!creature_ptr->lightspeed) {
+            msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely fast!"));
+            notice = TRUE;
+            chg_virtue(creature_ptr, V_PATIENCE, -1);
+            chg_virtue(creature_ptr, V_DILIGENCE, 1);
+        }
+    } else {
+        if (creature_ptr->lightspeed) {
+            msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->lightspeed = v;
+
+    if (!notice)
+        return;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+}
index ece8add..1530296 100644 (file)
@@ -5,3 +5,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);
index 24a0c91..0d01c7a 100644 (file)
@@ -32,6 +32,7 @@
 #include "io/save.h"
 #include "locale/vowel-checker.h"
 #include "mind/stances-table.h"
+#include "mind/mind-force-trainer.h"
 #include "mind/mind-sniper.h"
 #include "monster/monster-status.h"
 #include "mutation/mutation.h"
@@ -167,7 +168,7 @@ void set_action(player_type *creature_ptr, ACTION_IDX typ)
 void dispel_player(player_type *creature_ptr)
 {
     (void)set_fast(creature_ptr, 0, TRUE);
-    (void)set_lightspeed(creature_ptr, 0, TRUE);
+    set_lightspeed(creature_ptr, 0, TRUE);
     (void)set_slow(creature_ptr, 0, TRUE);
     (void)set_shield(creature_ptr, 0, TRUE);
     (void)set_blessed(creature_ptr, 0, TRUE);
@@ -319,52 +320,6 @@ bool set_fast(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 光速移動の継続時間をセットする / Set "lightspeed", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_lightspeed(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 (creature_ptr->wild_mode)
-        v = 0;
-
-    if (v) {
-        if (creature_ptr->lightspeed && !do_dec) {
-            if (creature_ptr->lightspeed > v)
-                return FALSE;
-        } else if (!creature_ptr->lightspeed) {
-            msg_print(_("非常に素早く動けるようになった!", "You feel yourself moving extremely fast!"));
-            notice = TRUE;
-            chg_virtue(creature_ptr, V_PATIENCE, -1);
-            chg_virtue(creature_ptr, V_DILIGENCE, 1);
-        }
-    } else {
-        if (creature_ptr->lightspeed) {
-            msg_print(_("動きの素早さがなくなったようだ。", "You feel yourself slow down."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->lightspeed = v;
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief 肌石化の継続時間をセットする / Set "shield", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
index d49dc8d..12f0196 100644 (file)
@@ -17,7 +17,6 @@ bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_infra(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_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_levitation(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);