OSDN Git Service

Refacotr: replace ifdef JP macros
[hengbandforosx/hengbandosx.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         cptr            p = _("魔法", "magic");
220
221         monster_power   spell;
222         bool            flag, redraw;
223         int menu_line = (use_menu ? 1 : 0);
224
225         /* Assume cancelled */
226         *sn = (-1);
227
228         /* Nothing chosen yet */
229         flag = FALSE;
230
231         /* No redraw yet */
232         redraw = FALSE;
233
234 #ifdef ALLOW_REPEAT /* TNB */
235
236         /* Get the spell, if available */
237         if (repeat_pull(sn))
238         {
239                 /* Success */
240                 return (TRUE);
241         }
242
243 #endif /* ALLOW_REPEAT -- TNB */
244
245         if (use_menu)
246         {
247                 screen_save();
248
249                 while(!mode)
250                 {
251 #ifdef JP
252                         prt(format(" %s ボルト", (menu_line == 1) ? "》" : "  "), 2, 14);
253                         prt(format(" %s ボール", (menu_line == 2) ? "》" : "  "), 3, 14);
254                         prt(format(" %s ブレス", (menu_line == 3) ? "》" : "  "), 4, 14);
255                         prt(format(" %s 召喚", (menu_line == 4) ? "》" : "  "), 5, 14);
256                         prt(format(" %s その他", (menu_line == 5) ? "》" : "  "), 6, 14);
257                         prt("どの種類の魔法を使いますか?", 0, 0);
258 #else
259                         prt(format(" %s bolt", (menu_line == 1) ? "> " : "  "), 2, 14);
260                         prt(format(" %s ball", (menu_line == 2) ? "> " : "  "), 3, 14);
261                         prt(format(" %s breath", (menu_line == 3) ? "> " : "  "), 4, 14);
262                         prt(format(" %s sommoning", (menu_line == 4) ? "> " : "  "), 5, 14);
263                         prt(format(" %s others", (menu_line == 5) ? "> " : "  "), 6, 14);
264                         prt("use which type of magic? ", 0, 0);
265 #endif
266                         choice = inkey();
267                         switch(choice)
268                         {
269                         case ESCAPE:
270                         case 'z':
271                         case 'Z':
272                                 screen_load();
273                                 return FALSE;
274                         case '2':
275                         case 'j':
276                         case 'J':
277                                 menu_line++;
278                                 break;
279                         case '8':
280                         case 'k':
281                         case 'K':
282                                 menu_line+= 4;
283                                 break;
284                         case '\r':
285                         case 'x':
286                         case 'X':
287                                 mode = menu_line;
288                                 break;
289                         }
290                         if (menu_line > 5) menu_line -= 5;
291                 }
292                 screen_load();
293         }
294         else
295         {
296         sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
297         while (TRUE)
298         {
299                 if (!get_com(comment, &ch, TRUE))
300                 {
301                         return FALSE;
302                 }
303                 if (ch == 'A' || ch == 'a')
304                 {
305                         mode = 1;
306                         break;
307                 }
308                 if (ch == 'B' || ch == 'b')
309                 {
310                         mode = 2;
311                         break;
312                 }
313                 if (ch == 'C' || ch == 'c')
314                 {
315                         mode = 3;
316                         break;
317                 }
318                 if (ch == 'D' || ch == 'd')
319                 {
320                         mode = 4;
321                         break;
322                 }
323                 if (ch == 'E' || ch == 'e')
324                 {
325                         mode = 5;
326                         break;
327                 }
328         }
329         }
330
331         set_rf_masks(&f4, &f5, &f6, mode);
332
333         for (i = 0, num = 0; i < 32; i++)
334         {
335                 if ((0x00000001 << i) & f4) spellnum[num++] = i;
336         }
337         for (; i < 64; i++)
338         {
339                 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
340         }
341         for (; i < 96; i++)
342         {
343                 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
344         }
345         for (i = 0; i < num; i++)
346         {
347                 if (p_ptr->magic_num2[spellnum[i]])
348                 {
349                         if (use_menu) menu_line = i+1;
350                         break;
351                 }
352         }
353         if (i == num)
354         {
355                 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
356                 return (FALSE);
357         }
358
359         /* Build a prompt (accept all spells) */
360         (void)strnfmt(out_val, 78, 
361                       _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
362                       I2A(0), I2A(num - 1), p);
363
364         if (use_menu) screen_save();
365
366         /* Get a spell from the user */
367
368         choice= (always_show_list || use_menu) ? ESCAPE:1 ;
369         while (!flag)
370         {
371                 if(choice==ESCAPE) choice = ' '; 
372                 else if( !get_com(out_val, &choice, TRUE) )break; 
373
374                 if (use_menu && choice != ' ')
375                 {
376                         switch(choice)
377                         {
378                                 case '0':
379                                 {
380                                         screen_load();
381                                         return (FALSE);
382                                 }
383
384                                 case '8':
385                                 case 'k':
386                                 case 'K':
387                                 {
388                                         do
389                                         {
390                                                 menu_line += (num-1);
391                                                 if (menu_line > num) menu_line -= num;
392                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
393                                         break;
394                                 }
395
396                                 case '2':
397                                 case 'j':
398                                 case 'J':
399                                 {
400                                         do
401                                         {
402                                                 menu_line++;
403                                                 if (menu_line > num) menu_line -= num;
404                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
405                                         break;
406                                 }
407
408                                 case '6':
409                                 case 'l':
410                                 case 'L':
411                                 {
412                                         menu_line=num;
413                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
414                                         break;
415                                 }
416
417                                 case '4':
418                                 case 'h':
419                                 case 'H':
420                                 {
421                                         menu_line=1;
422                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
423                                         break;
424                                 }
425
426                                 case 'x':
427                                 case 'X':
428                                 case '\r':
429                                 {
430                                         i = menu_line - 1;
431                                         ask = FALSE;
432                                         break;
433                                 }
434                         }
435                 }
436                 /* Request redraw */
437                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
438                 {
439                         /* Show the list */
440                         if (!redraw || use_menu)
441                         {
442                                 char psi_desc[80];
443
444                                 /* Show list */
445                                 redraw = TRUE;
446
447                                 /* Save the screen */
448                                 if (!use_menu) screen_save();
449
450                                 /* Display a list of spells */
451                                 prt("", y, x);
452                                 put_str(_("名前", "Name"), y, x + 5);
453                                 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
454
455
456                                 /* Dump the spells */
457                                 for (i = 0; i < num; i++)
458                                 {
459                                         int need_mana;
460
461                                         prt("", y + i + 1, x);
462                                         if (!p_ptr->magic_num2[spellnum[i]]) continue;
463
464                                         /* Access the spell */
465                                         spell = monster_powers[spellnum[i]];
466
467                                         chance = spell.fail;
468
469                                         /* Reduce failure rate by "effective" level adjustment */
470                                         if (plev > spell.level) chance -= 3 * (plev - spell.level);
471                                         else chance += (spell.level - plev);
472
473                                         /* Reduce failure rate by INT/WIS adjustment */
474                                         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
475
476                                         chance = mod_spell_chance_1(chance);
477
478                                         need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
479
480                                         /* Not enough mana to cast */
481                                         if (need_mana > p_ptr->csp)
482                                         {
483                                                 chance += 5 * (need_mana - p_ptr->csp);
484                                         }
485
486                                         /* Extract the minimum failure rate */
487                                         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
488
489                                         /* Minimum failure rate */
490                                         if (chance < minfail) chance = minfail;
491
492                                         /* Stunning makes spells harder */
493                                         if (p_ptr->stun > 50) chance += 25;
494                                         else if (p_ptr->stun) chance += 15;
495
496                                         /* Always a 5 percent chance of working */
497                                         if (chance > 95) chance = 95;
498
499                                         chance = mod_spell_chance_2(chance);
500
501                                         /* Get info */
502                                         learned_info(comment, spellnum[i]);
503
504                                         if (use_menu)
505                                         {
506                                                 if (i == (menu_line-1)) strcpy(psi_desc, _("  》", "  > "));
507                                                 else strcpy(psi_desc, "    ");
508                                         }
509                                         else sprintf(psi_desc, "  %c)", I2A(i));
510
511                                         /* Dump the spell --(-- */
512                                         strcat(psi_desc, format(" %-26s %3d %3d%%%s",
513                                                 spell.name, need_mana,
514                                                 chance, comment));
515                                         prt(psi_desc, y + i + 1, x);
516                                 }
517
518                                 /* Clear the bottom line */
519                                 if (y < 22) prt("", y + i + 1, x);
520                         }
521
522                         /* Hide the list */
523                         else
524                         {
525                                 /* Hide list */
526                                 redraw = FALSE;
527
528                                 /* Restore the screen */
529                                 screen_load();
530                         }
531
532                         /* Redo asking */
533                         continue;
534                 }
535
536                 if (!use_menu)
537                 {
538                         /* Note verify */
539                         ask = isupper(choice);
540
541                         /* Lowercase */
542                         if (ask) choice = tolower(choice);
543
544                         /* Extract request */
545                         i = (islower(choice) ? A2I(choice) : -1);
546                 }
547
548                 /* Totally Illegal */
549                 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
550                 {
551                         bell();
552                         continue;
553                 }
554
555                 /* Save the spell index */
556                 spell = monster_powers[spellnum[i]];
557
558                 /* Verify it */
559                 if (ask)
560                 {
561                         char tmp_val[160];
562
563                         /* Prompt */
564                         (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
565
566                         /* Belay that order */
567                         if (!get_check(tmp_val)) continue;
568                 }
569
570                 /* Stop the loop */
571                 flag = TRUE;
572         }
573
574         /* Restore the screen */
575         if (redraw) screen_load();
576
577         /* Show choices */
578         p_ptr->window |= (PW_SPELL);
579
580         /* Window stuff */
581         window_stuff();
582
583         /* Abort if needed */
584         if (!flag) return (FALSE);
585
586         /* Save the choice */
587         (*sn) = spellnum[i];
588
589 #ifdef ALLOW_REPEAT /* TNB */
590
591         repeat_push(*sn);
592
593 #endif /* ALLOW_REPEAT -- TNB */
594
595         /* Success */
596         return (TRUE);
597 }
598
599
600 /*!
601  * @brief 青魔法の発動 /
602  * do_cmd_cast calls this function if the player's class is 'blue-mage'.
603  * @param spell 発動するモンスター攻撃のID
604  * @param success TRUEは成功時、FALSEは失敗時の処理を行う
605  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
606  */
607 static bool cast_learned_spell(int spell, bool success)
608 {
609         int             dir;
610         int             plev = pseudo_plev();
611         int     summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
612         int             hp = p_ptr->chp;
613         int             damage = 0;
614         bool   pet = success;
615         bool   no_trump = FALSE;
616         u32b p_mode, u_mode = 0L, g_mode;
617
618         if (pet)
619         {
620                 p_mode = PM_FORCE_PET;
621                 g_mode = 0;
622         }
623         else
624         {
625                 p_mode = PM_NO_PET;
626                 g_mode = PM_ALLOW_GROUP;
627         }
628
629         if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
630
631         /* spell code */
632         switch (spell)
633         {
634         case MS_SHRIEK:
635         msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
636                 aggravate_monsters(0);
637                 break;
638         case MS_XXX1:
639                 break;
640         case MS_DISPEL:
641         {
642                 int m_idx;
643
644                 if (!target_set(TARGET_KILL)) return FALSE;
645                 m_idx = cave[target_row][target_col].m_idx;
646                 if (!m_idx) break;
647                 if (!player_has_los_bold(target_row, target_col)) break;
648                 if (!projectable(py, px, target_row, target_col)) break;
649                 dispel_monster_status(m_idx);
650                 break;
651         }
652         case MS_ROCKET:
653                 if (!get_aim_dir(&dir)) return FALSE;
654                 
655         msg_print(_("ロケットを発射した。", "You fire a rocket."));
656         damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
657                 fire_rocket(GF_ROCKET, dir, damage, 2);
658                 break;
659         case MS_SHOOT:
660         {
661                 object_type *o_ptr = NULL;
662
663                 if (!get_aim_dir(&dir)) return FALSE;
664                 
665         msg_print(_("矢を放った。", "You fire an arrow."));
666         damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
667                 fire_bolt(GF_ARROW, dir, damage);
668                 break;
669         }
670         case MS_XXX2:
671                 break;
672         case MS_XXX3:
673                 break;
674         case MS_XXX4:
675                 break;
676         case MS_BR_ACID:
677                 if (!get_aim_dir(&dir)) return FALSE;
678
679         msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
680         damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
681                 fire_ball(GF_ACID, dir, damage, (plev > 40 ? -3 : -2));
682                 break;
683         case MS_BR_ELEC:
684                 if (!get_aim_dir(&dir)) return FALSE;
685
686         msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
687         damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
688                 fire_ball(GF_ELEC, dir, damage, (plev > 40 ? -3 : -2));
689                 break;
690         case MS_BR_FIRE:
691                 if (!get_aim_dir(&dir)) return FALSE;
692
693         msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
694         damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
695                 fire_ball(GF_FIRE, dir, damage, (plev > 40 ? -3 : -2));
696                 break;
697         case MS_BR_COLD:
698         if (!get_aim_dir(&dir)) return FALSE;
699
700         msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
701         damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
702                 fire_ball(GF_COLD, dir, damage, (plev > 40 ? -3 : -2));
703                 break;
704         case MS_BR_POIS:
705         if (!get_aim_dir(&dir)) return FALSE;
706
707         msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
708         damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
709                 fire_ball(GF_POIS, dir, damage, (plev > 40 ? -3 : -2));
710                 break;
711         case MS_BR_NETHER:
712         if (!get_aim_dir(&dir)) return FALSE;
713
714         msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
715         damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
716                 fire_ball(GF_NETHER, dir, damage, (plev > 40 ? -3 : -2));
717                 break;
718         case MS_BR_LITE:
719                 if (!get_aim_dir(&dir)) return FALSE;
720
721         msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
722         damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
723                 fire_ball(GF_LITE, dir, damage, (plev > 40 ? -3 : -2));
724                 break;
725         case MS_BR_DARK:
726                 if (!get_aim_dir(&dir)) return FALSE;
727
728         msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
729         damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
730                 fire_ball(GF_DARK, dir, damage, (plev > 40 ? -3 : -2));
731                 break;
732         case MS_BR_CONF:
733                 if (!get_aim_dir(&dir)) return FALSE;
734
735         msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
736         damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
737                 fire_ball(GF_CONFUSION, dir, damage, (plev > 40 ? -3 : -2));
738                 break;
739         case MS_BR_SOUND:
740                 if (!get_aim_dir(&dir)) return FALSE;
741
742         msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
743         damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
744                 fire_ball(GF_SOUND, dir, damage, (plev > 40 ? -3 : -2));
745                 break;
746         case MS_BR_CHAOS:
747                 if (!get_aim_dir(&dir)) return FALSE;
748
749         msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
750         damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
751                 fire_ball(GF_CHAOS, dir, damage, (plev > 40 ? -3 : -2));
752                 break;
753         case MS_BR_DISEN:
754                 if (!get_aim_dir(&dir)) return FALSE;
755
756         msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
757         damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
758                 fire_ball(GF_DISENCHANT, dir, damage, (plev > 40 ? -3 : -2));
759                 break;
760         case MS_BR_NEXUS:
761                 if (!get_aim_dir(&dir)) return FALSE;
762
763         msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
764         damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
765                 fire_ball(GF_NEXUS, dir, damage, (plev > 40 ? -3 : -2));
766                 break;
767         case MS_BR_TIME:
768                 if (!get_aim_dir(&dir)) return FALSE;
769
770         msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
771         damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
772                 fire_ball(GF_TIME, dir, damage, (plev > 40 ? -3 : -2));
773                 break;
774         case MS_BR_INERTIA:
775                 if (!get_aim_dir(&dir)) return FALSE;
776
777         msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
778         damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
779                 fire_ball(GF_INERTIA, dir, damage, (plev > 40 ? -3 : -2));
780                 break;
781         case MS_BR_GRAVITY:
782                 if (!get_aim_dir(&dir)) return FALSE;
783
784         msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
785         damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
786                 fire_ball(GF_GRAVITY, dir, damage, (plev > 40 ? -3 : -2));
787                 break;
788         case MS_BR_SHARDS:
789         if (!get_aim_dir(&dir)) return FALSE;
790
791         msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
792         damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
793                 fire_ball(GF_SHARDS, dir, damage, (plev > 40 ? -3 : -2));
794                 break;
795         case MS_BR_PLASMA:
796         if (!get_aim_dir(&dir)) return FALSE;
797
798         msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
799         damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
800                 fire_ball(GF_PLASMA, dir, damage, (plev > 40 ? -3 : -2));
801                 break;
802         case MS_BR_FORCE:
803         if (!get_aim_dir(&dir)) return FALSE;
804
805         msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
806         damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
807                 fire_ball(GF_FORCE, dir, damage, (plev > 40 ? -3 : -2));
808                 break;
809         case MS_BR_MANA:
810                 if (!get_aim_dir(&dir)) return FALSE;
811
812         msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
813         damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
814                 fire_ball(GF_MANA, dir, damage, (plev > 40 ? -3 : -2));
815                 break;
816         case MS_BALL_NUKE:
817                 if (!get_aim_dir(&dir)) return FALSE;
818
819         msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
820         damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
821                 fire_ball(GF_NUKE, dir, damage, 2);
822                 break;
823         case MS_BR_NUKE:
824                 if (!get_aim_dir(&dir)) return FALSE;
825
826         msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
827         damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
828                 fire_ball(GF_NUKE, dir, damage, (plev > 40 ? -3 : -2));
829                 break;
830         case MS_BALL_CHAOS:
831                 if (!get_aim_dir(&dir)) return FALSE;
832
833         msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
834         damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
835                 fire_ball(GF_CHAOS, dir, damage, 4);
836                 break;
837         case MS_BR_DISI:
838                 if (!get_aim_dir(&dir)) return FALSE;
839
840         msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
841         damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
842                 fire_ball(GF_DISINTEGRATE, dir, damage, (plev > 40 ? -3 : -2));
843                 break;
844         case MS_BALL_ACID:
845                 if (!get_aim_dir(&dir)) return FALSE;
846
847         msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
848         damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
849                 fire_ball(GF_ACID, dir, damage, 2);
850                 break;
851         case MS_BALL_ELEC:
852         if (!get_aim_dir(&dir)) return FALSE;
853
854         msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
855         damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
856                 fire_ball(GF_ELEC, dir, damage, 2);
857                 break;
858         case MS_BALL_FIRE:
859                 if (!get_aim_dir(&dir)) return FALSE;
860
861         msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
862         damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
863                 fire_ball(GF_FIRE, dir, damage, 2);
864                 break;
865         case MS_BALL_COLD:
866         if (!get_aim_dir(&dir)) return FALSE;
867
868         msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
869         damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
870                 fire_ball(GF_COLD, dir, damage, 2);
871                 break;
872         case MS_BALL_POIS:
873                 if (!get_aim_dir(&dir)) return FALSE;
874
875         msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
876         damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
877                 fire_ball(GF_POIS, dir, damage, 2);
878                 break;
879         case MS_BALL_NETHER:
880         if (!get_aim_dir(&dir)) return FALSE;
881
882         msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
883         damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
884                 fire_ball(GF_NETHER, dir, damage, 2);
885                 break;
886         case MS_BALL_WATER:
887                 if (!get_aim_dir(&dir)) return FALSE;
888
889         msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
890         damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
891                 fire_ball(GF_WATER, dir, damage, 4);
892                 break;
893         case MS_BALL_MANA:
894         if (!get_aim_dir(&dir)) return FALSE;
895
896         msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
897         damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
898                 fire_ball(GF_MANA, dir, damage, 4);
899                 break;
900         case MS_BALL_DARK:
901                 if (!get_aim_dir(&dir)) return FALSE;
902
903         msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
904         damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
905                 fire_ball(GF_DARK, dir, damage, 4);
906                 break;
907         case MS_DRAIN_MANA:
908                 if (!get_aim_dir(&dir)) return FALSE;
909
910         damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
911         fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
912                 break;
913         case MS_MIND_BLAST:
914                 if (!get_aim_dir(&dir)) return FALSE;
915
916         damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
917                 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
918                 break;
919         case MS_BRAIN_SMASH:
920         if (!get_aim_dir(&dir)) return FALSE;
921
922         damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
923                 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
924                 break;
925         case MS_CAUSE_1:
926                 if (!get_aim_dir(&dir)) return FALSE;
927
928         damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
929                 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
930                 break;
931         case MS_CAUSE_2:
932                 if (!get_aim_dir(&dir)) return FALSE;
933
934         damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
935                 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
936                 break;
937         case MS_CAUSE_3:
938                 if (!get_aim_dir(&dir)) return FALSE;
939
940         damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
941                 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
942                 break;
943         case MS_CAUSE_4:
944                 if (!get_aim_dir(&dir)) return FALSE;
945
946         damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
947                 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
948                 break;
949         case MS_BOLT_ACID:
950                 if (!get_aim_dir(&dir)) return FALSE;
951
952         msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
953         damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
954         fire_bolt(GF_ACID, dir, damage);
955                 break;
956         case MS_BOLT_ELEC:
957                 if (!get_aim_dir(&dir)) return FALSE;
958
959         msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
960         damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
961                 fire_bolt(GF_ELEC, dir, damage);
962                 break;
963         case MS_BOLT_FIRE:
964                 if (!get_aim_dir(&dir)) return FALSE;
965
966         msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
967         damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
968                 fire_bolt(GF_FIRE, dir, damage);
969                 break;
970         case MS_BOLT_COLD:
971                 if (!get_aim_dir(&dir)) return FALSE;
972
973         msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
974         damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
975                 fire_bolt(GF_COLD, dir, damage);
976                 break;
977         case MS_STARBURST:
978                 if (!get_aim_dir(&dir)) return FALSE;
979
980         msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
981         damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
982                 fire_ball(GF_LITE, dir, damage, 4);
983                 break;
984         case MS_BOLT_NETHER:
985                 if (!get_aim_dir(&dir)) return FALSE;
986
987         msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
988         damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
989                 fire_bolt(GF_NETHER, dir, damage);
990                 break;
991         case MS_BOLT_WATER:
992                 if (!get_aim_dir(&dir)) return FALSE;
993
994         msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
995         damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
996                 fire_bolt(GF_WATER, dir, damage);
997                 break;
998         case MS_BOLT_MANA:
999                 if (!get_aim_dir(&dir)) return FALSE;
1000
1001         msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1002         damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1003                 fire_bolt(GF_MANA, dir, damage);
1004                 break;
1005         case MS_BOLT_PLASMA:
1006                 if (!get_aim_dir(&dir)) return FALSE;
1007
1008         msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1009         damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1010                 fire_bolt(GF_PLASMA, dir, damage);
1011                 break;
1012         case MS_BOLT_ICE:
1013                 if (!get_aim_dir(&dir)) return FALSE;
1014
1015         msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1016         damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1017                 fire_bolt(GF_ICE, dir, damage);
1018                 break;
1019         case MS_MAGIC_MISSILE:
1020                 if (!get_aim_dir(&dir)) return FALSE;
1021
1022         msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1023         damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1024                 fire_bolt(GF_MISSILE, dir, damage);
1025                 break;
1026         case MS_SCARE:
1027                 if (!get_aim_dir(&dir)) return FALSE;
1028
1029         msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1030                 fear_monster(dir, plev+10);
1031                 break;
1032         case MS_BLIND:
1033                 if (!get_aim_dir(&dir)) return FALSE;
1034                 confuse_monster(dir, plev * 2);
1035                 break;
1036         case MS_CONF:
1037                 if (!get_aim_dir(&dir)) return FALSE;
1038
1039         msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1040                 confuse_monster(dir, plev * 2);
1041                 break;
1042         case MS_SLOW:
1043                 if (!get_aim_dir(&dir)) return FALSE;
1044                 slow_monster(dir, plev);
1045                 break;
1046         case MS_SLEEP:
1047                 if (!get_aim_dir(&dir)) return FALSE;
1048                 sleep_monster(dir, plev);
1049                 break;
1050         case MS_SPEED:
1051                 (void)set_fast(randint1(20 + plev) + plev, FALSE);
1052                 break;
1053         case MS_HAND_DOOM:
1054         {
1055                 if (!get_aim_dir(&dir)) return FALSE;
1056
1057         msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1058                 fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
1059                 break;
1060         }
1061         case MS_HEAL:
1062         msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1063                 (void)hp_player(plev*4);
1064                 (void)set_stun(0);
1065                 (void)set_cut(0);
1066                 break;
1067         case MS_INVULNER:
1068         msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1069                 (void)set_invuln(randint1(4) + 4, FALSE);
1070                 break;
1071         case MS_BLINK:
1072                 teleport_player(10, 0L);
1073                 break;
1074         case MS_TELEPORT:
1075                 teleport_player(plev * 5, 0L);
1076                 break;
1077         case MS_WORLD:
1078         world_player = TRUE;
1079         msg_print(_("「時よ!」", "'Time!'"));
1080                 msg_print(NULL);
1081
1082                 /* Hack */
1083                 p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;
1084
1085                 /* Redraw map */
1086                 p_ptr->redraw |= (PR_MAP);
1087
1088                 /* Update monsters */
1089                 p_ptr->update |= (PU_MONSTERS);
1090
1091                 /* Window stuff */
1092                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1093
1094                 handle_stuff();
1095                 break;
1096         case MS_SPECIAL:
1097                 break;
1098         case MS_TELE_TO:
1099         {
1100                 monster_type *m_ptr;
1101                 monster_race *r_ptr;
1102                 char m_name[80];
1103
1104                 if (!target_set(TARGET_KILL)) return FALSE;
1105                 if (!cave[target_row][target_col].m_idx) break;
1106                 if (!player_has_los_bold(target_row, target_col)) break;
1107                 if (!projectable(py, px, target_row, target_col)) break;
1108                 m_ptr = &m_list[cave[target_row][target_col].m_idx];
1109                 r_ptr = &r_info[m_ptr->r_idx];
1110                 monster_desc(m_name, m_ptr, 0);
1111                 if (r_ptr->flagsr & RFR_RES_TELE)
1112                 {
1113                         if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1114                         {
1115                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1116                 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1117                                 break;
1118                         }
1119                         else if (r_ptr->level > randint1(100))
1120                         {
1121                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1122                 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1123                                 break;
1124                         }
1125                 }
1126         msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1127                 teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE);
1128                 break;
1129         }
1130         case MS_TELE_AWAY:
1131                 if (!get_aim_dir(&dir)) return FALSE;
1132
1133                 (void)fire_beam(GF_AWAY_ALL, dir, 100);
1134                 break;
1135         case MS_TELE_LEVEL:
1136         {
1137                 int target_m_idx;
1138                 monster_type *m_ptr;
1139                 monster_race *r_ptr;
1140                 char m_name[80];
1141
1142                 if (!target_set(TARGET_KILL)) return FALSE;
1143                 target_m_idx = cave[target_row][target_col].m_idx;
1144                 if (!target_m_idx) break;
1145                 if (!player_has_los_bold(target_row, target_col)) break;
1146                 if (!projectable(py, px, target_row, target_col)) break;
1147                 m_ptr = &m_list[target_m_idx];
1148                 r_ptr = &r_info[m_ptr->r_idx];
1149                 monster_desc(m_name, m_ptr, 0);
1150         msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
1151
1152                 if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
1153                         (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
1154                 {
1155             msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
1156                 }
1157                 else teleport_level(target_m_idx);
1158                 break;
1159         }
1160         case MS_PSY_SPEAR:
1161                 if (!get_aim_dir(&dir)) return FALSE;
1162
1163         msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1164         damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1165                 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
1166                 break;
1167         case MS_DARKNESS:
1168
1169         msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1170                 (void)unlite_area(10, 3);
1171                 break;
1172         case MS_MAKE_TRAP:
1173                 if (!target_set(TARGET_KILL)) return FALSE;
1174
1175         msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1176                 trap_creation(target_row, target_col);
1177                 break;
1178         case MS_FORGET:
1179         msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1180                 break;
1181     case MS_RAISE_DEAD:
1182         msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
1183                 (void)animate_dead(0, py, px);
1184                 break;
1185         case MS_S_KIN:
1186         {
1187                 int k;
1188
1189         msg_print(_("援軍を召喚した。", "You summon minions."));
1190                 for (k = 0;k < 1; k++)
1191                 {
1192                         if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L)))
1193                         {
1194                                 if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
1195                         }
1196                         else
1197                         {
1198                                 no_trump = TRUE;
1199                         }
1200                 }
1201                 break;
1202         }
1203         case MS_S_CYBER:
1204         {
1205                 int k;
1206
1207         msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1208                 for (k = 0 ;k < 1 ; k++)
1209                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode))
1210                         {
1211                 if (!pet)
1212                     msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1213                         }
1214                         else
1215                         {
1216                                 no_trump = TRUE;
1217                         }
1218                 break;
1219         }
1220         case MS_S_MONSTER:
1221         {
1222                 int k;
1223         msg_print(_("仲間を召喚した。", "You summon help."));
1224                 for (k = 0;k < 1; k++)
1225                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode))
1226                         {
1227                 if (!pet)
1228                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1229                         }
1230                         else
1231                         {
1232                                 no_trump = TRUE;
1233                         }
1234                 break;
1235         }
1236         case MS_S_MONSTERS:
1237         {
1238                 int k;
1239         msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1240                 for (k = 0;k < plev / 15 + 2; k++)
1241                         if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode)))
1242                         {
1243                 if (!pet)
1244                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1245                         }
1246                         else
1247                         {
1248                                 no_trump = TRUE;
1249                         }
1250                 break;
1251         }
1252         case MS_S_ANT:
1253         {
1254                 int k;
1255         msg_print(_("アリを召喚した。", "You summon ants."));
1256                 for (k = 0;k < 1; k++)
1257                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1258                         {
1259                 if (!pet)
1260                     msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1261                         }
1262                         else
1263                         {
1264                                 no_trump = TRUE;
1265                         }
1266                 break;
1267         }
1268         case MS_S_SPIDER:
1269         {
1270                 int k;
1271         msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1272                 for (k = 0;k < 1; k++)
1273                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1274                         {
1275                 if (!pet)
1276                     msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1277                         }
1278                         else
1279                         {
1280                                 no_trump = TRUE;
1281                         }
1282                 break;
1283         }
1284         case MS_S_HOUND:
1285         {
1286                 int k;
1287         msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1288                 for (k = 0;k < 1; k++)
1289                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1290                         {
1291                 if (!pet)
1292                     msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1293                         }
1294                         else
1295                         {
1296                                 no_trump = TRUE;
1297                         }
1298                 break;
1299         }
1300         case MS_S_HYDRA:
1301         {
1302                 int k;
1303         msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1304                 for (k = 0;k < 1; k++)
1305                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1306                         {
1307                 if (!pet)
1308                     msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1309                         }
1310                         else
1311                         {
1312                                 no_trump = TRUE;
1313                         }
1314                 break;
1315         }
1316         case MS_S_ANGEL:
1317         {
1318                 int k;
1319         msg_print(_("天使を召喚した!", "You summon an angel!"));
1320                 for (k = 0;k < 1; k++)
1321                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1322                         {
1323                 if (!pet)
1324                     msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
1325                         }
1326                         else
1327                         {
1328                                 no_trump = TRUE;
1329                         }
1330                 break;
1331         }
1332         case MS_S_DEMON:
1333         {
1334                 int k;
1335         msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1336                 for (k = 0;k < 1; k++)
1337                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1338                         {
1339                 if (!pet)
1340                     msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
1341                         }
1342                         else
1343                         {
1344                                 no_trump = TRUE;
1345                         }
1346                 break;
1347         }
1348         case MS_S_UNDEAD:
1349         {
1350                 int k;
1351         msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1352                 for (k = 0;k < 1; k++)
1353                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1354                         {
1355                 if (!pet)
1356                     msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
1357                         }
1358                         else
1359                         {
1360                                 no_trump = TRUE;
1361                         }
1362                 break;
1363         }
1364         case MS_S_DRAGON:
1365         {
1366                 int k;
1367         msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1368                 for (k = 0;k < 1; k++)
1369                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1370                         {
1371                 if (!pet)
1372                     msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
1373                         }
1374                         else
1375                         {
1376                                 no_trump = TRUE;
1377                         }
1378                 break;
1379         }
1380         case MS_S_HI_UNDEAD:
1381         {
1382                 int k;
1383         msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1384                 for (k = 0;k < 1; k++)
1385                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1386                         {
1387                 if (!pet)
1388                     msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1389                         }
1390                         else
1391                         {
1392                                 no_trump = TRUE;
1393                         }
1394                 break;
1395         }
1396         case MS_S_HI_DRAGON:
1397         {
1398                 int k;
1399         msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1400                 for (k = 0;k < 1; k++)
1401                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1402                         {
1403                 if (!pet)
1404                     msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
1405                         }
1406                         else
1407                         {
1408                                 no_trump = TRUE;
1409                         }
1410                 break;
1411         }
1412         case MS_S_AMBERITE:
1413         {
1414                 int k;
1415         msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1416                 for (k = 0;k < 1; k++)
1417                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1418                         {
1419                 if (!pet)
1420                     msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
1421                         }
1422                         else
1423                         {
1424                                 no_trump = TRUE;
1425                         }
1426                 break;
1427         }
1428         case MS_S_UNIQUE:
1429         {
1430                 int k, count = 0;
1431         msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1432                 for (k = 0;k < 1; k++)
1433                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1434                         {
1435                                 count++;
1436                 if (!pet)
1437                     msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
1438                         }
1439                 for (k = count;k < 1; k++)
1440                         if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1441                         {
1442                                 count++;
1443                 if (!pet)
1444                     msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1445                         }
1446                 if (!count)
1447                 {
1448                         no_trump = TRUE;
1449                 }
1450                 break;
1451         }
1452         default:
1453                 msg_print("hoge?");
1454         }
1455         if (no_trump)
1456     {
1457         msg_print(_("何も現れなかった。", "No one have appeared."));
1458         }
1459
1460         return TRUE;
1461 }
1462
1463 /*!
1464  * @brief 青魔法コマンドのメインルーチン /
1465  * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1466  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1467  */
1468 bool do_cmd_cast_learned(void)
1469 {
1470         int             n = 0;
1471         int             chance;
1472         int             minfail = 0;
1473         int             plev = p_ptr->lev;
1474         monster_power   spell;
1475         bool            cast;
1476         int             need_mana;
1477
1478
1479         /* not if confused */
1480         if (p_ptr->confused)
1481         {
1482                 msg_print(_("混乱していて唱えられない!", "You are too confused!"));
1483                 return TRUE;
1484         }
1485
1486         /* get power */
1487         if (!get_learned_power(&n)) return FALSE;
1488
1489         spell = monster_powers[n];
1490
1491         need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1492
1493         /* Verify "dangerous" spells */
1494         if (need_mana > p_ptr->csp)
1495         {
1496                 /* Warning */
1497                 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1498
1499                 if (!over_exert) return FALSE;
1500
1501                 /* Verify */
1502                 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1503         }
1504
1505         /* Spell failure chance */
1506         chance = spell.fail;
1507
1508         /* Reduce failure rate by "effective" level adjustment */
1509         if (plev > spell.level) chance -= 3 * (plev - spell.level);
1510         else chance += (spell.level - plev);
1511
1512         /* Reduce failure rate by INT/WIS adjustment */
1513         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1514
1515         chance = mod_spell_chance_1(chance);
1516
1517         /* Not enough mana to cast */
1518         if (need_mana > p_ptr->csp)
1519         {
1520                 chance += 5 * (need_mana - p_ptr->csp);
1521         }
1522
1523         /* Extract the minimum failure rate */
1524         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1525
1526         /* Minimum failure rate */
1527         if (chance < minfail) chance = minfail;
1528
1529         /* Stunning makes spells harder */
1530         if (p_ptr->stun > 50) chance += 25;
1531         else if (p_ptr->stun) chance += 15;
1532
1533         /* Always a 5 percent chance of working */
1534         if (chance > 95) chance = 95;
1535
1536         chance = mod_spell_chance_2(chance);
1537
1538         /* Failed spell */
1539         if (randint0(100) < chance)
1540         {
1541                 if (flush_failure) flush();
1542                 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1543
1544                 sound(SOUND_FAIL);
1545
1546                 if (n >= MS_S_KIN)
1547                         /* Cast the spell */
1548                         cast = cast_learned_spell(n, FALSE);
1549         }
1550         else
1551         {
1552                 sound(SOUND_ZAP);
1553
1554                 /* Cast the spell */
1555                 cast = cast_learned_spell(n, TRUE);
1556
1557                 if (!cast) return FALSE;
1558         }
1559
1560         /* Sufficient mana */
1561         if (need_mana <= p_ptr->csp)
1562         {
1563                 /* Use some mana */
1564                 p_ptr->csp -= need_mana;
1565         }
1566         else
1567         {
1568                 int oops = need_mana;
1569
1570                 /* No mana left */
1571                 p_ptr->csp = 0;
1572                 p_ptr->csp_frac = 0;
1573
1574                 /* Message */
1575                 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1576
1577                 /* Hack -- Bypass free action */
1578                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1579
1580                 chg_virtue(V_KNOWLEDGE, -10);
1581
1582                 /* Damage CON (possibly permanently) */
1583                 if (randint0(100) < 50)
1584                 {
1585                         bool perm = (randint0(100) < 25);
1586
1587                         /* Message */
1588                         msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1589
1590                         /* Reduce constitution */
1591                         (void)dec_stat(A_CON, 15 + randint1(10), perm);
1592                 }
1593         }
1594
1595         /* Take a turn */
1596         energy_use = 100;
1597
1598         /* Window stuff */
1599         p_ptr->redraw |= (PR_MANA);
1600         p_ptr->window |= (PW_PLAYER);
1601         p_ptr->window |= (PW_SPELL);
1602
1603         return TRUE;
1604 }
1605
1606 /*!
1607  * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1608  * @param monspell ラーニングを試みるモンスター攻撃のID
1609  * @return なし
1610  */
1611 void learn_spell(int monspell)
1612 {
1613         if (p_ptr->action != ACTION_LEARN) return;
1614         if (monspell < 0) return; /* Paranoia */
1615         if (p_ptr->magic_num2[monspell]) return;
1616         if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1617         if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1618         {
1619                 p_ptr->magic_num2[monspell] = 1;
1620                 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1621                 gain_exp(monster_powers[monspell].level * monster_powers[monspell].smana);
1622
1623                 /* Sound */
1624                 sound(SOUND_STUDY);
1625
1626                 new_mane = TRUE;
1627                 p_ptr->redraw |= (PR_STATE);
1628         }
1629 }
1630
1631
1632 /*!
1633  * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1634  * Extract monster spells mask for the given mode
1635  * @param f4 モンスター特殊能力の4番目のフラグ配列
1636  * @param f5 モンスター特殊能力の5番目のフラグ配列
1637  * @param f6 モンスター特殊能力の6番目のフラグ配列
1638  * @param mode 抜き出したい条件
1639  * @return なし
1640  */
1641 /*
1642  */
1643 void set_rf_masks(s32b *f4, s32b *f5, s32b *f6, int mode)
1644 {
1645         switch (mode)
1646         {
1647                 case MONSPELL_TYPE_BOLT:
1648                         *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1649                         *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1650                         *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1651                         break;
1652
1653                 case MONSPELL_TYPE_BALL:
1654                         *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1655                         *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1656                         *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1657                         break;
1658
1659                 case MONSPELL_TYPE_BREATH:
1660                         *f4 = RF4_BREATH_MASK;
1661                         *f5 = RF5_BREATH_MASK;
1662                         *f6 = RF6_BREATH_MASK;
1663                         break;
1664
1665                 case MONSPELL_TYPE_SUMMON:
1666                         *f4 = RF4_SUMMON_MASK;
1667                         *f5 = RF5_SUMMON_MASK;
1668                         *f6 = RF6_SUMMON_MASK;
1669                         break;
1670
1671                 case MONSPELL_TYPE_OTHER:
1672                         *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1673                         *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1674                         *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);
1675                         break;
1676         }
1677
1678         return;
1679 }