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(SPELL_IDX *sn)
42 PLAYER_LEVEL plev = p_ptr->lev;
46 SPELL_IDX sentaku[32];
47 cptr p = _("必殺剣", "special attack");
51 int menu_line = (use_menu ? 1 : 0);
53 /* Assume cancelled */
56 #ifdef ALLOW_REPEAT /* TNB */
58 /* Get the spell, if available */
59 if (repeat_pull(&code))
61 *sn = (SPELL_IDX)code;
62 /* Verify the spell */
63 if (technic_info[TECHNIC_HISSATSU][*sn].slevel <= plev)
70 #endif /* ALLOW_REPEAT -- TNB */
72 /* Nothing chosen yet */
78 for (i = 0; i < 32; i++)
80 if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL)
87 /* Build a prompt (accept all spells) */
88 (void) strnfmt(out_val, 78,
89 _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
90 p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
92 if (use_menu) screen_save();
94 /* Get a spell from the user */
96 choice= always_show_list ? ESCAPE:1 ;
99 if(choice==ESCAPE) choice = ' ';
100 else if( !get_com(out_val, &choice, FALSE) )break;
102 if (use_menu && choice != ' ')
119 if (menu_line > 32) menu_line -= 32;
120 } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
131 if (menu_line > 32) menu_line -= 32;
132 } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
143 bool reverse = FALSE;
144 if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
151 while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
156 if (menu_line < 2) reverse = FALSE;
161 if (menu_line > 31) reverse = TRUE;
179 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
182 if (!redraw || use_menu)
190 /* Save the screen */
191 if (!use_menu) screen_save();
193 /* Display a list of spells */
195 put_str(_("名前 Lv MP 名前 Lv MP ",
196 "name Lv SP name Lv SP "), y, x + 5);
198 /* Dump the spells */
199 for (i = 0, line = 0; i < 32; i++)
201 spell = technic_info[TECHNIC_HISSATSU][i];
203 if (spell.slevel > PY_MAX_LEVEL) continue;
205 if (!(p_ptr->spell_learned1 >> i)) break;
207 /* Access the spell */
208 if (spell.slevel > plev) continue;
209 if (!(p_ptr->spell_learned1 & (1L << i))) continue;
212 if (i == (menu_line-1))
213 strcpy(psi_desc, _(" 》", " > "));
214 else strcpy(psi_desc, " ");
221 letter = I2A(line-1);
223 letter = '0' + line - 27;
224 sprintf(psi_desc, " %c)",letter);
227 /* Dump the spell --(-- */
228 strcat(psi_desc, format(" %-18s%2d %3d",
229 do_spell(REALM_HISSATSU, i, SPELL_NAME),
230 spell.slevel, spell.smana));
231 prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
232 prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
242 /* Restore the screen */
255 ask = (isupper(choice));
258 if (ask) choice = (char)tolower(choice);
260 /* Extract request */
261 i = (islower(choice) ? A2I(choice) : -1);
265 ask = FALSE; /* Can't uppercase digits */
267 i = choice - '0' + 26;
271 /* Totally Illegal */
272 if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
286 (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), do_spell(REALM_HISSATSU, j, SPELL_NAME));
288 /* Belay that order */
289 if (!get_check(tmp_val)) continue;
296 /* Restore the screen */
297 if (redraw) screen_load();
300 p_ptr->window |= (PW_SPELL);
305 /* Abort if needed */
306 if (!flag) return (FALSE);
308 /* Save the choice */
311 #ifdef ALLOW_REPEAT /* TNB */
313 repeat_push((COMMAND_CODE)j);
315 #endif /* ALLOW_REPEAT -- TNB */
323 * @brief 剣術コマンドのメインルーチン
326 void do_cmd_hissatsu(void)
331 /* not if confused */
334 msg_print(_("混乱していて集中できない!", "You are too confused!"));
337 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
339 if (flush_failure) flush();
340 msg_print(_("武器を持たないと必殺技は使えない!", "You need to wield a weapon!"));
343 if (!p_ptr->spell_learned1)
345 msg_print(_("何も技を知らない。", "You don't know any special attacks."));
349 if (p_ptr->special_defense & KATA_MASK)
351 set_action(ACTION_NONE);
355 if (!get_hissatsu_power(&n)) return;
357 spell = technic_info[TECHNIC_HISSATSU][n];
359 /* Verify "dangerous" spells */
360 if (spell.smana > p_ptr->csp)
362 if (flush_failure) flush();
364 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
372 if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return;
374 p_ptr->energy_use = 100;
377 p_ptr->csp -= spell.smana;
380 if (p_ptr->csp < 0) p_ptr->csp = 0;
383 p_ptr->redraw |= (PR_MANA);
385 p_ptr->window |= (PW_PLAYER);
386 p_ptr->window |= (PW_SPELL);
394 void do_cmd_gain_hissatsu(void)
404 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
406 set_action(ACTION_NONE);
409 if (p_ptr->blind || no_lite())
411 msg_print(_("目が見えない!", "You cannot see!"));
417 msg_print(_("混乱していて読めない!", "You are too confused!"));
421 if (!(p_ptr->new_spells))
423 msg_print(_("新しい必殺技を覚えることはできない!", "You cannot learn any new special attacks!"));
428 if( p_ptr->new_spells < 10 ){
429 msg_format("あと %d つの必殺技を学べる。", p_ptr->new_spells);
431 msg_format("あと %d 個の必殺技を学べる。", p_ptr->new_spells);
434 msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
435 (p_ptr->new_spells == 1?"":"s"));
438 item_tester_tval = TV_HISSATSU_BOOK;
441 q = _("どの書から学びますか? ", "Study which book? ");
442 s = _("読める書がない。", "You have no books that you can read.");
444 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
446 /* Get the item (in the pack) */
449 o_ptr = &inventory[item];
452 /* Get the item (on the floor) */
455 o_ptr = &o_list[0 - item];
458 for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
460 if (p_ptr->spell_learned1 & (1L << i)) continue;
461 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
463 p_ptr->spell_learned1 |= (1L << i);
464 p_ptr->spell_worked1 |= (1L << i);
465 msg_format(_("%sの技を覚えた。", "You have learned the special attack of %s."), do_spell(REALM_HISSATSU, i, SPELL_NAME));
466 for (j = 0; j < 64; j++)
468 /* Stop at the first empty space */
469 if (p_ptr->spell_order[j] == 99) break;
471 p_ptr->spell_order[j] = i;
477 msg_print(_("何も覚えられなかった。", "You were not able to learn any special attacks."));
480 p_ptr->energy_use = 100;
482 p_ptr->update |= (PU_SPELLS);
487 * @brief 剣術のスレイ倍率計算を行う /
488 * Calcurate magnification of hissatsu technics
489 * @param mult 剣術のスレイ効果以前に算出している多要素の倍率(/10倍)
490 * @param flgs 剣術に使用する武器のスレイフラグ配列
491 * @param m_ptr 目標となるモンスターの構造体参照ポインタ
492 * @param mode 剣術のスレイ型ID
493 * @return スレイの倍率(/10倍)
495 MULTIPLY mult_hissatsu(MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS mode)
497 monster_race *r_ptr = &r_info[m_ptr->r_idx];
499 /* Burning Strike (Fire) */
500 if (mode == HISSATSU_FIRE)
502 /* Notice immunity */
503 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
505 if (is_original_ap_and_seen(m_ptr))
507 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
511 /* Otherwise, take the damage */
512 else if (have_flag(flgs, TR_BRAND_FIRE))
514 if (r_ptr->flags3 & RF3_HURT_FIRE)
516 if (mult < 70) mult = 70;
517 if (is_original_ap_and_seen(m_ptr))
519 r_ptr->r_flags3 |= RF3_HURT_FIRE;
522 else if (mult < 35) mult = 35;
526 if (r_ptr->flags3 & RF3_HURT_FIRE)
528 if (mult < 50) mult = 50;
529 if (is_original_ap_and_seen(m_ptr))
531 r_ptr->r_flags3 |= RF3_HURT_FIRE;
534 else if (mult < 25) mult = 25;
538 /* Serpent's Tongue (Poison) */
539 if (mode == HISSATSU_POISON)
541 /* Notice immunity */
542 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
544 if (is_original_ap_and_seen(m_ptr))
546 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
550 /* Otherwise, take the damage */
551 else if (have_flag(flgs, TR_BRAND_POIS))
553 if (mult < 35) mult = 35;
557 if (mult < 25) mult = 25;
561 /* Zammaken (Nonliving Evil) */
562 if (mode == HISSATSU_ZANMA)
564 if (!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
566 if (mult < 15) mult = 25;
567 else if (mult < 50) mult = MIN(50, mult+20);
571 /* Rock Smash (Hurt Rock) */
572 if (mode == HISSATSU_HAGAN)
574 if (r_ptr->flags3 & RF3_HURT_ROCK)
576 if (is_original_ap_and_seen(m_ptr))
578 r_ptr->r_flags3 |= RF3_HURT_ROCK;
580 if (mult == 10) mult = 40;
581 else if (mult < 60) mult = 60;
585 /* Midare-Setsugekka (Cold) */
586 if (mode == HISSATSU_COLD)
588 /* Notice immunity */
589 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
591 if (is_original_ap_and_seen(m_ptr))
593 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
596 /* Otherwise, take the damage */
597 else if (have_flag(flgs, TR_BRAND_COLD))
599 if (r_ptr->flags3 & RF3_HURT_COLD)
601 if (mult < 70) mult = 70;
602 if (is_original_ap_and_seen(m_ptr))
604 r_ptr->r_flags3 |= RF3_HURT_COLD;
607 else if (mult < 35) mult = 35;
611 if (r_ptr->flags3 & RF3_HURT_COLD)
613 if (mult < 50) mult = 50;
614 if (is_original_ap_and_seen(m_ptr))
616 r_ptr->r_flags3 |= RF3_HURT_COLD;
619 else if (mult < 25) mult = 25;
623 /* Lightning Eagle (Elec) */
624 if (mode == HISSATSU_ELEC)
626 /* Notice immunity */
627 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
629 if (is_original_ap_and_seen(m_ptr))
631 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
635 /* Otherwise, take the damage */
636 else if (have_flag(flgs, TR_BRAND_ELEC))
638 if (mult < 70) mult = 70;
642 if (mult < 50) mult = 50;
646 /* Bloody Maelstrom */
647 if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
649 MULTIPLY tmp = MIN(100, MAX(10, p_ptr->cut / 10));
650 if (mult < tmp) mult = tmp;
654 if (mode == HISSATSU_UNDEAD)
656 if (r_ptr->flags3 & RF3_UNDEAD)
658 if (is_original_ap_and_seen(m_ptr))
660 r_ptr->r_flags3 |= RF3_UNDEAD;
662 if (mult == 10) mult = 70;
663 else if (mult < 140) mult = MIN(140, mult+60);
665 if (mult == 10) mult = 40;
666 else if (mult < 60) mult = MIN(60, mult+30);
669 if (mult > 150) mult = 150;