OSDN Git Service

3ccbc879d3bd4134e074420886056bc27d015c2b
[hengband/hengband.git] / src / mind.c
1 /*!
2  * @file mind.c
3  * @brief 各職業の特殊技能実装 / Special magics
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  * 2005 henkma \n
11  * 2014 Deskull rearranged comment for Doxygen.\n
12  * @details
13  * mind.cとあるが実際には超能力者、練気術師、狂戦士、鏡使い、忍者までの
14  * 特殊技能を揃えて実装している。
15  */
16
17
18
19 #include "angband.h"
20 #include "mindtips.h"
21
22 /*! 特殊技能の一覧テーブル */
23 mind_power mind_powers[5] =
24 {
25   {
26     {
27       /* Level gained,  cost,  %fail,  name */
28 #ifdef JP
29       { 1,   1,  15, "霊視"},
30       { 2,   1,  20, "神経攻撃"},
31       { 3,   2,  25, "次元の瞬き"},
32       { 7,   6,  35, "虚空の幻影"},
33       { 9,   7,  50, "精神支配"},
34       { 11,  7,  30, "念動衝撃弾"},
35       { 13, 12,  50, "鎧化"},
36       { 15, 12,  60, "サイコメトリー"},
37       { 18, 10,  45, "精神波動"},
38       { 23, 15,  50, "アドレナリン・ドーピング"},
39       { 26, 28,  60, "テレキネシス"},
40       { 28, 10,  40, "サイキック・ドレイン"},
41       { 35, 35,  75, "光の剣"},
42       { 45,150,  85, "完全な世界"},
43       { 99,  0,   0, ""},
44       { 99,  0,   0, ""},
45       { 99,  0,   0, ""},
46       { 99,  0,   0, ""},
47       { 99,  0,   0, ""},
48       { 99,  0,   0, ""},
49       { 99,  0,   0, ""},
50 #else
51       { 1,   1,  15, "Precognition"},
52       { 2,   1,  20, "Neural Blast"},
53       { 3,   2,  25, "Minor Displacement"},
54       { 7,   6,  35, "Major Displacement"},
55       { 9,   7,  50, "Domination"},
56       { 11,  7,  30, "Pulverise"},
57       { 13, 12,  50, "Character Armour"},
58       { 15, 12,  60, "Psychometry" },
59       { 18, 10,  45, "Mind Wave" },
60       { 23, 15,  50, "Adrenaline Channeling"},
61       { 26, 28,  60, "Telekinesis"},
62       { 28, 10,  40, "Psychic Drain"},
63       { 35, 35,  75, "Psycho-Spear"},
64       { 45,150,  85, "The World"},
65       { 99,  0,   0, ""},
66       { 99,  0,   0, ""},
67       { 99,  0,   0, ""},
68       { 99,  0,   0, ""},
69       { 99,  0,   0, ""},
70       { 99,  0,   0, ""},
71       { 99,  0,   0, ""},
72 #endif
73       
74     }
75   },
76   
77   {
78     {
79       /* Level gained,  cost,  %fail,  name */
80 #ifdef JP
81       { 1,   1,  15, "小龍"},
82       { 3,   3,  30, "閃光"},
83       { 5,   6,  35, "舞空術"},
84       { 8,   5,  40, "カメハメ波"},
85       { 10,  7,  45, "対魔法防御"},
86       { 13,  5,  60, "練気"},
87       { 17, 17,  50, "纏闘気"},
88       { 20, 20,  50, "衝波"},
89       { 23, 18,  55, "彗龍"},
90       { 25, 30,  70, "いてつく波動"},
91       { 28, 26,  50, "幻霊召喚"},
92       { 32, 35,  65, "煉獄火炎"},
93       { 38, 42,  75, "超カメハメ波"},
94       { 44, 50,  80, "光速移動"},
95       { 99,  0,   0, ""},
96       { 99,  0,   0, ""},
97       { 99,  0,   0, ""},
98       { 99,  0,   0, ""},
99       { 99,  0,   0, ""},
100       { 99,  0,   0, ""},
101       { 99,  0,   0, ""},
102 #else
103       { 1,   1,  15, "Small Force Ball"},
104       { 3,   3,  30, "Flash Light"},
105       { 5,   6,  35, "Flying Technique"},
106       { 8,   5,  40, "Kamehameha"},
107       { 10,  7,  45, "Magic Resistance"},
108       { 13,  5,  60, "Improve Force"},
109       { 17, 17,  50, "Aura of Force"},
110       { 20, 20,  50, "Shock Power"},
111       { 23, 18,  55, "Large Force Ball"},
112       { 25, 30,  70, "Dispel Magic"},
113       { 28, 26,  50, "Summon Ghost"},
114       { 32, 35,  65, "Exploding Frame"},
115       { 38, 42,  75, "Super Kamehameha"},
116       { 44, 50,  80, "Light Speed"},
117       { 99,  0,   0, ""},
118       { 99,  0,   0, ""},
119       { 99,  0,   0, ""},
120       { 99,  0,   0, ""},
121       { 99,  0,   0, ""},
122       { 99,  0,   0, ""},
123       { 99,  0,   0, ""},
124 #endif
125       
126     }
127   },
128   
129   {
130     {
131       /* Level gained,  cost,  %fail,  name */
132 #ifdef JP
133       {  8,  5,  40, "殺気感知"},
134       { 15, 20,   0, "突撃"},
135       { 20, 15,   0, "トラップ粉砕"},
136       { 25, 20,  60, "地震"},
137       { 30, 80,  75, "皆殺し"},
138       { 99,  0,   0, ""},
139       { 99,  0,   0, ""},
140       { 99,  0,   0, ""},
141       { 99,  0,   0, ""},
142       { 99,  0,   0, ""},
143       { 99,  0,   0, ""},
144       { 99,  0,   0, ""},
145       { 99,  0,   0, ""},
146       { 99,  0,   0, ""},
147       { 99,  0,   0, ""},
148       { 99,  0,   0, ""},
149       { 99,  0,   0, ""},
150       { 99,  0,   0, ""},
151       { 99,  0,   0, ""},
152       { 99,  0,   0, ""},
153       { 99,  0,   0, ""},
154 #else
155       {  8,  5,  40, "Detect Atmosphere of Menace"},
156       { 15, 20,   0, "Charge"},
157       { 20, 15,   0, "Smash a Trap"},
158       { 25, 20,  60, "Quake"},
159       { 30, 80,  75, "Massacre"},
160       { 99,  0,   0, ""},
161       { 99,  0,   0, ""},
162       { 99,  0,   0, ""},
163       { 99,  0,   0, ""},
164       { 99,  0,   0, ""},
165       { 99,  0,   0, ""},
166       { 99,  0,   0, ""},
167       { 99,  0,   0, ""},
168       { 99,  0,   0, ""},
169       { 99,  0,   0, ""},
170       { 99,  0,   0, ""},
171       { 99,  0,   0, ""},
172       { 99,  0,   0, ""},
173       { 99,  0,   0, ""},
174       { 99,  0,   0, ""},
175       { 99,  0,   0, ""},
176 #endif
177       
178     }
179   },
180
181   {
182     {
183       /* Level gained,  cost,  %fail,  name */
184 #ifdef JP
185       { 1,   1,  15, "真見の鏡"},
186       { 1,   2,  40, "鏡生成"},
187       { 2,   2,  20, "光のしずく"},
188       { 3,   2,  20, "歪んだ鏡"},
189       { 5,   3,  35, "閃光鏡"},
190       { 6,   5,  35, "彷える鏡"},
191
192       { 10,  5,  30, "微塵隠れ"},
193       { 12, 12,  30, "追放の鏡"},
194       { 15, 15,  30, "鏡砕き"},
195       { 19, 13,  30, "催眠鏡"},
196       { 23, 18,  50, "シーカーレイ"},
197
198       { 25, 20,  40, "鏡の封印"},
199       { 27, 30,  60, "水鏡の盾"},
200       { 29, 30,  60, "スーパーレイ"},
201       { 31, 35,  60, "幻惑の光"},
202       { 33, 50,  80, "鏡の国"},
203
204       { 36, 30,  80, "鏡抜け"},
205       { 38, 40,  70, "帰還の鏡"},
206       { 40, 50,  55, "影分身"},
207       { 43, 55,  70, "封魔結界"},
208       { 46, 70,  75, "ラフノールの鏡"},
209 #else
210       { 1,   1,  15, "Mirror of Seeing"},
211       { 1,   2,  40, "Making a Mirror"},
212       { 2,   2,  20, "Drip of Light"},
213       { 3,   2,  20, "Warped Mirror"},
214       { 5,   3,  35, "Mirror of Light"},
215       { 6,   5,  35, "Mirror of Wandering"},
216
217       { 10,  5,  30, "Robe of Dust"},
218       { 12, 12,  30, "Banishing Mirror"},
219       { 15, 15,  30, "Mirror Clashing"},
220       { 19, 13,  30, "Mirror Sleeping"},
221       { 23, 18,  50, "Seeker Ray"},
222
223       { 25, 20,  40, "Seal of Mirror"},
224       { 27, 30,  60, "Shield of Water"},
225       { 29, 30,  60, "Super Ray"},
226       { 31, 35,  60, "Illusion Light"},
227       { 33, 50,  80, "Mirror Shift"},
228
229       { 36, 30,  80, "Mirror Tunnel"},
230       { 38, 40,  70, "Mirror of Recall"},
231       { 40, 50,  55, "Multi-Shadow"},
232       { 43, 55,  70, "Binding Field"},
233       { 46, 70,  75, "Mirror of Ruffnor"},
234 #endif
235       
236     }
237   },
238   
239   {
240     {
241       /* Level gained,  cost,  %fail,  name */
242 #ifdef JP
243       {  1,  1,  20, "暗闇生成"},
244       {  2,  2,  25, "周辺調査"},
245       {  3,  3,  25, "葉隠れ"},
246       {  5,  3,  30, "変わり身"},
247       {  7,  8,  35, "高飛び"},
248       {  8, 10,  35, "一撃離脱"},
249       { 10, 10,  40, "金縛り"},
250       { 12, 12,  70, "古の口伝"},
251       { 15, 10,  50, "浮雲"},
252       { 17, 12,  45, "火遁"},
253       { 18, 20,  40, "入身"},
254       { 20,  5,  50, "八方手裏剣"},
255       { 22, 15,  55, "鎖鎌"},
256       { 25, 32,  60, "煙玉"},
257       { 28, 32,  60, "転身"},
258       { 30, 30,  70, "爆発の紋章"},
259       { 32, 40,  40, "土遁"},
260       { 34, 35,  50, "霧隠れ"},
261       { 38, 40,  60, "煉獄火炎"},
262       { 41, 50,  55, "分身"},
263       { 99,  0,   0, ""},
264 #else
265       {  1,  1,  20, "Create Darkness"},
266       {  2,  2,  25, "Detect Near"},
267       {  3,  3,  25, "Hide in Leafs"},
268       {  5,  3,  30, "Kawarimi"},
269       {  7,  8,  35, "Absconding"},
270       {  8, 10,  35, "Hit and Away"},
271       { 10, 10,  40, "Bind Monster"},
272       { 12, 12,  70, "Ancient Knowledge"},
273       { 15, 10,  50, "Floating"},
274       { 17, 12,  45, "Hide in Flame"},
275       { 18, 20,  40, "Nyusin"},
276       { 20,  5,  50, "Syuriken Spreading"},
277       { 22, 15,  55, "Chain Hook"},
278       { 25, 32,  60, "Smoke Ball"},
279       { 28, 32,  60, "Swap Position"},
280       { 30, 30,  70, "Glyph of Explosion"},
281       { 32, 40,  40, "Hide in Mud"},
282       { 34, 35,  50, "Hide in Mist"},
283       { 38, 40,  60, "Rengoku-Kaen"},
284       { 41, 50,  55, "Bunshin"},
285       { 99,  0,   0, ""},
286 #endif
287       
288     }
289   },
290 };
291
292 /*!
293  * @brief 特殊技能の効果情報をまとめたフォーマットを返す
294  * @param p 情報を返す文字列参照ポインタ
295  * @param use_mind 職業毎の特殊技能ID
296  * @param power モンスター魔法のID
297  * @return なし
298  */
299 void mindcraft_info(char *p, int use_mind, int power)
300 {
301 #ifdef JP
302         cptr s_dam = "損傷:";
303         cptr s_dur = "期間:";
304         cptr s_range = "範囲:";
305 #else
306         cptr s_dam = "dam ";
307         cptr s_dur = "dur ";
308         cptr s_range = "range ";
309 #endif
310         int plev = p_ptr->lev;
311
312         strcpy(p, "");
313
314         switch (use_mind)
315         {
316         case MIND_MINDCRAFTER:
317                 switch (power)
318                 {
319                 case 0:  break;
320                 case 1:  sprintf(p, " %s%dd%d", s_dam, 3 + ((plev - 1) / 4), 3 + plev/15); break;
321                 case 2:  sprintf(p, " %s10", s_range); break;
322                 case 3:  sprintf(p, " %s%d", s_range, plev * 5);  break;
323                 case 4:  break;
324                 case 5: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 4));  break;
325                 case 6:  sprintf(p, " %s%d", s_dur, plev);  break;
326                 case 7:  break;
327                 case 8:  sprintf(p, (plev < 25 ? " %s%d" : " %sd%d"), s_dam, (plev < 25 ? plev * 3 / 2 : plev * ((plev - 5) / 10 + 1))); break;
328                 case 9:  sprintf(p, " %s10+d%d", s_dur, plev * 3 / 2);  break;
329 #ifdef JP
330                 case 10: sprintf(p, " 最大重量:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15));  break;
331 #else
332                 case 10: sprintf(p, " max wgt %d", plev * 15);  break;
333 #endif
334                 case 11: sprintf(p, " %s%dd6", s_dam, plev / 2);  break;
335                 case 12: sprintf(p, " %sd%d+%d", s_dam, plev * 3, plev * 3); break;
336                 case 13: sprintf(p, _(" 行動:%ld回", " %ld acts."), (long int)(p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
337                 }
338                 break;
339         case MIND_KI:
340         {
341                 int boost = p_ptr->magic_num1[0];
342
343                 if (heavy_armor()) boost /= 2;
344
345                 switch (power)
346                 {
347                 case 0:  sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) + boost / 12); break;
348                 case 1:  break;
349                 case 2:  sprintf(p, " %s%d+d30", s_dur, 30 + boost / 5); break;
350                 case 3:  sprintf(p, " %s%dd5", s_dam, 5 + ((plev - 1) / 5) + boost / 10); break;
351                 case 4:  sprintf(p, " %s%d+d20", s_dur, 20 + boost / 5); break;
352                 case 5:  break;
353                 case 6:  sprintf(p, " %s%d+d%d", s_dur, 15 + boost / 7, plev / 2); break;
354                 case 7:  sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 5) + boost / 12); break;
355                 case 8:  sprintf(p, " %s10d6+%d", s_dam, plev * 3 / 2 + boost * 3 / 5); break;
356                 case 9:  break;
357                 case 10: sprintf(p, _(" 最大%d体", " max %d"), 1+boost/100); break;
358                 case 11: sprintf(p, " %s%d", s_dam, 100 + plev + boost); break;
359                 case 12: sprintf(p, " %s%dd15", s_dam, 10 + plev / 2 + boost * 3 / 10); break;
360                 case 13: sprintf(p, _(" 行動:%d+d16回", " %d+d16 acts"), 16+boost/20); break;
361                 }
362                 break;
363         }
364         case MIND_MIRROR_MASTER:
365         {
366                 switch (power)
367                 {
368                 case 0:  break;
369                 case 1:  break;
370                 case 2:  sprintf(p, " %s%dd4", s_dam,  3 + ((plev - 1) / 5) ); break;
371                 case 3:  sprintf(p, " %s10", s_range); break;
372                 case 4:  break;
373                 case 5:  sprintf(p, " %s%d", s_range, plev *5); break;
374                 case 6:  sprintf(p, " %s20+d20", s_dur);  break;
375                 case 7:  break;
376                 case 8:  sprintf(p, " %s%dd8", s_dam, 8+((plev -5)/4) ); break;
377                 case 9:  break;
378                 case 10: sprintf(p, " %s%dd8", s_dam, 11+(plev-5)/4 ); break;
379                 case 11: break;
380                 case 12: sprintf(p, " %s20+d20", s_dur);  break;
381                 case 13: sprintf(p, " %s150+d%d", s_dam, plev*2 ); break;
382                 case 14: break;
383                 case 15: break;
384                 case 16: sprintf(p, " %s%d", s_range, plev/2 +10); break;
385                 case 17: break;
386                 case 18: sprintf(p, " %s6+d6", s_dur);  break;
387                 case 19: sprintf(p, " %s%d", s_dam, plev*11+5 ); break;
388                 case 20: sprintf(p, " %s4+d4", s_dur);  break;
389                 }
390                 break;
391         }
392         case MIND_NINJUTSU:
393         {
394                 switch (power)
395                 {
396                 case 0:  break;
397                 case 1:  break;
398                 case 2:  sprintf(p, " %s10", s_range); break;
399                 case 3:  break;
400                 case 4:  sprintf(p, " %s%d", s_range , plev *5); break;
401                 case 5:  sprintf(p, " %s30", s_range); break;
402                 case 6:  break;
403                 case 7:  break;
404                 case 8:  sprintf(p, " %s20+d20", s_dur);  break;
405                 case 9:  sprintf(p, " %s%d", s_dam, (50+plev)/2 ); break;
406                 case 10: break;
407                 case 11: break;
408                 case 12: break;
409                 case 13: break;
410                 case 14: break;
411                 case 15: break;
412                 case 16: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2);  break;
413                 case 17: sprintf(p, " %s%d*3", s_dam, (75+plev*2/3)/2 ); break;
414                 case 18: sprintf(p, " %s%dd10", s_dam, 6+plev/8 ); break;
415                 case 19: sprintf(p, " %s6+d6", s_dur);  break;
416                 }
417                 break;
418         }
419         }
420 }
421
422 /*!
423  * @brief 使用可能な特殊技能を選択する /
424  * Allow user to choose a mindcrafter power.
425  * @param sn 選択した特殊技能ID、キャンセルの場合-1、不正な選択の場合-2を返す
426  * @param only_browse 一覧を見るだけの場合TRUEを返す
427  * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
428  * @details
429  * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
430  * If the user hits escape, returns FALSE, and set '*sn' to -1\n
431  * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
432  *\n
433  * The "prompt" should be "cast", "recite", or "study"\n
434  * The "known" should be TRUE for cast/pray, FALSE for study\n
435  *\n
436  * nb: This function has a (trivial) display bug which will be obvious\n
437  * when you run it. It's probably easy to fix but I haven't tried,\n
438  * sorry.\n
439  */
440   static int get_mind_power(int *sn, bool only_browse)
441     {
442       int             i;
443       int             num = 0;
444       int             y = 1;
445       int             x = 10;
446       int             minfail = 0;
447       int             plev = p_ptr->lev;
448       int             chance = 0;
449       int             ask = TRUE;
450       char            choice;
451       char            out_val[160];
452       char            comment[80];
453       cptr            p;
454
455       mind_type       spell;
456       mind_power      *mind_ptr;
457       bool            flag, redraw;
458       int             use_mind;
459       int menu_line = (use_menu ? 1 : 0);
460
461       switch(p_ptr->pclass)
462         {
463         case CLASS_MINDCRAFTER:
464           {
465             use_mind = MIND_MINDCRAFTER;
466             p = _("超能力", "mindcraft");
467             break;
468           }
469         case CLASS_FORCETRAINER:
470           {
471             use_mind = MIND_KI;
472             p = _("練気術", "Force");
473             break;
474           }
475         case CLASS_BERSERKER:
476           {
477             use_mind = MIND_BERSERKER;
478             p = _("技", "brutal power");
479             break;
480           }
481         case CLASS_MIRROR_MASTER:
482           {
483             use_mind = MIND_MIRROR_MASTER;
484             p = _("鏡魔法", "magic");
485             break;
486           }
487         case CLASS_NINJA:
488           {
489             use_mind = MIND_NINJUTSU;
490             p = _("忍術", "ninjutsu");
491             break;
492           }
493         default:
494           {
495             use_mind = 0;
496             p = _("超能力", "mindcraft");
497             break;
498           }
499         }
500       mind_ptr = &mind_powers[use_mind];
501
502         /* Assume cancelled */
503       *sn = (-1);
504
505 #ifdef ALLOW_REPEAT /* TNB */
506
507         /* Get the spell, if available */
508         if (repeat_pull(sn))
509         {
510                 /* Hack -- If requested INVEN_FORCE(1111), pull again */
511                 if (*sn == INVEN_FORCE) repeat_pull(sn);
512
513                 /* Verify the spell */
514                 if (mind_ptr->info[*sn].min_lev <= plev)
515                 {
516                         /* Success */
517                         return (TRUE);
518                 }
519         }
520
521 #endif /* ALLOW_REPEAT -- TNB */
522
523     /* Nothing chosen yet */
524     flag = FALSE;
525
526     /* No redraw yet */
527     redraw = FALSE;
528
529     for (i = 0; i < MAX_MIND_POWERS; i++)
530         {
531           if (mind_ptr->info[i].min_lev <= plev)
532             {
533               num++;
534             }
535         }
536
537     /* Build a prompt (accept all spells) */
538     if (only_browse)
539         {
540                 (void) strnfmt(out_val, 78, 
541                                         _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
542                                        p, I2A(0), I2A(num - 1), p);
543         }
544         else
545         {
546                 (void) strnfmt(out_val, 78, 
547                                         _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
548                                                 p, I2A(0), I2A(num - 1), p);
549         }
550
551         if (use_menu && !only_browse) screen_save();
552         /* Get a spell from the user */
553
554         choice= (always_show_list || use_menu) ? ESCAPE:1 ;
555         while (!flag)
556         {
557                 if(choice==ESCAPE) choice = ' '; 
558                 else if( !get_com(out_val, &choice, TRUE) )break;
559
560                 if (use_menu && choice != ' ')
561                 {
562                         switch(choice)
563                         {
564                                 case '0':
565                                 {
566                                         if (!only_browse) screen_load();
567                                         return (FALSE);
568                                 }
569
570                                 case '8':
571                                 case 'k':
572                                 case 'K':
573                                 {
574                                         menu_line += (num - 1);
575                                         break;
576                                 }
577
578                                 case '2':
579                                 case 'j':
580                                 case 'J':
581                                 {
582                                         menu_line++;
583                                         break;
584                                 }
585
586                                 case 'x':
587                                 case 'X':
588                                 case '\r':
589                                 case '\n':
590                                 {
591                                         i = menu_line - 1;
592                                         ask = FALSE;
593                                         break;
594                                 }
595                         }
596                         if (menu_line > num) menu_line -= num;
597                 }
598                 /* Request redraw */
599                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
600                 {
601                         /* Show the list */
602                         if (!redraw || use_menu)
603                         {
604                                 char psi_desc[80];
605                                 bool has_weapon[2];
606
607                                 /* Show list */
608                                 redraw = TRUE;
609
610                                 /* Save the screen */
611                                 if (!only_browse && !use_menu) screen_save();
612
613                                 /* Display a list of spells */
614                                 prt("", y, x);
615                                 put_str(_("名前", "Name"), y, x + 5);
616
617 #ifdef JP
618 put_str(format("Lv   %s   失率 効果", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
619 #else
620 put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
621 #endif
622                                 has_weapon[0] = buki_motteruka(INVEN_RARM);
623                                 has_weapon[1] = buki_motteruka(INVEN_LARM);
624
625                                 /* Dump the spells */
626                                 for (i = 0; i < MAX_MIND_POWERS; i++)
627                                 {
628                                         int mana_cost;
629
630                                         /* Access the spell */
631                                         spell = mind_ptr->info[i];
632
633                                         if (spell.min_lev > plev)   break;
634
635                                         chance = spell.fail;
636
637                                         mana_cost = spell.mana_cost;
638                                         if (chance)
639                                         {
640
641                                                 /* Reduce failure rate by "effective" level adjustment */
642                                                 chance -= 3 * (plev - spell.min_lev);
643
644                                                 /* Reduce failure rate by INT/WIS adjustment */
645                                                 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
646
647                                                 if (use_mind == MIND_KI)
648                                                 {
649                                                         if (heavy_armor()) chance += 20;
650                                                         if (p_ptr->icky_wield[0]) chance += 20;
651                                                         else if (has_weapon[0]) chance += 10;
652                                                         if (p_ptr->icky_wield[1]) chance += 20;
653                                                         else if (has_weapon[1]) chance += 10;
654                                                         if (i == 5)
655                                                         {
656                                                                 int j;
657                                                                 for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
658                                                                         mana_cost += (j+1) * 3 / 2;
659                                                         }
660                                                 }
661
662                                                 /* Not enough mana to cast */
663                                                 if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU) && (mana_cost > p_ptr->csp))
664                                                 {
665                                                         chance += 5 * (mana_cost - p_ptr->csp);
666                                                 }
667
668                                                 chance += p_ptr->to_m_chance;
669
670                                                 /* Extract the minimum failure rate */
671                                                 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
672
673                                                 /* Minimum failure rate */
674                                                 if (chance < minfail) chance = minfail;
675
676                                                 /* Stunning makes spells harder */
677                                                 if (p_ptr->stun > 50) chance += 25;
678                                                 else if (p_ptr->stun) chance += 15;
679
680                                                 if (use_mind == MIND_KI)
681                                                 {
682                                                         if (heavy_armor()) chance += 5;
683                                                         if (p_ptr->icky_wield[0]) chance += 5;
684                                                         if (p_ptr->icky_wield[1]) chance += 5;
685                                                 }
686                                                 /* Always a 5 percent chance of working */
687                                                 if (chance > 95) chance = 95;
688                                         }
689
690                                         /* Get info */
691                                         mindcraft_info(comment, use_mind, i);
692
693                                         if (use_menu)
694                                         {
695                                                 if (i == (menu_line-1)) strcpy(psi_desc, _("  》 ", "  >  "));
696                                                 else strcpy(psi_desc, "     ");
697                                         }
698                                         else
699                                                 sprintf(psi_desc, "  %c) ",I2A(i));
700                                         /* Dump the spell --(-- */
701                                         strcat(psi_desc,
702                                                format("%-30s%2d %4d%s %3d%%%s",
703                                                       spell.name, spell.min_lev, mana_cost,
704 #ifdef JP
705                                                       (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "~" : "  "), 
706 #else
707                                                       (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "~ " : "  "), 
708 #endif
709                                                       chance, comment));
710                                         prt(psi_desc, y + i + 1, x);
711                                 }
712
713                                 /* Clear the bottom line */
714                                 prt("", y + i + 1, x);
715                         }
716
717                         /* Hide the list */
718                         else if (!only_browse)
719                         {
720                                 /* Hide list */
721                                 redraw = FALSE;
722
723                                 /* Restore the screen */
724                                 screen_load();
725                         }
726
727                         /* Redo asking */
728                         continue;
729                 }
730
731                 if (!use_menu)
732                 {
733                         /* Note verify */
734                         ask = isupper(choice);
735
736                         /* Lowercase */
737                         if (ask) choice = tolower(choice);
738
739                         /* Extract request */
740                         i = (islower(choice) ? A2I(choice) : -1);
741                 }
742
743                 /* Totally Illegal */
744                 if ((i < 0) || (i >= num))
745                 {
746                         bell();
747                         continue;
748                 }
749
750                 /* Save the spell index */
751                 spell = mind_ptr->info[i];
752
753                 /* Verify it */
754                 if (ask)
755                 {
756                         char tmp_val[160];
757
758                         /* Prompt */
759                         (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), spell.name);
760
761                         /* Belay that order */
762                         if (!get_check(tmp_val)) continue;
763                 }
764
765                 /* Stop the loop */
766                 flag = TRUE;
767         }
768
769         /* Restore the screen */
770         if (redraw && !only_browse) screen_load();
771
772         /* Show choices */
773         p_ptr->window |= (PW_SPELL);
774
775         /* Window stuff */
776         window_stuff();
777
778         /* Abort if needed */
779         if (!flag) return (FALSE);
780
781         /* Save the choice */
782         (*sn) = i;
783
784 #ifdef ALLOW_REPEAT /* TNB */
785
786         repeat_push(*sn);
787
788 #endif /* ALLOW_REPEAT -- TNB */
789
790         /* Success */
791         return (TRUE);
792 }
793
794 /*!
795  * @brief 超能力の発動 /
796  * do_cmd_cast calls this function if the player's class is 'mindcrafter'.
797  * @param spell 発動する特殊技能のID
798  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
799  */
800 static bool cast_mindcrafter_spell(int spell)
801 {
802         int             b = 0;
803         int             dir;
804         int             plev = p_ptr->lev;
805
806         /* spell code */
807         switch (spell)
808         {
809         case 0:   /* Precog */
810                 if (plev > 44)
811                 {
812                         chg_virtue(V_KNOWLEDGE, 1);
813                         chg_virtue(V_ENLIGHTEN, 1);
814                         wiz_lite(FALSE);
815                 }
816                 else if (plev > 19)
817                         map_area(DETECT_RAD_MAP);
818
819                 if (plev < 30)
820                 {
821                         b = detect_monsters_normal(DETECT_RAD_DEFAULT);
822                         if (plev > 14) b |= detect_monsters_invis(DETECT_RAD_DEFAULT);
823                         if (plev > 4)  {
824                                 b |= detect_traps(DETECT_RAD_DEFAULT, TRUE);
825                                 b |= detect_doors(DETECT_RAD_DEFAULT);
826                         }
827                 }
828                 else
829                 {
830                         b = detect_all(DETECT_RAD_DEFAULT);
831                 }
832
833                 if ((plev > 24) && (plev < 40))
834                         set_tim_esp(plev, FALSE);
835
836                 if (!b) msg_print(_("安全な気がする。", "You feel safe."));
837
838                 break;
839         case 1:
840                 /* Mindblast */
841                 if (!get_aim_dir(&dir)) return FALSE;
842
843                 if (randint1(100) < plev * 2)
844                         fire_beam(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
845                 else
846                         fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
847                 break;
848         case 2:
849                 /* Minor displace */
850                 teleport_player(10, 0L);
851                 break;
852         case 3:
853                 /* Major displace */
854                 teleport_player(plev * 5, 0L);
855                 break;
856         case 4:
857                 /* Domination */
858                 if (plev < 30)
859                 {
860                         if (!get_aim_dir(&dir)) return FALSE;
861
862                         fire_ball(GF_DOMINATION, dir, plev, 0);
863                 }
864                 else
865                 {
866                         charm_monsters(plev * 2);
867                 }
868                 break;
869         case 5:
870                 /* Fist of Force  ---  not 'true' TK  */
871                 if (!get_aim_dir(&dir)) return FALSE;
872
873                 fire_ball(GF_TELEKINESIS, dir, damroll(8 + ((plev - 5) / 4), 8),
874                         (plev > 20 ? (plev - 20) / 8 + 1 : 0));
875                 break;
876         case 6:
877                 /* Character Armour */
878                 set_shield(plev, FALSE);
879                 if (plev > 14) set_oppose_acid(plev, FALSE);
880                 if (plev > 19) set_oppose_fire(plev, FALSE);
881                 if (plev > 24) set_oppose_cold(plev, FALSE);
882                 if (plev > 29) set_oppose_elec(plev, FALSE);
883                 if (plev > 34) set_oppose_pois(plev, FALSE);
884                 break;
885         case 7:
886                 /* Psychometry */
887                 if (plev < 25)
888                         return psychometry();
889                 else
890                         return ident_spell(FALSE);
891         case 8:
892                 /* Mindwave */
893                 msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!"));
894
895                 if (plev < 25)
896                         project(0, 2 + plev / 10, py, px,
897                         (plev * 3), GF_PSI, PROJECT_KILL, -1);
898                 else
899                         (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1)));
900                 break;
901         case 9:
902                 /* Adrenaline */
903                 set_afraid(0);
904                 set_stun(0);
905
906                 /*
907                  * Only heal when Adrenalin Channeling is not active. We check
908                  * that by checking if the player isn't fast and 'heroed' atm.
909                  */
910                 if (!IS_FAST() || !IS_HERO())
911                 {
912                         hp_player(plev);
913                 }
914
915                 b = 10 + randint1((plev * 3) / 2);
916                 set_hero(b, FALSE);
917                 /* Haste */
918                 (void)set_fast(b, FALSE);
919                 break;
920         case 10:
921                 /* Telekinesis */
922                 if (!get_aim_dir(&dir)) return FALSE;
923
924                 fetch(dir, plev * 15, FALSE);
925
926                 break;
927         case 11:
928                 /* Psychic Drain */
929                 if (!get_aim_dir(&dir)) return FALSE;
930
931                 b = damroll(plev / 2, 6);
932
933                 /* This is always a radius-0 ball now */
934                 if (fire_ball(GF_PSI_DRAIN, dir, b, 0))
935                         p_ptr->energy_need += randint1(150);
936                 break;
937         case 12:
938                 /* psycho-spear */
939                 if (!get_aim_dir(&dir)) return FALSE;
940
941                 fire_beam(GF_PSY_SPEAR, dir, randint1(plev*3)+plev*3);
942                 break;
943         case 13:
944         {
945                 if (world_player)
946                 {
947                         msg_print(_("既に時は止まっている。", "Time is already stopped."));
948                         return (FALSE);
949                 }
950                 world_player = TRUE;
951                 msg_print(_("「時よ!」", "You yell 'Time!'"));
952                 msg_print(NULL);
953
954                 /* Hack */
955                 p_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK/10;
956
957                 /* Redraw map */
958                 p_ptr->redraw |= (PR_MAP);
959
960                 /* Update monsters */
961                 p_ptr->update |= (PU_MONSTERS);
962
963                 /* Window stuff */
964                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
965
966                 handle_stuff();
967                 break;
968         }
969         default:
970                 msg_print(_("なに?", "Zap?"));
971         }
972
973         return TRUE;
974 }
975
976 /*!
977  * @brief 練気術の発動 /
978  * do_cmd_cast calls this function if the player's class is 'ForceTrainer'.
979  * @param spell 発動する特殊技能のID
980  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
981  */
982 static bool cast_force_spell(int spell)
983 {
984         int             dir;
985         int             plev = p_ptr->lev;
986         int             boost = p_ptr->magic_num1[0];
987
988         if (heavy_armor()) boost /= 2;
989
990         /* spell code */
991         switch (spell)
992         {
993         case 0:
994                 if (!get_aim_dir(&dir)) return FALSE;
995                 fire_ball(GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5) + boost / 12, 4), 0);
996                 break;
997         case 1:
998                 (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
999                 break;
1000         case 2:
1001                 set_tim_levitation(randint1(30) + 30 + boost / 5, FALSE);
1002                 break;
1003         case 3:
1004                 project_length = plev / 8 + 3;
1005                 if (!get_aim_dir(&dir)) return FALSE;
1006
1007                 fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
1008                 break;
1009         case 4:
1010                 set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
1011                 break;
1012         case 5:
1013                 msg_print(_("気を練った。", "You improved the Force."));
1014                 p_ptr->magic_num1[0] += (70 + plev);
1015                 p_ptr->update |= (PU_BONUS);
1016                 if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
1017                 {
1018                         msg_print(_("気が暴走した!", "The Force exploded!"));
1019                         fire_ball(GF_MANA, 0, p_ptr->magic_num1[0] / 2, 10);
1020                         take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, _("気の暴走", "Explosion of the Force"), -1);
1021                 }
1022                 else return TRUE;
1023                 break;
1024         case 6:
1025                 set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
1026                 break;
1027         case 7:
1028         {
1029                 int y, x, dam;
1030                 project_length = 1;
1031                 if (!get_aim_dir(&dir)) return FALSE;
1032
1033                 y = py + ddy[dir];
1034                 x = px + ddx[dir];
1035                 dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
1036                 fire_beam(GF_MISSILE, dir, dam);
1037                 if (cave[y][x].m_idx)
1038                 {
1039                         int i;
1040                         int ty = y, tx = x;
1041                         int oy = y, ox = x;
1042                         int m_idx = cave[y][x].m_idx;
1043                         monster_type *m_ptr = &m_list[m_idx];
1044                         monster_race *r_ptr = &r_info[m_ptr->r_idx];
1045                         char m_name[80];
1046
1047                         monster_desc(m_name, m_ptr, 0);
1048
1049                         if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam/2)
1050                         {
1051                                 msg_format(_("%sは飛ばされなかった。", "%^s was not blown away."), m_name);
1052                         }
1053                         else
1054                         {
1055                                 for (i = 0; i < 5; i++)
1056                                 {
1057                                         y += ddy[dir];
1058                                         x += ddx[dir];
1059                                         if (cave_empty_bold(y, x))
1060                                         {
1061                                                 ty = y;
1062                                                 tx = x;
1063                                         }
1064                                         else break;
1065                                 }
1066                                 if ((ty != oy) || (tx != ox))
1067                                 {
1068                                         msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
1069                                         cave[oy][ox].m_idx = 0;
1070                                         cave[ty][tx].m_idx = m_idx;
1071                                         m_ptr->fy = ty;
1072                                         m_ptr->fx = tx;
1073
1074                                         update_mon(m_idx, TRUE);
1075                                         lite_spot(oy, ox);
1076                                         lite_spot(ty, tx);
1077
1078                                         if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
1079                                                 p_ptr->update |= (PU_MON_LITE);
1080                                 }
1081                         }
1082                 }
1083                 break;
1084         }
1085         case 8:
1086                 if (!get_aim_dir(&dir)) return FALSE;
1087                 fire_ball(GF_MISSILE, dir, damroll(10, 6) + plev * 3 / 2 + boost * 3 / 5, (plev < 30) ? 2 : 3);
1088                 break;
1089         case 9:
1090         {
1091                 int m_idx;
1092
1093                 if (!target_set(TARGET_KILL)) return FALSE;
1094                 m_idx = cave[target_row][target_col].m_idx;
1095                 if (!m_idx) break;
1096                 if (!player_has_los_bold(target_row, target_col)) break;
1097                 if (!projectable(py, px, target_row, target_col)) break;
1098                 dispel_monster_status(m_idx);
1099                 break;
1100         }
1101         case 10:
1102         {
1103                 int i;
1104                 bool success = FALSE;
1105
1106                 for (i = 0; i < 1 + boost/100; i++)
1107                         if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, PM_FORCE_PET))
1108                                 success = TRUE;
1109                 if (success)
1110                 {
1111                         msg_print(_("御用でございますが、御主人様?", "'Your wish, master?'"));
1112                 }
1113                 else
1114                 {
1115                         msg_print(_("何も現れなかった。", "Nothing happen."));
1116                 }
1117                 break;
1118         }
1119         case 11:
1120                 fire_ball(GF_FIRE, 0, 200 + (2 * plev) + boost * 2, 10);
1121                 break;
1122         case 12:
1123                 if (!get_aim_dir(&dir)) return FALSE;
1124
1125                 fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
1126                 break;
1127         case 13:
1128                 set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
1129                 break;
1130         default:
1131                 msg_print(_("なに?", "Zap?"));
1132         }
1133         p_ptr->magic_num1[0] = 0;
1134         p_ptr->update |= (PU_BONUS);
1135
1136         return TRUE;
1137 }
1138
1139
1140 /*!
1141  * @brief 現在フロアに存在している鏡の数を数える / calculate mirrors
1142  * @return 鏡の枚数
1143  */
1144 static int number_of_mirrors( void )
1145 {
1146   int x,y;
1147   int val=0;
1148   for( x=0 ; x < cur_wid ; x++ ){
1149     for( y=0 ; y < cur_hgt ; y++ ){
1150       if (is_mirror_grid(&cave[y][x])) val++;
1151     }
1152   }
1153   return val;
1154 }
1155
1156 /*!
1157  * @brief 鏡魔法の発動 /
1158  * do_cmd_cast calls this function if the player's class is 'Mirror magic'.
1159  * @param spell 発動する特殊技能のID
1160  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1161  */
1162 static bool cast_mirror_spell(int spell)
1163 {
1164         int             dir;
1165         int             plev = p_ptr->lev;
1166         int             tmp;
1167         int             x,y;
1168
1169         /* spell code */
1170         switch (spell)
1171         {
1172         /* mirror of seeing */
1173         case 0:
1174           tmp = is_mirror_grid(&cave[py][px]) ? 4 : 0;
1175           if( plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
1176           if( plev + tmp > 18 )detect_monsters_invis(DETECT_RAD_DEFAULT);
1177           if( plev + tmp > 28 )set_tim_esp(plev,FALSE);
1178           if( plev + tmp > 38 )map_area(DETECT_RAD_MAP);
1179           if( tmp == 0 && plev < 5 ){
1180             msg_print(_("鏡がなくて集中できなかった!", "You need a mirror to concentrate!"));
1181           }
1182           break;
1183         /* drip of light */
1184         case 1:
1185           if( number_of_mirrors() < 4 + plev/10 ){
1186             place_mirror();
1187           }
1188           else {
1189                         msg_format(_("これ以上鏡は制御できない!", "There are too many mirrors to control!"));
1190           }
1191           break;
1192         case 2:
1193           if (!get_aim_dir(&dir)) return FALSE;
1194           if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) {
1195             fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
1196           }
1197           else {
1198             fire_bolt(GF_LITE, dir,damroll(3+((plev-1)/5),4));
1199           }
1200           break;
1201         /* warped mirror */
1202         case 3:
1203           teleport_player(10, 0L);
1204           break;
1205         /* mirror of light */
1206         case 4:
1207           (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
1208           break;
1209         /* mirror of wandering */
1210         case 5:
1211           teleport_player(plev * 5, 0L);
1212           break;
1213         /* robe of dust */
1214         case 6:
1215           set_dustrobe(20+randint1(20),FALSE);
1216           break;
1217         /* banishing mirror */
1218         case 7:
1219           if (!get_aim_dir(&dir)) return FALSE;
1220           (void)fire_beam(GF_AWAY_ALL, dir , plev);
1221           break;
1222         /* mirror clashing */
1223         case 8:
1224           if (!get_aim_dir(&dir)) return FALSE;
1225           fire_ball(GF_SHARDS, dir, damroll(8 + ((plev - 5) / 4), 8),
1226                     (plev > 20 ? (plev - 20) / 8 + 1 : 0));
1227           break;
1228         /* mirror sleeping */
1229         case 9:
1230           for(x=0;x<cur_wid;x++){
1231             for(y=0;y<cur_hgt;y++){
1232               if (is_mirror_grid(&cave[y][x])) {
1233                 project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
1234               }
1235             }
1236           }
1237           break;
1238         /* seeker ray */
1239         case 10:
1240           if (!get_aim_dir(&dir)) return FALSE;
1241           fire_beam(GF_SEEKER,dir, damroll(11+(plev-5)/4,8));
1242           break;
1243         /* seal of mirror */
1244         case 11:
1245           seal_of_mirror(plev*4+100);
1246           break;
1247         /* shield of water */
1248         case 12:
1249           tmp = 20+randint1(20);
1250           set_shield(tmp, FALSE);
1251           if( plev > 31 )set_tim_reflect(tmp, FALSE);
1252           if( plev > 39 )set_resist_magic(tmp,FALSE);
1253           break;
1254         /* super ray */
1255         case 13:
1256           if (!get_aim_dir(&dir)) return FALSE;
1257           fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
1258           break;
1259         /* illusion light */
1260         case 14:
1261           tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3;
1262           slow_monsters(plev);
1263           stun_monsters(plev*tmp);
1264           confuse_monsters(plev*tmp);
1265           turn_monsters(plev*tmp);
1266           stun_monsters(plev*tmp);
1267           stasis_monsters(plev*tmp);
1268           break;
1269         /* mirror shift */
1270         case 15:
1271           if( !is_mirror_grid(&cave[py][px]) ){
1272                 msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
1273                 break;
1274           }
1275           alter_reality();
1276           break;
1277         /* mirror tunnel */
1278         case 16:
1279           msg_print(_("鏡の世界を通り抜け…  ", "Go through the world of mirror..."));
1280           return mirror_tunnel();
1281
1282         /* mirror of recall */
1283         case 17:
1284                 return word_of_recall();
1285         /* multi-shadow */
1286         case 18:
1287           set_multishadow(6+randint1(6),FALSE);
1288           break;
1289         /* binding field */
1290         case 19:
1291           if( !binding_field(plev*11+5) )msg_print(_("適当な鏡を選べなかった!", "You were not able to choose suitable mirrors!"));
1292           break;
1293         /* mirror of Ruffnor */
1294         case 20:
1295           (void)set_invuln(randint1(4)+4,FALSE);
1296           break;
1297         default:
1298                 msg_print(_("なに?", "Zap?"));
1299
1300         }
1301         p_ptr->magic_num1[0] = 0;
1302
1303         return TRUE;
1304 }
1305
1306 /*!
1307  * @brief 怒りの発動 /
1308  * do_cmd_cast calls this function if the player's class is 'berserker'.
1309  * @param spell 発動する特殊技能のID
1310  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1311  */
1312 static bool cast_berserk_spell(int spell)
1313 {
1314         int y, x;
1315         int dir;
1316
1317         /* spell code */
1318         switch (spell)
1319         {
1320         case 0:
1321                 detect_monsters_mind(DETECT_RAD_DEFAULT);
1322                 break;
1323         case 1:
1324         {
1325                 if (p_ptr->riding)
1326                 {
1327                         msg_print(_("乗馬中には無理だ。", "You cannot do it when riding."));
1328                         return FALSE;
1329                 }
1330
1331                 if (!get_rep_dir2(&dir)) return FALSE;
1332
1333                 if (dir == 5) return FALSE;
1334                 y = py + ddy[dir];
1335                 x = px + ddx[dir];
1336
1337                 if (!cave[y][x].m_idx)
1338                 {
1339                         msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
1340                         return FALSE;
1341                 }
1342
1343                 py_attack(y, x, 0);
1344
1345                 if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
1346                         break;
1347
1348                 y += ddy[dir];
1349                 x += ddx[dir];
1350
1351                 if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
1352                 {
1353                         msg_print(NULL);
1354
1355                         /* Move the player */
1356                         (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
1357                 }
1358                 break;
1359         }
1360         case 2:
1361         {
1362                 if (!get_rep_dir2(&dir)) return FALSE;
1363                 y = py + ddy[dir];
1364                 x = px + ddx[dir];
1365                 move_player(dir, easy_disarm, TRUE);
1366                 break;
1367         }
1368         case 3:
1369                 earthquake(py, px, 8+randint0(5));
1370                 break;
1371         case 4:
1372                 massacre(py, px);
1373                 break;
1374         default:
1375                 msg_print(_("なに?", "Zap?"));
1376
1377         }
1378         return TRUE;
1379 }
1380
1381 /*!
1382  * @brief 忍術の発動 /
1383  * do_cmd_cast calls this function if the player's class is 'ninja'.
1384  * @param spell 発動する特殊技能のID
1385  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1386  */
1387 static bool cast_ninja_spell(int spell)
1388 {
1389         int x, y;
1390         int dir;
1391         int plev = p_ptr->lev;
1392
1393         /* spell code */
1394         switch (spell)
1395         {
1396         case 0:
1397                 (void)unlite_area(0, 3);
1398                 break;
1399         case 1:
1400                 if (plev > 44)
1401                 {
1402                         wiz_lite(TRUE);
1403                 }
1404                 detect_monsters_normal(DETECT_RAD_DEFAULT);
1405                 if (plev > 4)
1406                 {
1407                         detect_traps(DETECT_RAD_DEFAULT, TRUE);
1408                         detect_doors(DETECT_RAD_DEFAULT);
1409                         detect_stairs(DETECT_RAD_DEFAULT);
1410                 }
1411                 if (plev > 14)
1412                 {
1413                         detect_objects_normal(DETECT_RAD_DEFAULT);
1414                 }
1415                 break;
1416         case 2:
1417         {
1418                 teleport_player(10, 0L);
1419                 break;
1420         }
1421         case 3:
1422         {
1423                 if (!(p_ptr->special_defense & NINJA_KAWARIMI))
1424                 {
1425                         msg_print(_("敵の攻撃に対して敏感になった。", "You are now prepare to evade any attacks."));
1426                         p_ptr->special_defense |= NINJA_KAWARIMI;
1427                         p_ptr->redraw |= (PR_STATUS);
1428                 }
1429                 break;
1430         }
1431         case 4:
1432         {
1433                 teleport_player(p_ptr->lev * 5, 0L);
1434                 break;
1435         }
1436         case 5:
1437         {
1438                 if (!get_rep_dir(&dir, FALSE)) return FALSE;
1439                 y = py + ddy[dir];
1440                 x = px + ddx[dir];
1441                 if (cave[y][x].m_idx)
1442                 {
1443                         py_attack(y, x, 0);
1444                         if (randint0(p_ptr->skill_dis) < 7)
1445                                 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
1446                         else
1447                                 teleport_player(30, 0L);
1448                 }
1449                 else
1450                 {
1451                         msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
1452                         msg_print(NULL);
1453                 }
1454                 break;
1455         }
1456         case 6:
1457         {
1458                 if (!get_aim_dir(&dir)) return FALSE;
1459                 (void)stasis_monster(dir);
1460                 break;
1461         }
1462         case 7:
1463                 return ident_spell(FALSE);
1464         case 8:
1465                 set_tim_levitation(randint1(20) + 20, FALSE);
1466                 break;
1467         case 9:
1468                 fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
1469                 teleport_player(30, 0L);
1470                 set_oppose_fire(plev, FALSE);
1471                 break;
1472         case 10:
1473                 return rush_attack(NULL);
1474         case 11:
1475         {
1476                 int i;
1477                 for (i = 0; i < 8; i++)
1478                 {
1479                         int slot;
1480
1481                         for (slot = 0; slot < INVEN_PACK; slot++)
1482                         {
1483                                 if (inventory[slot].tval == TV_SPIKE) break;
1484                         }
1485                         if (slot == INVEN_PACK)
1486                         {
1487 #ifdef JP
1488                                 if (!i) msg_print("くさびを持っていない。");
1489                                 else msg_print("くさびがなくなった。");
1490 #else
1491                                 if (!i) msg_print("You have no Iron Spikes.");
1492                                 else msg_print("You have no more Iron Spikes.");
1493 #endif
1494                                 return FALSE;
1495                         }
1496
1497                         /* Gives a multiplier of 2 at first, up to 3 at 40th */
1498                         do_cmd_throw_aux(1, FALSE, slot);
1499
1500                         energy_use = 100;
1501                 }
1502                 break;
1503         }
1504         case 12:
1505         {
1506                 monster_type *m_ptr;
1507                 int m_idx;
1508                 char m_name[80];
1509                 int i;
1510                 int path_n;
1511                 u16b path_g[512];
1512                 int ty,tx;
1513
1514                 if (!target_set(TARGET_KILL)) return FALSE;
1515                 m_idx = cave[target_row][target_col].m_idx;
1516                 if (!m_idx) break;
1517                 if (m_idx == p_ptr->riding) break;
1518                 if (!player_has_los_bold(target_row, target_col)) break;
1519                 if (!projectable(py, px, target_row, target_col)) break;
1520                 m_ptr = &m_list[m_idx];
1521                 monster_desc(m_name, m_ptr, 0);
1522                 msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
1523                 path_n = project_path(path_g, MAX_RANGE, target_row, target_col, py, px, 0);
1524                 ty = target_row, tx = target_col;
1525                 for (i = 1; i < path_n; i++)
1526                 {
1527                         int ny = GRID_Y(path_g[i]);
1528                         int nx = GRID_X(path_g[i]);
1529                         cave_type *c_ptr = &cave[ny][nx];
1530
1531                         if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
1532                             !(c_ptr->info & CAVE_OBJECT) &&
1533                                 !pattern_tile(ny, nx))
1534                         {
1535                                 ty = ny;
1536                                 tx = nx;
1537                         }
1538                 }
1539                 /* Update the old location */
1540                 cave[target_row][target_col].m_idx = 0;
1541
1542                 /* Update the new location */
1543                 cave[ty][tx].m_idx = m_idx;
1544
1545                 /* Move the monster */
1546                 m_ptr->fy = ty;
1547                 m_ptr->fx = tx;
1548
1549                 /* Wake the monster up */
1550                 (void)set_monster_csleep(m_idx, 0);
1551
1552                 /* Update the monster (new location) */
1553                 update_mon(m_idx, TRUE);
1554
1555                 /* Redraw the old grid */
1556                 lite_spot(target_row, target_col);
1557
1558                 /* Redraw the new grid */
1559                 lite_spot(ty, tx);
1560
1561                 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
1562                         p_ptr->update |= (PU_MON_LITE);
1563
1564                 if (m_ptr->ml)
1565                 {
1566                         /* Auto-Recall if possible and visible */
1567                         if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
1568
1569                         /* Track a new monster */
1570                         health_track(m_idx);
1571                 }
1572
1573                 break;
1574         }
1575         case 13:
1576                 if (!get_aim_dir(&dir)) return FALSE;
1577                 fire_ball(GF_OLD_CONF, dir, plev*3, 3);
1578                 break;
1579         case 14:
1580                 project_length = -1;
1581                 if (!get_aim_dir(&dir))
1582                 {
1583                         project_length = 0;
1584                         return FALSE;
1585                 }
1586                 project_length = 0;
1587
1588                 (void)teleport_swap(dir);
1589                 break;
1590         case 15:
1591                 explosive_rune();
1592                 break;
1593         case 16:
1594                 (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
1595                 set_oppose_acid(plev, FALSE);
1596                 break;
1597         case 17:
1598                 fire_ball(GF_POIS, 0, 75+plev*2/3, plev/5+2);
1599                 fire_ball(GF_OLD_DRAIN, 0, 75+plev*2/3, plev/5+2);
1600                 fire_ball(GF_CONFUSION, 0, 75+plev*2/3, plev/5+2);
1601                 teleport_player(30, 0L);
1602                 break;
1603         case 18:
1604         {
1605                 int k;
1606                 int num = damroll(3, 9);
1607
1608                 for (k = 0; k < num; k++)
1609                 {
1610                         int typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
1611                         int attempts = 1000;
1612
1613                         while (attempts--)
1614                         {
1615                                 scatter(&y, &x, py, px, 4, 0);
1616
1617                                 if (!player_bold(y, x)) break;
1618                         }
1619                         project(0, 0, y, x, damroll(6 + plev / 8, 10), typ,
1620                                 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
1621                 }
1622                 break;
1623         }
1624         case 19:
1625                 set_multishadow(6+randint1(6), FALSE);
1626                 break;
1627         default:
1628                 msg_print(_("なに?", "Zap?"));
1629
1630         }
1631         return TRUE;
1632 }
1633
1634 /*!
1635  * @brief 特殊技能コマンドのメインルーチン /
1636  * @return なし
1637  */
1638 void do_cmd_mind(void)
1639 {
1640         int             n = 0,  b = 0;
1641         int             chance;
1642         int             minfail = 0;
1643         int             plev = p_ptr->lev;
1644         int             old_csp = p_ptr->csp;
1645         mind_type       spell;
1646         bool            cast;
1647         int             use_mind, mana_cost;
1648         cptr            p;
1649         bool            on_mirror = FALSE;
1650
1651         /* not if confused */
1652         if (p_ptr->confused)
1653         {
1654                 msg_print(_("混乱していて集中できない!", "You are too confused!"));
1655                 return;
1656         }
1657
1658         /* get power */
1659         if (!get_mind_power(&n, FALSE)) return;
1660
1661 #ifdef JP
1662         switch(p_ptr->pclass)
1663         {
1664                 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;p = "精神";break;
1665                 case CLASS_FORCETRAINER:          use_mind = MIND_KI;p = "気";break;
1666                 case CLASS_BERSERKER:   use_mind = MIND_BERSERKER;p = "怒り";break;
1667                 case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER;p = "鏡魔法";break;
1668                 case CLASS_NINJA:       use_mind = MIND_NINJUTSU;p = "精神";break;
1669                 default:                use_mind = 0;p = "超能力";break;
1670         }
1671 #else
1672         switch(p_ptr->pclass)
1673         {
1674                 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
1675                 case CLASS_FORCETRAINER:          use_mind = MIND_KI;break;
1676                 case CLASS_BERSERKER:   use_mind = MIND_BERSERKER;break;
1677                 case CLASS_MIRROR_MASTER:   use_mind = MIND_MIRROR_MASTER;break;
1678                 case CLASS_NINJA:       use_mind = MIND_NINJUTSU;break;
1679                 default:                use_mind = 0;break;
1680         }
1681 #endif
1682         spell = mind_powers[use_mind].info[n];
1683
1684         /* Spell failure chance */
1685         chance = spell.fail;
1686
1687         mana_cost = spell.mana_cost;
1688         if (use_mind == MIND_KI)
1689         {
1690                 if (heavy_armor()) chance += 20;
1691                 if (p_ptr->icky_wield[0]) chance += 20;
1692                 else if (buki_motteruka(INVEN_RARM)) chance += 10;
1693                 if (p_ptr->icky_wield[1]) chance += 20;
1694                 else if (buki_motteruka(INVEN_LARM)) chance += 10;
1695                 if (n == 5)
1696                 {
1697                         int j;
1698                         for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
1699                                 mana_cost += (j+1) * 3 / 2;
1700                 }
1701         }
1702
1703         /* Verify "dangerous" spells */
1704         if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
1705         {
1706                 if (mana_cost > p_ptr->chp)
1707                 {
1708                         msg_print(_("HPが足りません。", "You do not have enough hp to use this power."));
1709                         return;
1710                 }
1711         }
1712         else if (mana_cost > p_ptr->csp)
1713         {
1714                 /* Warning */
1715                 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1716
1717                 if (!over_exert) return;
1718
1719                 /* Verify */
1720                 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return;
1721
1722         }
1723
1724         if (chance)
1725         {
1726                 /* Reduce failure rate by "effective" level adjustment */
1727                 chance -= 3 * (plev - spell.min_lev);
1728
1729                 chance += p_ptr->to_m_chance;
1730
1731                 /* Reduce failure rate by INT/WIS adjustment */
1732                 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
1733
1734                 /* Not enough mana to cast */
1735                 if ((mana_cost > p_ptr->csp) && (use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
1736                 {
1737                         chance += 5 * (mana_cost - p_ptr->csp);
1738                 }
1739
1740                 /* Extract the minimum failure rate */
1741                 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
1742
1743                 /* Minimum failure rate */
1744                 if (chance < minfail) chance = minfail;
1745
1746                 /* Stunning makes spells harder */
1747                 if (p_ptr->stun > 50) chance += 25;
1748                 else if (p_ptr->stun) chance += 15;
1749
1750                 if (use_mind == MIND_KI)
1751                 {
1752                         if (heavy_armor()) chance += 5;
1753                         if (p_ptr->icky_wield[0]) chance += 5;
1754                         if (p_ptr->icky_wield[1]) chance += 5;
1755                 }
1756         }
1757
1758         /* Always a 5 percent chance of working */
1759         if (chance > 95) chance = 95;
1760
1761         /* Failed spell */
1762         if (randint0(100) < chance)
1763         {
1764                 if (flush_failure) flush();
1765                 msg_format(_("%sの集中に失敗した!", "You failed to concentrate hard enough!"), p);
1766
1767                 sound(SOUND_FAIL);
1768
1769                 if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
1770                 {
1771                         if ((use_mind == MIND_KI) && (n != 5) && p_ptr->magic_num1[0])
1772                         {
1773                                 msg_print(_("気が散ってしまった...", "Your improved Force has gone away..."));
1774                                 p_ptr->magic_num1[0] = 0;
1775                         }
1776
1777                         if (randint1(100) < (chance / 2))
1778                         {
1779                                 /* Backfire */
1780                           b = randint1(100);
1781
1782                           if( use_mind == MIND_MINDCRAFTER ){
1783                                 if (b < 5)
1784                                 {
1785                                         msg_print(_("なんてこった!頭の中が真っ白になった!", "Oh, no! Your mind has gone blank!"));
1786                                         lose_all_info();
1787                                 }
1788                                 else if (b < 15)
1789                                 {
1790                                         msg_print(_("奇妙な光景が目の前で踊っている...", "Weird visions seem to dance before your eyes..."));
1791                                         set_image(p_ptr->image + 5 + randint1(10));
1792                                 }
1793                                 else if (b < 45)
1794                                 {
1795                                         msg_print(_("あなたの頭は混乱した!", "Your brain is addled!"));
1796                                         set_confused(p_ptr->confused + randint1(8));
1797                                 }
1798                                 else if (b < 90)
1799                                 {
1800                                         set_stun(p_ptr->stun + randint1(8));
1801                                 }
1802                                 else
1803                                 {
1804                                         /* Mana storm */
1805                                         msg_format(_("%sの力が制御できない氾流となって解放された!", "Your mind unleashes its power in an uncontrollable storm!"), p);
1806
1807                                         project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2,
1808                                                 GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
1809                                         p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
1810                                 }
1811                           }
1812                           if( use_mind == MIND_MIRROR_MASTER ){
1813                                 if (b < 51)
1814                                 {
1815                                   /* Nothing has happen */
1816                                 }
1817                                 else if (b < 81)
1818                                 {
1819                                         msg_print(_("鏡の世界の干渉を受けた!", "Weird visions seem to dance before your eyes..."));
1820                                         teleport_player(10, TELEPORT_PASSIVE);
1821                                 }
1822                                 else if (b < 96)
1823                                 {
1824                                         msg_print(_("まわりのものがキラキラ輝いている!", "Your brain is addled!"));
1825                                         set_image(p_ptr->image + 5 + randint1(10));
1826                                 }
1827                                 else
1828                                 {
1829                                         /* Mana storm */
1830                                         msg_format(_("%sの力が制御できない氾流となって解放された!", "Your mind unleashes its power in an uncontrollable storm!"), p);
1831
1832                                         project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2,
1833                                                 GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
1834                                         p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
1835                                 }
1836                           }
1837                         }
1838                 }
1839         }
1840         else
1841         {
1842                 sound(SOUND_ZAP);
1843
1844                 switch(use_mind)
1845                 {
1846                 case MIND_MINDCRAFTER:
1847                         /* Cast the spell */
1848                         cast = cast_mindcrafter_spell(n);
1849                         break;
1850                 case MIND_KI:
1851                         /* Cast the spell */
1852                         cast = cast_force_spell(n);
1853                         break;
1854                 case MIND_BERSERKER:
1855                         /* Cast the spell */
1856                         cast = cast_berserk_spell(n);
1857                         break;
1858                 case MIND_MIRROR_MASTER:
1859                         /* Cast the spell */
1860                         if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE;
1861                         cast = cast_mirror_spell(n);
1862                         break;
1863                 case MIND_NINJUTSU:
1864                         /* Cast the spell */
1865                         cast = cast_ninja_spell(n);
1866                         break;
1867                 default:
1868                         msg_format(_("謎の能力:%d, %d", "Mystery power:%d, %d"),use_mind, n);
1869                         return;
1870                 }
1871
1872                 if (!cast) return;
1873         }
1874
1875
1876         /* Take a turn */
1877         energy_use = 100;
1878         /* teleport from mirror costs small energy */
1879         if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
1880         {
1881           if( n==3 || n==5 || n==7 || n==16 )energy_use = 50;
1882         }
1883
1884         if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
1885         {
1886                 take_hit(DAMAGE_USELIFE, mana_cost, _("過度の集中", "concentrating too hard"), -1);
1887                 /* Redraw hp */
1888                 p_ptr->redraw |= (PR_HP);
1889         }
1890
1891         /* Sufficient mana */
1892         else if (mana_cost <= old_csp)
1893         {
1894                 /* Use some mana */
1895                 p_ptr->csp -= mana_cost;
1896
1897                 /* Limit */
1898                 if (p_ptr->csp < 0) p_ptr->csp = 0;
1899
1900                 if ((use_mind == MIND_MINDCRAFTER) && (n == 13))
1901                 {
1902                         /* No mana left */
1903                         p_ptr->csp = 0;
1904                         p_ptr->csp_frac = 0;
1905                 }
1906         }
1907
1908         /* Over-exert the player */
1909         else
1910         {
1911                 int oops = mana_cost - old_csp;
1912
1913                 /* No mana left */
1914                 if ((p_ptr->csp - mana_cost) < 0) p_ptr->csp_frac = 0;
1915                 p_ptr->csp = MAX(0, p_ptr->csp - mana_cost);
1916
1917                 /* Message */
1918                 msg_format(_("%sを集中しすぎて気を失ってしまった!", "You faint from the effort!"),p);
1919
1920                 /* Hack -- Bypass free action */
1921                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1922
1923                 /* Damage WIS (possibly permanently) */
1924                 if (randint0(100) < 50)
1925                 {
1926                         bool perm = (randint0(100) < 25);
1927
1928                         /* Message */
1929                         msg_print(_("自分の精神を攻撃してしまった!", "You have damaged your mind!"));
1930
1931                         /* Reduce constitution */
1932                         (void)dec_stat(A_WIS, 15 + randint1(10), perm);
1933                 }
1934         }
1935
1936         /* Redraw mana */
1937         p_ptr->redraw |= (PR_MANA);
1938
1939         /* Window stuff */
1940         p_ptr->window |= (PW_PLAYER);
1941         p_ptr->window |= (PW_SPELL);
1942 }
1943
1944
1945 /*!
1946  * @brief 現在プレイヤーが使用可能な特殊技能の一覧表示 /
1947  * @return なし
1948  */
1949 void do_cmd_mind_browse(void)
1950 {
1951         int n = 0;
1952         int j, line;
1953         char temp[62*5];
1954         int use_mind = 0;
1955
1956         if (p_ptr->pclass == CLASS_MINDCRAFTER) use_mind = MIND_MINDCRAFTER;
1957         else if (p_ptr->pclass == CLASS_FORCETRAINER) use_mind = MIND_KI;
1958         else if (p_ptr->pclass == CLASS_BERSERKER) use_mind = MIND_BERSERKER;
1959         else if (p_ptr->pclass == CLASS_NINJA) use_mind = MIND_NINJUTSU;
1960         else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
1961           use_mind = MIND_MIRROR_MASTER;
1962
1963         screen_save();
1964
1965         while(1)
1966         {
1967                 /* get power */
1968                 if (!get_mind_power(&n, TRUE))
1969                 {
1970                         screen_load();
1971                         return;
1972                 }
1973
1974                 /* Clear lines, position cursor  (really should use strlen here) */
1975                 Term_erase(12, 21, 255);
1976                 Term_erase(12, 20, 255);
1977                 Term_erase(12, 19, 255);
1978                 Term_erase(12, 18, 255);
1979                 Term_erase(12, 17, 255);
1980                 Term_erase(12, 16, 255);
1981
1982                 roff_to_buf(mind_tips[use_mind][n], 62, temp, sizeof(temp));
1983                 for(j=0, line = 17;temp[j];j+=(1+strlen(&temp[j])))
1984                 {
1985                         prt(&temp[j], line, 15);
1986                         line++;
1987                 }
1988                 switch (use_mind)
1989                 {
1990                 case MIND_MIRROR_MASTER:
1991                 case MIND_NINJUTSU:
1992                   prt(_("何かキーを押して下さい。", "Hit any key."),0,0);
1993                   (void)inkey();
1994                 }
1995         }
1996 }