OSDN Git Service

Add Doxygen comment to effects.c.
[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  * @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()".\noo
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  * @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  * @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  * @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  * @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  * @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  * @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  * @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  * @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  * @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  * @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  * @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 /*
1747  * Set "p_ptr->invuln", notice observable changes
1748  */
1749 bool set_invuln(int v, bool do_dec)
1750 {
1751         bool notice = FALSE;
1752
1753         /* Hack -- Force good values */
1754         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1755
1756         if (p_ptr->is_dead) return FALSE;
1757
1758         /* Open */
1759         if (v)
1760         {
1761                 if (p_ptr->invuln && !do_dec)
1762                 {
1763                         if (p_ptr->invuln > v) return FALSE;
1764                 }
1765                 else if (!IS_INVULN())
1766                 {
1767 #ifdef JP
1768 msg_print("̵Ũ¤À¡ª");
1769 #else
1770                         msg_print("Invulnerability!");
1771 #endif
1772
1773                         notice = TRUE;
1774
1775                         chg_virtue(V_UNLIFE, -2);
1776                         chg_virtue(V_HONOUR, -2);
1777                         chg_virtue(V_SACRIFICE, -3);
1778                         chg_virtue(V_VALOUR, -5);
1779
1780                         /* Redraw map */
1781                         p_ptr->redraw |= (PR_MAP);
1782
1783                         /* Update monsters */
1784                         p_ptr->update |= (PU_MONSTERS);
1785
1786                         /* Window stuff */
1787                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1788                 }
1789         }
1790
1791         /* Shut */
1792         else
1793         {
1794                 if (p_ptr->invuln && !music_singing(MUSIC_INVULN))
1795                 {
1796 #ifdef JP
1797 msg_print("̵Ũ¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
1798 #else
1799                         msg_print("The invulnerability wears off.");
1800 #endif
1801
1802                         notice = TRUE;
1803
1804                         /* Redraw map */
1805                         p_ptr->redraw |= (PR_MAP);
1806
1807                         /* Update monsters */
1808                         p_ptr->update |= (PU_MONSTERS);
1809
1810                         /* Window stuff */
1811                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1812
1813                         p_ptr->energy_need += ENERGY_NEED();
1814                 }
1815         }
1816
1817         /* Use the value */
1818         p_ptr->invuln = v;
1819
1820         /* Redraw status bar */
1821         p_ptr->redraw |= (PR_STATUS);
1822
1823         /* Nothing to notice */
1824         if (!notice) return (FALSE);
1825
1826         /* Disturb */
1827         if (disturb_state) disturb(0, 0);
1828
1829         /* Recalculate bonuses */
1830         p_ptr->update |= (PU_BONUS);
1831
1832         /* Handle stuff */
1833         handle_stuff();
1834
1835         /* Result */
1836         return (TRUE);
1837 }
1838
1839
1840 /*
1841  * Set "p_ptr->tim_esp", notice observable changes
1842  */
1843 bool set_tim_esp(int v, bool do_dec)
1844 {
1845         bool notice = FALSE;
1846
1847         /* Hack -- Force good values */
1848         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1849
1850         if (p_ptr->is_dead) return FALSE;
1851
1852         /* Open */
1853         if (v)
1854         {
1855                 if (p_ptr->tim_esp && !do_dec)
1856                 {
1857                         if (p_ptr->tim_esp > v) return FALSE;
1858                 }
1859                 else if (!IS_TIM_ESP())
1860                 {
1861 #ifdef JP
1862 msg_print("°Õ¼±¤¬¹­¤¬¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1863 #else
1864                         msg_print("You feel your consciousness expand!");
1865 #endif
1866
1867                         notice = TRUE;
1868                 }
1869         }
1870
1871         /* Shut */
1872         else
1873         {
1874                 if (p_ptr->tim_esp && !music_singing(MUSIC_MIND))
1875                 {
1876 #ifdef JP
1877 msg_print("°Õ¼±¤Ï¸µ¤ËÌá¤Ã¤¿¡£");
1878 #else
1879                         msg_print("Your consciousness contracts again.");
1880 #endif
1881
1882                         notice = TRUE;
1883                 }
1884         }
1885
1886         /* Use the value */
1887         p_ptr->tim_esp = v;
1888
1889         /* Redraw status bar */
1890         p_ptr->redraw |= (PR_STATUS);
1891
1892         /* Nothing to notice */
1893         if (!notice) return (FALSE);
1894
1895         /* Disturb */
1896         if (disturb_state) disturb(0, 0);
1897
1898         /* Recalculate bonuses */
1899         p_ptr->update |= (PU_BONUS);
1900
1901         /* Update the monsters */
1902         p_ptr->update |= (PU_MONSTERS);
1903
1904         /* Handle stuff */
1905         handle_stuff();
1906
1907         /* Result */
1908         return (TRUE);
1909 }
1910
1911
1912 /*
1913  * Set "p_ptr->tim_invis", notice observable changes
1914  */
1915 bool set_tim_invis(int v, bool do_dec)
1916 {
1917         bool notice = FALSE;
1918
1919         /* Hack -- Force good values */
1920         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1921
1922         if (p_ptr->is_dead) return FALSE;
1923
1924         /* Open */
1925         if (v)
1926         {
1927                 if (p_ptr->tim_invis && !do_dec)
1928                 {
1929                         if (p_ptr->tim_invis > v) return FALSE;
1930                 }
1931                 else if (!p_ptr->tim_invis)
1932                 {
1933 #ifdef JP
1934 msg_print("Ìܤ¬Èó¾ï¤ËÉÒ´¶¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡ª");
1935 #else
1936                         msg_print("Your eyes feel very sensitive!");
1937 #endif
1938
1939                         notice = TRUE;
1940                 }
1941         }
1942
1943         /* Shut */
1944         else
1945         {
1946                 if (p_ptr->tim_invis)
1947                 {
1948 #ifdef JP
1949 msg_print("ÌܤÎÉÒ´¶¤µ¤¬¤Ê¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£");
1950 #else
1951                         msg_print("Your eyes feel less sensitive.");
1952 #endif
1953
1954                         notice = TRUE;
1955                 }
1956         }
1957
1958         /* Use the value */
1959         p_ptr->tim_invis = v;
1960
1961         /* Redraw status bar */
1962         p_ptr->redraw |= (PR_STATUS);
1963
1964         /* Nothing to notice */
1965         if (!notice) return (FALSE);
1966
1967         /* Disturb */
1968         if (disturb_state) disturb(0, 0);
1969
1970         /* Recalculate bonuses */
1971         p_ptr->update |= (PU_BONUS);
1972
1973         /* Update the monsters */
1974         p_ptr->update |= (PU_MONSTERS);
1975
1976         /* Handle stuff */
1977         handle_stuff();
1978
1979         /* Result */
1980         return (TRUE);
1981 }
1982
1983
1984 /*
1985  * Set "p_ptr->tim_infra", notice observable changes
1986  */
1987 bool set_tim_infra(int v, bool do_dec)
1988 {
1989         bool notice = FALSE;
1990
1991         /* Hack -- Force good values */
1992         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
1993
1994         if (p_ptr->is_dead) return FALSE;
1995
1996         /* Open */
1997         if (v)
1998         {
1999                 if (p_ptr->tim_infra && !do_dec)
2000                 {
2001                         if (p_ptr->tim_infra > v) return FALSE;
2002                 }
2003                 else if (!p_ptr->tim_infra)
2004                 {
2005 #ifdef JP
2006 msg_print("Ìܤ¬¥é¥ó¥é¥ó¤Èµ±¤­»Ï¤á¤¿¡ª");
2007 #else
2008                         msg_print("Your eyes begin to tingle!");
2009 #endif
2010
2011                         notice = TRUE;
2012                 }
2013         }
2014
2015         /* Shut */
2016         else
2017         {
2018                 if (p_ptr->tim_infra)
2019                 {
2020 #ifdef JP
2021 msg_print("Ìܤ層­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2022 #else
2023                         msg_print("Your eyes stop tingling.");
2024 #endif
2025
2026                         notice = TRUE;
2027                 }
2028         }
2029
2030         /* Use the value */
2031         p_ptr->tim_infra = v;
2032
2033         /* Redraw status bar */
2034         p_ptr->redraw |= (PR_STATUS);
2035
2036         /* Nothing to notice */
2037         if (!notice) return (FALSE);
2038
2039         /* Disturb */
2040         if (disturb_state) disturb(0, 0);
2041
2042         /* Recalculate bonuses */
2043         p_ptr->update |= (PU_BONUS);
2044
2045         /* Update the monsters */
2046         p_ptr->update |= (PU_MONSTERS);
2047
2048         /* Handle stuff */
2049         handle_stuff();
2050
2051         /* Result */
2052         return (TRUE);
2053 }
2054
2055
2056 /*
2057  * Set "p_ptr->tim_regen", notice observable changes
2058  */
2059 bool set_tim_regen(int v, bool do_dec)
2060 {
2061         bool notice = FALSE;
2062
2063         /* Hack -- Force good values */
2064         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2065
2066         if (p_ptr->is_dead) return FALSE;
2067
2068         /* Open */
2069         if (v)
2070         {
2071                 if (p_ptr->tim_regen && !do_dec)
2072                 {
2073                         if (p_ptr->tim_regen > v) return FALSE;
2074                 }
2075                 else if (!p_ptr->tim_regen)
2076                 {
2077 #ifdef JP
2078 msg_print("²óÉüÎϤ¬¾å¤¬¤Ã¤¿¡ª");
2079 #else
2080                         msg_print("You feel yourself regenerating quickly!");
2081 #endif
2082
2083                         notice = TRUE;
2084                 }
2085         }
2086
2087         /* Shut */
2088         else
2089         {
2090                 if (p_ptr->tim_regen)
2091                 {
2092 #ifdef JP
2093 msg_print("ÁÇÁ᤯²óÉü¤¹¤ë´¶¤¸¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
2094 #else
2095                         msg_print("You feel yourself regenerating slowly.");
2096 #endif
2097
2098                         notice = TRUE;
2099                 }
2100         }
2101
2102         /* Use the value */
2103         p_ptr->tim_regen = v;
2104
2105         /* Redraw status bar */
2106         p_ptr->redraw |= (PR_STATUS);
2107
2108         /* Nothing to notice */
2109         if (!notice) return (FALSE);
2110
2111         /* Disturb */
2112         if (disturb_state) disturb(0, 0);
2113
2114         /* Recalculate bonuses */
2115         p_ptr->update |= (PU_BONUS);
2116
2117         /* Handle stuff */
2118         handle_stuff();
2119
2120         /* Result */
2121         return (TRUE);
2122 }
2123
2124
2125 /*
2126  * Set "p_ptr->tim_stealth", notice observable changes
2127  */
2128 bool set_tim_stealth(int v, bool do_dec)
2129 {
2130         bool notice = FALSE;
2131
2132         /* Hack -- Force good values */
2133         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2134
2135         if (p_ptr->is_dead) return FALSE;
2136
2137         /* Open */
2138         if (v)
2139         {
2140                 if (p_ptr->tim_stealth && !do_dec)
2141                 {
2142                         if (p_ptr->tim_stealth > v) return FALSE;
2143                 }
2144                 else if (!IS_TIM_STEALTH())
2145                 {
2146 #ifdef JP
2147 msg_print("­²»¤¬¾®¤µ¤¯¤Ê¤Ã¤¿¡ª");
2148 #else
2149                         msg_print("You begin to walk silently!");
2150 #endif
2151
2152                         notice = TRUE;
2153                 }
2154         }
2155
2156         /* Shut */
2157         else
2158         {
2159                 if (p_ptr->tim_stealth && !music_singing(MUSIC_STEALTH))
2160                 {
2161 #ifdef JP
2162 msg_print("­²»¤¬Â礭¤¯¤Ê¤Ã¤¿¡£");
2163 #else
2164                         msg_print("You no longer walk silently.");
2165 #endif
2166
2167                         notice = TRUE;
2168                 }
2169         }
2170
2171         /* Use the value */
2172         p_ptr->tim_stealth = v;
2173
2174         /* Redraw status bar */
2175         p_ptr->redraw |= (PR_STATUS);
2176
2177         /* Nothing to notice */
2178         if (!notice) return (FALSE);
2179
2180         /* Disturb */
2181         if (disturb_state) disturb(0, 0);
2182
2183         /* Recalculate bonuses */
2184         p_ptr->update |= (PU_BONUS);
2185
2186         /* Handle stuff */
2187         handle_stuff();
2188
2189         /* Result */
2190         return (TRUE);
2191 }
2192
2193
2194 bool set_superstealth(bool set)
2195 {
2196         bool notice = FALSE;
2197
2198         if (p_ptr->is_dead) return FALSE;
2199
2200         /* Open */
2201         if (set)
2202         {
2203                 if (!(p_ptr->special_defense & NINJA_S_STEALTH))
2204                 {
2205                         if (cave[py][px].info & CAVE_MNLT)
2206                         {
2207 #ifdef JP
2208                                 msg_print("Ũ¤ÎÌܤ«¤éÇö¤¤±Æ¤ÎÃæ¤Ëʤ¤¤±£¤µ¤ì¤¿¡£");
2209 #else
2210                                 msg_print("You are mantled in weak shadow from ordinary eyes.");
2211 #endif
2212                                 p_ptr->monlite = p_ptr->old_monlite = TRUE;
2213                         }
2214                         else
2215                         {
2216 #ifdef JP
2217                                 msg_print("Ũ¤ÎÌܤ«¤é±Æ¤ÎÃæ¤Ëʤ¤¤±£¤µ¤ì¤¿¡ª");
2218 #else
2219                                 msg_print("You are mantled in shadow from ordinary eyes!");
2220 #endif
2221                                 p_ptr->monlite = p_ptr->old_monlite = FALSE;
2222                         }
2223
2224                         notice = TRUE;
2225
2226                         /* Use the value */
2227                         p_ptr->special_defense |= NINJA_S_STEALTH;
2228                 }
2229         }
2230
2231         /* Shut */
2232         else
2233         {
2234                 if (p_ptr->special_defense & NINJA_S_STEALTH)
2235                 {
2236 #ifdef JP
2237                         msg_print("ºÆ¤ÓŨ¤ÎÌܤˤµ¤é¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
2238 #else
2239                         msg_print("You are exposed to common sight once more.");
2240 #endif
2241
2242                         notice = TRUE;
2243
2244                         /* Use the value */
2245                         p_ptr->special_defense &= ~(NINJA_S_STEALTH);
2246                 }
2247         }
2248
2249         /* Nothing to notice */
2250         if (!notice) return (FALSE);
2251
2252         /* Redraw status bar */
2253         p_ptr->redraw |= (PR_STATUS);
2254
2255         /* Disturb */
2256         if (disturb_state) disturb(0, 0);
2257
2258         /* Result */
2259         return (TRUE);
2260 }
2261
2262
2263 /*
2264  * Set "p_ptr->tim_levitation", notice observable changes
2265  */
2266 bool set_tim_levitation(int v, bool do_dec)
2267 {
2268         bool notice = FALSE;
2269
2270         /* Hack -- Force good values */
2271         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2272
2273         if (p_ptr->is_dead) return FALSE;
2274
2275         /* Open */
2276         if (v)
2277         {
2278                 if (p_ptr->tim_levitation && !do_dec)
2279                 {
2280                         if (p_ptr->tim_levitation > v) return FALSE;
2281                 }
2282                 else if (!p_ptr->tim_levitation)
2283                 {
2284 #ifdef JP
2285 msg_print("ÂΤ¬Ãè¤ËÉ⤭»Ï¤á¤¿¡£");
2286 #else
2287                         msg_print("You begin to fly!");
2288 #endif
2289
2290                         notice = TRUE;
2291                 }
2292         }
2293
2294         /* Shut */
2295         else
2296         {
2297                 if (p_ptr->tim_levitation)
2298                 {
2299 #ifdef JP
2300 msg_print("¤â¤¦Ãè¤ËÉ⤫¤Ù¤Ê¤¯¤Ê¤Ã¤¿¡£");
2301 #else
2302                         msg_print("You stop flying.");
2303 #endif
2304
2305                         notice = TRUE;
2306                 }
2307         }
2308
2309         /* Use the value */
2310         p_ptr->tim_levitation = v;
2311
2312         /* Redraw status bar */
2313         p_ptr->redraw |= (PR_STATUS);
2314
2315         /* Nothing to notice */
2316         if (!notice) return (FALSE);
2317
2318         /* Disturb */
2319         if (disturb_state) disturb(0, 0);
2320
2321         /* Recalculate bonuses */
2322         p_ptr->update |= (PU_BONUS);
2323
2324         /* Handle stuff */
2325         handle_stuff();
2326
2327         /* Result */
2328         return (TRUE);
2329 }
2330
2331
2332 /*
2333  * Set "p_ptr->tim_sh_touki", notice observable changes
2334  */
2335 bool set_tim_sh_touki(int v, bool do_dec)
2336 {
2337         bool notice = FALSE;
2338
2339         /* Hack -- Force good values */
2340         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2341
2342         if (p_ptr->is_dead) return FALSE;
2343
2344         /* Open */
2345         if (v)
2346         {
2347                 if (p_ptr->tim_sh_touki && !do_dec)
2348                 {
2349                         if (p_ptr->tim_sh_touki > v) return FALSE;
2350                 }
2351                 else if (!p_ptr->tim_sh_touki)
2352                 {
2353 #ifdef JP
2354 msg_print("ÂΤ¬Æ®µ¤¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2355 #else
2356                         msg_print("You have enveloped by the aura of the Force!");
2357 #endif
2358
2359                         notice = TRUE;
2360                 }
2361         }
2362
2363         /* Shut */
2364         else
2365         {
2366                 if (p_ptr->tim_sh_touki)
2367                 {
2368 #ifdef JP
2369 msg_print("Æ®µ¤¤¬¾Ã¤¨¤¿¡£");
2370 #else
2371                         msg_print("Aura of the Force disappeared.");
2372 #endif
2373
2374                         notice = TRUE;
2375                 }
2376         }
2377
2378         /* Use the value */
2379         p_ptr->tim_sh_touki = v;
2380
2381         /* Redraw status bar */
2382         p_ptr->redraw |= (PR_STATUS);
2383
2384         /* Nothing to notice */
2385         if (!notice) return (FALSE);
2386
2387         /* Disturb */
2388         if (disturb_state) disturb(0, 0);
2389
2390         /* Handle stuff */
2391         handle_stuff();
2392
2393         /* Result */
2394         return (TRUE);
2395 }
2396
2397
2398 /*
2399  * Set "p_ptr->tim_sh_fire", notice observable changes
2400  */
2401 bool set_tim_sh_fire(int v, bool do_dec)
2402 {
2403         bool notice = FALSE;
2404
2405         /* Hack -- Force good values */
2406         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2407
2408         if (p_ptr->is_dead) return FALSE;
2409
2410         /* Open */
2411         if (v)
2412         {
2413                 if (p_ptr->tim_sh_fire && !do_dec)
2414                 {
2415                         if (p_ptr->tim_sh_fire > v) return FALSE;
2416                 }
2417                 else if (!p_ptr->tim_sh_fire)
2418                 {
2419 #ifdef JP
2420 msg_print("ÂΤ¬±ê¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2421 #else
2422                         msg_print("You have enveloped by fiery aura!");
2423 #endif
2424
2425                         notice = TRUE;
2426                 }
2427         }
2428
2429         /* Shut */
2430         else
2431         {
2432                 if (p_ptr->tim_sh_fire)
2433                 {
2434 #ifdef JP
2435 msg_print("±ê¤Î¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2436 #else
2437                         msg_print("Fiery aura disappeared.");
2438 #endif
2439
2440                         notice = TRUE;
2441                 }
2442         }
2443
2444         /* Use the value */
2445         p_ptr->tim_sh_fire = v;
2446
2447         /* Redraw status bar */
2448         p_ptr->redraw |= (PR_STATUS);
2449
2450         /* Nothing to notice */
2451         if (!notice) return (FALSE);
2452
2453         /* Disturb */
2454         if (disturb_state) disturb(0, 0);
2455
2456         /* Recalculate bonuses */
2457         p_ptr->update |= (PU_BONUS);
2458
2459         /* Handle stuff */
2460         handle_stuff();
2461
2462         /* Result */
2463         return (TRUE);
2464 }
2465
2466
2467 /*
2468  * Set "p_ptr->tim_sh_holy", notice observable changes
2469  */
2470 bool set_tim_sh_holy(int v, bool do_dec)
2471 {
2472         bool notice = FALSE;
2473
2474         /* Hack -- Force good values */
2475         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2476
2477         if (p_ptr->is_dead) return FALSE;
2478
2479         /* Open */
2480         if (v)
2481         {
2482                 if (p_ptr->tim_sh_holy && !do_dec)
2483                 {
2484                         if (p_ptr->tim_sh_holy > v) return FALSE;
2485                 }
2486                 else if (!p_ptr->tim_sh_holy)
2487                 {
2488 #ifdef JP
2489 msg_print("ÂΤ¬À»¤Ê¤ë¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2490 #else
2491                         msg_print("You have enveloped by holy aura!");
2492 #endif
2493
2494                         notice = TRUE;
2495                 }
2496         }
2497
2498         /* Shut */
2499         else
2500         {
2501                 if (p_ptr->tim_sh_holy)
2502                 {
2503 #ifdef JP
2504 msg_print("À»¤Ê¤ë¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2505 #else
2506                         msg_print("Holy aura disappeared.");
2507 #endif
2508
2509                         notice = TRUE;
2510                 }
2511         }
2512
2513         /* Use the value */
2514         p_ptr->tim_sh_holy = v;
2515
2516         /* Redraw status bar */
2517         p_ptr->redraw |= (PR_STATUS);
2518
2519         /* Nothing to notice */
2520         if (!notice) return (FALSE);
2521
2522         /* Disturb */
2523         if (disturb_state) disturb(0, 0);
2524
2525         /* Recalculate bonuses */
2526         p_ptr->update |= (PU_BONUS);
2527
2528         /* Handle stuff */
2529         handle_stuff();
2530
2531         /* Result */
2532         return (TRUE);
2533 }
2534
2535
2536
2537 /*
2538  * Set "p_ptr->tim_eyeeye", notice observable changes
2539  */
2540 bool set_tim_eyeeye(int v, bool do_dec)
2541 {
2542         bool notice = FALSE;
2543
2544         /* Hack -- Force good values */
2545         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2546
2547         if (p_ptr->is_dead) return FALSE;
2548
2549         /* Open */
2550         if (v)
2551         {
2552                 if (p_ptr->tim_eyeeye && !do_dec)
2553                 {
2554                         if (p_ptr->tim_eyeeye > v) return FALSE;
2555                 }
2556                 else if (!p_ptr->tim_eyeeye)
2557                 {
2558 #ifdef JP
2559 msg_print("Ë¡¤Î¼é¤ê¼ê¤Ë¤Ê¤Ã¤¿µ¤¤¬¤·¤¿¡ª");
2560 #else
2561                         msg_print("You feel like a keeper of commandments!");
2562 #endif
2563
2564                         notice = TRUE;
2565                 }
2566         }
2567
2568         /* Shut */
2569         else
2570         {
2571                 if (p_ptr->tim_eyeeye)
2572                 {
2573 #ifdef JP
2574 msg_print("Ĩȳ¤ò¼¹¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
2575 #else
2576                         msg_print("You no longer feel like a keeper.");
2577 #endif
2578
2579                         notice = TRUE;
2580                 }
2581         }
2582
2583         /* Use the value */
2584         p_ptr->tim_eyeeye = v;
2585
2586         /* Redraw status bar */
2587         p_ptr->redraw |= (PR_STATUS);
2588
2589         /* Nothing to notice */
2590         if (!notice) return (FALSE);
2591
2592         /* Disturb */
2593         if (disturb_state) disturb(0, 0);
2594
2595         /* Recalculate bonuses */
2596         p_ptr->update |= (PU_BONUS);
2597
2598         /* Handle stuff */
2599         handle_stuff();
2600
2601         /* Result */
2602         return (TRUE);
2603 }
2604
2605
2606
2607 /*
2608  * Set "p_ptr->resist_magic", notice observable changes
2609  */
2610 bool set_resist_magic(int v, bool do_dec)
2611 {
2612         bool notice = FALSE;
2613
2614         /* Hack -- Force good values */
2615         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2616
2617         if (p_ptr->is_dead) return FALSE;
2618
2619         /* Open */
2620         if (v)
2621         {
2622                 if (p_ptr->resist_magic && !do_dec)
2623                 {
2624                         if (p_ptr->resist_magic > v) return FALSE;
2625                 }
2626                 else if (!p_ptr->resist_magic)
2627                 {
2628 #ifdef JP
2629 msg_print("ËâË¡¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿¡£");
2630 #else
2631                         msg_print("You have been protected from magic!");
2632 #endif
2633
2634                         notice = TRUE;
2635                 }
2636         }
2637
2638         /* Shut */
2639         else
2640         {
2641                 if (p_ptr->resist_magic)
2642                 {
2643 #ifdef JP
2644 msg_print("ËâË¡¤Ë¼å¤¯¤Ê¤Ã¤¿¡£");
2645 #else
2646 msg_print("You are no longer protected from magic.");
2647 #endif
2648
2649                         notice = TRUE;
2650                 }
2651         }
2652
2653         /* Use the value */
2654         p_ptr->resist_magic = v;
2655
2656         /* Redraw status bar */
2657         p_ptr->redraw |= (PR_STATUS);
2658
2659         /* Nothing to notice */
2660         if (!notice) return (FALSE);
2661
2662         /* Disturb */
2663         if (disturb_state) disturb(0, 0);
2664
2665         /* Recalculate bonuses */
2666         p_ptr->update |= (PU_BONUS);
2667
2668         /* Handle stuff */
2669         handle_stuff();
2670
2671         /* Result */
2672         return (TRUE);
2673 }
2674
2675
2676 /*
2677  * Set "p_ptr->tim_reflect", notice observable changes
2678  */
2679 bool set_tim_reflect(int v, bool do_dec)
2680 {
2681         bool notice = FALSE;
2682
2683         /* Hack -- Force good values */
2684         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2685
2686         if (p_ptr->is_dead) return FALSE;
2687
2688         /* Open */
2689         if (v)
2690         {
2691                 if (p_ptr->tim_reflect && !do_dec)
2692                 {
2693                         if (p_ptr->tim_reflect > v) return FALSE;
2694                 }
2695                 else if (!p_ptr->tim_reflect)
2696                 {
2697 #ifdef JP
2698 msg_print("ÂΤÎɽÌ̤¬³ê¤«¤Ë¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
2699 #else
2700                         msg_print("Your body becames smooth.");
2701 #endif
2702
2703                         notice = TRUE;
2704                 }
2705         }
2706
2707         /* Shut */
2708         else
2709         {
2710                 if (p_ptr->tim_reflect)
2711                 {
2712 #ifdef JP
2713 msg_print("ÂΤÎɽÌ̤¬³ê¤«¤Ç¤Ê¤¯¤Ê¤Ã¤¿¡£");
2714 #else
2715                         msg_print("Your body is no longer smooth.");
2716 #endif
2717
2718                         notice = TRUE;
2719                 }
2720         }
2721
2722         /* Use the value */
2723         p_ptr->tim_reflect = v;
2724
2725         /* Redraw status bar */
2726         p_ptr->redraw |= (PR_STATUS);
2727
2728         /* Nothing to notice */
2729         if (!notice) return (FALSE);
2730
2731         /* Disturb */
2732         if (disturb_state) disturb(0, 0);
2733
2734         /* Recalculate bonuses */
2735         p_ptr->update |= (PU_BONUS);
2736
2737         /* Handle stuff */
2738         handle_stuff();
2739
2740         /* Result */
2741         return (TRUE);
2742 }
2743
2744
2745 /*
2746  * Set "p_ptr->multishadow", notice observable changes
2747  */
2748 bool set_multishadow(int v, bool do_dec)
2749 {
2750         bool notice = FALSE;
2751
2752         /* Hack -- Force good values */
2753         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2754
2755         if (p_ptr->is_dead) return FALSE;
2756
2757         /* Open */
2758         if (v)
2759         {
2760                 if (p_ptr->multishadow && !do_dec)
2761                 {
2762                         if (p_ptr->multishadow > v) return FALSE;
2763                 }
2764                 else if (!p_ptr->multishadow)
2765                 {
2766 #ifdef JP
2767 msg_print("¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¸¸±Æ¤¬À¸¤Þ¤ì¤¿¡£");
2768 #else
2769                         msg_print("Your Shadow enveloped you.");
2770 #endif
2771
2772                         notice = TRUE;
2773                 }
2774         }
2775
2776         /* Shut */
2777         else
2778         {
2779                 if (p_ptr->multishadow)
2780                 {
2781 #ifdef JP
2782 msg_print("¸¸±Æ¤¬¾Ã¤¨¤¿¡£");
2783 #else
2784                         msg_print("Your Shadow disappears.");
2785 #endif
2786
2787                         notice = TRUE;
2788                 }
2789         }
2790
2791         /* Use the value */
2792         p_ptr->multishadow = v;
2793
2794         /* Redraw status bar */
2795         p_ptr->redraw |= (PR_STATUS);
2796
2797         /* Nothing to notice */
2798         if (!notice) return (FALSE);
2799
2800         /* Disturb */
2801         if (disturb_state) disturb(0, 0);
2802
2803         /* Recalculate bonuses */
2804         p_ptr->update |= (PU_BONUS);
2805
2806         /* Handle stuff */
2807         handle_stuff();
2808
2809         /* Result */
2810         return (TRUE);
2811 }
2812
2813
2814 /*
2815  * Set "p_ptr->dustrobe", notice observable changes
2816  */
2817 bool set_dustrobe(int v, bool do_dec)
2818 {
2819         bool notice = FALSE;
2820
2821         /* Hack -- Force good values */
2822         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2823
2824         if (p_ptr->is_dead) return FALSE;
2825
2826         /* Open */
2827         if (v)
2828         {
2829                 if (p_ptr->dustrobe && !do_dec)
2830                 {
2831                         if (p_ptr->dustrobe > v) return FALSE;
2832                 }
2833                 else if (!p_ptr->dustrobe)
2834                 {
2835 #ifdef JP
2836 msg_print("ÂΤ¬¶À¤Î¥ª¡¼¥é¤Çʤ¤ï¤ì¤¿¡£");
2837 #else
2838                         msg_print("You were enveloped by mirror shards.");
2839 #endif
2840
2841                         notice = TRUE;
2842                 }
2843         }
2844
2845         /* Shut */
2846         else
2847         {
2848                 if (p_ptr->dustrobe)
2849                 {
2850 #ifdef JP
2851 msg_print("¶À¤Î¥ª¡¼¥é¤¬¾Ã¤¨¤¿¡£");
2852 #else
2853                         msg_print("The mirror shards disappear.");
2854 #endif
2855
2856                         notice = TRUE;
2857                 }
2858         }
2859
2860         /* Use the value */
2861         p_ptr->dustrobe = v;
2862
2863         /* Redraw status bar */
2864         p_ptr->redraw |= (PR_STATUS);
2865
2866         /* Nothing to notice */
2867         if (!notice) return (FALSE);
2868
2869         /* Disturb */
2870         if (disturb_state) disturb(0, 0);
2871
2872         /* Recalculate bonuses */
2873         p_ptr->update |= (PU_BONUS);
2874
2875         /* Handle stuff */
2876         handle_stuff();
2877
2878         /* Result */
2879         return (TRUE);
2880 }
2881
2882
2883 /*
2884  * Set "p_ptr->tim_regen", notice observable changes
2885  */
2886 bool set_kabenuke(int v, bool do_dec)
2887 {
2888         bool notice = FALSE;
2889
2890         /* Hack -- Force good values */
2891         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2892
2893         if (p_ptr->is_dead) return FALSE;
2894
2895         /* Open */
2896         if (v)
2897         {
2898                 if (p_ptr->kabenuke && !do_dec)
2899                 {
2900                         if (p_ptr->kabenuke > v) return FALSE;
2901                 }
2902                 else if (!p_ptr->kabenuke)
2903                 {
2904 #ifdef JP
2905 msg_print("ÂΤ¬È¾Êª¼Á¤Î¾õÂ֤ˤʤä¿¡£");
2906 #else
2907                         msg_print("You became ethereal form.");
2908 #endif
2909
2910                         notice = TRUE;
2911                 }
2912         }
2913
2914         /* Shut */
2915         else
2916         {
2917                 if (p_ptr->kabenuke)
2918                 {
2919 #ifdef JP
2920 msg_print("ÂΤ¬Êª¼Á²½¤·¤¿¡£");
2921 #else
2922                         msg_print("You are no longer in an ethereal form.");
2923 #endif
2924
2925                         notice = TRUE;
2926                 }
2927         }
2928
2929         /* Use the value */
2930         p_ptr->kabenuke = v;
2931
2932         /* Redraw status bar */
2933         p_ptr->redraw |= (PR_STATUS);
2934
2935         /* Nothing to notice */
2936         if (!notice) return (FALSE);
2937
2938         /* Disturb */
2939         if (disturb_state) disturb(0, 0);
2940
2941         /* Recalculate bonuses */
2942         p_ptr->update |= (PU_BONUS);
2943
2944         /* Handle stuff */
2945         handle_stuff();
2946
2947         /* Result */
2948         return (TRUE);
2949 }
2950
2951
2952 bool set_tsuyoshi(int v, bool do_dec)
2953 {
2954         bool notice = FALSE;
2955
2956         /* Hack -- Force good values */
2957         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
2958
2959         if (p_ptr->is_dead) return FALSE;
2960
2961         /* Open */
2962         if (v)
2963         {
2964                 if (p_ptr->tsuyoshi && !do_dec)
2965                 {
2966                         if (p_ptr->tsuyoshi > v) return FALSE;
2967                 }
2968                 else if (!p_ptr->tsuyoshi)
2969                 {
2970 #ifdef JP
2971 msg_print("¡Ö¥ª¥¯¥ì·»¤µ¤ó¡ª¡×");
2972 #else
2973                         msg_print("Brother OKURE!");
2974 #endif
2975
2976                         notice = TRUE;
2977                         chg_virtue(V_VITALITY, 2);
2978                 }
2979         }
2980
2981         /* Shut */
2982         else
2983         {
2984                 if (p_ptr->tsuyoshi)
2985                 {
2986 #ifdef JP
2987 msg_print("ÆùÂΤ¬µÞ®¤Ë¤·¤Ü¤ó¤Ç¤¤¤Ã¤¿¡£");
2988 #else
2989                         msg_print("Your body had quickly shriveled.");
2990 #endif
2991
2992                         (void)dec_stat(A_CON, 20, TRUE);
2993                         (void)dec_stat(A_STR, 20, TRUE);
2994
2995                         notice = TRUE;
2996                         chg_virtue(V_VITALITY, -3);
2997                 }
2998         }
2999
3000         /* Use the value */
3001         p_ptr->tsuyoshi = v;
3002
3003         /* Redraw status bar */
3004         p_ptr->redraw |= (PR_STATUS);
3005
3006         /* Nothing to notice */
3007         if (!notice) return (FALSE);
3008
3009         /* Disturb */
3010         if (disturb_state) disturb(0, 0);
3011
3012         /* Recalculate bonuses */
3013         p_ptr->update |= (PU_BONUS);
3014
3015         /* Recalculate hitpoints */
3016         p_ptr->update |= (PU_HP);
3017
3018         /* Handle stuff */
3019         handle_stuff();
3020
3021         /* Result */
3022         return (TRUE);
3023 }
3024
3025
3026 /*
3027  * Set a temporary elemental brand.  Clear all other brands.  Print status 
3028  * messages. -LM-
3029  */
3030 bool set_ele_attack(u32b attack_type, int v)
3031 {
3032         /* Hack -- Force good values */
3033         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3034
3035         /* Clear all elemental attacks (only one is allowed at a time). */
3036         if ((p_ptr->special_attack & (ATTACK_ACID)) && (attack_type != ATTACK_ACID))
3037         {
3038                 p_ptr->special_attack &= ~(ATTACK_ACID);
3039 #ifdef JP
3040                 msg_print("»À¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3041 #else
3042                 msg_print("Your temporary acidic brand fades away.");
3043 #endif
3044         }
3045         if ((p_ptr->special_attack & (ATTACK_ELEC)) && (attack_type != ATTACK_ELEC))
3046         {
3047                 p_ptr->special_attack &= ~(ATTACK_ELEC);
3048 #ifdef JP
3049                 msg_print("ÅÅ·â¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3050 #else
3051                 msg_print("Your temporary electrical brand fades away.");
3052 #endif
3053         }
3054         if ((p_ptr->special_attack & (ATTACK_FIRE)) && (attack_type != ATTACK_FIRE))
3055         {
3056                 p_ptr->special_attack &= ~(ATTACK_FIRE);
3057 #ifdef JP
3058                 msg_print("²Ð±ê¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3059 #else
3060                 msg_print("Your temporary fiery brand fades away.");
3061 #endif
3062         }
3063         if ((p_ptr->special_attack & (ATTACK_COLD)) && (attack_type != ATTACK_COLD))
3064         {
3065                 p_ptr->special_attack &= ~(ATTACK_COLD);
3066 #ifdef JP
3067                 msg_print("Î䵤¤Ç¹¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3068 #else
3069                 msg_print("Your temporary frost brand fades away.");
3070 #endif
3071         }
3072         if ((p_ptr->special_attack & (ATTACK_POIS)) && (attack_type != ATTACK_POIS))
3073         {
3074                 p_ptr->special_attack &= ~(ATTACK_POIS);
3075 #ifdef JP
3076                 msg_print("ÆǤǹ¶·â¤Ç¤­¤Ê¤¯¤Ê¤Ã¤¿¡£");
3077 #else
3078                 msg_print("Your temporary poison brand fades away.");
3079 #endif
3080         }
3081
3082         if ((v) && (attack_type))
3083         {
3084                 /* Set attack type. */
3085                 p_ptr->special_attack |= (attack_type);
3086
3087                 /* Set duration. */
3088                 p_ptr->ele_attack = v;
3089
3090                 /* Message. */
3091 #ifdef JP
3092                 msg_format("%s¤Ç¹¶·â¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª",
3093                              ((attack_type == ATTACK_ACID) ? "»À" :
3094                               ((attack_type == ATTACK_ELEC) ? "ÅÅ·â" :
3095                                ((attack_type == ATTACK_FIRE) ? "²Ð±ê" : 
3096                                 ((attack_type == ATTACK_COLD) ? "Î䵤" : 
3097                                  ((attack_type == ATTACK_POIS) ? "ÆÇ" : 
3098                                         "(¤Ê¤·)"))))));
3099 #else
3100                 msg_format("For a while, the blows you deal will %s",
3101                              ((attack_type == ATTACK_ACID) ? "melt with acid!" :
3102                               ((attack_type == ATTACK_ELEC) ? "shock your foes!" :
3103                                ((attack_type == ATTACK_FIRE) ? "burn with fire!" : 
3104                                 ((attack_type == ATTACK_COLD) ? "chill to the bone!" : 
3105                                  ((attack_type == ATTACK_POIS) ? "poison your enemies!" : 
3106                                         "do nothing special."))))));
3107 #endif
3108         }
3109
3110         /* Disturb */
3111         if (disturb_state) disturb(0, 0);
3112
3113         /* Redraw status bar */
3114         p_ptr->redraw |= (PR_STATUS);
3115
3116         p_ptr->update |= (PU_BONUS);
3117
3118         /* Handle stuff */
3119         handle_stuff();
3120
3121         return (TRUE);
3122 }
3123
3124
3125 /*
3126  * Set a temporary elemental brand.  Clear all other brands.  Print status 
3127  * messages. -LM-
3128  */
3129 bool set_ele_immune(u32b immune_type, int v)
3130 {
3131         /* Hack -- Force good values */
3132         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3133
3134         /* Clear all elemental attacks (only one is allowed at a time). */
3135         if ((p_ptr->special_defense & (DEFENSE_ACID)) && (immune_type != DEFENSE_ACID))
3136         {
3137                 p_ptr->special_defense &= ~(DEFENSE_ACID);
3138 #ifdef JP
3139                 msg_print("»À¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3140 #else
3141                 msg_print("You are no longer immune to acid.");
3142 #endif
3143         }
3144         if ((p_ptr->special_defense & (DEFENSE_ELEC)) && (immune_type != DEFENSE_ELEC))
3145         {
3146                 p_ptr->special_defense &= ~(DEFENSE_ELEC);
3147 #ifdef JP
3148                 msg_print("ÅÅ·â¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3149 #else
3150                 msg_print("You are no longer immune to electricity.");
3151 #endif
3152         }
3153         if ((p_ptr->special_defense & (DEFENSE_FIRE)) && (immune_type != DEFENSE_FIRE))
3154         {
3155                 p_ptr->special_defense &= ~(DEFENSE_FIRE);
3156 #ifdef JP
3157                 msg_print("²Ð±ê¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3158 #else
3159                 msg_print("You are no longer immune to fire.");
3160 #endif
3161         }
3162         if ((p_ptr->special_defense & (DEFENSE_COLD)) && (immune_type != DEFENSE_COLD))
3163         {
3164                 p_ptr->special_defense &= ~(DEFENSE_COLD);
3165 #ifdef JP
3166                 msg_print("Î䵤¤Î¹¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3167 #else
3168                 msg_print("You are no longer immune to cold.");
3169 #endif
3170         }
3171         if ((p_ptr->special_defense & (DEFENSE_POIS)) && (immune_type != DEFENSE_POIS))
3172         {
3173                 p_ptr->special_defense &= ~(DEFENSE_POIS);
3174 #ifdef JP
3175                 msg_print("ÆǤι¶·â¤Ç½ý¤Ä¤±¤é¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¡£");
3176 #else
3177                 msg_print("You are no longer immune to poison.");
3178 #endif
3179         }
3180
3181         if ((v) && (immune_type))
3182         {
3183                 /* Set attack type. */
3184                 p_ptr->special_defense |= (immune_type);
3185
3186                 /* Set duration. */
3187                 p_ptr->ele_immune = v;
3188
3189                 /* Message. */
3190 #ifdef JP
3191                 msg_format("%s¤Î¹¶·â¤ò¼õ¤±¤Ä¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª",
3192                              ((immune_type == DEFENSE_ACID) ? "»À" :
3193                               ((immune_type == DEFENSE_ELEC) ? "ÅÅ·â" :
3194                                ((immune_type == DEFENSE_FIRE) ? "²Ð±ê" : 
3195                                 ((immune_type == DEFENSE_COLD) ? "Î䵤" : 
3196                                  ((immune_type == DEFENSE_POIS) ? "ÆÇ" : 
3197                                         "(¤Ê¤·)"))))));
3198 #else
3199                 msg_format("For a while, You are immune to %s",
3200                              ((immune_type == DEFENSE_ACID) ? "acid!" :
3201                               ((immune_type == DEFENSE_ELEC) ? "electricity!" :
3202                                ((immune_type == DEFENSE_FIRE) ? "fire!" : 
3203                                 ((immune_type == DEFENSE_COLD) ? "cold!" : 
3204                                  ((immune_type == DEFENSE_POIS) ? "poison!" : 
3205                                         "do nothing special."))))));
3206 #endif
3207         }
3208
3209         /* Disturb */
3210         if (disturb_state) disturb(0, 0);
3211
3212         /* Redraw status bar */
3213         p_ptr->redraw |= (PR_STATUS);
3214
3215         p_ptr->update |= (PU_BONUS);
3216
3217         /* Handle stuff */
3218         handle_stuff();
3219
3220         return (TRUE);
3221 }
3222
3223
3224 /*
3225  * Set "p_ptr->oppose_acid", notice observable changes
3226  */
3227 bool set_oppose_acid(int v, bool do_dec)
3228 {
3229         bool notice = FALSE;
3230
3231         /* Hack -- Force good values */
3232         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3233
3234         if (p_ptr->is_dead) return FALSE;
3235
3236         /* Open */
3237         if (v)
3238         {
3239                 if (p_ptr->oppose_acid && !do_dec)
3240                 {
3241                         if (p_ptr->oppose_acid > v) return FALSE;
3242                 }
3243                 else if (!IS_OPPOSE_ACID())
3244                 {
3245 #ifdef JP
3246 msg_print("»À¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3247 #else
3248                         msg_print("You feel resistant to acid!");
3249 #endif
3250
3251                         notice = TRUE;
3252                 }
3253         }
3254
3255         /* Shut */
3256         else
3257         {
3258                 if (p_ptr->oppose_acid && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3259                 {
3260 #ifdef JP
3261 msg_print("»À¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3262 #else
3263                         msg_print("You feel less resistant to acid.");
3264 #endif
3265
3266                         notice = TRUE;
3267                 }
3268         }
3269
3270         /* Use the value */
3271         p_ptr->oppose_acid = v;
3272
3273         /* Nothing to notice */
3274         if (!notice) return (FALSE);
3275
3276         /* Redraw status bar */
3277         p_ptr->redraw |= (PR_STATUS);
3278
3279         /* Disturb */
3280         if (disturb_state) disturb(0, 0);
3281
3282         /* Handle stuff */
3283         handle_stuff();
3284
3285         /* Result */
3286         return (TRUE);
3287 }
3288
3289
3290 /*
3291  * Set "p_ptr->oppose_elec", notice observable changes
3292  */
3293 bool set_oppose_elec(int v, bool do_dec)
3294 {
3295         bool notice = FALSE;
3296
3297         /* Hack -- Force good values */
3298         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3299
3300         if (p_ptr->is_dead) return FALSE;
3301
3302         /* Open */
3303         if (v)
3304         {
3305                 if (p_ptr->oppose_elec && !do_dec)
3306                 {
3307                         if (p_ptr->oppose_elec > v) return FALSE;
3308                 }
3309                 else if (!IS_OPPOSE_ELEC())
3310                 {
3311 #ifdef JP
3312 msg_print("ÅÅ·â¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3313 #else
3314                         msg_print("You feel resistant to electricity!");
3315 #endif
3316
3317                         notice = TRUE;
3318                 }
3319         }
3320
3321         /* Shut */
3322         else
3323         {
3324                 if (p_ptr->oppose_elec && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3325                 {
3326 #ifdef JP
3327 msg_print("ÅÅ·â¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3328 #else
3329                         msg_print("You feel less resistant to electricity.");
3330 #endif
3331
3332                         notice = TRUE;
3333                 }
3334         }
3335
3336         /* Use the value */
3337         p_ptr->oppose_elec = v;
3338
3339         /* Nothing to notice */
3340         if (!notice) return (FALSE);
3341
3342         /* Redraw status bar */
3343         p_ptr->redraw |= (PR_STATUS);
3344
3345         /* Disturb */
3346         if (disturb_state) disturb(0, 0);
3347
3348         /* Handle stuff */
3349         handle_stuff();
3350
3351         /* Result */
3352         return (TRUE);
3353 }
3354
3355
3356 /*
3357  * Set "p_ptr->oppose_fire", notice observable changes
3358  */
3359 bool set_oppose_fire(int v, bool do_dec)
3360 {
3361         bool notice = FALSE;
3362
3363         /* Hack -- Force good values */
3364         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3365
3366         if (p_ptr->is_dead) return FALSE;
3367
3368         if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1;
3369         /* Open */
3370         if (v)
3371         {
3372                 if (p_ptr->oppose_fire && !do_dec)
3373                 {
3374                         if (p_ptr->oppose_fire > v) return FALSE;
3375                 }
3376                 else if (!IS_OPPOSE_FIRE())
3377                 {
3378 #ifdef JP
3379 msg_print("²Ð¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3380 #else
3381                         msg_print("You feel resistant to fire!");
3382 #endif
3383
3384                         notice = TRUE;
3385                 }
3386         }
3387
3388         /* Shut */
3389         else
3390         {
3391                 if (p_ptr->oppose_fire && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3392                 {
3393 #ifdef JP
3394 msg_print("²Ð¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3395 #else
3396                         msg_print("You feel less resistant to fire.");
3397 #endif
3398
3399                         notice = TRUE;
3400                 }
3401         }
3402
3403         /* Use the value */
3404         p_ptr->oppose_fire = v;
3405
3406         /* Nothing to notice */
3407         if (!notice) return (FALSE);
3408
3409         /* Redraw status bar */
3410         p_ptr->redraw |= (PR_STATUS);
3411
3412         /* Disturb */
3413         if (disturb_state) disturb(0, 0);
3414
3415         /* Handle stuff */
3416         handle_stuff();
3417
3418         /* Result */
3419         return (TRUE);
3420 }
3421
3422
3423 /*
3424  * Set "p_ptr->oppose_cold", notice observable changes
3425  */
3426 bool set_oppose_cold(int v, bool do_dec)
3427 {
3428         bool notice = FALSE;
3429
3430         /* Hack -- Force good values */
3431         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3432
3433         if (p_ptr->is_dead) return FALSE;
3434
3435         /* Open */
3436         if (v)
3437         {
3438                 if (p_ptr->oppose_cold && !do_dec)
3439                 {
3440                         if (p_ptr->oppose_cold > v) return FALSE;
3441                 }
3442                 else if (!IS_OPPOSE_COLD())
3443                 {
3444 #ifdef JP
3445 msg_print("Î䵤¤Ø¤ÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3446 #else
3447                         msg_print("You feel resistant to cold!");
3448 #endif
3449
3450                         notice = TRUE;
3451                 }
3452         }
3453
3454         /* Shut */
3455         else
3456         {
3457                 if (p_ptr->oppose_cold && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3458                 {
3459 #ifdef JP
3460 msg_print("Î䵤¤Ø¤ÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3461 #else
3462                         msg_print("You feel less resistant to cold.");
3463 #endif
3464
3465                         notice = TRUE;
3466                 }
3467         }
3468
3469         /* Use the value */
3470         p_ptr->oppose_cold = v;
3471
3472         /* Nothing to notice */
3473         if (!notice) return (FALSE);
3474
3475         /* Redraw status bar */
3476         p_ptr->redraw |= (PR_STATUS);
3477
3478         /* Disturb */
3479         if (disturb_state) disturb(0, 0);
3480
3481         /* Handle stuff */
3482         handle_stuff();
3483
3484         /* Result */
3485         return (TRUE);
3486 }
3487
3488
3489 /*
3490  * Set "p_ptr->oppose_pois", notice observable changes
3491  */
3492 bool set_oppose_pois(int v, bool do_dec)
3493 {
3494         bool notice = FALSE;
3495
3496         /* Hack -- Force good values */
3497         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3498
3499         if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1;
3500         if (p_ptr->is_dead) return FALSE;
3501
3502         /* Open */
3503         if (v)
3504         {
3505                 if (p_ptr->oppose_pois && !do_dec)
3506                 {
3507                         if (p_ptr->oppose_pois > v) return FALSE;
3508                 }
3509                 else if (!IS_OPPOSE_POIS())
3510                 {
3511 #ifdef JP
3512 msg_print("ÆǤؤÎÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
3513 #else
3514                         msg_print("You feel resistant to poison!");
3515 #endif
3516
3517                         notice = TRUE;
3518                 }
3519         }
3520
3521         /* Shut */
3522         else
3523         {
3524                 if (p_ptr->oppose_pois && !music_singing(MUSIC_RESIST) && !(p_ptr->special_defense & KATA_MUSOU))
3525                 {
3526 #ifdef JP
3527 msg_print("ÆǤؤÎÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
3528 #else
3529                         msg_print("You feel less resistant to poison.");
3530 #endif
3531
3532                         notice = TRUE;
3533                 }
3534         }
3535
3536         /* Use the value */
3537         p_ptr->oppose_pois = v;
3538
3539         /* Nothing to notice */
3540         if (!notice) return (FALSE);
3541
3542         /* Redraw status bar */
3543         p_ptr->redraw |= (PR_STATUS);
3544
3545         /* Disturb */
3546         if (disturb_state) disturb(0, 0);
3547
3548         /* Handle stuff */
3549         handle_stuff();
3550
3551         /* Result */
3552         return (TRUE);
3553 }
3554
3555
3556 /*
3557  * Set "p_ptr->stun", notice observable changes
3558  *
3559  * Note the special code to only notice "range" changes.
3560  */
3561 bool set_stun(int v)
3562 {
3563         int old_aux, new_aux;
3564         bool notice = FALSE;
3565
3566
3567         /* Hack -- Force good values */
3568         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3569
3570         if (p_ptr->is_dead) return FALSE;
3571
3572         if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0;
3573
3574         /* Knocked out */
3575         if (p_ptr->stun > 100)
3576         {
3577                 old_aux = 3;
3578         }
3579
3580         /* Heavy stun */
3581         else if (p_ptr->stun > 50)
3582         {
3583                 old_aux = 2;
3584         }
3585
3586         /* Stun */
3587         else if (p_ptr->stun > 0)
3588         {
3589                 old_aux = 1;
3590         }
3591
3592         /* None */
3593         else
3594         {
3595                 old_aux = 0;
3596         }
3597
3598         /* Knocked out */
3599         if (v > 100)
3600         {
3601                 new_aux = 3;
3602         }
3603
3604         /* Heavy stun */
3605         else if (v > 50)
3606         {
3607                 new_aux = 2;
3608         }
3609
3610         /* Stun */
3611         else if (v > 0)
3612         {
3613                 new_aux = 1;
3614         }
3615
3616         /* None */
3617         else
3618         {
3619                 new_aux = 0;
3620         }
3621
3622         /* Increase cut */
3623         if (new_aux > old_aux)
3624         {
3625                 /* Describe the state */
3626                 switch (new_aux)
3627                 {
3628                         /* Stun */
3629                         case 1:
3630 #ifdef JP
3631 msg_print("°Õ¼±¤¬¤â¤¦¤í¤¦¤È¤·¤Æ¤­¤¿¡£");
3632 #else
3633                         msg_print("You have been stunned.");
3634 #endif
3635
3636                         break;
3637
3638                         /* Heavy stun */
3639                         case 2:
3640 #ifdef JP
3641 msg_print("°Õ¼±¤¬¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤Æ¤­¤¿¡£");
3642 #else
3643                         msg_print("You have been heavily stunned.");
3644 #endif
3645
3646                         break;
3647
3648                         /* Knocked out */
3649                         case 3:
3650 #ifdef JP
3651 msg_print("Ƭ¤¬¥¯¥é¥¯¥é¤·¤Æ°Õ¼±¤¬±ó¤Î¤¤¤Æ¤­¤¿¡£");
3652 #else
3653                         msg_print("You have been knocked out.");
3654 #endif
3655
3656                         break;
3657                 }
3658
3659                 if (randint1(1000) < v || one_in_(16))
3660                 {
3661 #ifdef JP
3662 msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
3663 #else
3664                         msg_print("A vicious blow hits your head.");
3665 #endif
3666
3667                         if (one_in_(3))
3668                         {
3669                                 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3670                                 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3671                         }
3672                         else if (one_in_(2))
3673                         {
3674                                 if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
3675                         }
3676                         else
3677                         {
3678                                 if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
3679                         }
3680                 }
3681                 if (p_ptr->special_defense & KATA_MASK)
3682                 {
3683 #ifdef JP
3684                         msg_print("·¿¤¬Êø¤ì¤¿¡£");
3685 #else
3686                         msg_print("Your posture gets loose.");
3687 #endif
3688                         p_ptr->special_defense &= ~(KATA_MASK);
3689                         p_ptr->update |= (PU_BONUS);
3690                         p_ptr->update |= (PU_MONSTERS);
3691                         p_ptr->redraw |= (PR_STATE);
3692                         p_ptr->redraw |= (PR_STATUS);
3693                         p_ptr->action = ACTION_NONE;
3694                 }
3695
3696                 /* Sniper */
3697                 if (p_ptr->concent) reset_concentration(TRUE);
3698
3699                 /* Hex */
3700                 if (hex_spelling_any()) stop_hex_spell_all();
3701
3702                 /* Notice */
3703                 notice = TRUE;
3704         }
3705
3706         /* Decrease cut */
3707         else if (new_aux < old_aux)
3708         {
3709                 /* Describe the state */
3710                 switch (new_aux)
3711                 {
3712                         /* None */
3713                         case 0:
3714 #ifdef JP
3715 msg_print("¤ä¤Ã¤ÈÛ¯Û°¾õÂÖ¤«¤é²óÉü¤·¤¿¡£");
3716 #else
3717                         msg_print("You are no longer stunned.");
3718 #endif
3719
3720                         if (disturb_state) disturb(0, 0);
3721                         break;
3722                 }
3723
3724                 /* Notice */
3725                 notice = TRUE;
3726         }
3727
3728         /* Use the value */
3729         p_ptr->stun = v;
3730
3731         /* No change */
3732         if (!notice) return (FALSE);
3733
3734         /* Disturb */
3735         if (disturb_state) disturb(0, 0);
3736
3737         /* Recalculate bonuses */
3738         p_ptr->update |= (PU_BONUS);
3739
3740         /* Redraw the "stun" */
3741         p_ptr->redraw |= (PR_STUN);
3742
3743         /* Handle stuff */
3744         handle_stuff();
3745
3746         /* Result */
3747         return (TRUE);
3748 }
3749
3750
3751 /*
3752  * Set "p_ptr->cut", notice observable changes
3753  *
3754  * Note the special code to only notice "range" changes.
3755  */
3756 bool set_cut(int v)
3757 {
3758         int old_aux, new_aux;
3759         bool notice = FALSE;
3760
3761         /* Hack -- Force good values */
3762         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
3763
3764         if (p_ptr->is_dead) return FALSE;
3765
3766         if ((p_ptr->prace == RACE_GOLEM ||
3767             p_ptr->prace == RACE_SKELETON ||
3768             p_ptr->prace == RACE_SPECTRE ||
3769                 (p_ptr->prace == RACE_ZOMBIE && p_ptr->lev > 11)) &&
3770             !p_ptr->mimic_form)
3771                 v = 0;
3772
3773         /* Mortal wound */
3774         if (p_ptr->cut > 1000)
3775         {
3776                 old_aux = 7;
3777         }
3778
3779         /* Deep gash */
3780         else if (p_ptr->cut > 200)
3781         {
3782                 old_aux = 6;
3783         }
3784
3785         /* Severe cut */
3786         else if (p_ptr->cut > 100)
3787         {
3788                 old_aux = 5;
3789         }
3790
3791         /* Nasty cut */
3792         else if (p_ptr->cut > 50)
3793         {
3794                 old_aux = 4;
3795         }
3796
3797         /* Bad cut */
3798         else if (p_ptr->cut > 25)
3799         {
3800                 old_aux = 3;
3801         }
3802
3803         /* Light cut */
3804         else if (p_ptr->cut > 10)
3805         {
3806                 old_aux = 2;
3807         }
3808
3809         /* Graze */
3810         else if (p_ptr->cut > 0)
3811         {
3812                 old_aux = 1;
3813         }
3814
3815         /* None */
3816         else
3817         {
3818                 old_aux = 0;
3819         }
3820
3821         /* Mortal wound */
3822         if (v > 1000)
3823         {
3824                 new_aux = 7;
3825         }
3826
3827         /* Deep gash */
3828         else if (v > 200)
3829         {
3830                 new_aux = 6;
3831         }
3832
3833         /* Severe cut */
3834         else if (v > 100)
3835         {
3836                 new_aux = 5;
3837         }
3838
3839         /* Nasty cut */
3840         else if (v > 50)
3841         {
3842                 new_aux = 4;
3843         }
3844
3845         /* Bad cut */
3846         else if (v > 25)
3847         {
3848                 new_aux = 3;
3849         }
3850
3851         /* Light cut */
3852         else if (v > 10)
3853         {
3854                 new_aux = 2;
3855         }
3856
3857         /* Graze */
3858         else if (v > 0)
3859         {
3860                 new_aux = 1;
3861         }
3862
3863         /* None */
3864         else
3865         {
3866                 new_aux = 0;
3867         }
3868
3869         /* Increase cut */
3870         if (new_aux > old_aux)
3871         {
3872                 /* Describe the state */
3873                 switch (new_aux)
3874                 {
3875                         /* Graze */
3876                         case 1:
3877 #ifdef JP
3878 msg_print("¤«¤¹¤ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3879 #else
3880                         msg_print("You have been given a graze.");
3881 #endif
3882
3883                         break;
3884
3885                         /* Light cut */
3886                         case 2:
3887 #ifdef JP
3888 msg_print("·Ú¤¤½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3889 #else
3890                         msg_print("You have been given a light cut.");
3891 #endif
3892
3893                         break;
3894
3895                         /* Bad cut */
3896                         case 3:
3897 #ifdef JP
3898 msg_print("¤Ò¤É¤¤½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3899 #else
3900                         msg_print("You have been given a bad cut.");
3901 #endif
3902
3903                         break;
3904
3905                         /* Nasty cut */
3906                         case 4:
3907 #ifdef JP
3908 msg_print("ÂçÊѤʽý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3909 #else
3910                         msg_print("You have been given a nasty cut.");
3911 #endif
3912
3913                         break;
3914
3915                         /* Severe cut */
3916                         case 5:
3917 #ifdef JP
3918 msg_print("½ÅÂç¤Ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3919 #else
3920                         msg_print("You have been given a severe cut.");
3921 #endif
3922
3923                         break;
3924
3925                         /* Deep gash */
3926                         case 6:
3927 #ifdef JP
3928 msg_print("¤Ò¤É¤¤¿¼¼ê¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3929 #else
3930                         msg_print("You have been given a deep gash.");
3931 #endif
3932
3933                         break;
3934
3935                         /* Mortal wound */
3936                         case 7:
3937 #ifdef JP
3938 msg_print("Ã×̿Ū¤Ê½ý¤òÉé¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3939 #else
3940                         msg_print("You have been given a mortal wound.");
3941 #endif
3942
3943                         break;
3944                 }
3945
3946                 /* Notice */
3947                 notice = TRUE;
3948
3949                 if (randint1(1000) < v || one_in_(16))
3950                 {
3951                         if (!p_ptr->sustain_chr)
3952                         {
3953 #ifdef JP
3954 msg_print("¤Ò¤É¤¤½ýÀפ¬»Ä¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
3955 #else
3956                                 msg_print("You have been horribly scarred.");
3957 #endif
3958
3959
3960                                 do_dec_stat(A_CHR);
3961                         }
3962                 }
3963         }
3964
3965         /* Decrease cut */
3966         else if (new_aux < old_aux)
3967         {
3968                 /* Describe the state */
3969                 switch (new_aux)
3970                 {
3971                         /* None */
3972                         case 0:
3973 #ifdef JP
3974 msg_format("¤ä¤Ã¤È%s¡£", p_ptr->prace == RACE_ANDROID ? "²ø²æ¤¬Ä¾¤Ã¤¿" : "½Ð·ì¤¬»ß¤Þ¤Ã¤¿");
3975 #else
3976                         msg_print("You are no longer bleeding.");
3977 #endif
3978
3979                         if (disturb_state) disturb(0, 0);
3980                         break;
3981                 }
3982
3983                 /* Notice */
3984                 notice = TRUE;
3985         }
3986
3987         /* Use the value */
3988         p_ptr->cut = v;
3989
3990         /* No change */
3991         if (!notice) return (FALSE);
3992
3993         /* Disturb */
3994         if (disturb_state) disturb(0, 0);
3995
3996         /* Recalculate bonuses */
3997         p_ptr->update |= (PU_BONUS);
3998
3999         /* Redraw the "cut" */
4000         p_ptr->redraw |= (PR_CUT);
4001
4002         /* Handle stuff */
4003         handle_stuff();
4004
4005         /* Result */
4006         return (TRUE);
4007 }
4008
4009
4010 /*
4011  * Set "p_ptr->food", notice observable changes
4012  *
4013  * The "p_ptr->food" variable can get as large as 20000, allowing the
4014  * addition of the most "filling" item, Elvish Waybread, which adds
4015  * 7500 food units, without overflowing the 32767 maximum limit.
4016  *
4017  * Perhaps we should disturb the player with various messages,
4018  * especially messages about hunger status changes.  XXX XXX XXX
4019  *
4020  * Digestion of food is handled in "dungeon.c", in which, normally,
4021  * the player digests about 20 food units per 100 game turns, more
4022  * when "fast", more when "regenerating", less with "slow digestion",
4023  * but when the player is "gorged", he digests 100 food units per 10
4024  * game turns, or a full 1000 food units per 100 game turns.
4025  *
4026  * Note that the player's speed is reduced by 10 units while gorged,
4027  * so if the player eats a single food ration (5000 food units) when
4028  * full (15000 food units), he will be gorged for (5000/100)*10 = 500
4029  * game turns, or 500/(100/5) = 25 player turns (if nothing else is
4030  * affecting the player speed).
4031  */
4032 bool set_food(int v)
4033 {
4034         int old_aux, new_aux;
4035
4036         bool notice = FALSE;
4037
4038         /* Hack -- Force good values */
4039         v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
4040
4041         /* Fainting / Starving */
4042         if (p_ptr->food < PY_FOOD_FAINT)
4043         {
4044                 old_aux = 0;
4045         }
4046
4047         /* Weak */
4048         else if (p_ptr->food < PY_FOOD_WEAK)
4049         {
4050                 old_aux = 1;
4051         }
4052
4053         /* Hungry */
4054         else if (p_ptr->food < PY_FOOD_ALERT)
4055         {
4056                 old_aux = 2;
4057         }
4058
4059         /* Normal */
4060         else if (p_ptr->food < PY_FOOD_FULL)
4061         {
4062                 old_aux = 3;
4063         }
4064
4065         /* Full */
4066         else if (p_ptr->food < PY_FOOD_MAX)
4067         {
4068                 old_aux = 4;
4069         }
4070
4071         /* Gorged */
4072         else
4073         {
4074                 old_aux = 5;
4075         }
4076
4077         /* Fainting / Starving */
4078         if (v < PY_FOOD_FAINT)
4079         {
4080                 new_aux = 0;
4081         }
4082
4083         /* Weak */
4084         else if (v < PY_FOOD_WEAK)
4085         {
4086                 new_aux = 1;
4087         }
4088
4089         /* Hungry */
4090         else if (v < PY_FOOD_ALERT)
4091         {
4092                 new_aux = 2;
4093         }
4094
4095         /* Normal */
4096         else if (v < PY_FOOD_FULL)
4097         {
4098                 new_aux = 3;
4099         }
4100
4101         /* Full */
4102         else if (v < PY_FOOD_MAX)
4103         {
4104                 new_aux = 4;
4105         }
4106
4107         /* Gorged */
4108         else
4109         {
4110                 new_aux = 5;
4111         }
4112
4113         if (old_aux < 1 && new_aux > 0)
4114                 chg_virtue(V_PATIENCE, 2);
4115         else if (old_aux < 3 && (old_aux != new_aux))
4116                 chg_virtue(V_PATIENCE, 1);
4117         if (old_aux == 2)
4118                 chg_virtue(V_TEMPERANCE, 1);
4119         if (old_aux == 0)
4120                 chg_virtue(V_TEMPERANCE, -1);
4121
4122         /* Food increase */
4123         if (new_aux > old_aux)
4124         {
4125                 /* Describe the state */
4126                 switch (new_aux)
4127                 {
4128                         /* Weak */
4129                         case 1:
4130 #ifdef JP
4131 msg_print("¤Þ¤À¶õÊ¢¤ÇÅݤ줽¤¦¤À¡£");
4132 #else
4133                         msg_print("You are still weak.");
4134 #endif
4135
4136                         break;
4137
4138                         /* Hungry */
4139                         case 2:
4140 #ifdef JP
4141 msg_print("¤Þ¤À¶õÊ¢¤À¡£");
4142 #else
4143                         msg_print("You are still hungry.");
4144 #endif
4145
4146                         break;
4147
4148                         /* Normal */
4149                         case 3:
4150 #ifdef JP
4151 msg_print("¶õÊ¢´¶¤¬¤ª¤µ¤Þ¤Ã¤¿¡£");
4152 #else
4153                         msg_print("You are no longer hungry.");
4154 #endif
4155
4156                         break;
4157
4158                         /* Full */
4159                         case 4:
4160 #ifdef JP
4161 msg_print("ËþÊ¢¤À¡ª");
4162 #else
4163                         msg_print("You are full!");
4164 #endif
4165
4166                         break;
4167
4168                         /* Bloated */
4169                         case 5:
4170 #ifdef JP
4171 msg_print("¿©¤Ù²á¤®¤À¡ª");
4172 #else
4173                         msg_print("You have gorged yourself!");
4174 #endif
4175                         chg_virtue(V_HARMONY, -1);
4176                         chg_virtue(V_PATIENCE, -1);
4177                         chg_virtue(V_TEMPERANCE, -2);
4178
4179                         break;
4180                 }
4181
4182                 /* Change */
4183                 notice = TRUE;
4184         }
4185
4186         /* Food decrease */
4187         else if (new_aux < old_aux)
4188         {
4189                 /* Describe the state */
4190                 switch (new_aux)
4191                 {
4192                         /* Fainting / Starving */
4193                         case 0:
4194 #ifdef JP
4195 msg_print("¤¢¤Þ¤ê¤Ë¤â¶õÊ¢¤Çµ¤¤ò¼º¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
4196 #else
4197                         msg_print("You are getting faint from hunger!");
4198 #endif
4199
4200                         break;
4201
4202                         /* Weak */
4203                         case 1:
4204 #ifdef JP
4205 msg_print("¤ªÊ¢¤¬¶õ¤¤¤ÆÅݤ줽¤¦¤À¡£");
4206 #else
4207                         msg_print("You are getting weak from hunger!");
4208 #endif
4209
4210                         break;
4211
4212                         /* Hungry */
4213                         case 2:
4214 #ifdef JP
4215 msg_print("¤ªÊ¢¤¬¶õ¤¤¤Æ¤­¤¿¡£");
4216 #else
4217                         msg_print("You are getting hungry.");
4218 #endif
4219
4220                         break;
4221
4222                         /* Normal */
4223                         case 3:
4224 #ifdef JP
4225 msg_print("ËþÊ¢´¶¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
4226 #else
4227                         msg_print("You are no longer full.");
4228 #endif
4229
4230                         break;
4231
4232                         /* Full */
4233                         case 4:
4234 #ifdef JP
4235 msg_print("¤ä¤Ã¤È¤ªÊ¢¤¬¤­¤Ä¤¯¤Ê¤¯¤Ê¤Ã¤¿¡£");
4236 #else
4237                         msg_print("You are no longer gorged.");
4238 #endif
4239
4240                         break;
4241                 }
4242
4243                 if (p_ptr->wild_mode && (new_aux < 2))
4244                 {
4245                         change_wild_mode();
4246                 }
4247
4248                 /* Change */
4249                 notice = TRUE;
4250         }
4251
4252         /* Use the value */
4253         p_ptr->food = v;
4254
4255         /* Nothing to notice */
4256         if (!notice) return (FALSE);
4257
4258         /* Disturb */
4259         if (disturb_state) disturb(0, 0);
4260
4261         /* Recalculate bonuses */
4262         p_ptr->update |= (PU_BONUS);
4263
4264         /* Redraw hunger */
4265         p_ptr->redraw |= (PR_HUNGER);
4266
4267         /* Handle stuff */
4268         handle_stuff();
4269
4270         /* Result */
4271         return (TRUE);
4272 }
4273
4274 /*
4275  * Increases a stat by one randomized level             -RAK-
4276  *
4277  * Note that this function (used by stat potions) now restores
4278  * the stat BEFORE increasing it.
4279  */
4280 bool inc_stat(int stat)
4281 {
4282         int value, gain;
4283
4284         /* Then augment the current/max stat */
4285         value = p_ptr->stat_cur[stat];
4286
4287         /* Cannot go above 18/100 */
4288         if (value < p_ptr->stat_max_max[stat])
4289         {
4290                 /* Gain one (sometimes two) points */
4291                 if (value < 18)
4292                 {
4293                         gain = ((randint0(100) < 75) ? 1 : 2);
4294                         value += gain;
4295                 }
4296
4297                 /* Gain 1/6 to 1/3 of distance to 18/100 */
4298                 else if (value < (p_ptr->stat_max_max[stat]-2))
4299                 {
4300                         /* Approximate gain value */
4301                         gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
4302
4303                         /* Paranoia */
4304                         if (gain < 1) gain = 1;
4305
4306                         /* Apply the bonus */
4307                         value += randint1(gain) + gain / 2;
4308
4309                         /* Maximal value */
4310                         if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
4311                 }
4312
4313                 /* Gain one point at a time */
4314                 else
4315                 {
4316                         value++;
4317                 }
4318
4319                 /* Save the new value */
4320                 p_ptr->stat_cur[stat] = value;
4321
4322                 /* Bring up the maximum too */
4323                 if (value > p_ptr->stat_max[stat])
4324                 {
4325                         p_ptr->stat_max[stat] = value;
4326                 }
4327
4328                 /* Recalculate bonuses */
4329                 p_ptr->update |= (PU_BONUS);
4330
4331                 /* Success */
4332                 return (TRUE);
4333         }
4334
4335         /* Nothing to gain */
4336         return (FALSE);
4337 }
4338
4339
4340
4341 /*
4342  * Decreases a stat by an amount indended to vary from 0 to 100 percent.
4343  *
4344  * Amount could be a little higher in extreme cases to mangle very high
4345  * stats from massive assaults.  -CWS
4346  *
4347  * Note that "permanent" means that the *given* amount is permanent,
4348  * not that the new value becomes permanent.  This may not work exactly
4349  * as expected, due to "weirdness" in the algorithm, but in general,
4350  * if your stat is already drained, the "max" value will not drop all
4351  * the way down to the "cur" value.
4352  */
4353 bool dec_stat(int stat, int amount, int permanent)
4354 {
4355         int cur, max, loss, same, res = FALSE;
4356
4357
4358         /* Acquire current value */
4359         cur = p_ptr->stat_cur[stat];
4360         max = p_ptr->stat_max[stat];
4361
4362         /* Note when the values are identical */
4363         same = (cur == max);
4364
4365         /* Damage "current" value */
4366         if (cur > 3)
4367         {
4368                 /* Handle "low" values */
4369                 if (cur <= 18)
4370                 {
4371                         if (amount > 90) cur--;
4372                         if (amount > 50) cur--;
4373                         if (amount > 20) cur--;
4374                         cur--;
4375                 }
4376
4377                 /* Handle "high" values */
4378                 else
4379                 {
4380                         /* Hack -- Decrement by a random amount between one-quarter */
4381                         /* and one-half of the stat bonus times the percentage, with a */
4382                         /* minimum damage of half the percentage. -CWS */
4383                         loss = (((cur-18) / 2 + 1) / 2 + 1);
4384
4385                         /* Paranoia */
4386                         if (loss < 1) loss = 1;
4387
4388                         /* Randomize the loss */
4389                         loss = ((randint1(loss) + loss) * amount) / 100;
4390
4391                         /* Maximal loss */
4392                         if (loss < amount/2) loss = amount/2;
4393
4394                         /* Lose some points */
4395                         cur = cur - loss;
4396
4397                         /* Hack -- Only reduce stat to 17 sometimes */
4398                         if (cur < 18) cur = (amount <= 20) ? 18 : 17;
4399                 }
4400
4401                 /* Prevent illegal values */
4402                 if (cur < 3) cur = 3;
4403
4404                 /* Something happened */
4405                 if (cur != p_ptr->stat_cur[stat]) res = TRUE;
4406         }
4407
4408         /* Damage "max" value */
4409         if (permanent && (max > 3))
4410         {
4411                 chg_virtue(V_SACRIFICE, 1);
4412                 if (stat == A_WIS || stat == A_INT)
4413                         chg_virtue(V_ENLIGHTEN, -2);
4414
4415                 /* Handle "low" values */
4416                 if (max <= 18)
4417                 {
4418                         if (amount > 90) max--;
4419                         if (amount > 50) max--;
4420                         if (amount > 20) max--;
4421                         max--;
4422                 }
4423
4424                 /* Handle "high" values */
4425                 else
4426                 {
4427                         /* Hack -- Decrement by a random amount between one-quarter */
4428                         /* and one-half of the stat bonus times the percentage, with a */
4429                         /* minimum damage of half the percentage. -CWS */
4430                         loss = (((max-18) / 2 + 1) / 2 + 1);
4431                         loss = ((randint1(loss) + loss) * amount) / 100;
4432                         if (loss < amount/2) loss = amount/2;
4433
4434                         /* Lose some points */
4435                         max = max - loss;
4436
4437                         /* Hack -- Only reduce stat to 17 sometimes */
4438                         if (max < 18) max = (amount <= 20) ? 18 : 17;
4439                 }
4440
4441                 /* Hack -- keep it clean */
4442                 if (same || (max < cur)) max = cur;
4443
4444                 /* Something happened */
4445                 if (max != p_ptr->stat_max[stat]) res = TRUE;
4446         }
4447
4448         /* Apply changes */
4449         if (res)
4450         {
4451                 /* Actually set the stat to its new value. */
4452                 p_ptr->stat_cur[stat] = cur;
4453                 p_ptr->stat_max[stat] = max;
4454
4455                 /* Redisplay the stats later */
4456                 p_ptr->redraw |= (PR_STATS);
4457
4458                 /* Recalculate bonuses */
4459                 p_ptr->update |= (PU_BONUS);
4460         }
4461
4462         /* Done */
4463         return (res);
4464 }
4465
4466
4467 /*
4468  * Restore a stat.  Return TRUE only if this actually makes a difference.
4469  */
4470 bool res_stat(int stat)
4471 {
4472         /* Restore if needed */
4473         if (p_ptr->stat_cur[stat] != p_ptr->stat_max[stat])
4474         {
4475                 /* Restore */
4476                 p_ptr->stat_cur[stat] = p_ptr->stat_max[stat];
4477
4478                 /* Recalculate bonuses */
4479                 p_ptr->update |= (PU_BONUS);
4480
4481                 /* Redisplay the stats later */
4482                 p_ptr->redraw |= (PR_STATS);
4483
4484                 /* Success */
4485                 return (TRUE);
4486         }
4487
4488         /* Nothing to restore */
4489         return (FALSE);
4490 }
4491
4492
4493 /*
4494  * Increase players hit points, notice effects
4495  */
4496 bool hp_player(int num)
4497 {
4498         int vir;
4499         vir = virtue_number(V_VITALITY);
4500         if (vir)
4501         {
4502                 num = num * (p_ptr->virtues[vir - 1] + 1250) / 1250;
4503         }
4504         /* Healing needed */
4505         if (p_ptr->chp < p_ptr->mhp)
4506         {
4507                 if ((num > 0) && (p_ptr->chp < (p_ptr->mhp/3)))
4508                         chg_virtue(V_TEMPERANCE, 1);
4509                 /* Gain hitpoints */
4510                 p_ptr->chp += num;
4511
4512                 /* Enforce maximum */
4513                 if (p_ptr->chp >= p_ptr->mhp)
4514                 {
4515                         p_ptr->chp = p_ptr->mhp;
4516                         p_ptr->chp_frac = 0;
4517                 }
4518
4519                 /* Redraw */
4520                 p_ptr->redraw |= (PR_HP);
4521
4522                 /* Window stuff */
4523                 p_ptr->window |= (PW_PLAYER);
4524
4525                 /* Heal 0-4 */
4526                 if (num < 5)
4527                 {
4528 #ifdef JP
4529 msg_print("¾¯¤·µ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4530 #else
4531                         msg_print("You feel a little better.");
4532 #endif
4533
4534                 }
4535
4536                 /* Heal 5-14 */
4537                 else if (num < 15)
4538                 {
4539 #ifdef JP
4540 msg_print("µ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4541 #else
4542                         msg_print("You feel better.");
4543 #endif
4544
4545                 }
4546
4547                 /* Heal 15-34 */
4548                 else if (num < 35)
4549                 {
4550 #ifdef JP
4551 msg_print("¤È¤Æ¤âµ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4552 #else
4553                         msg_print("You feel much better.");
4554 #endif
4555
4556                 }
4557
4558                 /* Heal 35+ */
4559                 else
4560                 {
4561 #ifdef JP
4562 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬Îɤ¯¤Ê¤Ã¤¿¡£");
4563 #else
4564                         msg_print("You feel very good.");
4565 #endif
4566
4567                 }
4568
4569                 /* Notice */
4570                 return (TRUE);
4571         }
4572
4573         /* Ignore */
4574         return (FALSE);
4575 }
4576
4577
4578 /*
4579  * Array of stat "descriptions"
4580  */
4581 static cptr desc_stat_pos[] =
4582 {
4583 #ifdef JP
4584 "¶¯¤¯",
4585 #else
4586         "strong",
4587 #endif
4588
4589 #ifdef JP
4590 "ÃÎŪ¤Ë",
4591 #else
4592         "smart",
4593 #endif
4594
4595 #ifdef JP
4596 "¸­¤¯",
4597 #else
4598         "wise",
4599 #endif
4600
4601 #ifdef JP
4602 "´ïÍѤË",
4603 #else
4604         "dextrous",
4605 #endif
4606
4607 #ifdef JP
4608 "·ò¹¯¤Ë",
4609 #else
4610         "healthy",
4611 #endif
4612
4613 #ifdef JP
4614 "Èþ¤·¤¯"
4615 #else
4616         "cute"
4617 #endif
4618
4619 };
4620
4621
4622 /*
4623  * Array of stat "descriptions"
4624  */
4625 static cptr desc_stat_neg[] =
4626 {
4627 #ifdef JP
4628 "¼å¤¯",
4629 "̵ÃΤË",
4630 "¶ò¤«¤Ë",
4631 "ÉÔ´ïÍѤË",
4632 "ÉÔ·ò¹¯¤Ë",
4633 "½¹¤¯"
4634 #else
4635         "weak",
4636         "stupid",
4637         "naive",
4638         "clumsy",
4639         "sickly",
4640         "ugly"
4641 #endif
4642
4643 };
4644
4645
4646 /*
4647  * Lose a "point"
4648  */
4649 bool do_dec_stat(int stat)
4650 {
4651         bool sust = FALSE;
4652
4653         /* Access the "sustain" */
4654         switch (stat)
4655         {
4656                 case A_STR: if (p_ptr->sustain_str) sust = TRUE; break;
4657                 case A_INT: if (p_ptr->sustain_int) sust = TRUE; break;
4658                 case A_WIS: if (p_ptr->sustain_wis) sust = TRUE; break;
4659                 case A_DEX: if (p_ptr->sustain_dex) sust = TRUE; break;
4660                 case A_CON: if (p_ptr->sustain_con) sust = TRUE; break;
4661                 case A_CHR: if (p_ptr->sustain_chr) sust = TRUE; break;
4662         }
4663
4664         /* Sustain */
4665         if (sust && (!ironman_nightmare || randint0(13)))
4666         {
4667                 /* Message */
4668 #ifdef JP
4669 msg_format("%s¤Ê¤Ã¤¿µ¤¤¬¤·¤¿¤¬¡¢¤¹¤°¤Ë¸µ¤ËÌá¤Ã¤¿¡£",
4670 #else
4671                 msg_format("You feel %s for a moment, but the feeling passes.",
4672 #endif
4673
4674                                 desc_stat_neg[stat]);
4675
4676                 /* Notice effect */
4677                 return (TRUE);
4678         }
4679
4680         /* Attempt to reduce the stat */
4681         if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
4682         {
4683                 /* Message */
4684 #ifdef JP
4685 msg_format("¤Ò¤É¤¯%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_neg[stat]);
4686 #else
4687                 msg_format("You feel very %s.", desc_stat_neg[stat]);
4688 #endif
4689
4690
4691                 /* Notice effect */
4692                 return (TRUE);
4693         }
4694
4695         /* Nothing obvious */
4696         return (FALSE);
4697 }
4698
4699
4700 /*
4701  * Restore lost "points" in a stat
4702  */
4703 bool do_res_stat(int stat)
4704 {
4705         /* Attempt to increase */
4706         if (res_stat(stat))
4707         {
4708                 /* Message */
4709 #ifdef JP
4710 msg_format("¸µÄ̤ê¤Ë%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_pos[stat]);
4711 #else
4712                 msg_format("You feel less %s.", desc_stat_neg[stat]);
4713 #endif
4714
4715
4716                 /* Notice */
4717                 return (TRUE);
4718         }
4719
4720         /* Nothing obvious */
4721         return (FALSE);
4722 }
4723
4724
4725 /*
4726  * Gain a "point" in a stat
4727  */
4728 bool do_inc_stat(int stat)
4729 {
4730         bool res;
4731
4732         /* Restore strength */
4733         res = res_stat(stat);
4734
4735         /* Attempt to increase */
4736         if (inc_stat(stat))
4737         {
4738                 if (stat == A_WIS)
4739                 {
4740                         chg_virtue(V_ENLIGHTEN, 1);
4741                         chg_virtue(V_FAITH, 1);
4742                 }
4743                 else if (stat == A_INT)
4744                 {
4745                         chg_virtue(V_KNOWLEDGE, 1);
4746                         chg_virtue(V_ENLIGHTEN, 1);
4747                 }
4748                 else if (stat == A_CON)
4749                         chg_virtue(V_VITALITY, 1);
4750
4751                 /* Message */
4752 #ifdef JP
4753 msg_format("¥ï¡¼¥ª¡ª¤È¤Æ¤â%s¤Ê¤Ã¤¿¡ª", desc_stat_pos[stat]);
4754 #else
4755                 msg_format("Wow!  You feel very %s!", desc_stat_pos[stat]);
4756 #endif
4757
4758
4759                 /* Notice */
4760                 return (TRUE);
4761         }
4762
4763         /* Restoration worked */
4764         if (res)
4765         {
4766                 /* Message */
4767 #ifdef JP
4768 msg_format("¸µÄ̤ê¤Ë%s¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", desc_stat_pos[stat]);
4769 #else
4770                 msg_format("You feel less %s.", desc_stat_neg[stat]);
4771 #endif
4772
4773
4774                 /* Notice */
4775                 return (TRUE);
4776         }
4777
4778         /* Nothing obvious */
4779         return (FALSE);
4780 }
4781
4782
4783 /*
4784  * Restores any drained experience
4785  */
4786 bool restore_level(void)
4787 {
4788         /* Restore experience */
4789         if (p_ptr->exp < p_ptr->max_exp)
4790         {
4791                 /* Message */
4792 #ifdef JP
4793 msg_print("À¸Ì¿ÎϤ¬Ìá¤Ã¤Æ¤­¤¿µ¤¤¬¤¹¤ë¡£");
4794 #else
4795                 msg_print("You feel your life energies returning.");
4796 #endif
4797
4798
4799                 /* Restore the experience */
4800                 p_ptr->exp = p_ptr->max_exp;
4801
4802                 /* Check the experience */
4803                 check_experience();
4804
4805                 /* Did something */
4806                 return (TRUE);
4807         }
4808
4809         /* No effect */
4810         return (FALSE);
4811 }
4812
4813
4814 /*
4815  * Forget everything
4816  */
4817 bool lose_all_info(void)
4818 {
4819         int i;
4820
4821         chg_virtue(V_KNOWLEDGE, -5);
4822         chg_virtue(V_ENLIGHTEN, -5);
4823
4824         /* Forget info about objects */
4825         for (i = 0; i < INVEN_TOTAL; i++)
4826         {
4827                 object_type *o_ptr = &inventory[i];
4828
4829                 /* Skip non-objects */
4830                 if (!o_ptr->k_idx) continue;
4831
4832                 /* Allow "protection" by the MENTAL flag */
4833                 if (o_ptr->ident & (IDENT_MENTAL)) continue;
4834
4835                 /* Remove "default inscriptions" */
4836                 o_ptr->feeling = FEEL_NONE;
4837
4838                 /* Hack -- Clear the "empty" flag */
4839                 o_ptr->ident &= ~(IDENT_EMPTY);
4840
4841                 /* Hack -- Clear the "known" flag */
4842                 o_ptr->ident &= ~(IDENT_KNOWN);
4843
4844                 /* Hack -- Clear the "felt" flag */
4845                 o_ptr->ident &= ~(IDENT_SENSE);
4846         }
4847
4848         /* Recalculate bonuses */
4849         p_ptr->update |= (PU_BONUS);
4850
4851         /* Combine / Reorder the pack (later) */
4852         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4853
4854         /* Window stuff */
4855         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4856
4857         /* Mega-Hack -- Forget the map */
4858         wiz_dark();
4859
4860         /* It worked */
4861         return (TRUE);
4862 }
4863
4864
4865 void do_poly_wounds(void)
4866 {
4867         /* Changed to always provide at least _some_ healing */
4868         s16b wounds = p_ptr->cut;
4869         s16b hit_p = (p_ptr->mhp - p_ptr->chp);
4870         s16b change = damroll(p_ptr->lev, 5);
4871         bool Nasty_effect = one_in_(5);
4872
4873         if (!(wounds || hit_p || Nasty_effect)) return;
4874
4875 #ifdef JP
4876 msg_print("½ý¤¬¤è¤ê·Ú¤¤¤â¤Î¤ËÊѲ½¤·¤¿¡£");
4877 #else
4878         msg_print("Your wounds are polymorphed into less serious ones.");
4879 #endif
4880
4881         hp_player(change);
4882         if (Nasty_effect)
4883         {
4884 #ifdef JP
4885 msg_print("¿·¤¿¤Ê½ý¤¬¤Ç¤­¤¿¡ª");
4886 take_hit(DAMAGE_LOSELIFE, change / 2, "ÊѲ½¤·¤¿½ý", -1);
4887 #else
4888                 msg_print("A new wound was created!");
4889                 take_hit(DAMAGE_LOSELIFE, change / 2, "a polymorphed wound", -1);
4890 #endif
4891
4892                 set_cut(change);
4893         }
4894         else
4895         {
4896                 set_cut(p_ptr->cut - (change / 2));
4897         }
4898 }
4899
4900
4901 /*
4902  * Change player race
4903  */
4904 void change_race(int new_race, cptr effect_msg)
4905 {
4906         cptr title = race_info[new_race].title;
4907         int  old_race = p_ptr->prace;
4908
4909 #ifdef JP
4910         msg_format("¤¢¤Ê¤¿¤Ï%s%s¤ËÊѲ½¤·¤¿¡ª", effect_msg, title);
4911 #else
4912         msg_format("You turn into %s %s%s!", (!effect_msg[0] && is_a_vowel(title[0]) ? "an" : "a"), effect_msg, title);
4913 #endif
4914
4915         chg_virtue(V_CHANCE, 2);
4916
4917         if (p_ptr->prace < 32)
4918         {
4919                 p_ptr->old_race1 |= 1L << p_ptr->prace;
4920         }
4921         else
4922         {
4923                 p_ptr->old_race2 |= 1L << (p_ptr->prace-32);
4924         }
4925         p_ptr->prace = new_race;
4926         rp_ptr = &race_info[p_ptr->prace];
4927
4928         /* Experience factor */
4929         p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
4930
4931         /*
4932          * The speed bonus of Klackons and Sprites are disabled
4933          * and the experience penalty is decreased.
4934          */
4935         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)))
4936                 p_ptr->expfact -= 15;
4937
4938         /* Get character's height and weight */
4939         get_height_weight();
4940
4941         /* Hitdice */
4942         if (p_ptr->pclass == CLASS_SORCERER)
4943                 p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
4944         else
4945                 p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
4946
4947         do_cmd_rerate(FALSE);
4948
4949         /* The experience level may be modified */
4950         check_experience();
4951
4952         p_ptr->redraw |= (PR_BASIC);
4953
4954         p_ptr->update |= (PU_BONUS);
4955
4956         handle_stuff();
4957
4958         /* Load an autopick preference file */
4959         if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
4960
4961         /* Player's graphic tile may change */
4962         lite_spot(py, px);
4963 }
4964
4965
4966 void do_poly_self(void)
4967 {
4968         int power = p_ptr->lev;
4969
4970 #ifdef JP
4971 msg_print("¤¢¤Ê¤¿¤ÏÊѲ½¤Îˬ¤ì¤ò´¶¤¸¤¿...");
4972 #else
4973         msg_print("You feel a change coming over you...");
4974 #endif
4975
4976         chg_virtue(V_CHANCE, 1);
4977
4978         if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
4979         {
4980                 char effect_msg[80] = "";
4981                 int new_race;
4982
4983                 /* Some form of racial polymorph... */
4984                 power -= 10;
4985
4986                 if ((power > randint0(5)) && one_in_(4))
4987                 {
4988                         /* sex change */
4989                         power -= 2;
4990
4991                         if (p_ptr->psex == SEX_MALE)
4992                         {
4993                                 p_ptr->psex = SEX_FEMALE;
4994                                 sp_ptr = &sex_info[p_ptr->psex];
4995 #ifdef JP
4996 sprintf(effect_msg, "½÷À­¤Î");
4997 #else
4998                                 sprintf(effect_msg, "female ");
4999 #endif
5000
5001                         }
5002                         else
5003                         {
5004                                 p_ptr->psex = SEX_MALE;
5005                                 sp_ptr = &sex_info[p_ptr->psex];
5006 #ifdef JP
5007 sprintf(effect_msg, "ÃËÀ­¤Î");
5008 #else
5009                                 sprintf(effect_msg, "male ");
5010 #endif
5011
5012                         }
5013                 }
5014
5015                 if ((power > randint0(30)) && one_in_(5))
5016                 {
5017                         int tmp = 0;
5018
5019                         /* Harmful deformity */
5020                         power -= 15;
5021
5022                         while (tmp < 6)
5023                         {
5024                                 if (one_in_(2))
5025                                 {
5026                                         (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
5027                                         power -= 1;
5028                                 }
5029                                 tmp++;
5030                         }
5031
5032                         /* Deformities are discriminated against! */
5033                         (void)dec_stat(A_CHR, randint1(6), TRUE);
5034
5035                         if (effect_msg[0])
5036                         {
5037                                 char tmp_msg[10];
5038 #ifdef JP
5039                                 sprintf(tmp_msg,"%s",effect_msg);
5040                                 sprintf(effect_msg,"´ñ·Á¤Î%s",tmp_msg);
5041 #else
5042                                 sprintf(tmp_msg,"%s ",effect_msg);
5043                                 sprintf(effect_msg,"deformed %s ",tmp_msg);
5044 #endif
5045
5046                         }
5047                         else
5048                         {
5049 #ifdef JP
5050                                 sprintf(effect_msg,"´ñ·Á¤Î");
5051 #else
5052                                 sprintf(effect_msg,"deformed ");
5053 #endif
5054
5055                         }
5056                 }
5057
5058                 while ((power > randint0(20)) && one_in_(10))
5059                 {
5060                         /* Polymorph into a less mutated form */
5061                         power -= 10;
5062
5063                         if (!lose_mutation(0))
5064 #ifdef JP
5065 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
5066 #else
5067                                 msg_print("You feel oddly normal.");
5068 #endif
5069
5070                 }
5071
5072                 do
5073                 {
5074                         new_race = randint0(MAX_RACES);
5075                 }
5076                 while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
5077
5078                 change_race(new_race, effect_msg);
5079         }
5080
5081         if ((power > randint0(30)) && one_in_(6))
5082         {
5083                 int tmp = 0;
5084
5085                 /* Abomination! */
5086                 power -= 20;
5087
5088 #ifdef JP
5089 msg_format("%s¤Î¹½À®¤¬ÊѲ½¤·¤¿¡ª", p_ptr->prace == RACE_ANDROID ? "µ¡³£" : "Æâ¡");
5090 #else
5091                 msg_print("Your internal organs are rearranged!");
5092 #endif
5093
5094                 while (tmp < 6)
5095                 {
5096                         (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
5097                         tmp++;
5098                 }
5099                 if (one_in_(6))
5100                 {
5101 #ifdef JP
5102                         msg_print("¸½ºß¤Î»Ñ¤ÇÀ¸¤­¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
5103                         take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
5104 #else
5105                         msg_print("You find living difficult in your present form!");
5106                         take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "a lethal mutation", -1);
5107 #endif
5108
5109                         power -= 10;
5110                 }
5111         }
5112
5113         if ((power > randint0(20)) && one_in_(4))
5114         {
5115                 power -= 10;
5116
5117                 get_max_stats();
5118                 do_cmd_rerate(FALSE);
5119         }
5120
5121         while ((power > randint0(15)) && one_in_(3))
5122         {
5123                 power -= 7;
5124                 (void)gain_random_mutation(0);
5125         }
5126
5127         if (power > randint0(5))
5128         {
5129                 power -= 5;
5130                 do_poly_wounds();
5131         }
5132
5133         /* Note: earlier deductions may have left power < 0 already. */
5134         while (power > 0)
5135         {
5136                 mutate_player();
5137                 power--;
5138         }
5139 }
5140
5141
5142 /*
5143  * Decreases players hit points and sets death flag if necessary
5144  *
5145  * XXX XXX XXX Invulnerability needs to be changed into a "shield"
5146  *
5147  * XXX XXX XXX Hack -- this function allows the user to save (or quit)
5148  * the game when he dies, since the "You die." message is shown before
5149  * setting the player to "dead".
5150  */
5151
5152 int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
5153 {
5154         int old_chp = p_ptr->chp;
5155
5156         char death_message[1024];
5157         char tmp[80];
5158
5159         int warning = (p_ptr->mhp * hitpoint_warn / 10);
5160
5161         /* Paranoia */
5162         if (p_ptr->is_dead) return 0;
5163
5164         if (p_ptr->sutemi) damage *= 2;
5165         if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5;
5166
5167         if (easy_band) damage = (damage+1)/2;
5168
5169         if (damage_type != DAMAGE_USELIFE)
5170         {
5171                 /* Disturb */
5172                 disturb(1, 1);
5173                 if (auto_more)
5174                 {
5175                         now_damaged = TRUE;
5176                 }
5177         }
5178
5179         if (monspell >= 0) learn_spell(monspell);
5180
5181         /* Mega-Hack -- Apply "invulnerability" */
5182         if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
5183         {
5184                 if (IS_INVULN() && (damage < 9000))
5185                 {
5186                         if (damage_type == DAMAGE_FORCE)
5187                         {
5188 #ifdef JP
5189                                 msg_print("¥Ð¥ê¥¢¤¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5190 #else
5191                                 msg_print("The attack cuts your shield of invulnerability open!");
5192 #endif
5193                         }
5194                         else if (one_in_(PENETRATE_INVULNERABILITY))
5195                         {
5196 #ifdef JP
5197                                 msg_print("̵Ũ¤Î¥Ð¥ê¥¢¤òÇˤäƹ¶·â¤µ¤ì¤¿¡ª");
5198 #else
5199                                 msg_print("The attack penetrates your shield of invulnerability!");
5200 #endif
5201                         }
5202                         else
5203                         {
5204                                 return 0;
5205                         }
5206                 }
5207
5208                 if (CHECK_MULTISHADOW())
5209                 {
5210                         if (damage_type == DAMAGE_FORCE)
5211                         {
5212 #ifdef JP
5213                                 msg_print("¸¸±Æ¤â¤í¤È¤âÂΤ¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5214 #else
5215                                 msg_print("The attack hits Shadow together with you!");
5216 #endif
5217                         }
5218                         else if (damage_type == DAMAGE_ATTACK)
5219                         {
5220 #ifdef JP
5221                                 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
5222 #else
5223                                 msg_print("The attack hits Shadow, you are unharmed!");
5224 #endif
5225                                 return 0;
5226                         }
5227                 }
5228
5229                 if (p_ptr->wraith_form)
5230                 {
5231                         if (damage_type == DAMAGE_FORCE)
5232                         {
5233 #ifdef JP
5234                                 msg_print("Ⱦʪ¼Á¤ÎÂΤ¬ÀÚ¤êÎö¤«¤ì¤¿¡ª");
5235 #else
5236                                 msg_print("The attack cuts through your ethereal body!");
5237 #endif
5238                         }
5239                         else
5240                         {
5241                                 damage /= 2;
5242                                 if ((damage == 0) && one_in_(2)) damage = 1;
5243                         }
5244                 }
5245
5246                 if (p_ptr->special_defense & KATA_MUSOU)
5247                 {
5248                         damage /= 2;
5249                         if ((damage == 0) && one_in_(2)) damage = 1;
5250                 }
5251         } /* not if LOSELIFE USELIFE */
5252
5253         /* Hurt the player */
5254         p_ptr->chp -= damage;
5255         if(damage_type == DAMAGE_GENO && p_ptr->chp < 0)
5256         {
5257                 damage += p_ptr->chp;
5258                 p_ptr->chp = 0;
5259         }
5260
5261         /* Display the hitpoints */
5262         p_ptr->redraw |= (PR_HP);
5263
5264         /* Window stuff */
5265         p_ptr->window |= (PW_PLAYER);
5266
5267         if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
5268         {
5269                 chg_virtue(V_SACRIFICE, 1);
5270                 chg_virtue(V_CHANCE, 2);
5271         }
5272
5273         /* Dead player */
5274         if (p_ptr->chp < 0)
5275         {
5276                 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
5277
5278 #ifdef JP       /* »à¤ó¤À»þ¤Ë¶¯À©½ªÎ»¤·¤Æ»à¤ò²óÈò¤Ç¤­¤Ê¤¯¤·¤Æ¤ß¤¿ by Habu */
5279                 if (!cheat_save)
5280                         if(!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
5281 #endif
5282
5283                 /* Sound */
5284                 sound(SOUND_DEATH);
5285
5286                 chg_virtue(V_SACRIFICE, 10);
5287
5288                 handle_stuff();
5289
5290                 /* Leaving */
5291                 p_ptr->leaving = TRUE;
5292
5293                 /* Note death */
5294                 p_ptr->is_dead = TRUE;
5295
5296                 if (p_ptr->inside_arena)
5297                 {
5298                         cptr m_name = r_name+r_info[arena_info[p_ptr->arena_number].r_idx].name;
5299 #ifdef JP
5300                         msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£", m_name);
5301 #else
5302                         msg_format("You are beaten by %s.", m_name);
5303 #endif
5304                         msg_print(NULL);
5305                         if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, -1 - p_ptr->arena_number, m_name);
5306                 }
5307                 else
5308                 {
5309                         int q_idx = quest_number(dun_level);
5310                         bool seppuku = streq(hit_from, "Seppuku");
5311                         bool winning_seppuku = p_ptr->total_winner && seppuku;
5312
5313 #ifdef WORLD_SCORE
5314                         /* Make screen dump */
5315                         screen_dump = make_screen_dump();
5316 #endif
5317
5318                         /* Note cause of death */
5319                         if (seppuku)
5320                         {
5321                                 strcpy(p_ptr->died_from, hit_from);
5322 #ifdef JP
5323                                 if (!winning_seppuku) strcpy(p_ptr->died_from, "ÀÚÊ¢");
5324 #endif
5325                         }
5326                         else
5327                         {
5328                                 char dummy[1024];
5329 #ifdef JP
5330                                 sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç" : "Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from);
5331 #else
5332                                 sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
5333 #endif
5334                                 my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
5335                         }
5336
5337                         /* No longer a winner */
5338                         p_ptr->total_winner = FALSE;
5339
5340                         if (winning_seppuku)
5341                         {
5342 #ifdef JP
5343                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¾¡Íø¤Î¸åÀÚÊ¢¤·¤¿¡£");
5344 #else
5345                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "did Seppuku after the winning.");
5346 #endif
5347                         }
5348                         else
5349                         {
5350                                 char buf[20];
5351
5352                                 if (p_ptr->inside_arena)
5353 #ifdef JP
5354                                         strcpy(buf,"¥¢¥ê¡¼¥Ê");
5355 #else
5356                                         strcpy(buf,"in the Arena");
5357 #endif
5358                                 else if (!dun_level)
5359 #ifdef JP
5360                                         strcpy(buf,"ÃϾå");
5361 #else
5362                                         strcpy(buf,"on the surface");
5363 #endif
5364                                 else if (q_idx && (is_fixed_quest_idx(q_idx) &&
5365                                          !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
5366 #ifdef JP
5367                                         strcpy(buf,"¥¯¥¨¥¹¥È");
5368 #else
5369                                         strcpy(buf,"in a quest");
5370 #endif
5371                                 else
5372 #ifdef JP
5373                                         sprintf(buf,"%d³¬", dun_level);
5374 #else
5375                                         sprintf(buf,"level %d", dun_level);
5376 #endif
5377
5378 #ifdef JP
5379                                 sprintf(tmp, "%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", buf, p_ptr->died_from);
5380 #else
5381                                 sprintf(tmp, "killed by %s %s.", p_ptr->died_from, buf);
5382 #endif
5383                                 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
5384                         }
5385
5386 #ifdef JP
5387                         do_cmd_write_nikki(NIKKI_GAMESTART, 1, "-------- ¥²¡¼¥à¥ª¡¼¥Ð¡¼ --------");
5388 #else
5389                         do_cmd_write_nikki(NIKKI_GAMESTART, 1, "--------   Game  Over   --------");
5390 #endif
5391                         do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
5392
5393                         flush();
5394
5395 #ifdef JP
5396                         if (get_check_strict("²èÌ̤òÊݸ¤·¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
5397 #else
5398                         if (get_check_strict("Dump the screen? ", CHECK_NO_HISTORY))
5399 #endif
5400                         {
5401                                 do_cmd_save_screen();
5402                         }
5403
5404                         flush();
5405
5406                         /* Initialize "last message" buffer */
5407                         if (p_ptr->last_message) string_free(p_ptr->last_message);
5408                         p_ptr->last_message = NULL;
5409
5410                         /* Hack -- Note death */
5411                         if (!last_words)
5412                         {
5413 #ifdef JP
5414                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Þ¤·¤¿¡£", android ? "²õ¤ì" : "»à¤Ë");
5415 #else
5416                                 msg_print(android ? "You are broken." : "You die.");
5417 #endif
5418
5419                                 msg_print(NULL);
5420                         }
5421                         else
5422                         {
5423                                 if (winning_seppuku)
5424                                 {
5425 #ifdef JP
5426                                         get_rnd_line("seppuku_j.txt", 0, death_message);
5427 #else
5428                                         get_rnd_line("seppuku.txt", 0, death_message);
5429 #endif
5430                                 }
5431                                 else
5432                                 {
5433 #ifdef JP
5434                                         get_rnd_line("death_j.txt", 0, death_message);
5435 #else
5436                                         get_rnd_line("death.txt", 0, death_message);
5437 #endif
5438                                 }
5439
5440                                 do
5441                                 {
5442 #ifdef JP
5443                                         while (!get_string(winning_seppuku ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ;
5444 #else
5445                                         while (!get_string("Last word: ", death_message, 1024)) ;
5446 #endif
5447                                 }
5448 #ifdef JP
5449                                 while (winning_seppuku && !get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_NO_HISTORY));
5450 #else
5451                                 while (winning_seppuku && !get_check_strict("Are you sure? ", CHECK_NO_HISTORY));
5452 #endif
5453
5454                                 if (death_message[0] == '\0')
5455                                 {
5456 #ifdef JP
5457                                         strcpy(death_message, format("¤¢¤Ê¤¿¤Ï%s¤Þ¤·¤¿¡£", android ? "²õ¤ì" : "»à¤Ë"));
5458 #else
5459                                         strcpy(death_message, android ? "You are broken." : "You die.");
5460 #endif
5461                                 }
5462                                 else p_ptr->last_message = string_make(death_message);
5463
5464 #ifdef JP
5465                                 if (winning_seppuku)
5466                                 {
5467                                         int i, len;
5468                                         int w = Term->wid;
5469                                         int h = Term->hgt;
5470                                         int msg_pos_x[9] = {  5,  7,  9, 12,  14,  17,  19,  21, 23};
5471                                         int msg_pos_y[9] = {  3,  4,  5,  4,   5,   4,   5,   6,  4};
5472                                         cptr str;
5473                                         char* str2;
5474
5475                                         Term_clear();
5476
5477                                         /* ºù»¶¤ë */
5478                                         for (i = 0; i < 40; i++)
5479                                                 Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "¦Ô");
5480
5481                                         str = death_message;
5482                                         if (strncmp(str, "¡Ö", 2) == 0) str += 2;
5483
5484                                         str2 = my_strstr(str, "¡×");
5485                                         if (str2 != NULL) *str2 = '\0';
5486
5487                                         i = 0;
5488                                         while (i < 9)
5489                                         {
5490                                                 str2 = my_strstr(str, " ");
5491                                                 if (str2 == NULL) len = strlen(str);
5492                                                 else len = str2 - str;
5493
5494                                                 if (len != 0)
5495                                                 {
5496                                                         Term_putstr_v(w * 3 / 4 - 2 - msg_pos_x[i] * 2, msg_pos_y[i], len,
5497                                                         TERM_WHITE, str);
5498                                                         if (str2 == NULL) break;
5499                                                         i++;
5500                                                 }
5501                                                 str = str2 + 1;
5502                                                 if (*str == 0) break;
5503                                         }
5504
5505                                         /* Hide cursor */
5506                                         Term_putstr(w-1, h-1, 1, TERM_WHITE, " ");
5507
5508                                         flush();
5509 #ifdef WORLD_SCORE
5510                                         /* Make screen dump */
5511                                         screen_dump = make_screen_dump();
5512 #endif
5513
5514                                         /* Wait a key press */
5515                                         (void)inkey();
5516                                 }
5517                                 else
5518 #endif
5519                                         msg_print(death_message);
5520                         }
5521                 }
5522
5523                 /* Dead */
5524                 return damage;
5525         }
5526
5527         handle_stuff();
5528
5529         /* Hitpoint warning */
5530         if (p_ptr->chp < warning)
5531         {
5532                 /* Hack -- bell on first notice */
5533                 if (old_chp > warning) bell();
5534
5535                 sound(SOUND_WARN);
5536
5537                 if (record_danger && (old_chp > warning))
5538                 {
5539                         if (p_ptr->image && damage_type == DAMAGE_ATTACK)
5540 #ifdef JP
5541                                 hit_from = "²¿¤«";
5542 #else
5543                                 hit_from = "something";
5544 #endif
5545
5546 #ifdef JP
5547                         sprintf(tmp,"%s¤Ë¤è¤Ã¤Æ¥Ô¥ó¥Á¤Ë´Ù¤Ã¤¿¡£",hit_from);
5548 #else
5549                         sprintf(tmp,"A critical situation because of %s.",hit_from);
5550 #endif
5551                         do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp);
5552                 }
5553
5554                 if (auto_more)
5555                 {
5556                         /* stop auto_more even if DAMAGE_USELIFE */
5557                         now_damaged = TRUE;
5558                 }
5559
5560                 /* Message */
5561 #ifdef JP
5562 msg_print("*** ·Ù¹ð:Äã¥Ò¥Ã¥È¡¦¥Ý¥¤¥ó¥È¡ª ***");
5563 #else
5564                 msg_print("*** LOW HITPOINT WARNING! ***");
5565 #endif
5566
5567                 msg_print(NULL);
5568                 flush();
5569         }
5570         if (p_ptr->wild_mode && !p_ptr->leaving && (p_ptr->chp < MAX(warning, p_ptr->mhp/5)))
5571         {
5572                 change_wild_mode();
5573         }
5574         return damage;
5575 }
5576
5577
5578 /*
5579  * Gain experience
5580  */
5581 void gain_exp_64(s32b amount, u32b amount_frac)
5582 {
5583         if (p_ptr->is_dead) return;
5584
5585         if (p_ptr->prace == RACE_ANDROID) return;
5586
5587         /* Gain some experience */
5588         s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
5589
5590         /* Slowly recover from experience drainage */
5591         if (p_ptr->exp < p_ptr->max_exp)
5592         {
5593                 /* Gain max experience (20%) (was 10%) */
5594                 p_ptr->max_exp += amount / 5;
5595         }
5596
5597         /* Check Experience */
5598         check_experience();
5599 }
5600
5601
5602 /*
5603  * Gain experience
5604  */
5605 void gain_exp(s32b amount)
5606 {
5607         gain_exp_64(amount, 0L);
5608 }
5609
5610
5611 void calc_android_exp(void)
5612 {
5613         int i;
5614         u32b total_exp = 0;
5615         if (p_ptr->is_dead) return;
5616
5617         if (p_ptr->prace != RACE_ANDROID) return;
5618
5619         for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5620         {
5621                 object_type *o_ptr = &inventory[i];
5622                 object_type forge;
5623                 object_type *q_ptr = &forge;
5624                 u32b value, exp;
5625                 int level = MAX(k_info[o_ptr->k_idx].level - 8, 1);
5626
5627                 if ((i == INVEN_RIGHT) || (i == INVEN_LEFT) || (i == INVEN_NECK) || (i == INVEN_LITE)) continue;
5628                 if (!o_ptr->k_idx) continue;
5629
5630                 /* Wipe the object */
5631                 object_wipe(q_ptr);
5632
5633                 object_copy(q_ptr, o_ptr);
5634                 q_ptr->discount = 0;
5635                 q_ptr->curse_flags = 0L;
5636
5637                 if (object_is_fixed_artifact(o_ptr))
5638                 {
5639                         level = (level + MAX(a_info[o_ptr->name1].level - 8, 5)) / 2;
5640                         level += MIN(20, a_info[o_ptr->name1].rarity/(a_info[o_ptr->name1].gen_flags & TRG_INSTA_ART ? 10 : 3));
5641                 }
5642                 else if (object_is_ego(o_ptr))
5643                 {
5644                         level += MAX(3, (e_info[o_ptr->name2].rating - 5)/2);
5645                 }
5646                 else if (o_ptr->art_name)
5647                 {
5648                         s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
5649                         int fake_level;
5650
5651                         if (!object_is_weapon_ammo(o_ptr))
5652                         {
5653                                 /* For armors */
5654                                 if (total_flags < 15000) fake_level = 10;
5655                                 else if (total_flags < 35000) fake_level = 25;
5656                                 else fake_level = 40;
5657                         }
5658                         else
5659                         {
5660                                 /* For weapons */
5661                                 if (total_flags < 20000) fake_level = 10;
5662                                 else if (total_flags < 45000) fake_level = 25;
5663                                 else fake_level = 40;
5664                         }
5665
5666                         level = MAX(level, (level + MAX(fake_level - 8, 5)) / 2 + 3);
5667                 }
5668
5669                 value = object_value_real(q_ptr);
5670
5671                 if (value <= 0) continue;
5672                 if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
5673                 if (value > 5000000L) value = 5000000L;
5674                 if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
5675
5676                 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr) ||
5677                     (o_ptr->tval == TV_DRAG_ARMOR) ||
5678                     ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM)) ||
5679                     ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD)) ||
5680                     ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)) ||
5681                     ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)) ||
5682                     ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
5683                 {
5684                         if (level > 65) level = 35 + (level - 65) / 5;
5685                         else if (level > 35) level = 25 + (level - 35) / 3;
5686                         else if (level > 15) level = 15 + (level - 15) / 2;
5687                         exp = MIN(100000L, value) * level * level / 2;
5688                         if (value > 100000L)
5689                                 exp += (value - 100000L) * level * level / 8;
5690                 }
5691                 else
5692                 {
5693                         exp = MIN(100000L, value) * level;
5694                         if (value > 100000L)
5695                                 exp += (value - 100000L) * level / 4;
5696                 }
5697                 if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48;
5698                 else total_exp += exp / 16;
5699                 if (i == INVEN_BODY) total_exp += exp / 32;
5700         }
5701         p_ptr->exp = p_ptr->max_exp = total_exp;
5702
5703         /* Check Experience */
5704         check_experience();
5705 }
5706
5707
5708 /*
5709  * Lose experience
5710  */
5711 void lose_exp(s32b amount)
5712 {
5713         if (p_ptr->prace == RACE_ANDROID) return;
5714
5715         /* Never drop below zero experience */
5716         if (amount > p_ptr->exp) amount = p_ptr->exp;
5717
5718         /* Lose some experience */
5719         p_ptr->exp -= amount;
5720
5721         /* Check Experience */
5722         check_experience();
5723 }
5724
5725
5726 /*
5727  * Drain experience
5728  * If resisted to draining, return FALSE
5729  */
5730 bool drain_exp(s32b drain, s32b slip, int hold_life_prob)
5731 {
5732         /* Androids and their mimics are never drained */
5733         if (p_ptr->prace == RACE_ANDROID) return FALSE;
5734
5735         if (p_ptr->hold_life && (randint0(100) < hold_life_prob))
5736         {
5737                 /* Hold experience */
5738 #ifdef JP
5739                 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª");
5740 #else
5741                 msg_print("You keep hold of your life force!");
5742 #endif
5743                 return FALSE;
5744         }
5745
5746         /* Hold experience failed */
5747         if (p_ptr->hold_life)
5748         {
5749 #ifdef JP
5750                 msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
5751 #else
5752                 msg_print("You feel your life slipping away!");
5753 #endif
5754                 lose_exp(slip);
5755         }
5756         else
5757         {
5758 #ifdef JP
5759                 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
5760 #else
5761                 msg_print("You feel your life draining away!");
5762 #endif
5763                 lose_exp(drain);
5764         }
5765
5766         return TRUE;
5767 }
5768
5769
5770 bool set_ultimate_res(int v, bool do_dec)
5771 {
5772         bool notice = FALSE;
5773
5774         /* Hack -- Force good values */
5775         v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
5776
5777         if (p_ptr->is_dead) return FALSE;
5778
5779         /* Open */
5780         if (v)
5781         {
5782                 if (p_ptr->ult_res && !do_dec)
5783                 {
5784                         if (p_ptr->ult_res > v) return FALSE;
5785                 }
5786                 else if (!p_ptr->ult_res)
5787                 {
5788 #ifdef JP
5789 msg_print("¤¢¤é¤æ¤ë¤³¤È¤ËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5790 #else
5791                         msg_print("You feel resistant!");
5792 #endif
5793
5794                         notice = TRUE;
5795                 }
5796         }
5797
5798         /* Shut */
5799         else
5800         {
5801                 if (p_ptr->ult_res)
5802                 {
5803 #ifdef JP
5804 msg_print("¤¢¤é¤æ¤ë¤³¤È¤ËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
5805 #else
5806                         msg_print("You feel less resistant");
5807 #endif
5808
5809                         notice = TRUE;
5810                 }
5811         }
5812
5813         /* Use the value */
5814         p_ptr->ult_res = v;
5815
5816         /* Redraw status bar */
5817         p_ptr->redraw |= (PR_STATUS);
5818
5819         /* Nothing to notice */
5820         if (!notice) return (FALSE);
5821
5822         /* Disturb */
5823         if (disturb_state) disturb(0, 0);
5824
5825         /* Recalculate bonuses */
5826         p_ptr->update |= (PU_BONUS);
5827
5828         /* Handle stuff */
5829         handle_stuff();
5830
5831         /* Result */
5832         return (TRUE);
5833 }
5834
5835 bool set_tim_res_nether(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->tim_res_nether && !do_dec)
5848                 {
5849                         if (p_ptr->tim_res_nether > v) return FALSE;
5850                 }
5851                 else if (!p_ptr->tim_res_nether)
5852                 {
5853 #ifdef JP
5854 msg_print("ÃϹö¤ÎÎϤËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5855 #else
5856                         msg_print("You feel nether resistant!");
5857 #endif
5858
5859                         notice = TRUE;
5860                 }
5861         }
5862
5863         /* Shut */
5864         else
5865         {
5866                 if (p_ptr->tim_res_nether)
5867                 {
5868 #ifdef JP
5869 msg_print("ÃϹö¤ÎÎϤËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
5870 #else
5871                         msg_print("You feel less nether resistant");
5872 #endif
5873
5874                         notice = TRUE;
5875                 }
5876         }
5877
5878         /* Use the value */
5879         p_ptr->tim_res_nether = 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_time(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_time && !do_dec)
5913                 {
5914                         if (p_ptr->tim_res_time > v) return FALSE;
5915                 }
5916                 else if (!p_ptr->tim_res_time)
5917                 {
5918 #ifdef JP
5919 msg_print("»þ´ÖµÕž¤ÎÎϤËÂФ·¤ÆÂÑÀ­¤¬¤Ä¤¤¤¿µ¤¤¬¤¹¤ë¡ª");
5920 #else
5921                         msg_print("You feel time resistant!");
5922 #endif
5923
5924                         notice = TRUE;
5925                 }
5926         }
5927
5928         /* Shut */
5929         else
5930         {
5931                 if (p_ptr->tim_res_time)
5932                 {
5933 #ifdef JP
5934 msg_print("»þ´ÖµÕž¤ÎÎϤËÂФ¹¤ëÂÑÀ­¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
5935 #else
5936                         msg_print("You feel less time resistant");
5937 #endif
5938
5939                         notice = TRUE;
5940                 }
5941         }
5942
5943         /* Use the value */
5944         p_ptr->tim_res_time = 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
5966 /*
5967  * Choose a warrior-mage elemental attack. -LM-
5968  */
5969 bool choose_ele_attack(void)
5970 {
5971         int num;
5972
5973         char choice;
5974
5975         if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
5976         {
5977 #ifdef JP
5978                 msg_format("Éð´ï¤ò»ý¤¿¤Ê¤¤¤ÈËâË¡·õ¤Ï»È¤¨¤Ê¤¤¡£");
5979 #else
5980                 msg_format("You cannot use temporary branding with no weapon.");
5981 #endif
5982                 return FALSE;
5983         }
5984
5985         /* Save screen */
5986         screen_save();
5987
5988         num = (p_ptr->lev - 20) / 5;
5989
5990 #ifdef JP
5991                       c_prt(TERM_RED,    "        a) ¾Æ´þ", 2, 14);
5992 #else
5993                       c_prt(TERM_RED,    "        a) Fire Brand", 2, 14);
5994 #endif
5995
5996 #ifdef JP
5997         if (num >= 2) c_prt(TERM_L_WHITE,"        b) Åà·ë", 3, 14);
5998 #else
5999         if (num >= 2) c_prt(TERM_L_WHITE,"        b) Cold Brand", 3, 14);
6000 #endif
6001         else prt("", 3, 14);
6002
6003 #ifdef JP
6004         if (num >= 3) c_prt(TERM_GREEN,  "        c) ÆÇ»¦", 4, 14);
6005 #else
6006         if (num >= 3) c_prt(TERM_GREEN,  "        c) Poison Brand", 4, 14);
6007 #endif
6008         else prt("", 4, 14);
6009
6010 #ifdef JP
6011         if (num >= 4) c_prt(TERM_L_DARK, "        d) Íϲò", 5, 14);
6012 #else
6013         if (num >= 4) c_prt(TERM_L_DARK, "        d) Acid Brand", 5, 14);
6014 #endif
6015         else prt("", 5, 14);
6016
6017 #ifdef JP
6018         if (num >= 5) c_prt(TERM_BLUE,   "        e) ÅÅ·â", 6, 14);
6019 #else
6020         if (num >= 5) c_prt(TERM_BLUE,   "        e) Elec Brand", 6, 14);
6021 #endif
6022         else prt("", 6, 14);
6023
6024         prt("", 7, 14);
6025         prt("", 8, 14);
6026         prt("", 9, 14);
6027
6028         prt("", 1, 0);
6029 #ifdef JP
6030         prt("        ¤É¤Î¸µÁǹ¶·â¤ò¤·¤Þ¤¹¤«¡©", 1, 14);
6031 #else
6032         prt("        Choose a temporary elemental brand ", 1, 14);
6033 #endif
6034
6035         choice = inkey();
6036
6037         if ((choice == 'a') || (choice == 'A')) 
6038                 set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6039         else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
6040                 set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6041         else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
6042                 set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6043         else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
6044                 set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6045         else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
6046                 set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
6047         else
6048         {
6049 #ifdef JP
6050                 msg_print("ËâË¡·õ¤ò»È¤¦¤Î¤ò¤ä¤á¤¿¡£");
6051 #else
6052                 msg_print("You cancel the temporary branding.");
6053 #endif
6054                 screen_load();
6055                 return FALSE;
6056         }
6057         /* Load screen */
6058         screen_load();
6059         return TRUE;
6060 }
6061
6062
6063 /*
6064  * Choose a elemental immune. -LM-
6065  */
6066 bool choose_ele_immune(int turn)
6067 {
6068         char choice;
6069
6070         /* Save screen */
6071         screen_save();
6072
6073 #ifdef JP
6074         c_prt(TERM_RED,    "        a) ²Ð±ê", 2, 14);
6075 #else
6076         c_prt(TERM_RED,    "        a) Immune Fire", 2, 14);
6077 #endif
6078
6079 #ifdef JP
6080         c_prt(TERM_L_WHITE,"        b) Î䵤", 3, 14);
6081 #else
6082         c_prt(TERM_L_WHITE,"        b) Immune Cold", 3, 14);
6083 #endif
6084
6085 #ifdef JP
6086         c_prt(TERM_L_DARK, "        c) »À", 4, 14);
6087 #else
6088         c_prt(TERM_L_DARK, "        c) Immune Acid", 4, 14);
6089 #endif
6090
6091 #ifdef JP
6092         c_prt(TERM_BLUE,   "        d) ÅÅ·â", 5, 14);
6093 #else
6094         c_prt(TERM_BLUE,   "        d) Immune Elec", 5, 14);
6095 #endif
6096
6097
6098         prt("", 6, 14);
6099         prt("", 7, 14);
6100         prt("", 8, 14);
6101         prt("", 9, 14);
6102
6103         prt("", 1, 0);
6104 #ifdef JP
6105         prt("        ¤É¤Î¸µÁǤÎÌȱ֤ò¤Ä¤±¤Þ¤¹¤«¡©", 1, 14);
6106 #else
6107         prt("        Choose a temporary elemental immune ", 1, 14);
6108 #endif
6109
6110         choice = inkey();
6111
6112         if ((choice == 'a') || (choice == 'A')) 
6113                 set_ele_immune(DEFENSE_FIRE, turn);
6114         else if ((choice == 'b') || (choice == 'B'))
6115                 set_ele_immune(DEFENSE_COLD, turn);
6116         else if ((choice == 'c') || (choice == 'C'))
6117                 set_ele_immune(DEFENSE_ACID, turn);
6118         else if ((choice == 'd') || (choice == 'D'))
6119                 set_ele_immune(DEFENSE_ELEC, turn);
6120         else
6121         {
6122 #ifdef JP
6123                 msg_print("Ìȱ֤òÉÕ¤±¤ë¤Î¤ò¤ä¤á¤¿¡£");
6124 #else
6125                 msg_print("You cancel the temporary immune.");
6126 #endif
6127                 screen_load();
6128                 return FALSE;
6129         }
6130         /* Load screen */
6131         screen_load();
6132         return TRUE;
6133 }