From c30d32a866f66e4dff93a0492cd130043cc0d2f2 Mon Sep 17 00:00:00 2001 From: Hourier Date: Tue, 30 Jun 2020 21:28:24 +0900 Subject: [PATCH] [Refactor] #40466 Separated form-changer.c/h from player-effect.c/h --- Hengband/Hengband/Hengband.vcxproj | 2 + Hengband/Hengband/Hengband.vcxproj.filters | 6 + src/Makefile.am | 1 + src/cmd-item/cmd-activate.c | 1 + src/cmd-item/cmd-quaff.c | 1 + src/cmd-item/cmd-read.c | 1 + src/cmd-item/cmd-usestaff.c | 1 + src/cmd-item/cmd-zaprod.c | 1 + src/core/magic-effects-timeout-reducer.c | 1 + src/mutation/mutation-processor.c | 1 + src/player/player-effects.c | 202 +-------------------------- src/player/player-effects.h | 4 - src/realm/realm-death.c | 1 + src/realm/realm-demon.c | 1 + src/spell/spells-status.c | 1 + src/status/bad-status-setter.c | 3 +- src/status/form-changer.c | 210 +++++++++++++++++++++++++++++ src/status/form-changer.h | 8 ++ 18 files changed, 240 insertions(+), 206 deletions(-) create mode 100644 src/status/form-changer.c create mode 100644 src/status/form-changer.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index f2f798b6f..b5daa56a3 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -236,6 +236,7 @@ + @@ -668,6 +669,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index ce7de4790..7e489cb51 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -1523,6 +1523,9 @@ status + + status + @@ -3337,6 +3340,9 @@ status + + status + diff --git a/src/Makefile.am b/src/Makefile.am index ed41de079..23a44f261 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ \ diff --git a/src/cmd-item/cmd-activate.c b/src/cmd-item/cmd-activate.c index 3c1ac5a49..41280c188 100644 --- a/src/cmd-item/cmd-activate.c +++ b/src/cmd-item/cmd-activate.c @@ -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" diff --git a/src/cmd-item/cmd-quaff.c b/src/cmd-item/cmd-quaff.c index 494e9dbcc..5ef758c7c 100644 --- a/src/cmd-item/cmd-quaff.c +++ b/src/cmd-item/cmd-quaff.c @@ -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" diff --git a/src/cmd-item/cmd-read.c b/src/cmd-item/cmd-read.c index c7c13304a..cab37304a 100644 --- a/src/cmd-item/cmd-read.c +++ b/src/cmd-item/cmd-read.c @@ -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" diff --git a/src/cmd-item/cmd-usestaff.c b/src/cmd-item/cmd-usestaff.c index 8082b83f5..7bfc2ee00 100644 --- a/src/cmd-item/cmd-usestaff.c +++ b/src/cmd-item/cmd-usestaff.c @@ -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" diff --git a/src/cmd-item/cmd-zaprod.c b/src/cmd-item/cmd-zaprod.c index 6e2af162e..f9fccdac8 100644 --- a/src/cmd-item/cmd-zaprod.c +++ b/src/cmd-item/cmd-zaprod.c @@ -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" diff --git a/src/core/magic-effects-timeout-reducer.c b/src/core/magic-effects-timeout-reducer.c index 6df5d3cb9..80c596d57 100644 --- a/src/core/magic-effects-timeout-reducer.c +++ b/src/core/magic-effects-timeout-reducer.c @@ -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" diff --git a/src/mutation/mutation-processor.c b/src/mutation/mutation-processor.c index 67112920b..170d12833 100644 --- a/src/mutation/mutation-processor.c +++ b/src/mutation/mutation-processor.c @@ -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" diff --git a/src/player/player-effects.c b/src/player/player-effects.c index 14850b468..91f7c0b7a 100644 --- a/src/player/player-effects.c +++ b/src/player/player-effects.c @@ -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を返す。 diff --git a/src/player/player-effects.h b/src/player/player-effects.h index bccf6cdb9..521d0fab8 100644 --- a/src/player/player-effects.h +++ b/src/player/player-effects.h @@ -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); diff --git a/src/realm/realm-death.c b/src/realm/realm-death.c index 2a73aa7dd..26816b91e 100644 --- a/src/realm/realm-death.c +++ b/src/realm/realm-death.c @@ -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" /*! diff --git a/src/realm/realm-demon.c b/src/realm/realm-demon.c index 0c16da37e..6c9263545 100644 --- a/src/realm/realm-demon.c +++ b/src/realm/realm-demon.c @@ -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" diff --git a/src/spell/spells-status.c b/src/spell/spells-status.c index 39cb1589c..a3c482dfc 100644 --- a/src/spell/spells-status.c +++ b/src/spell/spells-status.c @@ -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" diff --git a/src/status/bad-status-setter.c b/src/status/bad-status-setter.c index 06d38b44a..53fe243ff 100644 --- a/src/status/bad-status-setter.c +++ b/src/status/bad-status-setter.c @@ -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 index 000000000..983ab4542 --- /dev/null +++ b/src/status/form-changer.c @@ -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 index 000000000..0b38911c8 --- /dev/null +++ b/src/status/form-changer.h @@ -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); -- 2.11.0