OSDN Git Service

[Refactor] #40466 Separated buff-setter.c/h from player-effects.c/h
[hengband/hengband.git] / src / player / player-effects.c
1 /*!
2  * @brief プレイヤーのステータス管理 / effects of various "objects"
3  * @date 2014/01/01
4  * @author
5  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6  *
7  * This software may be copied and distributed for educational, research,
8  * and not for profit purposes provided that this copyright and statement
9  * are included in all such copies.  Other copyrights may also apply.
10  *
11  * 2013 Deskull rearranged comment for Doxygen.
12  */
13
14 #include "player/player-effects.h"
15 #include "autopick/autopick-reader-writer.h"
16 #include "birth/birth-body-spec.h"
17 #include "birth/birth-stat.h"
18 #include "birth/character-builder.h"
19 #include "cmd-building/cmd-building.h"
20 #include "cmd-io/cmd-dump.h"
21 #include "core/speed-table.h"
22 #include "core/stuff-handler.h"
23 #include "dungeon/quest.h"
24 #include "floor/floor.h"
25 #include "floor/wild.h"
26 #include "game-option/birth-options.h"
27 #include "game-option/disturbance-options.h"
28 #include "grid/grid.h"
29 #include "inventory/inventory-object.h"
30 #include "io/input-key-acceptor.h"
31 #include "io/report.h"
32 #include "io/save.h"
33 #include "locale/vowel-checker.h"
34 #include "mind/stances-table.h"
35 #include "mind/mind-force-trainer.h"
36 #include "mind/mind-sniper.h"
37 #include "monster/monster-status.h"
38 #include "mutation/mutation.h"
39 #include "object-enchant/artifact.h"
40 #include "object-enchant/item-feeling.h"
41 #include "object-enchant/object-ego.h"
42 #include "object-enchant/special-object-flags.h"
43 #include "object-enchant/trg-types.h"
44 #include "object-hook/hook-checker.h"
45 #include "object-hook/hook-enchant.h"
46 #include "object-hook/hook-weapon.h"
47 #include "object/object-generator.h"
48 #include "object/object-kind.h"
49 #include "object/object-value-calc.h"
50 #include "object/object-value.h"
51 #include "perception/object-perception.h"
52 #include "player/avatar.h"
53 #include "player/bad-status-setter.h"
54 #include "player/buff-setter.h"
55 #include "player/player-class.h"
56 #include "player/player-damage.h"
57 #include "player/player-move.h"
58 #include "player/player-personalities-types.h"
59 #include "player/player-personality.h"
60 #include "player/player-race-types.h"
61 #include "player/player-sex.h"
62 #include "player/player-status.h"
63 #include "player/race-info-table.h"
64 #include "realm/realm-song-numbers.h"
65 #include "spell-kind/spells-floor.h"
66 #include "spell-realm/spells-hex.h"
67 #include "spell/spells-status.h"
68 #include "sv-definition/sv-armor-types.h"
69 #include "sv-definition/sv-protector-types.h"
70 #include "sv-definition/sv-weapon-types.h"
71 #include "term/screen-processor.h"
72 #include "term/term-color-types.h"
73 #include "view/display-messages.h"
74 #include "world/world.h"
75
76 /*!
77  * @brief プレイヤーの継続行動を設定する。
78  * @param typ 継続行動のID\n
79  * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL
80  * から選択。
81  * @return なし
82  */
83 void set_action(player_type *creature_ptr, ACTION_IDX typ)
84 {
85     int prev_typ = creature_ptr->action;
86
87     if (typ == prev_typ) {
88         return;
89     } else {
90         switch (prev_typ) {
91         case ACTION_SEARCH: {
92             msg_print(_("探索をやめた。", "You no longer walk carefully."));
93             creature_ptr->redraw |= (PR_SPEED);
94             break;
95         }
96         case ACTION_REST: {
97             creature_ptr->resting = 0;
98             break;
99         }
100         case ACTION_LEARN: {
101             msg_print(_("学習をやめた。", "You stop learning."));
102             creature_ptr->new_mane = FALSE;
103             break;
104         }
105         case ACTION_KAMAE: {
106             msg_print(_("構えをといた。", "You stop assuming the special stance."));
107             creature_ptr->special_defense &= ~(KAMAE_MASK);
108             break;
109         }
110         case ACTION_KATA: {
111             msg_print(_("型を崩した。", "You stop assuming the special stance."));
112             creature_ptr->special_defense &= ~(KATA_MASK);
113             creature_ptr->update |= (PU_MONSTERS);
114             creature_ptr->redraw |= (PR_STATUS);
115             break;
116         }
117         case ACTION_SING: {
118             msg_print(_("歌うのをやめた。", "You stop singing."));
119             break;
120         }
121         case ACTION_HAYAGAKE: {
122             msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
123             take_turn(creature_ptr, 100);
124             break;
125         }
126         case ACTION_SPELL: {
127             msg_print(_("呪文の詠唱を中断した。", "You stopped casting."));
128             break;
129         }
130         }
131     }
132
133     creature_ptr->action = typ;
134
135     /* If we are requested other action, stop singing */
136     if (prev_typ == ACTION_SING)
137         stop_singing(creature_ptr);
138     if (prev_typ == ACTION_SPELL)
139         stop_hex_spell(creature_ptr);
140
141     switch (creature_ptr->action) {
142     case ACTION_SEARCH: {
143         msg_print(_("注意深く歩き始めた。", "You begin to walk carefully."));
144         creature_ptr->redraw |= (PR_SPEED);
145         break;
146     }
147     case ACTION_LEARN: {
148         msg_print(_("学習を始めた。", "You begin learning"));
149         break;
150     }
151     case ACTION_FISH: {
152         msg_print(_("水面に糸を垂らした...", "You begin fishing..."));
153         break;
154     }
155     case ACTION_HAYAGAKE: {
156         msg_print(_("足が羽のように軽くなった。", "You begin to walk extremely fast."));
157         break;
158     }
159     default: {
160         break;
161     }
162     }
163     creature_ptr->update |= (PU_BONUS);
164     creature_ptr->redraw |= (PR_STATE);
165 }
166
167 /*!
168  * @brief プレイヤーに魔力消去効果を与える。
169  * @return なし
170  */
171 void dispel_player(player_type *creature_ptr)
172 {
173     (void)set_fast(creature_ptr, 0, TRUE);
174     set_lightspeed(creature_ptr, 0, TRUE);
175     (void)set_slow(creature_ptr, 0, TRUE);
176     (void)set_shield(creature_ptr, 0, TRUE);
177     (void)set_blessed(creature_ptr, 0, TRUE);
178     (void)set_tsuyoshi(creature_ptr, 0, TRUE);
179     (void)set_hero(creature_ptr, 0, TRUE);
180     (void)set_shero(creature_ptr, 0, TRUE);
181     (void)set_protevil(creature_ptr, 0, TRUE);
182     (void)set_invuln(creature_ptr, 0, TRUE);
183     (void)set_wraith_form(creature_ptr, 0, TRUE);
184     (void)set_kabenuke(creature_ptr, 0, TRUE);
185     (void)set_tim_res_nether(creature_ptr, 0, TRUE);
186     (void)set_tim_res_time(creature_ptr, 0, TRUE);
187     (void)set_tim_reflect(creature_ptr, 0, TRUE);
188     (void)set_multishadow(creature_ptr, 0, TRUE);
189     (void)set_dustrobe(creature_ptr, 0, TRUE);
190
191     (void)set_tim_invis(creature_ptr, 0, TRUE);
192     (void)set_tim_infra(creature_ptr, 0, TRUE);
193     (void)set_tim_esp(creature_ptr, 0, TRUE);
194     (void)set_tim_regen(creature_ptr, 0, TRUE);
195     (void)set_tim_stealth(creature_ptr, 0, TRUE);
196     (void)set_tim_levitation(creature_ptr, 0, TRUE);
197     (void)set_tim_sh_touki(creature_ptr, 0, TRUE);
198     (void)set_tim_sh_fire(creature_ptr, 0, TRUE);
199     (void)set_tim_sh_holy(creature_ptr, 0, TRUE);
200     (void)set_tim_eyeeye(creature_ptr, 0, TRUE);
201     (void)set_magicdef(creature_ptr, 0, TRUE);
202     (void)set_resist_magic(creature_ptr, 0, TRUE);
203     (void)set_oppose_acid(creature_ptr, 0, TRUE);
204     (void)set_oppose_elec(creature_ptr, 0, TRUE);
205     (void)set_oppose_fire(creature_ptr, 0, TRUE);
206     (void)set_oppose_cold(creature_ptr, 0, TRUE);
207     (void)set_oppose_pois(creature_ptr, 0, TRUE);
208     (void)set_ultimate_res(creature_ptr, 0, TRUE);
209     (void)set_mimic(creature_ptr, 0, 0, TRUE);
210     (void)set_ele_attack(creature_ptr, 0, 0);
211     (void)set_ele_immune(creature_ptr, 0, 0);
212
213     if (creature_ptr->special_attack & ATTACK_CONFUSE) {
214         creature_ptr->special_attack &= ~(ATTACK_CONFUSE);
215         msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
216     }
217
218     if (music_singing_any(creature_ptr) || hex_spelling_any(creature_ptr)) {
219         concptr str = (music_singing_any(creature_ptr)) ? _("歌", "singing") : _("呪文", "casting");
220         INTERUPTING_SONG_EFFECT(creature_ptr) = SINGING_SONG_EFFECT(creature_ptr);
221         SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
222         msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
223
224         creature_ptr->action = ACTION_NONE;
225         creature_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
226         creature_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
227         creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
228         creature_ptr->energy_need += ENERGY_NEED();
229     }
230 }
231
232 /*!
233  * @brief 変身効果の継続時間と変身先をセットする / Set "tim_mimic", and "mimic_form", notice observable changes
234  * @param v 継続時間
235  * @param p 変身内容
236  * @param do_dec 現在の継続時間より長い値のみ上書きする
237  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
238  */
239 bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, MIMIC_RACE_IDX p, bool do_dec)
240 {
241     bool notice = FALSE;
242     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
243
244     if (creature_ptr->is_dead)
245         return FALSE;
246
247     if (v) {
248         if (creature_ptr->tim_mimic && (creature_ptr->mimic_form == p) && !do_dec) {
249             if (creature_ptr->tim_mimic > v)
250                 return FALSE;
251         } else if ((!creature_ptr->tim_mimic) || (creature_ptr->mimic_form != p)) {
252             msg_print(_("自分の体が変わってゆくのを感じた。", "You feel that your body changes."));
253             creature_ptr->mimic_form = p;
254             notice = TRUE;
255         }
256     }
257
258     else {
259         if (creature_ptr->tim_mimic) {
260             msg_print(_("変身が解けた。", "You are no longer transformed."));
261             if (creature_ptr->mimic_form == MIMIC_DEMON)
262                 set_oppose_fire(creature_ptr, 0, TRUE);
263             creature_ptr->mimic_form = 0;
264             notice = TRUE;
265             p = 0;
266         }
267     }
268
269     creature_ptr->tim_mimic = v;
270     if (!notice)
271         return FALSE;
272
273     if (disturb_state)
274         disturb(creature_ptr, FALSE, TRUE);
275
276     creature_ptr->redraw |= (PR_BASIC | PR_STATUS);
277     creature_ptr->update |= (PU_BONUS | PU_HP);
278
279     handle_stuff(creature_ptr);
280     return TRUE;
281 }
282
283 /*!
284  * @brief 狂戦士化の継続時間をセットする / Set "shero", notice observable changes
285  * @param v 継続時間/ 0ならば無条件にリセット
286  * @param do_dec FALSEの場合現在の継続時間より長い値のみ上書きする
287  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
288  */
289 bool set_shero(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
290 {
291     bool notice = FALSE;
292     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
293
294     if (creature_ptr->is_dead)
295         return FALSE;
296
297     if (creature_ptr->pclass == CLASS_BERSERKER)
298         v = 1;
299     if (v) {
300         if (creature_ptr->shero && !do_dec) {
301             if (creature_ptr->shero > v)
302                 return FALSE;
303         } else if (!creature_ptr->shero) {
304             msg_print(_("殺戮マシーンになった気がする!", "You feel like a killing machine!"));
305             notice = TRUE;
306         }
307     } else {
308         if (creature_ptr->shero) {
309             msg_print(_("野蛮な気持ちが消え失せた。", "You feel less berserk."));
310             notice = TRUE;
311         }
312     }
313
314     creature_ptr->shero = v;
315     creature_ptr->redraw |= (PR_STATUS);
316
317     if (!notice)
318         return FALSE;
319
320     if (disturb_state)
321         disturb(creature_ptr, FALSE, FALSE);
322     creature_ptr->update |= (PU_BONUS);
323     creature_ptr->update |= (PU_HP);
324     handle_stuff(creature_ptr);
325     return TRUE;
326 }
327
328 /*!
329  * @brief 対邪悪結界の継続時間をセットする / Set "protevil", notice observable changes
330  * @param v 継続時間
331  * @param do_dec 現在の継続時間より長い値のみ上書きする
332  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
333  */
334 bool set_protevil(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
335 {
336     bool notice = FALSE;
337     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
338
339     if (creature_ptr->is_dead)
340         return FALSE;
341
342     if (v) {
343         if (creature_ptr->protevil && !do_dec) {
344             if (creature_ptr->protevil > v)
345                 return FALSE;
346         } else if (!creature_ptr->protevil) {
347             msg_print(_("邪悪なる存在から守られているような感じがする!", "You feel safe from evil!"));
348             notice = TRUE;
349         }
350     } else {
351         if (creature_ptr->protevil) {
352             msg_print(_("邪悪なる存在から守られている感じがなくなった。", "You no longer feel safe from evil."));
353             notice = TRUE;
354         }
355     }
356
357     creature_ptr->protevil = v;
358     creature_ptr->redraw |= (PR_STATUS);
359
360     if (!notice)
361         return FALSE;
362
363     if (disturb_state)
364         disturb(creature_ptr, FALSE, FALSE);
365     handle_stuff(creature_ptr);
366     return TRUE;
367 }
368
369 /*!
370  * @brief 幽体化の継続時間をセットする / Set "wraith_form", notice observable changes
371  * @param v 継続時間
372  * @param do_dec 現在の継続時間より長い値のみ上書きする
373  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
374  */
375 bool set_wraith_form(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
376 {
377     bool notice = FALSE;
378     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
379
380     if (creature_ptr->is_dead)
381         return FALSE;
382
383     if (v) {
384         if (creature_ptr->wraith_form && !do_dec) {
385             if (creature_ptr->wraith_form > v)
386                 return FALSE;
387         } else if (!creature_ptr->wraith_form) {
388             msg_print(_("物質界を離れて幽鬼のような存在になった!", "You leave the physical world and turn into a wraith-being!"));
389             notice = TRUE;
390             chg_virtue(creature_ptr, V_UNLIFE, 3);
391             chg_virtue(creature_ptr, V_HONOUR, -2);
392             chg_virtue(creature_ptr, V_SACRIFICE, -2);
393             chg_virtue(creature_ptr, V_VALOUR, -5);
394
395             creature_ptr->redraw |= (PR_MAP);
396             creature_ptr->update |= (PU_MONSTERS);
397
398             creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
399         }
400     } else {
401         if (creature_ptr->wraith_form) {
402             msg_print(_("不透明になった感じがする。", "You feel opaque."));
403             notice = TRUE;
404
405             creature_ptr->redraw |= (PR_MAP);
406             creature_ptr->update |= (PU_MONSTERS);
407
408             creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
409         }
410     }
411
412     creature_ptr->wraith_form = v;
413     creature_ptr->redraw |= (PR_STATUS);
414
415     if (!notice)
416         return FALSE;
417
418     if (disturb_state)
419         disturb(creature_ptr, FALSE, FALSE);
420     creature_ptr->update |= (PU_BONUS);
421     handle_stuff(creature_ptr);
422     return TRUE;
423 }
424
425 /*!
426  * @brief 無傷球の継続時間をセットする / Set "invuln", notice observable changes
427  * @param v 継続時間
428  * @param do_dec 現在の継続時間より長い値のみ上書きする
429  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
430  */
431 bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
432 {
433     bool notice = FALSE;
434     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
435
436     if (creature_ptr->is_dead)
437         return FALSE;
438
439     if (v) {
440         if (creature_ptr->invuln && !do_dec) {
441             if (creature_ptr->invuln > v)
442                 return FALSE;
443         } else if (!is_invuln(creature_ptr)) {
444             msg_print(_("無敵だ!", "Invulnerability!"));
445             notice = TRUE;
446
447             chg_virtue(creature_ptr, V_UNLIFE, -2);
448             chg_virtue(creature_ptr, V_HONOUR, -2);
449             chg_virtue(creature_ptr, V_SACRIFICE, -3);
450             chg_virtue(creature_ptr, V_VALOUR, -5);
451
452             creature_ptr->redraw |= (PR_MAP);
453             creature_ptr->update |= (PU_MONSTERS);
454
455             creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
456         }
457     } else {
458         if (creature_ptr->invuln && !music_singing(creature_ptr, MUSIC_INVULN)) {
459             msg_print(_("無敵ではなくなった。", "The invulnerability wears off."));
460             notice = TRUE;
461
462             creature_ptr->redraw |= (PR_MAP);
463             creature_ptr->update |= (PU_MONSTERS);
464
465             creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
466
467             creature_ptr->energy_need += ENERGY_NEED();
468         }
469     }
470
471     creature_ptr->invuln = v;
472     creature_ptr->redraw |= (PR_STATUS);
473
474     if (!notice)
475         return FALSE;
476
477     if (disturb_state)
478         disturb(creature_ptr, FALSE, FALSE);
479     creature_ptr->update |= (PU_BONUS);
480     handle_stuff(creature_ptr);
481     return TRUE;
482 }
483
484 /*!
485  * @brief 時限ESPの継続時間をセットする / Set "tim_esp", notice observable changes
486  * @param v 継続時間
487  * @param do_dec 現在の継続時間より長い値のみ上書きする
488  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
489  */
490 bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
491 {
492     bool notice = FALSE;
493     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
494
495     if (creature_ptr->is_dead)
496         return FALSE;
497
498     if (v) {
499         if (creature_ptr->tim_esp && !do_dec) {
500             if (creature_ptr->tim_esp > v)
501                 return FALSE;
502         } else if (!is_time_limit_esp(creature_ptr)) {
503             msg_print(_("意識が広がった気がする!", "You feel your consciousness expand!"));
504             notice = TRUE;
505         }
506     } else {
507         if (creature_ptr->tim_esp && !music_singing(creature_ptr, MUSIC_MIND)) {
508             msg_print(_("意識は元に戻った。", "Your consciousness contracts again."));
509             notice = TRUE;
510         }
511     }
512
513     creature_ptr->tim_esp = v;
514     creature_ptr->redraw |= (PR_STATUS);
515
516     if (!notice)
517         return FALSE;
518
519     if (disturb_state)
520         disturb(creature_ptr, FALSE, FALSE);
521     creature_ptr->update |= (PU_BONUS);
522     creature_ptr->update |= (PU_MONSTERS);
523     handle_stuff(creature_ptr);
524     return TRUE;
525 }
526
527 /*!
528  * @brief 時限透明視の継続時間をセットする / Set "tim_invis", notice observable changes
529  * @param v 継続時間
530  * @param do_dec 現在の継続時間より長い値のみ上書きする
531  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
532  */
533 bool set_tim_invis(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
534 {
535     bool notice = FALSE;
536     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
537
538     if (creature_ptr->is_dead)
539         return FALSE;
540
541     if (v) {
542         if (creature_ptr->tim_invis && !do_dec) {
543             if (creature_ptr->tim_invis > v)
544                 return FALSE;
545         } else if (!creature_ptr->tim_invis) {
546             msg_print(_("目が非常に敏感になった気がする!", "Your eyes feel very sensitive!"));
547             notice = TRUE;
548         }
549     } else {
550         if (creature_ptr->tim_invis) {
551             msg_print(_("目の敏感さがなくなったようだ。", "Your eyes feel less sensitive."));
552             notice = TRUE;
553         }
554     }
555
556     creature_ptr->tim_invis = v;
557     creature_ptr->redraw |= (PR_STATUS);
558
559     if (!notice)
560         return FALSE;
561
562     if (disturb_state)
563         disturb(creature_ptr, FALSE, FALSE);
564     creature_ptr->update |= (PU_BONUS);
565     creature_ptr->update |= (PU_MONSTERS);
566     handle_stuff(creature_ptr);
567     return TRUE;
568 }
569
570 /*!
571  * @brief 時限赤外線視力の継続時間をセットする / Set "tim_infra", notice observable changes
572  * @param v 継続時間
573  * @param do_dec 現在の継続時間より長い値のみ上書きする
574  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
575  */
576 bool set_tim_infra(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
577 {
578     bool notice = FALSE;
579     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
580
581     if (creature_ptr->is_dead)
582         return FALSE;
583
584     if (v) {
585         if (creature_ptr->tim_infra && !do_dec) {
586             if (creature_ptr->tim_infra > v)
587                 return FALSE;
588         } else if (!creature_ptr->tim_infra) {
589             msg_print(_("目がランランと輝き始めた!", "Your eyes begin to tingle!"));
590             notice = TRUE;
591         }
592     } else {
593         if (creature_ptr->tim_infra) {
594             msg_print(_("目の輝きがなくなった。", "Your eyes stop tingling."));
595             notice = TRUE;
596         }
597     }
598
599     creature_ptr->tim_infra = v;
600     creature_ptr->redraw |= (PR_STATUS);
601
602     if (!notice)
603         return FALSE;
604
605     if (disturb_state)
606         disturb(creature_ptr, FALSE, FALSE);
607     creature_ptr->update |= (PU_BONUS);
608     creature_ptr->update |= (PU_MONSTERS);
609     handle_stuff(creature_ptr);
610     return TRUE;
611 }
612
613 /*!
614  * @brief 時限急回復の継続時間をセットする / Set "tim_regen", notice observable changes
615  * @param v 継続時間
616  * @param do_dec 現在の継続時間より長い値のみ上書きする
617  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
618  */
619 bool set_tim_regen(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
620 {
621     bool notice = FALSE;
622     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
623
624     if (creature_ptr->is_dead)
625         return FALSE;
626
627     if (v) {
628         if (creature_ptr->tim_regen && !do_dec) {
629             if (creature_ptr->tim_regen > v)
630                 return FALSE;
631         } else if (!creature_ptr->tim_regen) {
632             msg_print(_("回復力が上がった!", "You feel yourself regenerating quickly!"));
633             notice = TRUE;
634         }
635     } else {
636         if (creature_ptr->tim_regen) {
637             msg_print(_("素早く回復する感じがなくなった。", "You feel yourself regenerating slowly."));
638             notice = TRUE;
639         }
640     }
641
642     creature_ptr->tim_regen = v;
643     creature_ptr->redraw |= (PR_STATUS);
644
645     if (!notice)
646         return FALSE;
647
648     if (disturb_state)
649         disturb(creature_ptr, FALSE, FALSE);
650     creature_ptr->update |= (PU_BONUS);
651     handle_stuff(creature_ptr);
652     return TRUE;
653 }
654
655 /*!
656  * @brief 隠密の歌の継続時間をセットする / Set "tim_stealth", notice observable changes
657  * @param v 継続時間
658  * @param do_dec 現在の継続時間より長い値のみ上書きする
659  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
660  */
661 bool set_tim_stealth(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
662 {
663     bool notice = FALSE;
664     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
665
666     if (creature_ptr->is_dead)
667         return FALSE;
668
669     if (v) {
670         if (creature_ptr->tim_stealth && !do_dec) {
671             if (creature_ptr->tim_stealth > v)
672                 return FALSE;
673         } else if (!is_time_limit_stealth(creature_ptr)) {
674             msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
675             notice = TRUE;
676         }
677     } else {
678         if (creature_ptr->tim_stealth && !music_singing(creature_ptr, MUSIC_STEALTH)) {
679             msg_print(_("足音が大きくなった。", "You no longer walk silently."));
680             notice = TRUE;
681         }
682     }
683
684     creature_ptr->tim_stealth = v;
685     creature_ptr->redraw |= (PR_STATUS);
686
687     if (!notice)
688         return FALSE;
689
690     if (disturb_state)
691         disturb(creature_ptr, FALSE, FALSE);
692     creature_ptr->update |= (PU_BONUS);
693     handle_stuff(creature_ptr);
694     return TRUE;
695 }
696
697 /*!
698  * @brief 超隠密状態をセットする
699  * @param set TRUEならば超隠密状態になる。
700  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
701  */
702 bool set_superstealth(player_type *creature_ptr, bool set)
703 {
704     bool notice = FALSE;
705
706     if (creature_ptr->is_dead)
707         return FALSE;
708
709     if (set) {
710         if (!(creature_ptr->special_defense & NINJA_S_STEALTH)) {
711             if (creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & CAVE_MNLT) {
712                 msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes."));
713                 creature_ptr->monlite = creature_ptr->old_monlite = TRUE;
714             } else {
715                 msg_print(_("敵の目から影の中に覆い隠された!", "You are mantled in shadow from ordinary eyes!"));
716                 creature_ptr->monlite = creature_ptr->old_monlite = FALSE;
717             }
718
719             notice = TRUE;
720             creature_ptr->special_defense |= NINJA_S_STEALTH;
721         }
722     } else {
723         if (creature_ptr->special_defense & NINJA_S_STEALTH) {
724             msg_print(_("再び敵の目にさらされるようになった。", "You are exposed to common sight once more."));
725             notice = TRUE;
726             creature_ptr->special_defense &= ~(NINJA_S_STEALTH);
727         }
728     }
729
730     if (!notice)
731         return FALSE;
732     creature_ptr->redraw |= (PR_STATUS);
733
734     if (disturb_state)
735         disturb(creature_ptr, FALSE, FALSE);
736     return TRUE;
737 }
738
739 /*!
740  * @brief 一時的浮遊の継続時間をセットする / Set "tim_levitation", notice observable changes
741  * @param v 継続時間
742  * @param do_dec 現在の継続時間より長い値のみ上書きする
743  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
744  */
745 bool set_tim_levitation(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
746 {
747     bool notice = FALSE;
748     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
749
750     if (creature_ptr->is_dead)
751         return FALSE;
752
753     if (v) {
754         if (creature_ptr->tim_levitation && !do_dec) {
755             if (creature_ptr->tim_levitation > v)
756                 return FALSE;
757         } else if (!creature_ptr->tim_levitation) {
758             msg_print(_("体が宙に浮き始めた。", "You begin to fly!"));
759             notice = TRUE;
760         }
761     } else {
762         if (creature_ptr->tim_levitation) {
763             msg_print(_("もう宙に浮かべなくなった。", "You stop flying."));
764             notice = TRUE;
765         }
766     }
767
768     creature_ptr->tim_levitation = v;
769     creature_ptr->redraw |= (PR_STATUS);
770
771     if (!notice)
772         return FALSE;
773
774     if (disturb_state)
775         disturb(creature_ptr, FALSE, FALSE);
776     creature_ptr->update |= (PU_BONUS);
777     handle_stuff(creature_ptr);
778     return TRUE;
779 }
780
781 /*!
782  * @brief 一時的闘気のオーラの継続時間をセットする / Set "tim_sh_touki", notice observable changes
783  * @param v 継続時間
784  * @param do_dec 現在の継続時間より長い値のみ上書きする
785  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
786  */
787 bool set_tim_sh_touki(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
788 {
789     bool notice = FALSE;
790     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
791
792     if (creature_ptr->is_dead)
793         return FALSE;
794
795     if (v) {
796         if (creature_ptr->tim_sh_touki && !do_dec) {
797             if (creature_ptr->tim_sh_touki > v)
798                 return FALSE;
799         } else if (!creature_ptr->tim_sh_touki) {
800             msg_print(_("体が闘気のオーラで覆われた。", "You are enveloped by an aura of the Force!"));
801             notice = TRUE;
802         }
803     } else {
804         if (creature_ptr->tim_sh_touki) {
805             msg_print(_("闘気が消えた。", "The aura of the Force disappeared."));
806             notice = TRUE;
807         }
808     }
809
810     creature_ptr->tim_sh_touki = v;
811     creature_ptr->redraw |= (PR_STATUS);
812
813     if (!notice)
814         return FALSE;
815
816     if (disturb_state)
817         disturb(creature_ptr, FALSE, FALSE);
818     handle_stuff(creature_ptr);
819     return TRUE;
820 }
821
822 /*!
823  * @brief 一時的火炎のオーラの継続時間をセットする / Set "tim_sh_fire", notice observable changes
824  * @param v 継続時間
825  * @param do_dec 現在の継続時間より長い値のみ上書きする
826  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
827  */
828 bool set_tim_sh_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
829 {
830     bool notice = FALSE;
831     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
832
833     if (creature_ptr->is_dead)
834         return FALSE;
835
836     if (v) {
837         if (creature_ptr->tim_sh_fire && !do_dec) {
838             if (creature_ptr->tim_sh_fire > v)
839                 return FALSE;
840         } else if (!creature_ptr->tim_sh_fire) {
841             msg_print(_("体が炎のオーラで覆われた。", "You are enveloped by a fiery aura!"));
842             notice = TRUE;
843         }
844     } else {
845         if (creature_ptr->tim_sh_fire) {
846             msg_print(_("炎のオーラが消えた。", "The fiery aura disappeared."));
847             notice = TRUE;
848         }
849     }
850
851     creature_ptr->tim_sh_fire = v;
852     creature_ptr->redraw |= (PR_STATUS);
853
854     if (!notice)
855         return FALSE;
856
857     if (disturb_state)
858         disturb(creature_ptr, FALSE, FALSE);
859     creature_ptr->update |= (PU_BONUS);
860     handle_stuff(creature_ptr);
861     return TRUE;
862 }
863
864 /*!
865  * @brief 一時的聖なるのオーラの継続時間をセットする / Set "tim_sh_holy", notice observable changes
866  * @param v 継続時間
867  * @param do_dec 現在の継続時間より長い値のみ上書きする
868  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
869  */
870 bool set_tim_sh_holy(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
871 {
872     bool notice = FALSE;
873     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
874
875     if (creature_ptr->is_dead)
876         return FALSE;
877
878     if (v) {
879         if (creature_ptr->tim_sh_holy && !do_dec) {
880             if (creature_ptr->tim_sh_holy > v)
881                 return FALSE;
882         } else if (!creature_ptr->tim_sh_holy) {
883             msg_print(_("体が聖なるオーラで覆われた。", "You are enveloped by a holy aura!"));
884             notice = TRUE;
885         }
886     } else {
887         if (creature_ptr->tim_sh_holy) {
888             msg_print(_("聖なるオーラが消えた。", "The holy aura disappeared."));
889             notice = TRUE;
890         }
891     }
892
893     creature_ptr->tim_sh_holy = v;
894     creature_ptr->redraw |= (PR_STATUS);
895
896     if (!notice)
897         return FALSE;
898
899     if (disturb_state)
900         disturb(creature_ptr, FALSE, FALSE);
901     creature_ptr->update |= (PU_BONUS);
902     handle_stuff(creature_ptr);
903     return TRUE;
904 }
905
906 /*!
907  * @brief 目には目をの残り時間をセットする / Set "tim_eyeeye", notice observable changes
908  * @param v 継続時間
909  * @param do_dec 現在の継続時間より長い値のみ上書きする
910  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
911  */
912 bool set_tim_eyeeye(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
913 {
914     bool notice = FALSE;
915     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
916
917     if (creature_ptr->is_dead)
918         return FALSE;
919
920     if (v) {
921         if (creature_ptr->tim_eyeeye && !do_dec) {
922             if (creature_ptr->tim_eyeeye > v)
923                 return FALSE;
924         } else if (!creature_ptr->tim_eyeeye) {
925             msg_print(_("法の守り手になった気がした!", "You feel like a keeper of commandments!"));
926             notice = TRUE;
927         }
928     } else {
929         if (creature_ptr->tim_eyeeye) {
930             msg_print(_("懲罰を執行することができなくなった。", "You no longer feel like a keeper."));
931             notice = TRUE;
932         }
933     }
934
935     creature_ptr->tim_eyeeye = v;
936     creature_ptr->redraw |= (PR_STATUS);
937
938     if (!notice)
939         return FALSE;
940
941     if (disturb_state)
942         disturb(creature_ptr, FALSE, FALSE);
943     creature_ptr->update |= (PU_BONUS);
944     handle_stuff(creature_ptr);
945     return TRUE;
946 }
947
948 /*!
949  * @brief 一時的魔法防御の継続時間をセットする / Set "resist_magic", notice observable changes
950  * @param v 継続時間
951  * @param do_dec 現在の継続時間より長い値のみ上書きする
952  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
953  */
954 bool set_resist_magic(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
955 {
956     bool notice = FALSE;
957     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
958
959     if (creature_ptr->is_dead)
960         return FALSE;
961
962     if (v) {
963         if (creature_ptr->resist_magic && !do_dec) {
964             if (creature_ptr->resist_magic > v)
965                 return FALSE;
966         } else if (!creature_ptr->resist_magic) {
967             msg_print(_("魔法への耐性がついた。", "You have been protected from magic!"));
968             notice = TRUE;
969         }
970     } else {
971         if (creature_ptr->resist_magic) {
972             msg_print(_("魔法に弱くなった。", "You are no longer protected from magic."));
973             notice = TRUE;
974         }
975     }
976
977     creature_ptr->resist_magic = v;
978     creature_ptr->redraw |= (PR_STATUS);
979
980     if (!notice)
981         return FALSE;
982
983     if (disturb_state)
984         disturb(creature_ptr, FALSE, FALSE);
985     creature_ptr->update |= (PU_BONUS);
986     handle_stuff(creature_ptr);
987     return TRUE;
988 }
989
990 /*!
991  * @brief 一時的反射の継続時間をセットする / Set "tim_reflect", notice observable changes
992  * @param v 継続時間
993  * @param do_dec 現在の継続時間より長い値のみ上書きする
994  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
995  */
996 bool set_tim_reflect(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
997 {
998     bool notice = FALSE;
999     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1000
1001     if (creature_ptr->is_dead)
1002         return FALSE;
1003
1004     if (v) {
1005         if (creature_ptr->tim_reflect && !do_dec) {
1006             if (creature_ptr->tim_reflect > v)
1007                 return FALSE;
1008         } else if (!creature_ptr->tim_reflect) {
1009             msg_print(_("体の表面が滑かになった気がする。", "Your body becames smooth."));
1010             notice = TRUE;
1011         }
1012     } else {
1013         if (creature_ptr->tim_reflect) {
1014             msg_print(_("体の表面が滑かでなくなった。", "Your body is no longer smooth."));
1015             notice = TRUE;
1016         }
1017     }
1018
1019     creature_ptr->tim_reflect = v;
1020     creature_ptr->redraw |= (PR_STATUS);
1021
1022     if (!notice)
1023         return FALSE;
1024
1025     if (disturb_state)
1026         disturb(creature_ptr, FALSE, FALSE);
1027     creature_ptr->update |= (PU_BONUS);
1028     handle_stuff(creature_ptr);
1029     return TRUE;
1030 }
1031
1032 /*
1033  * Set "multishadow", notice observable changes
1034  */
1035 bool set_multishadow(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1036 {
1037     bool notice = FALSE;
1038     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1039
1040     if (creature_ptr->is_dead)
1041         return FALSE;
1042
1043     if (v) {
1044         if (creature_ptr->multishadow && !do_dec) {
1045             if (creature_ptr->multishadow > v)
1046                 return FALSE;
1047         } else if (!creature_ptr->multishadow) {
1048             msg_print(_("あなたの周りに幻影が生まれた。", "Your Shadow enveloped you."));
1049             notice = TRUE;
1050         }
1051     } else {
1052         if (creature_ptr->multishadow) {
1053             msg_print(_("幻影が消えた。", "Your Shadow disappears."));
1054             notice = TRUE;
1055         }
1056     }
1057
1058     creature_ptr->multishadow = v;
1059     creature_ptr->redraw |= (PR_STATUS);
1060
1061     if (!notice)
1062         return FALSE;
1063
1064     if (disturb_state)
1065         disturb(creature_ptr, FALSE, FALSE);
1066     creature_ptr->update |= (PU_BONUS);
1067     handle_stuff(creature_ptr);
1068     return TRUE;
1069 }
1070
1071 /*!
1072  * @brief 一時的破片のオーラの継続時間をセットする / Set "dustrobe", notice observable changes
1073  * @param v 継続時間
1074  * @param do_dec 現在の継続時間より長い値のみ上書きする
1075  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1076  */
1077 bool set_dustrobe(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1078 {
1079     bool notice = FALSE;
1080     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1081
1082     if (creature_ptr->is_dead)
1083         return FALSE;
1084
1085     if (v) {
1086         if (creature_ptr->dustrobe && !do_dec) {
1087             if (creature_ptr->dustrobe > v)
1088                 return FALSE;
1089         } else if (!creature_ptr->dustrobe) {
1090             msg_print(_("体が鏡のオーラで覆われた。", "You were enveloped by mirror shards."));
1091             notice = TRUE;
1092         }
1093     } else {
1094         if (creature_ptr->dustrobe) {
1095             msg_print(_("鏡のオーラが消えた。", "The mirror shards disappear."));
1096             notice = TRUE;
1097         }
1098     }
1099
1100     creature_ptr->dustrobe = v;
1101     creature_ptr->redraw |= (PR_STATUS);
1102
1103     if (!notice)
1104         return FALSE;
1105
1106     if (disturb_state)
1107         disturb(creature_ptr, FALSE, FALSE);
1108     creature_ptr->update |= (PU_BONUS);
1109     handle_stuff(creature_ptr);
1110     return TRUE;
1111 }
1112
1113 /*!
1114  * @brief 一時的壁抜けの継続時間をセットする / Set "kabenuke", notice observable changes
1115  * @param v 継続時間
1116  * @param do_dec 現在の継続時間より長い値のみ上書きする
1117  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1118  */
1119 bool set_kabenuke(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1120 {
1121     bool notice = FALSE;
1122     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1123
1124     if (creature_ptr->is_dead)
1125         return FALSE;
1126
1127     if (v) {
1128         if (creature_ptr->kabenuke && !do_dec) {
1129             if (creature_ptr->kabenuke > v)
1130                 return FALSE;
1131         } else if (!creature_ptr->kabenuke) {
1132             msg_print(_("体が半物質の状態になった。", "You became ethereal."));
1133             notice = TRUE;
1134         }
1135     } else {
1136         if (creature_ptr->kabenuke) {
1137             msg_print(_("体が物質化した。", "You are no longer ethereal."));
1138             notice = TRUE;
1139         }
1140     }
1141
1142     creature_ptr->kabenuke = v;
1143     creature_ptr->redraw |= (PR_STATUS);
1144
1145     if (!notice)
1146         return FALSE;
1147
1148     if (disturb_state)
1149         disturb(creature_ptr, FALSE, FALSE);
1150     creature_ptr->update |= (PU_BONUS);
1151     handle_stuff(creature_ptr);
1152     return TRUE;
1153 }
1154
1155 /*!
1156  * @brief オクレ兄さんの継続時間をセットする / Set "tsuyoshi", notice observable changes
1157  * @param v 継続時間
1158  * @param do_dec 現在の継続時間より長い値のみ上書きする
1159  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1160  */
1161 bool set_tsuyoshi(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1162 {
1163     bool notice = FALSE;
1164     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1165
1166     if (creature_ptr->is_dead)
1167         return FALSE;
1168
1169     if (v) {
1170         if (creature_ptr->tsuyoshi && !do_dec) {
1171             if (creature_ptr->tsuyoshi > v)
1172                 return FALSE;
1173         } else if (!creature_ptr->tsuyoshi) {
1174             msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
1175             notice = TRUE;
1176             chg_virtue(creature_ptr, V_VITALITY, 2);
1177         }
1178     } else {
1179         if (creature_ptr->tsuyoshi) {
1180             msg_print(_("肉体が急速にしぼんでいった。", "Your body has quickly shriveled."));
1181
1182             (void)dec_stat(creature_ptr, A_CON, 20, TRUE);
1183             (void)dec_stat(creature_ptr, A_STR, 20, TRUE);
1184
1185             notice = TRUE;
1186             chg_virtue(creature_ptr, V_VITALITY, -3);
1187         }
1188     }
1189
1190     creature_ptr->tsuyoshi = v;
1191     creature_ptr->redraw |= (PR_STATUS);
1192
1193     if (!notice)
1194         return FALSE;
1195
1196     if (disturb_state)
1197         disturb(creature_ptr, FALSE, FALSE);
1198     creature_ptr->update |= (PU_BONUS);
1199     creature_ptr->update |= (PU_HP);
1200     handle_stuff(creature_ptr);
1201     return TRUE;
1202 }
1203
1204 /*!
1205  * @brief 一時的元素スレイの継続時間をセットする / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
1206  * @param attack_type スレイのタイプID
1207  * @param v 継続時間
1208  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1209  */
1210 bool set_ele_attack(player_type *creature_ptr, u32b attack_type, TIME_EFFECT v)
1211 {
1212     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1213
1214     if ((creature_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID)) {
1215         creature_ptr->special_attack &= ~(ATTACK_ACID);
1216         msg_print(_("酸で攻撃できなくなった。", "Your temporary acidic brand fades away."));
1217     }
1218
1219     if ((creature_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC)) {
1220         creature_ptr->special_attack &= ~(ATTACK_ELEC);
1221         msg_print(_("電撃で攻撃できなくなった。", "Your temporary electrical brand fades away."));
1222     }
1223
1224     if ((creature_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE)) {
1225         creature_ptr->special_attack &= ~(ATTACK_FIRE);
1226         msg_print(_("火炎で攻撃できなくなった。", "Your temporary fiery brand fades away."));
1227     }
1228
1229     if ((creature_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD)) {
1230         creature_ptr->special_attack &= ~(ATTACK_COLD);
1231         msg_print(_("冷気で攻撃できなくなった。", "Your temporary frost brand fades away."));
1232     }
1233
1234     if ((creature_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS)) {
1235         creature_ptr->special_attack &= ~(ATTACK_POIS);
1236         msg_print(_("毒で攻撃できなくなった。", "Your temporary poison brand fades away."));
1237     }
1238
1239     if ((v) && (attack_type)) {
1240         creature_ptr->special_attack |= (attack_type);
1241         creature_ptr->ele_attack = v;
1242 #ifdef JP
1243         msg_format("%sで攻撃できるようになった!",
1244             ((attack_type == ATTACK_ACID)
1245                     ? "酸"
1246                     : ((attack_type == ATTACK_ELEC)
1247                             ? "電撃"
1248                             : ((attack_type == ATTACK_FIRE) ? "火炎"
1249                                                             : ((attack_type == ATTACK_COLD) ? "冷気" : ((attack_type == ATTACK_POIS) ? "毒" : "(なし)"))))));
1250 #else
1251         msg_format("For a while, the blows you deal will %s",
1252             ((attack_type == ATTACK_ACID)
1253                     ? "melt with acid!"
1254                     : ((attack_type == ATTACK_ELEC)
1255                             ? "shock your foes!"
1256                             : ((attack_type == ATTACK_FIRE)
1257                                     ? "burn with fire!"
1258                                     : ((attack_type == ATTACK_COLD) ? "chill to the bone!"
1259                                                                     : ((attack_type == ATTACK_POIS) ? "poison your enemies!" : "do nothing special."))))));
1260 #endif
1261     }
1262
1263     if (disturb_state)
1264         disturb(creature_ptr, FALSE, FALSE);
1265     creature_ptr->redraw |= (PR_STATUS);
1266     creature_ptr->update |= (PU_BONUS);
1267     handle_stuff(creature_ptr);
1268
1269     return TRUE;
1270 }
1271
1272 /*!
1273  * @brief 一時的元素免疫の継続時間をセットする / Set a temporary elemental brand.  Clear all other brands.  Print status messages. -LM-
1274  * @param immune_type 免疫のタイプID
1275  * @param v 継続時間
1276  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1277  */
1278 bool set_ele_immune(player_type *creature_ptr, u32b immune_type, TIME_EFFECT v)
1279 {
1280     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1281
1282     if ((creature_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID)) {
1283         creature_ptr->special_defense &= ~(DEFENSE_ACID);
1284         msg_print(_("酸の攻撃で傷つけられるようになった。。", "You are no longer immune to acid."));
1285     }
1286
1287     if ((creature_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC)) {
1288         creature_ptr->special_defense &= ~(DEFENSE_ELEC);
1289         msg_print(_("電撃の攻撃で傷つけられるようになった。。", "You are no longer immune to electricity."));
1290     }
1291
1292     if ((creature_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE)) {
1293         creature_ptr->special_defense &= ~(DEFENSE_FIRE);
1294         msg_print(_("火炎の攻撃で傷つけられるようになった。。", "You are no longer immune to fire."));
1295     }
1296
1297     if ((creature_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD)) {
1298         creature_ptr->special_defense &= ~(DEFENSE_COLD);
1299         msg_print(_("冷気の攻撃で傷つけられるようになった。。", "You are no longer immune to cold."));
1300     }
1301
1302     if ((creature_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS)) {
1303         creature_ptr->special_defense &= ~(DEFENSE_POIS);
1304         msg_print(_("毒の攻撃で傷つけられるようになった。。", "You are no longer immune to poison."));
1305     }
1306
1307     if ((v) && (immune_type)) {
1308         creature_ptr->special_defense |= (immune_type);
1309         creature_ptr->ele_immune = v;
1310         msg_format(_("%sの攻撃を受けつけなくなった!", "For a while, You are immune to %s"),
1311             ((immune_type == DEFENSE_ACID)
1312                     ? _("酸", "acid!")
1313                     : ((immune_type == DEFENSE_ELEC)
1314                             ? _("電撃", "electricity!")
1315                             : ((immune_type == DEFENSE_FIRE)
1316                                     ? _("火炎", "fire!")
1317                                     : ((immune_type == DEFENSE_COLD)
1318                                             ? _("冷気", "cold!")
1319                                             : ((immune_type == DEFENSE_POIS) ? _("毒", "poison!") : _("(なし)", "do nothing special.")))))));
1320     }
1321
1322     if (disturb_state)
1323         disturb(creature_ptr, FALSE, FALSE);
1324     creature_ptr->redraw |= (PR_STATUS);
1325     creature_ptr->update |= (PU_BONUS);
1326     handle_stuff(creature_ptr);
1327
1328     return TRUE;
1329 }
1330
1331 /*!
1332  * @brief 一時的酸耐性の継続時間をセットする / Set "oppose_acid", notice observable changes
1333  * @param v 継続時間
1334  * @param do_dec 現在の継続時間より長い値のみ上書きする
1335  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1336  */
1337 bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1338 {
1339     bool notice = FALSE;
1340     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1341     if (creature_ptr->is_dead)
1342         return FALSE;
1343
1344     if (v) {
1345         if (creature_ptr->oppose_acid && !do_dec) {
1346             if (creature_ptr->oppose_acid > v)
1347                 return FALSE;
1348         } else if (!is_oppose_acid(creature_ptr)) {
1349             msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
1350             notice = TRUE;
1351         }
1352     } else {
1353         if (creature_ptr->oppose_acid && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
1354             msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
1355             notice = TRUE;
1356         }
1357     }
1358
1359     creature_ptr->oppose_acid = v;
1360
1361     if (!notice)
1362         return FALSE;
1363     creature_ptr->redraw |= (PR_STATUS);
1364
1365     if (disturb_state)
1366         disturb(creature_ptr, FALSE, FALSE);
1367     handle_stuff(creature_ptr);
1368     return TRUE;
1369 }
1370
1371 /*!
1372  * @brief 一時的電撃耐性の継続時間をセットする / Set "oppose_elec", notice observable changes
1373  * @param v 継続時間
1374  * @param do_dec 現在の継続時間より長い値のみ上書きする
1375  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1376  */
1377 bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1378 {
1379     bool notice = FALSE;
1380     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1381
1382     if (creature_ptr->is_dead)
1383         return FALSE;
1384
1385     if (v) {
1386         if (creature_ptr->oppose_elec && !do_dec) {
1387             if (creature_ptr->oppose_elec > v)
1388                 return FALSE;
1389         } else if (!is_oppose_elec(creature_ptr)) {
1390             msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
1391             notice = TRUE;
1392         }
1393     } else {
1394         if (creature_ptr->oppose_elec && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
1395             msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
1396             notice = TRUE;
1397         }
1398     }
1399
1400     creature_ptr->oppose_elec = v;
1401
1402     if (!notice)
1403         return FALSE;
1404     creature_ptr->redraw |= (PR_STATUS);
1405
1406     if (disturb_state)
1407         disturb(creature_ptr, FALSE, FALSE);
1408     handle_stuff(creature_ptr);
1409     return TRUE;
1410 }
1411
1412 /*!
1413  * @brief 一時的火炎耐性の継続時間をセットする / Set "oppose_fire", notice observable changes
1414  * @param v 継続時間
1415  * @param do_dec 現在の継続時間より長い値のみ上書きする
1416  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1417  */
1418 bool set_oppose_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1419 {
1420     bool notice = FALSE;
1421     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1422     if (creature_ptr->is_dead)
1423         return FALSE;
1424
1425     if ((is_specific_player_race(creature_ptr, RACE_BALROG) && (creature_ptr->lev > 44)) || (creature_ptr->mimic_form == MIMIC_DEMON))
1426         v = 1;
1427     if (v) {
1428         if (creature_ptr->oppose_fire && !do_dec) {
1429             if (creature_ptr->oppose_fire > v)
1430                 return FALSE;
1431         } else if (!is_oppose_fire(creature_ptr)) {
1432             msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
1433             notice = TRUE;
1434         }
1435     } else {
1436         if (creature_ptr->oppose_fire && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
1437             msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
1438             notice = TRUE;
1439         }
1440     }
1441
1442     creature_ptr->oppose_fire = v;
1443
1444     if (!notice)
1445         return FALSE;
1446     creature_ptr->redraw |= (PR_STATUS);
1447
1448     if (disturb_state)
1449         disturb(creature_ptr, FALSE, FALSE);
1450     handle_stuff(creature_ptr);
1451     return TRUE;
1452 }
1453
1454 /*!
1455  * @brief 一時的冷気耐性の継続時間をセットする / Set "oppose_cold", notice observable changes
1456  * @param v 継続時間
1457  * @param do_dec 現在の継続時間より長い値のみ上書きする
1458  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1459  */
1460 bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1461 {
1462     bool notice = FALSE;
1463     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1464     if (creature_ptr->is_dead)
1465         return FALSE;
1466
1467     if (v) {
1468         if (creature_ptr->oppose_cold && !do_dec) {
1469             if (creature_ptr->oppose_cold > v)
1470                 return FALSE;
1471         } else if (!is_oppose_cold(creature_ptr)) {
1472             msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
1473             notice = TRUE;
1474         }
1475     } else {
1476         if (creature_ptr->oppose_cold && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
1477             msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
1478             notice = TRUE;
1479         }
1480     }
1481
1482     creature_ptr->oppose_cold = v;
1483
1484     if (!notice)
1485         return FALSE;
1486     creature_ptr->redraw |= (PR_STATUS);
1487
1488     if (disturb_state)
1489         disturb(creature_ptr, FALSE, FALSE);
1490     handle_stuff(creature_ptr);
1491     return TRUE;
1492 }
1493
1494 /*!
1495  * @brief 一時的毒耐性の継続時間をセットする / Set "oppose_pois", notice observable changes
1496  * @param v 継続時間
1497  * @param do_dec 現在の継続時間より長い値のみ上書きする
1498  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1499  */
1500 bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
1501 {
1502     bool notice = FALSE;
1503     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1504     if ((creature_ptr->pclass == CLASS_NINJA) && (creature_ptr->lev > 44))
1505         v = 1;
1506     if (creature_ptr->is_dead)
1507         return FALSE;
1508
1509     if (v) {
1510         if (creature_ptr->oppose_pois && !do_dec) {
1511             if (creature_ptr->oppose_pois > v)
1512                 return FALSE;
1513         } else if (!is_oppose_pois(creature_ptr)) {
1514             msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
1515             notice = TRUE;
1516         }
1517     } else {
1518         if (creature_ptr->oppose_pois && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
1519             msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
1520             notice = TRUE;
1521         }
1522     }
1523
1524     creature_ptr->oppose_pois = v;
1525     if (!notice)
1526         return FALSE;
1527     creature_ptr->redraw |= (PR_STATUS);
1528
1529     if (disturb_state)
1530         disturb(creature_ptr, FALSE, FALSE);
1531     handle_stuff(creature_ptr);
1532     return TRUE;
1533 }
1534
1535 /*!
1536  * @brief 空腹状態をセットする / Set "food", notice observable changes
1537  * @param v 継続時間
1538  * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
1539  * @details
1540  * Set "", notice observable changes\n
1541  *\n
1542  * The "food" variable can get as large as 20000, allowing the
1543  * addition of the most "filling" item, Elvish Waybread, which adds
1544  * 7500 food units, without overflowing the 32767 maximum limit.\n
1545  *\n
1546  * Perhaps we should disturb the player with various messages,
1547  * especially messages about hunger status changes.  \n
1548  *\n
1549  * Digestion of food is handled in "dungeon.c", in which, normally,
1550  * the player digests about 20 food units per 100 game turns, more
1551  * when "fast", more when "regenerating", less with "slow digestion",
1552  * but when the player is "gorged", he digests 100 food units per 10
1553  * game turns, or a full 1000 food units per 100 game turns.\n
1554  *\n
1555  * Note that the player's speed is reduced by 10 units while gorged,
1556  * so if the player eats a single food ration (5000 food units) when
1557  * full (15000 food units), he will be gorged for (5000/100)*10 = 500
1558  * game turns, or 500/(100/5) = 25 player turns (if nothing else is
1559  * affecting the player speed).\n
1560  */
1561 bool set_food(player_type *creature_ptr, TIME_EFFECT v)
1562 {
1563     int old_aux, new_aux;
1564
1565     bool notice = FALSE;
1566     v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
1567     if (creature_ptr->food < PY_FOOD_FAINT) {
1568         old_aux = 0;
1569     } else if (creature_ptr->food < PY_FOOD_WEAK) {
1570         old_aux = 1;
1571     } else if (creature_ptr->food < PY_FOOD_ALERT) {
1572         old_aux = 2;
1573     } else if (creature_ptr->food < PY_FOOD_FULL) {
1574         old_aux = 3;
1575     } else if (creature_ptr->food < PY_FOOD_MAX) {
1576         old_aux = 4;
1577     } else {
1578         old_aux = 5;
1579     }
1580
1581     if (v < PY_FOOD_FAINT) {
1582         new_aux = 0;
1583     } else if (v < PY_FOOD_WEAK) {
1584         new_aux = 1;
1585     } else if (v < PY_FOOD_ALERT) {
1586         new_aux = 2;
1587     } else if (v < PY_FOOD_FULL) {
1588         new_aux = 3;
1589     } else if (v < PY_FOOD_MAX) {
1590         new_aux = 4;
1591     } else {
1592         new_aux = 5;
1593     }
1594
1595     if (old_aux < 1 && new_aux > 0)
1596         chg_virtue(creature_ptr, V_PATIENCE, 2);
1597     else if (old_aux < 3 && (old_aux != new_aux))
1598         chg_virtue(creature_ptr, V_PATIENCE, 1);
1599     if (old_aux == 2)
1600         chg_virtue(creature_ptr, V_TEMPERANCE, 1);
1601     if (old_aux == 0)
1602         chg_virtue(creature_ptr, V_TEMPERANCE, -1);
1603
1604     if (new_aux > old_aux) {
1605         switch (new_aux) {
1606         case 1:
1607             msg_print(_("まだ空腹で倒れそうだ。", "You are still weak."));
1608             break;
1609         case 2:
1610             msg_print(_("まだ空腹だ。", "You are still hungry."));
1611             break;
1612         case 3:
1613             msg_print(_("空腹感がおさまった。", "You are no longer hungry."));
1614             break;
1615         case 4:
1616             msg_print(_("満腹だ!", "You are full!"));
1617             break;
1618
1619         case 5:
1620             msg_print(_("食べ過ぎだ!", "You have gorged yourself!"));
1621             chg_virtue(creature_ptr, V_HARMONY, -1);
1622             chg_virtue(creature_ptr, V_PATIENCE, -1);
1623             chg_virtue(creature_ptr, V_TEMPERANCE, -2);
1624             break;
1625         }
1626
1627         notice = TRUE;
1628     } else if (new_aux < old_aux) {
1629         switch (new_aux) {
1630         case 0:
1631             msg_print(_("あまりにも空腹で気を失ってしまった!", "You are getting faint from hunger!"));
1632             break;
1633         case 1:
1634             msg_print(_("お腹が空いて倒れそうだ。", "You are getting weak from hunger!"));
1635             break;
1636         case 2:
1637             msg_print(_("お腹が空いてきた。", "You are getting hungry."));
1638             break;
1639         case 3:
1640             msg_print(_("満腹感がなくなった。", "You are no longer full."));
1641             break;
1642         case 4:
1643             msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged."));
1644             break;
1645         }
1646
1647         if (creature_ptr->wild_mode && (new_aux < 2)) {
1648             change_wild_mode(creature_ptr, FALSE);
1649         }
1650
1651         notice = TRUE;
1652     }
1653
1654     creature_ptr->food = v;
1655     if (!notice)
1656         return FALSE;
1657
1658     if (disturb_state)
1659         disturb(creature_ptr, FALSE, FALSE);
1660     creature_ptr->update |= (PU_BONUS);
1661     creature_ptr->redraw |= (PR_HUNGER);
1662     handle_stuff(creature_ptr);
1663
1664     return TRUE;
1665 }
1666
1667 /*!
1668  * @brief プレイヤーの基本能力値を増加させる / Increases a stat by one randomized level -RAK-
1669  * @param stat 上昇させるステータスID
1670  * @return 実際に上昇した場合TRUEを返す。
1671  * @details
1672  * Note that this function (used by stat potions) now restores\n
1673  * the stat BEFORE increasing it.\n
1674  */
1675 bool inc_stat(player_type *creature_ptr, int stat)
1676 {
1677     BASE_STATUS gain;
1678     BASE_STATUS value = creature_ptr->stat_cur[stat];
1679
1680     if (value < creature_ptr->stat_max_max[stat]) {
1681         if (value < 18) {
1682             gain = ((randint0(100) < 75) ? 1 : 2);
1683             value += gain;
1684         } else if (value < (creature_ptr->stat_max_max[stat] - 2)) {
1685             gain = (((creature_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
1686             if (gain < 1)
1687                 gain = 1;
1688
1689             value += randint1(gain) + gain / 2;
1690             if (value > (creature_ptr->stat_max_max[stat] - 1))
1691                 value = creature_ptr->stat_max_max[stat] - 1;
1692         } else {
1693             value++;
1694         }
1695
1696         creature_ptr->stat_cur[stat] = value;
1697         if (value > creature_ptr->stat_max[stat]) {
1698             creature_ptr->stat_max[stat] = value;
1699         }
1700
1701         creature_ptr->update |= (PU_BONUS);
1702         return TRUE;
1703     }
1704
1705     return FALSE;
1706 }
1707
1708 /*!
1709  * @brief プレイヤーの基本能力値を減少させる / Decreases a stat by an amount indended to vary from 0 to 100 percent.
1710  * @param stat 減少させるステータスID
1711  * @param amount 減少させる基本量
1712  * @param permanent TRUEならば現在の最大値を減少させる
1713  * @return 実際に減少した場合TRUEを返す。
1714  * @details
1715  *\n
1716  * Amount could be a little higher in extreme cases to mangle very high\n
1717  * stats from massive assaults.  -CWS\n
1718  *\n
1719  * Note that "permanent" means that the *given* amount is permanent,\n
1720  * not that the new value becomes permanent.  This may not work exactly\n
1721  * as expected, due to "weirdness" in the algorithm, but in general,\n
1722  * if your stat is already drained, the "max" value will not drop all\n
1723  * the way down to the "cur" value.\n
1724  */
1725 bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent)
1726 {
1727     int loss;
1728     bool res = FALSE;
1729
1730     BASE_STATUS cur = creature_ptr->stat_cur[stat];
1731     BASE_STATUS max = creature_ptr->stat_max[stat];
1732     int same = (cur == max);
1733     if (cur > 3) {
1734         if (cur <= 18) {
1735             if (amount > 90)
1736                 cur--;
1737             if (amount > 50)
1738                 cur--;
1739             if (amount > 20)
1740                 cur--;
1741             cur--;
1742         } else {
1743             loss = (((cur - 18) / 2 + 1) / 2 + 1);
1744             if (loss < 1)
1745                 loss = 1;
1746
1747             loss = ((randint1(loss) + loss) * amount) / 100;
1748             if (loss < amount / 2)
1749                 loss = amount / 2;
1750
1751             cur = cur - loss;
1752             if (cur < 18)
1753                 cur = (amount <= 20) ? 18 : 17;
1754         }
1755
1756         if (cur < 3)
1757             cur = 3;
1758
1759         if (cur != creature_ptr->stat_cur[stat])
1760             res = TRUE;
1761     }
1762
1763     if (permanent && (max > 3)) {
1764         chg_virtue(creature_ptr, V_SACRIFICE, 1);
1765         if (stat == A_WIS || stat == A_INT)
1766             chg_virtue(creature_ptr, V_ENLIGHTEN, -2);
1767
1768         if (max <= 18) {
1769             if (amount > 90)
1770                 max--;
1771             if (amount > 50)
1772                 max--;
1773             if (amount > 20)
1774                 max--;
1775             max--;
1776         } else {
1777             loss = (((max - 18) / 2 + 1) / 2 + 1);
1778             loss = ((randint1(loss) + loss) * amount) / 100;
1779             if (loss < amount / 2)
1780                 loss = amount / 2;
1781
1782             max = max - loss;
1783             if (max < 18)
1784                 max = (amount <= 20) ? 18 : 17;
1785         }
1786
1787         if (same || (max < cur))
1788             max = cur;
1789
1790         if (max != creature_ptr->stat_max[stat])
1791             res = TRUE;
1792     }
1793
1794     if (res) {
1795         creature_ptr->stat_cur[stat] = cur;
1796         creature_ptr->stat_max[stat] = max;
1797         creature_ptr->redraw |= (PR_STATS);
1798         creature_ptr->update |= (PU_BONUS);
1799     }
1800
1801     return (res);
1802 }
1803
1804 /*!
1805  * @brief プレイヤーの基本能力値を回復させる / Restore a stat.  Return TRUE only if this actually makes a difference.
1806  * @param stat 回復ステータスID
1807  * @return 実際に回復した場合TRUEを返す。
1808  */
1809 bool res_stat(player_type *creature_ptr, int stat)
1810 {
1811     if (creature_ptr->stat_cur[stat] != creature_ptr->stat_max[stat]) {
1812         creature_ptr->stat_cur[stat] = creature_ptr->stat_max[stat];
1813         creature_ptr->update |= (PU_BONUS);
1814         creature_ptr->redraw |= (PR_STATS);
1815         return TRUE;
1816     }
1817
1818     return FALSE;
1819 }
1820
1821 /*
1822  * Increase players hit points, notice effects
1823  */
1824 bool hp_player(player_type *creature_ptr, int num)
1825 {
1826     int vir;
1827     vir = virtue_number(creature_ptr, V_VITALITY);
1828
1829     if (num <= 0)
1830         return FALSE;
1831
1832     if (vir) {
1833         num = num * (creature_ptr->virtues[vir - 1] + 1250) / 1250;
1834     }
1835
1836     if (creature_ptr->chp < creature_ptr->mhp) {
1837         if ((num > 0) && (creature_ptr->chp < (creature_ptr->mhp / 3)))
1838             chg_virtue(creature_ptr, V_TEMPERANCE, 1);
1839
1840         creature_ptr->chp += num;
1841         if (creature_ptr->chp >= creature_ptr->mhp) {
1842             creature_ptr->chp = creature_ptr->mhp;
1843             creature_ptr->chp_frac = 0;
1844         }
1845
1846         creature_ptr->redraw |= (PR_HP);
1847         creature_ptr->window |= (PW_PLAYER);
1848         if (num < 5) {
1849             msg_print(_("少し気分が良くなった。", "You feel a little better."));
1850         } else if (num < 15) {
1851             msg_print(_("気分が良くなった。", "You feel better."));
1852         } else if (num < 35) {
1853             msg_print(_("とても気分が良くなった。", "You feel much better."));
1854         } else {
1855             msg_print(_("ひじょうに気分が良くなった。", "You feel very good."));
1856         }
1857
1858         return TRUE;
1859     }
1860
1861     return FALSE;
1862 }
1863
1864 /*
1865  * Array of stat "descriptions"
1866  */
1867 static concptr desc_stat_pos[]
1868     = { _("強く", "stronger"), _("知的に", "smarter"), _("賢く", "wiser"), _("器用に", "more dextrous"), _("健康に", "healthier"), _("美しく", "cuter") };
1869
1870 /*
1871  * Array of stat "descriptions"
1872  */
1873 static concptr desc_stat_neg[]
1874     = { _("弱く", "weaker"), _("無知に", "stupider"), _("愚かに", "more naive"), _("不器用に", "clumsier"), _("不健康に", "more sickly"), _("醜く", "uglier") };
1875
1876 /*
1877  * Lose a "point"
1878  */
1879 bool do_dec_stat(player_type *creature_ptr, int stat)
1880 {
1881     bool sust = FALSE;
1882
1883     /* Access the "sustain" */
1884     switch (stat) {
1885     case A_STR:
1886         if (creature_ptr->sustain_str)
1887             sust = TRUE;
1888         break;
1889     case A_INT:
1890         if (creature_ptr->sustain_int)
1891             sust = TRUE;
1892         break;
1893     case A_WIS:
1894         if (creature_ptr->sustain_wis)
1895             sust = TRUE;
1896         break;
1897     case A_DEX:
1898         if (creature_ptr->sustain_dex)
1899             sust = TRUE;
1900         break;
1901     case A_CON:
1902         if (creature_ptr->sustain_con)
1903             sust = TRUE;
1904         break;
1905     case A_CHR:
1906         if (creature_ptr->sustain_chr)
1907             sust = TRUE;
1908         break;
1909     }
1910
1911     if (sust && (!ironman_nightmare || randint0(13))) {
1912         msg_format(_("%sなった気がしたが、すぐに元に戻った。", "You feel %s for a moment, but the feeling passes."), desc_stat_neg[stat]);
1913
1914         return TRUE;
1915     }
1916
1917     if (dec_stat(creature_ptr, stat, 10, (ironman_nightmare && !randint0(13)))) {
1918         msg_format(_("ひどく%sなった気がする。", "You feel %s."), desc_stat_neg[stat]);
1919
1920         return TRUE;
1921     }
1922
1923     return FALSE;
1924 }
1925
1926 /*
1927  * Restore lost "points" in a stat
1928  */
1929 bool do_res_stat(player_type *creature_ptr, int stat)
1930 {
1931     if (res_stat(creature_ptr, stat)) {
1932         msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
1933         return TRUE;
1934     }
1935
1936     return FALSE;
1937 }
1938
1939 /*
1940  * Gain a "point" in a stat
1941  */
1942 bool do_inc_stat(player_type *creature_ptr, int stat)
1943 {
1944     bool res = res_stat(creature_ptr, stat);
1945     if (inc_stat(creature_ptr, stat)) {
1946         if (stat == A_WIS) {
1947             chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
1948             chg_virtue(creature_ptr, V_FAITH, 1);
1949         } else if (stat == A_INT) {
1950             chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
1951             chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
1952         } else if (stat == A_CON)
1953             chg_virtue(creature_ptr, V_VITALITY, 1);
1954
1955         msg_format(_("ワーオ!とても%sなった!", "Wow! You feel %s!"), desc_stat_pos[stat]);
1956         return TRUE;
1957     }
1958
1959     if (res) {
1960         msg_format(_("元通りに%sなった気がする。", "You feel %s."), desc_stat_pos[stat]);
1961         return TRUE;
1962     }
1963
1964     return FALSE;
1965 }
1966
1967 /*
1968  * Restores any drained experience
1969  */
1970 bool restore_level(player_type *creature_ptr)
1971 {
1972     if (creature_ptr->exp < creature_ptr->max_exp) {
1973         msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
1974         creature_ptr->exp = creature_ptr->max_exp;
1975         check_experience(creature_ptr);
1976         return TRUE;
1977     }
1978
1979     return FALSE;
1980 }
1981
1982 /*
1983  * Forget everything
1984  */
1985 bool lose_all_info(player_type *creature_ptr)
1986 {
1987     chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
1988     chg_virtue(creature_ptr, V_ENLIGHTEN, -5);
1989     for (int i = 0; i < INVEN_TOTAL; i++) {
1990         object_type *o_ptr = &creature_ptr->inventory_list[i];
1991         if (!o_ptr->k_idx)
1992             continue;
1993         if (object_is_fully_known(o_ptr))
1994             continue;
1995
1996         o_ptr->feeling = FEEL_NONE;
1997         o_ptr->ident &= ~(IDENT_EMPTY);
1998         o_ptr->ident &= ~(IDENT_KNOWN);
1999         o_ptr->ident &= ~(IDENT_SENSE);
2000     }
2001
2002     creature_ptr->update |= (PU_BONUS);
2003     creature_ptr->update |= (PU_COMBINE | PU_REORDER);
2004     creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2005     wiz_dark(creature_ptr);
2006     return TRUE;
2007 }
2008
2009 void do_poly_wounds(player_type *creature_ptr)
2010 {
2011     s16b wounds = creature_ptr->cut;
2012     s16b hit_p = (creature_ptr->mhp - creature_ptr->chp);
2013     s16b change = damroll(creature_ptr->lev, 5);
2014     bool Nasty_effect = one_in_(5);
2015     if (!(wounds || hit_p || Nasty_effect))
2016         return;
2017
2018     msg_print(_("傷がより軽いものに変化した。", "Your wounds are polymorphed into less serious ones."));
2019     hp_player(creature_ptr, change);
2020     if (Nasty_effect) {
2021         msg_print(_("新たな傷ができた!", "A new wound was created!"));
2022         take_hit(creature_ptr, DAMAGE_LOSELIFE, change / 2, _("変化した傷", "a polymorphed wound"), -1);
2023         set_cut(creature_ptr, change);
2024     } else {
2025         set_cut(creature_ptr, creature_ptr->cut - (change / 2));
2026     }
2027 }
2028
2029 /*
2030  * Change player race
2031  */
2032 void change_race(player_type *creature_ptr, player_race_type new_race, concptr effect_msg)
2033 {
2034     concptr title = race_info[new_race].title;
2035     int old_race = creature_ptr->prace;
2036 #ifdef JP
2037     msg_format("あなたは%s%sに変化した!", effect_msg, title);
2038 #else
2039     msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
2040 #endif
2041
2042     chg_virtue(creature_ptr, V_CHANCE, 2);
2043     if (creature_ptr->prace < 32) {
2044         creature_ptr->old_race1 |= 1L << creature_ptr->prace;
2045     } else {
2046         creature_ptr->old_race2 |= 1L << (creature_ptr->prace - 32);
2047     }
2048
2049     creature_ptr->prace = new_race;
2050     rp_ptr = &race_info[creature_ptr->prace];
2051     creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
2052
2053     bool is_special_class = creature_ptr->pclass == CLASS_MONK;
2054     is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
2055     is_special_class |= creature_ptr->pclass == CLASS_NINJA;
2056     bool is_special_race = creature_ptr->prace == RACE_KLACKON;
2057     is_special_race |= creature_ptr->prace == RACE_SPRITE;
2058     if (is_special_class && is_special_race)
2059         creature_ptr->expfact -= 15;
2060
2061     get_height_weight(creature_ptr);
2062
2063     if (creature_ptr->pclass == CLASS_SORCERER)
2064         creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
2065     else
2066         creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
2067
2068     roll_hitdice(creature_ptr, 0L);
2069     check_experience(creature_ptr);
2070     creature_ptr->redraw |= (PR_BASIC);
2071     creature_ptr->update |= (PU_BONUS);
2072     handle_stuff(creature_ptr);
2073
2074     if (old_race != creature_ptr->prace)
2075         autopick_load_pref(creature_ptr, FALSE);
2076
2077     lite_spot(creature_ptr, creature_ptr->y, creature_ptr->x);
2078 }
2079
2080 void do_poly_self(player_type *creature_ptr)
2081 {
2082     int power = creature_ptr->lev;
2083
2084     msg_print(_("あなたは変化の訪れを感じた...", "You feel a change coming over you..."));
2085     chg_virtue(creature_ptr, V_CHANCE, 1);
2086
2087     if ((power > randint0(20)) && one_in_(3) && (creature_ptr->prace != RACE_ANDROID)) {
2088         char effect_msg[80] = "";
2089         player_race_type new_race;
2090
2091         power -= 10;
2092         if ((power > randint0(5)) && one_in_(4)) {
2093             power -= 2;
2094             if (creature_ptr->psex == SEX_MALE) {
2095                 creature_ptr->psex = SEX_FEMALE;
2096                 sp_ptr = &sex_info[creature_ptr->psex];
2097                 sprintf(effect_msg, _("女性の", "female "));
2098             } else {
2099                 creature_ptr->psex = SEX_MALE;
2100                 sp_ptr = &sex_info[creature_ptr->psex];
2101                 sprintf(effect_msg, _("男性の", "male "));
2102             }
2103         }
2104
2105         if ((power > randint0(30)) && one_in_(5)) {
2106             int tmp = 0;
2107             power -= 15;
2108             while (tmp < A_MAX) {
2109                 if (one_in_(2)) {
2110                     (void)dec_stat(creature_ptr, tmp, randint1(6) + 6, one_in_(3));
2111                     power -= 1;
2112                 }
2113                 tmp++;
2114             }
2115
2116             (void)dec_stat(creature_ptr, A_CHR, randint1(6), TRUE);
2117
2118             if (effect_msg[0]) {
2119                 char tmp_msg[10];
2120                 sprintf(tmp_msg, _("%s", "%s "), effect_msg);
2121                 sprintf(effect_msg, _("奇形の%s", "deformed %s "), tmp_msg);
2122             } else {
2123                 sprintf(effect_msg, _("奇形の", "deformed "));
2124             }
2125         }
2126
2127         while ((power > randint0(20)) && one_in_(10)) {
2128             power -= 10;
2129
2130             if (!lose_mutation(creature_ptr, 0))
2131                 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2132         }
2133
2134         do {
2135             new_race = (player_race_type)randint0(MAX_RACES);
2136         } while ((new_race == creature_ptr->prace) || (new_race == RACE_ANDROID));
2137
2138         change_race(creature_ptr, new_race, effect_msg);
2139     }
2140
2141     if ((power > randint0(30)) && one_in_(6)) {
2142         int tmp = 0;
2143         power -= 20;
2144         msg_format(_("%sの構成が変化した!", "Your internal organs are rearranged!"), creature_ptr->prace == RACE_ANDROID ? "機械" : "内臓");
2145
2146         while (tmp < A_MAX) {
2147             (void)dec_stat(creature_ptr, tmp, randint1(6) + 6, one_in_(3));
2148             tmp++;
2149         }
2150         if (one_in_(6)) {
2151             msg_print(_("現在の姿で生きていくのは困難なようだ!", "You find living difficult in your present form!"));
2152             take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(randint1(10), creature_ptr->lev), _("致命的な突然変異", "a lethal mutation"), -1);
2153
2154             power -= 10;
2155         }
2156     }
2157
2158     if ((power > randint0(20)) && one_in_(4)) {
2159         power -= 10;
2160
2161         get_max_stats(creature_ptr);
2162         roll_hitdice(creature_ptr, 0L);
2163     }
2164
2165     while ((power > randint0(15)) && one_in_(3)) {
2166         power -= 7;
2167         (void)gain_mutation(creature_ptr, 0);
2168     }
2169
2170     if (power > randint0(5)) {
2171         power -= 5;
2172         do_poly_wounds(creature_ptr);
2173     }
2174
2175     while (power > 0) {
2176         status_shuffle(creature_ptr);
2177         power--;
2178     }
2179 }
2180
2181 /*
2182  * Gain experience
2183  */
2184 void gain_exp_64(player_type *creature_ptr, s32b amount, u32b amount_frac)
2185 {
2186     if (creature_ptr->is_dead)
2187         return;
2188     if (creature_ptr->prace == RACE_ANDROID)
2189         return;
2190
2191     s64b_add(&(creature_ptr->exp), &(creature_ptr->exp_frac), amount, amount_frac);
2192
2193     if (creature_ptr->exp < creature_ptr->max_exp) {
2194         creature_ptr->max_exp += amount / 5;
2195     }
2196
2197     check_experience(creature_ptr);
2198 }
2199
2200 /*
2201  * Gain experience
2202  */
2203 void gain_exp(player_type *creature_ptr, s32b amount) { gain_exp_64(creature_ptr, amount, 0L); }
2204
2205 void calc_android_exp(player_type *creature_ptr)
2206 {
2207     u32b total_exp = 0;
2208     if (creature_ptr->is_dead)
2209         return;
2210     if (creature_ptr->prace != RACE_ANDROID)
2211         return;
2212
2213     for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
2214         object_type *o_ptr = &creature_ptr->inventory_list[i];
2215         object_type forge;
2216         object_type *q_ptr = &forge;
2217         u32b value, exp;
2218         DEPTH level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
2219
2220         if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE))
2221             continue;
2222         if (!o_ptr->k_idx)
2223             continue;
2224
2225         object_wipe(q_ptr);
2226         object_copy(q_ptr, o_ptr);
2227         q_ptr->discount = 0;
2228         q_ptr->curse_flags = 0L;
2229
2230         if (object_is_fixed_artifact(o_ptr)) {
2231             level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
2232             level += MIN(20, a_info[o_ptr->name1].rarity / (a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
2233         } else if (object_is_ego(o_ptr)) {
2234             level += MAX(3, (e_info[o_ptr->name2].rating - 5) / 2);
2235         } else if (o_ptr->art_name) {
2236             s32b total_flags = flag_cost(creature_ptr, o_ptr, o_ptr->pval);
2237             int fake_level;
2238
2239             if (!object_is_weapon_ammo(o_ptr)) {
2240                 if (total_flags < 15000)
2241                     fake_level = 10;
2242                 else if (total_flags < 35000)
2243                     fake_level = 25;
2244                 else
2245                     fake_level = 40;
2246             } else {
2247                 if (total_flags < 20000)
2248                     fake_level = 10;
2249                 else if (total_flags < 45000)
2250                     fake_level = 25;
2251                 else
2252                     fake_level = 40;
2253             }
2254
2255             level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
2256         }
2257
2258         value = object_value_real(creature_ptr, q_ptr);
2259         if (value <= 0)
2260             continue;
2261         if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (creature_ptr->pseikaku != PERSONALITY_SEXY))
2262             value /= 32;
2263         if (value > 5000000L)
2264             value = 5000000L;
2265         if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD))
2266             level /= 2;
2267
2268         if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) || (o_ptr->tval == TV_DRAG_ARMOR) || ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
2269             || ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) || ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
2270             || ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) || ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE))) {
2271             if (level > 65)
2272                 level = 35 + (level - 65) / 5;
2273             else if (level > 35)
2274                 level = 25 + (level - 35) / 3;
2275             else if (level > 15)
2276                 level = 15 + (level - 15) / 2;
2277             exp = MIN(100000L, value) / 2 * level * level;
2278             if (value > 100000L)
2279                 exp += (value - 100000L) / 8 * level * level;
2280         } else {
2281             exp = MIN(100000L, value) * level;
2282             if (value > 100000L)
2283                 exp += (value - 100000L) / 4 * level;
2284         }
2285         if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (has_melee_weapon(creature_ptr, i))) || (i == INVEN_BOW))
2286             total_exp += exp / 48;
2287         else
2288             total_exp += exp / 16;
2289         if (i == INVEN_BODY)
2290             total_exp += exp / 32;
2291     }
2292
2293     creature_ptr->exp = creature_ptr->max_exp = total_exp;
2294     check_experience(creature_ptr);
2295 }
2296
2297 /*
2298  * Lose experience
2299  */
2300 void lose_exp(player_type *creature_ptr, s32b amount)
2301 {
2302     if (creature_ptr->prace == RACE_ANDROID)
2303         return;
2304     if (amount > creature_ptr->exp)
2305         amount = creature_ptr->exp;
2306
2307     creature_ptr->exp -= amount;
2308
2309     check_experience(creature_ptr);
2310 }
2311
2312 /*
2313  * Drain experience
2314  * If resisted to draining, return FALSE
2315  */
2316 bool drain_exp(player_type *creature_ptr, s32b drain, s32b slip, int hold_exp_prob)
2317 {
2318     if (creature_ptr->prace == RACE_ANDROID)
2319         return FALSE;
2320
2321     if (creature_ptr->hold_exp && (randint0(100) < hold_exp_prob)) {
2322         msg_print(_("しかし自己の経験値を守りきった!", "You keep hold of your experience!"));
2323         return FALSE;
2324     }
2325
2326     if (creature_ptr->hold_exp) {
2327         msg_print(_("経験値を少し吸い取られた気がする!", "You feel your experience slipping away!"));
2328         lose_exp(creature_ptr, slip);
2329     } else {
2330         msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away!"));
2331         lose_exp(creature_ptr, drain);
2332     }
2333
2334     return TRUE;
2335 }
2336
2337 bool set_ultimate_res(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
2338 {
2339     bool notice = FALSE;
2340     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2341
2342     if (creature_ptr->is_dead)
2343         return FALSE;
2344
2345     if (v) {
2346         if (creature_ptr->ult_res && !do_dec) {
2347             if (creature_ptr->ult_res > v)
2348                 return FALSE;
2349         } else if (!creature_ptr->ult_res) {
2350             msg_print(_("あらゆることに対して耐性がついた気がする!", "You feel resistant!"));
2351             notice = TRUE;
2352         }
2353     }
2354
2355     else {
2356         if (creature_ptr->ult_res) {
2357             msg_print(_("あらゆることに対する耐性が薄れた気がする。", "You feel less resistant"));
2358             notice = TRUE;
2359         }
2360     }
2361
2362     creature_ptr->ult_res = v;
2363     creature_ptr->redraw |= (PR_STATUS);
2364
2365     if (!notice)
2366         return FALSE;
2367
2368     if (disturb_state)
2369         disturb(creature_ptr, FALSE, FALSE);
2370     creature_ptr->update |= (PU_BONUS);
2371     handle_stuff(creature_ptr);
2372
2373     return TRUE;
2374 }
2375
2376 bool set_tim_res_nether(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
2377 {
2378     bool notice = FALSE;
2379     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2380
2381     if (creature_ptr->is_dead)
2382         return FALSE;
2383
2384     if (v) {
2385         if (creature_ptr->tim_res_nether && !do_dec) {
2386             if (creature_ptr->tim_res_nether > v)
2387                 return FALSE;
2388         } else if (!creature_ptr->tim_res_nether) {
2389             msg_print(_("地獄の力に対して耐性がついた気がする!", "You feel nether resistant!"));
2390             notice = TRUE;
2391         }
2392     }
2393
2394     else {
2395         if (creature_ptr->tim_res_nether) {
2396             msg_print(_("地獄の力に対する耐性が薄れた気がする。", "You feel less nether resistant"));
2397             notice = TRUE;
2398         }
2399     }
2400
2401     creature_ptr->tim_res_nether = v;
2402     creature_ptr->redraw |= (PR_STATUS);
2403
2404     if (!notice)
2405         return FALSE;
2406
2407     if (disturb_state)
2408         disturb(creature_ptr, FALSE, FALSE);
2409     creature_ptr->update |= (PU_BONUS);
2410     handle_stuff(creature_ptr);
2411     return TRUE;
2412 }
2413
2414 bool set_tim_res_time(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
2415 {
2416     bool notice = FALSE;
2417     v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2418     if (creature_ptr->is_dead)
2419         return FALSE;
2420
2421     if (v) {
2422         if (creature_ptr->tim_res_time && !do_dec) {
2423             if (creature_ptr->tim_res_time > v)
2424                 return FALSE;
2425         } else if (!creature_ptr->tim_res_time) {
2426             msg_print(_("時間逆転の力に対して耐性がついた気がする!", "You feel time resistant!"));
2427             notice = TRUE;
2428         }
2429     } else {
2430         if (creature_ptr->tim_res_time) {
2431             msg_print(_("時間逆転の力に対する耐性が薄れた気がする。", "You feel less time resistant"));
2432             notice = TRUE;
2433         }
2434     }
2435
2436     creature_ptr->tim_res_time = v;
2437     creature_ptr->redraw |= (PR_STATUS);
2438     if (!notice)
2439         return FALSE;
2440
2441     if (disturb_state)
2442         disturb(creature_ptr, FALSE, FALSE);
2443     creature_ptr->update |= (PU_BONUS);
2444     handle_stuff(creature_ptr);
2445     return TRUE;
2446 }
2447
2448 /*
2449  * Choose a warrior-mage elemental attack. -LM-
2450  */
2451 bool choose_ele_attack(player_type *creature_ptr)
2452 {
2453     if (!has_melee_weapon(creature_ptr, INVEN_RARM) && !has_melee_weapon(creature_ptr, INVEN_LARM)) {
2454         msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon."));
2455         return FALSE;
2456     }
2457
2458     screen_save();
2459     int num = (creature_ptr->lev - 20) / 5;
2460     c_prt(TERM_RED, _("        a) 焼棄", "        a) Fire Brand"), 2, 14);
2461
2462     if (num >= 2)
2463         c_prt(TERM_L_WHITE, _("        b) 凍結", "        b) Cold Brand"), 3, 14);
2464     else
2465         prt("", 3, 14);
2466
2467     if (num >= 3)
2468         c_prt(TERM_GREEN, _("        c) 毒殺", "        c) Poison Brand"), 4, 14);
2469     else
2470         prt("", 4, 14);
2471
2472     if (num >= 4)
2473         c_prt(TERM_L_DARK, _("        d) 溶解", "        d) Acid Brand"), 5, 14);
2474     else
2475         prt("", 5, 14);
2476
2477     if (num >= 5)
2478         c_prt(TERM_BLUE, _("        e) 電撃", "        e) Elec Brand"), 6, 14);
2479     else
2480         prt("", 6, 14);
2481
2482     prt("", 7, 14);
2483     prt("", 8, 14);
2484     prt("", 9, 14);
2485
2486     prt("", 1, 0);
2487     prt(_("        どの元素攻撃をしますか?", "        Choose a temporary elemental brand "), 1, 14);
2488
2489     char choice = inkey();
2490
2491     if ((choice == 'a') || (choice == 'A'))
2492         set_ele_attack(creature_ptr, ATTACK_FIRE, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
2493     else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
2494         set_ele_attack(creature_ptr, ATTACK_COLD, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
2495     else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
2496         set_ele_attack(creature_ptr, ATTACK_POIS, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
2497     else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
2498         set_ele_attack(creature_ptr, ATTACK_ACID, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
2499     else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
2500         set_ele_attack(creature_ptr, ATTACK_ELEC, creature_ptr->lev / 2 + randint1(creature_ptr->lev / 2));
2501     else {
2502         msg_print(_("魔法剣を使うのをやめた。", "You cancel the temporary branding."));
2503         screen_load();
2504         return FALSE;
2505     }
2506
2507     screen_load();
2508     return TRUE;
2509 }
2510
2511 /*
2512  * Choose a elemental immune. -LM-
2513  */
2514 bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT immune_turn)
2515 {
2516     screen_save();
2517
2518     c_prt(TERM_RED, _("        a) 火炎", "        a) Immunity to fire"), 2, 14);
2519     c_prt(TERM_L_WHITE, _("        b) 冷気", "        b) Immunity to cold"), 3, 14);
2520     c_prt(TERM_L_DARK, _("        c) 酸", "        c) Immunity to acid"), 4, 14);
2521     c_prt(TERM_BLUE, _("        d) 電撃", "        d) Immunity to elec"), 5, 14);
2522
2523     prt("", 6, 14);
2524     prt("", 7, 14);
2525     prt("", 8, 14);
2526     prt("", 9, 14);
2527
2528     prt("", 1, 0);
2529     prt(_("        どの元素の免疫をつけますか?", "        Choose a temporary elemental immunity "), 1, 14);
2530
2531     char choice = inkey();
2532
2533     if ((choice == 'a') || (choice == 'A'))
2534         set_ele_immune(creature_ptr, DEFENSE_FIRE, immune_turn);
2535     else if ((choice == 'b') || (choice == 'B'))
2536         set_ele_immune(creature_ptr, DEFENSE_COLD, immune_turn);
2537     else if ((choice == 'c') || (choice == 'C'))
2538         set_ele_immune(creature_ptr, DEFENSE_ACID, immune_turn);
2539     else if ((choice == 'd') || (choice == 'D'))
2540         set_ele_immune(creature_ptr, DEFENSE_ELEC, immune_turn);
2541     else {
2542         msg_print(_("免疫を付けるのをやめた。", "You cancel the temporary immunity."));
2543         screen_load();
2544         return FALSE;
2545     }
2546
2547     screen_load();
2548     return TRUE;
2549 }
2550
2551 bool drop_weapons(player_type *creature_ptr)
2552 {
2553     INVENTORY_IDX slot = 0;
2554     object_type *o_ptr = NULL;
2555
2556     if (creature_ptr->wild_mode)
2557         return FALSE;
2558
2559     msg_print(NULL);
2560     if (has_melee_weapon(creature_ptr, INVEN_RARM)) {
2561         slot = INVEN_RARM;
2562         o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
2563
2564         if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2)) {
2565             o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2566             slot = INVEN_LARM;
2567         }
2568     } else if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
2569         o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2570         slot = INVEN_LARM;
2571     }
2572
2573     if (slot && !object_is_cursed(o_ptr)) {
2574         msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2575         drop_from_inventory(creature_ptr, slot, 1);
2576         return TRUE;
2577     }
2578
2579     return FALSE;
2580 }