OSDN Git Service

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