OSDN Git Service

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