OSDN Git Service

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