OSDN Git Service

剣術 "地走り", "虎伏絶刀勢" で期待値を計算する際に, 切れ味フラグによ
[hengband/hengband.git] / src / hissatsu.c
1 /* File: mind.c */
2
3 /* Purpose: Mindcrafter code */
4
5 /*
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.  Other copyrights may also apply.
11  */
12
13 #include "angband.h"
14
15 #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
16
17 /*
18  * Allow user to choose a mindcrafter power.
19  *
20  * If a valid spell is chosen, saves it in '*sn' and returns TRUE
21  * If the user hits escape, returns FALSE, and set '*sn' to -1
22  * If there are no legal choices, returns FALSE, and sets '*sn' to -2
23  *
24  * The "prompt" should be "cast", "recite", or "study"
25  * The "known" should be TRUE for cast/pray, FALSE for study
26  *
27  * nb: This function has a (trivial) display bug which will be obvious
28  * when you run it. It's probably easy to fix but I haven't tried,
29  * sorry.
30  */
31 static int get_hissatsu_power(int *sn)
32 {
33         int             i, j = 0;
34         int             num = 0;
35         int             y = 1;
36         int             x = 15;
37         int             plev = p_ptr->lev;
38         int             ask = TRUE;
39         char            choice;
40         char            out_val[160];
41         char sentaku[32];
42 #ifdef JP
43 cptr            p = "ɬ»¦·õ";
44 #else
45         cptr            p = "special attack";
46 #endif
47
48         magic_type spell;
49         bool            flag, redraw;
50         int menu_line = (use_menu ? 1 : 0);
51
52         /* Assume cancelled */
53         *sn = (-1);
54
55 #ifdef ALLOW_REPEAT /* TNB */
56
57         /* Get the spell, if available */
58         if (repeat_pull(sn))
59         {
60                 /* Verify the spell */
61                 if (technic_info[TECHNIC_HISSATSU][*sn].slevel <= plev)
62                 {
63                         /* Success */
64                         return (TRUE);
65                 }
66         }
67
68 #endif /* ALLOW_REPEAT -- TNB */
69
70         /* Nothing chosen yet */
71         flag = FALSE;
72
73         /* No redraw yet */
74         redraw = FALSE;
75
76         for (i = 0; i < 32; i++)
77         {
78                 if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL)
79                 {
80                         sentaku[num] = i;
81                         num++;
82                 }
83         }
84
85         /* Build a prompt (accept all spells) */
86 #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                                 }
112
113                                 case '8':
114                                 case 'k':
115                                 case 'K':
116                                 {
117                                         do
118                                         {
119                                                 menu_line += 31;
120                                                 if (menu_line > 32) menu_line -= 32;
121                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
122                                         break;
123                                 }
124
125                                 case '2':
126                                 case 'j':
127                                 case 'J':
128                                 {
129                                         do
130                                         {
131                                                 menu_line++;
132                                                 if (menu_line > 32) menu_line -= 32;
133                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
134                                         break;
135                                 }
136
137                                 case '4':
138                                 case 'h':
139                                 case 'H':
140                                 case '6':
141                                 case 'l':
142                                 case 'L':
143                                 {
144                                         bool reverse = FALSE;
145                                         if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
146                                         if (menu_line > 16)
147                                         {
148                                                 menu_line -= 16;
149                                                 reverse = TRUE;
150                                         }
151                                         else menu_line+=16;
152                                         while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
153                                         {
154                                                 if (reverse)
155                                                 {
156                                                         menu_line--;
157                                                         if (menu_line < 2) reverse = FALSE;
158                                                 }
159                                                 else
160                                                 {
161                                                         menu_line++;
162                                                         if (menu_line > 31) reverse = TRUE;
163                                                 }
164                                         }
165                                         break;
166                                 }
167
168                                 case 'x':
169                                 case 'X':
170                                 case '\r':
171                                 case '\n':
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 (!(p_ptr->spell_learned1 >> i)) break;
210
211                                         /* Access the spell */
212                                         if (spell.slevel > plev)   continue;
213                                         if (!(p_ptr->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) || !(p_ptr->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);
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 | PU_MON_LITE);
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_set_feat(y, x, floor_type[randint0(100)]);
677
678                 /* Update some things */
679                 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
680
681                 break;
682         }
683         case 13:
684         {
685                 if (!get_rep_dir2(&dir)) return FALSE;
686                 if (dir == 5) return FALSE;
687                 y = py + ddy[dir];
688                 x = px + ddx[dir];
689                 if (cave[y][x].m_idx)
690                         py_attack(y, x, HISSATSU_COLD);
691                 else
692                 {
693 #ifdef JP
694                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
695 #else
696                         msg_print("There is no monster.");
697 #endif
698                         return FALSE;
699                 }
700                 break;
701         }
702         case 14:
703         {
704                 if (!get_rep_dir2(&dir)) return FALSE;
705                 if (dir == 5) return FALSE;
706                 y = py + ddy[dir];
707                 x = px + ddx[dir];
708                 if (cave[y][x].m_idx)
709                         py_attack(y, x, HISSATSU_KYUSHO);
710                 else
711                 {
712 #ifdef JP
713                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
714 #else
715                         msg_print("There is no monster.");
716 #endif
717                         return FALSE;
718                 }
719                 break;
720         }
721         case 15:
722         {
723                 if (!get_rep_dir2(&dir)) return FALSE;
724                 if (dir == 5) return FALSE;
725                 y = py + ddy[dir];
726                 x = px + ddx[dir];
727                 if (cave[y][x].m_idx)
728                         py_attack(y, x, HISSATSU_MAJIN);
729                 else
730                 {
731 #ifdef JP
732                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
733 #else
734                         msg_print("There is no monster.");
735 #endif
736                         return FALSE;
737                 }
738                 break;
739         }
740         case 16:
741         {
742                 if (!get_rep_dir2(&dir)) return FALSE;
743                 if (dir == 5) return FALSE;
744                 y = py + ddy[dir];
745                 x = px + ddx[dir];
746                 if (cave[y][x].m_idx)
747                         py_attack(y, x, HISSATSU_SUTEMI);
748                 else
749                 {
750 #ifdef JP
751                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
752 #else
753                         msg_print("There is no monster.");
754 #endif
755                         return FALSE;
756                 }
757                 p_ptr->sutemi = TRUE;
758                 break;
759         }
760         case 17:
761         {
762                 if (!get_rep_dir2(&dir)) return FALSE;
763                 if (dir == 5) return FALSE;
764                 y = py + ddy[dir];
765                 x = px + ddx[dir];
766                 if (cave[y][x].m_idx)
767                         py_attack(y, x, HISSATSU_ELEC);
768                 else
769                 {
770 #ifdef JP
771                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
772 #else
773                         msg_print("There is no monster.");
774 #endif
775                         return FALSE;
776                 }
777                 break;
778         }
779         case 18:
780                 return rush_attack(NULL);
781         case 19: /* Whirlwind Attack */
782         {
783                 int y = 0, x = 0;
784                 cave_type       *c_ptr;
785                 monster_type    *m_ptr;
786
787                 if (p_ptr->cut < 300)
788                         set_cut(p_ptr->cut + 300);
789                 else
790                         set_cut(p_ptr->cut * 2);
791
792                 for (dir = 0; dir < 8; dir++)
793                 {
794                         y = py + ddy_ddd[dir];
795                         x = px + ddx_ddd[dir];
796                         c_ptr = &cave[y][x];
797
798                         /* Get the monster */
799                         m_ptr = &m_list[c_ptr->m_idx];
800
801                         /* Hack -- attack monsters */
802                         if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
803                         {
804                                 if (!monster_living(&r_info[m_ptr->r_idx]))
805                                 {
806                                         char m_name[80];
807
808                                         monster_desc(m_name, m_ptr, 0);
809 #ifdef JP
810                                         msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤¤¡ª", m_name);
811 #else
812                                         msg_format("%s is unharmed!", m_name);
813 #endif
814                                 }
815                                 else py_attack(y, x, HISSATSU_SEKIRYUKA);
816                         }
817                 }
818                 break;
819         }
820         case 20:
821         {
822                 if (!get_rep_dir2(&dir)) return FALSE;
823                 if (dir == 5) return FALSE;
824                 y = py + ddy[dir];
825                 x = px + ddx[dir];
826                 if (cave[y][x].m_idx)
827                         py_attack(y, x, HISSATSU_QUAKE);
828                 else
829                 {
830                         earthquake(py, px, 10);
831                 }
832                 break;
833         }
834         case 21:
835         {
836                 int total_damage = 0, basedam, i;
837                 u32b flgs[TR_FLAG_SIZE];
838                 object_type *o_ptr;
839                 if (!get_aim_dir(&dir)) return FALSE;
840 #ifdef JP
841                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
842 #else
843                 msg_print("You swing your weapon downward.");
844 #endif
845                 for (i = 0; i < 2; i++)
846                 {
847                         int damage;
848
849                         if (!buki_motteruka(INVEN_RARM+i)) break;
850                         o_ptr = &inventory[INVEN_RARM+i];
851                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
852                         damage = o_ptr->to_d * 100;
853                         object_flags(o_ptr, flgs);
854                         if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
855                         {
856                                 /* vorpal blade */
857                                 basedam *= 5;
858                                 basedam /= 3;
859                         }
860                         else if (have_flag(flgs, TR_VORPAL))
861                         {
862                                 /* vorpal flag only */
863                                 basedam *= 11;
864                                 basedam /= 9;
865                         }
866                         damage += basedam;
867                         damage *= p_ptr->num_blow[i];
868                         total_damage += damage / 200;
869                         if (i) total_damage = total_damage*7/10;
870                 }
871                 fire_beam(GF_FORCE, dir, total_damage);
872                 break;
873         }
874         case 22:
875         {
876 #ifdef JP
877                 msg_print("ͺ¶«¤Ó¤ò¤¢¤²¤¿¡ª");
878 #else
879                 msg_print("You roar out!");
880 #endif
881                 project_hack(GF_SOUND, randint1(p_ptr->lev * 3));
882                 aggravate_monsters(0);
883                 break;
884         }
885         case 23:
886         {
887                 int i;
888                 if (!get_rep_dir2(&dir)) return FALSE;
889                 if (dir == 5) return FALSE;
890                 for (i = 0; i < 3; i++)
891                 {
892                         int oy, ox;
893                         int ny, nx;
894                         int m_idx;
895                         monster_type *m_ptr;
896
897                         y = py + ddy[dir];
898                         x = px + ddx[dir];
899
900                         if (cave[y][x].m_idx)
901                                 py_attack(y, x, HISSATSU_3DAN);
902                         else
903                         {
904 #ifdef JP
905                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
906 #else
907                                 msg_print("There is no monster.");
908 #endif
909                                 return FALSE;
910                         }
911
912                         if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
913                         {
914                                 return TRUE;
915                         }
916
917                         /* Monster is dead? */
918                         if (!cave[y][x].m_idx) break;
919
920                         ny = y + ddy[dir];
921                         nx = x + ddx[dir];
922                         m_idx = cave[y][x].m_idx;
923                         m_ptr = &m_list[m_idx];
924
925                         /* Monster cannot move back? */
926                         if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx])) continue;
927
928                         cave[y][x].m_idx = 0;
929                         cave[ny][nx].m_idx = m_idx;
930                         m_ptr->fy = ny;
931                         m_ptr->fx = nx;
932
933                         update_mon(m_idx, TRUE);
934
935                         /* Player can move forward? */
936                         if (player_can_enter(cave[y][x].feat))
937                         {
938                                 /* Save the old location */
939                                 oy = py;
940                                 ox = px;
941
942                                 /* Move the player */
943                                 py = y;
944                                 px = x;
945
946                                 if (p_ptr->riding)
947                                 {
948                                         int tmp;
949                                         tmp = cave[py][px].m_idx;
950                                         cave[py][px].m_idx = cave[oy][ox].m_idx;
951                                         cave[oy][ox].m_idx = tmp;
952                                         m_list[p_ptr->riding].fy = py;
953                                         m_list[p_ptr->riding].fx = px;
954                                         update_mon(cave[py][px].m_idx, TRUE);
955                                 }
956
957                                 forget_flow();
958
959                                 /* Redraw the old spot */
960                                 lite_spot(oy, ox);
961
962                                 /* Redraw the new spot */
963                                 lite_spot(py, px);
964                         }
965
966                         /* Redraw the old spot */
967                         lite_spot(y, x);
968
969                         /* Redraw the new spot */
970                         lite_spot(ny, nx);
971
972                         /* Check for new panel (redraw map) */
973                         verify_panel();
974
975                         /* Update stuff */
976                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
977
978                         /* Update the monsters */
979                         p_ptr->update |= (PU_DISTANCE);
980
981                         /* Window stuff */
982                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
983
984                         /* Handle stuff */
985                         handle_stuff();
986
987                         /* -more- */
988                         if (i < 2) msg_print(NULL);
989                 }
990                 break;
991         }
992         case 24:
993         {
994                 if (!get_rep_dir2(&dir)) return FALSE;
995                 if (dir == 5) return FALSE;
996                 y = py + ddy[dir];
997                 x = px + ddx[dir];
998                 if (cave[y][x].m_idx)
999                         py_attack(y, x, HISSATSU_DRAIN);
1000                 else
1001                 {
1002 #ifdef JP
1003                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1004 #else
1005                                 msg_print("There is no monster.");
1006 #endif
1007                         return FALSE;
1008                 }
1009                 break;
1010         }
1011         case 25:
1012         {
1013 #ifdef JP
1014                 msg_print("Éð´ï¤òÉÔµ¬Â§¤ËÍɤ餷¤¿¡¥¡¥¡¥");
1015 #else
1016                 msg_print("You irregularly wave your weapon...");
1017 #endif
1018                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1019                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1020                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1021                 break;
1022         }
1023         case 26:
1024         {
1025 #define NEED_MANA_PER_MONSTER 8
1026                 bool new = TRUE;
1027                 bool mdeath;
1028                 /* int count = 0; currently unused */
1029                 do
1030                 {
1031                         if (!rush_attack(&mdeath)) break;
1032                         if (new)
1033                         {
1034                                 /* Reserve needed mana point */
1035                                 p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana;
1036                                 new = FALSE;
1037                         }
1038                         else
1039                                 p_ptr->csp -= NEED_MANA_PER_MONSTER;
1040                         if (!mdeath) break;
1041                         /* count++; currently unused */
1042                         command_dir = 0;
1043                         p_ptr->redraw |= PR_MANA;
1044                         handle_stuff();
1045                 }
1046                 while (p_ptr->csp > NEED_MANA_PER_MONSTER);
1047                 if (new) return FALSE;
1048
1049                 /* Restore reserved mana */
1050                 p_ptr->csp += technic_info[TECHNIC_HISSATSU][26].smana;
1051                 break;
1052
1053 #undef NEED_MANA_PER_MONSTER
1054         }
1055         case 27:
1056         {
1057                 if (!tgt_pt(&x, &y)) return FALSE;
1058                 if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
1059                         (distance(y, x, py, px) > MAX_SIGHT / 2) ||
1060                     !projectable(py, px, y, x))
1061                 {
1062 #ifdef JP
1063                         msg_print("¼ºÇÔ¡ª");
1064 #else
1065                         msg_print("You cannot move to that place!");
1066 #endif
1067                         break;
1068                 }
1069                 if (p_ptr->anti_tele)
1070                 {
1071 #ifdef JP
1072 msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
1073 #else
1074                         msg_print("A mysterious force prevents you from teleporting!");
1075 #endif
1076
1077                         break;
1078                 }
1079                 project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
1080                 teleport_player_to(y, x, TRUE);
1081                 break;
1082         }
1083         case 28:
1084         {
1085                 int x, y;
1086
1087                 if (!get_rep_dir(&dir, FALSE)) return FALSE;
1088                 y = py + ddy[dir];
1089                 x = px + ddx[dir];
1090                 if (cave[y][x].m_idx)
1091                 {
1092                         py_attack(y, x, 0);
1093                         if (cave[y][x].m_idx)
1094                         {
1095                                 handle_stuff();
1096                                 py_attack(y, x, 0);
1097                         }
1098                 }
1099                 else
1100                 {
1101 #ifdef JP
1102 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1103 #else
1104                         msg_print("You don't see any monster in this direction");
1105 #endif
1106                         return FALSE;
1107                 }
1108                 break;
1109         }
1110         case 29:
1111         {
1112                 int total_damage = 0, basedam, i;
1113                 int y, x;
1114                 u32b flgs[TR_FLAG_SIZE];
1115                 object_type *o_ptr;
1116
1117                 if (!get_rep_dir2(&dir)) return FALSE;
1118                 if (dir == 5) return FALSE;
1119                 y = py + ddy[dir];
1120                 x = px + ddx[dir];
1121                 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
1122                 {
1123 #ifdef JP
1124                         msg_print("¤Ê¤¼¤«¹¶·â¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£");
1125 #else
1126                         msg_print("Something prevent you from attacking.");
1127 #endif
1128                         return TRUE;
1129                 }
1130 #ifdef JP
1131                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
1132 #else
1133                 msg_print("You swing your weapon downward.");
1134 #endif
1135                 for (i = 0; i < 2; i++)
1136                 {
1137                         int damage;
1138                         if (!buki_motteruka(INVEN_RARM+i)) break;
1139                         o_ptr = &inventory[INVEN_RARM+i];
1140                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
1141                         damage = o_ptr->to_d * 100;
1142                         object_flags(o_ptr, flgs);
1143                         if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
1144                         {
1145                                 /* vorpal blade */
1146                                 basedam *= 5;
1147                                 basedam /= 3;
1148                         }
1149                         else if (have_flag(flgs, TR_VORPAL))
1150                         {
1151                                 /* vorpal flag only */
1152                                 basedam *= 11;
1153                                 basedam /= 9;
1154                         }
1155                         damage += basedam;
1156                         damage += p_ptr->to_d[i] * 100;
1157                         damage *= p_ptr->num_blow[i];
1158                         total_damage += (damage / 100);
1159                 }
1160                 project(0, (cave_floor_bold(y, x) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
1161                 break;
1162         }
1163         case 30:
1164         {
1165                 if (!get_rep_dir2(&dir)) return FALSE;
1166                 if (dir == 5) return FALSE;
1167                 y = py + ddy[dir];
1168                 x = px + ddx[dir];
1169                 if (cave[y][x].m_idx)
1170                         py_attack(y, x, HISSATSU_UNDEAD);
1171                 else
1172                 {
1173 #ifdef JP
1174                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1175 #else
1176                         msg_print("There is no monster.");
1177 #endif
1178                         return FALSE;
1179                 }
1180 #ifdef JP
1181                 take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
1182 #else
1183                 take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "exhaustion on using Keiun-Kininken", -1);
1184 #endif
1185                 break;
1186         }
1187         case 31:
1188         {
1189                 int i;
1190 #ifdef JP
1191 if (!get_check("ËÜÅö¤Ë¼«»¦¤·¤Þ¤¹¤«¡©")) return FALSE;
1192 #else
1193                 if (!get_check("Do you really want to commit suicide? ")) return FALSE;
1194 #endif
1195                         /* Special Verification for suicide */
1196 #ifdef JP
1197 prt("³Îǧ¤Î¤¿¤á '@' ¤ò²¡¤·¤Æ²¼¤µ¤¤¡£", 0, 0);
1198 #else
1199                 prt("Please verify SUICIDE by typing the '@' sign: ", 0, 0);
1200 #endif
1201
1202                 flush();
1203                 i = inkey();
1204                 prt("", 0, 0);
1205                 if (i != '@') return FALSE;
1206                 if (p_ptr->total_winner)
1207                 {
1208                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1209                         p_ptr->total_winner = TRUE;
1210                 }
1211                 else
1212                 {
1213 #ifdef JP
1214                         msg_print("Éð»ÎÆ»¤È¤Ï¡¢»à¤Ì¤³¤È¤È¸«¤Ä¤±¤¿¤ê¡£");
1215                         take_hit(DAMAGE_FORCE, 9999, "ÀÚÊ¢", -1);
1216 #else
1217                         msg_print("Meaning of Bushi-do is found in the death.");
1218                         take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
1219 #endif
1220                 }
1221                 break;
1222         }
1223         default:
1224 #ifdef JP
1225 msg_print("¤Ê¤Ë¡©");
1226 #else
1227                 msg_print("Zap?");
1228 #endif
1229
1230         }
1231
1232         return TRUE;
1233 }
1234
1235
1236 /*
1237  * do_cmd_cast calls this function if the player's class
1238  * is 'mindcrafter'.
1239  */
1240 void do_cmd_hissatsu(void)
1241 {
1242         int             n = 0;
1243         magic_type      spell;
1244         bool            cast;
1245
1246
1247         /* not if confused */
1248         if (p_ptr->confused)
1249         {
1250 #ifdef JP
1251 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
1252 #else
1253                 msg_print("You are too confused!");
1254 #endif
1255
1256                 return;
1257         }
1258         if (!buki_motteruka(INVEN_RARM))
1259         {
1260                 if (flush_failure) flush();
1261 #ifdef JP
1262 msg_print("Éð´ï¤ò»ý¤¿¤Ê¤¤¤Èɬ»¦µ»¤Ï»È¤¨¤Ê¤¤¡ª");
1263 #else
1264                 msg_print("You need to wield a weapon!");
1265 #endif
1266
1267                 return;
1268         }
1269         if (!p_ptr->spell_learned1)
1270         {
1271 #ifdef JP
1272 msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
1273 #else
1274                 msg_print("You don't know any special attacks.");
1275 #endif
1276
1277                 return;
1278         }
1279
1280         if (p_ptr->special_defense & KATA_MASK)
1281         {
1282                 set_action(ACTION_NONE);
1283         }
1284
1285         /* get power */
1286         if (!get_hissatsu_power(&n)) return;
1287
1288         spell = technic_info[TECHNIC_HISSATSU][n];
1289
1290         /* Verify "dangerous" spells */
1291         if (spell.smana > p_ptr->csp)
1292         {
1293                 if (flush_failure) flush();
1294                 /* Warning */
1295 #ifdef JP
1296 msg_print("£Í£Ð¤¬Â­¤ê¤Þ¤»¤ó¡£");
1297 #else
1298                 msg_print("You do not have enough mana to use this power.");
1299 #endif
1300                 msg_print(NULL);
1301                 return;
1302         }
1303
1304         sound(SOUND_ZAP);
1305
1306         /* Cast the spell */
1307         cast = cast_hissatsu_spell(n);
1308
1309         if (!cast) return;
1310
1311         /* Take a turn */
1312         energy_use = 100;
1313
1314         /* Use some mana */
1315         p_ptr->csp -= spell.smana;
1316
1317         /* Limit */
1318         if (p_ptr->csp < 0) p_ptr->csp = 0;
1319
1320         /* Redraw mana */
1321         p_ptr->redraw |= (PR_MANA);
1322
1323         /* Window stuff */
1324         p_ptr->window |= (PW_PLAYER);
1325         p_ptr->window |= (PW_SPELL);
1326 }
1327
1328
1329 void do_cmd_gain_hissatsu(void)
1330 {
1331         int item, i, j;
1332
1333         object_type *o_ptr;
1334         cptr q, s;
1335
1336         bool gain = FALSE;
1337
1338         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1339         {
1340                 set_action(ACTION_NONE);
1341         }
1342
1343         if (p_ptr->blind || no_lite())
1344         {
1345 #ifdef JP
1346 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
1347 #else
1348                 msg_print("You cannot see!");
1349 #endif
1350
1351                 return;
1352         }
1353
1354         if (p_ptr->confused)
1355         {
1356 #ifdef JP
1357 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
1358 #else
1359                 msg_print("You are too confused!");
1360 #endif
1361
1362                 return;
1363         }
1364
1365         if (!(p_ptr->new_spells))
1366         {
1367 #ifdef JP
1368 msg_print("¿·¤·¤¤É¬»¦µ»¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡ª");
1369 #else
1370                 msg_print("You cannot learn any new special attacks!");
1371 #endif
1372
1373                 return;
1374         }
1375
1376 #ifdef JP
1377         if( p_ptr->new_spells < 10 ){
1378                 msg_format("¤¢¤È %d ¤Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1379         }else{
1380                 msg_format("¤¢¤È %d ¸Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
1381         }
1382 #else
1383         msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
1384                 (p_ptr->new_spells == 1?"":"s"));
1385 #endif
1386
1387         item_tester_tval = TV_HISSATSU_BOOK;
1388
1389         /* Get an item */
1390 #ifdef JP
1391 q = "¤É¤Î½ñ¤«¤é³Ø¤Ó¤Þ¤¹¤«? ";
1392 #else
1393         q = "Study which book? ";
1394 #endif
1395
1396 #ifdef JP
1397 s = "Æɤá¤ë½ñ¤¬¤Ê¤¤¡£";
1398 #else
1399         s = "You have no books that you can read.";
1400 #endif
1401
1402         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1403
1404         /* Get the item (in the pack) */
1405         if (item >= 0)
1406         {
1407                 o_ptr = &inventory[item];
1408         }
1409
1410         /* Get the item (on the floor) */
1411         else
1412         {
1413                 o_ptr = &o_list[0 - item];
1414         }
1415
1416         for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
1417         {
1418                 if (p_ptr->spell_learned1 & (1L << i)) continue;
1419                 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
1420
1421                 p_ptr->spell_learned1 |= (1L << i);
1422                 p_ptr->spell_worked1 |= (1L << i);
1423 #ifdef JP
1424                 msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1425 #else
1426                 msg_format("You have learned the special attack of %s.", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
1427 #endif
1428                 for (j = 0; j < 64; j++)
1429                 {
1430                         /* Stop at the first empty space */
1431                         if (p_ptr->spell_order[j] == 99) break;
1432                 }
1433                 p_ptr->spell_order[j] = i;
1434                 gain = TRUE;
1435         }
1436
1437         /* No gain ... */
1438         if (!gain)
1439 #ifdef JP
1440                 msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
1441 #else
1442                 msg_print("You were not able to learn any special attacks.");
1443 #endif
1444
1445         /* Take a turn */
1446         else
1447                 energy_use = 100;
1448
1449         p_ptr->update |= (PU_SPELLS);
1450 }