1 #include "status/bad-status-setter.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 "core/window-redrawer.h"
7 #include "game-option/disturbance-options.h"
8 #include "mind/mind-sniper.h"
9 #include "player/attack-defense-types.h"
10 #include "player-info/avatar.h"
11 #include "player/player-race.h"
12 #include "player/player-status-flags.h"
13 #include "player/special-defense-types.h"
14 #include "spell-realm/spells-hex.h"
15 #include "status/base-status.h"
16 #include "status/buff-setter.h"
17 #include "view/display-messages.h"
20 * @brief 盲目の継続時間をセットする / Set "blind", notice observable changes
22 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
24 * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
25 * memorize any terrain features which suddenly become "visible".\n
26 * Note that blindness is currently the only thing which can affect\n
27 * "player_can_see_bold()".\n
29 bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
32 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
34 if (creature_ptr->is_dead)
38 if (!creature_ptr->blind) {
39 if (creature_ptr->prace == RACE_ANDROID) {
40 msg_print(_("センサーをやられた!", "You are blind!"));
42 msg_print(_("目が見えなくなってしまった!", "You are blind!"));
46 chg_virtue(creature_ptr, V_ENLIGHTEN, -1);
51 if (creature_ptr->blind) {
52 if (creature_ptr->prace == RACE_ANDROID) {
53 msg_print(_("センサーが復旧した。", "You can see again."));
55 msg_print(_("やっと目が見えるようになった。", "You can see again."));
62 creature_ptr->blind = v;
63 creature_ptr->redraw |= (PR_STATUS);
67 disturb(creature_ptr, FALSE, FALSE);
69 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
70 creature_ptr->redraw |= (PR_MAP);
71 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
72 handle_stuff(creature_ptr);
77 * @brief 混乱の継続時間をセットする / Set "confused", notice observable changes
79 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
81 bool set_confused(player_type *creature_ptr, TIME_EFFECT v)
84 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
86 if (creature_ptr->is_dead)
90 if (!creature_ptr->confused) {
91 msg_print(_("あなたは混乱した!", "You are confused!"));
93 if (creature_ptr->action == ACTION_LEARN) {
94 msg_print(_("学習が続けられない!", "You cannot continue learning!"));
95 creature_ptr->new_mane = FALSE;
97 creature_ptr->redraw |= (PR_STATE);
98 creature_ptr->action = ACTION_NONE;
100 if (creature_ptr->action == ACTION_KAMAE) {
101 msg_print(_("構えがとけた。", "You lose your stance."));
102 creature_ptr->special_defense &= ~(KAMAE_MASK);
103 creature_ptr->update |= (PU_BONUS);
104 creature_ptr->redraw |= (PR_STATE);
105 creature_ptr->action = ACTION_NONE;
106 } else if (creature_ptr->action == ACTION_KATA) {
107 msg_print(_("型が崩れた。", "You lose your stance."));
108 creature_ptr->special_defense &= ~(KATA_MASK);
109 creature_ptr->update |= (PU_BONUS);
110 creature_ptr->update |= (PU_MONSTERS);
111 creature_ptr->redraw |= (PR_STATE);
112 creature_ptr->redraw |= (PR_STATUS);
113 creature_ptr->action = ACTION_NONE;
117 if (creature_ptr->concent)
118 reset_concentration(creature_ptr, TRUE);
120 if (hex_spelling_any(creature_ptr))
121 stop_hex_spell_all(creature_ptr);
124 creature_ptr->counter = FALSE;
125 chg_virtue(creature_ptr, V_HARMONY, -1);
128 if (creature_ptr->confused) {
129 msg_print(_("やっと混乱がおさまった。", "You feel less confused now."));
130 creature_ptr->special_attack &= ~(ATTACK_SUIKEN);
135 creature_ptr->confused = v;
136 creature_ptr->redraw |= (PR_STATUS);
142 disturb(creature_ptr, FALSE, FALSE);
143 handle_stuff(creature_ptr);
148 * @brief 毒の継続時間をセットする / Set "poisoned", notice observable changes
150 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
152 bool set_poisoned(player_type *creature_ptr, TIME_EFFECT v)
155 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
157 if (creature_ptr->is_dead)
161 if (!creature_ptr->poisoned) {
162 msg_print(_("毒に侵されてしまった!", "You are poisoned!"));
166 if (creature_ptr->poisoned) {
167 msg_print(_("やっと毒の痛みがなくなった。", "You are no longer poisoned."));
172 creature_ptr->poisoned = v;
173 creature_ptr->redraw |= (PR_STATUS);
179 disturb(creature_ptr, FALSE, FALSE);
180 handle_stuff(creature_ptr);
185 * @brief 恐怖の継続時間をセットする / Set "afraid", notice observable changes
187 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
189 bool set_afraid(player_type *creature_ptr, TIME_EFFECT v)
192 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
194 if (creature_ptr->is_dead)
198 if (!creature_ptr->afraid) {
199 msg_print(_("何もかも恐くなってきた!", "You are terrified!"));
201 if (creature_ptr->special_defense & KATA_MASK) {
202 msg_print(_("型が崩れた。", "You lose your stance."));
203 creature_ptr->special_defense &= ~(KATA_MASK);
204 creature_ptr->update |= (PU_BONUS);
205 creature_ptr->update |= (PU_MONSTERS);
206 creature_ptr->redraw |= (PR_STATE);
207 creature_ptr->redraw |= (PR_STATUS);
208 creature_ptr->action = ACTION_NONE;
212 creature_ptr->counter = FALSE;
213 chg_virtue(creature_ptr, V_VALOUR, -1);
216 if (creature_ptr->afraid) {
217 msg_print(_("やっと恐怖を振り払った。", "You feel bolder now."));
222 creature_ptr->afraid = v;
223 creature_ptr->redraw |= (PR_STATUS);
229 disturb(creature_ptr, FALSE, FALSE);
230 handle_stuff(creature_ptr);
235 * @brief 麻痺の継続時間をセットする / Set "paralyzed", notice observable changes
237 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
239 bool set_paralyzed(player_type *creature_ptr, TIME_EFFECT v)
242 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
244 if (creature_ptr->is_dead)
248 if (!creature_ptr->paralyzed) {
249 msg_print(_("体が麻痺してしまった!", "You are paralyzed!"));
250 if (creature_ptr->concent)
251 reset_concentration(creature_ptr, TRUE);
252 if (hex_spelling_any(creature_ptr))
253 stop_hex_spell_all(creature_ptr);
255 creature_ptr->counter = FALSE;
259 if (creature_ptr->paralyzed) {
260 msg_print(_("やっと動けるようになった。", "You can move again."));
265 creature_ptr->paralyzed = v;
266 creature_ptr->redraw |= (PR_STATUS);
272 disturb(creature_ptr, FALSE, FALSE);
273 creature_ptr->redraw |= (PR_STATE);
274 handle_stuff(creature_ptr);
279 * @brief 幻覚の継続時間をセットする / Set "image", notice observable changes
281 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
282 * @details Note that we must redraw the map when hallucination changes.
284 bool set_image(player_type *creature_ptr, TIME_EFFECT v)
287 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
289 if (creature_ptr->is_dead)
291 if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
295 set_tsuyoshi(creature_ptr, 0, TRUE);
296 if (!creature_ptr->image) {
297 msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
300 if (creature_ptr->concent)
301 reset_concentration(creature_ptr, TRUE);
303 creature_ptr->counter = FALSE;
307 if (creature_ptr->image) {
308 msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
313 creature_ptr->image = v;
314 creature_ptr->redraw |= (PR_STATUS);
320 disturb(creature_ptr, FALSE, TRUE);
322 creature_ptr->redraw |= (PR_MAP | PR_HEALTH | PR_UHEALTH);
323 creature_ptr->update |= (PU_MONSTERS);
324 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
325 handle_stuff(creature_ptr);
330 * @brief 減速の継続時間をセットする / Set "slow", notice observable changes
332 * @param do_dec 現在の継続時間より長い値のみ上書きする
333 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
335 bool set_slow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
338 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
340 if (creature_ptr->is_dead)
344 if (creature_ptr->slow && !do_dec) {
345 if (creature_ptr->slow > v)
347 } else if (!creature_ptr->slow) {
348 msg_print(_("体の動きが遅くなってしまった!", "You feel yourself moving slower!"));
352 if (creature_ptr->slow) {
353 msg_print(_("動きの遅さがなくなったようだ。", "You feel yourself speed up."));
358 creature_ptr->slow = v;
363 disturb(creature_ptr, FALSE, FALSE);
364 creature_ptr->update |= (PU_BONUS);
365 handle_stuff(creature_ptr);
370 * @brief 朦朧の継続時間をセットする / Set "stun", notice observable changes
372 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
374 * Note the special code to only notice "range" changes.
376 bool set_stun(player_type *creature_ptr, TIME_EFFECT v)
378 int old_aux, new_aux;
380 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
381 if (creature_ptr->is_dead)
383 if (is_specific_player_race(creature_ptr, RACE_GOLEM) || ((creature_ptr->pclass == CLASS_BERSERKER) && (creature_ptr->lev > 34)))
386 if (creature_ptr->stun > 100) {
388 } else if (creature_ptr->stun > 50) {
390 } else if (creature_ptr->stun > 0) {
406 if (new_aux > old_aux) {
409 msg_print(_("意識がもうろうとしてきた。", "You have been stunned."));
412 msg_print(_("意識がひどくもうろうとしてきた。", "You have been heavily stunned."));
415 msg_print(_("頭がクラクラして意識が遠のいてきた。", "You have been knocked out."));
419 if (randint1(1000) < v || one_in_(16)) {
420 msg_print(_("割れるような頭痛がする。", "A vicious blow hits your head."));
423 if (!has_sustain_int(creature_ptr))
424 (void)do_dec_stat(creature_ptr, A_INT);
425 if (!creature_ptr->sustain_wis)
426 (void)do_dec_stat(creature_ptr, A_WIS);
427 } else if (one_in_(2)) {
428 if (!has_sustain_int(creature_ptr))
429 (void)do_dec_stat(creature_ptr, A_INT);
431 if (!creature_ptr->sustain_wis)
432 (void)do_dec_stat(creature_ptr, A_WIS);
436 if (creature_ptr->special_defense & KATA_MASK) {
437 msg_print(_("型が崩れた。", "You lose your stance."));
438 creature_ptr->special_defense &= ~(KATA_MASK);
439 creature_ptr->update |= (PU_BONUS);
440 creature_ptr->update |= (PU_MONSTERS);
441 creature_ptr->redraw |= (PR_STATE);
442 creature_ptr->redraw |= (PR_STATUS);
443 creature_ptr->action = ACTION_NONE;
446 if (creature_ptr->concent)
447 reset_concentration(creature_ptr, TRUE);
448 if (hex_spelling_any(creature_ptr))
449 stop_hex_spell_all(creature_ptr);
452 } else if (new_aux < old_aux) {
454 msg_print(_("やっと朦朧状態から回復した。", "You are no longer stunned."));
456 disturb(creature_ptr, FALSE, FALSE);
462 creature_ptr->stun = v;
468 disturb(creature_ptr, FALSE, FALSE);
469 creature_ptr->update |= (PU_BONUS);
470 creature_ptr->redraw |= (PR_STUN);
471 handle_stuff(creature_ptr);
476 * @brief 出血の継続時間をセットする / Set "cut", notice observable changes
478 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
480 * Note the special code to only notice "range" changes.
482 bool set_cut(player_type *creature_ptr, TIME_EFFECT v)
484 int old_aux, new_aux;
486 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
487 if (creature_ptr->is_dead)
490 if ((creature_ptr->prace == RACE_GOLEM || creature_ptr->prace == RACE_SKELETON || creature_ptr->prace == RACE_SPECTRE
491 || (creature_ptr->prace == RACE_ZOMBIE && creature_ptr->lev > 11))
492 && !creature_ptr->mimic_form)
495 if (creature_ptr->cut > 1000) {
497 } else if (creature_ptr->cut > 200) {
499 } else if (creature_ptr->cut > 100) {
501 } else if (creature_ptr->cut > 50) {
503 } else if (creature_ptr->cut > 25) {
505 } else if (creature_ptr->cut > 10) {
507 } else if (creature_ptr->cut > 0) {
515 } else if (v > 200) {
517 } else if (v > 100) {
531 if (new_aux > old_aux) {
534 msg_print(_("かすり傷を負ってしまった。", "You have been given a graze."));
537 msg_print(_("軽い傷を負ってしまった。", "You have been given a light cut."));
540 msg_print(_("ひどい傷を負ってしまった。", "You have been given a bad cut."));
543 msg_print(_("大変な傷を負ってしまった。", "You have been given a nasty cut."));
546 msg_print(_("重大な傷を負ってしまった。", "You have been given a severe cut."));
549 msg_print(_("ひどい深手を負ってしまった。", "You have been given a deep gash."));
552 msg_print(_("致命的な傷を負ってしまった。", "You have been given a mortal wound."));
557 if (randint1(1000) < v || one_in_(16)) {
558 if (!creature_ptr->sustain_chr) {
559 msg_print(_("ひどい傷跡が残ってしまった。", "You have been horribly scarred."));
560 do_dec_stat(creature_ptr, A_CHR);
563 } else if (new_aux < old_aux) {
565 msg_format(_("やっと%s。", "You are no longer bleeding."), creature_ptr->prace == RACE_ANDROID ? "怪我が直った" : "出血が止まった");
567 disturb(creature_ptr, FALSE, FALSE);
573 creature_ptr->cut = v;
578 disturb(creature_ptr, FALSE, FALSE);
579 creature_ptr->update |= (PU_BONUS);
580 creature_ptr->redraw |= (PR_CUT);
581 handle_stuff(creature_ptr);