OSDN Git Service

Merge pull request #1786 from Hourier/Remove-MIN-Macro-Function
[hengbandforosx/hengbandosx.git] / src / view / display-lore-status.cpp
1 #include "view/display-lore-status.h"
2 #include "lore/lore-calculator.h"
3 #include "lore/lore-util.h"
4 #include "monster-race/monster-race.h"
5 #include "monster-race/race-flags-resistance.h"
6 #include "monster-race/race-flags1.h"
7 #include "monster-race/race-flags2.h"
8 #include "monster-race/race-flags3.h"
9 #include "monster-race/race-flags7.h"
10 #include "system/monster-race-definition.h"
11 #include "term/term-color-types.h"
12 #ifdef JP
13 #include "locale/japanese.h"
14 #endif
15
16 void display_monster_hp_ac(lore_type *lore_ptr)
17 {
18     if (!know_armour(lore_ptr->r_idx, lore_ptr->know_everything))
19         return;
20
21     hooked_roff(format(_("%^sは AC%d の防御力と", "%^s has an armor rating of %d"), Who::who(lore_ptr->msex), lore_ptr->r_ptr->ac));
22     if ((lore_ptr->flags1 & RF1_FORCE_MAXHP) || (lore_ptr->r_ptr->hside == 1)) {
23         auto hp = lore_ptr->r_ptr->hdice * (lore_ptr->nightmare ? 2 : 1) * lore_ptr->r_ptr->hside;
24         hooked_roff(format(_(" %d の体力がある。", " and a life rating of %d.  "), std::min(30000, hp)));
25     } else {
26         hooked_roff(format(
27             _(" %dd%d の体力がある。", " and a life rating of %dd%d.  "), lore_ptr->r_ptr->hdice * (lore_ptr->nightmare ? 2 : 1), lore_ptr->r_ptr->hside));
28     }
29 }
30
31 void display_monster_concrete_abilities(lore_type *lore_ptr)
32 {
33     if (lore_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2)) {
34         lore_ptr->vp[lore_ptr->vn] = _("ダンジョンを照らす", "illuminate the dungeon");
35         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
36     }
37
38     if (lore_ptr->flags7 & (RF7_HAS_DARK_1 | RF7_HAS_DARK_2)) {
39         lore_ptr->vp[lore_ptr->vn] = _("ダンジョンを暗くする", "darken the dungeon");
40         lore_ptr->color[lore_ptr->vn++] = TERM_L_DARK;
41     }
42
43     if (lore_ptr->flags2 & RF2_OPEN_DOOR) {
44         lore_ptr->vp[lore_ptr->vn] = _("ドアを開ける", "open doors");
45         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
46     }
47
48     if (lore_ptr->flags2 & RF2_BASH_DOOR) {
49         lore_ptr->vp[lore_ptr->vn] = _("ドアを打ち破る", "bash down doors");
50         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
51     }
52
53     if (lore_ptr->flags7 & RF7_CAN_FLY) {
54         lore_ptr->vp[lore_ptr->vn] = _("空を飛ぶ", "fly");
55         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
56     }
57
58     if (lore_ptr->flags7 & RF7_CAN_SWIM) {
59         lore_ptr->vp[lore_ptr->vn] = _("水を渡る", "swim");
60         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
61     }
62
63     if (lore_ptr->flags2 & RF2_PASS_WALL) {
64         lore_ptr->vp[lore_ptr->vn] = _("壁をすり抜ける", "pass through walls");
65         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
66     }
67
68     if (lore_ptr->flags2 & RF2_KILL_WALL) {
69         lore_ptr->vp[lore_ptr->vn] = _("壁を掘り進む", "bore through walls");
70         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
71     }
72
73     if (lore_ptr->flags2 & RF2_MOVE_BODY) {
74         lore_ptr->vp[lore_ptr->vn] = _("弱いモンスターを押しのける", "push past weaker monsters");
75         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
76     }
77
78     if (lore_ptr->flags2 & RF2_KILL_BODY) {
79         lore_ptr->vp[lore_ptr->vn] = _("弱いモンスターを倒す", "destroy weaker monsters");
80         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
81     }
82
83     if (lore_ptr->flags2 & RF2_TAKE_ITEM) {
84         lore_ptr->vp[lore_ptr->vn] = _("アイテムを拾う", "pick up objects");
85         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
86     }
87
88     if (lore_ptr->flags2 & RF2_KILL_ITEM) {
89         lore_ptr->vp[lore_ptr->vn] = _("アイテムを壊す", "destroy objects");
90         lore_ptr->color[lore_ptr->vn++] = TERM_WHITE;
91     }
92 }
93
94 void display_monster_abilities(lore_type *lore_ptr)
95 {
96     if (lore_ptr->vn <= 0)
97         return;
98
99     hooked_roff(format(_("%^sは", "%^s"), Who::who(lore_ptr->msex)));
100     for (int n = 0; n < lore_ptr->vn; n++) {
101 #ifdef JP
102         if (n != lore_ptr->vn - 1) {
103             jverb(lore_ptr->vp[n], lore_ptr->jverb_buf, JVERB_AND);
104             hook_c_roff(lore_ptr->color[n], lore_ptr->jverb_buf);
105             hooked_roff("、");
106         } else {
107             hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
108         }
109 #else
110         if (n == 0)
111             hooked_roff(" can ");
112         else if (n < lore_ptr->vn - 1)
113             hooked_roff(", ");
114         else
115             hooked_roff(" and ");
116
117         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
118 #endif
119     }
120
121     hooked_roff(_("ことができる。", ".  "));
122 }
123
124 void display_monster_constitutions(lore_type *lore_ptr)
125 {
126     if (lore_ptr->flags7 & RF7_AQUATIC)
127         hooked_roff(format(_("%^sは水中に棲んでいる。", "%^s lives in water.  "), Who::who(lore_ptr->msex)));
128
129     if (lore_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2))
130         hooked_roff(format(_("%^sは光っている。", "%^s is shining.  "), Who::who(lore_ptr->msex)));
131
132     if (lore_ptr->flags7 & (RF7_SELF_DARK_1 | RF7_SELF_DARK_2))
133         hook_c_roff(TERM_L_DARK, format(_("%^sは暗黒に包まれている。", "%^s is surrounded by darkness.  "), Who::who(lore_ptr->msex)));
134
135     if (lore_ptr->flags2 & RF2_INVISIBLE)
136         hooked_roff(format(_("%^sは透明で目に見えない。", "%^s is invisible.  "), Who::who(lore_ptr->msex)));
137
138     if (lore_ptr->flags2 & RF2_COLD_BLOOD)
139         hooked_roff(format(_("%^sは冷血動物である。", "%^s is cold blooded.  "), Who::who(lore_ptr->msex)));
140
141     if (lore_ptr->flags2 & RF2_EMPTY_MIND)
142         hooked_roff(format(_("%^sはテレパシーでは感知できない。", "%^s is not detected by telepathy.  "), Who::who(lore_ptr->msex)));
143     else if (lore_ptr->flags2 & RF2_WEIRD_MIND)
144         hooked_roff(format(_("%^sはまれにテレパシーで感知できる。", "%^s is rarely detected by telepathy.  "), Who::who(lore_ptr->msex)));
145
146     if (lore_ptr->flags2 & RF2_MULTIPLY)
147         hook_c_roff(TERM_L_UMBER, format(_("%^sは爆発的に増殖する。", "%^s breeds explosively.  "), Who::who(lore_ptr->msex)));
148
149     if (lore_ptr->flags2 & RF2_REGENERATE)
150         hook_c_roff(TERM_L_WHITE, format(_("%^sは素早く体力を回復する。", "%^s regenerates quickly.  "), Who::who(lore_ptr->msex)));
151
152     if (lore_ptr->flags7 & RF7_RIDING)
153         hook_c_roff(TERM_SLATE, format(_("%^sに乗ることができる。", "%^s is suitable for riding.  "), Who::who(lore_ptr->msex)));
154 }
155
156 void display_monster_concrete_weakness(lore_type *lore_ptr)
157 {
158     if (lore_ptr->flags3 & RF3_HURT_ROCK) {
159         lore_ptr->vp[lore_ptr->vn] = _("岩を除去するもの", "rock remover");
160         lore_ptr->color[lore_ptr->vn++] = TERM_UMBER;
161     }
162
163     if (lore_ptr->flags3 & RF3_HURT_LITE) {
164         lore_ptr->vp[lore_ptr->vn] = _("明るい光", "bright light");
165         lore_ptr->color[lore_ptr->vn++] = TERM_YELLOW;
166     }
167
168     if (lore_ptr->flags3 & RF3_HURT_FIRE) {
169         lore_ptr->vp[lore_ptr->vn] = _("炎", "fire");
170         lore_ptr->color[lore_ptr->vn++] = TERM_RED;
171     }
172
173     if (lore_ptr->flags3 & RF3_HURT_COLD) {
174         lore_ptr->vp[lore_ptr->vn] = _("冷気", "cold");
175         lore_ptr->color[lore_ptr->vn++] = TERM_L_WHITE;
176     }
177 }
178
179 void display_monster_weakness(lore_type *lore_ptr)
180 {
181     if (lore_ptr->vn <= 0)
182         return;
183
184     hooked_roff(format(_("%^sには", "%^s"), Who::who(lore_ptr->msex)));
185     for (int n = 0; n < lore_ptr->vn; n++) {
186 #ifdef JP
187         if (n != 0)
188             hooked_roff("や");
189 #else
190         if (n == 0)
191             hooked_roff(" is hurt by ");
192         else if (n < lore_ptr->vn - 1)
193             hooked_roff(", ");
194         else
195             hooked_roff(" and ");
196 #endif
197         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
198     }
199
200     hooked_roff(_("でダメージを与えられる。", ".  "));
201 }
202
203 void display_monster_concrete_resistances(lore_type *lore_ptr)
204 {
205     if (lore_ptr->flagsr & RFR_IM_ACID) {
206         lore_ptr->vp[lore_ptr->vn] = _("酸", "acid");
207         lore_ptr->color[lore_ptr->vn++] = TERM_GREEN;
208     }
209
210     if (lore_ptr->flagsr & RFR_IM_ELEC) {
211         lore_ptr->vp[lore_ptr->vn] = _("稲妻", "lightning");
212         lore_ptr->color[lore_ptr->vn++] = TERM_BLUE;
213     }
214
215     if (lore_ptr->flagsr & RFR_IM_FIRE) {
216         lore_ptr->vp[lore_ptr->vn] = _("炎", "fire");
217         lore_ptr->color[lore_ptr->vn++] = TERM_RED;
218     }
219
220     if (lore_ptr->flagsr & RFR_IM_COLD) {
221         lore_ptr->vp[lore_ptr->vn] = _("冷気", "cold");
222         lore_ptr->color[lore_ptr->vn++] = TERM_L_WHITE;
223     }
224
225     if (lore_ptr->flagsr & RFR_IM_POIS) {
226         lore_ptr->vp[lore_ptr->vn] = _("毒", "poison");
227         lore_ptr->color[lore_ptr->vn++] = TERM_L_GREEN;
228     }
229
230     if (lore_ptr->flagsr & RFR_RES_LITE) {
231         lore_ptr->vp[lore_ptr->vn] = _("閃光", "light");
232         lore_ptr->color[lore_ptr->vn++] = TERM_YELLOW;
233     }
234
235     if (lore_ptr->flagsr & RFR_RES_DARK) {
236         lore_ptr->vp[lore_ptr->vn] = _("暗黒", "dark");
237         lore_ptr->color[lore_ptr->vn++] = TERM_L_DARK;
238     }
239
240     if (lore_ptr->flagsr & RFR_RES_NETH) {
241         lore_ptr->vp[lore_ptr->vn] = _("地獄", "nether");
242         lore_ptr->color[lore_ptr->vn++] = TERM_L_DARK;
243     }
244
245     if (lore_ptr->flagsr & RFR_RES_WATE) {
246         lore_ptr->vp[lore_ptr->vn] = _("水", "water");
247         lore_ptr->color[lore_ptr->vn++] = TERM_BLUE;
248     }
249
250     if (lore_ptr->flagsr & RFR_RES_PLAS) {
251         lore_ptr->vp[lore_ptr->vn] = _("プラズマ", "plasma");
252         lore_ptr->color[lore_ptr->vn++] = TERM_L_RED;
253     }
254
255     if (lore_ptr->flagsr & RFR_RES_SHAR) {
256         lore_ptr->vp[lore_ptr->vn] = _("破片", "shards");
257         lore_ptr->color[lore_ptr->vn++] = TERM_L_UMBER;
258     }
259
260     if (lore_ptr->flagsr & RFR_RES_SOUN) {
261         lore_ptr->vp[lore_ptr->vn] = _("轟音", "sound");
262         lore_ptr->color[lore_ptr->vn++] = TERM_ORANGE;
263     }
264
265     if (lore_ptr->flagsr & RFR_RES_CHAO) {
266         lore_ptr->vp[lore_ptr->vn] = _("カオス", "chaos");
267         lore_ptr->color[lore_ptr->vn++] = TERM_VIOLET;
268     }
269
270     if (lore_ptr->flagsr & RFR_RES_NEXU) {
271         lore_ptr->vp[lore_ptr->vn] = _("因果混乱", "nexus");
272         lore_ptr->color[lore_ptr->vn++] = TERM_VIOLET;
273     }
274
275     if (lore_ptr->flagsr & RFR_RES_DISE) {
276         lore_ptr->vp[lore_ptr->vn] = _("劣化", "disenchantment");
277         lore_ptr->color[lore_ptr->vn++] = TERM_VIOLET;
278     }
279
280     if (lore_ptr->flagsr & RFR_RES_WALL) {
281         lore_ptr->vp[lore_ptr->vn] = _("フォース", "force");
282         lore_ptr->color[lore_ptr->vn++] = TERM_UMBER;
283     }
284
285     if (lore_ptr->flagsr & RFR_RES_INER) {
286         lore_ptr->vp[lore_ptr->vn] = _("遅鈍", "inertia");
287         lore_ptr->color[lore_ptr->vn++] = TERM_SLATE;
288     }
289
290     if (lore_ptr->flagsr & RFR_RES_TIME) {
291         lore_ptr->vp[lore_ptr->vn] = _("時間逆転", "time");
292         lore_ptr->color[lore_ptr->vn++] = TERM_L_BLUE;
293     }
294
295     if (lore_ptr->flagsr & RFR_RES_GRAV) {
296         lore_ptr->vp[lore_ptr->vn] = _("重力", "gravity");
297         lore_ptr->color[lore_ptr->vn++] = TERM_SLATE;
298     }
299
300     if (lore_ptr->flagsr & RFR_RES_ALL) {
301         lore_ptr->vp[lore_ptr->vn] = _("あらゆる攻撃", "all");
302         lore_ptr->color[lore_ptr->vn++] = TERM_YELLOW;
303     }
304
305     if ((lore_ptr->flagsr & RFR_RES_TELE) && !(lore_ptr->r_ptr->flags1 & RF1_UNIQUE)) {
306         lore_ptr->vp[lore_ptr->vn] = _("テレポート", "teleportation");
307         lore_ptr->color[lore_ptr->vn++] = TERM_ORANGE;
308     }
309 }
310
311 void display_monster_resistances(lore_type *lore_ptr)
312 {
313     if (lore_ptr->vn <= 0)
314         return;
315
316     hooked_roff(format(_("%^sは", "%^s"), Who::who(lore_ptr->msex)));
317     for (int n = 0; n < lore_ptr->vn; n++) {
318 #ifdef JP
319         if (n != 0)
320             hooked_roff("と");
321 #else
322         if (n == 0)
323             hooked_roff(" resists ");
324         else if (n < lore_ptr->vn - 1)
325             hooked_roff(", ");
326         else
327             hooked_roff(" and ");
328 #endif
329         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
330     }
331
332     hooked_roff(_("の耐性を持っている。", ".  "));
333 }
334
335 void display_monster_evolution(lore_type* lore_ptr)
336 {
337     if (!lore_ptr->r_ptr->r_can_evolve && !lore_ptr->know_everything)
338         return;
339
340     if (lore_ptr->r_ptr->next_r_idx) {
341         hooked_roff(format(_("%^sは経験を積むと、", "%^s will evolve into "), Who::who(lore_ptr->msex)));
342         hook_c_roff(TERM_YELLOW, format("%s", r_info[lore_ptr->r_ptr->next_r_idx].name.c_str()));
343
344         hooked_roff(_(format("に進化する。"), format(" when %s gets enough experience.  ", Who::who(lore_ptr->msex))));
345     } else if (!(lore_ptr->r_ptr->flags1 & RF1_UNIQUE)) {
346         hooked_roff(format(_("%sは進化しない。", "%s won't evolve.  "), Who::who(lore_ptr->msex)));
347     }
348 }
349
350 void display_monster_concrete_immunities(lore_type *lore_ptr)
351 {
352     if (lore_ptr->flags3 & RF3_NO_STUN) {
353         lore_ptr->vp[lore_ptr->vn] = _("朦朧としない", "stunned");
354         lore_ptr->color[lore_ptr->vn++] = TERM_ORANGE;
355     }
356
357     if (lore_ptr->flags3 & RF3_NO_FEAR) {
358         lore_ptr->vp[lore_ptr->vn] = _("恐怖を感じない", "frightened");
359         lore_ptr->color[lore_ptr->vn++] = TERM_SLATE;
360     }
361
362     if (lore_ptr->flags3 & RF3_NO_CONF) {
363         lore_ptr->vp[lore_ptr->vn] = _("混乱しない", "confused");
364         lore_ptr->color[lore_ptr->vn++] = TERM_L_UMBER;
365     }
366
367     if (lore_ptr->flags3 & RF3_NO_SLEEP) {
368         lore_ptr->vp[lore_ptr->vn] = _("眠らされない", "slept");
369         lore_ptr->color[lore_ptr->vn++] = TERM_BLUE;
370     }
371
372     if ((lore_ptr->flagsr & RFR_RES_TELE) && (lore_ptr->r_ptr->flags1 & RF1_UNIQUE)) {
373         lore_ptr->vp[lore_ptr->vn] = _("テレポートされない", "teleported");
374         lore_ptr->color[lore_ptr->vn++] = TERM_ORANGE;
375     }
376 }
377
378 void display_monster_immunities(lore_type *lore_ptr)
379 {
380     if (lore_ptr->vn <= 0)
381         return;
382
383     hooked_roff(format(_("%^sは", "%^s"), Who::who(lore_ptr->msex)));
384     for (int n = 0; n < lore_ptr->vn; n++) {
385 #ifdef JP
386         if (n != 0)
387             hooked_roff("し、");
388 #else
389         if (n == 0)
390             hooked_roff(" cannot be ");
391         else if (n < lore_ptr->vn - 1)
392             hooked_roff(", ");
393         else
394             hooked_roff(" or ");
395 #endif
396         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
397     }
398
399     hooked_roff(_("。", ".  "));
400 }
401
402 void display_monster_alert(lore_type *lore_ptr)
403 {
404     bool alert = ((int)lore_ptr->r_ptr->r_wake * (int)lore_ptr->r_ptr->r_wake) > lore_ptr->r_ptr->sleep;
405     alert |= lore_ptr->r_ptr->r_ignore == MAX_UCHAR;
406     alert |= (lore_ptr->r_ptr->sleep == 0) && (lore_ptr->r_ptr->r_tkills >= 10);
407     alert |= lore_ptr->know_everything;
408     if (!alert)
409         return;
410
411     concptr act;
412     if (lore_ptr->r_ptr->sleep > 200) {
413         act = _("を無視しがちであるが", "prefers to ignore");
414     } else if (lore_ptr->r_ptr->sleep > 95) {
415         act = _("に対してほとんど注意を払わないが", "pays very little attention to");
416     } else if (lore_ptr->r_ptr->sleep > 75) {
417         act = _("に対してあまり注意を払わないが", "pays little attention to");
418     } else if (lore_ptr->r_ptr->sleep > 45) {
419         act = _("を見過ごしがちであるが", "tends to overlook");
420     } else if (lore_ptr->r_ptr->sleep > 25) {
421         act = _("をほんの少しは見ており", "takes quite a while to see");
422     } else if (lore_ptr->r_ptr->sleep > 10) {
423         act = _("をしばらくは見ており", "takes a while to see");
424     } else if (lore_ptr->r_ptr->sleep > 5) {
425         act = _("を幾分注意深く見ており", "is fairly observant of");
426     } else if (lore_ptr->r_ptr->sleep > 3) {
427         act = _("を注意深く見ており", "is observant of");
428     } else if (lore_ptr->r_ptr->sleep > 1) {
429         act = _("をかなり注意深く見ており", "is very observant of");
430     } else if (lore_ptr->r_ptr->sleep > 0) {
431         act = _("を警戒しており", "is vigilant for");
432     } else {
433         act = _("をかなり警戒しており", "is ever vigilant for");
434     }
435
436     hooked_roff(_(format("%^sは侵入者%s、 %d フィート先から侵入者に気付くことがある。", Who::who(lore_ptr->msex), act, 10 * lore_ptr->r_ptr->aaf),
437         format("%^s %s intruders, which %s may notice from %d feet.  ", Who::who(lore_ptr->msex), act, Who::who(lore_ptr->msex), 10 * lore_ptr->r_ptr->aaf)));
438 }