OSDN Git Service

[Refactpr] #40466 Separated temporary-resistance.c/h player-effects.c/h
authorHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 11:42:02 +0000 (20:42 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 11:42:06 +0000 (20:42 +0900)
12 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-item/cmd-activate.c
src/core/magic-effects-timeout-reducer.c
src/mind/mind.c
src/player/player-effects.c
src/player/player-effects.h
src/realm/realm-demon.c
src/realm/realm-life.c
src/status/temporary-resistance.c [new file with mode: 0644]
src/status/temporary-resistance.h [new file with mode: 0644]

index c8143ce..f2f798b 100644 (file)
     <ClCompile Include="..\..\src\spell\spell-info.c" />\r
     <ClCompile Include="..\..\src\status\element-resistance.c" />\r
     <ClCompile Include="..\..\src\status\sight-setter.c" />\r
+    <ClCompile Include="..\..\src\status\temporary-resistance.c" />\r
     <ClCompile Include="..\..\src\view\display-map.c" />\r
     <ClCompile Include="..\..\src\view\display-sub-windows.c" />\r
     <ClCompile Include="..\..\src\view\main-window-left-frame.c" />\r
     <ClInclude Include="..\..\src\spell\spell-info.h" />\r
     <ClInclude Include="..\..\src\status\element-resistance.h" />\r
     <ClInclude Include="..\..\src\status\sight-setter.h" />\r
+    <ClInclude Include="..\..\src\status\temporary-resistance.h" />\r
     <ClInclude Include="..\..\src\system\alloc-entries.h" />\r
     <ClInclude Include="..\..\src\term\screen-processor.h" />\r
     <ClInclude Include="..\..\src\util\bit-flags-calculator.h" />\r
index 6f1630d..ce7de47 100644 (file)
     <ClCompile Include="..\..\src\status\element-resistance.c">
       <Filter>status</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\status\temporary-resistance.c">
+      <Filter>status</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\status\element-resistance.h">
       <Filter>status</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\status\temporary-resistance.h">
+      <Filter>status</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 2968d00..ed41de0 100644 (file)
@@ -558,6 +558,7 @@ hengband_SOURCES = \
        status/buff-setter.c status/buff-setter.h \
        status/element-resistance.c status/element-resistance.h \
        status/sight-setter.c status/sight-setter.h \
+       status/temporary-resistance.c status/temporary-resistance.h \
        \
        store/store.c store/store.h \
        store/black-market.c store/black-market.h \
index 2fecd38..3c1ac5a 100644 (file)
@@ -80,6 +80,7 @@
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
 #include "status/sight-setter.h"
+#include "status/temporary-resistance.h"
 #include "sv-definition/sv-lite-types.h"
 #include "sv-definition/sv-ring-types.h"
 #include "term/screen-processor.h"
index 4893ed9..76638ec 100644 (file)
@@ -9,6 +9,7 @@
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
 #include "status/sight-setter.h"
+#include "status/temporary-resistance.h"
 
 /*!
  * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
index a1fdc62..d156aa9 100644 (file)
@@ -66,6 +66,7 @@
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
 #include "status/sight-setter.h"
+#include "status/temporary-resistance.h"
 #include "term/screen-processor.h"
 #include "util/buffer-shaper.h"
 #include "util/int-char-converter.h"
index 18ff337..8704af7 100644 (file)
@@ -69,6 +69,7 @@
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
 #include "status/sight-setter.h"
+#include "status/temporary-resistance.h"
 #include "sv-definition/sv-armor-types.h"
 #include "sv-definition/sv-protector-types.h"
 #include "sv-definition/sv-weapon-types.h"
@@ -528,48 +529,6 @@ bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 一時的浮遊の継続時間をセットする / Set "tim_levitation", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tim_levitation(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_levitation && !do_dec) {
-            if (creature_ptr->tim_levitation > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_levitation) {
-            msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_levitation) {
-            msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_levitation = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    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 "tim_sh_touki", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
@@ -1581,113 +1540,3 @@ bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_pr
     return TRUE;
 }
 
-bool set_ultimate_res(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->ult_res && !do_dec) {
-            if (creature_ptr->ult_res > v)
-                return FALSE;
-        } else if (!creature_ptr->ult_res) {
-            msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
-            notice = TRUE;
-        }
-    }
-
-    else {
-        if (creature_ptr->ult_res) {
-            msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->ult_res = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-
-    return TRUE;
-}
-
-bool set_tim_res_nether(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_res_nether && !do_dec) {
-            if (creature_ptr->tim_res_nether > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_res_nether) {
-            msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
-            notice = TRUE;
-        }
-    }
-
-    else {
-        if (creature_ptr->tim_res_nether) {
-            msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_res_nether = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-bool set_tim_res_time(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_res_time && !do_dec) {
-            if (creature_ptr->tim_res_time > v)
-                return FALSE;
-        } else if (!creature_ptr->tim_res_time) {
-            msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->tim_res_time) {
-            msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->tim_res_time = v;
-    creature_ptr->redraw |= (PR_STATUS);
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
index a163689..b19a62d 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_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);
 bool set_tim_sh_holy(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
@@ -33,9 +32,6 @@ void calc_android_exp(player_type *creature_ptr);
 void lose_exp(player_type *creature_ptr, s32b amount);
 bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_prob);
 void do_poly_self(player_type *creature_ptr);
-bool set_ultimate_res(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_wraith_form(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 void do_poly_wounds(player_type *creature_ptr);
 void change_race(player_type *creature_ptr, player_race_type new_race, concptr effect_msg);
index 9322444..0c16da3 100644 (file)
@@ -22,6 +22,7 @@
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
 #include "status/sight-setter.h"
+#include "status/temporary-resistance.h"
 #include "view/display-messages.h"
 
 /*!
index f8f1ddc..6646f71 100644 (file)
@@ -21,6 +21,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/temporary-resistance.h"
 
 /*!
 * @brief 生命領域魔法の各処理を行う
diff --git a/src/status/temporary-resistance.c b/src/status/temporary-resistance.c
new file mode 100644 (file)
index 0000000..647edd6
--- /dev/null
@@ -0,0 +1,158 @@
+#include "status/temporary-resistance.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "player/player-move.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 一時的浮遊の継続時間をセットする / Set "tim_levitation", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tim_levitation(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_levitation && !do_dec) {
+            if (creature_ptr->tim_levitation > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_levitation) {
+            msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_levitation) {
+            msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_levitation = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+bool set_ultimate_res(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->ult_res && !do_dec) {
+            if (creature_ptr->ult_res > v)
+                return FALSE;
+        } else if (!creature_ptr->ult_res) {
+            msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
+            notice = TRUE;
+        }
+    }
+
+    else {
+        if (creature_ptr->ult_res) {
+            msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->ult_res = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+
+    return TRUE;
+}
+
+bool set_tim_res_nether(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_res_nether && !do_dec) {
+            if (creature_ptr->tim_res_nether > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_res_nether) {
+            msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
+            notice = TRUE;
+        }
+    }
+
+    else {
+        if (creature_ptr->tim_res_nether) {
+            msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_res_nether = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+bool set_tim_res_time(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_res_time && !do_dec) {
+            if (creature_ptr->tim_res_time > v)
+                return FALSE;
+        } else if (!creature_ptr->tim_res_time) {
+            msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->tim_res_time) {
+            msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->tim_res_time = v;
+    creature_ptr->redraw |= (PR_STATUS);
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
diff --git a/src/status/temporary-resistance.h b/src/status/temporary-resistance.h
new file mode 100644 (file)
index 0000000..6718264
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool set_tim_levitation(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_ultimate_res(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);