OSDN Git Service

Merge branch 'master' of github.com:/dis-/hengband
[hengband/hengband.git] / src / mspells3.c
1 /*!
2  * @file mspells3.c
3  * @brief ÀÄËâË¡¤Î½èÍý¼ÂÁõ / Blue magic
4  * @date 2014/01/15
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  * This software may be copied and distributed for educational, research,\n
8  * and not for profit purposes provided that this copyright and statement\n
9  * are included in all such copies.  Other copyrights may also apply.\n
10  * 2014 Deskull rearranged comment for Doxygen.\n
11  */
12
13 #include "angband.h"
14
15 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< ¥â¥ó¥¹¥¿¡¼ËâË¡¤ò¥×¥ì¥¤¥ä¡¼¤¬»ÈÍѤ¹¤ë¾ì¹ç¤Î´¹»»¥ì¥Ù¥ë */
16
17
18 /*!
19 * @brief Ê¸»úÎó¤ËÀÄËâƳ»Õ¤Î¼öʸ¤Î¹¶·âÎϤò²Ã¤¨¤ë
20 * @param r_idx ¥â¥ó¥¹¥¿¡¼¤Î¼ï²ID
21 * @param SPELL_NUM ¼öʸÈÖ¹æ
22 * @param msg É½¼¨¤¹¤ëʸ»úÎó
23 * @param tmp ÊÖ¤¹¥á¥Ã¥»¡¼¥¸¤ò³ÊǼ¤¹¤ëÇÛÎó
24 * @return ¤Ê¤·
25 */
26 void set_bluemage_damage(int SPELL_NUM, int plev, cptr msg, char* tmp)
27 {
28     int base_damage = monspell_bluemage_damage(SPELL_NUM, plev, BASE_DAM);
29     int dice_num = monspell_bluemage_damage(SPELL_NUM, plev, DICE_NUM);
30     int dice_side = monspell_bluemage_damage(SPELL_NUM, plev, DICE_SIDE);
31     int dice_mult = monspell_bluemage_damage(SPELL_NUM, plev, DICE_MULT);
32     int dice_div = monspell_bluemage_damage(SPELL_NUM, plev, DICE_DIV);
33     char dmg_str[80];
34     dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
35     sprintf(tmp, msg, dmg_str);
36 }
37
38 /*!
39  * @brief ¼õ¤±¼è¤Ã¤¿¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID¤Ë±þ¤¸¤ÆÀÄËâË¡¤Î¸ú²Ì¾ðÊó¤ò¤Þ¤È¤á¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤òÊÖ¤¹
40  * @param p ¾ðÊó¤òÊÖ¤¹Ê¸»úÎ󻲾ȥݥ¤¥ó¥¿
41  * @param power ¥â¥ó¥¹¥¿¡¼ËâË¡¤ÎID
42  * @return ¤Ê¤·
43  */
44 static void learned_info(char *p, int power)
45 {
46         int plev = pseudo_plev();
47         int hp = p_ptr->chp;
48
49 #ifdef JP
50         cptr s_dam = " Â»½ý:%s";
51         cptr s_dur = "´ü´Ö:";
52         cptr s_range = "ÈÏ°Ï:";
53         cptr s_heal = " ²óÉü:%s";
54 #else
55         cptr s_dam = " dam %s";
56         cptr s_dur = "dur ";
57         cptr s_range = "range ";
58         cptr s_heal = " heal %s";
59 #endif
60
61         strcpy(p, "");
62
63         switch (power)
64         {
65                 case MS_SHRIEK:
66                 case MS_XXX1:
67                 case MS_XXX2:
68                 case MS_XXX3:
69                 case MS_XXX4:
70                 case MS_SCARE:
71                 case MS_BLIND:
72                 case MS_CONF:
73                 case MS_SLOW:
74                 case MS_SLEEP:
75                 case MS_HAND_DOOM:
76                 case MS_WORLD:
77                 case MS_SPECIAL:
78                 case MS_TELE_TO:
79                 case MS_TELE_AWAY:
80                 case MS_TELE_LEVEL:
81                 case MS_DARKNESS:
82                 case MS_MAKE_TRAP:
83                 case MS_FORGET:
84                 case MS_S_KIN:
85                 case MS_S_CYBER:
86                 case MS_S_MONSTER:
87                 case MS_S_MONSTERS:
88                 case MS_S_ANT:
89                 case MS_S_SPIDER:
90                 case MS_S_HOUND:
91                 case MS_S_HYDRA:
92                 case MS_S_ANGEL:
93                 case MS_S_DEMON:
94                 case MS_S_UNDEAD:
95                 case MS_S_DRAGON:
96                 case MS_S_HI_UNDEAD:
97                 case MS_S_HI_DRAGON:
98                 case MS_S_AMBERITE:
99                 case MS_S_UNIQUE:
100                         break;
101         case MS_BALL_MANA:
102         case MS_BALL_DARK:
103         case MS_STARBURST: 
104             set_bluemage_damage((power), plev, s_dam, p); break;
105                 case MS_DISPEL:
106                         break;
107         case MS_ROCKET:
108         case MS_SHOOT:
109         case MS_BR_ACID:
110         case MS_BR_ELEC:
111         case MS_BR_FIRE:
112         case MS_BR_COLD:
113         case MS_BR_POIS:
114         case MS_BR_NUKE: 
115         case MS_BR_NEXUS:
116         case MS_BR_TIME:
117         case MS_BR_GRAVITY:
118         case MS_BR_MANA:
119         case MS_BR_NETHER:
120         case MS_BR_LITE:
121         case MS_BR_DARK:
122         case MS_BR_CONF:
123         case MS_BR_SOUND:
124         case MS_BR_CHAOS:
125         case MS_BR_DISEN:
126         case MS_BR_SHARDS:
127         case MS_BR_PLASMA:
128         case MS_BR_INERTIA:
129         case MS_BR_FORCE:
130         case MS_BR_DISI:
131         case MS_BALL_NUKE:
132         case MS_BALL_CHAOS:
133         case MS_BALL_ACID:
134         case MS_BALL_ELEC:
135         case MS_BALL_FIRE:
136         case MS_BALL_COLD:
137         case MS_BALL_POIS:
138         case MS_BALL_NETHER:
139         case MS_BALL_WATER:
140             set_bluemage_damage((power), plev, s_dam, p); break;
141         case MS_DRAIN_MANA:
142             set_bluemage_damage((power), plev, s_heal, p); break;
143         case MS_MIND_BLAST:
144         case MS_BRAIN_SMASH:
145         case MS_CAUSE_1:
146         case MS_CAUSE_2:
147         case MS_CAUSE_3:
148         case MS_CAUSE_4:
149         case MS_BOLT_ACID:
150         case MS_BOLT_ELEC:
151         case MS_BOLT_FIRE:
152         case MS_BOLT_COLD:
153         case MS_BOLT_NETHER:
154         case MS_BOLT_WATER:
155         case MS_BOLT_MANA:
156         case MS_BOLT_PLASMA:
157         case MS_BOLT_ICE: 
158         case MS_MAGIC_MISSILE: 
159             set_bluemage_damage((power), plev, s_dam, p); break;
160                 case MS_SPEED:
161                         sprintf(p, " %sd%d+%d", s_dur, 20+plev, plev);
162                         break;
163         case MS_HEAL:
164             set_bluemage_damage((power), plev, s_heal, p); break;
165                 case MS_INVULNER:
166                         sprintf(p, " %sd7+7", s_dur);
167                         break;
168                 case MS_BLINK:
169                         sprintf(p, " %s10", s_range);
170                         break;
171                 case MS_TELEPORT:
172                         sprintf(p, " %s%d", s_range, plev * 5);
173                         break;
174         case MS_PSY_SPEAR:
175             set_bluemage_damage((power), plev, s_dam, p); break;
176                         break;
177                 case MS_RAISE_DEAD:
178                         sprintf(p, " %s5", s_range);
179                         break;
180                 default:
181                         break;
182         }
183 }
184
185
186 /*!
187  * @brief »ÈÍѲÄǽ¤ÊÀÄËâË¡¤òÁªÂò¤¹¤ë /
188  * Allow user to choose a imitation.
189  * @param sn ÁªÂò¤·¤¿¥â¥ó¥¹¥¿¡¼¹¶·âID¡¢¥­¥ã¥ó¥»¥ë¤Î¾ì¹ç-1¡¢ÉÔÀµ¤ÊÁªÂò¤Î¾ì¹ç-2¤òÊÖ¤¹
190  * @return È¯Æ°²Äǽ¤ÊËâË¡¤òÁªÂò¤·¤¿¾ì¹çTRUE¡¢¥­¥ã¥ó¥»¥ë½èÍý¤«ÉÔÀµ¤ÊÁªÂò¤¬¹Ô¤ï¤ì¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
191  * @details
192  * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
193  * If the user hits escape, returns FALSE, and set '*sn' to -1\n
194  * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
195  *\n
196  * The "prompt" should be "cast", "recite", or "study"\n
197  * The "known" should be TRUE for cast/pray, FALSE for study\n
198  *\n
199  * nb: This function has a (trivial) display bug which will be obvious\n
200  * when you run it. It's probably easy to fix but I haven't tried,\n
201  * sorry.\n
202  */
203 static int get_learned_power(int *sn)
204 {
205         int             i = 0;
206         int             num = 0;
207         int             y = 1;
208         int             x = 18;
209         int             minfail = 0;
210         int             plev = p_ptr->lev;
211         int             chance = 0;
212         int             ask = TRUE, mode = 0;
213         int             spellnum[MAX_MONSPELLS];
214         char            ch;
215         char            choice;
216         char            out_val[160];
217         char            comment[80];
218         s32b            f4 = 0, f5 = 0, f6 = 0;
219 #ifdef JP
220 cptr            p = "ËâË¡";
221 #else
222         cptr            p = "magic";
223 #endif
224
225         monster_power   spell;
226         bool            flag, redraw;
227         int menu_line = (use_menu ? 1 : 0);
228
229         /* Assume cancelled */
230         *sn = (-1);
231
232         /* Nothing chosen yet */
233         flag = FALSE;
234
235         /* No redraw yet */
236         redraw = FALSE;
237
238 #ifdef ALLOW_REPEAT /* TNB */
239
240         /* Get the spell, if available */
241         if (repeat_pull(sn))
242         {
243                 /* Success */
244                 return (TRUE);
245         }
246
247 #endif /* ALLOW_REPEAT -- TNB */
248
249         if (use_menu)
250         {
251                 screen_save();
252
253                 while(!mode)
254                 {
255 #ifdef JP
256                         prt(format(" %s ¥Ü¥ë¥È", (menu_line == 1) ? "¡Õ" : "  "), 2, 14);
257                         prt(format(" %s ¥Ü¡¼¥ë", (menu_line == 2) ? "¡Õ" : "  "), 3, 14);
258                         prt(format(" %s ¥Ö¥ì¥¹", (menu_line == 3) ? "¡Õ" : "  "), 4, 14);
259                         prt(format(" %s ¾¤´­", (menu_line == 4) ? "¡Õ" : "  "), 5, 14);
260                         prt(format(" %s ¤½¤Î¾", (menu_line == 5) ? "¡Õ" : "  "), 6, 14);
261                         prt("¤É¤Î¼ïÎà¤ÎËâË¡¤ò»È¤¤¤Þ¤¹¤«¡©", 0, 0);
262 #else
263                         prt(format(" %s bolt", (menu_line == 1) ? "> " : "  "), 2, 14);
264                         prt(format(" %s ball", (menu_line == 2) ? "> " : "  "), 3, 14);
265                         prt(format(" %s breath", (menu_line == 3) ? "> " : "  "), 4, 14);
266                         prt(format(" %s sommoning", (menu_line == 4) ? "> " : "  "), 5, 14);
267                         prt(format(" %s others", (menu_line == 5) ? "> " : "  "), 6, 14);
268                         prt("use which type of magic? ", 0, 0);
269 #endif
270                         choice = inkey();
271                         switch(choice)
272                         {
273                         case ESCAPE:
274                         case 'z':
275                         case 'Z':
276                                 screen_load();
277                                 return FALSE;
278                         case '2':
279                         case 'j':
280                         case 'J':
281                                 menu_line++;
282                                 break;
283                         case '8':
284                         case 'k':
285                         case 'K':
286                                 menu_line+= 4;
287                                 break;
288                         case '\r':
289                         case 'x':
290                         case 'X':
291                                 mode = menu_line;
292                                 break;
293                         }
294                         if (menu_line > 5) menu_line -= 5;
295                 }
296                 screen_load();
297         }
298         else
299         {
300 #ifdef JP
301         sprintf(comment, "[A]¥Ü¥ë¥È, [B]¥Ü¡¼¥ë, [C]¥Ö¥ì¥¹, [D]¾¤´­, [E]¤½¤Î¾:");
302 #else
303         sprintf(comment, "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:");
304 #endif
305         while (TRUE)
306         {
307                 if (!get_com(comment, &ch, TRUE))
308                 {
309                         return FALSE;
310                 }
311                 if (ch == 'A' || ch == 'a')
312                 {
313                         mode = 1;
314                         break;
315                 }
316                 if (ch == 'B' || ch == 'b')
317                 {
318                         mode = 2;
319                         break;
320                 }
321                 if (ch == 'C' || ch == 'c')
322                 {
323                         mode = 3;
324                         break;
325                 }
326                 if (ch == 'D' || ch == 'd')
327                 {
328                         mode = 4;
329                         break;
330                 }
331                 if (ch == 'E' || ch == 'e')
332                 {
333                         mode = 5;
334                         break;
335                 }
336         }
337         }
338
339         set_rf_masks(&f4, &f5, &f6, mode);
340
341         for (i = 0, num = 0; i < 32; i++)
342         {
343                 if ((0x00000001 << i) & f4) spellnum[num++] = i;
344         }
345         for (; i < 64; i++)
346         {
347                 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
348         }
349         for (; i < 96; i++)
350         {
351                 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
352         }
353         for (i = 0; i < num; i++)
354         {
355                 if (p_ptr->magic_num2[spellnum[i]])
356                 {
357                         if (use_menu) menu_line = i+1;
358                         break;
359                 }
360         }
361         if (i == num)
362         {
363 #ifdef JP
364                 msg_print("¤½¤Î¼ïÎà¤ÎËâË¡¤Ï³Ð¤¨¤Æ¤¤¤Ê¤¤¡ª");
365 #else
366                 msg_print("You don't know any spell of this type.");
367 #endif
368                 return (FALSE);
369         }
370
371         /* Build a prompt (accept all spells) */
372         (void)strnfmt(out_val, 78, 
373 #ifdef JP
374                       "(%c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò¾§¤¨¤Þ¤¹¤«¡©",
375 #else
376                       "(%c-%c, *=List, ESC=exit) Use which %s? ",
377 #endif
378                       I2A(0), I2A(num - 1), p);
379
380         if (use_menu) screen_save();
381
382         /* Get a spell from the user */
383
384         choice= (always_show_list || use_menu) ? ESCAPE:1 ;
385         while (!flag)
386         {
387                 if(choice==ESCAPE) choice = ' '; 
388                 else if( !get_com(out_val, &choice, TRUE) )break; 
389
390                 if (use_menu && choice != ' ')
391                 {
392                         switch(choice)
393                         {
394                                 case '0':
395                                 {
396                                         screen_load();
397                                         return (FALSE);
398                                 }
399
400                                 case '8':
401                                 case 'k':
402                                 case 'K':
403                                 {
404                                         do
405                                         {
406                                                 menu_line += (num-1);
407                                                 if (menu_line > num) menu_line -= num;
408                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
409                                         break;
410                                 }
411
412                                 case '2':
413                                 case 'j':
414                                 case 'J':
415                                 {
416                                         do
417                                         {
418                                                 menu_line++;
419                                                 if (menu_line > num) menu_line -= num;
420                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
421                                         break;
422                                 }
423
424                                 case '6':
425                                 case 'l':
426                                 case 'L':
427                                 {
428                                         menu_line=num;
429                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
430                                         break;
431                                 }
432
433                                 case '4':
434                                 case 'h':
435                                 case 'H':
436                                 {
437                                         menu_line=1;
438                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
439                                         break;
440                                 }
441
442                                 case 'x':
443                                 case 'X':
444                                 case '\r':
445                                 {
446                                         i = menu_line - 1;
447                                         ask = FALSE;
448                                         break;
449                                 }
450                         }
451                 }
452                 /* Request redraw */
453                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
454                 {
455                         /* Show the list */
456                         if (!redraw || use_menu)
457                         {
458                                 char psi_desc[80];
459
460                                 /* Show list */
461                                 redraw = TRUE;
462
463                                 /* Save the screen */
464                                 if (!use_menu) screen_save();
465
466                                 /* Display a list of spells */
467                                 prt("", y, x);
468 #ifdef JP
469 put_str("̾Á°", y, x + 5);
470 #else
471                                 put_str("Name", y, x + 5);
472 #endif
473
474 #ifdef JP
475 put_str("MP ¼ºÎ¨ ¸ú²Ì", y, x + 33);
476 #else
477                                 put_str("SP Fail Info", y, x + 32);
478 #endif
479
480
481                                 /* Dump the spells */
482                                 for (i = 0; i < num; i++)
483                                 {
484                                         int need_mana;
485
486                                         prt("", y + i + 1, x);
487                                         if (!p_ptr->magic_num2[spellnum[i]]) continue;
488
489                                         /* Access the spell */
490                                         spell = monster_powers[spellnum[i]];
491
492                                         chance = spell.fail;
493
494                                         /* Reduce failure rate by "effective" level adjustment */
495                                         if (plev > spell.level) chance -= 3 * (plev - spell.level);
496                                         else chance += (spell.level - plev);
497
498                                         /* Reduce failure rate by INT/WIS adjustment */
499                                         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
500
501                                         chance = mod_spell_chance_1(chance);
502
503                                         need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
504
505                                         /* Not enough mana to cast */
506                                         if (need_mana > p_ptr->csp)
507                                         {
508                                                 chance += 5 * (need_mana - p_ptr->csp);
509                                         }
510
511                                         /* Extract the minimum failure rate */
512                                         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
513
514                                         /* Minimum failure rate */
515                                         if (chance < minfail) chance = minfail;
516
517                                         /* Stunning makes spells harder */
518                                         if (p_ptr->stun > 50) chance += 25;
519                                         else if (p_ptr->stun) chance += 15;
520
521                                         /* Always a 5 percent chance of working */
522                                         if (chance > 95) chance = 95;
523
524                                         chance = mod_spell_chance_2(chance);
525
526                                         /* Get info */
527                                         learned_info(comment, spellnum[i]);
528
529                                         if (use_menu)
530                                         {
531 #ifdef JP
532                                                 if (i == (menu_line-1)) strcpy(psi_desc, "  ¡Õ");
533 #else
534                                                 if (i == (menu_line-1)) strcpy(psi_desc, "  > ");
535 #endif
536                                                 else strcpy(psi_desc, "    ");
537                                         }
538                                         else sprintf(psi_desc, "  %c)", I2A(i));
539
540                                         /* Dump the spell --(-- */
541                                         strcat(psi_desc, format(" %-26s %3d %3d%%%s",
542                                                 spell.name, need_mana,
543                                                 chance, comment));
544                                         prt(psi_desc, y + i + 1, x);
545                                 }
546
547                                 /* Clear the bottom line */
548                                 if (y < 22) prt("", y + i + 1, x);
549                         }
550
551                         /* Hide the list */
552                         else
553                         {
554                                 /* Hide list */
555                                 redraw = FALSE;
556
557                                 /* Restore the screen */
558                                 screen_load();
559                         }
560
561                         /* Redo asking */
562                         continue;
563                 }
564
565                 if (!use_menu)
566                 {
567                         /* Note verify */
568                         ask = isupper(choice);
569
570                         /* Lowercase */
571                         if (ask) choice = tolower(choice);
572
573                         /* Extract request */
574                         i = (islower(choice) ? A2I(choice) : -1);
575                 }
576
577                 /* Totally Illegal */
578                 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
579                 {
580                         bell();
581                         continue;
582                 }
583
584                 /* Save the spell index */
585                 spell = monster_powers[spellnum[i]];
586
587                 /* Verify it */
588                 if (ask)
589                 {
590                         char tmp_val[160];
591
592                         /* Prompt */
593 #ifdef JP
594                         (void) strnfmt(tmp_val, 78, "%s¤ÎËâË¡¤ò¾§¤¨¤Þ¤¹¤«¡©", monster_powers[spellnum[i]].name);
595 #else
596                         (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[spellnum[i]].name);
597 #endif
598
599
600                         /* Belay that order */
601                         if (!get_check(tmp_val)) continue;
602                 }
603
604                 /* Stop the loop */
605                 flag = TRUE;
606         }
607
608         /* Restore the screen */
609         if (redraw) screen_load();
610
611         /* Show choices */
612         p_ptr->window |= (PW_SPELL);
613
614         /* Window stuff */
615         window_stuff();
616
617         /* Abort if needed */
618         if (!flag) return (FALSE);
619
620         /* Save the choice */
621         (*sn) = spellnum[i];
622
623 #ifdef ALLOW_REPEAT /* TNB */
624
625         repeat_push(*sn);
626
627 #endif /* ALLOW_REPEAT -- TNB */
628
629         /* Success */
630         return (TRUE);
631 }
632
633
634 /*!
635  * @brief ÀÄËâË¡¤Îȯư /
636  * do_cmd_cast calls this function if the player's class is 'blue-mage'.
637  * @param spell È¯Æ°¤¹¤ë¥â¥ó¥¹¥¿¡¼¹¶·â¤ÎID
638  * @param success TRUE¤ÏÀ®¸ù»þ¡¢FALSE¤Ï¼ºÇÔ»þ¤Î½èÍý¤ò¹Ô¤¦
639  * @return ½èÍý¤ò¼Â¹Ô¤·¤¿¤éTRUE¡¢¥­¥ã¥ó¥»¥ë¤·¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
640  */
641 static bool cast_learned_spell(int spell, bool success)
642 {
643         int             dir;
644         int             plev = pseudo_plev();
645         int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
646         int             hp = p_ptr->chp;
647         int             damage = 0;
648         bool   pet = success;
649         bool   no_trump = FALSE;
650         u32b p_mode, u_mode = 0L, g_mode;
651
652         if (pet)
653         {
654                 p_mode = PM_FORCE_PET;
655                 g_mode = 0;
656         }
657         else
658         {
659                 p_mode = PM_NO_PET;
660                 g_mode = PM_ALLOW_GROUP;
661         }
662
663         if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
664
665         /* spell code */
666         switch (spell)
667         {
668         case MS_SHRIEK:
669         msg_print(_("¤«¤ó¹â¤¤¶âÀÚ¤êÀ¼¤ò¤¢¤²¤¿¡£", "You make a high pitched shriek."));
670                 aggravate_monsters(0);
671                 break;
672         case MS_XXX1:
673                 break;
674         case MS_DISPEL:
675         {
676                 int m_idx;
677
678                 if (!target_set(TARGET_KILL)) return FALSE;
679                 m_idx = cave[target_row][target_col].m_idx;
680                 if (!m_idx) break;
681                 if (!player_has_los_bold(target_row, target_col)) break;
682                 if (!projectable(py, px, target_row, target_col)) break;
683                 dispel_monster_status(m_idx);
684                 break;
685         }
686         case MS_ROCKET:
687                 if (!get_aim_dir(&dir)) return FALSE;
688                 
689         msg_print(_("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡£", "You fire a rocket."));
690         damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
691                 fire_rocket(GF_ROCKET, dir, damage, 2);
692                 break;
693         case MS_SHOOT:
694         {
695                 object_type *o_ptr = NULL;
696
697                 if (!get_aim_dir(&dir)) return FALSE;
698                 
699         msg_print(_("Ìð¤òÊü¤Ã¤¿¡£", "You fire an arrow."));
700         damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
701                 fire_bolt(GF_ARROW, dir, damage);
702                 break;
703         }
704         case MS_XXX2:
705                 break;
706         case MS_XXX3:
707                 break;
708         case MS_XXX4:
709                 break;
710         case MS_BR_ACID:
711                 if (!get_aim_dir(&dir)) return FALSE;
712
713         msg_print(_("»À¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe acid."));
714         damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
715                 fire_ball(GF_ACID, dir, damage, (plev > 40 ? -3 : -2));
716                 break;
717         case MS_BR_ELEC:
718                 if (!get_aim_dir(&dir)) return FALSE;
719
720         msg_print(_("°ðºÊ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe lightning."));
721         damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
722                 fire_ball(GF_ELEC, dir, damage, (plev > 40 ? -3 : -2));
723                 break;
724         case MS_BR_FIRE:
725                 if (!get_aim_dir(&dir)) return FALSE;
726
727         msg_print(_("²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe fire."));
728         damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
729                 fire_ball(GF_FIRE, dir, damage, (plev > 40 ? -3 : -2));
730                 break;
731         case MS_BR_COLD:
732         if (!get_aim_dir(&dir)) return FALSE;
733
734         msg_print(_("Î䵤¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe frost."));
735         damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
736                 fire_ball(GF_COLD, dir, damage, (plev > 40 ? -3 : -2));
737                 break;
738         case MS_BR_POIS:
739         if (!get_aim_dir(&dir)) return FALSE;
740
741         msg_print(_("¥¬¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe gas."));
742         damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
743                 fire_ball(GF_POIS, dir, damage, (plev > 40 ? -3 : -2));
744                 break;
745         case MS_BR_NETHER:
746         if (!get_aim_dir(&dir)) return FALSE;
747
748         msg_print(_("ÃϹö¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe nether."));
749         damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
750                 fire_ball(GF_NETHER, dir, damage, (plev > 40 ? -3 : -2));
751                 break;
752         case MS_BR_LITE:
753                 if (!get_aim_dir(&dir)) return FALSE;
754
755         msg_print(_("Á®¸÷¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe light."));
756         damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
757                 fire_ball(GF_LITE, dir, damage, (plev > 40 ? -3 : -2));
758                 break;
759         case MS_BR_DARK:
760                 if (!get_aim_dir(&dir)) return FALSE;
761
762         msg_print(_("°Å¹õ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe darkness."));
763         damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
764                 fire_ball(GF_DARK, dir, damage, (plev > 40 ? -3 : -2));
765                 break;
766         case MS_BR_CONF:
767                 if (!get_aim_dir(&dir)) return FALSE;
768
769         msg_print(_("º®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe confusion."));
770         damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
771                 fire_ball(GF_CONFUSION, dir, damage, (plev > 40 ? -3 : -2));
772                 break;
773         case MS_BR_SOUND:
774                 if (!get_aim_dir(&dir)) return FALSE;
775
776         msg_print(_("¹ì²»¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe sound."));
777         damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
778                 fire_ball(GF_SOUND, dir, damage, (plev > 40 ? -3 : -2));
779                 break;
780         case MS_BR_CHAOS:
781                 if (!get_aim_dir(&dir)) return FALSE;
782
783         msg_print(_("¥«¥ª¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe chaos."));
784         damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
785                 fire_ball(GF_CHAOS, dir, damage, (plev > 40 ? -3 : -2));
786                 break;
787         case MS_BR_DISEN:
788                 if (!get_aim_dir(&dir)) return FALSE;
789
790         msg_print(_("Îô²½¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe disenchantment."));
791         damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
792                 fire_ball(GF_DISENCHANT, dir, damage, (plev > 40 ? -3 : -2));
793                 break;
794         case MS_BR_NEXUS:
795                 if (!get_aim_dir(&dir)) return FALSE;
796
797         msg_print(_("°ø²Ìº®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe nexus."));
798         damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
799                 fire_ball(GF_NEXUS, dir, damage, (plev > 40 ? -3 : -2));
800                 break;
801         case MS_BR_TIME:
802                 if (!get_aim_dir(&dir)) return FALSE;
803
804         msg_print(_("»þ´ÖµÕž¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe time."));
805         damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
806                 fire_ball(GF_TIME, dir, damage, (plev > 40 ? -3 : -2));
807                 break;
808         case MS_BR_INERTIA:
809                 if (!get_aim_dir(&dir)) return FALSE;
810
811         msg_print(_("ÃÙÆߤΥ֥쥹¤òÅǤ¤¤¿¡£", "You breathe inertia."));
812         damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
813                 fire_ball(GF_INERTIA, dir, damage, (plev > 40 ? -3 : -2));
814                 break;
815         case MS_BR_GRAVITY:
816                 if (!get_aim_dir(&dir)) return FALSE;
817
818         msg_print(_("½ÅÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", "You breathe gravity."));
819         damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
820                 fire_ball(GF_GRAVITY, dir, damage, (plev > 40 ? -3 : -2));
821                 break;
822         case MS_BR_SHARDS:
823         if (!get_aim_dir(&dir)) return FALSE;
824
825         msg_print(_("ÇËÊҤΥ֥쥹¤òÅǤ¤¤¿¡£", "You breathe shards."));
826         damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
827                 fire_ball(GF_SHARDS, dir, damage, (plev > 40 ? -3 : -2));
828                 break;
829         case MS_BR_PLASMA:
830         if (!get_aim_dir(&dir)) return FALSE;
831
832         msg_print(_("¥×¥é¥º¥Þ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe plasma."));
833         damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
834                 fire_ball(GF_PLASMA, dir, damage, (plev > 40 ? -3 : -2));
835                 break;
836         case MS_BR_FORCE:
837         if (!get_aim_dir(&dir)) return FALSE;
838
839         msg_print(_("¥Õ¥©¡¼¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe force."));
840         damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
841                 fire_ball(GF_FORCE, dir, damage, (plev > 40 ? -3 : -2));
842                 break;
843         case MS_BR_MANA:
844                 if (!get_aim_dir(&dir)) return FALSE;
845
846         msg_print(_("ËâÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", "You breathe mana."));
847         damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
848                 fire_ball(GF_MANA, dir, damage, (plev > 40 ? -3 : -2));
849                 break;
850         case MS_BALL_NUKE:
851                 if (!get_aim_dir(&dir)) return FALSE;
852
853         msg_print(_("Êü¼Íǽµå¤òÊü¤Ã¤¿¡£", "You cast a ball of radiation."));
854         damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
855                 fire_ball(GF_NUKE, dir, damage, 2);
856                 break;
857         case MS_BR_NUKE:
858                 if (!get_aim_dir(&dir)) return FALSE;
859
860         msg_print(_("Êü¼ÍÀ­ÇÑ´þʪ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe toxic waste."));
861         damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
862                 fire_ball(GF_NUKE, dir, damage, (plev > 40 ? -3 : -2));
863                 break;
864         case MS_BALL_CHAOS:
865                 if (!get_aim_dir(&dir)) return FALSE;
866
867         msg_print(_("½ã¥í¥°¥ë¥¹¤òÊü¤Ã¤¿¡£", "You invoke a raw Logrus."));
868         damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
869                 fire_ball(GF_CHAOS, dir, damage, 4);
870                 break;
871         case MS_BR_DISI:
872                 if (!get_aim_dir(&dir)) return FALSE;
873
874         msg_print(_("ʬ²ò¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe disintegration."));
875         damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
876                 fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 40 ? -3 : -2));
877                 break;
878         case MS_BALL_ACID:
879                 if (!get_aim_dir(&dir)) return FALSE;
880
881         msg_print(_("¥¢¥·¥Ã¥É¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast an acid ball."));
882         damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
883                 fire_ball(GF_ACID, dir, damage, 2);
884                 break;
885         case MS_BALL_ELEC:
886         if (!get_aim_dir(&dir)) return FALSE;
887
888         msg_print(_("¥µ¥ó¥À¡¼¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a lightning ball."));
889         damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
890                 fire_ball(GF_ELEC, dir, damage, 2);
891                 break;
892         case MS_BALL_FIRE:
893                 if (!get_aim_dir(&dir)) return FALSE;
894
895         msg_print(_("¥Õ¥¡¥¤¥¢¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a fire ball."));
896         damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
897                 fire_ball(GF_FIRE, dir, damage, 2);
898                 break;
899         case MS_BALL_COLD:
900         if (!get_aim_dir(&dir)) return FALSE;
901
902         msg_print(_("¥¢¥¤¥¹¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a frost ball."));
903         damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
904                 fire_ball(GF_COLD, dir, damage, 2);
905                 break;
906         case MS_BALL_POIS:
907                 if (!get_aim_dir(&dir)) return FALSE;
908
909         msg_print(_("°­½­±À¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a stinking cloud."));
910         damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
911                 fire_ball(GF_POIS, dir, damage, 2);
912                 break;
913         case MS_BALL_NETHER:
914         if (!get_aim_dir(&dir)) return FALSE;
915
916         msg_print(_("ÃϹöµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a nether ball."));
917         damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
918                 fire_ball(GF_NETHER, dir, damage, 2);
919                 break;
920         case MS_BALL_WATER:
921                 if (!get_aim_dir(&dir)) return FALSE;
922
923         msg_print(_("ή¤ì¤ë¤è¤¦¤Ê¿È¿¶¤ê¤ò¤·¤¿¡£", "You gesture fluidly."));
924         damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
925                 fire_ball(GF_WATER, dir, damage, 4);
926                 break;
927         case MS_BALL_MANA:
928         if (!get_aim_dir(&dir)) return FALSE;
929
930         msg_print(_("ËâÎϤÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", "You invoke a mana storm."));
931         damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
932                 fire_ball(GF_MANA, dir, damage, 4);
933                 break;
934         case MS_BALL_DARK:
935                 if (!get_aim_dir(&dir)) return FALSE;
936
937         msg_print(_("°Å¹õ¤ÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", "You invoke a darkness storm."));
938         damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
939                 fire_ball(GF_DARK, dir, damage, 4);
940                 break;
941         case MS_DRAIN_MANA:
942                 if (!get_aim_dir(&dir)) return FALSE;
943
944         damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
945         fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
946                 break;
947         case MS_MIND_BLAST:
948                 if (!get_aim_dir(&dir)) return FALSE;
949
950         damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
951                 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
952                 break;
953         case MS_BRAIN_SMASH:
954         if (!get_aim_dir(&dir)) return FALSE;
955
956         damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
957                 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
958                 break;
959         case MS_CAUSE_1:
960                 if (!get_aim_dir(&dir)) return FALSE;
961
962         damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
963                 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
964                 break;
965         case MS_CAUSE_2:
966                 if (!get_aim_dir(&dir)) return FALSE;
967
968         damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
969                 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
970                 break;
971         case MS_CAUSE_3:
972                 if (!get_aim_dir(&dir)) return FALSE;
973
974         damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
975                 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
976                 break;
977         case MS_CAUSE_4:
978                 if (!get_aim_dir(&dir)) return FALSE;
979
980         damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
981                 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
982                 break;
983         case MS_BOLT_ACID:
984                 if (!get_aim_dir(&dir)) return FALSE;
985
986         msg_print(_("¥¢¥·¥Ã¥É¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast an acid bolt."));
987         damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
988         fire_bolt(GF_ACID, dir, damage);
989                 break;
990         case MS_BOLT_ELEC:
991                 if (!get_aim_dir(&dir)) return FALSE;
992
993         msg_print(_("¥µ¥ó¥À¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a lightning bolt."));
994         damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
995                 fire_bolt(GF_ELEC, dir, damage);
996                 break;
997         case MS_BOLT_FIRE:
998                 if (!get_aim_dir(&dir)) return FALSE;
999
1000         msg_print(_("¥Õ¥¡¥¤¥¢¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a fire bolt."));
1001         damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
1002                 fire_bolt(GF_FIRE, dir, damage);
1003                 break;
1004         case MS_BOLT_COLD:
1005                 if (!get_aim_dir(&dir)) return FALSE;
1006
1007         msg_print(_("¥¢¥¤¥¹¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a frost bolt."));
1008         damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
1009                 fire_bolt(GF_COLD, dir, damage);
1010                 break;
1011         case MS_STARBURST:
1012                 if (!get_aim_dir(&dir)) return FALSE;
1013
1014         msg_print(_("¥¹¥¿¡¼¥Ð¡¼¥¹¥È¤Î¼öʸ¤òÇ°¤¸¤¿¡£", "You invoke a starburst."));
1015         damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
1016                 fire_ball(GF_LITE, dir, damage, 4);
1017                 break;
1018         case MS_BOLT_NETHER:
1019                 if (!get_aim_dir(&dir)) return FALSE;
1020
1021         msg_print(_("ÃϹö¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a nether bolt."));
1022         damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
1023                 fire_bolt(GF_NETHER, dir, damage);
1024                 break;
1025         case MS_BOLT_WATER:
1026                 if (!get_aim_dir(&dir)) return FALSE;
1027
1028         msg_print(_("¥¦¥©¡¼¥¿¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a water bolt."));
1029         damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
1030                 fire_bolt(GF_WATER, dir, damage);
1031                 break;
1032         case MS_BOLT_MANA:
1033                 if (!get_aim_dir(&dir)) return FALSE;
1034
1035         msg_print(_("ËâÎϤÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a mana bolt."));
1036         damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1037                 fire_bolt(GF_MANA, dir, damage);
1038                 break;
1039         case MS_BOLT_PLASMA:
1040                 if (!get_aim_dir(&dir)) return FALSE;
1041
1042         msg_print(_("¥×¥é¥º¥Þ¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a plasma bolt."));
1043         damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1044                 fire_bolt(GF_PLASMA, dir, damage);
1045                 break;
1046         case MS_BOLT_ICE:
1047                 if (!get_aim_dir(&dir)) return FALSE;
1048
1049         msg_print(_("¶Ë´¨¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a ice bolt."));
1050         damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1051                 fire_bolt(GF_ICE, dir, damage);
1052                 break;
1053         case MS_MAGIC_MISSILE:
1054                 if (!get_aim_dir(&dir)) return FALSE;
1055
1056         msg_print(_("¥Þ¥¸¥Ã¥¯¡¦¥ß¥µ¥¤¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a magic missile."));
1057         damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1058                 fire_bolt(GF_MISSILE, dir, damage);
1059                 break;
1060         case MS_SCARE:
1061                 if (!get_aim_dir(&dir)) return FALSE;
1062
1063         msg_print(_("¶²¤í¤·¤²¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", "You cast a fearful illusion."));
1064                 fear_monster(dir, plev+10);
1065                 break;
1066         case MS_BLIND:
1067                 if (!get_aim_dir(&dir)) return FALSE;
1068                 confuse_monster(dir, plev * 2);
1069                 break;
1070         case MS_CONF:
1071                 if (!get_aim_dir(&dir)) return FALSE;
1072
1073         msg_print(_("ͶÏÇŪ¤Ê¸¸³Ð¤ò¤Ä¤¯¤ê½Ð¤·¤¿¡£", "You cast a mesmerizing illusion."));
1074                 confuse_monster(dir, plev * 2);
1075                 break;
1076         case MS_SLOW:
1077                 if (!get_aim_dir(&dir)) return FALSE;
1078                 slow_monster(dir, plev);
1079                 break;
1080         case MS_SLEEP:
1081                 if (!get_aim_dir(&dir)) return FALSE;
1082                 sleep_monster(dir, plev);
1083                 break;
1084         case MS_SPEED:
1085                 (void)set_fast(randint1(20 + plev) + plev, FALSE);
1086                 break;
1087         case MS_HAND_DOOM:
1088         {
1089                 if (!get_aim_dir(&dir)) return FALSE;
1090
1091         msg_print(_("<ÇËÌǤμê>¤òÊü¤Ã¤¿¡ª", "You invoke the Hand of Doom!"));
1092                 fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
1093                 break;
1094         }
1095         case MS_HEAL:
1096         msg_print(_("¼«Ê¬¤Î½ý¤ËÇ°¤ò½¸Ã椷¤¿¡£", "You concentrate on your wounds!"));
1097                 (void)hp_player(plev*4);
1098                 (void)set_stun(0);
1099                 (void)set_cut(0);
1100                 break;
1101         case MS_INVULNER:
1102         msg_print(_("̵½ý¤Îµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a Globe of Invulnerability."));
1103                 (void)set_invuln(randint1(4) + 4, FALSE);
1104                 break;
1105         case MS_BLINK:
1106                 teleport_player(10, 0L);
1107                 break;
1108         case MS_TELEPORT:
1109                 teleport_player(plev * 5, 0L);
1110                 break;
1111         case MS_WORLD:
1112         world_player = TRUE;
1113         msg_print(_("¡Ö»þ¤è¡ª¡×", "'Time!'"));
1114                 msg_print(NULL);
1115
1116                 /* Hack */
1117                 p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;
1118
1119                 /* Redraw map */
1120                 p_ptr->redraw |= (PR_MAP);
1121
1122                 /* Update monsters */
1123                 p_ptr->update |= (PU_MONSTERS);
1124
1125                 /* Window stuff */
1126                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1127
1128                 handle_stuff();
1129                 break;
1130         case MS_SPECIAL:
1131                 break;
1132         case MS_TELE_TO:
1133         {
1134                 monster_type *m_ptr;
1135                 monster_race *r_ptr;
1136                 char m_name[80];
1137
1138                 if (!target_set(TARGET_KILL)) return FALSE;
1139                 if (!cave[target_row][target_col].m_idx) break;
1140                 if (!player_has_los_bold(target_row, target_col)) break;
1141                 if (!projectable(py, px, target_row, target_col)) break;
1142                 m_ptr = &m_list[cave[target_row][target_col].m_idx];
1143                 r_ptr = &r_info[m_ptr->r_idx];
1144                 monster_desc(m_name, m_ptr, 0);
1145                 if (r_ptr->flagsr & RFR_RES_TELE)
1146                 {
1147                         if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1148                         {
1149                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1150                 msg_format(_("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", "%s is unaffected!"), m_name);
1151                                 break;
1152                         }
1153                         else if (r_ptr->level > randint1(100))
1154                         {
1155                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1156                 msg_format(_("%s¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª", "%s resists!"), m_name);
1157                                 break;
1158                         }
1159                 }
1160         msg_format(_("%s¤ò°ú¤­Ìᤷ¤¿¡£", "You command %s to return."), m_name);
1161                 teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE);
1162                 break;
1163         }
1164         case MS_TELE_AWAY:
1165                 if (!get_aim_dir(&dir)) return FALSE;
1166
1167                 (void)fire_beam(GF_AWAY_ALL, dir, 100);
1168                 break;
1169         case MS_TELE_LEVEL:
1170         {
1171                 int target_m_idx;
1172                 monster_type *m_ptr;
1173                 monster_race *r_ptr;
1174                 char m_name[80];
1175
1176                 if (!target_set(TARGET_KILL)) return FALSE;
1177                 target_m_idx = cave[target_row][target_col].m_idx;
1178                 if (!target_m_idx) break;
1179                 if (!player_has_los_bold(target_row, target_col)) break;
1180                 if (!projectable(py, px, target_row, target_col)) break;
1181                 m_ptr = &m_list[target_m_idx];
1182                 r_ptr = &r_info[m_ptr->r_idx];
1183                 monster_desc(m_name, m_ptr, 0);
1184         msg_format(_("%^s¤Î­¤ò»Ø¤µ¤·¤¿¡£", "You gesture at %^s's feet."), m_name);
1185
1186                 if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
1187                         (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
1188                 {
1189             msg_format(_("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", "%^s is unaffected!"), m_name);
1190                 }
1191                 else teleport_level(target_m_idx);
1192                 break;
1193         }
1194         case MS_PSY_SPEAR:
1195                 if (!get_aim_dir(&dir)) return FALSE;
1196
1197         msg_print(_("¸÷¤Î·õ¤òÊü¤Ã¤¿¡£", "You throw a psycho-spear."));
1198         damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1199                 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
1200                 break;
1201         case MS_DARKNESS:
1202
1203         msg_print(_("°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", "You gesture in shadow."));
1204                 (void)unlite_area(10, 3);
1205                 break;
1206         case MS_MAKE_TRAP:
1207                 if (!target_set(TARGET_KILL)) return FALSE;
1208
1209         msg_print(_("¼öʸ¤ò¾§¤¨¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", "You cast a spell and cackle evilly."));
1210                 trap_creation(target_row, target_col);
1211                 break;
1212         case MS_FORGET:
1213         msg_print(_("¤·¤«¤·²¿¤âµ¯¤­¤Ê¤«¤Ã¤¿¡£", "Nothing happen."));
1214                 break;
1215     case MS_RAISE_DEAD:
1216         msg_print(_("»à¼ÔÉü³è¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "You cast a animate dead."));
1217                 (void)animate_dead(0, py, px);
1218                 break;
1219         case MS_S_KIN:
1220         {
1221                 int k;
1222
1223         msg_print(_("±ç·³¤ò¾¤´­¤·¤¿¡£", "You summon minions."));
1224                 for (k = 0;k < 1; k++)
1225                 {
1226                         if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L)))
1227                         {
1228                                 if (!pet) msg_print(_("¾¤´­¤µ¤ì¤¿Ãç´Ö¤ÏÅܤäƤ¤¤ë¡ª", "Summoned fellows are angry!"));
1229                         }
1230                         else
1231                         {
1232                                 no_trump = TRUE;
1233                         }
1234                 }
1235                 break;
1236         }
1237         case MS_S_CYBER:
1238         {
1239                 int k;
1240
1241         msg_print(_("¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", "You summon a Cyberdemon!"));
1242                 for (k = 0 ;k < 1 ; k++)
1243                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode))
1244                         {
1245                 if (!pet)
1246                     msg_print(_("¾¤´­¤µ¤ì¤¿¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ÏÅܤäƤ¤¤ë¡ª", "The summoned Cyberdemon are angry!"));
1247                         }
1248                         else
1249                         {
1250                                 no_trump = TRUE;
1251                         }
1252                 break;
1253         }
1254         case MS_S_MONSTER:
1255         {
1256                 int k;
1257         msg_print(_("Ãç´Ö¤ò¾¤´­¤·¤¿¡£", "You summon help."));
1258                 for (k = 0;k < 1; k++)
1259                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode))
1260                         {
1261                 if (!pet)
1262                     msg_print(_("¾¤´­¤µ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤ÏÅܤäƤ¤¤ë¡ª", "The summoned monster is angry!"));
1263                         }
1264                         else
1265                         {
1266                                 no_trump = TRUE;
1267                         }
1268                 break;
1269         }
1270         case MS_S_MONSTERS:
1271         {
1272                 int k;
1273         msg_print(_("¥â¥ó¥¹¥¿¡¼¤ò¾¤´­¤·¤¿¡ª", "You summon monsters!"));
1274                 for (k = 0;k < plev / 15 + 2; k++)
1275                         if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode)))
1276                         {
1277                 if (!pet)
1278                     msg_print(_("¾¤´­¤µ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤ÏÅܤäƤ¤¤ë¡ª", "The summoned monsters are angry!"));
1279                         }
1280                         else
1281                         {
1282                                 no_trump = TRUE;
1283                         }
1284                 break;
1285         }
1286         case MS_S_ANT:
1287         {
1288                 int k;
1289         msg_print(_("¥¢¥ê¤ò¾¤´­¤·¤¿¡£", "You summon ants."));
1290                 for (k = 0;k < 1; k++)
1291                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1292                         {
1293                 if (!pet)
1294                     msg_print(_("¾¤´­¤µ¤ì¤¿¥¢¥ê¤ÏÅܤäƤ¤¤ë¡ª", "The summoned ants are angry!"));
1295                         }
1296                         else
1297                         {
1298                                 no_trump = TRUE;
1299                         }
1300                 break;
1301         }
1302         case MS_S_SPIDER:
1303         {
1304                 int k;
1305         msg_print(_("ÃØéá¤ò¾¤´­¤·¤¿¡£", "You summon spiders."));
1306                 for (k = 0;k < 1; k++)
1307                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1308                         {
1309                 if (!pet)
1310                     msg_print(_("¾¤´­¤µ¤ì¤¿ÃØéá¤ÏÅܤäƤ¤¤ë¡ª", "Summoned spiders are angry!"));
1311                         }
1312                         else
1313                         {
1314                                 no_trump = TRUE;
1315                         }
1316                 break;
1317         }
1318         case MS_S_HOUND:
1319         {
1320                 int k;
1321         msg_print(_("¥Ï¥¦¥ó¥É¤ò¾¤´­¤·¤¿¡£", "You summon hounds."));
1322                 for (k = 0;k < 1; k++)
1323                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1324                         {
1325                 if (!pet)
1326                     msg_print(_("¾¤´­¤µ¤ì¤¿¥Ï¥¦¥ó¥É¤ÏÅܤäƤ¤¤ë¡ª", "Summoned hounds are angry!"));
1327                         }
1328                         else
1329                         {
1330                                 no_trump = TRUE;
1331                         }
1332                 break;
1333         }
1334         case MS_S_HYDRA:
1335         {
1336                 int k;
1337         msg_print(_("¥Ò¥É¥é¤ò¾¤´­¤·¤¿¡£", "You summon a hydras."));
1338                 for (k = 0;k < 1; k++)
1339                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1340                         {
1341                 if (!pet)
1342                     msg_print(_("¾¤´­¤µ¤ì¤¿¥Ò¥É¥é¤ÏÅܤäƤ¤¤ë¡ª", "Summoned hydras are angry!"));
1343                         }
1344                         else
1345                         {
1346                                 no_trump = TRUE;
1347                         }
1348                 break;
1349         }
1350         case MS_S_ANGEL:
1351         {
1352                 int k;
1353         msg_print(_("Å·»È¤ò¾¤´­¤·¤¿¡ª", "You summon an angel!"));
1354                 for (k = 0;k < 1; k++)
1355                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1356                         {
1357                 if (!pet)
1358                     msg_print(_("¾¤´­¤µ¤ì¤¿Å·»È¤ÏÅܤäƤ¤¤ë¡ª", "Summoned angels are angry!"));
1359                         }
1360                         else
1361                         {
1362                                 no_trump = TRUE;
1363                         }
1364                 break;
1365         }
1366         case MS_S_DEMON:
1367         {
1368                 int k;
1369         msg_print(_("º®Æ٤εÜÄ¤é°­Ëâ¤ò¾¤´­¤·¤¿¡ª", "You summon a demon from the Courts of Chaos!"));
1370                 for (k = 0;k < 1; k++)
1371                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1372                         {
1373                 if (!pet)
1374                     msg_print(_("¾¤´­¤µ¤ì¤¿¥Ç¡¼¥â¥ó¤ÏÅܤäƤ¤¤ë¡ª", "Summoned demons are angry!"));
1375                         }
1376                         else
1377                         {
1378                                 no_trump = TRUE;
1379                         }
1380                 break;
1381         }
1382         case MS_S_UNDEAD:
1383         {
1384                 int k;
1385         msg_print(_("¥¢¥ó¥Ç¥Ã¥É¤Î¶¯Å¨¤ò¾¤´­¤·¤¿¡ª", "You summon an undead adversary!"));
1386                 for (k = 0;k < 1; k++)
1387                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1388                         {
1389                 if (!pet)
1390                     msg_print(_("¾¤´­¤µ¤ì¤¿¥¢¥ó¥Ç¥Ã¥É¤ÏÅܤäƤ¤¤ë¡ª", "Summoned undeads are angry!"));
1391                         }
1392                         else
1393                         {
1394                                 no_trump = TRUE;
1395                         }
1396                 break;
1397         }
1398         case MS_S_DRAGON:
1399         {
1400                 int k;
1401         msg_print(_("¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", "You summon a dragon!"));
1402                 for (k = 0;k < 1; k++)
1403                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1404                         {
1405                 if (!pet)
1406                     msg_print(_("¾¤´­¤µ¤ì¤¿¥É¥é¥´¥ó¤ÏÅܤäƤ¤¤ë¡ª", "Summoned dragons are angry!"));
1407                         }
1408                         else
1409                         {
1410                                 no_trump = TRUE;
1411                         }
1412                 break;
1413         }
1414         case MS_S_HI_UNDEAD:
1415         {
1416                 int k;
1417         msg_print(_("¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡ª", "You summon a greater undead!"));
1418                 for (k = 0;k < 1; k++)
1419                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1420                         {
1421                 if (!pet)
1422                     msg_print(_("¾¤´­¤µ¤ì¤¿¾åµé¥¢¥ó¥Ç¥Ã¥É¤ÏÅܤäƤ¤¤ë¡ª", "Summoned greater undeads are angry!"));
1423                         }
1424                         else
1425                         {
1426                                 no_trump = TRUE;
1427                         }
1428                 break;
1429         }
1430         case MS_S_HI_DRAGON:
1431         {
1432                 int k;
1433         msg_print(_("¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", "You summon an ancient dragon!"));
1434                 for (k = 0;k < 1; k++)
1435                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1436                         {
1437                 if (!pet)
1438                     msg_print(_("¾¤´­¤µ¤ì¤¿¸ÅÂå¥É¥é¥´¥ó¤ÏÅܤäƤ¤¤ë¡ª", "Summoned ancient dragons are angry!"));
1439                         }
1440                         else
1441                         {
1442                                 no_trump = TRUE;
1443                         }
1444                 break;
1445         }
1446         case MS_S_AMBERITE:
1447         {
1448                 int k;
1449         msg_print(_("¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ò¾¤´­¤·¤¿¡ª", "You summon a Lord of Amber!"));
1450                 for (k = 0;k < 1; k++)
1451                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1452                         {
1453                 if (!pet)
1454                     msg_print(_("¾¤´­¤µ¤ì¤¿¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ÏÅܤäƤ¤¤ë¡ª", "Summoned Lords of Amber are angry!"));
1455                         }
1456                         else
1457                         {
1458                                 no_trump = TRUE;
1459                         }
1460                 break;
1461         }
1462         case MS_S_UNIQUE:
1463         {
1464                 int k, count = 0;
1465         msg_print(_("ÆÃÊ̤ʶ¯Å¨¤ò¾¤´­¤·¤¿¡ª", "You summon a special opponent!"));
1466                 for (k = 0;k < 1; k++)
1467                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1468                         {
1469                                 count++;
1470                 if (!pet)
1471                     msg_print(_("¾¤´­¤µ¤ì¤¿¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤ÏÅܤäƤ¤¤ë¡ª", "Summoned special opponents are angry!"));
1472                         }
1473                 for (k = count;k < 1; k++)
1474                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1475                         {
1476                                 count++;
1477                 if (!pet)
1478                     msg_print(_("¾¤´­¤µ¤ì¤¿¾åµé¥¢¥ó¥Ç¥Ã¥É¤ÏÅܤäƤ¤¤ë¡ª", "Summoned greater undeads are angry!"));
1479                         }
1480                 if (!count)
1481                 {
1482                         no_trump = TRUE;
1483                 }
1484                 break;
1485         }
1486         default:
1487                 msg_print("hoge?");
1488         }
1489         if (no_trump)
1490     {
1491         msg_print(_("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿¡£", "No one have appeared."));
1492         }
1493
1494         return TRUE;
1495 }
1496
1497 /*!
1498  * @brief ÀÄËâË¡¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
1499  * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1500  * @return ½èÍý¤ò¼Â¹Ô¤·¤¿¤éTRUE¡¢¥­¥ã¥ó¥»¥ë¤·¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
1501  */
1502 bool do_cmd_cast_learned(void)
1503 {
1504         int             n = 0;
1505         int             chance;
1506         int             minfail = 0;
1507         int             plev = p_ptr->lev;
1508         monster_power   spell;
1509         bool            cast;
1510         int             need_mana;
1511
1512
1513         /* not if confused */
1514         if (p_ptr->confused)
1515         {
1516 #ifdef JP
1517 msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
1518 #else
1519                 msg_print("You are too confused!");
1520 #endif
1521
1522                 return TRUE;
1523         }
1524
1525         /* get power */
1526         if (!get_learned_power(&n)) return FALSE;
1527
1528         spell = monster_powers[n];
1529
1530         need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1531
1532         /* Verify "dangerous" spells */
1533         if (need_mana > p_ptr->csp)
1534         {
1535                 /* Warning */
1536 #ifdef JP
1537 msg_print("£Í£Ð¤¬Â­¤ê¤Þ¤»¤ó¡£");
1538 #else
1539                 msg_print("You do not have enough mana to use this power.");
1540 #endif
1541
1542
1543                 if (!over_exert) return FALSE;
1544
1545                 /* Verify */
1546 #ifdef JP
1547 if (!get_check("¤½¤ì¤Ç¤âÄ©À路¤Þ¤¹¤«? ")) return FALSE;
1548 #else
1549                 if (!get_check("Attempt it anyway? ")) return FALSE;
1550 #endif
1551
1552         }
1553
1554         /* Spell failure chance */
1555         chance = spell.fail;
1556
1557         /* Reduce failure rate by "effective" level adjustment */
1558         if (plev > spell.level) chance -= 3 * (plev - spell.level);
1559         else chance += (spell.level - plev);
1560
1561         /* Reduce failure rate by INT/WIS adjustment */
1562         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1563
1564         chance = mod_spell_chance_1(chance);
1565
1566         /* Not enough mana to cast */
1567         if (need_mana > p_ptr->csp)
1568         {
1569                 chance += 5 * (need_mana - p_ptr->csp);
1570         }
1571
1572         /* Extract the minimum failure rate */
1573         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1574
1575         /* Minimum failure rate */
1576         if (chance < minfail) chance = minfail;
1577
1578         /* Stunning makes spells harder */
1579         if (p_ptr->stun > 50) chance += 25;
1580         else if (p_ptr->stun) chance += 15;
1581
1582         /* Always a 5 percent chance of working */
1583         if (chance > 95) chance = 95;
1584
1585         chance = mod_spell_chance_2(chance);
1586
1587         /* Failed spell */
1588         if (randint0(100) < chance)
1589         {
1590                 if (flush_failure) flush();
1591 #ifdef JP
1592 msg_print("ËâË¡¤ò¤¦¤Þ¤¯¾§¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
1593 #else
1594                 msg_print("You failed to concentrate hard enough!");
1595 #endif
1596
1597                 sound(SOUND_FAIL);
1598
1599                 if (n >= MS_S_KIN)
1600                         /* Cast the spell */
1601                         cast = cast_learned_spell(n, FALSE);
1602         }
1603         else
1604         {
1605                 sound(SOUND_ZAP);
1606
1607                 /* Cast the spell */
1608                 cast = cast_learned_spell(n, TRUE);
1609
1610                 if (!cast) return FALSE;
1611         }
1612
1613         /* Sufficient mana */
1614         if (need_mana <= p_ptr->csp)
1615         {
1616                 /* Use some mana */
1617                 p_ptr->csp -= need_mana;
1618         }
1619         else
1620         {
1621                 int oops = need_mana;
1622
1623                 /* No mana left */
1624                 p_ptr->csp = 0;
1625                 p_ptr->csp_frac = 0;
1626
1627                 /* Message */
1628 #ifdef JP
1629 msg_print("Àº¿À¤ò½¸Ã椷¤¹¤®¤Æµ¤¤ò¼º¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
1630 #else
1631                 msg_print("You faint from the effort!");
1632 #endif
1633
1634
1635                 /* Hack -- Bypass free action */
1636                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1637
1638                 chg_virtue(V_KNOWLEDGE, -10);
1639
1640                 /* Damage CON (possibly permanently) */
1641                 if (randint0(100) < 50)
1642                 {
1643                         bool perm = (randint0(100) < 25);
1644
1645                         /* Message */
1646 #ifdef JP
1647 msg_print("ÂΤò°­¤¯¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
1648 #else
1649                         msg_print("You have damaged your health!");
1650 #endif
1651
1652
1653                         /* Reduce constitution */
1654                         (void)dec_stat(A_CON, 15 + randint1(10), perm);
1655                 }
1656         }
1657
1658         /* Take a turn */
1659         energy_use = 100;
1660
1661         /* Window stuff */
1662         p_ptr->redraw |= (PR_MANA);
1663         p_ptr->window |= (PW_PLAYER);
1664         p_ptr->window |= (PW_SPELL);
1665
1666         return TRUE;
1667 }
1668
1669 /*!
1670  * @brief ÀÄËâË¡¤Î¥é¡¼¥Ë¥ó¥°È½Äê¤ÈÀ®¸ù¤·¤¿¾ì¹ç¤Î¥é¡¼¥Ë¥ó¥°½èÍý
1671  * @param monspell ¥é¡¼¥Ë¥ó¥°¤ò»î¤ß¤ë¥â¥ó¥¹¥¿¡¼¹¶·â¤ÎID
1672  * @return ¤Ê¤·
1673  */
1674 void learn_spell(int monspell)
1675 {
1676         if (p_ptr->action != ACTION_LEARN) return;
1677         if (monspell < 0) return; /* Paranoia */
1678         if (p_ptr->magic_num2[monspell]) return;
1679         if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1680         if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1681         {
1682                 p_ptr->magic_num2[monspell] = 1;
1683 #ifdef JP
1684                 msg_format("%s¤ò³Ø½¬¤·¤¿¡ª", monster_powers[monspell].name);
1685 #else
1686                 msg_format("You have learned %s!", monster_powers[monspell].name);
1687 #endif
1688                 gain_exp(monster_powers[monspell].level * monster_powers[monspell].smana);
1689
1690                 /* Sound */
1691                 sound(SOUND_STUDY);
1692
1693                 new_mane = TRUE;
1694                 p_ptr->redraw |= (PR_STATE);
1695         }
1696 }
1697
1698
1699 /*!
1700  * @brief ¥â¥ó¥¹¥¿¡¼ÆüìǽÎϤΥե饰ÇÛÎ󤫤éÆÃÄê¾ò·ï¤ÎËâË¡¤À¤±¤òÈ´¤­½Ð¤¹½èÍý
1701  * Extract monster spells mask for the given mode
1702  * @param f4 ¥â¥ó¥¹¥¿¡¼ÆüìǽÎϤÎ4ÈÖÌܤΥե饰ÇÛÎó
1703  * @param f5 ¥â¥ó¥¹¥¿¡¼ÆüìǽÎϤÎ5ÈÖÌܤΥե饰ÇÛÎó
1704  * @param f6 ¥â¥ó¥¹¥¿¡¼ÆüìǽÎϤÎ6ÈÖÌܤΥե饰ÇÛÎó
1705  * @param mode È´¤­½Ð¤·¤¿¤¤¾ò·ï
1706  * @return ¤Ê¤·
1707  */
1708 /*
1709  */
1710 void set_rf_masks(s32b *f4, s32b *f5, s32b *f6, int mode)
1711 {
1712         switch (mode)
1713         {
1714                 case MONSPELL_TYPE_BOLT:
1715                         *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1716                         *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1717                         *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1718                         break;
1719
1720                 case MONSPELL_TYPE_BALL:
1721                         *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1722                         *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1723                         *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1724                         break;
1725
1726                 case MONSPELL_TYPE_BREATH:
1727                         *f4 = RF4_BREATH_MASK;
1728                         *f5 = RF5_BREATH_MASK;
1729                         *f6 = RF6_BREATH_MASK;
1730                         break;
1731
1732                 case MONSPELL_TYPE_SUMMON:
1733                         *f4 = RF4_SUMMON_MASK;
1734                         *f5 = RF5_SUMMON_MASK;
1735                         *f6 = RF6_SUMMON_MASK;
1736                         break;
1737
1738                 case MONSPELL_TYPE_OTHER:
1739                         *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1740                         *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1741                         *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);
1742                         break;
1743         }
1744
1745         return;
1746 }