OSDN Git Service

Merge pull request #1862 from sikabane-works/feature/refactor-player-class
[hengbandforosx/hengbandosx.git] / src / spell-realm / spells-demon.cpp
1 #include "spell-realm/spells-demon.h"
2 #include "core/disturbance.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "core/stuff-handler.h"
6 #include "game-option/disturbance-options.h"
7 #include "system/player-type-definition.h"
8 #include "view/display-messages.h"
9
10 /*!
11  * @brief 一時的火炎のオーラの継続時間をセットする / Set "tim_sh_fire", notice observable changes
12  * @param v 継続時間
13  * @param do_dec 現在の継続時間より長い値のみ上書きする
14  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
15  */
16 bool set_tim_sh_fire(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec)
17 {
18     bool notice = false;
19     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
20
21     if (player_ptr->is_dead)
22         return false;
23
24     if (v) {
25         if (player_ptr->tim_sh_fire && !do_dec) {
26             if (player_ptr->tim_sh_fire > v)
27                 return false;
28         } else if (!player_ptr->tim_sh_fire) {
29             msg_print(_("体が炎のオーラで覆われた。", "You are enveloped by a fiery aura!"));
30             notice = true;
31         }
32     } else {
33         if (player_ptr->tim_sh_fire) {
34             msg_print(_("炎のオーラが消えた。", "The fiery aura disappeared."));
35             notice = true;
36         }
37     }
38
39     player_ptr->tim_sh_fire = v;
40     player_ptr->redraw |= (PR_STATUS);
41
42     if (!notice)
43         return false;
44
45     if (disturb_state)
46         disturb(player_ptr, false, false);
47     player_ptr->update |= (PU_BONUS);
48     handle_stuff(player_ptr);
49     return true;
50 }