OSDN Git Service

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