OSDN Git Service

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