OSDN Git Service

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