OSDN Git Service

Leon氏の勧めに従って、Vanillaのコードと同様に各ソースファイルの頭の
[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                                         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(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
123                                         break;
124                                 }
125
126                                 case '2':
127                                 case 'j':
128                                 case 'J':
129                                 {
130                                         do
131                                         {
132                                                 menu_line++;
133                                                 if (menu_line > 32) menu_line -= 32;
134                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
135                                         break;
136                                 }
137
138                                 case '4':
139                                 case 'h':
140                                 case 'H':
141                                 case '6':
142                                 case 'l':
143                                 case 'L':
144                                 {
145                                         bool reverse = FALSE;
146                                         if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
147                                         if (menu_line > 16)
148                                         {
149                                                 menu_line -= 16;
150                                                 reverse = TRUE;
151                                         }
152                                         else menu_line+=16;
153                                         while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
154                                         {
155                                                 if (reverse)
156                                                 {
157                                                         menu_line--;
158                                                         if (menu_line < 2) reverse = FALSE;
159                                                 }
160                                                 else
161                                                 {
162                                                         menu_line++;
163                                                         if (menu_line > 31) reverse = TRUE;
164                                                 }
165                                         }
166                                         break;
167                                 }
168
169                                 case 'x':
170                                 case 'X':
171                                 case '\r':
172                                 case '\n':
173                                 {
174                                         i = menu_line - 1;
175                                         ask = FALSE;
176                                         break;
177                                 }
178                         }
179                 }
180                 /* Request redraw */
181                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
182                 {
183                         /* Show the list */
184                         if (!redraw || use_menu)
185                         {
186                                 char psi_desc[80];
187                                 int line;
188
189                                 /* Show list */
190                                 redraw = TRUE;
191
192                                 /* Save the screen */
193                                 if (!use_menu) screen_save();
194
195                                 /* Display a list of spells */
196                                 prt("", y, x);
197 #ifdef JP
198 put_str("̾Á°              Lv  MP      Ì¾Á°              Lv  MP ", y, x + 5);
199 #else
200 put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
201 #endif
202                                 prt("", y+1, x);
203                                 /* Dump the spells */
204                                 for (i = 0, line = 0; i < 32; i++)
205                                 {
206                                         spell = technic_info[TECHNIC_HISSATSU][i];
207
208                                         if (spell.slevel > PY_MAX_LEVEL) continue;
209                                         line++;
210                                         if (!(p_ptr->spell_learned1 >> i)) break;
211
212                                         /* Access the spell */
213                                         if (spell.slevel > plev)   continue;
214                                         if (!(p_ptr->spell_learned1 & (1L << i))) continue;
215                                         if (use_menu)
216                                         {
217                                                 if (i == (menu_line-1))
218 #ifdef JP
219                                                         strcpy(psi_desc, "  ¡Õ");
220 #else
221                                                         strcpy(psi_desc, "  > ");
222 #endif
223                                                 else strcpy(psi_desc, "    ");
224                                                 
225                                         }
226                                         else
227                                         {
228                                                 char letter;
229                                                 if (line <= 26)
230                                                         letter = I2A(line-1);
231                                                 else
232                                                         letter = '0' + line - 27;
233                                                 sprintf(psi_desc, "  %c)",letter);
234                                         }
235
236                                         /* Dump the spell --(-- */
237                                         strcat(psi_desc, format(" %-18s%2d %3d",
238                                                 spell_names[technic2magic(REALM_HISSATSU)-1][i],
239                                                 spell.slevel, spell.smana));
240                                         prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
241                                         prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
242                                 }
243                         }
244
245                         /* Hide the list */
246                         else
247                         {
248                                 /* Hide list */
249                                 redraw = FALSE;
250
251                                 /* Restore the screen */
252                                 screen_load();
253                         }
254
255                         /* Redo asking */
256                         continue;
257                 }
258
259                 if (!use_menu)
260                 {
261                         if (isalpha(choice))
262                         {
263                                 /* Note verify */
264                                 ask = (isupper(choice));
265
266                                 /* Lowercase */
267                                 if (ask) choice = tolower(choice);
268
269                                 /* Extract request */
270                                 i = (islower(choice) ? A2I(choice) : -1);
271                         }
272                         else
273                         {
274                                 ask = FALSE; /* Can't uppercase digits */
275
276                                 i = choice - '0' + 26;
277                         }
278                 }
279
280                 /* Totally Illegal */
281                 if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
282                 {
283                         bell();
284                         continue;
285                 }
286
287                 j = sentaku[i];
288
289                 /* Verify it */
290                 if (ask)
291                 {
292                         char tmp_val[160];
293
294                         /* Prompt */
295 #ifdef JP
296 (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
297 #else
298                         (void)strnfmt(tmp_val, 78, "Use %s? ", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
299 #endif
300
301
302                         /* Belay that order */
303                         if (!get_check(tmp_val)) continue;
304                 }
305
306                 /* Stop the loop */
307                 flag = TRUE;
308         }
309
310         /* Restore the screen */
311         if (redraw) screen_load();
312
313         /* Show choices */
314         if (show_choices)
315         {
316                 /* Update */
317                 p_ptr->window |= (PW_SPELL);
318
319                 /* Window stuff */
320                 window_stuff();
321         }
322
323         /* Abort if needed */
324         if (!flag) return (FALSE);
325
326         /* Save the choice */
327         (*sn) = j;
328
329 #ifdef ALLOW_REPEAT /* TNB */
330
331         repeat_push(*sn);
332
333 #endif /* ALLOW_REPEAT -- TNB */
334
335         /* Success */
336         return (TRUE);
337 }
338
339
340 /*
341  * do_cmd_cast calls this function if the player's class
342  * is 'mindcrafter'.
343  */
344 static bool cast_hissatsu_spell(int spell)
345 {
346         int             y, x;
347         int             dir;
348
349
350         /* spell code */
351         switch (spell)
352         {
353         case 0:
354                 project_length = 2;
355                 if (!get_aim_dir(&dir)) return FALSE;
356                 project_hook(GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
357
358                 break;
359         case 1:
360         {
361                 int cdir;
362                 if (!get_rep_dir2(&dir)) return FALSE;
363                 if (dir == 5) return FALSE;
364                 for (cdir = 0;cdir < 8; cdir++)
365                 {
366                         if (cdd[cdir] == dir) break;
367                 }
368                 if (cdir == 8) return FALSE;
369                 y = py + ddy_cdd[cdir];
370                 x = px + ddx_cdd[cdir];
371                 if (cave[y][x].m_idx)
372                         py_attack(y, x, 0);
373                 else
374 #ifdef JP
375                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
376 #else
377                         msg_print("You attack the empty air.");
378 #endif
379                 y = py + ddy_cdd[(cdir + 7) % 8];
380                 x = px + ddx_cdd[(cdir + 7) % 8];
381                 if (cave[y][x].m_idx)
382                         py_attack(y, x, 0);
383                 else
384 #ifdef JP
385                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
386 #else
387                         msg_print("You attack the empty air.");
388 #endif
389                 y = py + ddy_cdd[(cdir + 1) % 8];
390                 x = px + ddx_cdd[(cdir + 1) % 8];
391                 if (cave[y][x].m_idx)
392                         py_attack(y, x, 0);
393                 else
394 #ifdef JP
395                         msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
396 #else
397                         msg_print("You attack the empty air.");
398 #endif
399
400                 break;
401         }
402         case 2:
403         {
404                 if (!do_cmd_throw_aux(1, TRUE, 0)) return FALSE;
405                 break;
406         }
407         case 3:
408         {
409                 if (!get_rep_dir2(&dir)) return FALSE;
410                 if (dir == 5) return FALSE;
411                 y = py + ddy[dir];
412                 x = px + ddx[dir];
413                 if (cave[y][x].m_idx)
414                         py_attack(y, x, HISSATSU_FIRE);
415                 else
416                 {
417 #ifdef JP
418                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
419 #else
420                         msg_print("There is no monster.");
421 #endif
422                         return FALSE;
423                 }
424                 break;
425         }
426         case 4:
427         {
428                 detect_monsters_mind(DETECT_RAD_DEFAULT);
429                 break;
430         }
431         case 5:
432         {
433                 if (!get_rep_dir2(&dir)) return FALSE;
434                 if (dir == 5) return FALSE;
435                 y = py + ddy[dir];
436                 x = px + ddx[dir];
437                 if (cave[y][x].m_idx)
438                         py_attack(y, x, HISSATSU_MINEUCHI);
439                 else
440                 {
441 #ifdef JP
442                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
443 #else
444                         msg_print("There is no monster.");
445 #endif
446                         return FALSE;
447                 }
448                 break;
449         }
450         case 6:
451         {
452                 if (p_ptr->riding)
453                 {
454 #ifdef JP
455                         msg_print("¾èÇÏÃæ¤Ë¤Ï̵Íý¤À¡£");
456 #else
457                         msg_print("You cannot do it when riding.");
458 #endif
459                         return FALSE;
460                 }
461 #ifdef JP
462                 msg_print("Áê¼ê¤Î¹¶·â¤ËÂФ·¤Æ¿È¹½¤¨¤¿¡£");
463 #else
464                 msg_print("You prepare to counter blow.");
465 #endif
466                 p_ptr->counter = TRUE;
467                 break;
468         }
469         case 7:
470         {
471                 if (p_ptr->riding)
472                 {
473 #ifdef JP
474                         msg_print("¾èÇÏÃæ¤Ë¤Ï̵Íý¤À¡£");
475 #else
476                         msg_print("You cannot do it when riding.");
477 #endif
478                         return FALSE;
479                 }
480
481                 if (!get_rep_dir2(&dir)) return FALSE;
482
483                 if (dir == 5) return FALSE;
484                 y = py + ddy[dir];
485                 x = px + ddx[dir];
486
487                 if (!cave[y][x].m_idx)
488                 {
489 #ifdef JP
490                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
491 #else
492                         msg_print("There is no monster.");
493 #endif
494                         return FALSE;
495                 }
496
497                 py_attack(y, x, 0);
498
499                 if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
500                         break;
501
502                 y += ddy[dir];
503                 x += ddx[dir];
504
505                 if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
506                 {
507                         int oy, ox;
508
509                         msg_print(NULL);
510
511                         /* Save the old location */
512                         oy = py;
513                         ox = px;
514
515                         /* Move the player */
516                         py = y;
517                         px = x;
518
519                         forget_flow();
520
521                         /* Redraw the old spot */
522                         lite_spot(oy, ox);
523
524                         /* Redraw the new spot */
525                         lite_spot(py, px);
526
527                         /* Check for new panel (redraw map) */
528                         verify_panel();
529
530                         /* Update stuff */
531                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
532
533                         /* Update the monsters */
534                         p_ptr->update |= (PU_DISTANCE);
535
536                         /* Window stuff */
537                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
538
539                         /* Handle stuff XXX XXX XXX */
540                         handle_stuff();
541                 }
542                 break;
543         }
544         case 8:
545         {
546                 if (!get_rep_dir2(&dir)) return FALSE;
547                 if (dir == 5) return FALSE;
548                 y = py + ddy[dir];
549                 x = px + ddx[dir];
550                 if (cave[y][x].m_idx)
551                         py_attack(y, x, HISSATSU_POISON);
552                 else
553                 {
554 #ifdef JP
555                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
556 #else
557                         msg_print("There is no monster.");
558 #endif
559                         return FALSE;
560                 }
561                 break;
562         }
563         case 9:
564         {
565                 if (!get_rep_dir2(&dir)) return FALSE;
566                 if (dir == 5) return FALSE;
567                 y = py + ddy[dir];
568                 x = px + ddx[dir];
569                 if (cave[y][x].m_idx)
570                         py_attack(y, x, HISSATSU_ZANMA);
571                 else
572                 {
573 #ifdef JP
574                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
575 #else
576                         msg_print("There is no monster.");
577 #endif
578                         return FALSE;
579                 }
580                 break;
581         }
582         case 10:
583         {
584                 if (!get_rep_dir2(&dir)) return FALSE;
585                 if (dir == 5) return FALSE;
586                 y = py + ddy[dir];
587                 x = px + ddx[dir];
588                 if (cave[y][x].m_idx)
589                         py_attack(y, x, 0);
590                 else
591                 {
592 #ifdef JP
593                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
594 #else
595                         msg_print("There is no monster.");
596 #endif
597                         return FALSE;
598                 }
599                 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
600                 {
601                         return TRUE;
602                 }
603                 if (cave[y][x].m_idx)
604                 {
605                         int i;
606                         int ty = y, tx = x;
607                         int oy = y, ox = x;
608                         int m_idx = cave[y][x].m_idx;
609                         monster_type *m_ptr = &m_list[m_idx];
610                         char m_name[80];
611
612                         monster_desc(m_name, m_ptr, 0);
613
614                         for (i = 0; i < 5; i++)
615                         {
616                                 y += ddy[dir];
617                                 x += ddx[dir];
618                                 if (cave_empty_bold(y, x))
619                                 {
620                                         ty = y;
621                                         tx = x;
622                                 }
623                                 else break;
624                         }
625                         if ((ty != oy) || (tx != ox))
626                         {
627 #ifdef JP
628                                 msg_format("%s¤ò¿á¤­Èô¤Ð¤·¤¿¡ª", m_name);
629 #else
630                                 msg_format("You blow %s away!", m_name);
631 #endif
632                                 cave[oy][ox].m_idx = 0;
633                                 cave[ty][tx].m_idx = m_idx;
634                                 m_ptr->fy = ty;
635                                 m_ptr->fx = tx;
636
637                                 update_mon(m_idx, TRUE);
638                                 lite_spot(oy, ox);
639                                 lite_spot(ty, tx);
640                         }
641                 }
642                 break;
643         }
644         case 11:
645         {
646                 if (p_ptr->lev > 44)
647                 {
648                         if (!identify_fully(TRUE)) return FALSE;
649                 }
650                 else
651                 {
652                         if (!ident_spell(TRUE)) return FALSE;
653                 }
654                 break;
655         }
656         case 12:
657         {
658                 if (!get_rep_dir2(&dir)) return FALSE;
659                 if (dir == 5) return FALSE;
660                 y = py + ddy[dir];
661                 x = px + ddx[dir];
662                 if (cave[y][x].m_idx)
663                         py_attack(y, x, HISSATSU_HAGAN);
664
665                 /* Non-walls (etc) */
666                 if (cave_floor_bold(y, x)) break;
667
668                 /* Permanent walls */
669                 if (cave[y][x].feat >= FEAT_PERM_EXTRA) break;
670
671                 if (cave[y][x].feat < FEAT_DOOR_HEAD) break;
672
673                 /* Forget the wall */
674                 cave[y][x].info &= ~(CAVE_MARK);
675
676                 /* Destroy the feature */
677                 cave_set_feat(y, x, floor_type[randint0(100)]);
678
679                 /* Update some things */
680                 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
681
682                 break;
683         }
684         case 13:
685         {
686                 if (!get_rep_dir2(&dir)) return FALSE;
687                 if (dir == 5) return FALSE;
688                 y = py + ddy[dir];
689                 x = px + ddx[dir];
690                 if (cave[y][x].m_idx)
691                         py_attack(y, x, HISSATSU_COLD);
692                 else
693                 {
694 #ifdef JP
695                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
696 #else
697                         msg_print("There is no monster.");
698 #endif
699                         return FALSE;
700                 }
701                 break;
702         }
703         case 14:
704         {
705                 if (!get_rep_dir2(&dir)) return FALSE;
706                 if (dir == 5) return FALSE;
707                 y = py + ddy[dir];
708                 x = px + ddx[dir];
709                 if (cave[y][x].m_idx)
710                         py_attack(y, x, HISSATSU_KYUSHO);
711                 else
712                 {
713 #ifdef JP
714                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
715 #else
716                         msg_print("There is no monster.");
717 #endif
718                         return FALSE;
719                 }
720                 break;
721         }
722         case 15:
723         {
724                 if (!get_rep_dir2(&dir)) return FALSE;
725                 if (dir == 5) return FALSE;
726                 y = py + ddy[dir];
727                 x = px + ddx[dir];
728                 if (cave[y][x].m_idx)
729                         py_attack(y, x, HISSATSU_MAJIN);
730                 else
731                 {
732 #ifdef JP
733                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
734 #else
735                         msg_print("There is no monster.");
736 #endif
737                         return FALSE;
738                 }
739                 break;
740         }
741         case 16:
742         {
743                 if (!get_rep_dir2(&dir)) return FALSE;
744                 if (dir == 5) return FALSE;
745                 y = py + ddy[dir];
746                 x = px + ddx[dir];
747                 if (cave[y][x].m_idx)
748                         py_attack(y, x, HISSATSU_SUTEMI);
749                 else
750                 {
751 #ifdef JP
752                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
753 #else
754                         msg_print("There is no monster.");
755 #endif
756                         return FALSE;
757                 }
758                 p_ptr->sutemi = TRUE;
759                 break;
760         }
761         case 17:
762         {
763                 if (!get_rep_dir2(&dir)) return FALSE;
764                 if (dir == 5) return FALSE;
765                 y = py + ddy[dir];
766                 x = px + ddx[dir];
767                 if (cave[y][x].m_idx)
768                         py_attack(y, x, HISSATSU_ELEC);
769                 else
770                 {
771 #ifdef JP
772                         msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
773 #else
774                         msg_print("There is no monster.");
775 #endif
776                         return FALSE;
777                 }
778                 break;
779         }
780         case 18:
781                 project_length = 5;
782                 if (!get_aim_dir(&dir)) return FALSE;
783                 project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL);
784
785                 break;
786         case 19: /* Whirlwind Attack */
787         {
788                 int y = 0, x = 0;
789                 cave_type       *c_ptr;
790                 monster_type    *m_ptr;
791
792                 if (p_ptr->cut < 300)
793                         set_cut(p_ptr->cut + 300);
794                 else
795                         set_cut(p_ptr->cut * 2);
796
797                 for (dir = 0; dir < 8; dir++)
798                 {
799                         y = py + ddy_ddd[dir];
800                         x = px + ddx_ddd[dir];
801                         c_ptr = &cave[y][x];
802
803                         /* Get the monster */
804                         m_ptr = &m_list[c_ptr->m_idx];
805
806                         /* Hack -- attack monsters */
807                         if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
808                         {
809                                 if (r_info[m_list[c_ptr->m_idx].r_idx].flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING))
810                                 {
811                                         char m_name[80];
812
813                                         monster_desc(m_name, &m_list[c_ptr->m_idx], 0);
814 #ifdef JP
815                                         msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤¤¡ª", m_name);
816 #else
817                                         msg_format("%s is unharmed!", m_name);
818 #endif
819                                 }
820                                 else py_attack(y, x, HISSATSU_SEKIRYUKA);
821                         }
822                 }
823                 break;
824         }
825         case 20:
826         {
827                 if (!get_rep_dir2(&dir)) return FALSE;
828                 if (dir == 5) return FALSE;
829                 y = py + ddy[dir];
830                 x = px + ddx[dir];
831                 if (cave[y][x].m_idx)
832                         py_attack(y, x, HISSATSU_QUAKE);
833                 else
834                 {
835                         earthquake(py, px, 10);
836                 }
837                 break;
838         }
839         case 21:
840         {
841                 int total_damage = 0, basedam, i;
842                 u32b flgs[TR_FLAG_SIZE];
843                 object_type *o_ptr;
844                 if (!get_aim_dir(&dir)) return FALSE;
845 #ifdef JP
846                 msg_print("Éð´ï¤òÂ礭¤¯¿¶¤ê²¼¤í¤·¤¿¡£");
847 #else
848                 msg_print("You swing your weapon downward.");
849 #endif
850                 for (i = 0; i < 2; i++)
851                 {
852                         int damage;
853
854                         if (!buki_motteruka(INVEN_RARM+i)) break;
855                         o_ptr = &inventory[INVEN_RARM+i];
856                         basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
857                         damage = o_ptr->to_d * 100;
858                         object_flags(o_ptr, flgs);
859                         if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
860                         {
861                                 /* vorpal blade */
862                                 basedam *= 5;
863                                 basedam /= 3;
864                         }
865                         else if (object_known_p(o_ptr) && (have_flag(flgs, TR_VORPAL)))
866                         {
867                                 /* vorpal flag only */
868                                 basedam *= 11;
869                                 basedam /= 9;
870                         }
871                         damage += basedam;
872                         damage *= p_ptr->num_blow[i];
873                         total_damage += damage / 200;
874                         if (i) total_damage = total_damage*7/10;
875                 }
876                 fire_beam(GF_FORCE, dir, total_damage);
877                 break;
878         }
879         case 22:
880         {
881 #ifdef JP
882                 msg_print("ͺ¶«¤Ó¤ò¤¢¤²¤¿¡ª");
883 #else
884                 msg_print("You roar out!");
885 #endif
886                 project_hack(GF_SOUND, randint1(p_ptr->lev * 3));
887                 aggravate_monsters(0);
888                 break;
889         }
890         case 23:
891         {
892                 int i;
893                 if (!get_rep_dir2(&dir)) return FALSE;
894                 if (dir == 5) return FALSE;
895                 for (i = 0; i < 3; i++)
896                 {
897                         int oy, ox;
898                         int ny, nx;
899                         int m_idx;
900                         monster_type *m_ptr;
901
902                         y = py + ddy[dir];
903                         x = px + ddx[dir];
904
905                         if (cave[y][x].m_idx)
906                                 py_attack(y, x, HISSATSU_3DAN);
907                         else
908                         {
909 #ifdef JP
910                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
911 #else
912                                 msg_print("There is no monster.");
913 #endif
914                                 return FALSE;
915                         }
916
917                         if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
918                         {
919                                 return TRUE;
920                         }
921
922                         /* Monster is dead? */
923                         if (!cave[y][x].m_idx) break;
924
925                         ny = y + ddy[dir];
926                         nx = x + ddx[dir];
927                         m_idx = cave[y][x].m_idx;
928                         m_ptr = &m_list[m_idx];
929
930                         /* Monster cannot move back? */
931                         if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx])) continue;
932
933                         cave[y][x].m_idx = 0;
934                         cave[ny][nx].m_idx = m_idx;
935                         m_ptr->fy = ny;
936                         m_ptr->fx = nx;
937
938                         update_mon(m_idx, TRUE);
939
940                         /* Player can move forward? */
941                         if (player_can_enter(cave[y][x].feat))
942                         {
943                                 /* Save the old location */
944                                 oy = py;
945                                 ox = px;
946
947                                 /* Move the player */
948                                 py = y;
949                                 px = x;
950
951                                 if (p_ptr->riding)
952                                 {
953                                         int tmp;
954                                         tmp = cave[py][px].m_idx;
955                                         cave[py][px].m_idx = cave[oy][ox].m_idx;
956                                         cave[oy][ox].m_idx = tmp;
957                                         m_list[p_ptr->riding].fy = py;
958                                         m_list[p_ptr->riding].fx = px;
959                                         update_mon(cave[py][px].m_idx, TRUE);
960                                 }
961
962                                 forget_flow();
963
964                                 /* Redraw the old spot */
965                                 lite_spot(oy, ox);
966
967                                 /* Redraw the new spot */
968                                 lite_spot(py, px);
969                         }
970
971                         /* Redraw the old spot */
972                         lite_spot(y, x);
973
974                         /* Redraw the new spot */
975                         lite_spot(ny, nx);
976
977                         /* Check for new panel (redraw map) */
978                         verify_panel();
979
980                         /* Update stuff */
981                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
982
983                         /* Update the monsters */
984                         p_ptr->update |= (PU_DISTANCE);
985
986                         /* Window stuff */
987                         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
988
989                         /* Handle stuff */
990                         handle_stuff();
991
992                         /* -more- */
993                         if (i < 2) msg_print(NULL);
994                 }
995                 break;
996         }
997         case 24:
998         {
999                 if (!get_rep_dir2(&dir)) return FALSE;
1000                 if (dir == 5) return FALSE;
1001                 y = py + ddy[dir];
1002                 x = px + ddx[dir];
1003                 if (cave[y][x].m_idx)
1004                         py_attack(y, x, HISSATSU_DRAIN);
1005                 else
1006                 {
1007 #ifdef JP
1008                                 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1009 #else
1010                                 msg_print("There is no monster.");
1011 #endif
1012                         return FALSE;
1013                 }
1014                 break;
1015         }
1016         case 25:
1017         {
1018 #ifdef JP
1019                 msg_print("Éð´ï¤òÉÔµ¬Â§¤ËÍɤ餷¤¿¡¥¡¥¡¥");
1020 #else
1021                 msg_print("You irregularly wave your weapon...");
1022 #endif
1023                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1024                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1025                 project_hack(GF_ENGETSU, p_ptr->lev * 4);
1026                 break;
1027         }
1028         case 26:
1029         {
1030                 bool new = TRUE;
1031                 int count = 0;
1032                 do
1033                 {
1034                         project_length = 5;
1035                         if (!get_aim_dir(&dir)) break;
1036                         if (new)
1037                                 /* Reserve needed mana point */
1038                                 p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana;
1039                         else
1040                                 p_ptr->csp -= 8;
1041                         new = FALSE;
1042                         if (!project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL)) break;
1043                         count++;
1044                         command_dir = 0;
1045                         p_ptr->redraw |= PR_MANA;
1046                         handle_stuff();
1047                 } while (p_ptr->csp > 8);
1048                 if (new) return FALSE;
1049
1050                 /* Restore reserved mana */
1051                 p_ptr->csp += technic_info[TECHNIC_HISSATSU][26].smana;
1052
1053                 break;
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 (object_known_p(o_ptr) && (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 martial arts.");
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 }