OSDN Git Service

[Refactor] #40457 Moved melee-related files from combat/ to melee/
[hengband/hengband.git] / src / object-enchant / vorpal-weapon.c
1 #include "object-enchant/vorpal-weapon.h"
2 #include "io/files-util.h"
3 #include "object-enchant/artifact.h"
4
5 /*!
6  * @brief ヴォーパル武器で攻撃した時のメッセージ表示
7  * @param pa_ptr 直接攻撃構造体への参照ポインタ
8  * @param int 倍率
9  * @return なし
10  */
11 static void print_vorpal_message(player_attack_type *pa_ptr, const int magnification)
12 {
13     switch (magnification) {
14     case 2:
15         msg_format(_("%sを斬った!", "You gouge %s!"), pa_ptr->m_name);
16         break;
17     case 3:
18         msg_format(_("%sをぶった斬った!", "You maim %s!"), pa_ptr->m_name);
19         break;
20     case 4:
21         msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), pa_ptr->m_name);
22         break;
23     case 5:
24         msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), pa_ptr->m_name);
25         break;
26     case 6:
27         msg_format(_("%sを刺身にした!", "You smite %s!"), pa_ptr->m_name);
28         break;
29     case 7:
30         msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), pa_ptr->m_name);
31         break;
32     default:
33         msg_format(_("%sを細切れにした!", "You shred %s!"), pa_ptr->m_name);
34         break;
35     }
36 }
37
38 /*!
39  * @brief チェンソーのノイズ音を表示する
40  * @param o_ptr チェンソーへの参照ポインタ
41  * @return なし
42  */
43 static void print_chainsword_noise(object_type *o_ptr)
44 {
45     if ((o_ptr->name1 != ART_CHAINSWORD) || one_in_(2))
46         return;
47
48     char chainsword_noise[1024];
49     if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise))
50         msg_print(chainsword_noise);
51 }
52
53 /*!
54  * @brief ヴォーパル武器利用時の処理メインルーチン
55  * @param attacker_ptr プレーヤーへの参照ポインタ
56  * @param pa_ptr 直接攻撃構造体への参照ポインタ
57  * @param vorpal_cut メッタ斬りにできるかどうか
58  * @param vorpal_chance ヴォーパル倍率上昇の機会値
59  * @return なし
60  */
61 void process_vorpal_attack(player_type *attacker_ptr, player_attack_type *pa_ptr, const bool vorpal_cut, const int vorpal_chance)
62 {
63     if (!vorpal_cut)
64         return;
65
66     object_type *o_ptr = &attacker_ptr->inventory_list[INVEN_RARM + pa_ptr->hand];
67     int vorpal_magnification = 2;
68     print_chainsword_noise(o_ptr);
69     if (o_ptr->name1 == ART_VORPAL_BLADE)
70         msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!"));
71     else
72         msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), pa_ptr->m_name);
73
74     while (one_in_(vorpal_chance))
75         vorpal_magnification++;
76
77     pa_ptr->attack_damage *= (HIT_POINT)vorpal_magnification;
78     monster_race *r_ptr = &r_info[pa_ptr->m_ptr->r_idx];
79     if (((r_ptr->flagsr & RFR_RES_ALL) ? pa_ptr->attack_damage / 100 : pa_ptr->attack_damage) > pa_ptr->m_ptr->hp)
80         msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), pa_ptr->m_name);
81     else
82         print_vorpal_message(pa_ptr, vorpal_magnification);
83
84     pa_ptr->drain_result = pa_ptr->drain_result * 3 / 2;
85 }