OSDN Git Service

9bc674ebd239dd69b054ce9aac51b72d32d56e8d
[hengband/hengband.git] / src / view / display-monster-lore.c
1 #include "view/display-monster-lore.h"
2 #include "lore/monster-lore.h"
3 #include "monster-race/race-flags1.h"
4 #include "monster-race/race-indice-types.h"
5 #include "term/term-color-types.h"
6 #include "world/world.h"
7
8 /*!
9  * @brief モンスター情報のヘッダを記述する
10  * Hack -- Display the "name" and "attr/chars" of a monster race
11  * @param r_idx モンスターの種族ID
12  * @return なし
13  */
14 void roff_top(MONRACE_IDX r_idx)
15 {
16     monster_race *r_ptr = &r_info[r_idx];
17     char c1 = r_ptr->d_char;
18     char c2 = r_ptr->x_char;
19
20     TERM_COLOR a1 = r_ptr->d_attr;
21     TERM_COLOR a2 = r_ptr->x_attr;
22
23     Term_erase(0, 0, 255);
24     Term_gotoxy(0, 0);
25
26 #ifdef JP
27 #else
28     if (!(r_ptr->flags1 & RF1_UNIQUE)) {
29         Term_addstr(-1, TERM_WHITE, "The ");
30     }
31 #endif
32
33     Term_addstr(-1, TERM_WHITE, (r_name + r_ptr->name));
34
35     Term_addstr(-1, TERM_WHITE, " ('");
36     Term_add_bigch(a1, c1);
37     Term_addstr(-1, TERM_WHITE, "')");
38
39     Term_addstr(-1, TERM_WHITE, "/('");
40     Term_add_bigch(a2, c2);
41     Term_addstr(-1, TERM_WHITE, "'):");
42
43     if (!current_world_ptr->wizard)
44         return;
45
46     char buf[16];
47     sprintf(buf, "%d", r_idx);
48     Term_addstr(-1, TERM_WHITE, " (");
49     Term_addstr(-1, TERM_L_BLUE, buf);
50     Term_addch(TERM_WHITE, ')');
51 }
52
53 /*!
54  * @brief  モンスター情報の表示と共に画面を一時消去するサブルーチン /
55  * Hack -- describe the given monster race at the top of the screen
56  * @param r_idx モンスターの種族ID
57  * @param mode 表示オプション
58  * @return なし
59  */
60 void screen_roff(player_type *player_ptr, MONRACE_IDX r_idx, BIT_FLAGS mode)
61 {
62     msg_erase();
63     Term_erase(0, 1, 255);
64     hook_c_roff = c_roff;
65     process_monster_lore(player_ptr, r_idx, mode);
66     roff_top(r_idx);
67 }
68
69 /*!
70  * @brief モンスター情報の現在のウィンドウに表示する /
71  * Hack -- describe the given monster race in the current "term" window
72  * @param r_idx モンスターの種族ID
73  * @return なし
74  */
75 void display_roff(player_type *player_ptr)
76 {
77     for (int y = 0; y < Term->hgt; y++) {
78         Term_erase(0, y, 255);
79     }
80
81     Term_gotoxy(0, 1);
82     hook_c_roff = c_roff;
83     MONRACE_IDX r_idx = player_ptr->monster_race_idx;
84     process_monster_lore(player_ptr, r_idx, 0);
85     roff_top(r_idx);
86 }
87
88 /*!
89  * @brief モンスター詳細情報を自動スポイラー向けに出力する /
90  * Hack -- output description of the given monster race
91  * @param r_idx モンスターの種族ID
92  * @param roff_func 出力処理を行う関数ポインタ
93  * @return なし
94  */
95 void output_monster_spoiler(player_type *player_ptr, MONRACE_IDX r_idx, void (*roff_func)(TERM_COLOR attr, concptr str))
96 {
97     hook_c_roff = roff_func;
98     process_monster_lore(player_ptr, r_idx, 0x03);
99 }
100
101 static bool display_kill_unique(lore_type *lore_ptr)
102 {
103     if ((lore_ptr->flags1 & RF1_UNIQUE) == 0)
104         return FALSE;
105
106     bool dead = (lore_ptr->r_ptr->max_num == 0);
107     if (lore_ptr->r_ptr->r_deaths) {
108         hooked_roff(format(_("%^sはあなたの先祖を %d 人葬っている", "%^s has slain %d of your ancestors"), wd_he[lore_ptr->msex], lore_ptr->r_ptr->r_deaths));
109
110         if (dead) {
111             hooked_roff(
112                 _(format("が、すでに仇討ちは果たしている!"), format(", but you have avenged %s!  ", plural(lore_ptr->r_ptr->r_deaths, "him", "them"))));
113         } else {
114             hooked_roff(
115                 _(format("のに、まだ仇討ちを果たしていない。"), format(", who %s unavenged.  ", plural(lore_ptr->r_ptr->r_deaths, "remains", "remain"))));
116         }
117
118         hooked_roff("\n");
119     } else if (dead) {
120         hooked_roff(_("あなたはこの仇敵をすでに葬り去っている。", "You have slain this foe.  "));
121         hooked_roff("\n");
122     }
123
124     return TRUE;
125 }
126
127 static bool display_killed(lore_type *lore_ptr)
128 {
129     if (lore_ptr->r_ptr->r_deaths == 0)
130         return FALSE;
131
132     hooked_roff(_(format("このモンスターはあなたの先祖を %d 人葬っている", lore_ptr->r_ptr->r_deaths),
133         format("%d of your ancestors %s been killed by this creature, ", lore_ptr->r_ptr->r_deaths, plural(lore_ptr->r_ptr->r_deaths, "has", "have"))));
134
135     if (lore_ptr->r_ptr->r_pkills) {
136         hooked_roff(format(_("が、あなたはこのモンスターを少なくとも %d 体は倒している。", "and you have exterminated at least %d of the creatures.  "),
137             lore_ptr->r_ptr->r_pkills));
138     } else if (lore_ptr->r_ptr->r_tkills) {
139         hooked_roff(format(
140             _("が、あなたの先祖はこのモンスターを少なくとも %d 体は倒している。", "and your ancestors have exterminated at least %d of the creatures.  "),
141             lore_ptr->r_ptr->r_tkills));
142     } else {
143         hooked_roff(format(_("が、まだ%sを倒したことはない。", "and %s is not ever known to have been defeated.  "), wd_he[lore_ptr->msex]));
144     }
145
146     hooked_roff("\n");
147     return TRUE;
148 }
149
150 void display_kill_numbers(lore_type *lore_ptr)
151 {
152     if ((lore_ptr->mode & 0x02) != 0)
153         return;
154
155     if (display_kill_unique(lore_ptr))
156         return;
157
158     if (display_killed(lore_ptr))
159         return;
160
161     if (lore_ptr->r_ptr->r_pkills) {
162         hooked_roff(format(
163             _("あなたはこのモンスターを少なくとも %d 体は殺している。", "You have killed at least %d of these creatures.  "), lore_ptr->r_ptr->r_pkills));
164     } else if (lore_ptr->r_ptr->r_tkills) {
165         hooked_roff(format(_("あなたの先祖はこのモンスターを少なくとも %d 体は殺している。", "Your ancestors have killed at least %d of these creatures.  "),
166             lore_ptr->r_ptr->r_tkills));
167     } else {
168         hooked_roff(_("このモンスターを倒したことはない。", "No battles to the death are recalled.  "));
169     }
170
171     hooked_roff("\n");
172 }
173
174 /*!
175  * @brief どこに出没するかを表示する
176  * @param lore_ptr モンスターの思い出構造体への参照ポインタ
177  * @return たぬきならFALSE、それ以外はTRUE
178  */
179 bool display_where_to_appear(lore_type *lore_ptr)
180 {
181     lore_ptr->old = FALSE;
182     if (lore_ptr->r_ptr->level == 0) {
183         hooked_roff(format(_("%^sは町に住み", "%^s lives in the town"), wd_he[lore_ptr->msex]));
184         lore_ptr->old = TRUE;
185     } else if (lore_ptr->r_ptr->r_tkills || lore_ptr->know_everything) {
186         if (depth_in_feet) {
187             hooked_roff(format(
188                 _("%^sは通常地下 %d フィートで出現し", "%^s is normally found at depths of %d feet"), wd_he[lore_ptr->msex], lore_ptr->r_ptr->level * 50));
189         } else {
190             hooked_roff(format(_("%^sは通常地下 %d 階で出現し", "%^s is normally found on dungeon level %d"), wd_he[lore_ptr->msex], lore_ptr->r_ptr->level));
191         }
192
193         lore_ptr->old = TRUE;
194     }
195
196     if (lore_ptr->r_idx == MON_CHAMELEON) {
197         hooked_roff(_("、他のモンスターに化ける。", "and can take the shape of other monster."));
198         return FALSE;
199     }
200
201     if (lore_ptr->old) {
202         hooked_roff(_("、", ", and "));
203     } else {
204         hooked_roff(format(_("%^sは", "%^s "), wd_he[lore_ptr->msex]));
205         lore_ptr->old = TRUE;
206     }
207
208     return TRUE;
209 }
210
211 void display_monster_move(lore_type *lore_ptr)
212 {
213 #ifdef JP
214 #else
215     hooked_roff("moves");
216 #endif
217
218     display_random_move(lore_ptr);
219     if (lore_ptr->speed > 110) {
220         if (lore_ptr->speed > 139)
221             hook_c_roff(TERM_RED, _("信じ難いほど", " incredibly"));
222         else if (lore_ptr->speed > 134)
223             hook_c_roff(TERM_ORANGE, _("猛烈に", " extremely"));
224         else if (lore_ptr->speed > 129)
225             hook_c_roff(TERM_ORANGE, _("非常に", " very"));
226         else if (lore_ptr->speed > 124)
227             hook_c_roff(TERM_UMBER, _("かなり", " fairly"));
228         else if (lore_ptr->speed < 120)
229             hook_c_roff(TERM_L_UMBER, _("やや", " somewhat"));
230         hook_c_roff(TERM_L_RED, _("素早く", " quickly"));
231     } else if (lore_ptr->speed < 110) {
232         if (lore_ptr->speed < 90)
233             hook_c_roff(TERM_L_GREEN, _("信じ難いほど", " incredibly"));
234         else if (lore_ptr->speed < 95)
235             hook_c_roff(TERM_BLUE, _("非常に", " very"));
236         else if (lore_ptr->speed < 100)
237             hook_c_roff(TERM_BLUE, _("かなり", " fairly"));
238         else if (lore_ptr->speed > 104)
239             hook_c_roff(TERM_GREEN, _("やや", " somewhat"));
240         hook_c_roff(TERM_L_BLUE, _("ゆっくりと", " slowly"));
241     } else {
242         hooked_roff(_("普通の速さで", " at normal speed"));
243     }
244
245 #ifdef JP
246     hooked_roff("動いている");
247 #endif
248 }
249
250 void display_random_move(lore_type *lore_ptr)
251 {
252     if (((lore_ptr->flags1 & RF1_RAND_50) == 0) && ((lore_ptr->flags1 & RF1_RAND_25) == 0))
253         return;
254
255     if ((lore_ptr->flags1 & RF1_RAND_50) && (lore_ptr->flags1 & RF1_RAND_25)) {
256         hooked_roff(_("かなり", " extremely"));
257     } else if (lore_ptr->flags1 & RF1_RAND_50) {
258         hooked_roff(_("幾分", " somewhat"));
259     } else if (lore_ptr->flags1 & RF1_RAND_25) {
260         hooked_roff(_("少々", " a bit"));
261     }
262
263     hooked_roff(_("不規則に", " erratically"));
264     if (lore_ptr->speed != 110)
265         hooked_roff(_("、かつ", ", and"));
266 }
267
268 void display_monster_never_move(lore_type *lore_ptr)
269 {
270     if ((lore_ptr->flags1 & RF1_NEVER_MOVE) == 0)
271         return;
272
273     if (lore_ptr->old) {
274         hooked_roff(_("、しかし", ", but "));
275     } else {
276         hooked_roff(format(_("%^sは", "%^s "), wd_he[lore_ptr->msex]));
277         lore_ptr->old = TRUE;
278     }
279
280     hooked_roff(_("侵入者を追跡しない", "does not deign to chase intruders"));
281 }