OSDN Git Service

92e2514afd4294121e4ba2f0b33e13818f62e56b
[hengband/hengband.git] / src / hissatsu.c
1 /* File: mind.c */
2
3 /* Purpose: Mindcrafter code */
4
5 /*
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.  Other copyrights may also apply.
11  */
12
13 #include "angband.h"
14
15 #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
16
17 /*
18  * Allow user to choose a mindcrafter power.
19  *
20  * If a valid spell is chosen, saves it in '*sn' and returns TRUE
21  * If the user hits escape, returns FALSE, and set '*sn' to -1
22  * If there are no legal choices, returns FALSE, and sets '*sn' to -2
23  *
24  * The "prompt" should be "cast", "recite", or "study"
25  * The "known" should be TRUE for cast/pray, FALSE for study
26  *
27  * nb: This function has a (trivial) display bug which will be obvious
28  * when you run it. It's probably easy to fix but I haven't tried,
29  * sorry.
30  */
31 static int get_hissatsu_power(int *sn)
32 {
33         int             i, j = 0;
34         int             num = 0;
35         int             y = 1;
36         int             x = 15;
37         int             plev = p_ptr->lev;
38         int             ask = TRUE;
39         char            choice;
40         char            out_val[160];
41         char sentaku[32];
42 #ifdef JP
43 cptr            p = "ɬ»¦·õ";
44 #else
45         cptr            p = "special attack";
46 #endif
47
48         magic_type spell;
49         bool            flag, redraw;
50         int menu_line = (use_menu ? 1 : 0);
51
52         /* Assume cancelled */
53         *sn = (-1);
54
55 #ifdef ALLOW_REPEAT /* TNB */
56
57         /* Get the spell, if available */
58         if (repeat_pull(sn))
59         {
60                 /* Verify the spell */
61                 if (technic_info[TECHNIC_HISSATSU][*sn].slevel <= plev)
62                 {
63                         /* Success */
64                         return (TRUE);
65                 }
66         }
67
68 #endif /* ALLOW_REPEAT -- TNB */
69
70         /* Nothing chosen yet */
71         flag = FALSE;
72
73         /* No redraw yet */
74         redraw = FALSE;
75
76         for (i = 0; i < 32; i++)
77         {
78                 if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL)
79                 {
80                         sentaku[num] = i;
81                         num++;
82                 }
83         }
84
85         /* Build a prompt (accept all spells) */
86         (void) strnfmt(out_val, 78, 
87 #ifdef JP
88                        "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
89 #else
90                        "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
91 #endif
92                        p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
93
94         if (use_menu) screen_save();
95
96         /* Get a spell from the user */
97
98         choice= always_show_list ? ESCAPE:1 ;
99         while (!flag)
100         {
101                 if(choice==ESCAPE) choice = ' '; 
102                 else if( !get_com(out_val, &choice, FALSE) )break;
103
104                 if (use_menu && choice != ' ')
105                 {
106                         switch(choice)
107                         {
108                                 case '0':
109                                 {
110                                         screen_load();
111                                         return (FALSE);
112                                 }
113
114                                 case '8':
115                                 case 'k':
116                                 case 'K':
117                                 {
118                                         do
119                                         {
120                                                 menu_line += 31;
121                                                 if (menu_line > 32) menu_line -= 32;
122                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
123                                         break;
124                                 }
125
126                                 case '2':
127                                 case 'j':
128                                 case 'J':
129                                 {
130                                         do
131                                         {
132                                                 menu_line++;
133                                                 if (menu_line > 32) menu_line -= 32;
134                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
135                                         break;
136                                 }
137
138                                 case '4':
139                                 case 'h':
140                                 case 'H':
141                                 case '6':
142                                 case 'l':
143                                 case 'L':
144                                 {
145                                         bool reverse = FALSE;
146                                         if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
147                                         if (menu_line > 16)
148                                         {
149                                                 menu_line -= 16;
150                                                 reverse = TRUE;
151                                         }
152                                         else menu_line+=16;
153                                         while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
154                                         {
155                                                 if (reverse)
156                                                 {
157                                                         menu_line--;
158                                                         if (menu_line < 2) reverse = FALSE;
159                                                 }
160                                                 else
161                                                 {
162                                                         menu_line++;
163                                                         if (menu_line > 31) reverse = TRUE;
164                                                 }
165                                         }
166                                         break;
167                                 }
168
169                                 case 'x':
170                                 case 'X':
171                                 case '\r':
172                                 case '\n':
173                                 {
174                                         i = menu_line - 1;
175                                         ask = FALSE;
176                                         break;
177                                 }
178                         }
179                 }
180                 /* Request redraw */
181                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
182                 {
183                         /* Show the list */
184                         if (!redraw || use_menu)
185                         {
186                                 char psi_desc[80];
187                                 int line;
188
189                                 /* Show list */
190                                 redraw = TRUE;
191
192                                 /* Save the screen */
193                                 if (!use_menu) screen_save();
194
195                                 /* Display a list of spells */
196                                 prt("", y, x);
197 #ifdef JP
198 put_str("̾Á°              Lv  MP      Ì¾Á°              Lv  MP ", y, x + 5);
199 #else
200 put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
201 #endif
202                                 prt("", y+1, x);
203                                 /* Dump the spells */
204                                 for (i = 0, line = 0; i < 32; i++)
205                                 {
206                                         spell = technic_info[TECHNIC_HISSATSU][i];
207
208                                         if (spell.slevel > PY_MAX_LEVEL) continue;
209                                         line++;
210                                         if (!(p_ptr->spell_learned1 >> i)) break;
211
212                                         /* Access the spell */
213                                         if (spell.slevel > plev)   continue;
214                                         if (!(p_ptr->spell_learned1 & (1L << i))) continue;
215                                         if (use_menu)
216                                         {
217                                                 if (i == (menu_line-1))
218 #ifdef JP
219                                                         strcpy(psi_desc, "  ¡Õ");
220 #else
221                                                         strcpy(psi_desc, "  > ");
222 #endif
223                                                 else strcpy(psi_desc, "    ");
224                                                 
225                                         }
226                                         else
227                                         {
228                                                 char letter;
229                                                 if (line <= 26)
230                                                         letter = I2A(line-1);
231                                                 else
232                                                         letter = '0' + line - 27;
233                                                 sprintf(psi_desc, "  %c)",letter);
234                                         }
235
236                                         /* Dump the spell --(-- */
237                                         strcat(psi_desc, format(" %-18s%2d %3d",
238                                                 spell_names[technic2magic(REALM_HISSATSU)-1][i],
239                                                 spell.slevel, spell.smana));
240                                         prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
241                                         prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
242                                 }
243                         }
244
245                         /* Hide the list */
246                         else
247                         {
248                                 /* Hide list */
249                                 redraw = FALSE;
250
251                                 /* Restore the screen */
252                                 screen_load();
253                         }
254
255                         /* Redo asking */
256                         continue;
257                 }
258
259                 if (!use_menu)
260                 {
261                         if (isalpha(choice))
262                         {
263                                 /* Note verify */
264                                 ask = (isupper(choice));
265
266                                 /* Lowercase */
267                                 if (ask) choice = tolower(choice);
268
269                                 /* Extract request */
270                                 i = (islower(choice) ? A2I(choice) : -1);
271                         }
272                         else
273                         {
274                                 ask = FALSE; /* Can't uppercase digits */
275
276                                 i = choice - '0' + 26;
277                         }
278                 }
279
280                 /* Totally Illegal */
281                 if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
282                 {
283                         bell();
284                         continue;
285                 }
286
287                 j = sentaku[i];
288
289                 /* Verify it */
290                 if (ask)
291                 {
292                         char tmp_val[160];
293
294                         /* Prompt */
295 #ifdef JP
296                         (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
297 #else
298                         (void)strnfmt(tmp_val, 78, "Use %s? ", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
299 #endif
300
301
302                         /* Belay that order */
303                         if (!get_check(tmp_val)) continue;
304                 }
305
306                 /* Stop the loop */
307                 flag = TRUE;
308         }
309
310         /* Restore the screen */
311         if (redraw) screen_load();
312
313         /* Show choices */
314         p_ptr->window |= (PW_SPELL);
315
316         /* Window stuff */
317         window_stuff();
318
319
320         /* Abort if needed */
321         if (!flag) return (FALSE);
322
323         /* Save the choice */
324         (*sn) = j;
325
326 #ifdef ALLOW_REPEAT /* TNB */
327
328         repeat_push(*sn);
329
330 #endif /* ALLOW_REPEAT -- TNB */
331
332         /* Success */
333         return (TRUE);
334 }
335
336
337 /*
338  * do_cmd_cast calls this function if the player's class
339  * is 'mindcrafter'.
340  */
341 static bool cast_hissatsu_spell(int spell)
342 {
343         int             y, x;
344         int             dir;
345
346
347         /* spell code */
348         switch (spell)
349         {
350         case 0:
351                 project_length = 2;
352                 if (!get_aim_dir(&dir)) return FALSE;
353                 project_hook(GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
354
355                 break;
356         case 1:
357         {
358                 int cdir;
359                 if (!get_rep_dir2(&dir)) return FALSE;
360                 if (dir == 5) return FALSE;
361                 for (cdir = 0;cdir < 8; cdir++)
362                 {
363                         if (cdd[cdir] == dir) break;
364                 }
365                 if (cdir == 8) return FALSE;
366                 y = py + ddy_cdd[cdir];
367                 x = px + ddx_cdd[cdir];
368                 if (cave[y][x].m_idx)
369                         py_attack(y, x, 0);
370                 else
371 #ifdef JP
372                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
373 #else
374                         msg_print("You attack the empty air.");
375 #endif
376                 y = py + ddy_cdd[(cdir + 7) % 8];
377                 x = px + ddx_cdd[(cdir + 7) % 8];
378                 if (cave[y][x].m_idx)
379                         py_attack(y, x, 0);
380                 else
381 #ifdef JP
382                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
383 #else
384                         msg_print("You attack the empty air.");
385 #endif
386                 y = py + ddy_cdd[(cdir + 1) % 8];
387                 x = px + ddx_cdd[(cdir + 1) % 8];
388                 if (cave[y][x].m_idx)
389                         py_attack(y, x, 0);
390                 else
391 #ifdef JP
392                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
393 #else
394                         msg_print("You attack the empty air.");
395 #endif
396
397                 break;
398         }
399         case 2:
400         {
401                 if (!do_cmd_throw_aux(1, TRUE, 0)) return FALSE;
402                 break;
403         }
404         case 3:
405         {
406                 if (!get_rep_dir2(&dir)) return FALSE;
407                 if (dir == 5) return FALSE;
408                 y = py + ddy[dir];
409                 x = px + ddx[dir];
410                 if (cave[y][x].m_idx)
411                         py_attack(y, x, HISSATSU_FIRE);
412                 else
413                 {
414 #ifdef JP
415                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
416 #else
417                         msg_print("There is no monster.");
418 #endif
419                         return FALSE;
420                 }
421                 break;
422         }
423         case 4:
424         {
425                 detect_monsters_mind(DETECT_RAD_DEFAULT);
426                 break;
427         }
428         case 5:
429         {
430                 if (!get_rep_dir2(&dir)) return FALSE;
431                 if (dir == 5) return FALSE;
432                 y = py + ddy[dir];
433                 x = px + ddx[dir];
434                 if (cave[y][x].m_idx)
435                         py_attack(y, x, HISSATSU_MINEUCHI);
436                 else
437                 {
438 #ifdef JP
439                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
440 #else
441                         msg_print("There is no monster.");
442 #endif
443                         return FALSE;
444                 }
445                 break;
446         }
447         case 6:
448         {
449                 if (p_ptr->riding)
450                 {
451 #ifdef JP
452                         msg_print("¾èÇÏÃæ¤Ë¤Ï̵Íý¤À¡£");
453 #else
454                         msg_print("You cannot do it when riding.");
455 #endif
456                         return FALSE;
457                 }
458 #ifdef JP
459                 msg_print("Áê¼ê¤Î¹¶·â¤ËÂФ·¤Æ¿È¹½¤¨¤¿¡£");
460 #else
461                 msg_print("You prepare to counter blow.");
462 #endif
463                 p_ptr->counter = TRUE;
464                 break;
465         }
466         case 7:
467         {
468                 if (p_ptr->riding)
469                 {
470 #ifdef JP
471                         msg_print("¾èÇÏÃæ¤Ë¤Ï̵Íý¤À¡£");
472 #else
473                         msg_print("You cannot do it when riding.");
474 #endif
475                         return FALSE;
476                 }
477
478                 if (!get_rep_dir2(&dir)) return FALSE;
479
480                 if (dir == 5) return FALSE;
481                 y = py + ddy[dir];
482                 x = px + ddx[dir];
483
484                 if (!cave[y][x].m_idx)
485                 {
486 #ifdef JP
487                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
488 #else
489                         msg_print("There is no monster.");
490 #endif
491                         return FALSE;
492                 }
493
494                 py_attack(y, x, 0);
495
496                 if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
497                         break;
498
499                 y += ddy[dir];
500                 x += ddx[dir];
501
502                 if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
503                 {
504                         msg_print(NULL);
505
506                         /* Move the player */
507                         (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
508                 }
509                 break;
510         }
511         case 8:
512         {
513                 if (!get_rep_dir2(&dir)) return FALSE;
514                 if (dir == 5) return FALSE;
515                 y = py + ddy[dir];
516                 x = px + ddx[dir];
517                 if (cave[y][x].m_idx)
518                         py_attack(y, x, HISSATSU_POISON);
519                 else
520                 {
521 #ifdef JP
522                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
523 #else
524                         msg_print("There is no monster.");
525 #endif
526                         return FALSE;
527                 }
528                 break;
529         }
530         case 9:
531         {
532                 if (!get_rep_dir2(&dir)) return FALSE;
533                 if (dir == 5) return FALSE;
534                 y = py + ddy[dir];
535                 x = px + ddx[dir];
536                 if (cave[y][x].m_idx)
537                         py_attack(y, x, HISSATSU_ZANMA);
538                 else
539                 {
540 #ifdef JP
541                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
542 #else
543                         msg_print("There is no monster.");
544 #endif
545                         return FALSE;
546                 }
547                 break;
548         }
549         case 10:
550         {
551                 if (!get_rep_dir2(&dir)) return FALSE;
552                 if (dir == 5) return FALSE;
553                 y = py + ddy[dir];
554                 x = px + ddx[dir];
555                 if (cave[y][x].m_idx)
556                         py_attack(y, x, 0);
557                 else
558                 {
559 #ifdef JP
560                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
561 #else
562                         msg_print("There is no monster.");
563 #endif
564                         return FALSE;
565                 }
566                 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
567                 {
568                         return TRUE;
569                 }
570                 if (cave[y][x].m_idx)
571                 {
572                         int i;
573                         int ty = y, tx = x;
574                         int oy = y, ox = x;
575                         int m_idx = cave[y][x].m_idx;
576                         monster_type *m_ptr = &m_list[m_idx];
577                         char m_name[80];
578
579                         monster_desc(m_name, m_ptr, 0);
580
581                         for (i = 0; i < 5; i++)
582                         {
583                                 y += ddy[dir];
584                                 x += ddx[dir];
585                                 if (cave_empty_bold(y, x))
586                                 {
587                                         ty = y;
588                                         tx = x;
589                                 }
590                                 else break;
591                         }
592                         if ((ty != oy) || (tx != ox))
593                         {
594 #ifdef JP
595                                 msg_format("%s¤ò¿á¤­Èô¤Ð¤·¤¿¡ª", m_name);
596 #else
597                                 msg_format("You blow %s away!", m_name);
598 #endif
599                                 cave[oy][ox].m_idx = 0;
600                                 cave[ty][tx].m_idx = m_idx;
601                                 m_ptr->fy = ty;
602                                 m_ptr->fx = tx;
603
604                                 update_mon(m_idx, TRUE);
605                                 lite_spot(oy, ox);
606                                 lite_spot(ty, tx);
607
608                                 if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
609                                         p_ptr->update |= (PU_MON_LITE);
610                         }
611                 }
612                 break;
613         }
614         case 11:
615         {
616                 if (p_ptr->lev > 44)
617                 {
618                         if (!identify_fully(TRUE)) return FALSE;
619                 }
620                 else
621                 {
622                         if (!ident_spell(TRUE)) return FALSE;
623                 }
624                 break;
625         }
626         case 12:
627         {
628                 if (!get_rep_dir2(&dir)) return FALSE;
629                 if (dir == 5) return FALSE;
630                 y = py + ddy[dir];
631                 x = px + ddx[dir];
632                 if (cave[y][x].m_idx)
633                         py_attack(y, x, HISSATSU_HAGAN);
634
635                 if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break;
636
637                 /* Destroy the feature */
638                 cave_alter_feat(y, x, FF_HURT_ROCK);
639
640                 /* Update some things */
641                 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
642
643                 break;
644         }
645         case 13:
646         {
647                 if (!get_rep_dir2(&dir)) return FALSE;
648                 if (dir == 5) return FALSE;
649                 y = py + ddy[dir];
650                 x = px + ddx[dir];
651                 if (cave[y][x].m_idx)
652                         py_attack(y, x, HISSATSU_COLD);
653                 else
654                 {
655 #ifdef JP
656                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
657 #else
658                         msg_print("There is no monster.");
659 #endif
660                         return FALSE;
661                 }
662                 break;
663         }
664         case 14:
665         {
666                 if (!get_rep_dir2(&dir)) return FALSE;
667                 if (dir == 5) return FALSE;
668                 y = py + ddy[dir];
669                 x = px + ddx[dir];
670                 if (cave[y][x].m_idx)
671                         py_attack(y, x, HISSATSU_KYUSHO);
672                 else
673                 {
674 #ifdef JP
675                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
676 #else
677                         msg_print("There is no monster.");
678 #endif
679                         return FALSE;
680                 }
681                 break;
682         }
683         case 15:
684         {
685                 if (!get_rep_dir2(&dir)) return FALSE;
686                 if (dir == 5) return FALSE;
687                 y = py + ddy[dir];
688                 x = px + ddx[dir];
689                 if (cave[y][x].m_idx)
690                         py_attack(y, x, HISSATSU_MAJIN);
691                 else
692                 {
693 #ifdef JP
694                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
695 #else
696                         msg_print("There is no monster.");
697 #endif
698                         return FALSE;
699                 }
700                 break;
701         }
702         case 16:
703         {
704                 if (!get_rep_dir2(&dir)) return FALSE;
705                 if (dir == 5) return FALSE;
706                 y = py + ddy[dir];
707                 x = px + ddx[dir];
708                 if (cave[y][x].m_idx)
709                         py_attack(y, x, HISSATSU_SUTEMI);
710                 else
711                 {
712 #ifdef JP
713                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
714 #else
715                         msg_print("There is no monster.");
716 #endif
717                         return FALSE;
718                 }
719                 p_ptr->sutemi = TRUE;
720                 break;
721         }
722         case 17:
723         {
724                 if (!get_rep_dir2(&dir)) return FALSE;
725                 if (dir == 5) return FALSE;
726                 y = py + ddy[dir];
727                 x = px + ddx[dir];
728                 if (cave[y][x].m_idx)
729                         py_attack(y, x, HISSATSU_ELEC);
730                 else
731                 {
732 #ifdef JP
733                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
734 #else
735                         msg_print("There is no monster.");
736 #endif
737                         return FALSE;
738                 }
739                 break;
740         }
741         case 18:
742                 return rush_attack(NULL);
743         case 19: /* Whirlwind Attack */
744         {
745                 int y = 0, x = 0;
746                 cave_type       *c_ptr;
747                 monster_type    *m_ptr;
748
749                 if (p_ptr->cut < 300)
750                         set_cut(p_ptr->cut + 300);
751                 else
752                         set_cut(p_ptr->cut * 2);
753
754                 for (dir = 0; dir < 8; dir++)
755                 {
756                         y = py + ddy_ddd[dir];
757                         x = px + ddx_ddd[dir];
758                         c_ptr = &cave[y][x];
759
760                         /* Get the monster */
761                         m_ptr = &m_list[c_ptr->m_idx];
762
763                         /* Hack -- attack monsters */
764                         if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
765                         {
766                                 if (!monster_living(&r_info[m_ptr->r_idx]))
767                                 {
768                                         char m_name[80];
769
770                                         monster_desc(m_name, m_ptr, 0);
771 #ifdef JP
772                                         msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤¤¡ª", m_name);
773 #else
774                                         msg_format("%s is unharmed!", m_name);
775 #endif
776                                 }
777                                 else py_attack(y, x, HISSATSU_SEKIRYUKA);
778                         }
779                 }
780                 break;
781         }
782         case 20:
783         {
784                 if (!get_rep_dir2(&dir)) return FALSE;
785                 if (dir == 5) return FALSE;
786                 y = py + ddy[dir];
787                 x = px + ddx[dir];
788                 if (cave[y][x].m_idx)
789                         py_attack(y, x, HISSATSU_QUAKE);
790                 else
791                 {
792                         earthquake(py, px, 10);
793                 }
794                 break;
795         }
796         case 21:
797         {
798                 int total_damage = 0, basedam, i;
799                 u32b flgs[TR_FLAG_SIZE];
800                 object_type *o_ptr;
801                 if (!get_aim_dir(&dir)) return FALSE;
802 #ifdef JP
803                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
804 #else
805                 msg_print("You swing your weapon downward.");
806 #endif
807                 for (i = 0; i < 2; i++)
808                 {
809                         int damage;
810
811                         if (!buki_motteruka(INVEN_RARM+i)) break;
812                         o_ptr = &inventory[INVEN_RARM+i];
813                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
814                         damage = o_ptr->to_d * 100;
815                         object_flags(o_ptr, flgs);
816                         if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
817                         {
818                                 /* vorpal blade */
819                                 basedam *= 5;
820                                 basedam /= 3;
821                         }
822                         else if (have_flag(flgs, TR_VORPAL))
823                         {
824                                 /* vorpal flag only */
825                                 basedam *= 11;
826                                 basedam /= 9;
827                         }
828                         damage += basedam;
829                         damage *= p_ptr->num_blow[i];
830                         total_damage += damage / 200;
831                         if (i) total_damage = total_damage*7/10;
832                 }
833                 fire_beam(GF_FORCE, dir, total_damage);
834                 break;
835         }
836         case 22:
837         {
838 #ifdef JP
839                 msg_print("ͺ¶«¤Ó¤ò¤¢¤²¤¿¡ª");
840 #else
841                 msg_print("You roar out!");
842 #endif
843                 project_hack(GF_SOUND, randint1(p_ptr->lev * 3));
844                 aggravate_monsters(0);
845                 break;
846         }
847         case 23:
848         {
849                 int i;
850                 if (!get_rep_dir2(&dir)) return FALSE;
851                 if (dir == 5) return FALSE;
852                 for (i = 0; i < 3; i++)
853                 {
854                         int ny, nx;
855                         int m_idx;
856                         cave_type *c_ptr;
857                         monster_type *m_ptr;
858
859                         y = py + ddy[dir];
860                         x = px + ddx[dir];
861                         c_ptr = &cave[y][x];
862
863                         if (c_ptr->m_idx)
864                                 py_attack(y, x, HISSATSU_3DAN);
865                         else
866                         {
867 #ifdef JP
868                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
869 #else
870                                 msg_print("There is no monster.");
871 #endif
872                                 return FALSE;
873                         }
874
875                         if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
876                         {
877                                 return TRUE;
878                         }
879
880                         /* Monster is dead? */
881                         if (!c_ptr->m_idx) break;
882
883                         ny = y + ddy[dir];
884                         nx = x + ddx[dir];
885                         m_idx = c_ptr->m_idx;
886                         m_ptr = &m_list[m_idx];
887
888                         /* Monster cannot move back? */
889                         if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0))
890                         {
891                                 /* -more- */
892                                 if (i < 2) msg_print(NULL);
893                                 continue;
894                         }
895
896                         c_ptr->m_idx = 0;
897                         cave[ny][nx].m_idx = m_idx;
898                         m_ptr->fy = ny;
899                         m_ptr->fx = nx;
900
901                         update_mon(m_idx, TRUE);
902
903                         /* Redraw the old spot */
904                         lite_spot(y, x);
905
906                         /* Redraw the new spot */
907                         lite_spot(ny, nx);
908
909                         /* Player can move forward? */
910                         if (player_can_enter(c_ptr->feat, 0))
911                         {
912                                 /* Move the player */
913                                 if (!move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
914                         }
915
916                         /* -more- */
917                         if (i < 2) msg_print(NULL);
918                 }
919                 break;
920         }
921         case 24:
922         {
923                 if (!get_rep_dir2(&dir)) return FALSE;
924                 if (dir == 5) return FALSE;
925                 y = py + ddy[dir];
926                 x = px + ddx[dir];
927                 if (cave[y][x].m_idx)
928                         py_attack(y, x, HISSATSU_DRAIN);
929                 else
930                 {
931 #ifdef JP
932                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
933 #else
934                                 msg_print("There is no monster.");
935 #endif
936                         return FALSE;
937                 }
938                 break;
939         }
940         case 25:
941         {
942 #ifdef JP
943                 msg_print("Éð´ï¤òÉÔµ¬Â§¤ËÍɤ餷¤¿¡¥¡¥¡¥");
944 #else
945                 msg_print("You irregularly wave your weapon...");
946 #endif
947                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
948                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
949                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
950                 break;
951         }
952         case 26:
953         {
954 #define NEED_MANA_PER_MONSTER 8
955                 bool new = TRUE;
956                 bool mdeath;
957                 /* int count = 0; currently unused */
958                 do
959                 {
960                         if (!rush_attack(&mdeath)) break;
961                         if (new)
962                         {
963                                 /* Reserve needed mana point */
964                                 p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana;
965                                 new = FALSE;
966                         }
967                         else
968                                 p_ptr->csp -= NEED_MANA_PER_MONSTER;
969                         if (!mdeath) break;
970                         /* count++; currently unused */
971                         command_dir = 0;
972                         p_ptr->redraw |= PR_MANA;
973                         handle_stuff();
974                 }
975                 while (p_ptr->csp > NEED_MANA_PER_MONSTER);
976                 if (new) return FALSE;
977
978                 /* Restore reserved mana */
979                 p_ptr->csp += technic_info[TECHNIC_HISSATSU][26].smana;
980                 break;
981
982 #undef NEED_MANA_PER_MONSTER
983         }
984         case 27:
985         {
986                 if (!tgt_pt(&x, &y)) return FALSE;
987                 if (!cave_player_teleportable_bold(y, x, FALSE, FALSE) ||
988                     (distance(y, x, py, px) > MAX_SIGHT / 2) ||
989                     !projectable(py, px, y, x))
990                 {
991 #ifdef JP
992                         msg_print("¼ºÇÔ¡ª");
993 #else
994                         msg_print("You cannot move to that place!");
995 #endif
996                         break;
997                 }
998                 if (p_ptr->anti_tele)
999                 {
1000 #ifdef JP
1001                         msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
1002 #else
1003                         msg_print("A mysterious force prevents you from teleporting!");
1004 #endif
1005
1006                         break;
1007                 }
1008                 project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
1009                 teleport_player_to(y, x, TRUE, FALSE);
1010                 break;
1011         }
1012         case 28:
1013         {
1014                 int x, y;
1015
1016                 if (!get_rep_dir(&dir, FALSE)) return FALSE;
1017                 y = py + ddy[dir];
1018                 x = px + ddx[dir];
1019                 if (cave[y][x].m_idx)
1020                 {
1021                         py_attack(y, x, 0);
1022                         if (cave[y][x].m_idx)
1023                         {
1024                                 handle_stuff();
1025                                 py_attack(y, x, 0);
1026                         }
1027                 }
1028                 else
1029                 {
1030 #ifdef JP
1031 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1032 #else
1033                         msg_print("You don't see any monster in this direction");
1034 #endif
1035                         return FALSE;
1036                 }
1037                 break;
1038         }
1039         case 29:
1040         {
1041                 int total_damage = 0, basedam, i;
1042                 int y, x;
1043                 u32b flgs[TR_FLAG_SIZE];
1044                 object_type *o_ptr;
1045
1046                 if (!get_rep_dir2(&dir)) return FALSE;
1047                 if (dir == 5) return FALSE;
1048                 y = py + ddy[dir];
1049                 x = px + ddx[dir];
1050                 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
1051                 {
1052 #ifdef JP
1053                         msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£");
1054 #else
1055                         msg_print("Something prevent you from attacking.");
1056 #endif
1057                         return TRUE;
1058                 }
1059 #ifdef JP
1060                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
1061 #else
1062                 msg_print("You swing your weapon downward.");
1063 #endif
1064                 for (i = 0; i < 2; i++)
1065                 {
1066                         int damage;
1067                         if (!buki_motteruka(INVEN_RARM+i)) break;
1068                         o_ptr = &inventory[INVEN_RARM+i];
1069                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
1070                         damage = o_ptr->to_d * 100;
1071                         object_flags(o_ptr, flgs);
1072                         if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
1073                         {
1074                                 /* vorpal blade */
1075                                 basedam *= 5;
1076                                 basedam /= 3;
1077                         }
1078                         else if (have_flag(flgs, TR_VORPAL))
1079                         {
1080                                 /* vorpal flag only */
1081                                 basedam *= 11;
1082                                 basedam /= 9;
1083                         }
1084                         damage += basedam;
1085                         damage += p_ptr->to_d[i] * 100;
1086                         damage *= p_ptr->num_blow[i];
1087                         total_damage += (damage / 100);
1088                 }
1089                 project(0, (cave_have_flag_bold(y, x, FF_PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
1090                 break;
1091         }
1092         case 30:
1093         {
1094                 if (!get_rep_dir2(&dir)) return FALSE;
1095                 if (dir == 5) return FALSE;
1096                 y = py + ddy[dir];
1097                 x = px + ddx[dir];
1098                 if (cave[y][x].m_idx)
1099                         py_attack(y, x, HISSATSU_UNDEAD);
1100                 else
1101                 {
1102 #ifdef JP
1103                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1104 #else
1105                         msg_print("There is no monster.");
1106 #endif
1107                         return FALSE;
1108                 }
1109 #ifdef JP
1110                 take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
1111 #else
1112                 take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "exhaustion on using Keiun-Kininken", -1);
1113 #endif
1114                 break;
1115         }
1116         case 31:
1117         {
1118                 int i;
1119 #ifdef JP
1120 if (!get_check("ËÜÅö¤Ë¼«»¦¤·¤Þ¤¹¤«¡©")) return FALSE;
1121 #else
1122                 if (!get_check("Do you really want to commit suicide? ")) return FALSE;
1123 #endif
1124                         /* Special Verification for suicide */
1125 #ifdef JP
1126 prt("³Îǧ¤Î¤¿¤á '@' ¤ò²¡¤·¤Æ²¼¤µ¤¤¡£", 0, 0);
1127 #else
1128                 prt("Please verify SUICIDE by typing the '@' sign: ", 0, 0);
1129 #endif
1130
1131                 flush();
1132                 i = inkey();
1133                 prt("", 0, 0);
1134                 if (i != '@') return FALSE;
1135                 if (p_ptr->total_winner)
1136                 {
1137                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1138                         p_ptr->total_winner = TRUE;
1139                 }
1140                 else
1141                 {
1142 #ifdef JP
1143                         msg_print("Éð»ÎÆ»¤È¤Ï¡¢»à¤Ì¤³¤È¤È¸«¤Ä¤±¤¿¤ê¡£");
1144                         take_hit(DAMAGE_FORCE, 9999, "ÀÚÊ¢", -1);
1145 #else
1146                         msg_print("Meaning of Bushi-do is found in the death.");
1147                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1148 #endif
1149                 }
1150                 break;
1151         }
1152         default:
1153 #ifdef JP
1154 msg_print("¤Ê¤Ë¡©");
1155 #else
1156                 msg_print("Zap?");
1157 #endif
1158
1159         }
1160
1161         return TRUE;
1162 }
1163
1164
1165 /*
1166  * do_cmd_cast calls this function if the player's class
1167  * is 'mindcrafter'.
1168  */
1169 void do_cmd_hissatsu(void)
1170 {
1171         int             n = 0;
1172         magic_type      spell;
1173         bool            cast;
1174
1175
1176         /* not if confused */
1177         if (p_ptr->confused)
1178         {
1179 #ifdef JP
1180 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
1181 #else
1182                 msg_print("You are too confused!");
1183 #endif
1184
1185                 return;
1186         }
1187         if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
1188         {
1189                 if (flush_failure) flush();
1190 #ifdef JP
1191 msg_print("Éð´ï¤ò»ý¤¿¤Ê¤¤¤Èɬ»¦µ»¤Ï»È¤¨¤Ê¤¤¡ª");
1192 #else
1193                 msg_print("You need to wield a weapon!");
1194 #endif
1195
1196                 return;
1197         }
1198         if (!p_ptr->spell_learned1)
1199         {
1200 #ifdef JP
1201 msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
1202 #else
1203                 msg_print("You don't know any special attacks.");
1204 #endif
1205
1206                 return;
1207         }
1208
1209         if (p_ptr->special_defense & KATA_MASK)
1210         {
1211                 set_action(ACTION_NONE);
1212         }
1213
1214         /* get power */
1215         if (!get_hissatsu_power(&n)) return;
1216
1217         spell = technic_info[TECHNIC_HISSATSU][n];
1218
1219         /* Verify "dangerous" spells */
1220         if (spell.smana > p_ptr->csp)
1221         {
1222                 if (flush_failure) flush();
1223                 /* Warning */
1224 #ifdef JP
1225 msg_print("£Í£Ð¤¬Â­¤ê¤Þ¤»¤ó¡£");
1226 #else
1227                 msg_print("You do not have enough mana to use this power.");
1228 #endif
1229                 msg_print(NULL);
1230                 return;
1231         }
1232
1233         sound(SOUND_ZAP);
1234
1235         /* Cast the spell */
1236         cast = cast_hissatsu_spell(n);
1237
1238         if (!cast) return;
1239
1240         /* Take a turn */
1241         energy_use = 100;
1242
1243         /* Use some mana */
1244         p_ptr->csp -= spell.smana;
1245
1246         /* Limit */
1247         if (p_ptr->csp < 0) p_ptr->csp = 0;
1248
1249         /* Redraw mana */
1250         p_ptr->redraw |= (PR_MANA);
1251
1252         /* Window stuff */
1253         p_ptr->window |= (PW_PLAYER);
1254         p_ptr->window |= (PW_SPELL);
1255 }
1256
1257
1258 void do_cmd_gain_hissatsu(void)
1259 {
1260         int item, i, j;
1261
1262         object_type *o_ptr;
1263         cptr q, s;
1264
1265         bool gain = FALSE;
1266
1267         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1268         {
1269                 set_action(ACTION_NONE);
1270         }
1271
1272         if (p_ptr->blind || no_lite())
1273         {
1274 #ifdef JP
1275 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
1276 #else
1277                 msg_print("You cannot see!");
1278 #endif
1279
1280                 return;
1281         }
1282
1283         if (p_ptr->confused)
1284         {
1285 #ifdef JP
1286 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
1287 #else
1288                 msg_print("You are too confused!");
1289 #endif
1290
1291                 return;
1292         }
1293
1294         if (!(p_ptr->new_spells))
1295         {
1296 #ifdef JP
1297 msg_print("¿·¤·¤¤É¬»¦µ»¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡ª");
1298 #else
1299                 msg_print("You cannot learn any new special attacks!");
1300 #endif
1301
1302                 return;
1303         }
1304
1305 #ifdef JP
1306         if( p_ptr->new_spells < 10 ){
1307                 msg_format("¤¢¤È %d ¤Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1308         }else{
1309                 msg_format("¤¢¤È %d ¸Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1310         }
1311 #else
1312         msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
1313                 (p_ptr->new_spells == 1?"":"s"));
1314 #endif
1315
1316         item_tester_tval = TV_HISSATSU_BOOK;
1317
1318         /* Get an item */
1319 #ifdef JP
1320 q = "¤É¤Î½ñ¤«¤é³Ø¤Ó¤Þ¤¹¤«? ";
1321 #else
1322         q = "Study which book? ";
1323 #endif
1324
1325 #ifdef JP
1326 s = "Æɤá¤ë½ñ¤¬¤Ê¤¤¡£";
1327 #else
1328         s = "You have no books that you can read.";
1329 #endif
1330
1331         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1332
1333         /* Get the item (in the pack) */
1334         if (item >= 0)
1335         {
1336                 o_ptr = &inventory[item];
1337         }
1338
1339         /* Get the item (on the floor) */
1340         else
1341         {
1342                 o_ptr = &o_list[0 - item];
1343         }
1344
1345         for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
1346         {
1347                 if (p_ptr->spell_learned1 & (1L << i)) continue;
1348                 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
1349
1350                 p_ptr->spell_learned1 |= (1L << i);
1351                 p_ptr->spell_worked1 |= (1L << i);
1352 #ifdef JP
1353                 msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1354 #else
1355                 msg_format("You have learned the special attack of %s.", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1356 #endif
1357                 for (j = 0; j < 64; j++)
1358                 {
1359                         /* Stop at the first empty space */
1360                         if (p_ptr->spell_order[j] == 99) break;
1361                 }
1362                 p_ptr->spell_order[j] = i;
1363                 gain = TRUE;
1364         }
1365
1366         /* No gain ... */
1367         if (!gain)
1368 #ifdef JP
1369                 msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
1370 #else
1371                 msg_print("You were not able to learn any special attacks.");
1372 #endif
1373
1374         /* Take a turn */
1375         else
1376                 energy_use = 100;
1377
1378         p_ptr->update |= (PU_SPELLS);
1379 }