OSDN Git Service

Extend features of tiling. (separation of Cell size and Tile size / add offset position.)
[hengband/hengband.git] / src / effects.c
1 /*!
2  * @file effects.c
3  * @brief ¥×¥ì¥¤¥ä¡¼¤Î¥¹¥Æ¡¼¥¿¥¹´ÉÍý / effects of various "objects"
4  * @date 2014/01/01
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  *\n
8  * This software may be copied and distributed for educational, research,\n
9  * and not for profit purposes provided that this copyright and statement\n
10  * are included in all such copies.  Other copyrights may also apply.\n
11  *\n
12  * 2013 Deskull rearranged comment for Doxygen.\n
13  */
14
15
16 #include "angband.h"
17
18 /*!
19  * @brief ¥×¥ì¥¤¥ä¡¼¤Î·Ñ³¹ÔÆ°¤òÀßÄꤹ¤ë¡£
20  * @param typ ·Ñ³¹ÔÆ°¤ÎID\n
21  * #ACTION_NONE / #ACTION_SEARCH / #ACTION_REST / #ACTION_LEARN / #ACTION_FISH / #ACTION_KAMAE / #ACTION_KATA / #ACTION_SING / #ACTION_HAYAGAKE / #ACTION_SPELL ¤«¤éÁªÂò¡£
22  * @return ¤Ê¤·
23  */
24 void set_action(int typ)
25 {
26         int prev_typ = p_ptr->action;
27
28         if (typ == prev_typ)
29         {
30                 return;
31         }
32         else
33         {
34                 switch (prev_typ)
35                 {
36                         case ACTION_SEARCH:
37                         {
38 #ifdef JP
39                                 msg_print("õº÷¤ò¤ä¤á¤¿¡£");
40 #else
41                                 msg_print("You no longer walk carefully.");
42 #endif
43                                 p_ptr->redraw |= (PR_SPEED);
44                                 break;
45                         }
46                         case ACTION_REST:
47                         {
48                                 resting = 0;
49                                 break;
50                         }
51                         case ACTION_LEARN:
52                         {
53 #ifdef JP
54                                 msg_print("³Ø½¬¤ò¤ä¤á¤¿¡£");
55 #else
56                                 msg_print("You stop Learning");
57 #endif
58                                 new_mane = FALSE;
59                                 break;
60                         }
61                         case ACTION_KAMAE:
62                         {
63 #ifdef JP
64                                 msg_print("¹½¤¨¤ò¤È¤¤¤¿¡£");
65 #else
66                                 msg_print("You stop assuming the posture.");
67 #endif
68                                 p_ptr->special_defense &= ~(KAMAE_MASK);
69                                 break;
70                         }
71                         case ACTION_KATA:
72                         {
73 #ifdef JP
74                                 msg_print("·¿¤òÊø¤·¤¿¡£");
75 #else
76                                 msg_print("You stop assuming the posture.");
77 #endif
78                                 p_ptr->special_defense &= ~(KATA_MASK);
79                                 p_ptr->update |= (PU_MONSTERS);
80                                 p_ptr->redraw |= (PR_STATUS);
81                                 break;
82                         }
83                         case ACTION_SING:
84                         {
85 #ifdef JP
86                                 msg_print("²Î¤¦¤Î¤ò¤ä¤á¤¿¡£");
87 #else
88                                 msg_print("You stop singing.");
89 #endif
90                                 break;
91                         }
92                         case ACTION_HAYAGAKE:
93                         {
94 #ifdef JP
95                                 msg_print("­¤¬½Å¤¯¤Ê¤Ã¤¿¡£");
96 #else
97                                 msg_print("You are no longer walking extremely fast.");
98 #endif
99                                 energy_use = 100;
100                                 break;
101                         }
102                         case ACTION_SPELL:
103                         {
104 #ifdef JP
105                                 msg_print("¼öʸ¤Î±Ó¾§¤òÃæÃǤ·¤¿¡£");
106 #else
107                                 msg_print("You stopped spelling all spells.");
108 #endif
109                                 break;
110                         }
111                 }
112         }
113
114         p_ptr->action = typ;
115
116         /* If we are requested other action, stop singing */
117         if (prev_typ == ACTION_SING) stop_singing();
118         if (prev_typ == ACTION_SPELL) stop_hex_spell();
119
120         switch (p_ptr->action)
121         {
122                 case ACTION_SEARCH:
123                 {
124 #ifdef JP
125                         msg_print("Ãí°Õ¿¼¤¯Ê⤭»Ï¤á¤¿¡£");
126 #else
127                         msg_print("You begin to walk carefully.");
128 #endif
129                         p_ptr->redraw |= (PR_SPEED);
130                         break;
131                 }
132                 case ACTION_LEARN:
133                 {
134 #ifdef JP
135                         msg_print("³Ø½¬¤ò»Ï¤á¤¿¡£");
136 #else
137                         msg_print("You begin Learning");
138 #endif
139                         break;
140                 }
141                 case ACTION_FISH:
142                 {
143 #ifdef JP
144                         msg_print("¿åÌ̤˻å¤ò¿â¤é¤·¤¿¡¥¡¥¡¥");
145 #else
146                         msg_print("You begin fishing...");
147 #endif
148                         break;
149                 }
150                 case ACTION_HAYAGAKE:
151                 {
152 #ifdef JP
153                         msg_print("­¤¬±©¤Î¤è¤¦¤Ë·Ú¤¯¤Ê¤Ã¤¿¡£");
154 #else
155                         msg_print("You begin to walk extremely fast.");
156 #endif
157                         break;
158                 }
159                 default:
160                 {
161                         break;
162                 }
163         }
164
165         /* Recalculate bonuses */
166         p_ptr->update |= (PU_BONUS);
167
168         /* Redraw the state */
169         p_ptr->redraw |= (PR_STATE);
170 }
171
172 /*!
173  * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÁ´¤Æ¤Î»þ¸Â¸ú²Ì¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£ / reset timed flags
174  * @return ¤Ê¤·
175  */
176 void reset_tim_flags(void)
177 {
178         p_ptr->fast = 0;            /* Timed -- Fast */
179         p_ptr->lightspeed = 0;
180         p_ptr->slow = 0;            /* Timed -- Slow */
181         p_ptr->blind = 0;           /* Timed -- Blindness */
182         p_ptr->paralyzed = 0;       /* Timed -- Paralysis */
183         p_ptr->confused = 0;        /* Timed -- Confusion */
184         p_ptr->afraid = 0;          /* Timed -- Fear */
185         p_ptr->image = 0;           /* Timed -- Hallucination */
186         p_ptr->poisoned = 0;        /* Timed -- Poisoned */
187         p_ptr->cut = 0;             /* Timed -- Cut */
188         p_ptr->stun = 0;            /* Timed -- Stun */
189
190         p_ptr->protevil = 0;        /* Timed -- Protection */
191         p_ptr->invuln = 0;          /* Timed -- Invulnerable */
192         p_ptr->ult_res = 0;
193         p_ptr->hero = 0;            /* Timed -- Heroism */
194         p_ptr->shero = 0;           /* Timed -- Super Heroism */
195         p_ptr->shield = 0;          /* Timed -- Shield Spell */
196         p_ptr->blessed = 0;         /* Timed -- Blessed */
197         p_ptr->tim_invis = 0;       /* Timed -- Invisibility */
198         p_ptr->tim_infra = 0;       /* Timed -- Infra Vision */
199         p_ptr->tim_regen = 0;       /* Timed -- Regeneration */
200         p_ptr->tim_stealth = 0;     /* Timed -- Stealth */
201         p_ptr->tim_esp = 0;
202         p_ptr->wraith_form = 0;     /* Timed -- Wraith Form */
203         p_ptr->tim_levitation = 0;
204         p_ptr->tim_sh_touki = 0;
205         p_ptr->tim_sh_fire = 0;
206         p_ptr->tim_sh_holy = 0;
207         p_ptr->tim_eyeeye = 0;
208         p_ptr->magicdef = 0;
209         p_ptr->resist_magic = 0;
210         p_ptr->tsuyoshi = 0;
211         p_ptr->kabenuke = 0;
212         p_ptr->tim_res_nether = 0;
213         p_ptr->tim_res_time = 0;
214         p_ptr->tim_mimic = 0;
215         p_ptr->mimic_form = 0;
216         p_ptr->tim_reflect = 0;
217         p_ptr->multishadow = 0;
218         p_ptr->dustrobe = 0;
219         p_ptr->action = ACTION_NONE;
220
221
222         p_ptr->oppose_acid = 0;     /* Timed -- oppose acid */
223         p_ptr->oppose_elec = 0;     /* Timed -- oppose lightning */
224         p_ptr->oppose_fire = 0;     /* Timed -- oppose heat */
225         p_ptr->oppose_cold = 0;     /* Timed -- oppose cold */
226         p_ptr->oppose_pois = 0;     /* Timed -- oppose poison */
227
228         p_ptr->word_recall = 0;
229         p_ptr->alter_reality = 0;
230         p_ptr->sutemi = FALSE;
231         p_ptr->counter = FALSE;
232         p_ptr->ele_attack = 0;
233         p_ptr->ele_immune = 0;
234         p_ptr->special_attack = 0L;
235         p_ptr->special_defense = 0L;
236
237         while(p_ptr->energy_need < 0) p_ptr->energy_need += ENERGY_NEED();
238         world_player = FALSE;
239
240         if (prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) p_ptr->oppose_fire = 1;
241         if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) p_ptr->oppose_pois = 1;
242         if (p_ptr->pclass == CLASS_BERSERKER) p_ptr->shero = 1;
243
244         if (p_ptr->riding)
245         {
246                 (void)set_monster_fast(p_ptr->riding, 0);
247                 (void)set_monster_slow(p_ptr->riding, 0);
248                 (void)set_monster_invulner(p_ptr->riding, 0, FALSE);
249         }
250
251         if (p_ptr->pclass == CLASS_BARD)
252         {
253                 p_ptr->magic_num1[0] = 0;
254                 p_ptr->magic_num2[0] = 0;
255         }
256 }
257
258 /*!
259  * @brief ¥×¥ì¥¤¥ä¡¼¤ËËâÎϾõî¸ú²Ì¤òÍ¿¤¨¤ë¡£
260  * @return ¤Ê¤·
261  */
262 void dispel_player(void)
263 {
264         (void)set_fast(0, TRUE);
265         (void)set_lightspeed(0, TRUE);
266         (void)set_slow(0, TRUE);
267         (void)set_shield(0, TRUE);
268         (void)set_blessed(0, TRUE);
269         (void)set_tsuyoshi(0, TRUE);
270         (void)set_hero(0, TRUE);
271         (void)set_shero(0, TRUE);
272         (void)set_protevil(0, TRUE);
273         (void)set_invuln(0, TRUE);
274         (void)set_wraith_form(0, TRUE);
275         (void)set_kabenuke(0, TRUE);
276         (void)set_tim_res_nether(0, TRUE);
277         (void)set_tim_res_time(0, TRUE);
278         /* by henkma */
279         (void)set_tim_reflect(0,TRUE);
280         (void)set_multishadow(0,TRUE);
281         (void)set_dustrobe(0,TRUE);
282
283         (void)set_tim_invis(0, TRUE);
284         (void)set_tim_infra(0, TRUE);
285         (void)set_tim_esp(0, TRUE);
286         (void)set_tim_regen(0, TRUE);
287         (void)set_tim_stealth(0, TRUE);
288         (void)set_tim_levitation(0, TRUE);
289         (void)set_tim_sh_touki(0, TRUE);
290         (void)set_tim_sh_fire(0, TRUE);
291         (void)set_tim_sh_holy(0, TRUE);
292         (void)set_tim_eyeeye(0, TRUE);
293         (void)set_magicdef(0, TRUE);
294         (void)set_resist_magic(0, TRUE);
295         (void)set_oppose_acid(0, TRUE);
296         (void)set_oppose_elec(0, TRUE);
297         (void)set_oppose_fire(0, TRUE);
298         (void)set_oppose_cold(0, TRUE);
299         (void)set_oppose_pois(0, TRUE);
300         (void)set_ultimate_res(0, TRUE);
301         (void)set_mimic(0, 0, TRUE);
302         (void)set_ele_attack(0, 0);
303         (void)set_ele_immune(0, 0);
304
305         /* Cancel glowing hands */
306         if (p_ptr->special_attack & ATTACK_CONFUSE)
307         {
308                 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
309 #ifdef JP
310                 msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
311 #else
312                 msg_print("Your hands stop glowing.");
313 #endif
314         }
315
316         if (music_singing_any() || hex_spelling_any())
317         {
318 #ifdef JP
319                 cptr str = (music_singing_any()) ? "²Î" : "¼öʸ";
320 #else
321                 cptr str = (music_singing_any()) ? "singing" : "spelling";
322 #endif
323                 p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
324                 p_ptr->magic_num1[0] = 0;
325 #ifdef JP
326                 msg_format("%s¤¬ÅÓÀڤ줿¡£", str);
327 #else
328                 msg_format("Your %s is interrupted.", str);
329 #endif
330                 p_ptr->action = ACTION_NONE;
331
332                 /* Recalculate bonuses */
333                 p_ptr->update |= (PU_BONUS | PU_HP);
334
335                 /* Redraw map */
336                 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
337
338                 /* Update monsters */
339                 p_ptr->update |= (PU_MONSTERS);
340
341                 /* Window stuff */
342                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
343
344                 p_ptr->energy_need += ENERGY_NEED();
345         }
346 }
347
348
349 /*!
350  * @brief Êѿȸú²Ì¤Î·Ñ³»þ´Ö¤ÈÊÑ¿ÈÀè¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", notice observable changes
351  * @param v ·Ñ³»þ´Ö
352  * @param p ÊÑ¿ÈÆâÍÆ
353  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
354  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
355  */
356 bool set_mimic(int v, int p, bool do_dec)
357 {
358         bool notice = FALSE;
359
360         /* Hack -- Force good values */
361         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
362
363         if (p_ptr->is_dead) return FALSE;
364
365         /* Open */
366         if (v)
367         {
368                 if (p_ptr->tim_mimic && (p_ptr->mimic_form == p) && !do_dec)
369                 {
370                         if (p_ptr->tim_mimic > v) return FALSE;
371                 }
372                 else if ((!p_ptr->tim_mimic) || (p_ptr->mimic_form != p))
373                 {
374 #ifdef JP
375                         msg_print("¼«Ê¬¤ÎÂΤ¬ÊѤï¤Ã¤Æ¤æ¤¯¤Î¤ò´¶¤¸¤¿¡£");
376 #else
377                         msg_print("You feel that your body changes.");
378 #endif
379                         p_ptr->mimic_form=p;
380                         notice = TRUE;
381                 }
382         }
383
384         /* Shut */
385         else
386         {
387                 if (p_ptr->tim_mimic)
388                 {
389 #ifdef JP
390                         msg_print("ÊѿȤ¬²ò¤±¤¿¡£");
391 #else
392                         msg_print("You are no longer transformed.");
393 #endif
394                         if (p_ptr->mimic_form == MIMIC_DEMON) set_oppose_fire(0, TRUE);
395                         p_ptr->mimic_form=0;
396                         notice = TRUE;
397                         p = 0;
398                 }
399         }
400
401         /* Use the value */
402         p_ptr->tim_mimic = v;
403
404         /* Nothing to notice */
405         if (!notice)
406                 return (FALSE);
407
408         /* Disturb */
409         if (disturb_state) disturb(0, 1);
410
411         /* Redraw title */
412         p_ptr->redraw |= (PR_BASIC | PR_STATUS);
413
414         /* Recalculate bonuses */
415         p_ptr->update |= (PU_BONUS | PU_HP);
416
417         handle_stuff();
418
419         /* Result */
420         return (TRUE);
421 }
422
423 /*!
424  * @brief ÌÕÌܤηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->blind", notice observable changes
425  * @param v ·Ñ³»þ´Ö
426  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
427  * @details
428  * Note the use of "PU_UN_LITE" and "PU_UN_VIEW", which is needed to\n
429  * memorize any terrain features which suddenly become "visible".\n
430  * Note that blindness is currently the only thing which can affect\n
431  * "player_can_see_bold()".\n
432  */
433 bool set_blind(int v)
434 {
435         bool notice = FALSE;
436
437         /* Hack -- Force good values */
438         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
439
440         if (p_ptr->is_dead) return FALSE;
441
442         /* Open */
443         if (v)
444         {
445                 if (!p_ptr->blind)
446                 {
447                         if (p_ptr->prace == RACE_ANDROID)
448                         {
449 #ifdef JP
450 msg_print("¥»¥ó¥µ¡¼¤ò¤ä¤é¤ì¤¿¡ª");
451 #else
452                                 msg_print("You are blind!");
453 #endif
454                         }
455                         else
456                         {
457 #ifdef JP
458 msg_print("Ìܤ¬¸«¤¨¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
459 #else
460                                 msg_print("You are blind!");
461 #endif
462                         }
463
464                         notice = TRUE;
465                         chg_virtue(V_ENLIGHTEN, -1);
466                 }
467         }
468
469         /* Shut */
470         else
471         {
472                 if (p_ptr->blind)
473                 {
474                         if (p_ptr->prace == RACE_ANDROID)
475                         {
476 #ifdef JP
477 msg_print("¥»¥ó¥µ¡¼¤¬Éüµì¤·¤¿¡£");
478 #else
479                                 msg_print("You can see again.");
480 #endif
481                         }
482                         else
483                         {
484 #ifdef JP
485 msg_print("¤ä¤Ã¤ÈÌܤ¬¸«¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
486 #else
487                                 msg_print("You can see again.");
488 #endif
489                         }
490
491                         notice = TRUE;
492                 }
493         }
494
495         /* Use the value */
496         p_ptr->blind = v;
497
498         /* Redraw status bar */
499         p_ptr->redraw |= (PR_STATUS);
500
501         /* Nothing to notice */
502         if (!notice) return (FALSE);
503
504         /* Disturb */
505         if (disturb_state) disturb(0, 0);
506
507         /* Fully update the visuals */
508         p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
509
510         /* Redraw map */
511         p_ptr->redraw |= (PR_MAP);
512
513         /* Window stuff */
514         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
515
516         /* Handle stuff */
517         handle_stuff();
518
519         /* Result */
520         return (TRUE);
521 }
522
523
524 /*!
525  * @brief º®Íð¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->confused", notice observable changes
526  * @param v ·Ñ³»þ´Ö
527  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
528  */
529 bool set_confused(int v)
530 {
531         bool notice = FALSE;
532
533         /* Hack -- Force good values */
534         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
535
536         if (p_ptr->is_dead) return FALSE;
537
538         /* Open */
539         if (v)
540         {
541                 if (!p_ptr->confused)
542                 {
543 #ifdef JP
544 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤¿¡ª");
545 #else
546                         msg_print("You are confused!");
547 #endif
548
549                         if (p_ptr->action == ACTION_LEARN)
550                         {
551 #ifdef JP
552                                 msg_print("³Ø½¬¤¬Â³¤±¤é¤ì¤Ê¤¤¡ª");
553 #else
554                                 msg_print("You cannot continue Learning!");
555 #endif
556                                 new_mane = FALSE;
557
558                                 p_ptr->redraw |= (PR_STATE);
559                                 p_ptr->action = ACTION_NONE;
560                         }
561                         if (p_ptr->action == ACTION_KAMAE)
562                         {
563 #ifdef JP
564                                 msg_print("¹½¤¨¤¬¤È¤±¤¿¡£");
565 #else
566                                 msg_print("Your posture gets loose.");
567 #endif
568                                 p_ptr->special_defense &= ~(KAMAE_MASK);
569                                 p_ptr->update |= (PU_BONUS);
570                                 p_ptr->redraw |= (PR_STATE);
571                                 p_ptr->action = ACTION_NONE;
572                         }
573                         else if (p_ptr->action == ACTION_KATA)
574                         {
575 #ifdef JP
576                                 msg_print("·¿¤¬Êø¤ì¤¿¡£");
577 #else
578                                 msg_print("Your posture gets loose.");
579 #endif
580                                 p_ptr->special_defense &= ~(KATA_MASK);
581                                 p_ptr->update |= (PU_BONUS);
582                                 p_ptr->update |= (PU_MONSTERS);
583                                 p_ptr->redraw |= (PR_STATE);
584                                 p_ptr->redraw |= (PR_STATUS);
585                                 p_ptr->action = ACTION_NONE;
586                         }
587
588                         /* Sniper */
589                         if (p_ptr->concent) reset_concentration(TRUE);
590
591                         /* Hex */
592                         if (hex_spelling_any()) stop_hex_spell_all();
593
594                         notice = TRUE;
595                         p_ptr->counter = FALSE;
596                         chg_virtue(V_HARMONY, -1);
597                 }
598         }
599
600         /* Shut */
601         else
602         {
603                 if (p_ptr->confused)
604                 {
605 #ifdef JP
606 msg_print("¤ä¤Ã¤Èº®Í𤬤ª¤µ¤Þ¤Ã¤¿¡£");
607 #else
608                         msg_print("You feel less confused now.");
609 #endif
610
611                         p_ptr->special_attack &= ~(ATTACK_SUIKEN);
612                         notice = TRUE;
613                 }
614         }
615
616         /* Use the value */
617         p_ptr->confused = v;
618
619         /* Redraw status bar */
620         p_ptr->redraw |= (PR_STATUS);
621
622         /* Nothing to notice */
623         if (!notice) return (FALSE);
624
625         /* Disturb */
626         if (disturb_state) disturb(0, 0);
627
628         /* Handle stuff */
629         handle_stuff();
630
631         /* Result */
632         return (TRUE);
633 }
634
635
636 /*!
637  * @brief ÆǤηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->poisoned", notice observable changes
638  * @param v ·Ñ³»þ´Ö
639  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
640  */
641 bool set_poisoned(int v)
642 {
643         bool notice = FALSE;
644
645         /* Hack -- Force good values */
646         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
647
648         if (p_ptr->is_dead) return FALSE;
649
650         /* Open */
651         if (v)
652         {
653                 if (!p_ptr->poisoned)
654                 {
655 #ifdef JP
656 msg_print("ÆǤ˿¯¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
657 #else
658                         msg_print("You are poisoned!");
659 #endif
660
661                         notice = TRUE;
662                 }
663         }
664
665         /* Shut */
666         else
667         {
668                 if (p_ptr->poisoned)
669                 {
670 #ifdef JP
671 msg_print("¤ä¤Ã¤ÈÆǤÎÄˤߤ¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
672 #else
673                         msg_print("You are no longer poisoned.");
674 #endif
675
676                         notice = TRUE;
677                 }
678         }
679
680         /* Use the value */
681         p_ptr->poisoned = v;
682
683         /* Redraw status bar */
684         p_ptr->redraw |= (PR_STATUS);
685
686         /* Nothing to notice */
687         if (!notice) return (FALSE);
688
689         /* Disturb */
690         if (disturb_state) disturb(0, 0);
691
692         /* Handle stuff */
693         handle_stuff();
694
695         /* Result */
696         return (TRUE);
697 }
698
699
700 /*!
701  * @brief ¶²Éݤηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->afraid", notice observable changes
702  * @param v ·Ñ³»þ´Ö
703  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
704  */
705 bool set_afraid(int v)
706 {
707         bool notice = FALSE;
708
709         /* Hack -- Force good values */
710         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
711
712         if (p_ptr->is_dead) return FALSE;
713
714         /* Open */
715         if (v)
716         {
717                 if (!p_ptr->afraid)
718                 {
719 #ifdef JP
720 msg_print("²¿¤â¤«¤â¶²¤¯¤Ê¤Ã¤Æ¤­¤¿¡ª");
721 #else
722                         msg_print("You are terrified!");
723 #endif
724
725                         if (p_ptr->special_defense & KATA_MASK)
726                         {
727 #ifdef JP
728                                 msg_print("·¿¤¬Êø¤ì¤¿¡£");
729 #else
730                                 msg_print("Your posture gets loose.");
731 #endif
732                                 p_ptr->special_defense &= ~(KATA_MASK);
733                                 p_ptr->update |= (PU_BONUS);
734                                 p_ptr->update |= (PU_MONSTERS);
735                                 p_ptr->redraw |= (PR_STATE);
736                                 p_ptr->redraw |= (PR_STATUS);
737                                 p_ptr->action = ACTION_NONE;
738                         }
739
740                         notice = TRUE;
741                         p_ptr->counter = FALSE;
742                         chg_virtue(V_VALOUR, -1);
743                 }
744         }
745
746         /* Shut */
747         else
748         {
749                 if (p_ptr->afraid)
750                 {
751 #ifdef JP
752 msg_print("¤ä¤Ã¤È¶²Éݤò¿¶¤êʧ¤Ã¤¿¡£");
753 #else
754                         msg_print("You feel bolder now.");
755 #endif
756
757                         notice = TRUE;
758                 }
759         }
760
761         /* Use the value */
762         p_ptr->afraid = v;
763
764         /* Redraw status bar */
765         p_ptr->redraw |= (PR_STATUS);
766
767         /* Nothing to notice */
768         if (!notice) return (FALSE);
769
770         /* Disturb */
771         if (disturb_state) disturb(0, 0);
772
773         /* Handle stuff */
774         handle_stuff();
775
776         /* Result */
777         return (TRUE);
778 }
779
780 /*!
781  * @brief Ëãáã¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->paralyzed", notice observable changes
782  * @param v ·Ñ³»þ´Ö
783  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
784  */
785 bool set_paralyzed(int v)
786 {
787         bool notice = FALSE;
788
789         /* Hack -- Force good values */
790         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
791
792         if (p_ptr->is_dead) return FALSE;
793
794         /* Open */
795         if (v)
796         {
797                 if (!p_ptr->paralyzed)
798                 {
799 #ifdef JP
800 msg_print("ÂΤ¬Ëãá㤷¤Æ¤·¤Þ¤Ã¤¿¡ª");
801 #else
802                         msg_print("You are paralyzed!");
803 #endif
804
805                         /* Sniper */
806                         if (p_ptr->concent) reset_concentration(TRUE);
807
808                         /* Hex */
809                         if (hex_spelling_any()) stop_hex_spell_all();
810
811                         p_ptr->counter = FALSE;
812                         notice = TRUE;
813                 }
814         }
815
816         /* Shut */
817         else
818         {
819                 if (p_ptr->paralyzed)
820                 {
821 #ifdef JP
822 msg_print("¤ä¤Ã¤ÈÆ°¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
823 #else
824                         msg_print("You can move again.");
825 #endif
826
827                         notice = TRUE;
828                 }
829         }
830
831         /* Use the value */
832         p_ptr->paralyzed = v;
833
834         /* Redraw status bar */
835         p_ptr->redraw |= (PR_STATUS);
836
837         /* Nothing to notice */
838         if (!notice) return (FALSE);
839
840         /* Disturb */
841         if (disturb_state) disturb(0, 0);
842
843         /* Redraw the state */
844         p_ptr->redraw |= (PR_STATE);
845
846         /* Handle stuff */
847         handle_stuff();
848
849         /* Result */
850         return (TRUE);
851 }
852
853 /*!
854  * @brief ¸¸³Ð¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->image", notice observable changes
855  * @param v ·Ñ³»þ´Ö
856  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
857  * @details Note that we must redraw the map when hallucination changes.
858  */
859 bool set_image(int v)
860 {
861         bool notice = FALSE;
862
863         /* Hack -- Force good values */
864         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
865
866         if (p_ptr->is_dead) return FALSE;
867
868
869         /* Open */
870         if (v)
871         {
872                 set_tsuyoshi(0, TRUE);
873                 if (!p_ptr->image)
874                 {
875 #ifdef JP
876 msg_print("¥ï¡¼¥ª¡ª²¿¤â¤«¤âÆú¿§¤Ë¸«¤¨¤ë¡ª");
877 #else
878                         msg_print("Oh, wow! Everything looks so cosmic now!");
879 #endif
880
881                         /* Sniper */
882                         if (p_ptr->concent) reset_concentration(TRUE);
883
884                         p_ptr->counter = FALSE;
885                         notice = TRUE;
886                 }
887         }
888
889         /* Shut */
890         else
891         {
892                 if (p_ptr->image)
893                 {
894 #ifdef JP
895 msg_print("¤ä¤Ã¤È¤Ï¤Ã¤­¤ê¤Èʪ¤¬¸«¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
896 #else
897                         msg_print("You can see clearly again.");
898 #endif
899
900                         notice = TRUE;
901                 }
902         }
903
904         /* Use the value */
905         p_ptr->image = v;
906
907         /* Redraw status bar */
908         p_ptr->redraw |= (PR_STATUS);
909
910         /* Nothing to notice */
911         if (!notice) return (FALSE);
912
913         /* Disturb */
914         if (disturb_state) disturb(0, 1);
915
916         /* Redraw map */
917         p_ptr->redraw |= (PR_MAP);
918
919         /* Update the health bar */
920         p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
921
922         /* Update monsters */
923         p_ptr->update |= (PU_MONSTERS);
924
925         /* Window stuff */
926         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
927
928         /* Handle stuff */
929         handle_stuff();
930
931         /* Result */
932         return (TRUE);
933 }
934
935 /*!
936  * @brief ²Ã®¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->fast", notice observable changes
937  * @param v ·Ñ³»þ´Ö
938  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
939  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
940  */
941 bool set_fast(int v, bool do_dec)
942 {
943         bool notice = FALSE;
944
945         /* Hack -- Force good values */
946         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
947
948         if (p_ptr->is_dead) return FALSE;
949
950         /* Open */
951         if (v)
952         {
953                 if (p_ptr->fast && !do_dec)
954                 {
955                         if (p_ptr->fast > v) return FALSE;
956                 }
957                 else if (!IS_FAST() && !p_ptr->lightspeed)
958                 {
959 #ifdef JP
960 msg_print("ÁÇÁ᤯ư¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
961 #else
962                         msg_print("You feel yourself moving much faster!");
963 #endif
964
965                         notice = TRUE;
966                         chg_virtue(V_PATIENCE, -1);
967                         chg_virtue(V_DILIGENCE, 1);
968                 }
969         }
970
971         /* Shut */
972         else
973         {
974                 if (p_ptr->fast && !p_ptr->lightspeed && !music_singing(MUSIC_SPEED) && !music_singing(MUSIC_SHERO))
975                 {
976 #ifdef JP
977 msg_print("Æ°¤­¤ÎÁÇÁᤵ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
978 #else
979                         msg_print("You feel yourself slow down.");
980 #endif
981
982                         notice = TRUE;
983                 }
984         }
985
986         /* Use the value */
987         p_ptr->fast = v;
988
989         /* Nothing to notice */
990         if (!notice) return (FALSE);
991
992         /* Disturb */
993         if (disturb_state) disturb(0, 0);
994
995         /* Recalculate bonuses */
996         p_ptr->update |= (PU_BONUS);
997
998         /* Handle stuff */
999         handle_stuff();
1000
1001         /* Result */
1002         return (TRUE);
1003 }
1004
1005 /*!
1006  * @brief ¸÷®°ÜÆ°¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->lightspeed", notice observable changes
1007  * @param v ·Ñ³»þ´Ö
1008  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1009  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1010  */
1011 bool set_lightspeed(int v, bool do_dec)
1012 {
1013         bool notice = FALSE;
1014
1015         /* Hack -- Force good values */
1016         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1017
1018         if (p_ptr->is_dead) return FALSE;
1019
1020         if (p_ptr->wild_mode) v = 0;
1021
1022         /* Open */
1023         if (v)
1024         {
1025                 if (p_ptr->lightspeed && !do_dec)
1026                 {
1027                         if (p_ptr->lightspeed > v) return FALSE;
1028                 }
1029                 else if (!p_ptr->lightspeed)
1030                 {
1031 #ifdef JP
1032 msg_print("Èó¾ï¤ËÁÇÁ᤯ư¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
1033 #else
1034                         msg_print("You feel yourself moving extremely faster!");
1035 #endif
1036
1037                         notice = TRUE;
1038                         chg_virtue(V_PATIENCE, -1);
1039                         chg_virtue(V_DILIGENCE, 1);
1040                 }
1041         }
1042
1043         /* Shut */
1044         else
1045         {
1046                 if (p_ptr->lightspeed)
1047                 {
1048 #ifdef JP
1049 msg_print("Æ°¤­¤ÎÁÇÁᤵ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
1050 #else
1051                         msg_print("You feel yourself slow down.");
1052 #endif
1053
1054                         notice = TRUE;
1055                 }
1056         }
1057
1058         /* Use the value */
1059         p_ptr->lightspeed = v;
1060
1061         /* Nothing to notice */
1062         if (!notice) return (FALSE);
1063
1064         /* Disturb */
1065         if (disturb_state) disturb(0, 0);
1066
1067         /* Recalculate bonuses */
1068         p_ptr->update |= (PU_BONUS);
1069
1070         /* Handle stuff */
1071         handle_stuff();
1072
1073         /* Result */
1074         return (TRUE);
1075 }
1076
1077 /*!
1078  * @brief ¸ºÂ®¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->slow", notice observable changes
1079  * @param v ·Ñ³»þ´Ö
1080  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1081  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1082  */
1083 bool set_slow(int v, bool do_dec)
1084 {
1085         bool notice = FALSE;
1086
1087         /* Hack -- Force good values */
1088         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1089
1090         if (p_ptr->is_dead) return FALSE;
1091
1092         /* Open */
1093         if (v)
1094         {
1095                 if (p_ptr->slow && !do_dec)
1096                 {
1097                         if (p_ptr->slow > v) return FALSE;
1098                 }
1099                 else if (!p_ptr->slow)
1100                 {
1101 #ifdef JP
1102 msg_print("ÂΤÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
1103 #else
1104                         msg_print("You feel yourself moving slower!");
1105 #endif
1106
1107                         notice = TRUE;
1108                 }
1109         }
1110
1111         /* Shut */
1112         else
1113         {
1114                 if (p_ptr->slow)
1115                 {
1116 #ifdef JP
1117 msg_print("Æ°¤­¤ÎÃÙ¤µ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
1118 #else
1119                         msg_print("You feel yourself speed up.");
1120 #endif
1121
1122                         notice = TRUE;
1123                 }
1124         }
1125
1126         /* Use the value */
1127         p_ptr->slow = v;
1128
1129         /* Nothing to notice */
1130         if (!notice) return (FALSE);
1131
1132         /* Disturb */
1133         if (disturb_state) disturb(0, 0);
1134
1135         /* Recalculate bonuses */
1136         p_ptr->update |= (PU_BONUS);
1137
1138         /* Handle stuff */
1139         handle_stuff();
1140
1141         /* Result */
1142         return (TRUE);
1143 }
1144
1145
1146 /*!
1147  * @brief È©Àв½¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->shield", notice observable changes
1148  * @param v ·Ñ³»þ´Ö
1149  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1150  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1151  */
1152 bool set_shield(int v, bool do_dec)
1153 {
1154         bool notice = FALSE;
1155
1156         /* Hack -- Force good values */
1157         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1158
1159         if (p_ptr->is_dead) return FALSE;
1160
1161         /* Open */
1162         if (v)
1163         {
1164                 if (p_ptr->shield && !do_dec)
1165                 {
1166                         if (p_ptr->shield > v) return FALSE;
1167                 }
1168                 else if (!p_ptr->shield)
1169                 {
1170 #ifdef JP
1171 msg_print("È©¤¬ÀФˤʤä¿¡£");
1172 #else
1173                         msg_print("Your skin turns to stone.");
1174 #endif
1175
1176                         notice = TRUE;
1177                 }
1178         }
1179
1180         /* Shut */
1181         else
1182         {
1183                 if (p_ptr->shield)
1184                 {
1185 #ifdef JP
1186 msg_print("È©¤¬¸µ¤ËÌá¤Ã¤¿¡£");
1187 #else
1188                         msg_print("Your skin returns to normal.");
1189 #endif
1190
1191                         notice = TRUE;
1192                 }
1193         }
1194
1195         /* Use the value */
1196         p_ptr->shield = v;
1197
1198         /* Redraw status bar */
1199         p_ptr->redraw |= (PR_STATUS);
1200
1201         /* Nothing to notice */
1202         if (!notice) return (FALSE);
1203
1204         /* Disturb */
1205         if (disturb_state) disturb(0, 0);
1206
1207         /* Recalculate bonuses */
1208         p_ptr->update |= (PU_BONUS);
1209
1210         /* Handle stuff */
1211         handle_stuff();
1212
1213         /* Result */
1214         return (TRUE);
1215 }
1216
1217
1218 /*!
1219  * @brief ¤Ä¤Ö¤ì¤ë¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tsubureru", notice observable changes
1220  * @param v ·Ñ³»þ´Ö
1221  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1222  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1223  */
1224 bool set_tsubureru(int v, bool do_dec)
1225 {
1226         bool notice = FALSE;
1227
1228         /* Hack -- Force good values */
1229         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1230
1231         if (p_ptr->is_dead) return FALSE;
1232
1233         /* Open */
1234         if (v)
1235         {
1236                 if (p_ptr->tsubureru && !do_dec)
1237                 {
1238                         if (p_ptr->tsubureru > v) return FALSE;
1239                 }
1240                 else if (!p_ptr->tsubureru)
1241                 {
1242 #ifdef JP
1243 msg_print("²£¤Ë¿­¤Ó¤¿¡£");
1244 #else
1245                         msg_print("Your body expands horizontally.");
1246 #endif
1247
1248                         notice = TRUE;
1249                 }
1250         }
1251
1252         /* Shut */
1253         else
1254         {
1255                 if (p_ptr->tsubureru)
1256                 {
1257 #ifdef JP
1258 msg_print("¤â¤¦²£¤Ë¿­¤Ó¤Æ¤¤¤Ê¤¤¡£");
1259 #else
1260                         msg_print("Your body returns to normal.");
1261 #endif
1262
1263                         notice = TRUE;
1264                 }
1265         }
1266
1267         /* Use the value */
1268         p_ptr->tsubureru = v;
1269
1270         /* Redraw status bar */
1271         p_ptr->redraw |= (PR_STATUS);
1272
1273         /* Nothing to notice */
1274         if (!notice) return (FALSE);
1275
1276         /* Disturb */
1277         if (disturb_state) disturb(0, 0);
1278
1279         /* Recalculate bonuses */
1280         p_ptr->update |= (PU_BONUS);
1281
1282         /* Handle stuff */
1283         handle_stuff();
1284
1285         /* Result */
1286         return (TRUE);
1287 }
1288
1289
1290 /*!
1291  * @brief ËâË¡¤Î³»¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->magicdef", notice observable changes
1292  * @param v ·Ñ³»þ´Ö
1293  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1294  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1295  */
1296 bool set_magicdef(int v, bool do_dec)
1297 {
1298         bool notice = FALSE;
1299
1300         /* Hack -- Force good values */
1301         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1302
1303         if (p_ptr->is_dead) return FALSE;
1304
1305         /* Open */
1306         if (v)
1307         {
1308                 if (p_ptr->magicdef && !do_dec)
1309                 {
1310                         if (p_ptr->magicdef > v) return FALSE;
1311                 }
1312                 else if (!p_ptr->magicdef)
1313                 {
1314 #ifdef JP
1315                         msg_print("ËâË¡¤ÎËɸæÎϤ¬Áý¤·¤¿¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1316 #else
1317                         msg_print("You feel more resistant to magic.");
1318 #endif
1319
1320                         notice = TRUE;
1321                 }
1322         }
1323
1324         /* Shut */
1325         else
1326         {
1327                 if (p_ptr->magicdef)
1328                 {
1329 #ifdef JP
1330                         msg_print("ËâË¡¤ÎËɸæÎϤ¬¸µ¤ËÌá¤Ã¤¿¡£");
1331 #else
1332                         msg_print("You feel less resistant to magic.");
1333 #endif
1334
1335                         notice = TRUE;
1336                 }
1337         }
1338
1339         /* Use the value */
1340         p_ptr->magicdef = v;
1341
1342         /* Redraw status bar */
1343         p_ptr->redraw |= (PR_STATUS);
1344
1345         /* Nothing to notice */
1346         if (!notice) return (FALSE);
1347
1348         /* Disturb */
1349         if (disturb_state) disturb(0, 0);
1350
1351         /* Recalculate bonuses */
1352         p_ptr->update |= (PU_BONUS);
1353
1354         /* Handle stuff */
1355         handle_stuff();
1356
1357         /* Result */
1358         return (TRUE);
1359 }
1360
1361 /*!
1362  * @brief ½ËÊ¡¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->blessed", notice observable changes
1363  * @param v ·Ñ³»þ´Ö
1364  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1365  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1366  */
1367 bool set_blessed(int v, bool do_dec)
1368 {
1369         bool notice = FALSE;
1370
1371         /* Hack -- Force good values */
1372         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1373
1374         if (p_ptr->is_dead) return FALSE;
1375
1376         /* Open */
1377         if (v)
1378         {
1379                 if (p_ptr->blessed && !do_dec)
1380                 {
1381                         if (p_ptr->blessed > v) return FALSE;
1382                 }
1383                 else if (!IS_BLESSED())
1384                 {
1385 #ifdef JP
1386 msg_print("¹â·é¤Êµ¤Ê¬¤Ë¤Ê¤Ã¤¿¡ª");
1387 #else
1388                         msg_print("You feel righteous!");
1389 #endif
1390
1391                         notice = TRUE;
1392                 }
1393         }
1394
1395         /* Shut */
1396         else
1397         {
1398                 if (p_ptr->blessed && !music_singing(MUSIC_BLESS))
1399                 {
1400 #ifdef JP
1401 msg_print("¹â·é¤Êµ¤Ê¬¤¬¾Ã¤¨¼º¤»¤¿¡£");
1402 #else
1403                         msg_print("The prayer has expired.");
1404 #endif
1405
1406                         notice = TRUE;
1407                 }
1408         }
1409
1410         /* Use the value */
1411         p_ptr->blessed = v;
1412
1413         /* Redraw status bar */
1414         p_ptr->redraw |= (PR_STATUS);
1415
1416         /* Nothing to notice */
1417         if (!notice) return (FALSE);
1418
1419         /* Disturb */
1420         if (disturb_state) disturb(0, 0);
1421
1422         /* Recalculate bonuses */
1423         p_ptr->update |= (PU_BONUS);
1424
1425         /* Handle stuff */
1426         handle_stuff();
1427
1428         /* Result */
1429         return (TRUE);
1430 }
1431
1432
1433 /*!
1434  * @brief »Îµ¤¹âÍȤηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->hero", notice observable changes
1435  * @param v ·Ñ³»þ´Ö
1436  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1437  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1438  */
1439 bool set_hero(int v, bool do_dec)
1440 {
1441         bool notice = FALSE;
1442
1443         /* Hack -- Force good values */
1444         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1445
1446         if (p_ptr->is_dead) return FALSE;
1447
1448         /* Open */
1449         if (v)
1450         {
1451                 if (p_ptr->hero && !do_dec)
1452                 {
1453                         if (p_ptr->hero > v) return FALSE;
1454                 }
1455                 else if (!IS_HERO())
1456                 {
1457 #ifdef JP
1458 msg_print("¥Ò¡¼¥í¡¼¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1459 #else
1460                         msg_print("You feel like a hero!");
1461 #endif
1462
1463                         notice = TRUE;
1464                 }
1465         }
1466
1467         /* Shut */
1468         else
1469         {
1470                 if (p_ptr->hero && !music_singing(MUSIC_HERO) && !music_singing(MUSIC_SHERO))
1471                 {
1472 #ifdef JP
1473 msg_print("¥Ò¡¼¥í¡¼¤Îµ¤Ê¬¤¬¾Ã¤¨¼º¤»¤¿¡£");
1474 #else
1475                         msg_print("The heroism wears off.");
1476 #endif
1477
1478                         notice = TRUE;
1479                 }
1480         }
1481
1482         /* Use the value */
1483         p_ptr->hero = v;
1484
1485         /* Redraw status bar */
1486         p_ptr->redraw |= (PR_STATUS);
1487
1488         /* Nothing to notice */
1489         if (!notice) return (FALSE);
1490
1491         /* Disturb */
1492         if (disturb_state) disturb(0, 0);
1493
1494         /* Recalculate bonuses */
1495         p_ptr->update |= (PU_BONUS);
1496
1497         /* Recalculate hitpoints */
1498         p_ptr->update |= (PU_HP);
1499
1500         /* Handle stuff */
1501         handle_stuff();
1502
1503         /* Result */
1504         return (TRUE);
1505 }
1506
1507 /*!
1508  * @brief ¶¸Àï»Î²½¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->shero", notice observable changes
1509  * @param v ·Ñ³»þ´Ö
1510  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1511  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1512  */
1513 bool set_shero(int v, bool do_dec)
1514 {
1515         bool notice = FALSE;
1516
1517         /* Hack -- Force good values */
1518         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1519
1520         if (p_ptr->is_dead) return FALSE;
1521
1522         if (p_ptr->pclass == CLASS_BERSERKER) v = 1;
1523         /* Open */
1524         if (v)
1525         {
1526                 if (p_ptr->shero && !do_dec)
1527                 {
1528                         if (p_ptr->shero > v) return FALSE;
1529                 }
1530                 else if (!p_ptr->shero)
1531                 {
1532 #ifdef JP
1533 msg_print("»¦Ù¤¥Þ¥·¡¼¥ó¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1534 #else
1535                         msg_print("You feel like a killing machine!");
1536 #endif
1537
1538                         notice = TRUE;
1539                 }
1540         }
1541
1542         /* Shut */
1543         else
1544         {
1545                 if (p_ptr->shero)
1546                 {
1547 #ifdef JP
1548 msg_print("ÌîÈڤʵ¤»ý¤Á¤¬¾Ã¤¨¼º¤»¤¿¡£");
1549 #else
1550                         msg_print("You feel less Berserk.");
1551 #endif
1552
1553                         notice = TRUE;
1554                 }
1555         }
1556
1557         /* Use the value */
1558         p_ptr->shero = v;
1559
1560         /* Redraw status bar */
1561         p_ptr->redraw |= (PR_STATUS);
1562
1563         /* Nothing to notice */
1564         if (!notice) return (FALSE);
1565
1566         /* Disturb */
1567         if (disturb_state) disturb(0, 0);
1568
1569         /* Recalculate bonuses */
1570         p_ptr->update |= (PU_BONUS);
1571
1572         /* Recalculate hitpoints */
1573         p_ptr->update |= (PU_HP);
1574
1575         /* Handle stuff */
1576         handle_stuff();
1577
1578         /* Result */
1579         return (TRUE);
1580 }
1581
1582 /*!
1583  * @brief Âмٰ­·ë³¦¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->protevil", notice observable changes
1584  * @param v ·Ñ³»þ´Ö
1585  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1586  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1587  */
1588 bool set_protevil(int v, bool do_dec)
1589 {
1590         bool notice = FALSE;
1591
1592         /* Hack -- Force good values */
1593         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1594
1595         if (p_ptr->is_dead) return FALSE;
1596
1597         /* Open */
1598         if (v)
1599         {
1600                 if (p_ptr->protevil && !do_dec)
1601                 {
1602                         if (p_ptr->protevil > v) return FALSE;
1603                 }
1604                 else if (!p_ptr->protevil)
1605                 {
1606 #ifdef JP
1607 msg_print("¼Ù°­¤Ê¤ë¸ºß¤«¤é¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Ê´¶¤¸¤¬¤¹¤ë¡ª");
1608 #else
1609                         msg_print("You feel safe from evil!");
1610 #endif
1611
1612                         notice = TRUE;
1613                 }
1614         }
1615
1616         /* Shut */
1617         else
1618         {
1619                 if (p_ptr->protevil)
1620                 {
1621 #ifdef JP
1622 msg_print("¼Ù°­¤Ê¤ë¸ºß¤«¤é¼é¤é¤ì¤Æ¤¤¤ë´¶¤¸¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
1623 #else
1624                         msg_print("You no longer feel safe from evil.");
1625 #endif
1626
1627                         notice = TRUE;
1628                 }
1629         }
1630
1631         /* Use the value */
1632         p_ptr->protevil = v;
1633
1634         /* Redraw status bar */
1635         p_ptr->redraw |= (PR_STATUS);
1636
1637         /* Nothing to notice */
1638         if (!notice) return (FALSE);
1639
1640         /* Disturb */
1641         if (disturb_state) disturb(0, 0);
1642
1643         /* Handle stuff */
1644         handle_stuff();
1645
1646         /* Result */
1647         return (TRUE);
1648 }
1649
1650 /*!
1651  * @brief Í©Âβ½¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->wraith_form", notice observable changes
1652  * @param v ·Ñ³»þ´Ö
1653  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1654  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1655  */
1656 bool set_wraith_form(int v, bool do_dec)
1657 {
1658         bool notice = FALSE;
1659
1660         /* Hack -- Force good values */
1661         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1662
1663         if (p_ptr->is_dead) return FALSE;
1664
1665         /* Open */
1666         if (v)
1667         {
1668                 if (p_ptr->wraith_form && !do_dec)
1669                 {
1670                         if (p_ptr->wraith_form > v) return FALSE;
1671                 }
1672                 else if (!p_ptr->wraith_form)
1673                 {
1674 #ifdef JP
1675 msg_print("ʪ¼Á³¦¤òÎ¥¤ì¤ÆÍ©µ´¤Î¤è¤¦¤Ê¸ºß¤Ë¤Ê¤Ã¤¿¡ª");
1676 #else
1677                         msg_print("You leave the physical world and turn into a wraith-being!");
1678 #endif
1679
1680                         notice = TRUE;
1681
1682                         chg_virtue(V_UNLIFE, 3);
1683                         chg_virtue(V_HONOUR, -2);
1684                         chg_virtue(V_SACRIFICE, -2);
1685                         chg_virtue(V_VALOUR, -5);
1686
1687                         /* Redraw map */
1688                         p_ptr->redraw |= (PR_MAP);
1689
1690                         /* Update monsters */
1691                         p_ptr->update |= (PU_MONSTERS);
1692
1693                         /* Window stuff */
1694                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1695                 }
1696         }
1697
1698         /* Shut */
1699         else
1700         {
1701                 if (p_ptr->wraith_form)
1702                 {
1703 #ifdef JP
1704 msg_print("ÉÔÆ©ÌÀ¤Ë¤Ê¤Ã¤¿´¶¤¸¤¬¤¹¤ë¡£");
1705 #else
1706                         msg_print("You feel opaque.");
1707 #endif
1708
1709                         notice = TRUE;
1710
1711                         /* Redraw map */
1712                         p_ptr->redraw |= (PR_MAP);
1713
1714                         /* Update monsters */
1715                         p_ptr->update |= (PU_MONSTERS);
1716
1717                         /* Window stuff */
1718                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1719                 }
1720         }
1721
1722         /* Use the value */
1723         p_ptr->wraith_form = v;
1724
1725         /* Redraw status bar */
1726         p_ptr->redraw |= (PR_STATUS);
1727
1728         /* Nothing to notice */
1729         if (!notice) return (FALSE);
1730
1731         /* Disturb */
1732         if (disturb_state) disturb(0, 0);
1733
1734         /* Recalculate bonuses */
1735         p_ptr->update |= (PU_BONUS);
1736
1737         /* Handle stuff */
1738         handle_stuff();
1739
1740         /* Result */
1741         return (TRUE);
1742
1743 }
1744
1745 /*!
1746  * @brief Ìµ½ýµå¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->invuln", notice observable changes
1747  * @param v ·Ñ³»þ´Ö
1748  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1749  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1750  */
1751 bool set_invuln(int v, bool do_dec)
1752 {
1753         bool notice = FALSE;
1754
1755         /* Hack -- Force good values */
1756         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1757
1758         if (p_ptr->is_dead) return FALSE;
1759
1760         /* Open */
1761         if (v)
1762         {
1763                 if (p_ptr->invuln && !do_dec)
1764                 {
1765                         if (p_ptr->invuln > v) return FALSE;
1766                 }
1767                 else if (!IS_INVULN())
1768                 {
1769 #ifdef JP
1770 msg_print("̵Ũ¤À¡ª");
1771 #else
1772                         msg_print("Invulnerability!");
1773 #endif
1774
1775                         notice = TRUE;
1776
1777                         chg_virtue(V_UNLIFE, -2);
1778                         chg_virtue(V_HONOUR, -2);
1779                         chg_virtue(V_SACRIFICE, -3);
1780                         chg_virtue(V_VALOUR, -5);
1781
1782                         /* Redraw map */
1783                         p_ptr->redraw |= (PR_MAP);
1784
1785                         /* Update monsters */
1786                         p_ptr->update |= (PU_MONSTERS);
1787
1788                         /* Window stuff */
1789                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1790                 }
1791         }
1792
1793         /* Shut */
1794         else
1795         {
1796                 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1797                 {
1798 #ifdef JP
1799 msg_print("̵Ũ¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
1800 #else
1801                         msg_print("The invulnerability wears off.");
1802 #endif
1803
1804                         notice = TRUE;
1805
1806                         /* Redraw map */
1807                         p_ptr->redraw |= (PR_MAP);
1808
1809                         /* Update monsters */
1810                         p_ptr->update |= (PU_MONSTERS);
1811
1812                         /* Window stuff */
1813                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1814
1815                         p_ptr->energy_need += ENERGY_NEED();
1816                 }
1817         }
1818
1819         /* Use the value */
1820         p_ptr->invuln = v;
1821
1822         /* Redraw status bar */
1823         p_ptr->redraw |= (PR_STATUS);
1824
1825         /* Nothing to notice */
1826         if (!notice) return (FALSE);
1827
1828         /* Disturb */
1829         if (disturb_state) disturb(0, 0);
1830
1831         /* Recalculate bonuses */
1832         p_ptr->update |= (PU_BONUS);
1833
1834         /* Handle stuff */
1835         handle_stuff();
1836
1837         /* Result */
1838         return (TRUE);
1839 }
1840
1841 /*!
1842  * @brief »þ¸ÂESP¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_esp", notice observable changes
1843  * @param v ·Ñ³»þ´Ö
1844  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1845  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1846  */
1847 bool set_tim_esp(int v, bool do_dec)
1848 {
1849         bool notice = FALSE;
1850
1851         /* Hack -- Force good values */
1852         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1853
1854         if (p_ptr->is_dead) return FALSE;
1855
1856         /* Open */
1857         if (v)
1858         {
1859                 if (p_ptr->tim_esp && !do_dec)
1860                 {
1861                         if (p_ptr->tim_esp > v) return FALSE;
1862                 }
1863                 else if (!IS_TIM_ESP())
1864                 {
1865 #ifdef JP
1866 msg_print("°Õ¼±¤¬¹­¤¬¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1867 #else
1868                         msg_print("You feel your consciousness expand!");
1869 #endif
1870
1871                         notice = TRUE;
1872                 }
1873         }
1874
1875         /* Shut */
1876         else
1877         {
1878                 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1879                 {
1880 #ifdef JP
1881 msg_print("°Õ¼±¤Ï¸µ¤ËÌá¤Ã¤¿¡£");
1882 #else
1883                         msg_print("Your consciousness contracts again.");
1884 #endif
1885
1886                         notice = TRUE;
1887                 }
1888         }
1889
1890         /* Use the value */
1891         p_ptr->tim_esp = v;
1892
1893         /* Redraw status bar */
1894         p_ptr->redraw |= (PR_STATUS);
1895
1896         /* Nothing to notice */
1897         if (!notice) return (FALSE);
1898
1899         /* Disturb */
1900         if (disturb_state) disturb(0, 0);
1901
1902         /* Recalculate bonuses */
1903         p_ptr->update |= (PU_BONUS);
1904
1905         /* Update the monsters */
1906         p_ptr->update |= (PU_MONSTERS);
1907
1908         /* Handle stuff */
1909         handle_stuff();
1910
1911         /* Result */
1912         return (TRUE);
1913 }
1914
1915 /*!
1916  * @brief »þ¸ÂÆ©ÌÀ»ë¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_invis", notice observable changes
1917  * @param v ·Ñ³»þ´Ö
1918  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1919  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1920  */
1921 bool set_tim_invis(int v, bool do_dec)
1922 {
1923         bool notice = FALSE;
1924
1925         /* Hack -- Force good values */
1926         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1927
1928         if (p_ptr->is_dead) return FALSE;
1929
1930         /* Open */
1931         if (v)
1932         {
1933                 if (p_ptr->tim_invis && !do_dec)
1934                 {
1935                         if (p_ptr->tim_invis > v) return FALSE;
1936                 }
1937                 else if (!p_ptr->tim_invis)
1938                 {
1939 #ifdef JP
1940 msg_print("Ìܤ¬Èó¾ï¤ËÉÒ´¶¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1941 #else
1942                         msg_print("Your eyes feel very sensitive!");
1943 #endif
1944
1945                         notice = TRUE;
1946                 }
1947         }
1948
1949         /* Shut */
1950         else
1951         {
1952                 if (p_ptr->tim_invis)
1953                 {
1954 #ifdef JP
1955 msg_print("ÌܤÎÉÒ´¶¤µ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
1956 #else
1957                         msg_print("Your eyes feel less sensitive.");
1958 #endif
1959
1960                         notice = TRUE;
1961                 }
1962         }
1963
1964         /* Use the value */
1965         p_ptr->tim_invis = v;
1966
1967         /* Redraw status bar */
1968         p_ptr->redraw |= (PR_STATUS);
1969
1970         /* Nothing to notice */
1971         if (!notice) return (FALSE);
1972
1973         /* Disturb */
1974         if (disturb_state) disturb(0, 0);
1975
1976         /* Recalculate bonuses */
1977         p_ptr->update |= (PU_BONUS);
1978
1979         /* Update the monsters */
1980         p_ptr->update |= (PU_MONSTERS);
1981
1982         /* Handle stuff */
1983         handle_stuff();
1984
1985         /* Result */
1986         return (TRUE);
1987 }
1988
1989 /*!
1990  * @brief »þ¸ÂÀÖ³°Àþ»ëÎϤηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_infra", notice observable changes
1991  * @param v ·Ñ³»þ´Ö
1992  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
1993  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
1994  */
1995 bool set_tim_infra(int v, bool do_dec)
1996 {
1997         bool notice = FALSE;
1998
1999         /* Hack -- Force good values */
2000         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2001
2002         if (p_ptr->is_dead) return FALSE;
2003
2004         /* Open */
2005         if (v)
2006         {
2007                 if (p_ptr->tim_infra && !do_dec)
2008                 {
2009                         if (p_ptr->tim_infra > v) return FALSE;
2010                 }
2011                 else if (!p_ptr->tim_infra)
2012                 {
2013 #ifdef JP
2014 msg_print("Ìܤ¬¥é¥ó¥é¥ó¤Èµ±¤­»Ï¤á¤¿¡ª");
2015 #else
2016                         msg_print("Your eyes begin to tingle!");
2017 #endif
2018
2019                         notice = TRUE;
2020                 }
2021         }
2022
2023         /* Shut */
2024         else
2025         {
2026                 if (p_ptr->tim_infra)
2027                 {
2028 #ifdef JP
2029 msg_print("Ìܤ層­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2030 #else
2031                         msg_print("Your eyes stop tingling.");
2032 #endif
2033
2034                         notice = TRUE;
2035                 }
2036         }
2037
2038         /* Use the value */
2039         p_ptr->tim_infra = v;
2040
2041         /* Redraw status bar */
2042         p_ptr->redraw |= (PR_STATUS);
2043
2044         /* Nothing to notice */
2045         if (!notice) return (FALSE);
2046
2047         /* Disturb */
2048         if (disturb_state) disturb(0, 0);
2049
2050         /* Recalculate bonuses */
2051         p_ptr->update |= (PU_BONUS);
2052
2053         /* Update the monsters */
2054         p_ptr->update |= (PU_MONSTERS);
2055
2056         /* Handle stuff */
2057         handle_stuff();
2058
2059         /* Result */
2060         return (TRUE);
2061 }
2062
2063 /*!
2064  * @brief »þ¸ÂµÞ²óÉü¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_regen", notice observable changes
2065  * @param v ·Ñ³»þ´Ö
2066  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2067  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2068  */
2069 bool set_tim_regen(int v, bool do_dec)
2070 {
2071         bool notice = FALSE;
2072
2073         /* Hack -- Force good values */
2074         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2075
2076         if (p_ptr->is_dead) return FALSE;
2077
2078         /* Open */
2079         if (v)
2080         {
2081                 if (p_ptr->tim_regen && !do_dec)
2082                 {
2083                         if (p_ptr->tim_regen > v) return FALSE;
2084                 }
2085                 else if (!p_ptr->tim_regen)
2086                 {
2087 #ifdef JP
2088 msg_print("²óÉüÎϤ¬¾å¤¬¤Ã¤¿¡ª");
2089 #else
2090                         msg_print("You feel yourself regenerating quickly!");
2091 #endif
2092
2093                         notice = TRUE;
2094                 }
2095         }
2096
2097         /* Shut */
2098         else
2099         {
2100                 if (p_ptr->tim_regen)
2101                 {
2102 #ifdef JP
2103 msg_print("ÁÇÁ᤯²óÉü¤¹¤ë´¶¤¸¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2104 #else
2105                         msg_print("You feel yourself regenerating slowly.");
2106 #endif
2107
2108                         notice = TRUE;
2109                 }
2110         }
2111
2112         /* Use the value */
2113         p_ptr->tim_regen = v;
2114
2115         /* Redraw status bar */
2116         p_ptr->redraw |= (PR_STATUS);
2117
2118         /* Nothing to notice */
2119         if (!notice) return (FALSE);
2120
2121         /* Disturb */
2122         if (disturb_state) disturb(0, 0);
2123
2124         /* Recalculate bonuses */
2125         p_ptr->update |= (PU_BONUS);
2126
2127         /* Handle stuff */
2128         handle_stuff();
2129
2130         /* Result */
2131         return (TRUE);
2132 }
2133
2134 /*!
2135  * @brief ±£Ì©¤Î²Î¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_stealth", notice observable changes
2136  * @param v ·Ñ³»þ´Ö
2137  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2138  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2139  */
2140 bool set_tim_stealth(int v, bool do_dec)
2141 {
2142         bool notice = FALSE;
2143
2144         /* Hack -- Force good values */
2145         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2146
2147         if (p_ptr->is_dead) return FALSE;
2148
2149         /* Open */
2150         if (v)
2151         {
2152                 if (p_ptr->tim_stealth && !do_dec)
2153                 {
2154                         if (p_ptr->tim_stealth > v) return FALSE;
2155                 }
2156                 else if (!IS_TIM_STEALTH())
2157                 {
2158 #ifdef JP
2159 msg_print("­²»¤¬¾®¤µ¤¯¤Ê¤Ã¤¿¡ª");
2160 #else
2161                         msg_print("You begin to walk silently!");
2162 #endif
2163
2164                         notice = TRUE;
2165                 }
2166         }
2167
2168         /* Shut */
2169         else
2170         {
2171                 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
2172                 {
2173 #ifdef JP
2174 msg_print("­²»¤¬Â礭¤¯¤Ê¤Ã¤¿¡£");
2175 #else
2176                         msg_print("You no longer walk silently.");
2177 #endif
2178
2179                         notice = TRUE;
2180                 }
2181         }
2182
2183         /* Use the value */
2184         p_ptr->tim_stealth = v;
2185
2186         /* Redraw status bar */
2187         p_ptr->redraw |= (PR_STATUS);
2188
2189         /* Nothing to notice */
2190         if (!notice) return (FALSE);
2191
2192         /* Disturb */
2193         if (disturb_state) disturb(0, 0);
2194
2195         /* Recalculate bonuses */
2196         p_ptr->update |= (PU_BONUS);
2197
2198         /* Handle stuff */
2199         handle_stuff();
2200
2201         /* Result */
2202         return (TRUE);
2203 }
2204
2205 /*!
2206  * @brief Ä¶±£Ì©¾õÂÖ¤ò¥»¥Ã¥È¤¹¤ë
2207  * @param set TRUE¤Ê¤é¤ÐĶ±£Ì©¾õÂ֤ˤʤ롣
2208  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2209  */
2210 bool set_superstealth(bool set)
2211 {
2212         bool notice = FALSE;
2213
2214         if (p_ptr->is_dead) return FALSE;
2215
2216         /* Open */
2217         if (set)
2218         {
2219                 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
2220                 {
2221                         if (cave[py][px].info & CAVE_MNLT)
2222                         {
2223 #ifdef JP
2224                                 msg_print("Ũ¤ÎÌܤ«¤éÇö¤¤±Æ¤ÎÃæ¤Ëʤ¤¤±£¤µ¤ì¤¿¡£");
2225 #else
2226                                 msg_print("You are mantled in weak shadow from ordinary eyes.");
2227 #endif
2228                                 p_ptr->monlite = p_ptr->old_monlite = TRUE;
2229                         }
2230                         else
2231                         {
2232 #ifdef JP
2233                                 msg_print("Ũ¤ÎÌܤ«¤é±Æ¤ÎÃæ¤Ëʤ¤¤±£¤µ¤ì¤¿¡ª");
2234 #else
2235                                 msg_print("You are mantled in shadow from ordinary eyes!");
2236 #endif
2237                                 p_ptr->monlite = p_ptr->old_monlite = FALSE;
2238                         }
2239
2240                         notice = TRUE;
2241
2242                         /* Use the value */
2243                         p_ptr->special_defense |= NINJA_S_STEALTH;
2244                 }
2245         }
2246
2247         /* Shut */
2248         else
2249         {
2250                 if (p_ptr->special_defense & NINJA_S_STEALTH)
2251                 {
2252 #ifdef JP
2253                         msg_print("ºÆ¤ÓŨ¤ÎÌܤˤµ¤é¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
2254 #else
2255                         msg_print("You are exposed to common sight once more.");
2256 #endif
2257
2258                         notice = TRUE;
2259
2260                         /* Use the value */
2261                         p_ptr->special_defense &= ~(NINJA_S_STEALTH);
2262                 }
2263         }
2264
2265         /* Nothing to notice */
2266         if (!notice) return (FALSE);
2267
2268         /* Redraw status bar */
2269         p_ptr->redraw |= (PR_STATUS);
2270
2271         /* Disturb */
2272         if (disturb_state) disturb(0, 0);
2273
2274         /* Result */
2275         return (TRUE);
2276 }
2277
2278 /*!
2279  * @brief °ì»þŪÉâÍ·¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_levitation", notice observable changes
2280  * @param v ·Ñ³»þ´Ö
2281  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2282  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2283  */
2284 bool set_tim_levitation(int v, bool do_dec)
2285 {
2286         bool notice = FALSE;
2287
2288         /* Hack -- Force good values */
2289         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2290
2291         if (p_ptr->is_dead) return FALSE;
2292
2293         /* Open */
2294         if (v)
2295         {
2296                 if (p_ptr->tim_levitation && !do_dec)
2297                 {
2298                         if (p_ptr->tim_levitation > v) return FALSE;
2299                 }
2300                 else if (!p_ptr->tim_levitation)
2301                 {
2302 #ifdef JP
2303 msg_print("ÂΤ¬Ãè¤ËÉ⤭»Ï¤á¤¿¡£");
2304 #else
2305                         msg_print("You begin to fly!");
2306 #endif
2307
2308                         notice = TRUE;
2309                 }
2310         }
2311
2312         /* Shut */
2313         else
2314         {
2315                 if (p_ptr->tim_levitation)
2316                 {
2317 #ifdef JP
2318 msg_print("¤â¤¦Ãè¤ËÉ⤫¤Ù¤Ê¤¯¤Ê¤Ã¤¿¡£");
2319 #else
2320                         msg_print("You stop flying.");
2321 #endif
2322
2323                         notice = TRUE;
2324                 }
2325         }
2326
2327         /* Use the value */
2328         p_ptr->tim_levitation = v;
2329
2330         /* Redraw status bar */
2331         p_ptr->redraw |= (PR_STATUS);
2332
2333         /* Nothing to notice */
2334         if (!notice) return (FALSE);
2335
2336         /* Disturb */
2337         if (disturb_state) disturb(0, 0);
2338
2339         /* Recalculate bonuses */
2340         p_ptr->update |= (PU_BONUS);
2341
2342         /* Handle stuff */
2343         handle_stuff();
2344
2345         /* Result */
2346         return (TRUE);
2347 }
2348
2349 /*!
2350  * @brief °ì»þŪƮµ¤¤Î¥ª¡¼¥é¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_sh_touki", notice observable changes
2351  * @param v ·Ñ³»þ´Ö
2352  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2353  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2354  */
2355 bool set_tim_sh_touki(int v, bool do_dec)
2356 {
2357         bool notice = FALSE;
2358
2359         /* Hack -- Force good values */
2360         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2361
2362         if (p_ptr->is_dead) return FALSE;
2363
2364         /* Open */
2365         if (v)
2366         {
2367                 if (p_ptr->tim_sh_touki && !do_dec)
2368                 {
2369                         if (p_ptr->tim_sh_touki > v) return FALSE;
2370                 }
2371                 else if (!p_ptr->tim_sh_touki)
2372                 {
2373 #ifdef JP
2374 msg_print("ÂΤ¬Æ®µ¤¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2375 #else
2376                         msg_print("You have enveloped by the aura of the Force!");
2377 #endif
2378
2379                         notice = TRUE;
2380                 }
2381         }
2382
2383         /* Shut */
2384         else
2385         {
2386                 if (p_ptr->tim_sh_touki)
2387                 {
2388 #ifdef JP
2389 msg_print("Æ®µ¤¤¬¾Ã¤¨¤¿¡£");
2390 #else
2391                         msg_print("Aura of the Force disappeared.");
2392 #endif
2393
2394                         notice = TRUE;
2395                 }
2396         }
2397
2398         /* Use the value */
2399         p_ptr->tim_sh_touki = v;
2400
2401         /* Redraw status bar */
2402         p_ptr->redraw |= (PR_STATUS);
2403
2404         /* Nothing to notice */
2405         if (!notice) return (FALSE);
2406
2407         /* Disturb */
2408         if (disturb_state) disturb(0, 0);
2409
2410         /* Handle stuff */
2411         handle_stuff();
2412
2413         /* Result */
2414         return (TRUE);
2415 }
2416
2417 /*!
2418  * @brief °ì»þŪ²Ð±ê¤Î¥ª¡¼¥é¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_sh_fire", notice observable changes
2419  * @param v ·Ñ³»þ´Ö
2420  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2421  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2422  */
2423 bool set_tim_sh_fire(int v, bool do_dec)
2424 {
2425         bool notice = FALSE;
2426
2427         /* Hack -- Force good values */
2428         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2429
2430         if (p_ptr->is_dead) return FALSE;
2431
2432         /* Open */
2433         if (v)
2434         {
2435                 if (p_ptr->tim_sh_fire && !do_dec)
2436                 {
2437                         if (p_ptr->tim_sh_fire > v) return FALSE;
2438                 }
2439                 else if (!p_ptr->tim_sh_fire)
2440                 {
2441 #ifdef JP
2442 msg_print("ÂΤ¬±ê¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2443 #else
2444                         msg_print("You have enveloped by fiery aura!");
2445 #endif
2446
2447                         notice = TRUE;
2448                 }
2449         }
2450
2451         /* Shut */
2452         else
2453         {
2454                 if (p_ptr->tim_sh_fire)
2455                 {
2456 #ifdef JP
2457 msg_print("±ê¤Î¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2458 #else
2459                         msg_print("Fiery aura disappeared.");
2460 #endif
2461
2462                         notice = TRUE;
2463                 }
2464         }
2465
2466         /* Use the value */
2467         p_ptr->tim_sh_fire = v;
2468
2469         /* Redraw status bar */
2470         p_ptr->redraw |= (PR_STATUS);
2471
2472         /* Nothing to notice */
2473         if (!notice) return (FALSE);
2474
2475         /* Disturb */
2476         if (disturb_state) disturb(0, 0);
2477
2478         /* Recalculate bonuses */
2479         p_ptr->update |= (PU_BONUS);
2480
2481         /* Handle stuff */
2482         handle_stuff();
2483
2484         /* Result */
2485         return (TRUE);
2486 }
2487
2488 /*!
2489  * @brief °ì»þŪÀ»¤Ê¤ë¤Î¥ª¡¼¥é¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_sh_holy", notice observable changes
2490  * @param v ·Ñ³»þ´Ö
2491  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2492  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2493  */
2494 bool set_tim_sh_holy(int v, bool do_dec)
2495 {
2496         bool notice = FALSE;
2497
2498         /* Hack -- Force good values */
2499         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2500
2501         if (p_ptr->is_dead) return FALSE;
2502
2503         /* Open */
2504         if (v)
2505         {
2506                 if (p_ptr->tim_sh_holy && !do_dec)
2507                 {
2508                         if (p_ptr->tim_sh_holy > v) return FALSE;
2509                 }
2510                 else if (!p_ptr->tim_sh_holy)
2511                 {
2512 #ifdef JP
2513 msg_print("ÂΤ¬À»¤Ê¤ë¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2514 #else
2515                         msg_print("You have enveloped by holy aura!");
2516 #endif
2517
2518                         notice = TRUE;
2519                 }
2520         }
2521
2522         /* Shut */
2523         else
2524         {
2525                 if (p_ptr->tim_sh_holy)
2526                 {
2527 #ifdef JP
2528 msg_print("À»¤Ê¤ë¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2529 #else
2530                         msg_print("Holy aura disappeared.");
2531 #endif
2532
2533                         notice = TRUE;
2534                 }
2535         }
2536
2537         /* Use the value */
2538         p_ptr->tim_sh_holy = v;
2539
2540         /* Redraw status bar */
2541         p_ptr->redraw |= (PR_STATUS);
2542
2543         /* Nothing to notice */
2544         if (!notice) return (FALSE);
2545
2546         /* Disturb */
2547         if (disturb_state) disturb(0, 0);
2548
2549         /* Recalculate bonuses */
2550         p_ptr->update |= (PU_BONUS);
2551
2552         /* Handle stuff */
2553         handle_stuff();
2554
2555         /* Result */
2556         return (TRUE);
2557 }
2558
2559 /*!
2560  * @brief ÌܤˤÏÌܤò¤Î»Ä¤ê»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_eyeeye", notice observable changes
2561  * @param v ·Ñ³»þ´Ö
2562  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2563  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2564  */
2565 bool set_tim_eyeeye(int v, bool do_dec)
2566 {
2567         bool notice = FALSE;
2568
2569         /* Hack -- Force good values */
2570         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2571
2572         if (p_ptr->is_dead) return FALSE;
2573
2574         /* Open */
2575         if (v)
2576         {
2577                 if (p_ptr->tim_eyeeye && !do_dec)
2578                 {
2579                         if (p_ptr->tim_eyeeye > v) return FALSE;
2580                 }
2581                 else if (!p_ptr->tim_eyeeye)
2582                 {
2583 #ifdef JP
2584 msg_print("Ë¡¤Î¼é¤ê¼ê¤Ë¤Ê¤Ã¤¿µ¤¤¬¤·¤¿¡ª");
2585 #else
2586                         msg_print("You feel like a keeper of commandments!");
2587 #endif
2588
2589                         notice = TRUE;
2590                 }
2591         }
2592
2593         /* Shut */
2594         else
2595         {
2596                 if (p_ptr->tim_eyeeye)
2597                 {
2598 #ifdef JP
2599 msg_print("Ĩȳ¤ò¼¹¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
2600 #else
2601                         msg_print("You no longer feel like a keeper.");
2602 #endif
2603
2604                         notice = TRUE;
2605                 }
2606         }
2607
2608         /* Use the value */
2609         p_ptr->tim_eyeeye = v;
2610
2611         /* Redraw status bar */
2612         p_ptr->redraw |= (PR_STATUS);
2613
2614         /* Nothing to notice */
2615         if (!notice) return (FALSE);
2616
2617         /* Disturb */
2618         if (disturb_state) disturb(0, 0);
2619
2620         /* Recalculate bonuses */
2621         p_ptr->update |= (PU_BONUS);
2622
2623         /* Handle stuff */
2624         handle_stuff();
2625
2626         /* Result */
2627         return (TRUE);
2628 }
2629
2630
2631 /*!
2632  * @brief °ì»þŪËâË¡Ëɸæ¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->resist_magic", notice observable changes
2633  * @param v ·Ñ³»þ´Ö
2634  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2635  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2636  */
2637 bool set_resist_magic(int v, bool do_dec)
2638 {
2639         bool notice = FALSE;
2640
2641         /* Hack -- Force good values */
2642         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2643
2644         if (p_ptr->is_dead) return FALSE;
2645
2646         /* Open */
2647         if (v)
2648         {
2649                 if (p_ptr->resist_magic && !do_dec)
2650                 {
2651                         if (p_ptr->resist_magic > v) return FALSE;
2652                 }
2653                 else if (!p_ptr->resist_magic)
2654                 {
2655 #ifdef JP
2656 msg_print("ËâË¡¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿¡£");
2657 #else
2658                         msg_print("You have been protected from magic!");
2659 #endif
2660
2661                         notice = TRUE;
2662                 }
2663         }
2664
2665         /* Shut */
2666         else
2667         {
2668                 if (p_ptr->resist_magic)
2669                 {
2670 #ifdef JP
2671 msg_print("ËâË¡¤Ë¼å¤¯¤Ê¤Ã¤¿¡£");
2672 #else
2673 msg_print("You are no longer protected from magic.");
2674 #endif
2675
2676                         notice = TRUE;
2677                 }
2678         }
2679
2680         /* Use the value */
2681         p_ptr->resist_magic = v;
2682
2683         /* Redraw status bar */
2684         p_ptr->redraw |= (PR_STATUS);
2685
2686         /* Nothing to notice */
2687         if (!notice) return (FALSE);
2688
2689         /* Disturb */
2690         if (disturb_state) disturb(0, 0);
2691
2692         /* Recalculate bonuses */
2693         p_ptr->update |= (PU_BONUS);
2694
2695         /* Handle stuff */
2696         handle_stuff();
2697
2698         /* Result */
2699         return (TRUE);
2700 }
2701
2702 /*!
2703  * @brief °ì»þŪȿ¼Í¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tim_reflect", notice observable changes
2704  * @param v ·Ñ³»þ´Ö
2705  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2706  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2707  */
2708 bool set_tim_reflect(int v, bool do_dec)
2709 {
2710         bool notice = FALSE;
2711
2712         /* Hack -- Force good values */
2713         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2714
2715         if (p_ptr->is_dead) return FALSE;
2716
2717         /* Open */
2718         if (v)
2719         {
2720                 if (p_ptr->tim_reflect && !do_dec)
2721                 {
2722                         if (p_ptr->tim_reflect > v) return FALSE;
2723                 }
2724                 else if (!p_ptr->tim_reflect)
2725                 {
2726 #ifdef JP
2727 msg_print("ÂΤÎɽÌ̤¬³ê¤«¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2728 #else
2729                         msg_print("Your body becames smooth.");
2730 #endif
2731
2732                         notice = TRUE;
2733                 }
2734         }
2735
2736         /* Shut */
2737         else
2738         {
2739                 if (p_ptr->tim_reflect)
2740                 {
2741 #ifdef JP
2742 msg_print("ÂΤÎɽÌ̤¬³ê¤«¤Ç¤Ê¤¯¤Ê¤Ã¤¿¡£");
2743 #else
2744                         msg_print("Your body is no longer smooth.");
2745 #endif
2746
2747                         notice = TRUE;
2748                 }
2749         }
2750
2751         /* Use the value */
2752         p_ptr->tim_reflect = v;
2753
2754         /* Redraw status bar */
2755         p_ptr->redraw |= (PR_STATUS);
2756
2757         /* Nothing to notice */
2758         if (!notice) return (FALSE);
2759
2760         /* Disturb */
2761         if (disturb_state) disturb(0, 0);
2762
2763         /* Recalculate bonuses */
2764         p_ptr->update |= (PU_BONUS);
2765
2766         /* Handle stuff */
2767         handle_stuff();
2768
2769         /* Result */
2770         return (TRUE);
2771 }
2772
2773
2774 /*
2775  * Set "p_ptr->multishadow", notice observable changes
2776  */
2777 bool set_multishadow(int v, bool do_dec)
2778 {
2779         bool notice = FALSE;
2780
2781         /* Hack -- Force good values */
2782         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2783
2784         if (p_ptr->is_dead) return FALSE;
2785
2786         /* Open */
2787         if (v)
2788         {
2789                 if (p_ptr->multishadow && !do_dec)
2790                 {
2791                         if (p_ptr->multishadow > v) return FALSE;
2792                 }
2793                 else if (!p_ptr->multishadow)
2794                 {
2795 #ifdef JP
2796 msg_print("¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¸¸±Æ¤¬À¸¤Þ¤ì¤¿¡£");
2797 #else
2798                         msg_print("Your Shadow enveloped you.");
2799 #endif
2800
2801                         notice = TRUE;
2802                 }
2803         }
2804
2805         /* Shut */
2806         else
2807         {
2808                 if (p_ptr->multishadow)
2809                 {
2810 #ifdef JP
2811 msg_print("¸¸±Æ¤¬¾Ã¤¨¤¿¡£");
2812 #else
2813                         msg_print("Your Shadow disappears.");
2814 #endif
2815
2816                         notice = TRUE;
2817                 }
2818         }
2819
2820         /* Use the value */
2821         p_ptr->multishadow = v;
2822
2823         /* Redraw status bar */
2824         p_ptr->redraw |= (PR_STATUS);
2825
2826         /* Nothing to notice */
2827         if (!notice) return (FALSE);
2828
2829         /* Disturb */
2830         if (disturb_state) disturb(0, 0);
2831
2832         /* Recalculate bonuses */
2833         p_ptr->update |= (PU_BONUS);
2834
2835         /* Handle stuff */
2836         handle_stuff();
2837
2838         /* Result */
2839         return (TRUE);
2840 }
2841
2842 /*!
2843  * @brief °ì»þŪÇËÊҤΥª¡¼¥é¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->dustrobe", notice observable changes
2844  * @param v ·Ñ³»þ´Ö
2845  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2846  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2847  */
2848 bool set_dustrobe(int v, bool do_dec)
2849 {
2850         bool notice = FALSE;
2851
2852         /* Hack -- Force good values */
2853         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2854
2855         if (p_ptr->is_dead) return FALSE;
2856
2857         /* Open */
2858         if (v)
2859         {
2860                 if (p_ptr->dustrobe && !do_dec)
2861                 {
2862                         if (p_ptr->dustrobe > v) return FALSE;
2863                 }
2864                 else if (!p_ptr->dustrobe)
2865                 {
2866 #ifdef JP
2867 msg_print("ÂΤ¬¶À¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2868 #else
2869                         msg_print("You were enveloped by mirror shards.");
2870 #endif
2871
2872                         notice = TRUE;
2873                 }
2874         }
2875
2876         /* Shut */
2877         else
2878         {
2879                 if (p_ptr->dustrobe)
2880                 {
2881 #ifdef JP
2882 msg_print("¶À¤Î¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2883 #else
2884                         msg_print("The mirror shards disappear.");
2885 #endif
2886
2887                         notice = TRUE;
2888                 }
2889         }
2890
2891         /* Use the value */
2892         p_ptr->dustrobe = v;
2893
2894         /* Redraw status bar */
2895         p_ptr->redraw |= (PR_STATUS);
2896
2897         /* Nothing to notice */
2898         if (!notice) return (FALSE);
2899
2900         /* Disturb */
2901         if (disturb_state) disturb(0, 0);
2902
2903         /* Recalculate bonuses */
2904         p_ptr->update |= (PU_BONUS);
2905
2906         /* Handle stuff */
2907         handle_stuff();
2908
2909         /* Result */
2910         return (TRUE);
2911 }
2912
2913 /*!
2914  * @brief °ì»þŪÊÉÈ´¤±¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->kabenuke", notice observable changes
2915  * @param v ·Ñ³»þ´Ö
2916  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2917  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2918  */
2919 bool set_kabenuke(int v, bool do_dec)
2920 {
2921         bool notice = FALSE;
2922
2923         /* Hack -- Force good values */
2924         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2925
2926         if (p_ptr->is_dead) return FALSE;
2927
2928         /* Open */
2929         if (v)
2930         {
2931                 if (p_ptr->kabenuke && !do_dec)
2932                 {
2933                         if (p_ptr->kabenuke > v) return FALSE;
2934                 }
2935                 else if (!p_ptr->kabenuke)
2936                 {
2937 #ifdef JP
2938 msg_print("ÂΤ¬È¾Êª¼Á¤Î¾õÂ֤ˤʤä¿¡£");
2939 #else
2940                         msg_print("You became ethereal form.");
2941 #endif
2942
2943                         notice = TRUE;
2944                 }
2945         }
2946
2947         /* Shut */
2948         else
2949         {
2950                 if (p_ptr->kabenuke)
2951                 {
2952 #ifdef JP
2953 msg_print("ÂΤ¬Êª¼Á²½¤·¤¿¡£");
2954 #else
2955                         msg_print("You are no longer in an ethereal form.");
2956 #endif
2957
2958                         notice = TRUE;
2959                 }
2960         }
2961
2962         /* Use the value */
2963         p_ptr->kabenuke = v;
2964
2965         /* Redraw status bar */
2966         p_ptr->redraw |= (PR_STATUS);
2967
2968         /* Nothing to notice */
2969         if (!notice) return (FALSE);
2970
2971         /* Disturb */
2972         if (disturb_state) disturb(0, 0);
2973
2974         /* Recalculate bonuses */
2975         p_ptr->update |= (PU_BONUS);
2976
2977         /* Handle stuff */
2978         handle_stuff();
2979
2980         /* Result */
2981         return (TRUE);
2982 }
2983
2984 /*!
2985  * @brief ¥ª¥¯¥ì·»¤µ¤ó¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->tsuyoshi", notice observable changes
2986  * @param v ·Ñ³»þ´Ö
2987  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
2988  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
2989  */
2990 bool set_tsuyoshi(int v, bool do_dec)
2991 {
2992         bool notice = FALSE;
2993
2994         /* Hack -- Force good values */
2995         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2996
2997         if (p_ptr->is_dead) return FALSE;
2998
2999         /* Open */
3000         if (v)
3001         {
3002                 if (p_ptr->tsuyoshi && !do_dec)
3003                 {
3004                         if (p_ptr->tsuyoshi > v) return FALSE;
3005                 }
3006                 else if (!p_ptr->tsuyoshi)
3007                 {
3008 #ifdef JP
3009 msg_print("¡Ö¥ª¥¯¥ì·»¤µ¤ó¡ª¡×");
3010 #else
3011                         msg_print("Brother OKURE!");
3012 #endif
3013
3014                         notice = TRUE;
3015                         chg_virtue(V_VITALITY, 2);
3016                 }
3017         }
3018
3019         /* Shut */
3020         else
3021         {
3022                 if (p_ptr->tsuyoshi)
3023                 {
3024 #ifdef JP
3025 msg_print("ÆùÂΤ¬µÞ®¤Ë¤·¤Ü¤ó¤Ç¤¤¤Ã¤¿¡£");
3026 #else
3027                         msg_print("Your body had quickly shriveled.");
3028 #endif
3029
3030                         (void)dec_stat(A_CON, 20, TRUE);
3031                         (void)dec_stat(A_STR, 20, TRUE);
3032
3033                         notice = TRUE;
3034                         chg_virtue(V_VITALITY, -3);
3035                 }
3036         }
3037
3038         /* Use the value */
3039         p_ptr->tsuyoshi = v;
3040
3041         /* Redraw status bar */
3042         p_ptr->redraw |= (PR_STATUS);
3043
3044         /* Nothing to notice */
3045         if (!notice) return (FALSE);
3046
3047         /* Disturb */
3048         if (disturb_state) disturb(0, 0);
3049
3050         /* Recalculate bonuses */
3051         p_ptr->update |= (PU_BONUS);
3052
3053         /* Recalculate hitpoints */
3054         p_ptr->update |= (PU_HP);
3055
3056         /* Handle stuff */
3057         handle_stuff();
3058
3059         /* Result */
3060         return (TRUE);
3061 }
3062
3063 /*!
3064  * @brief °ì»þŪ¸µÁÇ¥¹¥ì¥¤¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set a temporary elemental brand. Clear all other brands. Print status messages. -LM-
3065  * @param attack_type ¥¹¥ì¥¤¤Î¥¿¥¤¥×ID
3066  * @param v ·Ñ³»þ´Ö
3067  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3068  */
3069 bool set_ele_attack(u32b attack_type, int v)
3070 {
3071         /* Hack -- Force good values */
3072         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3073
3074         /* Clear all elemental attacks (only one is allowed at a time). */
3075         if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
3076         {
3077                 p_ptr->special_attack &= ~(ATTACK_ACID);
3078 #ifdef JP
3079                 msg_print("»À¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3080 #else
3081                 msg_print("Your temporary acidic brand fades away.");
3082 #endif
3083         }
3084         if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
3085         {
3086                 p_ptr->special_attack &= ~(ATTACK_ELEC);
3087 #ifdef JP
3088                 msg_print("ÅÅ·â¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3089 #else
3090                 msg_print("Your temporary electrical brand fades away.");
3091 #endif
3092         }
3093         if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
3094         {
3095                 p_ptr->special_attack &= ~(ATTACK_FIRE);
3096 #ifdef JP
3097                 msg_print("²Ð±ê¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3098 #else
3099                 msg_print("Your temporary fiery brand fades away.");
3100 #endif
3101         }
3102         if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
3103         {
3104                 p_ptr->special_attack &= ~(ATTACK_COLD);
3105 #ifdef JP
3106                 msg_print("Î䵤¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3107 #else
3108                 msg_print("Your temporary frost brand fades away.");
3109 #endif
3110         }
3111         if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
3112         {
3113                 p_ptr->special_attack &= ~(ATTACK_POIS);
3114 #ifdef JP
3115                 msg_print("ÆǤǹ¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3116 #else
3117                 msg_print("Your temporary poison brand fades away.");
3118 #endif
3119         }
3120
3121         if ((v) && (attack_type))
3122         {
3123                 /* Set attack type. */
3124                 p_ptr->special_attack |= (attack_type);
3125
3126                 /* Set duration. */
3127                 p_ptr->ele_attack = v;
3128
3129                 /* Message. */
3130 #ifdef JP
3131                 msg_format("%s¤Ç¹¶·â¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª",
3132                              ((attack_type == ATTACK_ACID) ? "»À" :
3133                               ((attack_type == ATTACK_ELEC) ? "ÅÅ·â" :
3134                                ((attack_type == ATTACK_FIRE) ? "²Ð±ê" : 
3135                                 ((attack_type == ATTACK_COLD) ? "Î䵤" : 
3136                                  ((attack_type == ATTACK_POIS) ? "ÆÇ" : 
3137                                         "(¤Ê¤·)"))))));
3138 #else
3139                 msg_format("For a while, the blows you deal will %s",
3140                              ((attack_type == ATTACK_ACID) ? "melt with acid!" :
3141                               ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
3142                                ((attack_type == ATTACK_FIRE) ? "burn with fire!" : 
3143                                 ((attack_type == ATTACK_COLD) ? "chill to the bone!" : 
3144                                  ((attack_type == ATTACK_POIS) ? "poison your enemies!" : 
3145                                         "do nothing special."))))));
3146 #endif
3147         }
3148
3149         /* Disturb */
3150         if (disturb_state) disturb(0, 0);
3151
3152         /* Redraw status bar */
3153         p_ptr->redraw |= (PR_STATUS);
3154
3155         p_ptr->update |= (PU_BONUS);
3156
3157         /* Handle stuff */
3158         handle_stuff();
3159
3160         return (TRUE);
3161 }
3162
3163 /*!
3164  * @brief °ì»þŪ¸µÁÇÌȱ֤ηѳ»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set a temporary elemental brand.  Clear all other brands.  Print status messages. -LM-
3165  * @param immune_type Ìȱ֤Υ¿¥¤¥×ID
3166  * @param v ·Ñ³»þ´Ö
3167  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3168  */
3169 bool set_ele_immune(u32b immune_type, int v)
3170 {
3171         /* Hack -- Force good values */
3172         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3173
3174         /* Clear all elemental attacks (only one is allowed at a time). */
3175         if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
3176         {
3177                 p_ptr->special_defense &= ~(DEFENSE_ACID);
3178 #ifdef JP
3179                 msg_print("»À¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3180 #else
3181                 msg_print("You are no longer immune to acid.");
3182 #endif
3183         }
3184         if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
3185         {
3186                 p_ptr->special_defense &= ~(DEFENSE_ELEC);
3187 #ifdef JP
3188                 msg_print("ÅÅ·â¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3189 #else
3190                 msg_print("You are no longer immune to electricity.");
3191 #endif
3192         }
3193         if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
3194         {
3195                 p_ptr->special_defense &= ~(DEFENSE_FIRE);
3196 #ifdef JP
3197                 msg_print("²Ð±ê¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3198 #else
3199                 msg_print("You are no longer immune to fire.");
3200 #endif
3201         }
3202         if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
3203         {
3204                 p_ptr->special_defense &= ~(DEFENSE_COLD);
3205 #ifdef JP
3206                 msg_print("Î䵤¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3207 #else
3208                 msg_print("You are no longer immune to cold.");
3209 #endif
3210         }
3211         if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
3212         {
3213                 p_ptr->special_defense &= ~(DEFENSE_POIS);
3214 #ifdef JP
3215                 msg_print("ÆǤι¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3216 #else
3217                 msg_print("You are no longer immune to poison.");
3218 #endif
3219         }
3220
3221         if ((v) && (immune_type))
3222         {
3223                 /* Set attack type. */
3224                 p_ptr->special_defense |= (immune_type);
3225
3226                 /* Set duration. */
3227                 p_ptr->ele_immune = v;
3228
3229                 /* Message. */
3230 #ifdef JP
3231                 msg_format("%s¤Î¹¶·â¤ò¼õ¤±¤Ä¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª",
3232                              ((immune_type == DEFENSE_ACID) ? "»À" :
3233                               ((immune_type == DEFENSE_ELEC) ? "ÅÅ·â" :
3234                                ((immune_type == DEFENSE_FIRE) ? "²Ð±ê" : 
3235                                 ((immune_type == DEFENSE_COLD) ? "Î䵤" : 
3236                                  ((immune_type == DEFENSE_POIS) ? "ÆÇ" : 
3237                                         "(¤Ê¤·)"))))));
3238 #else
3239                 msg_format("For a while, You are immune to %s",
3240                              ((immune_type == DEFENSE_ACID) ? "acid!" :
3241                               ((immune_type == DEFENSE_ELEC) ? "electricity!" :
3242                                ((immune_type == DEFENSE_FIRE) ? "fire!" : 
3243                                 ((immune_type == DEFENSE_COLD) ? "cold!" : 
3244                                  ((immune_type == DEFENSE_POIS) ? "poison!" : 
3245                                         "do nothing special."))))));
3246 #endif
3247         }
3248
3249         /* Disturb */
3250         if (disturb_state) disturb(0, 0);
3251
3252         /* Redraw status bar */
3253         p_ptr->redraw |= (PR_STATUS);
3254
3255         p_ptr->update |= (PU_BONUS);
3256
3257         /* Handle stuff */
3258         handle_stuff();
3259
3260         return (TRUE);
3261 }
3262
3263 /*!
3264  * @brief °ì»þŪ»ÀÂÑÀ­¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->oppose_acid", notice observable changes
3265  * @param v ·Ñ³»þ´Ö
3266  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
3267  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3268  */
3269 bool set_oppose_acid(int v, bool do_dec)
3270 {
3271         bool notice = FALSE;
3272
3273         /* Hack -- Force good values */
3274         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3275
3276         if (p_ptr->is_dead) return FALSE;
3277
3278         /* Open */
3279         if (v)
3280         {
3281                 if (p_ptr->oppose_acid && !do_dec)
3282                 {
3283                         if (p_ptr->oppose_acid > v) return FALSE;
3284                 }
3285                 else if (!IS_OPPOSE_ACID())
3286                 {
3287 #ifdef JP
3288 msg_print("»À¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3289 #else
3290                         msg_print("You feel resistant to acid!");
3291 #endif
3292
3293                         notice = TRUE;
3294                 }
3295         }
3296
3297         /* Shut */
3298         else
3299         {
3300                 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3301                 {
3302 #ifdef JP
3303 msg_print("»À¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3304 #else
3305                         msg_print("You feel less resistant to acid.");
3306 #endif
3307
3308                         notice = TRUE;
3309                 }
3310         }
3311
3312         /* Use the value */
3313         p_ptr->oppose_acid = v;
3314
3315         /* Nothing to notice */
3316         if (!notice) return (FALSE);
3317
3318         /* Redraw status bar */
3319         p_ptr->redraw |= (PR_STATUS);
3320
3321         /* Disturb */
3322         if (disturb_state) disturb(0, 0);
3323
3324         /* Handle stuff */
3325         handle_stuff();
3326
3327         /* Result */
3328         return (TRUE);
3329 }
3330
3331 /*!
3332  * @brief °ì»þŪÅÅ·âÂÑÀ­¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->oppose_elec", notice observable changes
3333  * @param v ·Ñ³»þ´Ö
3334  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
3335  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3336  */
3337 bool set_oppose_elec(int v, bool do_dec)
3338 {
3339         bool notice = FALSE;
3340
3341         /* Hack -- Force good values */
3342         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3343
3344         if (p_ptr->is_dead) return FALSE;
3345
3346         /* Open */
3347         if (v)
3348         {
3349                 if (p_ptr->oppose_elec && !do_dec)
3350                 {
3351                         if (p_ptr->oppose_elec > v) return FALSE;
3352                 }
3353                 else if (!IS_OPPOSE_ELEC())
3354                 {
3355 #ifdef JP
3356 msg_print("ÅÅ·â¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3357 #else
3358                         msg_print("You feel resistant to electricity!");
3359 #endif
3360
3361                         notice = TRUE;
3362                 }
3363         }
3364
3365         /* Shut */
3366         else
3367         {
3368                 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3369                 {
3370 #ifdef JP
3371 msg_print("ÅÅ·â¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3372 #else
3373                         msg_print("You feel less resistant to electricity.");
3374 #endif
3375
3376                         notice = TRUE;
3377                 }
3378         }
3379
3380         /* Use the value */
3381         p_ptr->oppose_elec = v;
3382
3383         /* Nothing to notice */
3384         if (!notice) return (FALSE);
3385
3386         /* Redraw status bar */
3387         p_ptr->redraw |= (PR_STATUS);
3388
3389         /* Disturb */
3390         if (disturb_state) disturb(0, 0);
3391
3392         /* Handle stuff */
3393         handle_stuff();
3394
3395         /* Result */
3396         return (TRUE);
3397 }
3398
3399 /*!
3400  * @brief °ì»þŪ²Ð±êÂÑÀ­¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->oppose_fire", notice observable changes
3401  * @param v ·Ñ³»þ´Ö
3402  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
3403  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3404  */
3405 bool set_oppose_fire(int v, bool do_dec)
3406 {
3407         bool notice = FALSE;
3408
3409         /* Hack -- Force good values */
3410         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3411
3412         if (p_ptr->is_dead) return FALSE;
3413
3414         if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
3415         /* Open */
3416         if (v)
3417         {
3418                 if (p_ptr->oppose_fire && !do_dec)
3419                 {
3420                         if (p_ptr->oppose_fire > v) return FALSE;
3421                 }
3422                 else if (!IS_OPPOSE_FIRE())
3423                 {
3424 #ifdef JP
3425 msg_print("²Ð¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3426 #else
3427                         msg_print("You feel resistant to fire!");
3428 #endif
3429
3430                         notice = TRUE;
3431                 }
3432         }
3433
3434         /* Shut */
3435         else
3436         {
3437                 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3438                 {
3439 #ifdef JP
3440 msg_print("²Ð¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3441 #else
3442                         msg_print("You feel less resistant to fire.");
3443 #endif
3444
3445                         notice = TRUE;
3446                 }
3447         }
3448
3449         /* Use the value */
3450         p_ptr->oppose_fire = v;
3451
3452         /* Nothing to notice */
3453         if (!notice) return (FALSE);
3454
3455         /* Redraw status bar */
3456         p_ptr->redraw |= (PR_STATUS);
3457
3458         /* Disturb */
3459         if (disturb_state) disturb(0, 0);
3460
3461         /* Handle stuff */
3462         handle_stuff();
3463
3464         /* Result */
3465         return (TRUE);
3466 }
3467
3468 /*!
3469  * @brief °ì»þŪÎ䵤ÂÑÀ­¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->oppose_cold", notice observable changes
3470  * @param v ·Ñ³»þ´Ö
3471  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
3472  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3473  */
3474 bool set_oppose_cold(int v, bool do_dec)
3475 {
3476         bool notice = FALSE;
3477
3478         /* Hack -- Force good values */
3479         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3480
3481         if (p_ptr->is_dead) return FALSE;
3482
3483         /* Open */
3484         if (v)
3485         {
3486                 if (p_ptr->oppose_cold && !do_dec)
3487                 {
3488                         if (p_ptr->oppose_cold > v) return FALSE;
3489                 }
3490                 else if (!IS_OPPOSE_COLD())
3491                 {
3492 #ifdef JP
3493 msg_print("Î䵤¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3494 #else
3495                         msg_print("You feel resistant to cold!");
3496 #endif
3497
3498                         notice = TRUE;
3499                 }
3500         }
3501
3502         /* Shut */
3503         else
3504         {
3505                 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3506                 {
3507 #ifdef JP
3508 msg_print("Î䵤¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3509 #else
3510                         msg_print("You feel less resistant to cold.");
3511 #endif
3512
3513                         notice = TRUE;
3514                 }
3515         }
3516
3517         /* Use the value */
3518         p_ptr->oppose_cold = v;
3519
3520         /* Nothing to notice */
3521         if (!notice) return (FALSE);
3522
3523         /* Redraw status bar */
3524         p_ptr->redraw |= (PR_STATUS);
3525
3526         /* Disturb */
3527         if (disturb_state) disturb(0, 0);
3528
3529         /* Handle stuff */
3530         handle_stuff();
3531
3532         /* Result */
3533         return (TRUE);
3534 }
3535
3536 /*!
3537  * @brief °ì»þŪÆÇÂÑÀ­¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->oppose_pois", notice observable changes
3538  * @param v ·Ñ³»þ´Ö
3539  * @param do_dec ¸½ºß¤Î·Ñ³»þ´Ö¤è¤êŤ¤ÃͤΤ߾å½ñ¤­¤¹¤ë
3540  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3541  */
3542 bool set_oppose_pois(int v, bool do_dec)
3543 {
3544         bool notice = FALSE;
3545
3546         /* Hack -- Force good values */
3547         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3548
3549         if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
3550         if (p_ptr->is_dead) return FALSE;
3551
3552         /* Open */
3553         if (v)
3554         {
3555                 if (p_ptr->oppose_pois && !do_dec)
3556                 {
3557                         if (p_ptr->oppose_pois > v) return FALSE;
3558                 }
3559                 else if (!IS_OPPOSE_POIS())
3560                 {
3561 #ifdef JP
3562 msg_print("ÆǤؤÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3563 #else
3564                         msg_print("You feel resistant to poison!");
3565 #endif
3566
3567                         notice = TRUE;
3568                 }
3569         }
3570
3571         /* Shut */
3572         else
3573         {
3574                 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3575                 {
3576 #ifdef JP
3577 msg_print("ÆǤؤÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3578 #else
3579                         msg_print("You feel less resistant to poison.");
3580 #endif
3581
3582                         notice = TRUE;
3583                 }
3584         }
3585
3586         /* Use the value */
3587         p_ptr->oppose_pois = v;
3588
3589         /* Nothing to notice */
3590         if (!notice) return (FALSE);
3591
3592         /* Redraw status bar */
3593         p_ptr->redraw |= (PR_STATUS);
3594
3595         /* Disturb */
3596         if (disturb_state) disturb(0, 0);
3597
3598         /* Handle stuff */
3599         handle_stuff();
3600
3601         /* Result */
3602         return (TRUE);
3603 }
3604
3605 /*!
3606  * @brief Û¯Û°¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->stun", notice observable changes
3607  * @param v ·Ñ³»þ´Ö
3608  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3609  * @details
3610  * Note the special code to only notice "range" changes.
3611  */
3612 bool set_stun(int v)
3613 {
3614         int old_aux, new_aux;
3615         bool notice = FALSE;
3616
3617
3618         /* Hack -- Force good values */
3619         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3620
3621         if (p_ptr->is_dead) return FALSE;
3622
3623         if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
3624
3625         /* Knocked out */
3626         if (p_ptr->stun > 100)
3627         {
3628                 old_aux = 3;
3629         }
3630
3631         /* Heavy stun */
3632         else if (p_ptr->stun > 50)
3633         {
3634                 old_aux = 2;
3635         }
3636
3637         /* Stun */
3638         else if (p_ptr->stun > 0)
3639         {
3640                 old_aux = 1;
3641         }
3642
3643         /* None */
3644         else
3645         {
3646                 old_aux = 0;
3647         }
3648
3649         /* Knocked out */
3650         if (v > 100)
3651         {
3652                 new_aux = 3;
3653         }
3654
3655         /* Heavy stun */
3656         else if (v > 50)
3657         {
3658                 new_aux = 2;
3659         }
3660
3661         /* Stun */
3662         else if (v > 0)
3663         {
3664                 new_aux = 1;
3665         }
3666
3667         /* None */
3668         else
3669         {
3670                 new_aux = 0;
3671         }
3672
3673         /* Increase cut */
3674         if (new_aux > old_aux)
3675         {
3676                 /* Describe the state */
3677                 switch (new_aux)
3678                 {
3679                         /* Stun */
3680                         case 1:
3681 #ifdef JP
3682 msg_print("°Õ¼±¤¬¤â¤¦¤í¤¦¤È¤·¤Æ¤­¤¿¡£");
3683 #else
3684                         msg_print("You have been stunned.");
3685 #endif
3686
3687                         break;
3688
3689                         /* Heavy stun */
3690                         case 2:
3691 #ifdef JP
3692 msg_print("°Õ¼±¤¬¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤Æ¤­¤¿¡£");
3693 #else
3694                         msg_print("You have been heavily stunned.");
3695 #endif
3696
3697                         break;
3698
3699                         /* Knocked out */
3700                         case 3:
3701 #ifdef JP
3702 msg_print("Ƭ¤¬¥¯¥é¥¯¥é¤·¤Æ°Õ¼±¤¬±ó¤Î¤¤¤Æ¤­¤¿¡£");
3703 #else
3704                         msg_print("You have been knocked out.");
3705 #endif
3706
3707                         break;
3708                 }
3709
3710                 if (randint1(1000) < v || one_in_(16))
3711                 {
3712 #ifdef JP
3713 msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
3714 #else
3715                         msg_print("A vicious blow hits your head.");
3716 #endif
3717
3718                         if (one_in_(3))
3719                         {
3720                                 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3721                                 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3722                         }
3723                         else if (one_in_(2))
3724                         {
3725                                 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3726                         }
3727                         else
3728                         {
3729                                 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3730                         }
3731                 }
3732                 if (p_ptr->special_defense & KATA_MASK)
3733                 {
3734 #ifdef JP
3735                         msg_print("·¿¤¬Êø¤ì¤¿¡£");
3736 #else
3737                         msg_print("Your posture gets loose.");
3738 #endif
3739                         p_ptr->special_defense &= ~(KATA_MASK);
3740                         p_ptr->update |= (PU_BONUS);
3741                         p_ptr->update |= (PU_MONSTERS);
3742                         p_ptr->redraw |= (PR_STATE);
3743                         p_ptr->redraw |= (PR_STATUS);
3744                         p_ptr->action = ACTION_NONE;
3745                 }
3746
3747                 /* Sniper */
3748                 if (p_ptr->concent) reset_concentration(TRUE);
3749
3750                 /* Hex */
3751                 if (hex_spelling_any()) stop_hex_spell_all();
3752
3753                 /* Notice */
3754                 notice = TRUE;
3755         }
3756
3757         /* Decrease cut */
3758         else if (new_aux < old_aux)
3759         {
3760                 /* Describe the state */
3761                 switch (new_aux)
3762                 {
3763                         /* None */
3764                         case 0:
3765 #ifdef JP
3766 msg_print("¤ä¤Ã¤ÈÛ¯Û°¾õÂÖ¤«¤é²óÉü¤·¤¿¡£");
3767 #else
3768                         msg_print("You are no longer stunned.");
3769 #endif
3770
3771                         if (disturb_state) disturb(0, 0);
3772                         break;
3773                 }
3774
3775                 /* Notice */
3776                 notice = TRUE;
3777         }
3778
3779         /* Use the value */
3780         p_ptr->stun = v;
3781
3782         /* No change */
3783         if (!notice) return (FALSE);
3784
3785         /* Disturb */
3786         if (disturb_state) disturb(0, 0);
3787
3788         /* Recalculate bonuses */
3789         p_ptr->update |= (PU_BONUS);
3790
3791         /* Redraw the "stun" */
3792         p_ptr->redraw |= (PR_STUN);
3793
3794         /* Handle stuff */
3795         handle_stuff();
3796
3797         /* Result */
3798         return (TRUE);
3799 }
3800
3801
3802 /*!
3803  * @brief ½Ð·ì¤Î·Ñ³»þ´Ö¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->cut", notice observable changes
3804  * @param v ·Ñ³»þ´Ö
3805  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
3806  * @details
3807  * Note the special code to only notice "range" changes.
3808  */
3809 bool set_cut(int v)
3810 {
3811         int old_aux, new_aux;
3812         bool notice = FALSE;
3813
3814         /* Hack -- Force good values */
3815         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3816
3817         if (p_ptr->is_dead) return FALSE;
3818
3819         if ((p_ptr->prace == RACE_GOLEM ||
3820             p_ptr->prace == RACE_SKELETON ||
3821             p_ptr->prace == RACE_SPECTRE ||
3822                 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3823             !p_ptr->mimic_form)
3824                 v = 0;
3825
3826         /* Mortal wound */
3827         if (p_ptr->cut > 1000)
3828         {
3829                 old_aux = 7;
3830         }
3831
3832         /* Deep gash */
3833         else if (p_ptr->cut > 200)
3834         {
3835                 old_aux = 6;
3836         }
3837
3838         /* Severe cut */
3839         else if (p_ptr->cut > 100)
3840         {
3841                 old_aux = 5;
3842         }
3843
3844         /* Nasty cut */
3845         else if (p_ptr->cut > 50)
3846         {
3847                 old_aux = 4;
3848         }
3849
3850         /* Bad cut */
3851         else if (p_ptr->cut > 25)
3852         {
3853                 old_aux = 3;
3854         }
3855
3856         /* Light cut */
3857         else if (p_ptr->cut > 10)
3858         {
3859                 old_aux = 2;
3860         }
3861
3862         /* Graze */
3863         else if (p_ptr->cut > 0)
3864         {
3865                 old_aux = 1;
3866         }
3867
3868         /* None */
3869         else
3870         {
3871                 old_aux = 0;
3872         }
3873
3874         /* Mortal wound */
3875         if (v > 1000)
3876         {
3877                 new_aux = 7;
3878         }
3879
3880         /* Deep gash */
3881         else if (v > 200)
3882         {
3883                 new_aux = 6;
3884         }
3885
3886         /* Severe cut */
3887         else if (v > 100)
3888         {
3889                 new_aux = 5;
3890         }
3891
3892         /* Nasty cut */
3893         else if (v > 50)
3894         {
3895                 new_aux = 4;
3896         }
3897
3898         /* Bad cut */
3899         else if (v > 25)
3900         {
3901                 new_aux = 3;
3902         }
3903
3904         /* Light cut */
3905         else if (v > 10)
3906         {
3907                 new_aux = 2;
3908         }
3909
3910         /* Graze */
3911         else if (v > 0)
3912         {
3913                 new_aux = 1;
3914         }
3915
3916         /* None */
3917         else
3918         {
3919                 new_aux = 0;
3920         }
3921
3922         /* Increase cut */
3923         if (new_aux > old_aux)
3924         {
3925                 /* Describe the state */
3926                 switch (new_aux)
3927                 {
3928                         /* Graze */
3929                         case 1:
3930 #ifdef JP
3931 msg_print("¤«¤¹¤ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3932 #else
3933                         msg_print("You have been given a graze.");
3934 #endif
3935
3936                         break;
3937
3938                         /* Light cut */
3939                         case 2:
3940 #ifdef JP
3941 msg_print("·Ú¤¤½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3942 #else
3943                         msg_print("You have been given a light cut.");
3944 #endif
3945
3946                         break;
3947
3948                         /* Bad cut */
3949                         case 3:
3950 #ifdef JP
3951 msg_print("¤Ò¤É¤¤½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3952 #else
3953                         msg_print("You have been given a bad cut.");
3954 #endif
3955
3956                         break;
3957
3958                         /* Nasty cut */
3959                         case 4:
3960 #ifdef JP
3961 msg_print("ÂçÊѤʽý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3962 #else
3963                         msg_print("You have been given a nasty cut.");
3964 #endif
3965
3966                         break;
3967
3968                         /* Severe cut */
3969                         case 5:
3970 #ifdef JP
3971 msg_print("½ÅÂç¤Ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3972 #else
3973                         msg_print("You have been given a severe cut.");
3974 #endif
3975
3976                         break;
3977
3978                         /* Deep gash */
3979                         case 6:
3980 #ifdef JP
3981 msg_print("¤Ò¤É¤¤¿¼¼ê¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3982 #else
3983                         msg_print("You have been given a deep gash.");
3984 #endif
3985
3986                         break;
3987
3988                         /* Mortal wound */
3989                         case 7:
3990 #ifdef JP
3991 msg_print("Ã×̿Ū¤Ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3992 #else
3993                         msg_print("You have been given a mortal wound.");
3994 #endif
3995
3996                         break;
3997                 }
3998
3999                 /* Notice */
4000                 notice = TRUE;
4001
4002                 if (randint1(1000) < v || one_in_(16))
4003                 {
4004                         if (!p_ptr->sustain_chr)
4005                         {
4006 #ifdef JP
4007 msg_print("¤Ò¤É¤¤½ýÀפ¬»Ä¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
4008 #else
4009                                 msg_print("You have been horribly scarred.");
4010 #endif
4011
4012
4013                                 do_dec_stat(A_CHR);
4014                         }
4015                 }
4016         }
4017
4018         /* Decrease cut */
4019         else if (new_aux < old_aux)
4020         {
4021                 /* Describe the state */
4022                 switch (new_aux)
4023                 {
4024                         /* None */
4025                         case 0:
4026 #ifdef JP
4027 msg_format("¤ä¤Ã¤È%s¡£", p_ptr->prace == RACE_ANDROID ? "²ø²æ¤¬Ä¾¤Ã¤¿" : "½Ð·ì¤¬»ß¤Þ¤Ã¤¿");
4028 #else
4029                         msg_print("You are no longer bleeding.");
4030 #endif
4031
4032                         if (disturb_state) disturb(0, 0);
4033                         break;
4034                 }
4035
4036                 /* Notice */
4037                 notice = TRUE;
4038         }
4039
4040         /* Use the value */
4041         p_ptr->cut = v;
4042
4043         /* No change */
4044         if (!notice) return (FALSE);
4045
4046         /* Disturb */
4047         if (disturb_state) disturb(0, 0);
4048
4049         /* Recalculate bonuses */
4050         p_ptr->update |= (PU_BONUS);
4051
4052         /* Redraw the "cut" */
4053         p_ptr->redraw |= (PR_CUT);
4054
4055         /* Handle stuff */
4056         handle_stuff();
4057
4058         /* Result */
4059         return (TRUE);
4060 }
4061
4062 /*!
4063  * @brief ¶õÊ¢¾õÂÖ¤ò¥»¥Ã¥È¤¹¤ë / Set "p_ptr->food", notice observable changes
4064  * @param v ·Ñ³»þ´Ö
4065  * @return ¥¹¥Æ¡¼¥¿¥¹¤Ë±Æ¶Á¤òµÚ¤Ü¤¹ÊѲ½¤¬¤¢¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
4066  * @details
4067  * Set "", notice observable changes\n
4068  *\n
4069  * The "p_ptr->food" variable can get as large as 20000, allowing the
4070  * addition of the most "filling" item, Elvish Waybread, which adds
4071  * 7500 food units, without overflowing the 32767 maximum limit.\n
4072  *\n
4073  * Perhaps we should disturb the player with various messages,
4074  * especially messages about hunger status changes.  XXX XXX XXX\n
4075  *\n
4076  * Digestion of food is handled in "dungeon.c", in which, normally,
4077  * the player digests about 20 food units per 100 game turns, more
4078  * when "fast", more when "regenerating", less with "slow digestion",
4079  * but when the player is "gorged", he digests 100 food units per 10
4080  * game turns, or a full 1000 food units per 100 game turns.\n
4081  *\n
4082  * Note that the player's speed is reduced by 10 units while gorged,
4083  * so if the player eats a single food ration (5000 food units) when
4084  * full (15000 food units), he will be gorged for (5000/100)*10 = 500
4085  * game turns, or 500/(100/5) = 25 player turns (if nothing else is
4086  * affecting the player speed).\n
4087  */
4088 bool set_food(int v)
4089 {
4090         int old_aux, new_aux;
4091
4092         bool notice = FALSE;
4093
4094         /* Hack -- Force good values */
4095         v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
4096
4097         /* Fainting / Starving */
4098         if (p_ptr->food < PY_FOOD_FAINT)
4099         {
4100                 old_aux = 0;
4101         }
4102
4103         /* Weak */
4104         else if (p_ptr->food < PY_FOOD_WEAK)
4105         {
4106                 old_aux = 1;
4107         }
4108
4109         /* Hungry */
4110         else if (p_ptr->food < PY_FOOD_ALERT)
4111         {
4112                 old_aux = 2;
4113         }
4114
4115         /* Normal */
4116         else if (p_ptr->food < PY_FOOD_FULL)
4117         {
4118                 old_aux = 3;
4119         }
4120
4121         /* Full */
4122         else if (p_ptr->food < PY_FOOD_MAX)
4123         {
4124                 old_aux = 4;
4125         }
4126
4127         /* Gorged */
4128         else
4129         {
4130                 old_aux = 5;
4131         }
4132
4133         /* Fainting / Starving */
4134         if (v < PY_FOOD_FAINT)
4135         {
4136                 new_aux = 0;
4137         }
4138
4139         /* Weak */
4140         else if (v < PY_FOOD_WEAK)
4141         {
4142                 new_aux = 1;
4143         }
4144
4145         /* Hungry */
4146         else if (v < PY_FOOD_ALERT)
4147         {
4148                 new_aux = 2;
4149         }
4150
4151         /* Normal */
4152         else if (v < PY_FOOD_FULL)
4153         {
4154                 new_aux = 3;
4155         }
4156
4157         /* Full */
4158         else if (v < PY_FOOD_MAX)
4159         {
4160                 new_aux = 4;
4161         }
4162
4163         /* Gorged */
4164         else
4165         {
4166                 new_aux = 5;
4167         }
4168
4169         if (old_aux < 1 && new_aux > 0)
4170                 chg_virtue(V_PATIENCE, 2);
4171         else if (old_aux < 3 && (old_aux != new_aux))
4172                 chg_virtue(V_PATIENCE, 1);
4173         if (old_aux == 2)
4174                 chg_virtue(V_TEMPERANCE, 1);
4175         if (old_aux == 0)
4176                 chg_virtue(V_TEMPERANCE, -1);
4177
4178         /* Food increase */
4179         if (new_aux > old_aux)
4180         {
4181                 /* Describe the state */
4182                 switch (new_aux)
4183                 {
4184                         /* Weak */
4185                         case 1:
4186 #ifdef JP
4187 msg_print("¤Þ¤À¶õÊ¢¤ÇÅݤ줽¤¦¤À¡£");
4188 #else
4189                         msg_print("You are still weak.");
4190 #endif
4191
4192                         break;
4193
4194                         /* Hungry */
4195                         case 2:
4196 #ifdef JP
4197 msg_print("¤Þ¤À¶õÊ¢¤À¡£");
4198 #else
4199                         msg_print("You are still hungry.");
4200 #endif
4201
4202                         break;
4203
4204                         /* Normal */
4205                         case 3:
4206 #ifdef JP
4207 msg_print("¶õÊ¢´¶¤¬¤ª¤µ¤Þ¤Ã¤¿¡£");
4208 #else
4209                         msg_print("You are no longer hungry.");
4210 #endif
4211
4212                         break;
4213
4214                         /* Full */
4215                         case 4:
4216 #ifdef JP
4217 msg_print("ËþÊ¢¤À¡ª");
4218 #else
4219                         msg_print("You are full!");
4220 #endif
4221
4222                         break;
4223
4224                         /* Bloated */
4225                         case 5:
4226 #ifdef JP
4227 msg_print("¿©¤Ù²á¤®¤À¡ª");
4228 #else
4229                         msg_print("You have gorged yourself!");
4230 #endif
4231                         chg_virtue(V_HARMONY, -1);
4232                         chg_virtue(V_PATIENCE, -1);
4233                         chg_virtue(V_TEMPERANCE, -2);
4234
4235                         break;
4236                 }
4237
4238                 /* Change */
4239                 notice = TRUE;
4240         }
4241
4242         /* Food decrease */
4243         else if (new_aux < old_aux)
4244         {
4245                 /* Describe the state */
4246                 switch (new_aux)
4247                 {
4248                         /* Fainting / Starving */
4249                         case 0:
4250 #ifdef JP
4251 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤¤ò¼º¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
4252 #else
4253                         msg_print("You are getting faint from hunger!");
4254 #endif
4255
4256                         break;
4257
4258                         /* Weak */
4259                         case 1:
4260 #ifdef JP
4261 msg_print("¤ªÊ¢¤¬¶õ¤¤¤ÆÅݤ줽¤¦¤À¡£");
4262 #else
4263                         msg_print("You are getting weak from hunger!");
4264 #endif
4265
4266                         break;
4267
4268                         /* Hungry */
4269                         case 2:
4270 #ifdef JP
4271 msg_print("¤ªÊ¢¤¬¶õ¤¤¤Æ¤­¤¿¡£");
4272 #else
4273                         msg_print("You are getting hungry.");
4274 #endif
4275
4276                         break;
4277
4278                         /* Normal */
4279                         case 3:
4280 #ifdef JP
4281 msg_print("ËþÊ¢´¶¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
4282 #else
4283                         msg_print("You are no longer full.");
4284 #endif
4285
4286                         break;
4287
4288                         /* Full */
4289                         case 4:
4290 #ifdef JP
4291 msg_print("¤ä¤Ã¤È¤ªÊ¢¤¬¤­¤Ä¤¯¤Ê¤¯¤Ê¤Ã¤¿¡£");
4292 #else
4293                         msg_print("You are no longer gorged.");
4294 #endif
4295
4296                         break;
4297                 }
4298
4299                 if (p_ptr->wild_mode && (new_aux < 2))
4300                 {
4301                         change_wild_mode();
4302                 }
4303
4304                 /* Change */
4305                 notice = TRUE;
4306         }
4307
4308         /* Use the value */
4309         p_ptr->food = v;
4310
4311         /* Nothing to notice */
4312         if (!notice) return (FALSE);
4313
4314         /* Disturb */
4315         if (disturb_state) disturb(0, 0);
4316
4317         /* Recalculate bonuses */
4318         p_ptr->update |= (PU_BONUS);
4319
4320         /* Redraw hunger */
4321         p_ptr->redraw |= (PR_HUNGER);
4322
4323         /* Handle stuff */
4324         handle_stuff();
4325
4326         /* Result */
4327         return (TRUE);
4328 }
4329
4330 /*!
4331  * @brief ¥×¥ì¥¤¥ä¡¼¤Î´ðËÜǽÎÏÃͤòÁý²Ã¤µ¤»¤ë / Increases a stat by one randomized level -RAK-
4332  * @param stat ¾å¾º¤µ¤»¤ë¥¹¥Æ¡¼¥¿¥¹ID
4333  * @return ¼ÂºÝ¤Ë¾å¾º¤·¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
4334  * @details
4335  * Note that this function (used by stat potions) now restores\n
4336  * the stat BEFORE increasing it.\n
4337  */
4338 bool inc_stat(int stat)
4339 {
4340         int value, gain;
4341
4342         /* Then augment the current/max stat */
4343         value = p_ptr->stat_cur[stat];
4344
4345         /* Cannot go above 18/100 */
4346         if (value < p_ptr->stat_max_max[stat])
4347         {
4348                 /* Gain one (sometimes two) points */
4349                 if (value < 18)
4350                 {
4351                         gain = ((randint0(100) < 75) ? 1 : 2);
4352                         value += gain;
4353                 }
4354
4355                 /* Gain 1/6 to 1/3 of distance to 18/100 */
4356                 else if (value < (p_ptr->stat_max_max[stat]-2))
4357                 {
4358                         /* Approximate gain value */
4359                         gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
4360
4361                         /* Paranoia */
4362                         if (gain < 1) gain = 1;
4363
4364                         /* Apply the bonus */
4365                         value += randint1(gain) + gain / 2;
4366
4367                         /* Maximal value */
4368                         if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
4369                 }
4370
4371                 /* Gain one point at a time */
4372                 else
4373                 {
4374                         value++;
4375                 }
4376
4377                 /* Save the new value */
4378                 p_ptr->stat_cur[stat] = value;
4379
4380                 /* Bring up the maximum too */
4381                 if (value > p_ptr->stat_max[stat])
4382                 {
4383                         p_ptr->stat_max[stat] = value;
4384                 }
4385
4386                 /* Recalculate bonuses */
4387                 p_ptr->update |= (PU_BONUS);
4388
4389                 /* Success */
4390                 return (TRUE);
4391         }
4392
4393         /* Nothing to gain */
4394         return (FALSE);
4395 }
4396
4397 /*!
4398  * @brief ¥×¥ì¥¤¥ä¡¼¤Î´ðËÜǽÎÏÃͤò¸º¾¯¤µ¤»¤ë / Decreases a stat by an amount indended to vary from 0 to 100 percent.
4399  * @param stat ¸º¾¯¤µ¤»¤ë¥¹¥Æ¡¼¥¿¥¹ID
4400  * @param amount ¸º¾¯¤µ¤»¤ë´ðËÜÎÌ
4401  * @param permanent TRUE¤Ê¤é¤Ð¸½ºß¤ÎºÇÂçÃͤò¸º¾¯¤µ¤»¤ë
4402  * @return ¼ÂºÝ¤Ë¸º¾¯¤·¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
4403  * @details
4404  *\n
4405  * Amount could be a little higher in extreme cases to mangle very high\n
4406  * stats from massive assaults.  -CWS\n
4407  *\n
4408  * Note that "permanent" means that the *given* amount is permanent,\n
4409  * not that the new value becomes permanent.  This may not work exactly\n
4410  * as expected, due to "weirdness" in the algorithm, but in general,\n
4411  * if your stat is already drained, the "max" value will not drop all\n
4412  * the way down to the "cur" value.\n
4413  */
4414 bool dec_stat(int stat, int amount, int permanent)
4415 {
4416         int cur, max, loss, same, res = FALSE;
4417
4418
4419         /* Acquire current value */
4420         cur = p_ptr->stat_cur[stat];
4421         max = p_ptr->stat_max[stat];
4422
4423         /* Note when the values are identical */
4424         same = (cur == max);
4425
4426         /* Damage "current" value */
4427         if (cur > 3)
4428         {
4429                 /* Handle "low" values */
4430                 if (cur <= 18)
4431                 {
4432                         if (amount > 90) cur--;
4433                         if (amount > 50) cur--;
4434                         if (amount > 20) cur--;
4435                         cur--;
4436                 }
4437
4438                 /* Handle "high" values */
4439                 else
4440                 {
4441                         /* Hack -- Decrement by a random amount between one-quarter */
4442                         /* and one-half of the stat bonus times the percentage, with a */
4443                         /* minimum damage of half the percentage. -CWS */
4444                         loss = (((cur-18) / 2 + 1) / 2 + 1);
4445
4446                         /* Paranoia */
4447                         if (loss < 1) loss = 1;
4448
4449                         /* Randomize the loss */
4450                         loss = ((randint1(loss) + loss) * amount) / 100;
4451
4452                         /* Maximal loss */
4453                         if (loss < amount/2) loss = amount/2;
4454
4455                         /* Lose some points */
4456                         cur = cur - loss;
4457
4458                         /* Hack -- Only reduce stat to 17 sometimes */
4459                         if (cur < 18) cur = (amount <= 20) ? 18 : 17;
4460                 }
4461
4462                 /* Prevent illegal values */
4463                 if (cur < 3) cur = 3;
4464
4465                 /* Something happened */
4466                 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
4467         }
4468
4469         /* Damage "max" value */
4470         if (permanent && (max > 3))
4471         {
4472                 chg_virtue(V_SACRIFICE, 1);
4473                 if (stat == A_WIS || stat == A_INT)
4474                         chg_virtue(V_ENLIGHTEN, -2);
4475
4476                 /* Handle "low" values */
4477                 if (max <= 18)
4478                 {
4479                         if (amount > 90) max--;
4480                         if (amount > 50) max--;
4481                         if (amount > 20) max--;
4482                         max--;
4483                 }
4484
4485                 /* Handle "high" values */
4486                 else
4487                 {
4488                         /* Hack -- Decrement by a random amount between one-quarter */
4489                         /* and one-half of the stat bonus times the percentage, with a */
4490                         /* minimum damage of half the percentage. -CWS */
4491                         loss = (((max-18) / 2 + 1) / 2 + 1);
4492                         loss = ((randint1(loss) + loss) * amount) / 100;
4493                         if (loss < amount/2) loss = amount/2;
4494
4495                         /* Lose some points */
4496                         max = max - loss;
4497
4498                         /* Hack -- Only reduce stat to 17 sometimes */
4499                         if (max < 18) max = (amount <= 20) ? 18 : 17;
4500                 }
4501
4502                 /* Hack -- keep it clean */
4503                 if (same || (max < cur)) max = cur;
4504
4505                 /* Something happened */
4506                 if (max != p_ptr->stat_max[stat]) res = TRUE;
4507         }
4508
4509         /* Apply changes */
4510         if (res)
4511         {
4512                 /* Actually set the stat to its new value. */
4513                 p_ptr->stat_cur[stat] = cur;
4514                 p_ptr->stat_max[stat] = max;
4515
4516                 /* Redisplay the stats later */
4517                 p_ptr->redraw |= (PR_STATS);
4518
4519                 /* Recalculate bonuses */
4520                 p_ptr->update |= (PU_BONUS);
4521         }
4522
4523         /* Done */
4524         return (res);
4525 }
4526
4527
4528 /*!
4529  * @brief ¥×¥ì¥¤¥ä¡¼¤Î´ðËÜǽÎÏÃͤò²óÉü¤µ¤»¤ë / Restore a stat.  Return TRUE only if this actually makes a difference.
4530  * @param stat ²óÉü¥¹¥Æ¡¼¥¿¥¹ID
4531  * @return ¼ÂºÝ¤Ë²óÉü¤·¤¿¾ì¹çTRUE¤òÊÖ¤¹¡£
4532  */
4533 bool res_stat(int stat)
4534 {
4535         /* Restore if needed */
4536         if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
4537         {
4538                 /* Restore */
4539                 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
4540
4541                 /* Recalculate bonuses */
4542                 p_ptr->update |= (PU_BONUS);
4543
4544                 /* Redisplay the stats later */
4545                 p_ptr->redraw |= (PR_STATS);
4546
4547                 /* Success */
4548                 return (TRUE);
4549         }
4550
4551         /* Nothing to restore */
4552         return (FALSE);
4553 }
4554
4555
4556 /*
4557  * Increase players hit points, notice effects
4558  */
4559 bool hp_player(int num)
4560 {
4561         int vir;
4562         vir = virtue_number(V_VITALITY);
4563         if (vir)
4564         {
4565                 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
4566         }
4567         /* Healing needed */
4568         if (p_ptr->chp < p_ptr->mhp)
4569         {
4570                 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
4571                         chg_virtue(V_TEMPERANCE, 1);
4572                 /* Gain hitpoints */
4573                 p_ptr->chp += num;
4574
4575                 /* Enforce maximum */
4576                 if (p_ptr->chp >= p_ptr->mhp)
4577                 {
4578                         p_ptr->chp = p_ptr->mhp;
4579                         p_ptr->chp_frac = 0;
4580                 }
4581
4582                 /* Redraw */
4583                 p_ptr->redraw |= (PR_HP);
4584
4585                 /* Window stuff */
4586                 p_ptr->window |= (PW_PLAYER);
4587
4588                 /* Heal 0-4 */
4589                 if (num < 5)
4590                 {
4591 #ifdef JP
4592 msg_print("¾¯¤·µ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4593 #else
4594                         msg_print("You feel a little better.");
4595 #endif
4596
4597                 }
4598
4599                 /* Heal 5-14 */
4600                 else if (num < 15)
4601                 {
4602 #ifdef JP
4603 msg_print("µ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4604 #else
4605                         msg_print("You feel better.");
4606 #endif
4607
4608                 }
4609
4610                 /* Heal 15-34 */
4611                 else if (num < 35)
4612                 {
4613 #ifdef JP
4614 msg_print("¤È¤Æ¤âµ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4615 #else
4616                         msg_print("You feel much better.");
4617 #endif
4618
4619                 }
4620
4621                 /* Heal 35+ */
4622                 else
4623                 {
4624 #ifdef JP
4625 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4626 #else
4627                         msg_print("You feel very good.");
4628 #endif
4629
4630                 }
4631
4632                 /* Notice */
4633                 return (TRUE);
4634         }
4635
4636         /* Ignore */
4637         return (FALSE);
4638 }
4639
4640
4641 /*
4642  * Array of stat "descriptions"
4643  */
4644 static cptr desc_stat_pos[] =
4645 {
4646 #ifdef JP
4647 "¶¯¤¯",
4648 #else
4649         "strong",
4650 #endif
4651
4652 #ifdef JP
4653 "ÃÎŪ¤Ë",
4654 #else
4655         "smart",
4656 #endif
4657
4658 #ifdef JP
4659 "¸­¤¯",
4660 #else
4661         "wise",
4662 #endif
4663
4664 #ifdef JP
4665 "´ïÍѤË",
4666 #else
4667         "dextrous",
4668 #endif
4669
4670 #ifdef JP
4671 "·ò¹¯¤Ë",
4672 #else
4673         "healthy",
4674 #endif
4675
4676 #ifdef JP
4677 "Èþ¤·¤¯"
4678 #else
4679         "cute"
4680 #endif
4681
4682 };
4683
4684
4685 /*
4686  * Array of stat "descriptions"
4687  */
4688 static cptr desc_stat_neg[] =
4689 {
4690 #ifdef JP
4691 "¼å¤¯",
4692 "̵ÃΤË",
4693 "¶ò¤«¤Ë",
4694 "ÉÔ´ïÍѤË",
4695 "ÉÔ·ò¹¯¤Ë",
4696 "½¹¤¯"
4697 #else
4698         "weak",
4699         "stupid",
4700         "naive",
4701         "clumsy",
4702         "sickly",
4703         "ugly"
4704 #endif
4705
4706 };
4707
4708
4709 /*
4710  * Lose a "point"
4711  */
4712 bool do_dec_stat(int stat)
4713 {
4714         bool sust = FALSE;
4715
4716         /* Access the "sustain" */
4717         switch (stat)
4718         {
4719                 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
4720                 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
4721                 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
4722                 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
4723                 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
4724                 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
4725         }
4726
4727         /* Sustain */
4728         if (sust && (!ironman_nightmare || randint0(13)))
4729         {
4730                 /* Message */
4731 #ifdef JP
4732 msg_format("%s¤Ê¤Ã¤¿µ¤¤¬¤·¤¿¤¬¡¢¤¹¤°¤Ë¸µ¤ËÌá¤Ã¤¿¡£",
4733 #else
4734                 msg_format("You feel %s for a moment, but the feeling passes.",
4735 #endif
4736
4737                                 desc_stat_neg[stat]);
4738
4739                 /* Notice effect */
4740                 return (TRUE);
4741         }
4742
4743         /* Attempt to reduce the stat */
4744         if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
4745         {
4746                 /* Message */
4747 #ifdef JP
4748 msg_format("¤Ò¤É¤¯%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_neg[stat]);
4749 #else
4750                 msg_format("You feel very %s.", desc_stat_neg[stat]);
4751 #endif
4752
4753
4754                 /* Notice effect */
4755                 return (TRUE);
4756         }
4757
4758         /* Nothing obvious */
4759         return (FALSE);
4760 }
4761
4762
4763 /*
4764  * Restore lost "points" in a stat
4765  */
4766 bool do_res_stat(int stat)
4767 {
4768         /* Attempt to increase */
4769         if (res_stat(stat))
4770         {
4771                 /* Message */
4772 #ifdef JP
4773 msg_format("¸µÄ̤ê¤Ë%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_pos[stat]);
4774 #else
4775                 msg_format("You feel less %s.", desc_stat_neg[stat]);
4776 #endif
4777
4778
4779                 /* Notice */
4780                 return (TRUE);
4781         }
4782
4783         /* Nothing obvious */
4784         return (FALSE);
4785 }
4786
4787
4788 /*
4789  * Gain a "point" in a stat
4790  */
4791 bool do_inc_stat(int stat)
4792 {
4793         bool res;
4794
4795         /* Restore strength */
4796         res = res_stat(stat);
4797
4798         /* Attempt to increase */
4799         if (inc_stat(stat))
4800         {
4801                 if (stat == A_WIS)
4802                 {
4803                         chg_virtue(V_ENLIGHTEN, 1);
4804                         chg_virtue(V_FAITH, 1);
4805                 }
4806                 else if (stat == A_INT)
4807                 {
4808                         chg_virtue(V_KNOWLEDGE, 1);
4809                         chg_virtue(V_ENLIGHTEN, 1);
4810                 }
4811                 else if (stat == A_CON)
4812                         chg_virtue(V_VITALITY, 1);
4813
4814                 /* Message */
4815 #ifdef JP
4816 msg_format("¥ï¡¼¥ª¡ª¤È¤Æ¤â%s¤Ê¤Ã¤¿¡ª", desc_stat_pos[stat]);
4817 #else
4818                 msg_format("Wow!  You feel very %s!", desc_stat_pos[stat]);
4819 #endif
4820
4821
4822                 /* Notice */
4823                 return (TRUE);
4824         }
4825
4826         /* Restoration worked */
4827         if (res)
4828         {
4829                 /* Message */
4830 #ifdef JP
4831 msg_format("¸µÄ̤ê¤Ë%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_pos[stat]);
4832 #else
4833                 msg_format("You feel less %s.", desc_stat_neg[stat]);
4834 #endif
4835
4836
4837                 /* Notice */
4838                 return (TRUE);
4839         }
4840
4841         /* Nothing obvious */
4842         return (FALSE);
4843 }
4844
4845
4846 /*
4847  * Restores any drained experience
4848  */
4849 bool restore_level(void)
4850 {
4851         /* Restore experience */
4852         if (p_ptr->exp < p_ptr->max_exp)
4853         {
4854                 /* Message */
4855 #ifdef JP
4856 msg_print("·Ð¸³Ãͤ¬Ìá¤Ã¤Æ¤­¤¿µ¤¤¬¤¹¤ë¡£");
4857 #else
4858                 msg_print("You feel your experience returning.");
4859 #endif
4860
4861
4862                 /* Restore the experience */
4863                 p_ptr->exp = p_ptr->max_exp;
4864
4865                 /* Check the experience */
4866                 check_experience();
4867
4868                 /* Did something */
4869                 return (TRUE);
4870         }
4871
4872         /* No effect */
4873         return (FALSE);
4874 }
4875
4876
4877 /*
4878  * Forget everything
4879  */
4880 bool lose_all_info(void)
4881 {
4882         int i;
4883
4884         chg_virtue(V_KNOWLEDGE, -5);
4885         chg_virtue(V_ENLIGHTEN, -5);
4886
4887         /* Forget info about objects */
4888         for (i = 0; i < INVEN_TOTAL; i++)
4889         {
4890                 object_type *o_ptr = &inventory[i];
4891
4892                 /* Skip non-objects */
4893                 if (!o_ptr->k_idx) continue;
4894
4895                 /* Allow "protection" by the MENTAL flag */
4896                 if (o_ptr->ident & (IDENT_MENTAL)) continue;
4897
4898                 /* Remove "default inscriptions" */
4899                 o_ptr->feeling = FEEL_NONE;
4900
4901                 /* Hack -- Clear the "empty" flag */
4902                 o_ptr->ident &= ~(IDENT_EMPTY);
4903
4904                 /* Hack -- Clear the "known" flag */
4905                 o_ptr->ident &= ~(IDENT_KNOWN);
4906
4907                 /* Hack -- Clear the "felt" flag */
4908                 o_ptr->ident &= ~(IDENT_SENSE);
4909         }
4910
4911         /* Recalculate bonuses */
4912         p_ptr->update |= (PU_BONUS);
4913
4914         /* Combine / Reorder the pack (later) */
4915         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4916
4917         /* Window stuff */
4918         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4919
4920         /* Mega-Hack -- Forget the map */
4921         wiz_dark();
4922
4923         /* It worked */
4924         return (TRUE);
4925 }
4926
4927
4928 void do_poly_wounds(void)
4929 {
4930         /* Changed to always provide at least _some_ healing */
4931         s16b wounds = p_ptr->cut;
4932         s16b hit_p = (p_ptr->mhp - p_ptr->chp);
4933         s16b change = damroll(p_ptr->lev, 5);
4934         bool Nasty_effect = one_in_(5);
4935
4936         if (!(wounds || hit_p || Nasty_effect)) return;
4937
4938 #ifdef JP
4939 msg_print("½ý¤¬¤è¤ê·Ú¤¤¤â¤Î¤ËÊѲ½¤·¤¿¡£");
4940 #else
4941         msg_print("Your wounds are polymorphed into less serious ones.");
4942 #endif
4943
4944         hp_player(change);
4945         if (Nasty_effect)
4946         {
4947 #ifdef JP
4948 msg_print("¿·¤¿¤Ê½ý¤¬¤Ç¤­¤¿¡ª");
4949 take_hit(DAMAGE_LOSELIFE, change / 2, "ÊѲ½¤·¤¿½ý", -1);
4950 #else
4951                 msg_print("A new wound was created!");
4952                 take_hit(DAMAGE_LOSELIFE, change / 2, "a polymorphed wound", -1);
4953 #endif
4954
4955                 set_cut(change);
4956         }
4957         else
4958         {
4959                 set_cut(p_ptr->cut - (change / 2));
4960         }
4961 }
4962
4963
4964 /*
4965  * Change player race
4966  */
4967 void change_race(int new_race, cptr effect_msg)
4968 {
4969         cptr title = race_info[new_race].title;
4970         int  old_race = p_ptr->prace;
4971
4972 #ifdef JP
4973         msg_format("¤¢¤Ê¤¿¤Ï%s%s¤ËÊѲ½¤·¤¿¡ª", effect_msg, title);
4974 #else
4975         msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
4976 #endif
4977
4978         chg_virtue(V_CHANCE, 2);
4979
4980         if (p_ptr->prace < 32)
4981         {
4982                 p_ptr->old_race1 |= 1L << p_ptr->prace;
4983         }
4984         else
4985         {
4986                 p_ptr->old_race2 |= 1L << (p_ptr->prace-32);
4987         }
4988         p_ptr->prace = new_race;
4989         rp_ptr = &race_info[p_ptr->prace];
4990
4991         /* Experience factor */
4992         p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
4993
4994         /*
4995          * The speed bonus of Klackons and Sprites are disabled
4996          * and the experience penalty is decreased.
4997          */
4998         if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && ((p_ptr->prace == RACE_KLACKON) || (p_ptr->prace == RACE_SPRITE)))
4999                 p_ptr->expfact -= 15;
5000
5001         /* Get character's height and weight */
5002         get_height_weight();
5003
5004         /* Hitdice */
5005         if (p_ptr->pclass == CLASS_SORCERER)
5006                 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
5007         else
5008                 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
5009
5010         do_cmd_rerate(FALSE);
5011
5012         /* The experience level may be modified */
5013         check_experience();
5014
5015         p_ptr->redraw |= (PR_BASIC);
5016
5017         p_ptr->update |= (PU_BONUS);
5018
5019         handle_stuff();
5020
5021         /* Load an autopick preference file */
5022         if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
5023
5024         /* Player's graphic tile may change */
5025         lite_spot(py, px);
5026 }
5027
5028
5029 void do_poly_self(void)
5030 {
5031         int power = p_ptr->lev;
5032
5033 #ifdef JP
5034 msg_print("¤¢¤Ê¤¿¤ÏÊѲ½¤Îˬ¤ì¤ò´¶¤¸¤¿...");
5035 #else
5036         msg_print("You feel a change coming over you...");
5037 #endif
5038
5039         chg_virtue(V_CHANCE, 1);
5040
5041         if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
5042         {
5043                 char effect_msg[80] = "";
5044                 int new_race;
5045
5046                 /* Some form of racial polymorph... */
5047                 power -= 10;
5048
5049                 if ((power > randint0(5)) && one_in_(4))
5050                 {
5051                         /* sex change */
5052                         power -= 2;
5053
5054                         if (p_ptr->psex == SEX_MALE)
5055                         {
5056                                 p_ptr->psex = SEX_FEMALE;
5057                                 sp_ptr = &sex_info[p_ptr->psex];
5058 #ifdef JP
5059 sprintf(effect_msg, "½÷À­¤Î");
5060 #else
5061                                 sprintf(effect_msg, "female ");
5062 #endif
5063
5064                         }
5065                         else
5066                         {
5067                                 p_ptr->psex = SEX_MALE;
5068                                 sp_ptr = &sex_info[p_ptr->psex];
5069 #ifdef JP
5070 sprintf(effect_msg, "ÃËÀ­¤Î");
5071 #else
5072                                 sprintf(effect_msg, "male ");
5073 #endif
5074
5075                         }
5076                 }
5077
5078                 if ((power > randint0(30)) && one_in_(5))
5079                 {
5080                         int tmp = 0;
5081
5082                         /* Harmful deformity */
5083                         power -= 15;
5084
5085                         while (tmp < 6)
5086                         {
5087                                 if (one_in_(2))
5088                                 {
5089                                         (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
5090                                         power -= 1;
5091                                 }
5092                                 tmp++;
5093                         }
5094
5095                         /* Deformities are discriminated against! */
5096                         (void)dec_stat(A_CHR, randint1(6), TRUE);
5097
5098                         if (effect_msg[0])
5099                         {
5100                                 char tmp_msg[10];
5101 #ifdef JP
5102                                 sprintf(tmp_msg,"%s",effect_msg);
5103                                 sprintf(effect_msg,"´ñ·Á¤Î%s",tmp_msg);
5104 #else
5105                                 sprintf(tmp_msg,"%s ",effect_msg);
5106                                 sprintf(effect_msg,"deformed %s ",tmp_msg);
5107 #endif
5108
5109                         }
5110                         else
5111                         {
5112 #ifdef JP
5113                                 sprintf(effect_msg,"´ñ·Á¤Î");
5114 #else
5115                                 sprintf(effect_msg,"deformed ");
5116 #endif
5117
5118                         }
5119                 }
5120
5121                 while ((power > randint0(20)) && one_in_(10))
5122                 {
5123                         /* Polymorph into a less mutated form */
5124                         power -= 10;
5125
5126                         if (!lose_mutation(0))
5127 #ifdef JP
5128 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
5129 #else
5130                                 msg_print("You feel oddly normal.");
5131 #endif
5132
5133                 }
5134
5135                 do
5136                 {
5137                         new_race = randint0(MAX_RACES);
5138                 }
5139                 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
5140
5141                 change_race(new_race, effect_msg);
5142         }
5143
5144         if ((power > randint0(30)) && one_in_(6))
5145         {
5146                 int tmp = 0;
5147
5148                 /* Abomination! */
5149                 power -= 20;
5150
5151 #ifdef JP
5152 msg_format("%s¤Î¹½À®¤¬ÊѲ½¤·¤¿¡ª", p_ptr->prace == RACE_ANDROID ? "µ¡³£" : "Æâ¡");
5153 #else
5154                 msg_print("Your internal organs are rearranged!");
5155 #endif
5156
5157                 while (tmp < 6)
5158                 {
5159                         (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
5160                         tmp++;
5161                 }
5162                 if (one_in_(6))
5163                 {
5164 #ifdef JP
5165                         msg_print("¸½ºß¤Î»Ñ¤ÇÀ¸¤­¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
5166                         take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
5167 #else
5168                         msg_print("You find living difficult in your present form!");
5169                         take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "a lethal mutation", -1);
5170 #endif
5171
5172                         power -= 10;
5173                 }
5174         }
5175
5176         if ((power > randint0(20)) && one_in_(4))
5177         {
5178                 power -= 10;
5179
5180                 get_max_stats();
5181                 do_cmd_rerate(FALSE);
5182         }
5183
5184         while ((power > randint0(15)) && one_in_(3))
5185         {
5186                 power -= 7;
5187                 (void)gain_random_mutation(0);
5188         }
5189
5190         if (power > randint0(5))
5191         {
5192                 power -= 5;
5193                 do_poly_wounds();
5194         }
5195
5196         /* Note: earlier deductions may have left power < 0 already. */
5197         while (power > 0)
5198         {
5199                 mutate_player();
5200                 power--;
5201         }
5202 }
5203
5204
5205 /*
5206  * Decreases players hit points and sets death flag if necessary
5207  *
5208  * XXX XXX XXX Invulnerability needs to be changed into a "shield"
5209  *
5210  * XXX XXX XXX Hack -- this function allows the user to save (or quit)
5211  * the game when he dies, since the "You die." message is shown before
5212  * setting the player to "dead".
5213  */
5214
5215 int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
5216 {
5217         int old_chp = p_ptr->chp;
5218
5219         char death_message[1024];
5220         char tmp[80];
5221
5222         int warning = (p_ptr->mhp * hitpoint_warn / 10);
5223
5224         /* Paranoia */
5225         if (p_ptr->is_dead) return 0;
5226
5227         if (p_ptr->sutemi) damage *= 2;
5228         if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
5229
5230         if (easy_band) damage = (damage+1)/2;
5231
5232         if (damage_type != DAMAGE_USELIFE)
5233         {
5234                 /* Disturb */
5235                 disturb(1, 1);
5236                 if (auto_more)
5237                 {
5238                         now_damaged = TRUE;
5239                 }
5240         }
5241
5242         if (monspell >= 0) learn_spell(monspell);
5243
5244         /* Mega-Hack -- Apply "invulnerability" */
5245         if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
5246         {
5247                 if (IS_INVULN() && (damage < 9000))
5248                 {
5249                         if (damage_type == DAMAGE_FORCE)
5250                         {
5251 #ifdef JP
5252                                 msg_print("¥Ð¥ê¥¢¤¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5253 #else
5254                                 msg_print("The attack cuts your shield of invulnerability open!");
5255 #endif
5256                         }
5257                         else if (one_in_(PENETRATE_INVULNERABILITY))
5258                         {
5259 #ifdef JP
5260                                 msg_print("̵Ũ¤Î¥Ð¥ê¥¢¤òÇˤäƹ¶·â¤µ¤ì¤¿¡ª");
5261 #else
5262                                 msg_print("The attack penetrates your shield of invulnerability!");
5263 #endif
5264                         }
5265                         else
5266                         {
5267                                 return 0;
5268                         }
5269                 }
5270
5271                 if (CHECK_MULTISHADOW())
5272                 {
5273                         if (damage_type == DAMAGE_FORCE)
5274                         {
5275 #ifdef JP
5276                                 msg_print("¸¸±Æ¤â¤í¤È¤âÂΤ¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5277 #else
5278                                 msg_print("The attack hits Shadow together with you!");
5279 #endif
5280                         }
5281                         else if (damage_type == DAMAGE_ATTACK)
5282                         {
5283 #ifdef JP
5284                                 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
5285 #else
5286                                 msg_print("The attack hits Shadow, you are unharmed!");
5287 #endif
5288                                 return 0;
5289                         }
5290                 }
5291
5292                 if (p_ptr->wraith_form)
5293                 {
5294                         if (damage_type == DAMAGE_FORCE)
5295                         {
5296 #ifdef JP
5297                                 msg_print("Ⱦʪ¼Á¤ÎÂΤ¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5298 #else
5299                                 msg_print("The attack cuts through your ethereal body!");
5300 #endif
5301                         }
5302                         else
5303                         {
5304                                 damage /= 2;
5305                                 if ((damage == 0) && one_in_(2)) damage = 1;
5306                         }
5307                 }
5308
5309                 if (p_ptr->special_defense & KATA_MUSOU)
5310                 {
5311                         damage /= 2;
5312                         if ((damage == 0) && one_in_(2)) damage = 1;
5313                 }
5314         } /* not if LOSELIFE USELIFE */
5315
5316         /* Hurt the player */
5317         p_ptr->chp -= damage;
5318         if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
5319         {
5320                 damage += p_ptr->chp;
5321                 p_ptr->chp = 0;
5322         }
5323
5324         /* Display the hitpoints */
5325         p_ptr->redraw |= (PR_HP);
5326
5327         /* Window stuff */
5328         p_ptr->window |= (PW_PLAYER);
5329
5330         if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
5331         {
5332                 chg_virtue(V_SACRIFICE, 1);
5333                 chg_virtue(V_CHANCE, 2);
5334         }
5335
5336         /* Dead player */
5337         if (p_ptr->chp < 0)
5338         {
5339                 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5340
5341 #ifdef JP       /* »à¤ó¤À»þ¤Ë¶¯À©½ªÎ»¤·¤Æ»à¤ò²óÈò¤Ç¤­¤Ê¤¯¤·¤Æ¤ß¤¿ by Habu */
5342                 if (!cheat_save)
5343                         if(!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
5344 #endif
5345
5346                 /* Sound */
5347                 sound(SOUND_DEATH);
5348
5349                 chg_virtue(V_SACRIFICE, 10);
5350
5351                 handle_stuff();
5352
5353                 /* Leaving */
5354                 p_ptr->leaving = TRUE;
5355
5356                 /* Note death */
5357                 p_ptr->is_dead = TRUE;
5358
5359                 if (p_ptr->inside_arena)
5360                 {
5361                         cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
5362 #ifdef JP
5363                         msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£", m_name);
5364 #else
5365                         msg_format("You are beaten by %s.", m_name);
5366 #endif
5367                         msg_print(NULL);
5368                         if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
5369                 }
5370                 else
5371                 {
5372                         int q_idx = quest_number(dun_level);
5373                         bool seppuku = streq(hit_from, "Seppuku");
5374                         bool winning_seppuku = p_ptr->total_winner && seppuku;
5375
5376                         play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
5377
5378 #ifdef WORLD_SCORE
5379                         /* Make screen dump */
5380                         screen_dump = make_screen_dump();
5381 #endif
5382
5383                         /* Note cause of death */
5384                         if (seppuku)
5385                         {
5386                                 strcpy(p_ptr->died_from, hit_from);
5387 #ifdef JP
5388                                 if (!winning_seppuku) strcpy(p_ptr->died_from, "ÀÚÊ¢");
5389 #endif
5390                         }
5391                         else
5392                         {
5393                                 char dummy[1024];
5394 #ifdef JP
5395                                 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç" : "Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from);
5396 #else
5397                                 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
5398 #endif
5399                                 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
5400                         }
5401
5402                         /* No longer a winner */
5403                         p_ptr->total_winner = FALSE;
5404
5405                         if (winning_seppuku)
5406                         {
5407 #ifdef JP
5408                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¾¡Íø¤Î¸åÀÚÊ¢¤·¤¿¡£");
5409 #else
5410                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "did Seppuku after the winning.");
5411 #endif
5412                         }
5413                         else
5414                         {
5415                                 char buf[20];
5416
5417                                 if (p_ptr->inside_arena)
5418 #ifdef JP
5419                                         strcpy(buf,"¥¢¥ê¡¼¥Ê");
5420 #else
5421                                         strcpy(buf,"in the Arena");
5422 #endif
5423                                 else if (!dun_level)
5424 #ifdef JP
5425                                         strcpy(buf,"ÃϾå");
5426 #else
5427                                         strcpy(buf,"on the surface");
5428 #endif
5429                                 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
5430                                          !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
5431 #ifdef JP
5432                                         strcpy(buf,"¥¯¥¨¥¹¥È");
5433 #else
5434                                         strcpy(buf,"in a quest");
5435 #endif
5436                                 else
5437 #ifdef JP
5438                                         sprintf(buf,"%d³¬", dun_level);
5439 #else
5440                                         sprintf(buf,"level %d", dun_level);
5441 #endif
5442
5443 #ifdef JP
5444                                 sprintf(tmp, "%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", buf, p_ptr->died_from);
5445 #else
5446                                 sprintf(tmp, "killed by %s %s.", p_ptr->died_from, buf);
5447 #endif
5448                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
5449                         }
5450
5451 #ifdef JP
5452                         do_cmd_write_nikki(NIKKI_GAMESTART, 1, "-------- ¥²¡¼¥à¥ª¡¼¥Ð¡¼ --------");
5453 #else
5454                         do_cmd_write_nikki(NIKKI_GAMESTART, 1, "--------   Game  Over   --------");
5455 #endif
5456                         do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
5457
5458                         flush();
5459
5460 #ifdef JP
5461                         if (get_check_strict("²èÌ̤òÊݸ¤·¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
5462 #else
5463                         if (get_check_strict("Dump the screen? ", CHECK_NO_HISTORY))
5464 #endif
5465                         {
5466                                 do_cmd_save_screen();
5467                         }
5468
5469                         flush();
5470
5471                         /* Initialize "last message" buffer */
5472                         if (p_ptr->last_message) string_free(p_ptr->last_message);
5473                         p_ptr->last_message = NULL;
5474
5475                         /* Hack -- Note death */
5476                         if (!last_words)
5477                         {
5478 #ifdef JP
5479                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Þ¤·¤¿¡£", android ? "²õ¤ì" : "»à¤Ë");
5480 #else
5481                                 msg_print(android ? "You are broken." : "You die.");
5482 #endif
5483
5484                                 msg_print(NULL);
5485                         }
5486                         else
5487                         {
5488                                 if (winning_seppuku)
5489                                 {
5490 #ifdef JP
5491                                         get_rnd_line("seppuku_j.txt", 0, death_message);
5492 #else
5493                                         get_rnd_line("seppuku.txt", 0, death_message);
5494 #endif
5495                                 }
5496                                 else
5497                                 {
5498 #ifdef JP
5499                                         get_rnd_line("death_j.txt", 0, death_message);
5500 #else
5501                                         get_rnd_line("death.txt", 0, death_message);
5502 #endif
5503                                 }
5504
5505                                 do
5506                                 {
5507 #ifdef JP
5508                                         while (!get_string(winning_seppuku ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ;
5509 #else
5510                                         while (!get_string("Last word: ", death_message, 1024)) ;
5511 #endif
5512                                 }
5513 #ifdef JP
5514                                 while (winning_seppuku && !get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_NO_HISTORY));
5515 #else
5516                                 while (winning_seppuku && !get_check_strict("Are you sure? ", CHECK_NO_HISTORY));
5517 #endif
5518
5519                                 if (death_message[0] == '\0')
5520                                 {
5521 #ifdef JP
5522                                         strcpy(death_message, format("¤¢¤Ê¤¿¤Ï%s¤Þ¤·¤¿¡£", android ? "²õ¤ì" : "»à¤Ë"));
5523 #else
5524                                         strcpy(death_message, android ? "You are broken." : "You die.");
5525 #endif
5526                                 }
5527                                 else p_ptr->last_message = string_make(death_message);
5528
5529 #ifdef JP
5530                                 if (winning_seppuku)
5531                                 {
5532                                         int i, len;
5533                                         int w = Term->wid;
5534                                         int h = Term->hgt;
5535                                         int msg_pos_x[9] = {  5,  7,  9, 12,  14,  17,  19,  21, 23};
5536                                         int msg_pos_y[9] = {  3,  4,  5,  4,   5,   4,   5,   6,  4};
5537                                         cptr str;
5538                                         char* str2;
5539
5540                                         Term_clear();
5541
5542                                         /* ºù»¶¤ë */
5543                                         for (i = 0; i < 40; i++)
5544                                                 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "¦Ô");
5545
5546                                         str = death_message;
5547                                         if (strncmp(str, "¡Ö", 2) == 0) str += 2;
5548
5549                                         str2 = my_strstr(str, "¡×");
5550                                         if (str2 != NULL) *str2 = '\0';
5551
5552                                         i = 0;
5553                                         while (i < 9)
5554                                         {
5555                                                 str2 = my_strstr(str, " ");
5556                                                 if (str2 == NULL) len = strlen(str);
5557                                                 else len = str2 - str;
5558
5559                                                 if (len != 0)
5560                                                 {
5561                                                         Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
5562                                                         TERM_WHITE, str);
5563                                                         if (str2 == NULL) break;
5564                                                         i++;
5565                                                 }
5566                                                 str = str2 + 1;
5567                                                 if (*str == 0) break;
5568                                         }
5569
5570                                         /* Hide cursor */
5571                                         Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
5572
5573                                         flush();
5574 #ifdef WORLD_SCORE
5575                                         /* Make screen dump */
5576                                         screen_dump = make_screen_dump();
5577 #endif
5578
5579                                         /* Wait a key press */
5580                                         (void)inkey();
5581                                 }
5582                                 else
5583 #endif
5584                                         msg_print(death_message);
5585                         }
5586                 }
5587
5588                 /* Dead */
5589                 return damage;
5590         }
5591
5592         handle_stuff();
5593
5594         /* Hitpoint warning */
5595         if (p_ptr->chp < warning)
5596         {
5597                 /* Hack -- bell on first notice */
5598                 if (old_chp > warning) bell();
5599
5600                 sound(SOUND_WARN);
5601
5602                 if (record_danger && (old_chp > warning))
5603                 {
5604                         if (p_ptr->image && damage_type == DAMAGE_ATTACK)
5605 #ifdef JP
5606                                 hit_from = "²¿¤«";
5607 #else
5608                                 hit_from = "something";
5609 #endif
5610
5611 #ifdef JP
5612                         sprintf(tmp,"%s¤Ë¤è¤Ã¤Æ¥Ô¥ó¥Á¤Ë´Ù¤Ã¤¿¡£",hit_from);
5613 #else
5614                         sprintf(tmp,"A critical situation because of %s.",hit_from);
5615 #endif
5616                         do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
5617                 }
5618
5619                 if (auto_more)
5620                 {
5621                         /* stop auto_more even if DAMAGE_USELIFE */
5622                         now_damaged = TRUE;
5623                 }
5624
5625                 /* Message */
5626 #ifdef JP
5627 msg_print("*** ·Ù¹ð:Äã¥Ò¥Ã¥È¡¦¥Ý¥¤¥ó¥È¡ª ***");
5628 #else
5629                 msg_print("*** LOW HITPOINT WARNING! ***");
5630 #endif
5631
5632                 msg_print(NULL);
5633                 flush();
5634         }
5635         if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
5636         {
5637                 change_wild_mode();
5638         }
5639         return damage;
5640 }
5641
5642
5643 /*
5644  * Gain experience
5645  */
5646 void gain_exp_64(s32b amount, u32b amount_frac)
5647 {
5648         if (p_ptr->is_dead) return;
5649
5650         if (p_ptr->prace == RACE_ANDROID) return;
5651
5652         /* Gain some experience */
5653         s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
5654
5655         /* Slowly recover from experience drainage */
5656         if (p_ptr->exp < p_ptr->max_exp)
5657         {
5658                 /* Gain max experience (20%) (was 10%) */
5659                 p_ptr->max_exp += amount / 5;
5660         }
5661
5662         /* Check Experience */
5663         check_experience();
5664 }
5665
5666
5667 /*
5668  * Gain experience
5669  */
5670 void gain_exp(s32b amount)
5671 {
5672         gain_exp_64(amount, 0L);
5673 }
5674
5675
5676 void calc_android_exp(void)
5677 {
5678         int i;
5679         u32b total_exp = 0;
5680         if (p_ptr->is_dead) return;
5681
5682         if (p_ptr->prace != RACE_ANDROID) return;
5683
5684         for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5685         {
5686                 object_type *o_ptr = &inventory[i];
5687                 object_type forge;
5688                 object_type *q_ptr = &forge;
5689                 u32b value, exp;
5690                 int level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
5691
5692                 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
5693                 if (!o_ptr->k_idx) continue;
5694
5695                 /* Wipe the object */
5696                 object_wipe(q_ptr);
5697
5698                 object_copy(q_ptr, o_ptr);
5699                 q_ptr->discount = 0;
5700                 q_ptr->curse_flags = 0L;
5701
5702                 if (object_is_fixed_artifact(o_ptr))
5703                 {
5704                         level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
5705                         level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
5706                 }
5707                 else if (object_is_ego(o_ptr))
5708                 {
5709                         level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
5710                 }
5711                 else if (o_ptr->art_name)
5712                 {
5713                         s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
5714                         int fake_level;
5715
5716                         if (!object_is_weapon_ammo(o_ptr))
5717                         {
5718                                 /* For armors */
5719                                 if (total_flags < 15000) fake_level = 10;
5720                                 else if (total_flags < 35000) fake_level = 25;
5721                                 else fake_level = 40;
5722                         }
5723                         else
5724                         {
5725                                 /* For weapons */
5726                                 if (total_flags < 20000) fake_level = 10;
5727                                 else if (total_flags < 45000) fake_level = 25;
5728                                 else fake_level = 40;
5729                         }
5730
5731                         level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
5732                 }
5733
5734                 value = object_value_real(q_ptr);
5735
5736                 if (value <= 0) continue;
5737                 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
5738                 if (value > 5000000L) value = 5000000L;
5739                 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
5740
5741                 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
5742                     (o_ptr->tval == TV_DRAG_ARMOR) ||
5743                     ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
5744                     ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
5745                     ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
5746                     ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
5747                     ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
5748                 {
5749                         if (level > 65) level = 35 + (level - 65) / 5;
5750                         else if (level > 35) level = 25 + (level - 35) / 3;
5751                         else if (level > 15) level = 15 + (level - 15) / 2;
5752                         exp = MIN(100000L, value) * level * level / 2;
5753                         if (value > 100000L)
5754                                 exp += (value - 100000L) * level * level / 8;
5755                 }
5756                 else
5757                 {
5758                         exp = MIN(100000L, value) * level;
5759                         if (value > 100000L)
5760                                 exp += (value - 100000L) * level / 4;
5761                 }
5762                 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
5763                 else total_exp += exp / 16;
5764                 if (i == INVEN_BODY) total_exp += exp / 32;
5765         }
5766         p_ptr->exp = p_ptr->max_exp = total_exp;
5767
5768         /* Check Experience */
5769         check_experience();
5770 }
5771
5772
5773 /*
5774  * Lose experience
5775  */
5776 void lose_exp(s32b amount)
5777 {
5778         if (p_ptr->prace == RACE_ANDROID) return;
5779
5780         /* Never drop below zero experience */
5781         if (amount > p_ptr->exp) amount = p_ptr->exp;
5782
5783         /* Lose some experience */
5784         p_ptr->exp -= amount;
5785
5786         /* Check Experience */
5787         check_experience();
5788 }
5789
5790
5791 /*
5792  * Drain experience
5793  * If resisted to draining, return FALSE
5794  */
5795 bool drain_exp(s32b drain, s32b slip, int hold_exp_prob)
5796 {
5797         /* Androids and their mimics are never drained */
5798         if (p_ptr->prace == RACE_ANDROID) return FALSE;
5799
5800         if (p_ptr->hold_exp && (randint0(100) < hold_exp_prob))
5801         {
5802                 /* Hold experience */
5803 #ifdef JP
5804                 msg_print("¤·¤«¤·¼«¸Ê¤Î·Ð¸³Ãͤò¼é¤ê¤­¤Ã¤¿¡ª");
5805 #else
5806                 msg_print("You keep hold of your experience!");
5807 #endif
5808                 return FALSE;
5809         }
5810
5811         /* Hold experience failed */
5812         if (p_ptr->hold_exp)
5813         {
5814 #ifdef JP
5815                 msg_print("·Ð¸³Ãͤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
5816 #else
5817                 msg_print("You feel your experience slipping away!");
5818 #endif
5819                 lose_exp(slip);
5820         }
5821         else
5822         {
5823 #ifdef JP
5824                 msg_print("·Ð¸³Ãͤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
5825 #else
5826                 msg_print("You feel your experience draining away!");
5827 #endif
5828                 lose_exp(drain);
5829         }
5830
5831         return TRUE;
5832 }
5833
5834
5835 bool set_ultimate_res(int v, bool do_dec)
5836 {
5837         bool notice = FALSE;
5838
5839         /* Hack -- Force good values */
5840         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
5841
5842         if (p_ptr->is_dead) return FALSE;
5843
5844         /* Open */
5845         if (v)
5846         {
5847                 if (p_ptr->ult_res && !do_dec)
5848                 {
5849                         if (p_ptr->ult_res > v) return FALSE;
5850                 }
5851                 else if (!p_ptr->ult_res)
5852                 {
5853 #ifdef JP
5854 msg_print("¤¢¤é¤æ¤ë¤³¤È¤ËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5855 #else
5856                         msg_print("You feel resistant!");
5857 #endif
5858
5859                         notice = TRUE;
5860                 }
5861         }
5862
5863         /* Shut */
5864         else
5865         {
5866                 if (p_ptr->ult_res)
5867                 {
5868 #ifdef JP
5869 msg_print("¤¢¤é¤æ¤ë¤³¤È¤ËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
5870 #else
5871                         msg_print("You feel less resistant");
5872 #endif
5873
5874                         notice = TRUE;
5875                 }
5876         }
5877
5878         /* Use the value */
5879         p_ptr->ult_res = v;
5880
5881         /* Redraw status bar */
5882         p_ptr->redraw |= (PR_STATUS);
5883
5884         /* Nothing to notice */
5885         if (!notice) return (FALSE);
5886
5887         /* Disturb */
5888         if (disturb_state) disturb(0, 0);
5889
5890         /* Recalculate bonuses */
5891         p_ptr->update |= (PU_BONUS);
5892
5893         /* Handle stuff */
5894         handle_stuff();
5895
5896         /* Result */
5897         return (TRUE);
5898 }
5899
5900 bool set_tim_res_nether(int v, bool do_dec)
5901 {
5902         bool notice = FALSE;
5903
5904         /* Hack -- Force good values */
5905         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
5906
5907         if (p_ptr->is_dead) return FALSE;
5908
5909         /* Open */
5910         if (v)
5911         {
5912                 if (p_ptr->tim_res_nether && !do_dec)
5913                 {
5914                         if (p_ptr->tim_res_nether > v) return FALSE;
5915                 }
5916                 else if (!p_ptr->tim_res_nether)
5917                 {
5918 #ifdef JP
5919 msg_print("ÃϹö¤ÎÎϤËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5920 #else
5921                         msg_print("You feel nether resistant!");
5922 #endif
5923
5924                         notice = TRUE;
5925                 }
5926         }
5927
5928         /* Shut */
5929         else
5930         {
5931                 if (p_ptr->tim_res_nether)
5932                 {
5933 #ifdef JP
5934 msg_print("ÃϹö¤ÎÎϤËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
5935 #else
5936                         msg_print("You feel less nether resistant");
5937 #endif
5938
5939                         notice = TRUE;
5940                 }
5941         }
5942
5943         /* Use the value */
5944         p_ptr->tim_res_nether = v;
5945
5946         /* Redraw status bar */
5947         p_ptr->redraw |= (PR_STATUS);
5948
5949         /* Nothing to notice */
5950         if (!notice) return (FALSE);
5951
5952         /* Disturb */
5953         if (disturb_state) disturb(0, 0);
5954
5955         /* Recalculate bonuses */
5956         p_ptr->update |= (PU_BONUS);
5957
5958         /* Handle stuff */
5959         handle_stuff();
5960
5961         /* Result */
5962         return (TRUE);
5963 }
5964
5965 bool set_tim_res_time(int v, bool do_dec)
5966 {
5967         bool notice = FALSE;
5968
5969         /* Hack -- Force good values */
5970         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
5971
5972         if (p_ptr->is_dead) return FALSE;
5973
5974         /* Open */
5975         if (v)
5976         {
5977                 if (p_ptr->tim_res_time && !do_dec)
5978                 {
5979                         if (p_ptr->tim_res_time > v) return FALSE;
5980                 }
5981                 else if (!p_ptr->tim_res_time)
5982                 {
5983 #ifdef JP
5984 msg_print("»þ´ÖµÕž¤ÎÎϤËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5985 #else
5986                         msg_print("You feel time resistant!");
5987 #endif
5988
5989                         notice = TRUE;
5990                 }
5991         }
5992
5993         /* Shut */
5994         else
5995         {
5996                 if (p_ptr->tim_res_time)
5997                 {
5998 #ifdef JP
5999 msg_print("»þ´ÖµÕž¤ÎÎϤËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
6000 #else
6001                         msg_print("You feel less time resistant");
6002 #endif
6003
6004                         notice = TRUE;
6005                 }
6006         }
6007
6008         /* Use the value */
6009         p_ptr->tim_res_time = v;
6010
6011         /* Redraw status bar */
6012         p_ptr->redraw |= (PR_STATUS);
6013
6014         /* Nothing to notice */
6015         if (!notice) return (FALSE);
6016
6017         /* Disturb */
6018         if (disturb_state) disturb(0, 0);
6019
6020         /* Recalculate bonuses */
6021         p_ptr->update |= (PU_BONUS);
6022
6023         /* Handle stuff */
6024         handle_stuff();
6025
6026         /* Result */
6027         return (TRUE);
6028 }
6029
6030
6031 /*
6032  * Choose a warrior-mage elemental attack. -LM-
6033  */
6034 bool choose_ele_attack(void)
6035 {
6036         int num;
6037
6038         char choice;
6039
6040         if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
6041         {
6042 #ifdef JP
6043                 msg_format("Éð´ï¤ò»ý¤¿¤Ê¤¤¤ÈËâË¡·õ¤Ï»È¤¨¤Ê¤¤¡£");
6044 #else
6045                 msg_format("You cannot use temporary branding with no weapon.");
6046 #endif
6047                 return FALSE;
6048         }
6049
6050         /* Save screen */
6051         screen_save();
6052
6053         num = (p_ptr->lev - 20) / 5;
6054
6055 #ifdef JP
6056                       c_prt(TERM_RED,    "        a) ¾Æ´þ", 2, 14);
6057 #else
6058                       c_prt(TERM_RED,    "        a) Fire Brand", 2, 14);
6059 #endif
6060
6061 #ifdef JP
6062         if (num >= 2) c_prt(TERM_L_WHITE,"        b) Åà·ë", 3, 14);
6063 #else
6064         if (num >= 2) c_prt(TERM_L_WHITE,"        b) Cold Brand", 3, 14);
6065 #endif
6066         else prt("", 3, 14);
6067
6068 #ifdef JP
6069         if (num >= 3) c_prt(TERM_GREEN,  "        c) ÆÇ»¦", 4, 14);
6070 #else
6071         if (num >= 3) c_prt(TERM_GREEN,  "        c) Poison Brand", 4, 14);
6072 #endif
6073         else prt("", 4, 14);
6074
6075 #ifdef JP
6076         if (num >= 4) c_prt(TERM_L_DARK, "        d) Íϲò", 5, 14);
6077 #else
6078         if (num >= 4) c_prt(TERM_L_DARK, "        d) Acid Brand", 5, 14);
6079 #endif
6080         else prt("", 5, 14);
6081
6082 #ifdef JP
6083         if (num >= 5) c_prt(TERM_BLUE,   "        e) ÅÅ·â", 6, 14);
6084 #else
6085         if (num >= 5) c_prt(TERM_BLUE,   "        e) Elec Brand", 6, 14);
6086 #endif
6087         else prt("", 6, 14);
6088
6089         prt("", 7, 14);
6090         prt("", 8, 14);
6091         prt("", 9, 14);
6092
6093         prt("", 1, 0);
6094 #ifdef JP
6095         prt("        ¤É¤Î¸µÁǹ¶·â¤ò¤·¤Þ¤¹¤«¡©", 1, 14);
6096 #else
6097         prt("        Choose a temporary elemental brand ", 1, 14);
6098 #endif
6099
6100         choice = inkey();
6101
6102         if ((choice == 'a') || (choice == 'A')) 
6103                 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6104         else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
6105                 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6106         else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
6107                 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6108         else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
6109                 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6110         else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
6111                 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6112         else
6113         {
6114 #ifdef JP
6115                 msg_print("ËâË¡·õ¤ò»È¤¦¤Î¤ò¤ä¤á¤¿¡£");
6116 #else
6117                 msg_print("You cancel the temporary branding.");
6118 #endif
6119                 screen_load();
6120                 return FALSE;
6121         }
6122         /* Load screen */
6123         screen_load();
6124         return TRUE;
6125 }
6126
6127
6128 /*
6129  * Choose a elemental immune. -LM-
6130  */
6131 bool choose_ele_immune(int turn)
6132 {
6133         char choice;
6134
6135         /* Save screen */
6136         screen_save();
6137
6138 #ifdef JP
6139         c_prt(TERM_RED,    "        a) ²Ð±ê", 2, 14);
6140 #else
6141         c_prt(TERM_RED,    "        a) Immune Fire", 2, 14);
6142 #endif
6143
6144 #ifdef JP
6145         c_prt(TERM_L_WHITE,"        b) Î䵤", 3, 14);
6146 #else
6147         c_prt(TERM_L_WHITE,"        b) Immune Cold", 3, 14);
6148 #endif
6149
6150 #ifdef JP
6151         c_prt(TERM_L_DARK, "        c) »À", 4, 14);
6152 #else
6153         c_prt(TERM_L_DARK, "        c) Immune Acid", 4, 14);
6154 #endif
6155
6156 #ifdef JP
6157         c_prt(TERM_BLUE,   "        d) ÅÅ·â", 5, 14);
6158 #else
6159         c_prt(TERM_BLUE,   "        d) Immune Elec", 5, 14);
6160 #endif
6161
6162
6163         prt("", 6, 14);
6164         prt("", 7, 14);
6165         prt("", 8, 14);
6166         prt("", 9, 14);
6167
6168         prt("", 1, 0);
6169 #ifdef JP
6170         prt("        ¤É¤Î¸µÁǤÎÌȱ֤ò¤Ä¤±¤Þ¤¹¤«¡©", 1, 14);
6171 #else
6172         prt("        Choose a temporary elemental immune ", 1, 14);
6173 #endif
6174
6175         choice = inkey();
6176
6177         if ((choice == 'a') || (choice == 'A')) 
6178                 set_ele_immune(DEFENSE_FIRE, turn);
6179         else if ((choice == 'b') || (choice == 'B'))
6180                 set_ele_immune(DEFENSE_COLD, turn);
6181         else if ((choice == 'c') || (choice == 'C'))
6182                 set_ele_immune(DEFENSE_ACID, turn);
6183         else if ((choice == 'd') || (choice == 'D'))
6184                 set_ele_immune(DEFENSE_ELEC, turn);
6185         else
6186         {
6187 #ifdef JP
6188                 msg_print("Ìȱ֤òÉÕ¤±¤ë¤Î¤ò¤ä¤á¤¿¡£");
6189 #else
6190                 msg_print("You cancel the temporary immune.");
6191 #endif
6192                 screen_load();
6193                 return FALSE;
6194         }
6195         /* Load screen */
6196         screen_load();
6197         return TRUE;
6198 }