3 * @brief ·õ½Ñ¤Î¼ÂÁõ / Blade arts
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research,\n
8 * and not for profit purposes provided that this copyright and statement\n
9 * are included in all such copies. Other copyrights may also apply.\n
10 * 2014 Deskull rearranged comment for Doxygen.\n
15 #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
19 * @brief »ÈÍѲÄǽ¤Ê·õ½Ñ¤òÁªÂò¤¹¤ë /
20 * Allow user to choose a blade arts.
21 * @param sn ÁªÂò¤·¤¿Æü쵻ǽID¡¢¥¥ã¥ó¥»¥ë¤Î¾ì¹ç-1¡¢ÉÔÀµ¤ÊÁªÂò¤Î¾ì¹ç-2¤òÊÖ¤¹
22 * @return ȯư²Äǽ¤ÊËâË¡¤òÁªÂò¤·¤¿¾ì¹çTRUE¡¢¥¥ã¥ó¥»¥ë½èÍý¤«ÉÔÀµ¤ÊÁªÂò¤¬¹Ô¤ï¤ì¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
24 * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
25 * If the user hits escape, returns FALSE, and set '*sn' to -1\n
26 * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
28 * The "prompt" should be "cast", "recite", or "study"\n
29 * The "known" should be TRUE for cast/pray, FALSE for study\n
31 * nb: This function has a (trivial) display bug which will be obvious\n
32 * when you run it. It's probably easy to fix but I haven't tried,\n
35 static int get_hissatsu_power(int *sn)
41 int plev = p_ptr->lev;
49 cptr p = "special attack";
54 int menu_line = (use_menu ? 1 : 0);
56 /* Assume cancelled */
59 #ifdef ALLOW_REPEAT /* TNB */
61 /* Get the spell, if available */
64 /* Verify the spell */
65 if (technic_info[TECHNIC_HISSATSU][*sn].slevel <= plev)
72 #endif /* ALLOW_REPEAT -- TNB */
74 /* Nothing chosen yet */
80 for (i = 0; i < 32; i++)
82 if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL)
89 /* Build a prompt (accept all spells) */
90 (void) strnfmt(out_val, 78,
92 "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
94 "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
96 p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
98 if (use_menu) screen_save();
100 /* Get a spell from the user */
102 choice= always_show_list ? ESCAPE:1 ;
105 if(choice==ESCAPE) choice = ' ';
106 else if( !get_com(out_val, &choice, FALSE) )break;
108 if (use_menu && choice != ' ')
125 if (menu_line > 32) menu_line -= 32;
126 } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
137 if (menu_line > 32) menu_line -= 32;
138 } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
149 bool reverse = FALSE;
150 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
157 while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
162 if (menu_line < 2) reverse = FALSE;
167 if (menu_line > 31) reverse = TRUE;
185 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
188 if (!redraw || use_menu)
196 /* Save the screen */
197 if (!use_menu) screen_save();
199 /* Display a list of spells */
202 put_str("̾Á° Lv MP ̾Á° Lv MP ", y, x + 5);
204 put_str("name Lv SP name Lv SP ", y, x + 5);
207 /* Dump the spells */
208 for (i = 0, line = 0; i < 32; i++)
210 spell = technic_info[TECHNIC_HISSATSU][i];
212 if (spell.slevel > PY_MAX_LEVEL) continue;
214 if (!(p_ptr->spell_learned1 >> i)) break;
216 /* Access the spell */
217 if (spell.slevel > plev) continue;
218 if (!(p_ptr->spell_learned1 & (1L << i))) continue;
221 if (i == (menu_line-1))
223 strcpy(psi_desc, " ¡Õ");
225 strcpy(psi_desc, " > ");
227 else strcpy(psi_desc, " ");
234 letter = I2A(line-1);
236 letter = '0' + line - 27;
237 sprintf(psi_desc, " %c)",letter);
240 /* Dump the spell --(-- */
241 strcat(psi_desc, format(" %-18s%2d %3d",
242 do_spell(REALM_HISSATSU, i, SPELL_NAME),
243 spell.slevel, spell.smana));
244 prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
245 prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
255 /* Restore the screen */
268 ask = (isupper(choice));
271 if (ask) choice = tolower(choice);
273 /* Extract request */
274 i = (islower(choice) ? A2I(choice) : -1);
278 ask = FALSE; /* Can't uppercase digits */
280 i = choice - '0' + 26;
284 /* Totally Illegal */
285 if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
300 (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", do_spell(REALM_HISSATSU, j, SPELL_NAME));
302 (void)strnfmt(tmp_val, 78, "Use %s? ", do_spell(REALM_HISSATSU, j, SPELL_NAME));
306 /* Belay that order */
307 if (!get_check(tmp_val)) continue;
314 /* Restore the screen */
315 if (redraw) screen_load();
318 p_ptr->window |= (PW_SPELL);
324 /* Abort if needed */
325 if (!flag) return (FALSE);
327 /* Save the choice */
330 #ifdef ALLOW_REPEAT /* TNB */
334 #endif /* ALLOW_REPEAT -- TNB */
342 * @brief ·õ½Ñ¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
345 void do_cmd_hissatsu(void)
351 /* not if confused */
355 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤¤Ê¤¤¡ª");
357 msg_print("You are too confused!");
362 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
364 if (flush_failure) flush();
366 msg_print("Éð´ï¤ò»ý¤¿¤Ê¤¤¤Èɬ»¦µ»¤Ï»È¤¨¤Ê¤¤¡ª");
368 msg_print("You need to wield a weapon!");
373 if (!p_ptr->spell_learned1)
376 msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
378 msg_print("You don't know any special attacks.");
384 if (p_ptr->special_defense & KATA_MASK)
386 set_action(ACTION_NONE);
390 if (!get_hissatsu_power(&n)) return;
392 spell = technic_info[TECHNIC_HISSATSU][n];
394 /* Verify "dangerous" spells */
395 if (spell.smana > p_ptr->csp)
397 if (flush_failure) flush();
400 msg_print("£Í£Ð¤¬Â¤ê¤Þ¤»¤ó¡£");
402 msg_print("You do not have enough mana to use this power.");
411 if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return;
417 p_ptr->csp -= spell.smana;
420 if (p_ptr->csp < 0) p_ptr->csp = 0;
423 p_ptr->redraw |= (PR_MANA);
426 p_ptr->window |= (PW_PLAYER);
427 p_ptr->window |= (PW_SPELL);
432 * @brief ·õ½Ñ¥³¥Þ¥ó¥É¤Î³Ø½¬
435 void do_cmd_gain_hissatsu(void)
444 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
446 set_action(ACTION_NONE);
449 if (p_ptr->blind || no_lite())
452 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
454 msg_print("You cannot see!");
463 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
465 msg_print("You are too confused!");
471 if (!(p_ptr->new_spells))
474 msg_print("¿·¤·¤¤É¬»¦µ»¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡ª");
476 msg_print("You cannot learn any new special attacks!");
483 if( p_ptr->new_spells < 10 ){
484 msg_format("¤¢¤È %d ¤Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
486 msg_format("¤¢¤È %d ¸Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
489 msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
490 (p_ptr->new_spells == 1?"":"s"));
493 item_tester_tval = TV_HISSATSU_BOOK;
497 q = "¤É¤Î½ñ¤«¤é³Ø¤Ó¤Þ¤¹¤«? ";
499 q = "Study which book? ";
503 s = "Æɤá¤ë½ñ¤¬¤Ê¤¤¡£";
505 s = "You have no books that you can read.";
508 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
510 /* Get the item (in the pack) */
513 o_ptr = &inventory[item];
516 /* Get the item (on the floor) */
519 o_ptr = &o_list[0 - item];
522 for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
524 if (p_ptr->spell_learned1 & (1L << i)) continue;
525 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
527 p_ptr->spell_learned1 |= (1L << i);
528 p_ptr->spell_worked1 |= (1L << i);
530 msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", do_spell(REALM_HISSATSU, i, SPELL_NAME));
532 msg_format("You have learned the special attack of %s.", do_spell(REALM_HISSATSU, i, SPELL_NAME));
534 for (j = 0; j < 64; j++)
536 /* Stop at the first empty space */
537 if (p_ptr->spell_order[j] == 99) break;
539 p_ptr->spell_order[j] = i;
546 msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
548 msg_print("You were not able to learn any special attacks.");
555 p_ptr->update |= (PU_SPELLS);
560 * @brief ·õ½Ñ¤Î¥¹¥ì¥¤ÇÜΨ·×»»¤ò¹Ô¤¦ /
561 * Calcurate magnification of hissatsu technics
562 * @param mult ·õ½Ñ¤Î¥¹¥ì¥¤¸ú²Ì°ÊÁ°¤Ë»»½Ð¤·¤Æ¤¤¤ë¿Í×ÁǤÎÇÜΨ(/10ÇÜ)
563 * @param flgs ·õ½Ñ¤Ë»ÈÍѤ¹¤ëÉð´ï¤Î¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
564 * @param m_ptr ÌÜɸ¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
565 * @param mode ·õ½Ñ¤Î¥¹¥ì¥¤·¿ID
566 * @return ¥¹¥ì¥¤¤ÎÇÜΨ(/10ÇÜ)
568 s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode)
570 monster_race *r_ptr = &r_info[m_ptr->r_idx];
572 /* Burning Strike (Fire) */
573 if (mode == HISSATSU_FIRE)
575 /* Notice immunity */
576 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
578 if (is_original_ap_and_seen(m_ptr))
580 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
584 /* Otherwise, take the damage */
585 else if (have_flag(flgs, TR_BRAND_FIRE))
587 if (r_ptr->flags3 & RF3_HURT_FIRE)
589 if (mult < 70) mult = 70;
590 if (is_original_ap_and_seen(m_ptr))
592 r_ptr->r_flags3 |= RF3_HURT_FIRE;
595 else if (mult < 35) mult = 35;
599 if (r_ptr->flags3 & RF3_HURT_FIRE)
601 if (mult < 50) mult = 50;
602 if (is_original_ap_and_seen(m_ptr))
604 r_ptr->r_flags3 |= RF3_HURT_FIRE;
607 else if (mult < 25) mult = 25;
611 /* Serpent's Tongue (Poison) */
612 if (mode == HISSATSU_POISON)
614 /* Notice immunity */
615 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
617 if (is_original_ap_and_seen(m_ptr))
619 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
623 /* Otherwise, take the damage */
624 else if (have_flag(flgs, TR_BRAND_POIS))
626 if (mult < 35) mult = 35;
630 if (mult < 25) mult = 25;
634 /* Zammaken (Nonliving Evil) */
635 if (mode == HISSATSU_ZANMA)
637 if (!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
639 if (mult < 15) mult = 25;
640 else if (mult < 50) mult = MIN(50, mult+20);
644 /* Rock Smash (Hurt Rock) */
645 if (mode == HISSATSU_HAGAN)
647 if (r_ptr->flags3 & RF3_HURT_ROCK)
649 if (is_original_ap_and_seen(m_ptr))
651 r_ptr->r_flags3 |= RF3_HURT_ROCK;
653 if (mult == 10) mult = 40;
654 else if (mult < 60) mult = 60;
658 /* Midare-Setsugekka (Cold) */
659 if (mode == HISSATSU_COLD)
661 /* Notice immunity */
662 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
664 if (is_original_ap_and_seen(m_ptr))
666 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
669 /* Otherwise, take the damage */
670 else if (have_flag(flgs, TR_BRAND_COLD))
672 if (r_ptr->flags3 & RF3_HURT_COLD)
674 if (mult < 70) mult = 70;
675 if (is_original_ap_and_seen(m_ptr))
677 r_ptr->r_flags3 |= RF3_HURT_COLD;
680 else if (mult < 35) mult = 35;
684 if (r_ptr->flags3 & RF3_HURT_COLD)
686 if (mult < 50) mult = 50;
687 if (is_original_ap_and_seen(m_ptr))
689 r_ptr->r_flags3 |= RF3_HURT_COLD;
692 else if (mult < 25) mult = 25;
696 /* Lightning Eagle (Elec) */
697 if (mode == HISSATSU_ELEC)
699 /* Notice immunity */
700 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
702 if (is_original_ap_and_seen(m_ptr))
704 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
708 /* Otherwise, take the damage */
709 else if (have_flag(flgs, TR_BRAND_ELEC))
711 if (mult < 70) mult = 70;
715 if (mult < 50) mult = 50;
719 /* Bloody Maelstrom */
720 if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
722 int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
723 if (mult < tmp) mult = tmp;
727 if (mode == HISSATSU_UNDEAD)
729 if (r_ptr->flags3 & RF3_UNDEAD)
731 if (is_original_ap_and_seen(m_ptr))
733 r_ptr->r_flags3 |= RF3_UNDEAD;
735 if (mult == 10) mult = 70;
736 else if (mult < 140) mult = MIN(140, mult+60);
738 if (mult == 10) mult = 40;
739 else if (mult < 60) mult = MIN(60, mult+30);
742 if (mult > 150) mult = 150;