OSDN Git Service

[Refactor] #37353 mention_use(), describe_use() を player-inventory.c/h へ移動.
[hengband/hengband.git] / src / object1.c
1 /*!
2  * @file object1.c
3  * @brief オブジェクトの実装 / Object code, part 1
4  * @date 2014/01/10
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  *\n
8  * This software may be copied and distributed for educational, research,\n
9  * and not for profit purposes provided that this copyright and statement\n
10  * are included in all such copies.  Other copyrights may also apply.\n
11  * 2014 Deskull rearranged comment for Doxygen.\n
12  */
13
14 #include "angband.h"
15 #include "core.h"
16 #include "util.h"
17
18 #include "artifact.h"
19 #include "floor.h"
20 #include "cmd-activate.h"
21 #include "objectkind.h"
22 #include "object-ego.h"
23 #include "object-flavor.h"
24 #include "object-hook.h"
25 #include "player-move.h"
26 #include "player-class.h"
27 #include "player-inventory.h"
28 #include "monster.h"
29 #include "files.h"
30 #include "term.h"
31 #include "cmd-smith.h"
32 #include "snipe.h"
33 #include "view-mainwindow.h"
34
35 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
36 #ifdef verify
37 #undef verify
38 #endif
39 #endif
40
41 /*!
42  * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
43  * @return なし
44  * This involves resetting various things to their "default" state.\n
45  *\n
46  * If the "prefs" flag is TRUE, then we will also load the appropriate\n
47  * "user pref file" based on the current setting of the "use_graphics"\n
48  * flag.  This is useful for switching "graphics" on/off.\n
49  *\n
50  * The features, objects, and monsters, should all be encoded in the\n
51  * relevant "font.pref" and/or "graf.prf" files.  \n
52  *\n
53  * The "prefs" parameter is no longer meaningful.  \n
54  */
55 void reset_visuals(void)
56 {
57         int i, j;
58
59         /* Extract some info about terrain features */
60         for (i = 0; i < max_f_idx; i++)
61         {
62                 feature_type *f_ptr = &f_info[i];
63
64                 /* Assume we will use the underlying values */
65                 for (j = 0; j < F_LIT_MAX; j++)
66                 {
67                         f_ptr->x_attr[j] = f_ptr->d_attr[j];
68                         f_ptr->x_char[j] = f_ptr->d_char[j];
69                 }
70         }
71
72         /* Extract default attr/char code for objects */
73         for (i = 0; i < max_k_idx; i++)
74         {
75                 object_kind *k_ptr = &k_info[i];
76
77                 /* Default attr/char */
78                 k_ptr->x_attr = k_ptr->d_attr;
79                 k_ptr->x_char = k_ptr->d_char;
80         }
81
82         /* Extract default attr/char code for monsters */
83         for (i = 0; i < max_r_idx; i++)
84         {
85                 monster_race *r_ptr = &r_info[i];
86
87                 /* Default attr/char */
88                 r_ptr->x_attr = r_ptr->d_attr;
89                 r_ptr->x_char = r_ptr->d_char;
90         }
91
92         if (use_graphics)
93         {
94                 char buf[1024];
95
96                 /* Process "graf.prf" */
97                 process_pref_file("graf.prf");
98
99                 /* Access the "character" pref file */
100                 sprintf(buf, "graf-%s.prf", p_ptr->base_name);
101
102                 /* Process "graf-<playername>.prf" */
103                 process_pref_file(buf);
104         }
105
106         /* Normal symbols */
107         else
108         {
109                 char buf[1024];
110
111                 /* Process "font.prf" */
112                 process_pref_file("font.prf");
113
114                 /* Access the "character" pref file */
115                 sprintf(buf, "font-%s.prf", p_ptr->base_name);
116
117                 /* Process "font-<playername>.prf" */
118                 process_pref_file(buf);
119         }
120 }
121
122 /*!
123  * @brief オブジェクトのフラグ類を配列に与える
124  * Obtain the "flags" for an item
125  * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
126  * @param flgs フラグ情報を受け取る配列
127  * @return なし
128  */
129 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
130 {
131         object_kind *k_ptr = &k_info[o_ptr->k_idx];
132         int i;
133
134         /* Base object */
135         for (i = 0; i < TR_FLAG_SIZE; i++)
136                 flgs[i] = k_ptr->flags[i];
137
138         /* Artifact */
139         if (object_is_fixed_artifact(o_ptr))
140         {
141                 artifact_type *a_ptr = &a_info[o_ptr->name1];
142
143                 for (i = 0; i < TR_FLAG_SIZE; i++)
144                         flgs[i] = a_ptr->flags[i];
145         }
146
147         /* Ego-item */
148         if (object_is_ego(o_ptr))
149         {
150                 ego_item_type *e_ptr = &e_info[o_ptr->name2];
151
152                 for (i = 0; i < TR_FLAG_SIZE; i++)
153                         flgs[i] |= e_ptr->flags[i];
154
155                 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
156                 {
157                         remove_flag(flgs, TR_SH_FIRE);
158                 }
159                 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
160                 {
161                         remove_flag(flgs, TR_INFRA);
162                 }
163                 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
164                 {
165                         remove_flag(flgs, TR_RES_BLIND);
166                         remove_flag(flgs, TR_SEE_INVIS);
167                 }
168         }
169
170         /* Random artifact ! */
171         for (i = 0; i < TR_FLAG_SIZE; i++)
172                 flgs[i] |= o_ptr->art_flags[i];
173
174         if (object_is_smith(o_ptr))
175         {
176                 int add = o_ptr->xtra3 - 1;
177
178                 if (add < TR_FLAG_MAX)
179                 {
180                         add_flag(flgs, add);
181                 }
182                 else if (add == ESSENCE_TMP_RES_ACID)
183                 {
184                         add_flag(flgs, TR_RES_ACID);
185                         add_flag(flgs, TR_ACTIVATE);
186                 }
187                 else if (add == ESSENCE_TMP_RES_ELEC)
188                 {
189                         add_flag(flgs, TR_RES_ELEC);
190                         add_flag(flgs, TR_ACTIVATE);
191                 }
192                 else if (add == ESSENCE_TMP_RES_FIRE)
193                 {
194                         add_flag(flgs, TR_RES_FIRE);
195                         add_flag(flgs, TR_ACTIVATE);
196                 }
197                 else if (add == ESSENCE_TMP_RES_COLD)
198                 {
199                         add_flag(flgs, TR_RES_COLD);
200                         add_flag(flgs, TR_ACTIVATE);
201                 }
202                 else if (add == ESSENCE_SH_FIRE)
203                 {
204                         add_flag(flgs, TR_RES_FIRE);
205                         add_flag(flgs, TR_SH_FIRE);
206                 }
207                 else if (add == ESSENCE_SH_ELEC)
208                 {
209                         add_flag(flgs, TR_RES_ELEC);
210                         add_flag(flgs, TR_SH_ELEC);
211                 }
212                 else if (add == ESSENCE_SH_COLD)
213                 {
214                         add_flag(flgs, TR_RES_COLD);
215                         add_flag(flgs, TR_SH_COLD);
216                 }
217                 else if (add == ESSENCE_RESISTANCE)
218                 {
219                         add_flag(flgs, TR_RES_ACID);
220                         add_flag(flgs, TR_RES_ELEC);
221                         add_flag(flgs, TR_RES_FIRE);
222                         add_flag(flgs, TR_RES_COLD);
223                 }
224                 else if (add == TR_IMPACT)
225                 {
226                         add_flag(flgs, TR_ACTIVATE);
227                 }
228         }
229 }
230
231 /*!
232  * @brief オブジェクトの明示されているフラグ類を取得する
233  * Obtain the "flags" for an item which are known to the player
234  * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
235  * @param flgs フラグ情報を受け取る配列
236  * @return なし
237  */
238 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
239 {
240         bool spoil = FALSE;
241         int i;
242
243         object_kind *k_ptr = &k_info[o_ptr->k_idx];
244
245         /* Clear */
246         for (i = 0; i < TR_FLAG_SIZE; i++)
247                 flgs[i] = 0;
248
249         if (!object_is_aware(o_ptr)) return;
250
251         /* Base object */
252         for (i = 0; i < TR_FLAG_SIZE; i++)
253                 flgs[i] = k_ptr->flags[i];
254
255         /* Must be identified */
256         if (!object_is_known(o_ptr)) return;
257
258         /* Ego-item (known basic flags) */
259         if (object_is_ego(o_ptr))
260         {
261                 ego_item_type *e_ptr = &e_info[o_ptr->name2];
262
263                 for (i = 0; i < TR_FLAG_SIZE; i++)
264                         flgs[i] |= e_ptr->flags[i];
265
266                 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
267                 {
268                         remove_flag(flgs, TR_SH_FIRE);
269                 }
270                 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
271                 {
272                         remove_flag(flgs, TR_INFRA);
273                 }
274                 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
275                 {
276                         remove_flag(flgs, TR_RES_BLIND);
277                         remove_flag(flgs, TR_SEE_INVIS);
278                 }
279         }
280
281
282 #ifdef SPOIL_ARTIFACTS
283         /* Full knowledge for some artifacts */
284         if (object_is_artifact(o_ptr)) spoil = TRUE;
285 #endif /* SPOIL_ARTIFACTS */
286
287 #ifdef SPOIL_EGO_ITEMS
288         /* Full knowledge for some ego-items */
289         if (object_is_ego(o_ptr)) spoil = TRUE;
290 #endif /* SPOIL_EGO_ITEMS */
291
292         /* Need full knowledge or spoilers */
293         if (spoil || (o_ptr->ident & IDENT_MENTAL))
294         {
295                 /* Artifact */
296                 if (object_is_fixed_artifact(o_ptr))
297                 {
298                         artifact_type *a_ptr = &a_info[o_ptr->name1];
299
300                         for (i = 0; i < TR_FLAG_SIZE; i++)
301                                 flgs[i] = a_ptr->flags[i];
302                 }
303
304                 /* Random artifact ! */
305                 for (i = 0; i < TR_FLAG_SIZE; i++)
306                         flgs[i] |= o_ptr->art_flags[i];
307         }
308
309         if (object_is_smith(o_ptr))
310         {
311                 int add = o_ptr->xtra3 - 1;
312
313                 if (add < TR_FLAG_MAX)
314                 {
315                         add_flag(flgs, add);
316                 }
317                 else if (add == ESSENCE_TMP_RES_ACID)
318                 {
319                         add_flag(flgs, TR_RES_ACID);
320                 }
321                 else if (add == ESSENCE_TMP_RES_ELEC)
322                 {
323                         add_flag(flgs, TR_RES_ELEC);
324                 }
325                 else if (add == ESSENCE_TMP_RES_FIRE)
326                 {
327                         add_flag(flgs, TR_RES_FIRE);
328                 }
329                 else if (add == ESSENCE_TMP_RES_COLD)
330                 {
331                         add_flag(flgs, TR_RES_COLD);
332                 }
333                 else if (add == ESSENCE_SH_FIRE)
334                 {
335                         add_flag(flgs, TR_RES_FIRE);
336                         add_flag(flgs, TR_SH_FIRE);
337                 }
338                 else if (add == ESSENCE_SH_ELEC)
339                 {
340                         add_flag(flgs, TR_RES_ELEC);
341                         add_flag(flgs, TR_SH_ELEC);
342                 }
343                 else if (add == ESSENCE_SH_COLD)
344                 {
345                         add_flag(flgs, TR_RES_COLD);
346                         add_flag(flgs, TR_SH_COLD);
347                 }
348                 else if (add == ESSENCE_RESISTANCE)
349                 {
350                         add_flag(flgs, TR_RES_ACID);
351                         add_flag(flgs, TR_RES_ELEC);
352                         add_flag(flgs, TR_RES_FIRE);
353                         add_flag(flgs, TR_RES_COLD);
354                 }
355         }
356 }
357
358 /*!
359  * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
360  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
361  * @return concptr 発動名称を返す文字列ポインタ
362  */
363 static concptr item_activation_dragon_breath(object_type *o_ptr)
364 {
365         static char desc[256];
366         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
367         int i, n = 0;
368
369         object_flags(o_ptr, flgs);
370         strcpy(desc, _("", "breath "));
371
372         for (i = 0; dragonbreath_info[i].flag != 0; i++)
373         {
374                 if (have_flag(flgs, dragonbreath_info[i].flag))
375                 {
376                         if (n > 0) strcat(desc, _("、", ", "));
377                         strcat(desc, dragonbreath_info[i].name);
378                         n++;
379                 }
380         }
381
382         strcat(desc, _("のブレス(250)", ""));
383
384         return (desc);
385 }
386
387 /*!
388  * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
389  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
390  * @return concptr 発動名称を返す文字列ポインタ
391  */
392 static concptr item_activation_aux(object_type *o_ptr)
393 {
394         static char activation_detail[256];
395         concptr desc;
396         char timeout[32];
397         int constant, dice;
398         const activation_type* const act_ptr = find_activation_info(o_ptr);
399
400         if (!act_ptr) return _("未定義", "something undefined");
401
402         desc = act_ptr->desc;
403
404         /* Overwrite description if it is special */
405         switch (act_ptr->index) {
406         case ACT_BR_FIRE:
407                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
408                         desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
409                 break;
410         case ACT_BR_COLD:
411                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
412                         desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
413                 break;
414         case ACT_BR_DRAGON:
415                 desc = item_activation_dragon_breath(o_ptr);
416                 break;
417         case ACT_AGGRAVATE:
418                 if (o_ptr->name1 == ART_HYOUSIGI)
419                         desc = _("拍子木を打ちならす", "beat wooden clappers");
420                 break;
421         case ACT_RESIST_ACID:
422                 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
423                         desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
424                 break;
425         case ACT_RESIST_FIRE:
426                 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
427                         desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
428                 break;
429         case ACT_RESIST_COLD:
430                 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
431                         desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
432                 break;
433         case ACT_RESIST_ELEC:
434                 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
435                         desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
436                 break;
437         case ACT_RESIST_POIS:
438                 if (o_ptr->name2 == EGO_BRAND_POIS)
439                         desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
440                 break;
441         }
442
443         /* Timeout description */
444         constant = act_ptr->timeout.constant;
445         dice = act_ptr->timeout.dice;
446         if (constant == 0 && dice == 0) {
447                 /* We can activate it every current_world_ptr->game_turn */
448                 strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
449         } else if (constant < 0) {
450                 /* Activations that have special timeout */
451                 switch (act_ptr->index) {
452                 case ACT_BR_FIRE:
453                         sprintf(timeout, _("%d ターン毎", "every %d turns"),
454                                 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
455                         break;
456                 case ACT_BR_COLD:
457                         sprintf(timeout, _("%d ターン毎", "every %d turns"),
458                                 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
459                         break;
460                 case ACT_TERROR:
461                         strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
462                         break;
463                 case ACT_MURAMASA:
464                         strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
465                         break;
466                 default:
467                         strcpy(timeout, "undefined");
468                         break;
469                 }
470         } else {
471                 /* Normal timeout activations */
472                 char constant_str[16], dice_str[16];
473                 sprintf(constant_str, "%d", constant);
474                 sprintf(dice_str, "d%d", dice);
475                 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
476                         (constant > 0) ? constant_str : "",
477                         (constant > 0 && dice > 0) ? "+" : "",
478                         (dice > 0) ? dice_str : "");
479         }
480
481         /* Build detail activate description */
482         sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
483
484         return activation_detail;
485 }
486
487 /*!
488  * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
489  * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
490  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
491  * @return concptr 発動名称を返す文字列ポインタ
492  */
493 concptr item_activation(object_type *o_ptr)
494 {
495         BIT_FLAGS flgs[TR_FLAG_SIZE];
496         object_flags(o_ptr, flgs);
497
498         /* Require activation ability */
499         if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
500
501         /* Get an explain of an activation */
502         if (activation_index(o_ptr))
503         {
504                 return item_activation_aux(o_ptr);
505         }
506
507         /* Special items */
508         if (o_ptr->tval == TV_WHISTLE)
509         {
510                 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
511         }
512
513         if (o_ptr->tval == TV_CAPTURE)
514         {
515                 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
516         }
517
518         return _("何も起きない", "Nothing");
519 }
520
521
522 /*!
523  * @brief オブジェクトの*鑑定*内容を詳述して表示する /
524  * Describe a "fully identified" item
525  * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
526  * @param mode 表示オプション
527  * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
528  */
529 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
530 {
531         int i = 0, j, k;
532
533         BIT_FLAGS flgs[TR_FLAG_SIZE];
534
535         char temp[70 * 20];
536         concptr            info[128];
537         GAME_TEXT o_name[MAX_NLEN];
538         int wid, hgt;
539         POSITION rad;
540         char desc[256];
541
542         int trivial_info = 0;
543         object_flags(o_ptr, flgs);
544
545         /* Extract the description */
546         {
547                 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
548                             (k_text + k_info[o_ptr->k_idx].text),
549                             77 - 15, temp, sizeof(temp));
550                 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
551                 { info[i] = &temp[j]; i++;}
552         }
553
554         if (object_is_equipment(o_ptr))
555         {
556                 /* Descriptions of a basic equipment is just a flavor */
557                 trivial_info = i;
558         }
559
560         /* Mega-Hack -- describe activation */
561         if (have_flag(flgs, TR_ACTIVATE))
562         {
563                 info[i++] = _("始動したときの効果...", "It can be activated for...");
564                 info[i++] = item_activation(o_ptr);
565                 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
566         }
567
568         /* Figurines, a hack */
569         if (o_ptr->tval == TV_FIGURINE)
570         {
571                 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
572         }
573
574         /* Figurines, a hack */
575         if (o_ptr->name1 == ART_STONEMASK)
576         {
577                 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
578         }
579
580         if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
581         {
582                 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
583         }
584
585         if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
586         {
587                 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
588                 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
589         }
590
591         if (o_ptr->name2 == EGO_2WEAPON)
592         {
593                 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
594         }
595
596         if (have_flag(flgs, TR_EASY_SPELL))
597         {
598                 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
599         }
600
601         if (o_ptr->name2 == EGO_AMU_FOOL)
602         {
603                 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
604         }
605
606         if (o_ptr->name2 == EGO_RING_THROW)
607         {
608                 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
609         }
610
611         if (o_ptr->name2 == EGO_AMU_NAIVETY)
612         {
613                 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
614         }
615
616         if (o_ptr->tval == TV_STATUE)
617         {
618                 monster_race *r_ptr = &r_info[o_ptr->pval];
619
620                 if (o_ptr->pval == MON_BULLGATES)
621                         info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
622                 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
623                         info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
624                 else
625                         info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
626         }
627         
628         /* Hack -- describe lite's */
629         
630         if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
631         
632         rad = 0;
633         if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 1;
634         if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 2;
635         if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 3;
636         if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
637         if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
638         if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
639         
640         if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
641                 
642         if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
643         {
644                 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);   
645         }
646         else
647         {
648                 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
649                 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
650         }
651         
652         if(rad != 0) info[i++] = desc;
653
654         
655         if (o_ptr->name2 == EGO_LITE_LONG)
656         {
657                 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
658         }
659
660         /* And then describe it fully */
661
662         if (have_flag(flgs, TR_RIDING))
663         {
664                 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
665                         info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
666                 else
667                 {
668                         info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
669                         /* This information is not important enough */
670                         trivial_info++;
671                 }
672         }
673         if (have_flag(flgs, TR_STR))
674         {
675                 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
676         }
677         if (have_flag(flgs, TR_INT))
678         {
679                 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
680         }
681         if (have_flag(flgs, TR_WIS))
682         {
683                 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
684         }
685         if (have_flag(flgs, TR_DEX))
686         {
687                 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
688         }
689         if (have_flag(flgs, TR_CON))
690         {
691                 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
692         }
693         if (have_flag(flgs, TR_CHR))
694         {
695                 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
696         }
697
698         if (have_flag(flgs, TR_MAGIC_MASTERY))
699         {
700                 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
701
702         }
703         if (have_flag(flgs, TR_STEALTH))
704         {
705                 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
706         }
707         if (have_flag(flgs, TR_SEARCH))
708         {
709                 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
710         }
711         if (have_flag(flgs, TR_INFRA))
712         {
713                 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
714         }
715         if (have_flag(flgs, TR_TUNNEL))
716         {
717                 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
718         }
719         if (have_flag(flgs, TR_SPEED))
720         {
721                 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
722         }
723         if (have_flag(flgs, TR_BLOWS))
724         {
725                 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
726         }
727
728         if (have_flag(flgs, TR_BRAND_ACID))
729         {
730                 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
731         }
732         if (have_flag(flgs, TR_BRAND_ELEC))
733         {
734                 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
735         }
736         if (have_flag(flgs, TR_BRAND_FIRE))
737         {
738                 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
739         }
740         if (have_flag(flgs, TR_BRAND_COLD))
741         {
742                 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
743         }
744
745         if (have_flag(flgs, TR_BRAND_POIS))
746         {
747                 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
748         }
749
750         if (have_flag(flgs, TR_CHAOTIC))
751         {
752                 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
753         }
754
755         if (have_flag(flgs, TR_VAMPIRIC))
756         {
757                 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
758         }
759
760         if (have_flag(flgs, TR_IMPACT))
761         {
762                 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
763         }
764
765         if (have_flag(flgs, TR_VORPAL))
766         {
767                 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
768         }
769
770         if (have_flag(flgs, TR_KILL_DRAGON))
771         {
772                 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
773         }
774         else if (have_flag(flgs, TR_SLAY_DRAGON))
775         {
776                 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
777         }
778
779         if (have_flag(flgs, TR_KILL_ORC))
780         {
781                 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
782         }
783         if (have_flag(flgs, TR_SLAY_ORC))
784         {
785                 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
786         }
787
788         if (have_flag(flgs, TR_KILL_TROLL))
789         {
790                 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
791         }
792         if (have_flag(flgs, TR_SLAY_TROLL))
793         {
794                 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
795         }
796
797         if (have_flag(flgs, TR_KILL_GIANT))
798         {
799                 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
800         }
801         else if (have_flag(flgs, TR_SLAY_GIANT))
802         {
803                 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
804         }
805
806         if (have_flag(flgs, TR_KILL_DEMON))
807         {
808                 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
809         }
810         if (have_flag(flgs, TR_SLAY_DEMON))
811         {
812                 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
813         }
814
815         if (have_flag(flgs, TR_KILL_UNDEAD))
816         {
817                 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
818         }
819         if (have_flag(flgs, TR_SLAY_UNDEAD))
820         {
821                 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
822         }
823
824         if (have_flag(flgs, TR_KILL_EVIL))
825         {
826                 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
827         }
828         if (have_flag(flgs, TR_SLAY_EVIL))
829         {
830                 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
831         }
832
833         if (have_flag(flgs, TR_KILL_ANIMAL))
834         {
835                 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
836         }
837         if (have_flag(flgs, TR_SLAY_ANIMAL))
838         {
839                 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
840         }
841
842         if (have_flag(flgs, TR_KILL_HUMAN))
843         {
844                 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
845         }
846         if (have_flag(flgs, TR_SLAY_HUMAN))
847         {
848                 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
849         }
850
851         if (have_flag(flgs, TR_FORCE_WEAPON))
852         {
853                 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
854         }
855         if (have_flag(flgs, TR_DEC_MANA))
856         {
857                 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
858         }
859         if (have_flag(flgs, TR_SUST_STR))
860         {
861                 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
862         }
863         if (have_flag(flgs, TR_SUST_INT))
864         {
865                 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
866         }
867         if (have_flag(flgs, TR_SUST_WIS))
868         {
869                 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
870         }
871         if (have_flag(flgs, TR_SUST_DEX))
872         {
873                 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
874         }
875         if (have_flag(flgs, TR_SUST_CON))
876         {
877                 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
878         }
879         if (have_flag(flgs, TR_SUST_CHR))
880         {
881                 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
882         }
883
884         if (have_flag(flgs, TR_IM_ACID))
885         {
886                 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
887         }
888         if (have_flag(flgs, TR_IM_ELEC))
889         {
890                 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
891         }
892         if (have_flag(flgs, TR_IM_FIRE))
893         {
894                 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
895         }
896         if (have_flag(flgs, TR_IM_COLD))
897         {
898                 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
899         }
900
901         if (have_flag(flgs, TR_THROW))
902         {
903                 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
904         }
905
906         if (have_flag(flgs, TR_FREE_ACT))
907         {
908                 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
909         }
910         if (have_flag(flgs, TR_HOLD_EXP))
911         {
912                 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
913         }
914         if (have_flag(flgs, TR_RES_FEAR))
915         {
916                 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
917         }
918         if (have_flag(flgs, TR_RES_ACID))
919         {
920                 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
921         }
922         if (have_flag(flgs, TR_RES_ELEC))
923         {
924                 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
925         }
926         if (have_flag(flgs, TR_RES_FIRE))
927         {
928                 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
929         }
930         if (have_flag(flgs, TR_RES_COLD))
931         {
932                 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
933         }
934         if (have_flag(flgs, TR_RES_POIS))
935         {
936                 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
937         }
938
939         if (have_flag(flgs, TR_RES_LITE))
940         {
941                 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
942         }
943         if (have_flag(flgs, TR_RES_DARK))
944         {
945                 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
946         }
947
948         if (have_flag(flgs, TR_RES_BLIND))
949         {
950                 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
951         }
952         if (have_flag(flgs, TR_RES_CONF))
953         {
954                 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
955         }
956         if (have_flag(flgs, TR_RES_SOUND))
957         {
958                 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
959         }
960         if (have_flag(flgs, TR_RES_SHARDS))
961         {
962                 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
963         }
964
965         if (have_flag(flgs, TR_RES_NETHER))
966         {
967                 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
968         }
969         if (have_flag(flgs, TR_RES_NEXUS))
970         {
971                 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
972         }
973         if (have_flag(flgs, TR_RES_CHAOS))
974         {
975                 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
976         }
977         if (have_flag(flgs, TR_RES_DISEN))
978         {
979                 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
980         }
981
982         if (have_flag(flgs, TR_LEVITATION))
983         {
984                 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
985         }
986                 
987         if (have_flag(flgs, TR_SEE_INVIS))
988         {
989                 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
990         }
991         if (have_flag(flgs, TR_TELEPATHY))
992         {
993                 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
994         }
995         if (have_flag(flgs, TR_ESP_ANIMAL))
996         {
997                 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
998         }
999         if (have_flag(flgs, TR_ESP_UNDEAD))
1000         {
1001                 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
1002         }
1003         if (have_flag(flgs, TR_ESP_DEMON))
1004         {
1005                 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
1006         }
1007         if (have_flag(flgs, TR_ESP_ORC))
1008         {
1009                 info[i++] = _("それはオークを感知する。", "It senses orcs.");
1010         }
1011         if (have_flag(flgs, TR_ESP_TROLL))
1012         {
1013                 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1014         }
1015         if (have_flag(flgs, TR_ESP_GIANT))
1016         {
1017                 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1018         }
1019         if (have_flag(flgs, TR_ESP_DRAGON))
1020         {
1021                 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1022         }
1023         if (have_flag(flgs, TR_ESP_HUMAN))
1024         {
1025                 info[i++] = _("それは人間を感知する。", "It senses humans.");
1026         }
1027         if (have_flag(flgs, TR_ESP_EVIL))
1028         {
1029                 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1030         }
1031         if (have_flag(flgs, TR_ESP_GOOD))
1032         {
1033                 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1034         }
1035         if (have_flag(flgs, TR_ESP_NONLIVING))
1036         {
1037                 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1038         }
1039         if (have_flag(flgs, TR_ESP_UNIQUE))
1040         {
1041                 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1042         }
1043         if (have_flag(flgs, TR_SLOW_DIGEST))
1044         {
1045                 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1046         }
1047         if (have_flag(flgs, TR_REGEN))
1048         {
1049                 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1050         }
1051         if (have_flag(flgs, TR_WARNING))
1052         {
1053                 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1054         }
1055         if (have_flag(flgs, TR_REFLECT))
1056         {
1057                 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1058         }
1059         if (have_flag(flgs, TR_SH_FIRE))
1060         {
1061                 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1062         }
1063         if (have_flag(flgs, TR_SH_ELEC))
1064         {
1065                 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1066         }
1067         if (have_flag(flgs, TR_SH_COLD))
1068         {
1069                 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1070         }
1071         if (have_flag(flgs, TR_NO_MAGIC))
1072         {
1073                 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1074         }
1075         if (have_flag(flgs, TR_NO_TELE))
1076         {
1077                 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1078         }
1079         if (have_flag(flgs, TR_XTRA_MIGHT))
1080         {
1081                 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1082         }
1083         if (have_flag(flgs, TR_XTRA_SHOTS))
1084         {
1085                 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1086         }
1087
1088         if (have_flag(flgs, TR_BLESSED))
1089         {
1090                 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1091         }
1092
1093         if (object_is_cursed(o_ptr))
1094         {
1095                 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1096                 {
1097                         info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1098                 }
1099                 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1100                 {
1101                         info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1102                 }
1103                 else
1104                 {
1105                         info[i++] = _("それは呪われている。", "It is cursed.");
1106
1107                         /*
1108                          * It's a trivial infomation since there is
1109                          * fake inscription {cursed}
1110                          */
1111                         trivial_info++;
1112                 }
1113         }
1114
1115         if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1116         {
1117                 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1118         }
1119         if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1120         {
1121                 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1122         }
1123         if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1124         {
1125                 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1126         }
1127         if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1128         {
1129                 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1130         }
1131         if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1132         {
1133                 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1134         }
1135         if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1136         {
1137                 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1138         }
1139         if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1140         {
1141                 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1142         }
1143         if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1144         {
1145                 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1146         }
1147         if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1148         {
1149                 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1150         }
1151         if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1152         {
1153                 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1154         }
1155         if ((have_flag(flgs, TR_COWARDICE)) ||  (o_ptr->curse_flags & TRC_COWARDICE))
1156         {
1157                 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1158         }
1159         if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1160         {
1161                 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1162         }
1163         if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1164         {
1165                 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1166         }
1167         if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1168         {
1169                 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1170         }
1171         if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1172         {
1173                 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1174         }
1175         if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1176         {
1177                 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1178         }
1179         if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1180         {
1181                 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1182         }
1183         if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1184         {
1185                 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1186         }
1187
1188         /* Describe about this kind of object instead of THIS fake object */
1189         if (mode & SCROBJ_FAKE_OBJECT)
1190         {
1191                 switch (o_ptr->tval)
1192                 {
1193                 case TV_RING:
1194                         switch (o_ptr->sval)
1195                         {
1196                         case SV_RING_LORDLY:
1197                                 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1198                                 break;
1199                         case SV_RING_WARNING:
1200                                 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1201                                 break;
1202                         }
1203                         break;
1204
1205                 case TV_AMULET:
1206                         switch (o_ptr->sval)
1207                         {
1208                         case SV_AMULET_RESISTANCE:
1209                                 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1210                                 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1211                                 break;
1212                         case SV_AMULET_THE_MAGI:
1213                                 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1214                                 break;
1215                         }
1216                         break;
1217                 }
1218         }
1219
1220         if (have_flag(flgs, TR_IGNORE_ACID) &&
1221             have_flag(flgs, TR_IGNORE_ELEC) &&
1222             have_flag(flgs, TR_IGNORE_FIRE) &&
1223             have_flag(flgs, TR_IGNORE_COLD))
1224         {
1225                 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1226         }
1227         else
1228         {
1229                 if (have_flag(flgs, TR_IGNORE_ACID))
1230                 {
1231                         info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1232                 }
1233                 if (have_flag(flgs, TR_IGNORE_ELEC))
1234                 {
1235                         info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1236                 }
1237                 if (have_flag(flgs, TR_IGNORE_FIRE))
1238                 {
1239                         info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1240                 }
1241                 if (have_flag(flgs, TR_IGNORE_COLD))
1242                 {
1243                         info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1244                 }
1245         }
1246
1247         if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1248
1249         /* No relevant informations */
1250         if (i <= trivial_info) return (FALSE);
1251         screen_save();
1252
1253         Term_get_size(&wid, &hgt);
1254
1255         /* Display Item name */
1256         if (!(mode & SCROBJ_FAKE_OBJECT))
1257                 object_desc(o_name, o_ptr, 0);
1258         else
1259                 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1260
1261         prt(o_name, 0, 0);
1262
1263         /* Erase the screen */
1264         for (k = 1; k < hgt; k++) prt("", k, 13);
1265
1266         /* Label the information */
1267         if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1268         {
1269                 monster_race *r_ptr = &r_info[o_ptr->pval];
1270                 int namelen = strlen(r_name + r_ptr->name);
1271                 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1272                 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1273                 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1274         }
1275         else
1276         {
1277                 prt(_("     アイテムの能力:", "     Item Attributes:"), 1, 15);
1278         }
1279
1280         /* We will print on top of the map (column 13) */
1281         for (k = 2, j = 0; j < i; j++)
1282         {
1283                 /* Show the info */
1284                 prt(info[j], k++, 15);
1285
1286                 /* Every 20 entries (lines 2 to 21), start over */
1287                 if ((k == hgt - 2) && (j+1 < i))
1288                 {
1289                         prt(_("-- 続く --", "-- more --"), k, 15);
1290                         inkey();
1291                         for (; k > 2; k--) prt("", k, 15);
1292                 }
1293         }
1294
1295         /* Wait for it */
1296         prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1297
1298         inkey();
1299         screen_load();
1300
1301         /* Gave knowledge */
1302         return (TRUE);
1303 }
1304
1305
1306
1307 /*!
1308  * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1309  * Convert an p_ptr->inventory_list index into a one character label
1310  * @param i プレイヤーの所持/装備オブジェクトID
1311  * @return 対応するアルファベット
1312  * @details Note that the label does NOT distinguish inven/equip.
1313  */
1314 char index_to_label(int i)
1315 {
1316         /* Indexes for "inven" are easy */
1317         if (i < INVEN_RARM) return (I2A(i));
1318
1319         /* Indexes for "equip" are offset */
1320         return (I2A(i - INVEN_RARM));
1321 }
1322
1323 /*!
1324  * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1325  * Convert a label into the index of an item in the "inven"
1326  * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1327  * @details Note that the label does NOT distinguish inven/equip.
1328  */
1329 INVENTORY_IDX label_to_inven(int c)
1330 {
1331         INVENTORY_IDX i;
1332
1333         /* Convert */
1334         i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1335
1336         /* Verify the index */
1337         if ((i < 0) || (i > INVEN_PACK)) return (-1);
1338
1339         /* Empty slots can never be chosen */
1340         if (!p_ptr->inventory_list[i].k_idx) return (-1);
1341
1342         /* Return the index */
1343         return (i);
1344 }
1345
1346 /*!
1347  * @brief オブジェクトの該当装備部位IDを返す /
1348  * Determine which equipment slot (if any) an item likes
1349  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1350  * @return 対応する装備部位ID
1351  */
1352 s16b wield_slot(object_type *o_ptr)
1353 {
1354         /* Slot for equipment */
1355         switch (o_ptr->tval)
1356         {
1357                 case TV_DIGGING:
1358                 case TV_HAFTED:
1359                 case TV_POLEARM:
1360                 case TV_SWORD:
1361                 {
1362                         if (!p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_RARM);
1363                         if (p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_RARM);
1364                         return (INVEN_LARM);
1365                 }
1366
1367                 case TV_CAPTURE:
1368                 case TV_CARD:
1369                 case TV_SHIELD:
1370                 {
1371                         if (!p_ptr->inventory_list[INVEN_LARM].k_idx) return (INVEN_LARM);
1372                         if (p_ptr->inventory_list[INVEN_RARM].k_idx) return (INVEN_LARM);
1373                         return (INVEN_RARM);
1374                 }
1375
1376                 case TV_BOW:
1377                 {
1378                         return (INVEN_BOW);
1379                 }
1380
1381                 case TV_RING:
1382                 {
1383                         /* Use the right hand first */
1384                         if (!p_ptr->inventory_list[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1385
1386                         /* Use the left hand for swapping (by default) */
1387                         return (INVEN_LEFT);
1388                 }
1389
1390                 case TV_AMULET:
1391                 case TV_WHISTLE:
1392                 {
1393                         return (INVEN_NECK);
1394                 }
1395
1396                 case TV_LITE:
1397                 {
1398                         return (INVEN_LITE);
1399                 }
1400
1401                 case TV_DRAG_ARMOR:
1402                 case TV_HARD_ARMOR:
1403                 case TV_SOFT_ARMOR:
1404                 {
1405                         return (INVEN_BODY);
1406                 }
1407
1408                 case TV_CLOAK:
1409                 {
1410                         return (INVEN_OUTER);
1411                 }
1412
1413                 case TV_CROWN:
1414                 case TV_HELM:
1415                 {
1416                         return (INVEN_HEAD);
1417                 }
1418
1419                 case TV_GLOVES:
1420                 {
1421                         return (INVEN_HANDS);
1422                 }
1423
1424                 case TV_BOOTS:
1425                 {
1426                         return (INVEN_FEET);
1427                 }
1428         }
1429
1430         /* No slot available */
1431         return (-1);
1432 }
1433
1434 /*!
1435  * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1436  * Hack: Check if a spellbook is one of the realms we can use. -- TY
1437  * @param book_tval ベースアイテムのtval
1438  * @param book_sval ベースアイテムのsval
1439  * @return 使用可能な魔法書ならばTRUEを返す。
1440  */
1441
1442 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1443 {
1444         if (book_tval < TV_LIFE_BOOK) return FALSE;
1445         if (p_ptr->pclass == CLASS_SORCERER)
1446         {
1447                 return is_magic(tval2realm(book_tval));
1448         }
1449         else if (p_ptr->pclass == CLASS_RED_MAGE)
1450         {
1451                 if (is_magic(tval2realm(book_tval)))
1452                         return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1453         }
1454         return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1455 }
1456
1457 /*
1458  * Here is a "hook" used during calls to "get_item()" and
1459  * "show_inven()" and "show_equip()", and the choice window routines.
1460  */
1461 bool(*item_tester_hook)(object_type*);
1462
1463 /*
1464  * Here is a "pseudo-hook" used during calls to "get_item()" and
1465  * "show_inven()" and "show_equip()", and the choice window routines.
1466  */
1467 OBJECT_TYPE_VALUE item_tester_tval;
1468
1469 /*!
1470  * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1471  * Check an item against the item tester info
1472  * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1473  * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1474  */
1475 bool item_tester_okay(object_type *o_ptr, OBJECT_TYPE_VALUE tval)
1476 {
1477         /* Hack -- allow listing empty slots */
1478         // if (item_tester_full) return (TRUE); // TODO:DELETE
1479
1480         /* Require an item */
1481         if (!o_ptr->k_idx) return (FALSE);
1482
1483         /* Hack -- ignore "gold" */
1484         if (o_ptr->tval == TV_GOLD)
1485         {
1486                 /* See xtra2.c */
1487                 extern bool show_gold_on_floor;
1488
1489                 if (!show_gold_on_floor) return (FALSE);
1490         }
1491
1492         /* Check the tval */
1493         if (tval)
1494         {
1495                 /* Is it a spellbook? If so, we need a hack -- TY */
1496                 if ((tval <= TV_DEATH_BOOK) && (tval >= TV_LIFE_BOOK))
1497                         return check_book_realm(o_ptr->tval, o_ptr->sval);
1498                 else
1499                         if (tval != o_ptr->tval) return (FALSE);
1500         }
1501
1502         /* Check the hook */
1503         if (item_tester_hook)
1504         {
1505                 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1506         }
1507
1508         /* Assume okay */
1509         return (TRUE);
1510 }
1511
1512 /*!
1513  * @brief 矢弾を射撃した場合の破損確率を返す /
1514  * Determines the odds of an object breaking when thrown at a monster
1515  * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
1516  * @return 破損確率(%)
1517  * @details
1518  * Note that artifacts never break, see the "drop_near()" function.
1519  */
1520 PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
1521 {
1522         PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
1523
1524         /* Examine the snipe type */
1525         if (snipe_type)
1526         {
1527                 if (snipe_type == SP_KILL_WALL) return (100);
1528                 if (snipe_type == SP_EXPLODE) return (100);
1529                 if (snipe_type == SP_PIERCE) return (100);
1530                 if (snipe_type == SP_FINAL) return (100);
1531                 if (snipe_type == SP_NEEDLE) return (100);
1532                 if (snipe_type == SP_EVILNESS) return (40);
1533                 if (snipe_type == SP_HOLYNESS) return (40);
1534         }
1535
1536         /* Examine the item type */
1537         switch (o_ptr->tval)
1538         {
1539                 /* Always break */
1540         case TV_FLASK:
1541         case TV_POTION:
1542         case TV_BOTTLE:
1543         case TV_FOOD:
1544         case TV_JUNK:
1545                 return (100);
1546
1547                 /* Often break */
1548         case TV_LITE:
1549         case TV_SCROLL:
1550         case TV_SKELETON:
1551                 return (50);
1552
1553                 /* Sometimes break */
1554         case TV_WAND:
1555         case TV_SPIKE:
1556                 return (25);
1557         case TV_ARROW:
1558                 return (20 - archer_bonus * 2);
1559
1560                 /* Rarely break */
1561         case TV_SHOT:
1562         case TV_BOLT:
1563                 return (10 - archer_bonus);
1564         default:
1565                 return (10);
1566         }
1567 }