OSDN Git Service

[Refactor] #40466 Separated form-changer.c/h from player-effect.c/h
authorHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 12:28:24 +0000 (21:28 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 30 Jun 2020 12:28:24 +0000 (21:28 +0900)
18 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-item/cmd-activate.c
src/cmd-item/cmd-quaff.c
src/cmd-item/cmd-read.c
src/cmd-item/cmd-usestaff.c
src/cmd-item/cmd-zaprod.c
src/core/magic-effects-timeout-reducer.c
src/mutation/mutation-processor.c
src/player/player-effects.c
src/player/player-effects.h
src/realm/realm-death.c
src/realm/realm-demon.c
src/spell/spells-status.c
src/status/bad-status-setter.c
src/status/form-changer.c [new file with mode: 0644]
src/status/form-changer.h [new file with mode: 0644]

index f2f798b..b5daa56 100644 (file)
     <ClCompile Include="..\..\src\spell-realm\spells-chaos.c" />\r
     <ClCompile Include="..\..\src\spell\spell-info.c" />\r
     <ClCompile Include="..\..\src\status\element-resistance.c" />\r
+    <ClCompile Include="..\..\src\status\form-changer.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
     <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\form-changer.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
index ce7de47..7e489cb 100644 (file)
     <ClCompile Include="..\..\src\status\temporary-resistance.c">
       <Filter>status</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\status\form-changer.c">
+      <Filter>status</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\status\temporary-resistance.h">
       <Filter>status</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\status\form-changer.h">
+      <Filter>status</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index ed41de0..23a44f2 100644 (file)
@@ -557,6 +557,7 @@ hengband_SOURCES = \
        status/bad-status-setter.c status/bad-status-setter.h \
        status/buff-setter.c status/buff-setter.h \
        status/element-resistance.c status/element-resistance.h \
+       status/form-changer.c status/form-changer.h \
        status/sight-setter.c status/sight-setter.h \
        status/temporary-resistance.c status/temporary-resistance.h \
        \
index 3c1ac5a..41280c1 100644 (file)
@@ -79,6 +79,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "status/temporary-resistance.h"
 #include "sv-definition/sv-lite-types.h"
index 494e9db..5ef758c 100644 (file)
@@ -43,6 +43,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "sv-definition/sv-potion-types.h"
 #include "term/screen-processor.h"
index c7c1330..cab3730 100644 (file)
@@ -51,6 +51,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h"
 #include "store/rumor.h"
 #include "sv-definition/sv-scroll-types.h"
 #include "term/screen-processor.h"
index 8082b83..7bfc2ee 100644 (file)
@@ -37,6 +37,7 @@
 #include "spell/spells-staff-only.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
+#include "status/form-changer.h"
 #include "sv-definition/sv-staff-types.h"
 #include "term/screen-processor.h"
 #include "view/display-messages.h"
index 6e2af16..f9fccda 100644 (file)
@@ -33,6 +33,7 @@
 #include "spell/spell-types.h"
 #include "sv-definition/sv-other-types.h"
 #include "sv-definition/sv-rod-types.h"
+#include "status/form-changer.h"
 #include "term/screen-processor.h"
 #include "view/display-messages.h"
 
index 6df5d3c..80c596d 100644 (file)
@@ -9,6 +9,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "status/temporary-resistance.h"
 
index 6711292..170d128 100644 (file)
@@ -26,6 +26,7 @@
 #include "spell/spells3.h"
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "store/store-owners.h"
 #include "store/store-util.h"
index 14850b4..91f7c0b 100644 (file)
@@ -68,6 +68,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h" // todo 相互依存.
 #include "status/sight-setter.h"
 #include "status/temporary-resistance.h"
 #include "sv-definition/sv-armor-types.h"
@@ -235,102 +236,6 @@ void dispel_player(player_type *creature_ptr)
 }
 
 /*!
- * @brief 変身効果の継続時間と変身先をセットする / Set "tim_mimic", and "mimic_form", notice observable changes
- * @param v 継続時間
- * @param p 変身内容
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, 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_mimic && (creature_ptr->mimic_form == p) && !do_dec) {
-            if (creature_ptr->tim_mimic > v)
-                return FALSE;
-        } else if ((!creature_ptr->tim_mimic) || (creature_ptr->mimic_form != p)) {
-            msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
-            creature_ptr->mimic_form = p;
-            notice = TRUE;
-        }
-    }
-
-    else {
-        if (creature_ptr->tim_mimic) {
-            msg_print(_("変身が解けた。", "You are no longer transformed."));
-            if (creature_ptr->mimic_form == MIMIC_DEMON)
-                set_oppose_fire(creature_ptr, 0, TRUE);
-            creature_ptr->mimic_form = 0;
-            notice = TRUE;
-            p = 0;
-        }
-    }
-
-    creature_ptr->tim_mimic = v;
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, TRUE);
-
-    creature_ptr->redraw |= (PR_BASIC | PR_STATUS);
-    creature_ptr->update |= (PU_BONUS | PU_HP);
-
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
- * @brief 狂戦士化の継続時間をセットする / Set "shero", notice observable changes
- * @param v 継続時間/ 0ならば無条件にリセット
- * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_shero(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->pclass == CLASS_BERSERKER)
-        v = 1;
-    if (v) {
-        if (creature_ptr->shero && !do_dec) {
-            if (creature_ptr->shero > v)
-                return FALSE;
-        } else if (!creature_ptr->shero) {
-            msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->shero) {
-            msg_print(_("野蛮な気持ちが消え失せた。", "You feel less berserk."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->shero = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    creature_ptr->update |= (PU_HP);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief 対邪悪結界の継続時間をセットする / Set "protevil", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
@@ -372,62 +277,6 @@ bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 幽体化の継続時間をセットする / Set "wraith_form", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_wraith_form(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->wraith_form && !do_dec) {
-            if (creature_ptr->wraith_form > v)
-                return FALSE;
-        } else if (!creature_ptr->wraith_form) {
-            msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
-            notice = TRUE;
-            chg_virtue(creature_ptr, V_UNLIFE, 3);
-            chg_virtue(creature_ptr, V_HONOUR, -2);
-            chg_virtue(creature_ptr, V_SACRIFICE, -2);
-            chg_virtue(creature_ptr, V_VALOUR, -5);
-
-            creature_ptr->redraw |= (PR_MAP);
-            creature_ptr->update |= (PU_MONSTERS);
-
-            creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-        }
-    } else {
-        if (creature_ptr->wraith_form) {
-            msg_print(_("不透明になった感じがする。", "You feel opaque."));
-            notice = TRUE;
-
-            creature_ptr->redraw |= (PR_MAP);
-            creature_ptr->update |= (PU_MONSTERS);
-
-            creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-        }
-    }
-
-    creature_ptr->wraith_form = 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 "invuln", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
@@ -781,55 +630,6 @@ bool set_kabenuke(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief オクレ兄さんの継続時間をセットする / Set "tsuyoshi", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_tsuyoshi(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->tsuyoshi && !do_dec) {
-            if (creature_ptr->tsuyoshi > v)
-                return FALSE;
-        } else if (!creature_ptr->tsuyoshi) {
-            msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
-            notice = TRUE;
-            chg_virtue(creature_ptr, V_VITALITY, 2);
-        }
-    } else {
-        if (creature_ptr->tsuyoshi) {
-            msg_print(_("肉体が急速にしぼんでいった。", "Your body has quickly shriveled."));
-
-            (void)dec_stat(creature_ptr, A_CON, 20, TRUE);
-            (void)dec_stat(creature_ptr, A_STR, 20, TRUE);
-
-            notice = TRUE;
-            chg_virtue(creature_ptr, V_VITALITY, -3);
-        }
-    }
-
-    creature_ptr->tsuyoshi = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->update |= (PU_BONUS);
-    creature_ptr->update |= (PU_HP);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
  * @param stat 上昇させるステータスID
  * @return 実際に上昇した場合TRUEを返す。
index bccf6cd..521d0fa 100644 (file)
@@ -4,8 +4,6 @@
 
 void set_action(player_type *creature_ptr, ACTION_IDX typ);
 void dispel_player(player_type *creature_ptr);
-bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, bool do_dec);
-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);
@@ -15,7 +13,6 @@ bool set_tim_eyeeye(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_resist_magic(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tim_reflect(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_kabenuke(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool inc_stat(player_type *creature_ptr, int stat);
 bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
 bool res_stat(player_type *creature_ptr, int stat);
@@ -31,6 +28,5 @@ 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_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 2a73aa7..26816b9 100644 (file)
@@ -23,6 +23,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "status/buff-setter.h"
+#include "status/form-changer.h"
 #include "status/element-resistance.h"
 
 /*!
index 0c16da3..6c92635 100644 (file)
@@ -21,6 +21,7 @@
 #include "status/bad-status-setter.h"
 #include "status/buff-setter.h"
 #include "status/element-resistance.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "status/temporary-resistance.h"
 #include "view/display-messages.h"
index 39cb158..a3c482d 100644 (file)
@@ -29,6 +29,7 @@
 #include "spell-kind/spells-launcher.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spell-types.h"
+#include "status/form-changer.h"
 #include "status/sight-setter.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
index 06d38b4..53fe243 100644 (file)
@@ -3,12 +3,13 @@
 #include "game-option/disturbance-options.h"
 #include "mind/mind-sniper.h"
 #include "player/avatar.h"
-#include "player/player-effects.h" // つよし状態、後で依存を消す.
+#include "player/player-effects.h" // todo do_dec_stat()、後で依存を消す.
 #include "player/player-move.h"
 #include "player/player-race.h"
 #include "player/special-defense-types.h"
 #include "realm/realm-types.h"
 #include "spell-realm/spells-hex.h"
+#include "status/form-changer.h"
 #include "view/display-messages.h"
 
 /*!
diff --git a/src/status/form-changer.c b/src/status/form-changer.c
new file mode 100644 (file)
index 0000000..983ab45
--- /dev/null
@@ -0,0 +1,210 @@
+#include "status/form-changer.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "player/avatar.h"
+#include "player/player-move.h"
+#include "player/player-effects.h" // todo 相互依存.
+#include "player/player-race.h"
+#include "status/element-resistance.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 変身効果の継続時間と変身先をセットする / Set "tim_mimic", and "mimic_form", notice observable changes
+ * @param v 継続時間
+ * @param p 変身内容
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, 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_mimic && (creature_ptr->mimic_form == p) && !do_dec) {
+            if (creature_ptr->tim_mimic > v)
+                return FALSE;
+        } else if ((!creature_ptr->tim_mimic) || (creature_ptr->mimic_form != p)) {
+            msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
+            creature_ptr->mimic_form = p;
+            notice = TRUE;
+        }
+    }
+
+    else {
+        if (creature_ptr->tim_mimic) {
+            msg_print(_("変身が解けた。", "You are no longer transformed."));
+            if (creature_ptr->mimic_form == MIMIC_DEMON)
+                set_oppose_fire(creature_ptr, 0, TRUE);
+            creature_ptr->mimic_form = 0;
+            notice = TRUE;
+            p = 0;
+        }
+    }
+
+    creature_ptr->tim_mimic = v;
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, TRUE);
+
+    creature_ptr->redraw |= (PR_BASIC | PR_STATUS);
+    creature_ptr->update |= (PU_BONUS | PU_HP);
+
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 狂戦士化の継続時間をセットする / Set "shero", notice observable changes
+ * @param v 継続時間/ 0ならば無条件にリセット
+ * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_shero(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->pclass == CLASS_BERSERKER)
+        v = 1;
+    if (v) {
+        if (creature_ptr->shero && !do_dec) {
+            if (creature_ptr->shero > v)
+                return FALSE;
+        } else if (!creature_ptr->shero) {
+            msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->shero) {
+            msg_print(_("野蛮な気持ちが消え失せた。", "You feel less berserk."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->shero = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    creature_ptr->update |= (PU_HP);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 幽体化の継続時間をセットする / Set "wraith_form", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_wraith_form(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->wraith_form && !do_dec) {
+            if (creature_ptr->wraith_form > v)
+                return FALSE;
+        } else if (!creature_ptr->wraith_form) {
+            msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
+            notice = TRUE;
+            chg_virtue(creature_ptr, V_UNLIFE, 3);
+            chg_virtue(creature_ptr, V_HONOUR, -2);
+            chg_virtue(creature_ptr, V_SACRIFICE, -2);
+            chg_virtue(creature_ptr, V_VALOUR, -5);
+
+            creature_ptr->redraw |= (PR_MAP);
+            creature_ptr->update |= (PU_MONSTERS);
+
+            creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+        }
+    } else {
+        if (creature_ptr->wraith_form) {
+            msg_print(_("不透明になった感じがする。", "You feel opaque."));
+            notice = TRUE;
+
+            creature_ptr->redraw |= (PR_MAP);
+            creature_ptr->update |= (PU_MONSTERS);
+
+            creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+        }
+    }
+
+    creature_ptr->wraith_form = 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 "tsuyoshi", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_tsuyoshi(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->tsuyoshi && !do_dec) {
+            if (creature_ptr->tsuyoshi > v)
+                return FALSE;
+        } else if (!creature_ptr->tsuyoshi) {
+            msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
+            notice = TRUE;
+            chg_virtue(creature_ptr, V_VITALITY, 2);
+        }
+    } else {
+        if (creature_ptr->tsuyoshi) {
+            msg_print(_("肉体が急速にしぼんでいった。", "Your body has quickly shriveled."));
+
+            (void)dec_stat(creature_ptr, A_CON, 20, TRUE);
+            (void)dec_stat(creature_ptr, A_STR, 20, TRUE);
+
+            notice = TRUE;
+            chg_virtue(creature_ptr, V_VITALITY, -3);
+        }
+    }
+
+    creature_ptr->tsuyoshi = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->update |= (PU_BONUS);
+    creature_ptr->update |= (PU_HP);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
diff --git a/src/status/form-changer.h b/src/status/form-changer.h
new file mode 100644 (file)
index 0000000..0b38911
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, bool do_dec);
+bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_wraith_form(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
+bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);