OSDN Git Service

Hengband 108 fix2 revision 4
[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 #ifdef JP
818                                         msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤¤¡ª", m_name);
819 #else
820                                         msg_format("%s is unharmed!", m_name);
821 #endif
822                                 }
823                                 else py_attack(y, x, HISSATSU_SEKIRYUKA);
824                         }
825                 }
826                 break;
827         }
828         case 20:
829         {
830                 if (!get_rep_dir2(&dir)) return FALSE;
831                 if (dir == 5) return FALSE;
832                 y = py + ddy[dir];
833                 x = px + ddx[dir];
834                 if (cave[y][x].m_idx)
835                         py_attack(y, x, HISSATSU_QUAKE);
836                 else
837                 {
838                         earthquake(py, px, 10);
839                 }
840                 break;
841         }
842         case 21:
843         {
844                 int total_damage = 0, basedam, i;
845                 u32b f1, f2, f3;
846                 object_type *o_ptr;
847                 if (!get_aim_dir(&dir)) return FALSE;
848 #ifdef JP
849                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
850 #else
851                 msg_print("You swing your weapon downward.");
852 #endif
853                 for (i = 0; i < 2; i++)
854                 {
855                         int damage;
856
857                         if (!buki_motteruka(INVEN_RARM+i)) break;
858                         o_ptr = &inventory[INVEN_RARM+i];
859                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
860                         damage = o_ptr->to_d * 100;
861                         object_flags(o_ptr, &f1, &f2, &f3);
862                         if (o_ptr->name1 == ART_VORPAL_BLADE)
863                         {
864                                 /* vorpal blade */
865                                 basedam *= 5;
866                                 basedam /= 3;
867                         }
868                         else if (object_known_p(o_ptr) && (f1 & TR1_VORPAL))
869                         {
870                                 /* vorpal flag only */
871                                 basedam *= 11;
872                                 basedam /= 9;
873                         }
874                         damage += basedam;
875                         damage *= p_ptr->num_blow[i];
876                         total_damage += damage / 200;
877                         if (i) total_damage = total_damage*7/10;
878                 }
879                 fire_beam(GF_FORCE, dir, total_damage);
880                 break;
881         }
882         case 22:
883         {
884 #ifdef JP
885                 msg_print("ͺ¶«¤Ó¤ò¤¢¤²¤¿¡ª");
886 #else
887                 msg_print("You roar out!");
888 #endif
889                 project_hack(GF_SOUND, randint(p_ptr->lev * 3));
890                 aggravate_monsters(0);
891                 break;
892         }
893         case 23:
894         {
895                 int i;
896                 if (!get_rep_dir2(&dir)) return FALSE;
897                 if (dir == 5) return FALSE;
898                 y = py + ddy[dir];
899                 x = px + ddx[dir];
900                 for (i = 0; i < 3; i++)
901                 {
902                         if (cave[y][x].m_idx)
903                                 py_attack(y, x, HISSATSU_3DAN);
904                         else
905                         {
906 #ifdef JP
907                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
908 #else
909                                 msg_print("There is no monster.");
910 #endif
911                                 return FALSE;
912                         }
913                         if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
914                         {
915                                 return TRUE;
916                         }
917                         if (cave[y][x].m_idx)
918                         {
919                                 int oy, ox;
920                                 int ny = y + ddy[dir];
921                                 int nx = x + ddx[dir];
922                                 int m_idx = cave[y][x].m_idx;
923                                 monster_type *m_ptr = &m_list[m_idx];
924                                 if (cave_empty_bold(ny, nx))
925                                 {
926                                         cave[y][x].m_idx = 0;
927                                         cave[ny][nx].m_idx = m_idx;
928                                         m_ptr->fy = ny;
929                                         m_ptr->fx = nx;
930
931                                         update_mon(m_idx, TRUE);
932
933                                         /* Save the old location */
934                                         oy = py;
935                                         ox = px;
936
937                                         /* Move the player */
938                                         py = y;
939                                         px = x;
940
941                                         if (p_ptr->riding)
942                                         {
943                                                 int tmp;
944                                                 tmp = cave[py][px].m_idx;
945                                                 cave[py][px].m_idx = cave[oy][ox].m_idx;
946                                                 cave[oy][ox].m_idx = tmp;
947                                                 m_list[p_ptr->riding].fy = py;
948                                                 m_list[p_ptr->riding].fx = px;
949                                                 update_mon(cave[py][px].m_idx, TRUE);
950                                         }
951
952                                         forget_flow();
953
954                                         /* Redraw the old spot */
955                                         lite_spot(oy, ox);
956
957                                         /* Redraw the new spot */
958                                         lite_spot(py, px);
959
960                                         /* Redraw the new spot */
961                                         lite_spot(ny, nx);
962
963                                         /* Check for new panel (redraw map) */
964                                         verify_panel();
965
966                                         /* Update stuff */
967                                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
968
969                                         /* Update the monsters */
970                                         p_ptr->update |= (PU_DISTANCE);
971
972                                         /* Window stuff */
973                                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
974
975                                         /* Handle stuff XXX XXX XXX */
976                                         handle_stuff();
977
978                                         if (i < 2) msg_print(NULL);
979                                         y += ddy[dir];
980                                         x += ddx[dir];
981                                 }
982                         }
983                         else break;
984                 }
985                 break;
986         }
987         case 24:
988         {
989                 if (!get_rep_dir2(&dir)) return FALSE;
990                 if (dir == 5) return FALSE;
991                 y = py + ddy[dir];
992                 x = px + ddx[dir];
993                 if (cave[y][x].m_idx)
994                         py_attack(y, x, HISSATSU_DRAIN);
995                 else
996                 {
997 #ifdef JP
998                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
999 #else
1000                                 msg_print("There is no monster.");
1001 #endif
1002                         return FALSE;
1003                 }
1004                 break;
1005         }
1006         case 25:
1007         {
1008 #ifdef JP
1009                 msg_print("Éð´ï¤òÉÔµ¬Â§¤ËÍɤ餷¤¿¡¥¡¥¡¥");
1010 #else
1011                 msg_print("You irregularly wave your weapon...");
1012 #endif
1013                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1014                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1015                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1016                 break;
1017         }
1018         case 26:
1019         {
1020                 bool new = TRUE;
1021                 int count = 0;
1022                 do
1023                 {
1024                         project_length = 5;
1025                         if (!get_aim_dir(&dir)) break;
1026                         if (new)
1027                                 p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana;
1028                         else
1029                                 p_ptr->csp -= 8;
1030                         new = FALSE;
1031                         if (!project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL | PROJECT_NO_REF)) break;
1032                         count++;
1033                         command_dir = 0;
1034                         p_ptr->redraw |= PR_MANA;
1035                         handle_stuff();
1036                 } while (p_ptr->csp > 8);
1037                 if (new) return FALSE;
1038                 break;
1039         }
1040         case 27:
1041         {
1042                 if (!tgt_pt(&x, &y)) return FALSE;
1043                 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
1044                         (distance(y, x, py, px) > MAX_SIGHT / 2) ||
1045                     !projectable(py, px, y, x))
1046                 {
1047 #ifdef JP
1048                         msg_print("¼ºÇÔ¡ª");
1049 #else
1050                         msg_print("You cannot move to that place!");
1051 #endif
1052                         break;
1053                 }
1054                 if (p_ptr->anti_tele)
1055                 {
1056 #ifdef JP
1057 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
1058 #else
1059                         msg_print("A mysterious force prevents you from teleporting!");
1060 #endif
1061
1062                         break;
1063                 }
1064                 project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL | PROJECT_NO_REF, -1);
1065                 teleport_player_to(y, x, TRUE);
1066                 break;
1067         }
1068         case 28:
1069         {
1070                 int x, y;
1071
1072                 if (!get_rep_dir(&dir, FALSE)) return FALSE;
1073                 y = py + ddy[dir];
1074                 x = px + ddx[dir];
1075                 if (cave[y][x].m_idx)
1076                 {
1077                         py_attack(y, x, 0);
1078                         if (cave[y][x].m_idx)
1079                         {
1080                                 handle_stuff();
1081                                 py_attack(y, x, 0);
1082                         }
1083                 }
1084                 else
1085                 {
1086 #ifdef JP
1087 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1088 #else
1089                         msg_print("You don't see any monster in this direction");
1090 #endif
1091                         return FALSE;
1092                 }
1093                 break;
1094         }
1095         case 29:
1096         {
1097                 int total_damage = 0, basedam, i;
1098                 int y, x;
1099                 u32b f1, f2, f3;
1100                 object_type *o_ptr;
1101
1102                 if (!get_rep_dir2(&dir)) return FALSE;
1103                 if (dir == 5) return FALSE;
1104                 y = py + ddy[dir];
1105                 x = px + ddx[dir];
1106                 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
1107                 {
1108 #ifdef JP
1109                         msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£");
1110 #else
1111                         msg_print("Something prevent you from attacking.");
1112 #endif
1113                         return TRUE;
1114                 }
1115 #ifdef JP
1116                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
1117 #else
1118                 msg_print("You swing your weapon downward.");
1119 #endif
1120                 for (i = 0; i < 2; i++)
1121                 {
1122                         int damage;
1123                         if (!buki_motteruka(INVEN_RARM+i)) break;
1124                         o_ptr = &inventory[INVEN_RARM+i];
1125                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
1126                         damage = o_ptr->to_d * 100;
1127                         object_flags(o_ptr, &f1, &f2, &f3);
1128                         if (o_ptr->name1 == ART_VORPAL_BLADE)
1129                         {
1130                                 /* vorpal blade */
1131                                 basedam *= 786;
1132                                 basedam /= 500;
1133                         }
1134                         else if (object_known_p(o_ptr) && (f1 & TR1_VORPAL))
1135                         {
1136                                 /* vorpal flag only */
1137                                 basedam *= 609;
1138                                 basedam /= 500;
1139                         }
1140                         damage += basedam;
1141                         damage += p_ptr->to_d[i] * 100;
1142                         damage *= p_ptr->num_blow[i];
1143                         total_damage += (damage / 100);
1144                 }
1145                 project(0, (cave_floor_bold(y, x) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
1146                 break;
1147         }
1148         case 30:
1149         {
1150                 if (!get_rep_dir2(&dir)) return FALSE;
1151                 if (dir == 5) return FALSE;
1152                 y = py + ddy[dir];
1153                 x = px + ddx[dir];
1154                 if (cave[y][x].m_idx)
1155                         py_attack(y, x, HISSATSU_UNDEAD);
1156                 else
1157                 {
1158 #ifdef JP
1159                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1160 #else
1161                         msg_print("There is no monster.");
1162 #endif
1163                         return FALSE;
1164                 }
1165 #ifdef JP
1166                 take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
1167 #else
1168                 take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "reaction of your attack", -1); /*nanka*/
1169 #endif
1170                 break;
1171         }
1172         case 31:
1173         {
1174                 int i;
1175 #ifdef JP
1176 if (!get_check("ËÜÅö¤Ë¼«»¦¤·¤Þ¤¹¤«¡©")) return FALSE;
1177 #else
1178                 if (!get_check("Do you really want to commit suicide? ")) return FALSE;
1179 #endif
1180                         /* Special Verification for suicide */
1181 #ifdef JP
1182 prt("³Îǧ¤Î¤¿¤á '@' ¤ò²¡¤·¤Æ²¼¤µ¤¤¡£", 0, 0);
1183 #else
1184                 prt("Please verify SUICIDE by typing the '@' sign: ", 0, 0);
1185 #endif
1186
1187                 flush();
1188                 i = inkey();
1189                 prt("", 0, 0);
1190                 if (i != '@') return FALSE;
1191                 if (total_winner)
1192                 {
1193                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1194                         total_winner = TRUE;
1195                 }
1196                 else
1197                 {
1198 #ifdef JP
1199                         msg_print("Éð»ÎÆ»¤È¤Ï¡¢»à¤Ì¤³¤È¤È¸«¤Ä¤±¤¿¤ê¡£");
1200                         take_hit(DAMAGE_FORCE, 9999, "ÀÚÊ¢", -1);
1201 #else
1202                         msg_print("Meaning of Bushi-do is found in the death.");
1203                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1204 #endif
1205                 }
1206                 break;
1207         }
1208         default:
1209 #ifdef JP
1210 msg_print("¤Ê¤Ë¡©");
1211 #else
1212                 msg_print("Zap?");
1213 #endif
1214
1215         }
1216
1217         return TRUE;
1218 }
1219
1220
1221 /*
1222  * do_cmd_cast calls this function if the player's class
1223  * is 'mindcrafter'.
1224  */
1225 void do_cmd_hissatsu(void)
1226 {
1227         int             n = 0;
1228         magic_type      spell;
1229         bool            cast;
1230
1231
1232         /* not if confused */
1233         if (p_ptr->confused)
1234         {
1235 #ifdef JP
1236 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
1237 #else
1238                 msg_print("You are too confused!");
1239 #endif
1240
1241                 return;
1242         }
1243         if (!buki_motteruka(INVEN_RARM))
1244         {
1245                 if (flush_failure) flush();
1246 #ifdef JP
1247 msg_print("Éð´ï¤ò»ý¤¿¤Ê¤¤¤Èɬ»¦µ»¤Ï»È¤¨¤Ê¤¤¡ª");
1248 #else
1249                 msg_print("You need to wield a weapon!");
1250 #endif
1251
1252                 return;
1253         }
1254         if (!spell_learned1)
1255         {
1256 #ifdef JP
1257 msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
1258 #else
1259                 msg_print("You don't know any martial arts.");
1260 #endif
1261
1262                 return;
1263         }
1264
1265         if (p_ptr->special_defense & KATA_MASK)
1266         {
1267                 set_action(ACTION_NONE);
1268         }
1269
1270         /* get power */
1271         if (!get_hissatsu_power(&n)) return;
1272
1273         spell = technic_info[TECHNIC_HISSATSU][n];
1274
1275         /* Verify "dangerous" spells */
1276         if (spell.smana > p_ptr->csp)
1277         {
1278                 if (flush_failure) flush();
1279                 /* Warning */
1280 #ifdef JP
1281 msg_print("£Í£Ð¤¬Â­¤ê¤Þ¤»¤ó¡£");
1282 #else
1283                 msg_print("You do not have enough mana to use this power.");
1284 #endif
1285                 msg_print(NULL);
1286                 return;
1287         }
1288
1289         sound(SOUND_ZAP);
1290
1291         /* Cast the spell */
1292         cast = cast_hissatsu_spell(n);
1293
1294         if (!cast) return;
1295
1296         /* Take a turn */
1297         energy_use = 100;
1298
1299         /* Use some mana */
1300         if (n != 25) p_ptr->csp -= spell.smana;
1301
1302         /* Limit */
1303         if (p_ptr->csp < 0) p_ptr->csp = 0;
1304
1305         /* Redraw mana */
1306         p_ptr->redraw |= (PR_MANA);
1307
1308         /* Window stuff */
1309         p_ptr->window |= (PW_PLAYER);
1310         p_ptr->window |= (PW_SPELL);
1311 }
1312
1313
1314 void do_cmd_gain_hissatsu(void)
1315 {
1316         int item, i, j;
1317
1318         object_type *o_ptr;
1319         cptr q, s;
1320
1321         bool gain = FALSE;
1322
1323         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1324         {
1325                 set_action(ACTION_NONE);
1326         }
1327
1328         if (p_ptr->blind || no_lite())
1329         {
1330 #ifdef JP
1331 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
1332 #else
1333                 msg_print("You cannot see!");
1334 #endif
1335
1336                 return;
1337         }
1338
1339         if (p_ptr->confused)
1340         {
1341 #ifdef JP
1342 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
1343 #else
1344                 msg_print("You are too confused!");
1345 #endif
1346
1347                 return;
1348         }
1349
1350         if (!(p_ptr->new_spells))
1351         {
1352 #ifdef JP
1353 msg_print("¿·¤·¤¤É¬»¦µ»¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡ª");
1354 #else
1355                 msg_print("You cannot learn any new special attacks!");
1356 #endif
1357
1358                 return;
1359         }
1360
1361 #ifdef JP
1362         if( p_ptr->new_spells < 10 ){
1363                 msg_format("¤¢¤È %d ¤Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1364         }else{
1365                 msg_format("¤¢¤È %d ¸Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1366         }
1367 #else
1368         msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
1369                 (p_ptr->new_spells == 1?"":"s"));
1370 #endif
1371
1372         item_tester_tval = TV_HISSATSU_BOOK;
1373
1374         /* Get an item */
1375 #ifdef JP
1376 q = "¤É¤Î½ñ¤«¤é³Ø¤Ó¤Þ¤¹¤«? ";
1377 #else
1378         q = "Study which book? ";
1379 #endif
1380
1381 #ifdef JP
1382 s = "Æɤá¤ë½ñ¤¬¤Ê¤¤¡£";
1383 #else
1384         s = "You have no books that you can read.";
1385 #endif
1386
1387         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1388
1389         /* Get the item (in the pack) */
1390         if (item >= 0)
1391         {
1392                 o_ptr = &inventory[item];
1393         }
1394
1395         /* Get the item (on the floor) */
1396         else
1397         {
1398                 o_ptr = &o_list[0 - item];
1399         }
1400
1401         for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
1402         {
1403                 if (spell_learned1 & (1L << i)) continue;
1404                 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
1405
1406                 spell_learned1 |= (1L << i);
1407                 spell_worked1 |= (1L << i);
1408 #ifdef JP
1409                 msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1410 #else
1411                 msg_format("You have learned the special attack of %s.", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1412 #endif
1413                 for (j = 0; j < 64; j++)
1414                 {
1415                         /* Stop at the first empty space */
1416                         if (spell_order[j] == 99) break;
1417                 }
1418                 spell_order[j] = i;
1419                 gain = TRUE;
1420         }
1421         if (!gain)
1422 #ifdef JP
1423                 msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
1424 #else
1425                 msg_print("You were not able to learn any special attacks.");
1426 #endif
1427
1428         p_ptr->update |= (PU_SPELLS);
1429 }