OSDN Git Service

Merge pull request #2122 from sikabane-works/release/3.0.0Alpha52
[hengbandforosx/hengbandosx.git] / src / view / display-lore-magics.cpp
1 #include "view/display-lore-magics.h"
2 #include "lore/lore-util.h"
3 #include "monster-race/race-flags2.h"
4 #include "system/monster-race-definition.h"
5 #include "term/term-color-types.h"
6
7 void display_monster_breath(lore_type *lore_ptr)
8 {
9     lore_ptr->breath = false;
10     if (lore_ptr->vn <= 0)
11         return;
12
13     lore_ptr->breath = true;
14     hooked_roff(format(_("%^sは", "%^s"), Who::who(lore_ptr->msex)));
15     for (int n = 0; n < lore_ptr->vn; n++) {
16 #ifdef JP
17         if (n != 0)
18             hooked_roff("や");
19 #else
20         if (n == 0)
21             hooked_roff(" may breathe ");
22         else if (n < lore_ptr->vn - 1)
23             hooked_roff(", ");
24         else
25             hooked_roff(" or ");
26 #endif
27         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
28     }
29
30 #ifdef JP
31     hooked_roff("のブレスを吐くことがある");
32 #endif
33 }
34
35 void display_monster_magic_types(lore_type *lore_ptr)
36 {
37     lore_ptr->magic = false;
38     if (lore_ptr->vn == 0)
39         return;
40
41     lore_ptr->magic = true;
42     if (lore_ptr->breath) {
43         hooked_roff(_("、なおかつ", ", and is also"));
44     } else {
45         hooked_roff(format(_("%^sは", "%^s is"), Who::who(lore_ptr->msex)));
46     }
47
48 #ifdef JP
49     if (lore_ptr->behavior_flags.has(MonsterBehaviorType::SMART))
50         hook_c_roff(TERM_YELLOW, "的確に");
51
52     hooked_roff("魔法を使うことができ、");
53 #else
54     hooked_roff(" magical, casting spells");
55     if (lore_ptr->behavior_flags.has(MonsterBehaviorType::SMART))
56         hook_c_roff(TERM_YELLOW, " intelligently");
57 #endif
58
59     for (int n = 0; n < lore_ptr->vn; n++) {
60 #ifdef JP
61         if (n != 0)
62             hooked_roff("、");
63 #else
64         if (n == 0)
65             hooked_roff(" which ");
66         else if (n < lore_ptr->vn - 1)
67             hooked_roff(", ");
68         else
69             hooked_roff(" or ");
70 #endif
71         hook_c_roff(lore_ptr->color[n], lore_ptr->vp[n]);
72     }
73
74 #ifdef JP
75     hooked_roff("の呪文を唱えることがある");
76 #endif
77 }
78
79 void display_mosnter_magic_possibility(lore_type *lore_ptr)
80 {
81     if (!lore_ptr->breath && !lore_ptr->magic && !lore_ptr->shoot && !lore_ptr->rocket)
82         return;
83
84     int m = lore_ptr->r_ptr->r_cast_spell;
85     int n = lore_ptr->r_ptr->freq_spell;
86     if (m > 100 || lore_ptr->know_everything) {
87         hooked_roff(format(_("(確率:1/%d)", "; 1 time in %d"), 100 / n));
88     } else if (m) {
89         n = ((n + 9) / 10) * 10;
90         hooked_roff(format(_("(確率:約1/%d)", "; about 1 time in %d"), 100 / n));
91     }
92
93     hooked_roff(_("。", ".  "));
94 }