1 #include "status/body-improvement.h"
2 #include "core/disturbance.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "core/speed-table.h"
6 #include "core/stuff-handler.h"
7 #include "core/window-redrawer.h"
8 #include "game-option/disturbance-options.h"
9 #include "player-info/avatar.h"
10 #include "realm/realm-song-numbers.h"
11 #include "view/display-messages.h"
14 * @brief 対邪悪結界の継続時間をセットする / Set "protevil", notice observable changes
16 * @param do_dec 現在の継続時間より長い値のみ上書きする
17 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
19 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
22 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
24 if (creature_ptr->is_dead)
28 if (creature_ptr->protevil && !do_dec) {
29 if (creature_ptr->protevil > v)
31 } else if (!creature_ptr->protevil) {
32 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
36 if (creature_ptr->protevil) {
37 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
42 creature_ptr->protevil = v;
43 creature_ptr->redraw |= (PR_STATUS);
49 disturb(creature_ptr, FALSE, FALSE);
51 handle_stuff(creature_ptr);
56 * @brief 無傷球の継続時間をセットする / Set "invuln", notice observable changes
58 * @param do_dec 現在の継続時間より長い値のみ上書きする
59 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
61 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
64 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
66 if (creature_ptr->is_dead)
70 if (creature_ptr->invuln && !do_dec) {
71 if (creature_ptr->invuln > v)
73 } else if (!is_invuln(creature_ptr)) {
74 msg_print(_("無敵だ!", "Invulnerability!"));
77 chg_virtue(creature_ptr, V_UNLIFE, -2);
78 chg_virtue(creature_ptr, V_HONOUR, -2);
79 chg_virtue(creature_ptr, V_SACRIFICE, -3);
80 chg_virtue(creature_ptr, V_VALOUR, -5);
82 creature_ptr->redraw |= (PR_MAP);
83 creature_ptr->update |= (PU_MONSTERS);
85 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
88 if (creature_ptr->invuln && !music_singing(creature_ptr, MUSIC_INVULN)) {
89 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
92 creature_ptr->redraw |= (PR_MAP);
93 creature_ptr->update |= (PU_MONSTERS);
95 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
97 creature_ptr->energy_need += ENERGY_NEED();
101 creature_ptr->invuln = v;
102 creature_ptr->redraw |= (PR_STATUS);
108 disturb(creature_ptr, FALSE, FALSE);
110 creature_ptr->update |= (PU_BONUS);
111 handle_stuff(creature_ptr);
116 * @brief 時限急回復の継続時間をセットする / Set "tim_regen", notice observable changes
118 * @param do_dec 現在の継続時間より長い値のみ上書きする
119 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
121 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
124 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
126 if (creature_ptr->is_dead)
130 if (creature_ptr->tim_regen && !do_dec) {
131 if (creature_ptr->tim_regen > v)
133 } else if (!creature_ptr->tim_regen) {
134 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
138 if (creature_ptr->tim_regen) {
139 msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
144 creature_ptr->tim_regen = v;
145 creature_ptr->redraw |= (PR_STATUS);
151 disturb(creature_ptr, FALSE, FALSE);
153 creature_ptr->update |= (PU_BONUS);
154 handle_stuff(creature_ptr);
159 * @brief 一時的反射の継続時間をセットする / Set "tim_reflect", notice observable changes
161 * @param do_dec 現在の継続時間より長い値のみ上書きする
162 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
164 bool set_tim_reflect(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
167 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
169 if (creature_ptr->is_dead)
173 if (creature_ptr->tim_reflect && !do_dec) {
174 if (creature_ptr->tim_reflect > v)
176 } else if (!creature_ptr->tim_reflect) {
177 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
181 if (creature_ptr->tim_reflect) {
182 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
187 creature_ptr->tim_reflect = v;
188 creature_ptr->redraw |= (PR_STATUS);
194 disturb(creature_ptr, FALSE, FALSE);
196 creature_ptr->update |= (PU_BONUS);
197 handle_stuff(creature_ptr);
202 * @brief 一時的壁抜けの継続時間をセットする / Set "tim_pass_wall", notice observable changes
204 * @param do_dec 現在の継続時間より長い値のみ上書きする
205 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
207 bool set_pass_wall(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
210 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
212 if (creature_ptr->is_dead)
216 if (creature_ptr->tim_pass_wall && !do_dec) {
217 if (creature_ptr->tim_pass_wall > v)
219 } else if (!creature_ptr->tim_pass_wall) {
220 msg_print(_("体が半物質の状態になった。", "You became ethereal."));
224 if (creature_ptr->tim_pass_wall) {
225 msg_print(_("体が物質化した。", "You are no longer ethereal."));
230 creature_ptr->tim_pass_wall = v;
231 creature_ptr->redraw |= (PR_STATUS);
237 disturb(creature_ptr, FALSE, FALSE);
239 creature_ptr->update |= (PU_BONUS);
240 handle_stuff(creature_ptr);