OSDN Git Service

[Refactor] #40466 Separated bad-status-setter.c/h from player-effects.c/h
authorHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 08:02:30 +0000 (17:02 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 08:02:30 +0000 (17:02 +0900)
48 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-action/cmd-spell.c
src/cmd-building/cmd-inn.c
src/cmd-item/cmd-activate.c
src/cmd-item/cmd-eat.c
src/cmd-item/cmd-quaff.c
src/cmd-item/cmd-read.c
src/cmd-item/cmd-usestaff.c
src/cmd/cmd-basic.c
src/core/hp-mp-processor.c
src/core/magic-effects-timeout-reducer.c
src/effect/effect-monster-charm.c
src/effect/effect-monster-psi.c
src/effect/effect-player-oldies.c
src/effect/effect-player-resist-hurt.c
src/effect/effect-player-spirit.c
src/floor/pattern-walk.c
src/grid/trap.c
src/inventory/inventory-curse.c
src/mind/mind.c
src/mind/racial.c
src/monster-attack/monster-attack-status.c
src/monster-attack/monster-attack-switcher.c
src/mspell/mspell-status.c
src/mspell/mspells3.c
src/mutation/mutation-processor.c
src/player/bad-status-setter.c [new file with mode: 0644]
src/player/bad-status-setter.h [new file with mode: 0644]
src/player/digestion-processor.c
src/player/eldritch-horror.c
src/player/player-effects.c
src/player/player-effects.h
src/realm/realm-arcane.c
src/realm/realm-crusade.c
src/realm/realm-daemon.c
src/realm/realm-life.c
src/realm/realm-nature.c
src/realm/realm-song.c
src/specific-object/chest.c
src/spell-kind/spells-floor.c
src/spell-kind/spells-random.c
src/spell/spells-object.c
src/spell/spells-staff-only.c
src/spell/spells-status.c
src/spell/spells-summon.c
src/spell/spells3.c

index d6e0fb2..5670d86 100644 (file)
     <ClCompile Include="..\..\src\io\input-key-requester.c" />\r
     <ClCompile Include="..\..\src\locale\vowel-checker.c" />\r
     <ClCompile Include="..\..\src\mind\stances-table.c" />\r
+    <ClCompile Include="..\..\src\player\bad-status-setter.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\mspell\mspells1.h" />\r
     <ClInclude Include="..\..\src\mspell\mspells2.h" />\r
     <ClInclude Include="..\..\src\mspell\mspells3.h" />\r
+    <ClInclude Include="..\..\src\player\bad-status-setter.h" />\r
     <ClInclude Include="..\..\src\player\special-defense-types.h" />\r
     <ClInclude Include="..\..\src\system\alloc-entries.h" />\r
     <ClInclude Include="..\..\src\term\screen-processor.h" />\r
index 72940b8..0b51446 100644 (file)
     <ClCompile Include="..\..\src\mind\stances-table.c">
       <Filter>mind</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\player\bad-status-setter.c">
+      <Filter>player</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\player\special-defense-types.h">
       <Filter>player</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\player\bad-status-setter.h">
+      <Filter>player</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 9c6533e..12a5259 100644 (file)
@@ -437,6 +437,7 @@ hengband_SOURCES = \
        pet/pet-util.c pet/pet-util.h \
        \
        player/avatar.h player/avatar.c \
+       player/bad-status-setter.c player/bad-status-setter.h \
        player/eldritch-horror.c player/eldritch-horror.h \
        player/mimic-info-table.c player/mimic-info-table.h \
        player/patron.c player/patron.h \
index e7e0101..e7abf78 100644 (file)
@@ -28,6 +28,7 @@
 #include "object/item-use-flags.h"
 #include "object/object-hook.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/eldritch-horror.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
index 7dedce1..789e899 100644 (file)
@@ -4,6 +4,7 @@
 #include "game-option/birth-options.h"
 #include "io/write-diary.h"
 #include "market/building-actions-table.h"
+#include "player/bad-status-setter.h"
 #include "player/eldritch-horror.h"
 #include "player/player-effects.h"
 #include "player/player-race-types.h"
index 2372a62..d4d6a3c 100644 (file)
@@ -44,6 +44,7 @@
 #include "monster-floor/place-monster-types.h"
 #include "monster/smart-learn-types.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "player/player-race-types.h"
index ffe9d7f..7c5b192 100644 (file)
@@ -22,6 +22,7 @@
 #include "object/object-info.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/mimic-info-table.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
index 0b22937..0a2887c 100644 (file)
@@ -24,6 +24,7 @@
 #include "object/object-info.h"
 #include "sv-definition/sv-potion-types.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/eldritch-horror.h"
 #include "player/mimic-info-table.h"
 #include "player/player-class.h"
index 942c501..aafe8c2 100644 (file)
@@ -24,6 +24,7 @@
 #include "object/object-kind.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index 3110ad1..c30f671 100644 (file)
@@ -17,6 +17,7 @@
 #include "object/object-kind.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-effects.h"
 #include "player/player-race-types.h"
index 47bb0e8..df4f8b7 100644 (file)
@@ -67,6 +67,7 @@
 #include "object/object-info.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-move.h"
 #include "player/player-personalities-types.h"
index 427c1a2..9d76434 100644 (file)
@@ -11,8 +11,8 @@
 #include "object-enchant/object-ego.h"
 #include "object-enchant/trc-types.h"
 #include "object/object-flavor.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
-#include "player/player-effects.h"
 #include "player/player-race-types.h"
 #include "player/player-race.h"
 #include "player/special-defense-types.h"
index c37223a..dd3313f 100644 (file)
@@ -1,5 +1,6 @@
 #include "core/magic-effects-timeout-reducer.h"
 #include "game-option/birth-options.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 
 /*!
index 886ca63..79380dd 100644 (file)
@@ -16,6 +16,7 @@
 #include "object-enchant/trc-types.h"
 #include "pet/pet-fall-off.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "spell/spells-diceroll.h"
 #include "view/display-messages.h"
index be6fd54..555755e 100644 (file)
@@ -8,6 +8,7 @@
 #include "monster/monster-describer.h"
 #include "monster/monster-description-types.h"
 #include "monster/monster-info.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "view/display-messages.h"
index 3610593..66c3ace 100644 (file)
@@ -1,6 +1,7 @@
 #include "effect/effect-player-oldies.h"
 #include "game-option/birth-options.h"
 #include "monster-race/race-indice-types.h"
+#include "player/bad-status-setter.h"
 #include "player/eldritch-horror.h"
 #include "player/player-effects.h"
 #include "view/display-messages.h"
index 06ed6a3..1736518 100644 (file)
@@ -6,6 +6,7 @@
 #include "mspell/mspells3.h"
 #include "mutation/mutation.h"
 #include "object/object-broken.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "player/player-race-types.h"
index f47bf0b..8f25083 100644 (file)
@@ -1,6 +1,7 @@
 #include "effect/effect-player-spirit.h"
 #include "mind/mind-mirror-master.h"
 #include "mspell/mspells3.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "view/display-messages.h"
index 38ef3da..04389e4 100644 (file)
@@ -9,6 +9,7 @@
 #include "grid/grid.h"
 #include "io/input-key-requester.h"
 #include "io/write-diary.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "player/player-move.h"
index 4a5008d..210ac63 100644 (file)
@@ -19,6 +19,7 @@
 #include "monster-floor/place-monster-types.h"
 #include "monster/monster-util.h"
 #include "player/eldritch-horror.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index d790f1b..8e3fbbd 100644 (file)
@@ -12,8 +12,8 @@
 #include "object/object-flags.h"
 #include "object/object-flavor.h"
 #include "perception/object-perception.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
-#include "player/player-effects.h"
 #include "player/player-move.h"
 #include "player/player-race-types.h"
 #include "spell-kind/spells-random.h"
index bb7e124..4b1e59a 100644 (file)
@@ -42,6 +42,7 @@
 #include "monster/monster-status.h"
 #include "monster-floor/place-monster-types.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index 26342ae..d7e833e 100644 (file)
@@ -41,6 +41,7 @@
 #include "mind/stances-table.h"
 #include "mutation/mutation.h"
 #include "object/object-hook.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index 243e6ae..a822303 100644 (file)
@@ -8,6 +8,7 @@
 #include "mind/mind-mirror-master.h"
 #include "monster-race/monster-race.h"
 #include "monster-race/race-indice-types.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "view/display-messages.h"
 
index 70804de..7a2f2b0 100644 (file)
@@ -12,6 +12,7 @@
 #include "mind/mind-mirror-master.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "spell-kind/earthquake.h"
index e24cac5..47988f1 100644 (file)
@@ -19,6 +19,7 @@
 #include "mspell/mspell-util.h"
 #include "mspell/mspells1.h"
 #include "mspell/mspells3.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-move.h"
 #include "player/player-personalities-types.h"
index d91f4f6..c7acaa9 100644 (file)
@@ -43,6 +43,7 @@
 #include "mspell/mspell-mask-definitions.h"
 #include "mspell/mspell-type.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "realm/realm-types.h"
index 894e2b7..390b883 100644 (file)
@@ -8,6 +8,7 @@
 #include "mutation/mutation.h"
 #include "object/lite-processor.h"
 #include "object/object-hook.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "player/player-move.h"
diff --git a/src/player/bad-status-setter.c b/src/player/bad-status-setter.c
new file mode 100644 (file)
index 0000000..c466d14
--- /dev/null
@@ -0,0 +1,361 @@
+#include "player/bad-status-setter.h"
+#include "core/stuff-handler.h"
+#include "game-option/disturbance-options.h"
+#include "mind/mind-sniper.h"
+#include "player/avatar.h"
+#include "player/player-effects.h" // つよし状態、後で依存を消す.
+#include "player/player-move.h"
+#include "player/special-defense-types.h"
+#include "realm/realm-types.h"
+#include "spell-realm/spells-hex.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief 盲目の継続時間をセットする / Set "blind", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ * @details
+ * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
+ * memorize any terrain features which suddenly become "visible".\n
+ * Note that blindness is currently the only thing which can affect\n
+ * "player_can_see_bold()".\n
+ */
+bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (!creature_ptr->blind) {
+            if (creature_ptr->prace == RACE_ANDROID) {
+                msg_print(_("センサーをやられた!", "You are blind!"));
+            } else {
+                msg_print(_("目が見えなくなってしまった!", "You are blind!"));
+            }
+
+            notice = TRUE;
+            chg_virtue(creature_ptr, V_ENLIGHTEN, -1);
+        }
+    }
+
+    else {
+        if (creature_ptr->blind) {
+            if (creature_ptr->prace == RACE_ANDROID) {
+                msg_print(_("センサーが復旧した。", "You can see again."));
+            } else {
+                msg_print(_("やっと目が見えるようになった。", "You can see again."));
+            }
+
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->blind = v;
+    creature_ptr->redraw |= (PR_STATUS);
+    if (!notice)
+        return FALSE;
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+
+    creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
+    creature_ptr->redraw |= (PR_MAP);
+    creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 混乱の継続時間をセットする / Set "confused", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_confused(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (!creature_ptr->confused) {
+            msg_print(_("あなたは混乱した!", "You are confused!"));
+
+            if (creature_ptr->action == ACTION_LEARN) {
+                msg_print(_("学習が続けられない!", "You cannot continue learning!"));
+                creature_ptr->new_mane = FALSE;
+
+                creature_ptr->redraw |= (PR_STATE);
+                creature_ptr->action = ACTION_NONE;
+            }
+            if (creature_ptr->action == ACTION_KAMAE) {
+                msg_print(_("構えがとけた。", "You lose your stance."));
+                creature_ptr->special_defense &= ~(KAMAE_MASK);
+                creature_ptr->update |= (PU_BONUS);
+                creature_ptr->redraw |= (PR_STATE);
+                creature_ptr->action = ACTION_NONE;
+            } else if (creature_ptr->action == ACTION_KATA) {
+                msg_print(_("型が崩れた。", "You lose your stance."));
+                creature_ptr->special_defense &= ~(KATA_MASK);
+                creature_ptr->update |= (PU_BONUS);
+                creature_ptr->update |= (PU_MONSTERS);
+                creature_ptr->redraw |= (PR_STATE);
+                creature_ptr->redraw |= (PR_STATUS);
+                creature_ptr->action = ACTION_NONE;
+            }
+
+            /* Sniper */
+            if (creature_ptr->concent)
+                reset_concentration(creature_ptr, TRUE);
+
+            if (hex_spelling_any(creature_ptr))
+                stop_hex_spell_all(creature_ptr);
+
+            notice = TRUE;
+            creature_ptr->counter = FALSE;
+            chg_virtue(creature_ptr, V_HARMONY, -1);
+        }
+    } else {
+        if (creature_ptr->confused) {
+            msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
+            creature_ptr->special_attack &= ~(ATTACK_SUIKEN);
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->confused = 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 "poisoned", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (!creature_ptr->poisoned) {
+            msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->poisoned) {
+            msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->poisoned = 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 "afraid", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_afraid(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (!creature_ptr->afraid) {
+            msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
+
+            if (creature_ptr->special_defense & KATA_MASK) {
+                msg_print(_("型が崩れた。", "You lose your stance."));
+                creature_ptr->special_defense &= ~(KATA_MASK);
+                creature_ptr->update |= (PU_BONUS);
+                creature_ptr->update |= (PU_MONSTERS);
+                creature_ptr->redraw |= (PR_STATE);
+                creature_ptr->redraw |= (PR_STATUS);
+                creature_ptr->action = ACTION_NONE;
+            }
+
+            notice = TRUE;
+            creature_ptr->counter = FALSE;
+            chg_virtue(creature_ptr, V_VALOUR, -1);
+        }
+    } else {
+        if (creature_ptr->afraid) {
+            msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->afraid = 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 "paralyzed", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+
+    if (v) {
+        if (!creature_ptr->paralyzed) {
+            msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
+            if (creature_ptr->concent)
+                reset_concentration(creature_ptr, TRUE);
+            if (hex_spelling_any(creature_ptr))
+                stop_hex_spell_all(creature_ptr);
+
+            creature_ptr->counter = FALSE;
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->paralyzed) {
+            msg_print(_("やっと動けるようになった。", "You can move again."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->paralyzed = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, FALSE);
+    creature_ptr->redraw |= (PR_STATE);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 幻覚の継続時間をセットする / Set "image", notice observable changes
+ * @param v 継続時間
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ * @details Note that we must redraw the map when hallucination changes.
+ */
+bool set_image(player_type *creature_ptr, TIME_EFFECT v)
+{
+    bool notice = FALSE;
+    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+    if (creature_ptr->is_dead)
+        return FALSE;
+    if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
+        v = 0;
+
+    if (v) {
+        set_tsuyoshi(creature_ptr, 0, TRUE);
+        if (!creature_ptr->image) {
+            msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
+
+            /* Sniper */
+            if (creature_ptr->concent)
+                reset_concentration(creature_ptr, TRUE);
+
+            creature_ptr->counter = FALSE;
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->image) {
+            msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->image = v;
+    creature_ptr->redraw |= (PR_STATUS);
+
+    if (!notice)
+        return FALSE;
+
+    if (disturb_state)
+        disturb(creature_ptr, FALSE, TRUE);
+
+    creature_ptr->redraw |= (PR_MAP | PR_HEALTH | PR_UHEALTH);
+    creature_ptr->update |= (PU_MONSTERS);
+    creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+    handle_stuff(creature_ptr);
+    return TRUE;
+}
+
+/*!
+ * @brief 減速の継続時間をセットする / Set "slow", notice observable changes
+ * @param v 継続時間
+ * @param do_dec 現在の継続時間より長い値のみ上書きする
+ * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
+ */
+bool set_slow(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->slow && !do_dec) {
+            if (creature_ptr->slow > v)
+                return FALSE;
+        } else if (!creature_ptr->slow) {
+            msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
+            notice = TRUE;
+        }
+    } else {
+        if (creature_ptr->slow) {
+            msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
+            notice = TRUE;
+        }
+    }
+
+    creature_ptr->slow = v;
+    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/player/bad-status-setter.h b/src/player/bad-status-setter.h
new file mode 100644 (file)
index 0000000..650066a
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool set_blind(player_type *creature_ptr, TIME_EFFECT v);
+bool set_confused(player_type *creature_ptr, TIME_EFFECT v);
+bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v);
+bool set_afraid(player_type *creature_ptr, TIME_EFFECT v);
+bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v);
+bool set_image(player_type *creature_ptr, TIME_EFFECT v);
+bool set_slow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
index ae0b3de..d5d6cca 100644 (file)
@@ -2,6 +2,7 @@
 #include "core/speed-table.h"
 #include "object-enchant/trc-types.h"
 #include "player/player-damage.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-move.h"
 #include "player/special-defense-types.h"
index a504500..9491f2d 100644 (file)
@@ -19,6 +19,7 @@
 #include "monster/monster-list.h"
 #include "monster/monster-util.h"
 #include "monster/smart-learn-types.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "player/mimic-info-table.h"
index 0c54d58..c854ac8 100644 (file)
@@ -47,6 +47,7 @@
 #include "object/object-value.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-move.h"
@@ -363,316 +364,6 @@ bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, bool
 }
 
 /*!
- * @brief 盲目の継続時間をセットする / Set "blind", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- * @details
- * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
- * memorize any terrain features which suddenly become "visible".\n
- * Note that blindness is currently the only thing which can affect\n
- * "player_can_see_bold()".\n
- */
-bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (!creature_ptr->blind) {
-            if (creature_ptr->prace == RACE_ANDROID) {
-                msg_print(_("センサーをやられた!", "You are blind!"));
-            } else {
-                msg_print(_("目が見えなくなってしまった!", "You are blind!"));
-            }
-
-            notice = TRUE;
-            chg_virtue(creature_ptr, V_ENLIGHTEN, -1);
-        }
-    }
-
-    else {
-        if (creature_ptr->blind) {
-            if (creature_ptr->prace == RACE_ANDROID) {
-                msg_print(_("センサーが復旧した。", "You can see again."));
-            } else {
-                msg_print(_("やっと目が見えるようになった。", "You can see again."));
-            }
-
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->blind = v;
-    creature_ptr->redraw |= (PR_STATUS);
-    if (!notice)
-        return FALSE;
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-
-    creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-    creature_ptr->redraw |= (PR_MAP);
-    creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
- * @brief 混乱の継続時間をセットする / Set "confused", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_confused(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (!creature_ptr->confused) {
-            msg_print(_("あなたは混乱した!", "You are confused!"));
-
-            if (creature_ptr->action == ACTION_LEARN) {
-                msg_print(_("学習が続けられない!", "You cannot continue learning!"));
-                creature_ptr->new_mane = FALSE;
-
-                creature_ptr->redraw |= (PR_STATE);
-                creature_ptr->action = ACTION_NONE;
-            }
-            if (creature_ptr->action == ACTION_KAMAE) {
-                msg_print(_("構えがとけた。", "You lose your stance."));
-                creature_ptr->special_defense &= ~(KAMAE_MASK);
-                creature_ptr->update |= (PU_BONUS);
-                creature_ptr->redraw |= (PR_STATE);
-                creature_ptr->action = ACTION_NONE;
-            } else if (creature_ptr->action == ACTION_KATA) {
-                msg_print(_("型が崩れた。", "You lose your stance."));
-                creature_ptr->special_defense &= ~(KATA_MASK);
-                creature_ptr->update |= (PU_BONUS);
-                creature_ptr->update |= (PU_MONSTERS);
-                creature_ptr->redraw |= (PR_STATE);
-                creature_ptr->redraw |= (PR_STATUS);
-                creature_ptr->action = ACTION_NONE;
-            }
-
-            /* Sniper */
-            if (creature_ptr->concent)
-                reset_concentration(creature_ptr, TRUE);
-
-            if (hex_spelling_any(creature_ptr))
-                stop_hex_spell_all(creature_ptr);
-
-            notice = TRUE;
-            creature_ptr->counter = FALSE;
-            chg_virtue(creature_ptr, V_HARMONY, -1);
-        }
-    } else {
-        if (creature_ptr->confused) {
-            msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
-            creature_ptr->special_attack &= ~(ATTACK_SUIKEN);
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->confused = 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 "poisoned", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (!creature_ptr->poisoned) {
-            msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->poisoned) {
-            msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->poisoned = 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 "afraid", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_afraid(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (!creature_ptr->afraid) {
-            msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
-
-            if (creature_ptr->special_defense & KATA_MASK) {
-                msg_print(_("型が崩れた。", "You lose your stance."));
-                creature_ptr->special_defense &= ~(KATA_MASK);
-                creature_ptr->update |= (PU_BONUS);
-                creature_ptr->update |= (PU_MONSTERS);
-                creature_ptr->redraw |= (PR_STATE);
-                creature_ptr->redraw |= (PR_STATUS);
-                creature_ptr->action = ACTION_NONE;
-            }
-
-            notice = TRUE;
-            creature_ptr->counter = FALSE;
-            chg_virtue(creature_ptr, V_VALOUR, -1);
-        }
-    } else {
-        if (creature_ptr->afraid) {
-            msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->afraid = 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 "paralyzed", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-
-    if (v) {
-        if (!creature_ptr->paralyzed) {
-            msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
-            if (creature_ptr->concent)
-                reset_concentration(creature_ptr, TRUE);
-            if (hex_spelling_any(creature_ptr))
-                stop_hex_spell_all(creature_ptr);
-
-            creature_ptr->counter = FALSE;
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->paralyzed) {
-            msg_print(_("やっと動けるようになった。", "You can move again."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->paralyzed = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, FALSE);
-    creature_ptr->redraw |= (PR_STATE);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
- * @brief 幻覚の継続時間をセットする / Set "image", notice observable changes
- * @param v 継続時間
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- * @details Note that we must redraw the map when hallucination changes.
- */
-bool set_image(player_type *creature_ptr, TIME_EFFECT v)
-{
-    bool notice = FALSE;
-    v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
-
-    if (creature_ptr->is_dead)
-        return FALSE;
-    if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
-        v = 0;
-
-    if (v) {
-        set_tsuyoshi(creature_ptr, 0, TRUE);
-        if (!creature_ptr->image) {
-            msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
-
-            /* Sniper */
-            if (creature_ptr->concent)
-                reset_concentration(creature_ptr, TRUE);
-
-            creature_ptr->counter = FALSE;
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->image) {
-            msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->image = v;
-    creature_ptr->redraw |= (PR_STATUS);
-
-    if (!notice)
-        return FALSE;
-
-    if (disturb_state)
-        disturb(creature_ptr, FALSE, TRUE);
-
-    creature_ptr->redraw |= (PR_MAP | PR_HEALTH | PR_UHEALTH);
-    creature_ptr->update |= (PU_MONSTERS);
-    creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-    handle_stuff(creature_ptr);
-    return TRUE;
-}
-
-/*!
  * @brief 加速の継続時間をセットする / Set "fast", notice observable changes
  * @param v 継続時間
  * @param do_dec 現在の継続時間より長い値のみ上書きする
@@ -761,46 +452,6 @@ bool set_lightspeed(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
 }
 
 /*!
- * @brief 減速の継続時間をセットする / Set "slow", notice observable changes
- * @param v 継続時間
- * @param do_dec 現在の継続時間より長い値のみ上書きする
- * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
- */
-bool set_slow(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->slow && !do_dec) {
-            if (creature_ptr->slow > v)
-                return FALSE;
-        } else if (!creature_ptr->slow) {
-            msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
-            notice = TRUE;
-        }
-    } else {
-        if (creature_ptr->slow) {
-            msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
-            notice = TRUE;
-        }
-    }
-
-    creature_ptr->slow = 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 a1ed0a2..8cc1d1a 100644 (file)
@@ -6,14 +6,7 @@ void set_action(player_type *creature_ptr, ACTION_IDX typ);
 void reset_tim_flags(player_type *creature_ptr);
 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_blind(player_type *creature_ptr, TIME_EFFECT v);
-bool set_confused(player_type *creature_ptr, TIME_EFFECT v);
-bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v);
-bool set_afraid(player_type *creature_ptr, TIME_EFFECT v);
-bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v);
-bool set_image(player_type *creature_ptr, TIME_EFFECT v);
 bool set_fast(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
-bool set_slow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_shield(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_tsubureru(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 bool set_magicdef(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
index 244ae08..4c8621f 100644 (file)
@@ -5,6 +5,7 @@
 #include "monster-floor/monster-summon.h"
 #include "monster-floor/place-monster-types.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "spell-kind/spells-beam.h"
index fec2886..8d0d3c0 100644 (file)
@@ -5,6 +5,7 @@
 #include "io/targeting.h"
 #include "monster-floor/monster-summon.h"
 #include "monster-floor/place-monster-types.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-effects.h"
 #include "spell/process-effect.h"
index 86932b1..6a4537f 100644 (file)
@@ -3,6 +3,7 @@
 #include "io/targeting.h"
 #include "monster-floor/monster-summon.h"
 #include "monster-floor/place-monster-types.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index a74201d..af73a72 100644 (file)
@@ -2,6 +2,7 @@
 #include "cmd-action/cmd-spell.h"
 #include "floor/floor.h"
 #include "io/targeting.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "spell-kind/spells-detection.h"
index 933a53a..eeb3be1 100644 (file)
@@ -9,6 +9,7 @@
 #include "object/object-generator.h"
 #include "object/object-kind-hook.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "player/player-race-types.h"
index 9a3e95a..c0892a0 100644 (file)
@@ -1,6 +1,7 @@
 #include "cmd-action/cmd-spell.h"
 #include "effect/effect-characteristics.h"
 #include "io/targeting.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-effects.h"
 #include "realm/realm-song-numbers.h"
index d37c68c..24e04e8 100644 (file)
@@ -10,6 +10,7 @@
 #include "object-enchant/item-apply-magic.h"
 #include "object/object-generator.h"
 #include "perception/object-perception.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index 3c96826..83837cc 100644 (file)
@@ -34,6 +34,7 @@
 #include "object/object-hook.h"
 #include "object/object-mark-types.h"
 #include "perception/object-perception.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "player/special-defense-types.h"
 #include "spell-kind/spells-teleport.h"
index eb33ef9..0de2bbc 100644 (file)
@@ -14,6 +14,7 @@
 #include "monster-floor/place-monster-types.h"
 #include "mutation/mutation.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "spell-kind/earthquake.h"
index 0ad1f34..8017409 100644 (file)
@@ -38,6 +38,7 @@
 #include "object/object-kind.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
index badb33d..1985623 100644 (file)
@@ -1,5 +1,6 @@
 #include "spell/spells-staff-only.h"
 #include "effect/effect-characteristics.h"
+#include "player/bad-status-setter.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"
 #include "spell/process-effect.h"
index 7452889..9ada258 100644 (file)
@@ -21,6 +21,7 @@
 #include "object/object-kind-hook.h"
 #include "object/object-kind.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-effects.h"
 #include "player/player-status.h"
index 95eb377..17f67be 100644 (file)
@@ -14,6 +14,7 @@
 #include "object/item-use-flags.h"
 #include "object/object-hook.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-effects.h"
 #include "spell/spells-diceroll.h"
 #include "spell-kind/earthquake.h"
index 1410bac..4831732 100644 (file)
@@ -77,6 +77,7 @@
 #include "perception/identification.h"
 #include "perception/object-perception.h"
 #include "player/avatar.h"
+#include "player/bad-status-setter.h"
 #include "player/player-class.h"
 #include "player/player-damage.h"
 #include "player/player-effects.h"