OSDN Git Service

[Refactor] ビット判定・操作式を ***_bits() にした
[hengbandforosx/hengbandosx.git] / src / player-info / weapon-effect-info.cpp
1 #include "player-info/weapon-effect-info.h"
2 #include "inventory/inventory-slot-types.h"
3 #include "object-enchant/tr-types.h"
4 #include "player-info/self-info-util.h"
5 #include "system/player-type-definition.h"
6 #include "util/bit-flags-calculator.h"
7
8 static void set_weapon_bless_info(self_info_type *self_ptr)
9 {
10     if (self_ptr->flags.has(TR_BLESSED)) {
11         self_ptr->info[self_ptr->line++] = _("あなたの武器は神の祝福を受けている。", "Your weapon has been blessed by the gods.");
12     }
13
14     if (self_ptr->flags.has(TR_CHAOTIC)) {
15         self_ptr->info[self_ptr->line++] = _("あなたの武器はログルスの徴の属性をもつ。", "Your weapon is branded with the Sign of Logrus.");
16     }
17
18     if (self_ptr->flags.has(TR_BRAND_MAGIC)) {
19         self_ptr->info[self_ptr->line++] = _("あなたの武器は魔術的効果を発動することがある。", "Your weapon is branded with magical power.");
20     }
21
22     if (self_ptr->flags.has(TR_EARTHQUAKE)) {
23         self_ptr->info[self_ptr->line++] = _("あなたの武器は打撃で地震を発生することができる。", "The impact of your weapon can cause earthquakes.");
24     }
25
26     if (self_ptr->flags.has(TR_VORPAL)) {
27         self_ptr->info[self_ptr->line++] = _("あなたの武器は非常に鋭い。", "Your weapon is very sharp.");
28     }
29
30     if (self_ptr->flags.has(TR_IMPACT)) {
31         self_ptr->info[self_ptr->line++] = _("あなたの武器は強力な一撃を放てる。", "Your weapon hits your foes strongly.");
32     }
33
34     if (self_ptr->flags.has(TR_VAMPIRIC)) {
35         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵から生命力を吸収する。", "Your weapon drains life from your foes.");
36     }
37 }
38
39 static void set_brand_attack_info(self_info_type *self_ptr)
40 {
41     if (self_ptr->flags.has(TR_BRAND_ACID)) {
42         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵を溶かす。", "Your weapon melts your foes.");
43     }
44
45     if (self_ptr->flags.has(TR_BRAND_ELEC)) {
46         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵を感電させる。", "Your weapon shocks your foes.");
47     }
48
49     if (self_ptr->flags.has(TR_BRAND_FIRE)) {
50         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵を燃やす。", "Your weapon burns your foes.");
51     }
52
53     if (self_ptr->flags.has(TR_BRAND_COLD)) {
54         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵を凍らせる。", "Your weapon freezes your foes.");
55     }
56
57     if (self_ptr->flags.has(TR_BRAND_POIS)) {
58         self_ptr->info[self_ptr->line++] = _("あなたの武器は敵を毒で侵す。", "Your weapon poisons your foes.");
59     }
60 }
61
62 static void set_slay_info(self_info_type *self_ptr)
63 {
64     if (self_ptr->flags.has(TR_KILL_ANIMAL)) {
65         self_ptr->info[self_ptr->line++] = _("あなたの武器は動物の天敵である。", "Your weapon is a great bane of animals.");
66     } else if (self_ptr->flags.has(TR_SLAY_ANIMAL)) {
67         self_ptr->info[self_ptr->line++] = _("あなたの武器は動物に対して強い力を発揮する。", "Your weapon strikes at animals with extra force.");
68     }
69
70     if (self_ptr->flags.has(TR_KILL_EVIL)) {
71         self_ptr->info[self_ptr->line++] = _("あなたの武器は邪悪なる存在の天敵である。", "Your weapon is a great bane of evil.");
72     } else if (self_ptr->flags.has(TR_SLAY_EVIL)) {
73         self_ptr->info[self_ptr->line++] = _("あなたの武器は邪悪なる存在に対して強い力を発揮する。", "Your weapon strikes at evil with extra force.");
74     }
75
76     if (self_ptr->flags.has(TR_KILL_GOOD)) {
77         self_ptr->info[self_ptr->line++] = _("あなたの武器は善良なる存在の天敵である。", "Your weapon is a great bane of good.");
78     } else if (self_ptr->flags.has(TR_SLAY_GOOD)) {
79         self_ptr->info[self_ptr->line++] = _("あなたの武器は善良なる存在に対して強い力を発揮する。", "Your weapon strikes at good with extra force.");
80     }
81
82     if (self_ptr->flags.has(TR_KILL_HUMAN)) {
83         self_ptr->info[self_ptr->line++] = _("あなたの武器は人間の天敵である。", "Your weapon is a great bane of humans.");
84     } else if (self_ptr->flags.has(TR_SLAY_HUMAN)) {
85         self_ptr->info[self_ptr->line++] = _("あなたの武器は人間に対して特に強い力を発揮する。", "Your weapon is especially deadly against humans.");
86     }
87
88     if (self_ptr->flags.has(TR_KILL_UNDEAD)) {
89         self_ptr->info[self_ptr->line++] = _("あなたの武器はアンデッドの天敵である。", "Your weapon is a great bane of undead.");
90     } else if (self_ptr->flags.has(TR_SLAY_UNDEAD)) {
91         self_ptr->info[self_ptr->line++] = _("あなたの武器はアンデッドに対して神聖なる力を発揮する。", "Your weapon strikes at undead with holy wrath.");
92     }
93
94     if (self_ptr->flags.has(TR_KILL_DEMON)) {
95         self_ptr->info[self_ptr->line++] = _("あなたの武器はデーモンの天敵である。", "Your weapon is a great bane of demons.");
96     } else if (self_ptr->flags.has(TR_SLAY_DEMON)) {
97         self_ptr->info[self_ptr->line++] = _("あなたの武器はデーモンに対して神聖なる力を発揮する。", "Your weapon strikes at demons with holy wrath.");
98     }
99
100     if (self_ptr->flags.has(TR_KILL_ORC)) {
101         self_ptr->info[self_ptr->line++] = _("あなたの武器はオークの天敵である。", "Your weapon is a great bane of orcs.");
102     } else if (self_ptr->flags.has(TR_SLAY_ORC)) {
103         self_ptr->info[self_ptr->line++] = _("あなたの武器はオークに対して特に強い力を発揮する。", "Your weapon is especially deadly against orcs.");
104     }
105
106     if (self_ptr->flags.has(TR_KILL_TROLL)) {
107         self_ptr->info[self_ptr->line++] = _("あなたの武器はトロルの天敵である。", "Your weapon is a great bane of trolls.");
108     } else if (self_ptr->flags.has(TR_SLAY_TROLL)) {
109         self_ptr->info[self_ptr->line++] = _("あなたの武器はトロルに対して特に強い力を発揮する。", "Your weapon is especially deadly against trolls.");
110     }
111
112     if (self_ptr->flags.has(TR_KILL_GIANT)) {
113         self_ptr->info[self_ptr->line++] = _("あなたの武器は巨人の天敵である。", "Your weapon is a great bane of giants.");
114     } else if (self_ptr->flags.has(TR_SLAY_GIANT)) {
115         self_ptr->info[self_ptr->line++] = _("あなたの武器は巨人に対して特に強い力を発揮する。", "Your weapon is especially deadly against giants.");
116     }
117
118     if (self_ptr->flags.has(TR_KILL_DRAGON)) {
119         self_ptr->info[self_ptr->line++] = _("あなたの武器はドラゴンの天敵である。", "Your weapon is a great bane of dragons.");
120     } else if (self_ptr->flags.has(TR_SLAY_DRAGON)) {
121         self_ptr->info[self_ptr->line++] = _("あなたの武器はドラゴンに対して特に強い力を発揮する。", "Your weapon is especially deadly against dragons.");
122     }
123 }
124
125 void set_weapon_effect_info(PlayerType *player_ptr, self_info_type *self_ptr)
126 {
127     auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
128     if (o_ptr->k_idx == 0) {
129         return;
130     }
131
132     set_weapon_bless_info(self_ptr);
133     set_brand_attack_info(self_ptr);
134     set_slay_info(self_ptr);
135     if (self_ptr->flags.has(TR_FORCE_WEAPON)) {
136         self_ptr->info[self_ptr->line++] = _("あなたの武器はMPを使って攻撃する。", "Your weapon causes great damage using your MP.");
137     }
138
139     if (self_ptr->flags.has(TR_THROW)) {
140         self_ptr->info[self_ptr->line++] = _("あなたの武器は投げやすい。", "Your weapon can be thrown well.");
141     }
142 }