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 "player/player-status.h"
11 #include "realm/realm-song-numbers.h"
12 #include "spell-realm/spells-song.h"
13 #include "system/player-type-definition.h"
14 #include "view/display-messages.h"
17 * @brief 対邪悪結界の継続時間をセットする / Set "protevil", notice observable changes
19 * @param do_dec 現在の継続時間より長い値のみ上書きする
20 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
22 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
25 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
27 if (creature_ptr->is_dead)
31 if (creature_ptr->protevil && !do_dec) {
32 if (creature_ptr->protevil > v)
34 } else if (!creature_ptr->protevil) {
35 msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
39 if (creature_ptr->protevil) {
40 msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
45 creature_ptr->protevil = v;
46 creature_ptr->redraw |= (PR_STATUS);
52 disturb(creature_ptr, false, false);
54 handle_stuff(creature_ptr);
59 * @brief 無傷球の継続時間をセットする / Set "invuln", notice observable changes
61 * @param do_dec 現在の継続時間より長い値のみ上書きする
62 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
64 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
67 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
69 if (creature_ptr->is_dead)
73 if (creature_ptr->invuln && !do_dec) {
74 if (creature_ptr->invuln > v)
76 } else if (!is_invuln(creature_ptr)) {
77 msg_print(_("無敵だ!", "Invulnerability!"));
80 chg_virtue(creature_ptr, V_UNLIFE, -2);
81 chg_virtue(creature_ptr, V_HONOUR, -2);
82 chg_virtue(creature_ptr, V_SACRIFICE, -3);
83 chg_virtue(creature_ptr, V_VALOUR, -5);
85 creature_ptr->redraw |= (PR_MAP);
86 creature_ptr->update |= (PU_MONSTERS);
88 creature_ptr->window_flags |= (PW_OVERHEAD | PW_DUNGEON);
91 if (creature_ptr->invuln && !music_singing(creature_ptr, MUSIC_INVULN)) {
92 msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
95 creature_ptr->redraw |= (PR_MAP);
96 creature_ptr->update |= (PU_MONSTERS);
98 creature_ptr->window_flags |= (PW_OVERHEAD | PW_DUNGEON);
100 creature_ptr->energy_need += ENERGY_NEED();
104 creature_ptr->invuln = v;
105 creature_ptr->redraw |= (PR_STATUS);
111 disturb(creature_ptr, false, false);
113 creature_ptr->update |= (PU_BONUS);
114 handle_stuff(creature_ptr);
119 * @brief 時限急回復の継続時間をセットする / Set "tim_regen", notice observable changes
121 * @param do_dec 現在の継続時間より長い値のみ上書きする
122 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
124 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
127 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
129 if (creature_ptr->is_dead)
133 if (creature_ptr->tim_regen && !do_dec) {
134 if (creature_ptr->tim_regen > v)
136 } else if (!creature_ptr->tim_regen) {
137 msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
141 if (creature_ptr->tim_regen) {
142 msg_print(_("素早く回復する感じがなくなった。", "You feel you are no longer regenerating quickly."));
147 creature_ptr->tim_regen = v;
148 creature_ptr->redraw |= (PR_STATUS);
154 disturb(creature_ptr, false, false);
156 creature_ptr->update |= (PU_BONUS);
157 handle_stuff(creature_ptr);
162 * @brief 一時的反射の継続時間をセットする / Set "tim_reflect", notice observable changes
164 * @param do_dec 現在の継続時間より長い値のみ上書きする
165 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
167 bool set_tim_reflect(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
170 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
172 if (creature_ptr->is_dead)
176 if (creature_ptr->tim_reflect && !do_dec) {
177 if (creature_ptr->tim_reflect > v)
179 } else if (!creature_ptr->tim_reflect) {
180 msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
184 if (creature_ptr->tim_reflect) {
185 msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
190 creature_ptr->tim_reflect = v;
191 creature_ptr->redraw |= (PR_STATUS);
197 disturb(creature_ptr, false, false);
199 creature_ptr->update |= (PU_BONUS);
200 handle_stuff(creature_ptr);
205 * @brief 一時的壁抜けの継続時間をセットする / Set "tim_pass_wall", notice observable changes
207 * @param do_dec 現在の継続時間より長い値のみ上書きする
208 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
210 bool set_pass_wall(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
213 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
215 if (creature_ptr->is_dead)
219 if (creature_ptr->tim_pass_wall && !do_dec) {
220 if (creature_ptr->tim_pass_wall > v)
222 } else if (!creature_ptr->tim_pass_wall) {
223 msg_print(_("体が半物質の状態になった。", "You became ethereal."));
227 if (creature_ptr->tim_pass_wall) {
228 msg_print(_("体が物質化した。", "You are no longer ethereal."));
233 creature_ptr->tim_pass_wall = v;
234 creature_ptr->redraw |= (PR_STATUS);
240 disturb(creature_ptr, false, false);
242 creature_ptr->update |= (PU_BONUS);
243 handle_stuff(creature_ptr);