OSDN Git Service

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