From afd21069e2ef22db0c3c020ca1126897507af5f9 Mon Sep 17 00:00:00 2001 From: Hourier Date: Tue, 30 Jun 2020 22:28:00 +0900 Subject: [PATCH] [Refactor] #40466 Separated spells-demon.c/h from player-effects.c/h --- Hengband/Hengband/Hengband.vcxproj | 2 ++ Hengband/Hengband/Hengband.vcxproj.filters | 6 ++++ src/Makefile.am | 1 + src/core/magic-effects-timeout-reducer.c | 1 + src/player/player-effects.c | 43 +-------------------------- src/player/player-effects.h | 1 - src/realm/realm-demon.c | 2 +- src/spell-realm/spells-demon.c | 47 ++++++++++++++++++++++++++++++ src/spell-realm/spells-demon.h | 5 ++++ 9 files changed, 64 insertions(+), 44 deletions(-) create mode 100644 src/spell-realm/spells-demon.c create mode 100644 src/spell-realm/spells-demon.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index 4efa8be84..a52e44061 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -227,6 +227,7 @@ + @@ -659,6 +660,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index 2e6549848..1dc6e224f 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -1529,6 +1529,9 @@ status + + spell-realm + @@ -3349,6 +3352,9 @@ status + + spell-realm + diff --git a/src/Makefile.am b/src/Makefile.am index 9d13bd250..210b0cd6f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -550,6 +550,7 @@ hengband_SOURCES = \ spell-realm/spells-chaos.c spell-realm/spells-chaos.h \ spell-realm/spells-craft.c spell-realm/spells-craft.h \ spell-realm/spells-crusade.c spell-realm/spells-crusade.h \ + spell-realm/spells-demon.c spell-realm/spells-demon.h \ spell-realm/spells-hex.c spell-realm/spells-hex.h \ spell-realm/spells-song.c spell-realm/spells-song.h \ spell-realm/spells-trump.c spell-realm/spells-trump.h \ diff --git a/src/core/magic-effects-timeout-reducer.c b/src/core/magic-effects-timeout-reducer.c index 80c596d57..3a15e90ac 100644 --- a/src/core/magic-effects-timeout-reducer.c +++ b/src/core/magic-effects-timeout-reducer.c @@ -5,6 +5,7 @@ #include "mind/racial-kutar.h" #include "player/player-effects.h" #include "spell-realm/spells-craft.h" +#include "spell-realm/spells-demon.h" #include "spell-realm/spells-song.h" #include "status/bad-status-setter.h" #include "status/buff-setter.h" diff --git a/src/player/player-effects.c b/src/player/player-effects.c index 85eadbd6e..606268f22 100644 --- a/src/player/player-effects.c +++ b/src/player/player-effects.c @@ -62,6 +62,7 @@ #include "realm/realm-song-numbers.h" #include "spell-kind/spells-floor.h" #include "spell-realm/spells-craft.h" +#include "spell-realm/spells-demon.h" #include "spell-realm/spells-hex.h" #include "spell-realm/spells-song.h" #include "spell/spells-status.h" @@ -378,48 +379,6 @@ bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec) } /*! - * @brief 一時的火炎のオーラの継続時間をセットする / Set "tim_sh_fire", notice observable changes - * @param v 継続時間 - * @param do_dec 現在の継続時間より長い値のみ上書きする - * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 - */ -bool set_tim_sh_fire(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_fire && !do_dec) { - if (creature_ptr->tim_sh_fire > v) - return FALSE; - } else if (!creature_ptr->tim_sh_fire) { - msg_print(_("体が炎のオーラで覆われた。", "You are enveloped by a fiery aura!")); - notice = TRUE; - } - } else { - if (creature_ptr->tim_sh_fire) { - msg_print(_("炎のオーラが消えた。", "The fiery aura disappeared.")); - notice = TRUE; - } - } - - creature_ptr->tim_sh_fire = 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_holy", notice observable changes * @param v 継続時間 * @param do_dec 現在の継続時間より長い値のみ上書きする diff --git a/src/player/player-effects.h b/src/player/player-effects.h index f171043c9..31587f943 100644 --- a/src/player/player-effects.h +++ b/src/player/player-effects.h @@ -7,7 +7,6 @@ void dispel_player(player_type *creature_ptr); 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_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); bool set_resist_magic(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); diff --git a/src/realm/realm-demon.c b/src/realm/realm-demon.c index 6c9263545..3f62f2cdf 100644 --- a/src/realm/realm-demon.c +++ b/src/realm/realm-demon.c @@ -5,7 +5,6 @@ #include "monster-floor/place-monster-types.h" #include "player/player-class.h" #include "player/player-damage.h" -#include "player/player-effects.h" #include "player/player-race.h" #include "spell-kind/spells-charm.h" #include "spell-kind/spells-detection.h" @@ -13,6 +12,7 @@ #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-pet.h" #include "spell-kind/spells-sight.h" +#include "spell-realm/spells-demon.h" #include "spell/spells-diceroll.h" #include "spell/spells-object.h" #include "spell/spells-status.h" diff --git a/src/spell-realm/spells-demon.c b/src/spell-realm/spells-demon.c new file mode 100644 index 000000000..c4e1afaf6 --- /dev/null +++ b/src/spell-realm/spells-demon.c @@ -0,0 +1,47 @@ +#include "spell-realm/spells-demon.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_sh_fire", notice observable changes + * @param v 継続時間 + * @param do_dec 現在の継続時間より長い値のみ上書きする + * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。 + */ +bool set_tim_sh_fire(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_fire && !do_dec) { + if (creature_ptr->tim_sh_fire > v) + return FALSE; + } else if (!creature_ptr->tim_sh_fire) { + msg_print(_("体が炎のオーラで覆われた。", "You are enveloped by a fiery aura!")); + notice = TRUE; + } + } else { + if (creature_ptr->tim_sh_fire) { + msg_print(_("炎のオーラが消えた。", "The fiery aura disappeared.")); + notice = TRUE; + } + } + + creature_ptr->tim_sh_fire = 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/spell-realm/spells-demon.h b/src/spell-realm/spells-demon.h new file mode 100644 index 000000000..4a1f47e56 --- /dev/null +++ b/src/spell-realm/spells-demon.h @@ -0,0 +1,5 @@ +#pragma once + +#include "system/angband.h" + +bool set_tim_sh_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec); -- 2.11.0