2 * @file object-flavor.c
3 * @brief オブジェクトの記述処理 / Mbject flavor code
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\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
16 #include "cmd-smith.h"
18 #include "player-status.h"
19 #include "player-class.h"
21 #include "objectkind.h"
22 #include "object-hook.h"
23 #include "object-flavor.h"
28 #include "monsterrace.h"
29 #include "object-ego.h"
33 * @brief アイテムの価値記述テーブル
35 const concptr game_inscriptions[] =
39 "壊れている", /* FEEL_BROKEN */
40 "恐ろしい", /* FEEL_TERRIBLE */
41 "無価値", /* FEEL_WORTHLESS */
42 "呪われている", /* FEEL_CURSED */
43 "上質以上", /* FEEL_UNCURSED */
44 "並", /* FEEL_AVERAGE */
46 "高級品", /* FEEL_EXCELLENT */
47 "特別製", /* FEEL_SPECIAL */
49 "broken", /* FEEL_BROKEN */
50 "terrible", /* FEEL_TERRIBLE */
51 "worthless", /* FEEL_WORTHLESS */
52 "cursed", /* FEEL_CURSED */
53 "uncursed", /* FEEL_UNCURSED */
54 "average", /* FEEL_AVERAGE */
55 "good", /* FEEL_GOOD */
56 "excellent", /* FEEL_EXCELLENT */
57 "special", /* FEEL_SPECIAL */
64 * @brief 最初から簡易な名称が明らかになるベースアイテムの判定。 / Certain items, if aware, are known instantly
66 * @return 簡易名称を明らかにするならTRUEを返す。
68 * This function is used only by "flavor_init()"
70 static bool object_easy_know(int i)
72 object_kind *k_ptr = &k_info[i];
74 /* Analyze the "tval" */
89 case TV_HISSATSU_BOOK:
106 /* All Food, Potions, Scrolls, Rods */
120 * @brief 各種語彙からランダムな名前を作成する / Create a name from random parts.
121 * @param out_string 作成した名を保管する参照ポインタ
123 * @details 日本語の場合 aname_j.txt 英語の場合確率に応じて
124 * syllables 配列と elvish.txt を組み合わせる。\n
126 void get_table_name_aux(char *out_string)
130 get_rnd_line("aname_j.txt", 1, Syllable);
131 strcpy(out_string, Syllable);
132 get_rnd_line("aname_j.txt", 2, Syllable);
133 strcat(out_string, Syllable);
135 #define MAX_SYLLABLES 164 /* Used with scrolls (see below) */
137 static concptr syllables[MAX_SYLLABLES] = {
138 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
139 "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
140 "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
141 "byt", "comp", "con", "cos", "cre", "dalf", "dan",
142 "den", "der", "doe", "dok", "eep", "el", "eng", "er", "ere", "erk",
143 "esh", "evs", "fa", "fid", "flit", "for", "fri", "fu", "gan",
144 "gar", "glen", "gop", "gre", "ha", "he", "hyd", "i",
145 "ing", "ion", "ip", "ish", "it", "ite", "iv", "jo",
146 "kho", "kli", "klis", "la", "lech", "man", "mar",
147 "me", "mi", "mic", "mik", "mon", "mung", "mur", "nag", "nej",
148 "nelg", "nep", "ner", "nes", "nis", "nih", "nin", "o",
149 "od", "ood", "org", "orn", "ox", "oxy", "pay", "pet",
150 "ple", "plu", "po", "pot", "prok", "re", "rea", "rhov",
151 "ri", "ro", "rog", "rok", "rol", "sa", "san", "sat",
152 "see", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
153 "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab",
154 "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
155 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly",
156 "vom", "wah", "wed", "werg", "wex", "whon", "wun", "x",
157 "yerg", "yp", "zun", "tri", "blaa", "jah", "bul", "on",
161 int testcounter = randint1(3) + 1;
163 strcpy(out_string, "");
165 if (randint1(3) == 2)
167 while (testcounter--)
168 strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
173 testcounter = randint1(2) + 1;
174 while (testcounter--)
176 (void)get_rnd_line("elvish.txt", 0, Syllable);
177 strcat(out_string, Syllable);
181 out_string[0] = toupper(out_string[1]);
183 out_string[16] = '\0';
188 * @brief ランダムな名前をアーティファクト銘として整形する。 / Create a name from random parts with quotes.
189 * @param out_string 作成した名を保管する参照ポインタ
191 * @details get_table_name_aux()ほぼ完全に実装を依存している。
193 void get_table_name(char *out_string)
196 get_table_name_aux(buff);
197 sprintf(out_string, _("『%s』", "'%s'"), buff);
201 * @brief ランダムなシンダリン銘を作成する / Make random Sindarin name
202 * @param out_string 作成した名を保管する参照ポインタ
204 * @details sname.txtが語幹の辞書となっている。
206 void get_table_sindarin_aux(char *out_string)
213 get_rnd_line("sname.txt", 1, Syllable);
215 strcpy(tmp, Syllable);
217 strcpy(out_string, Syllable);
220 get_rnd_line("sname.txt", 2, Syllable);
222 strcat(tmp, Syllable);
223 sindarin_to_kana(out_string, tmp);
225 strcat(out_string, Syllable);
230 * @brief シンダリン銘をアーティファクト用に整形する。 / Make random Sindarin name with quotes
231 * @param out_string 作成した名を保管する参照ポインタ
233 * @details get_table_sindarin_aux()ほぼ完全に実装を依存している。
235 void get_table_sindarin(char *out_string)
238 get_table_sindarin_aux(buff);
239 sprintf(out_string, _("『%s』", "'%s'"), buff);
244 * @brief ベースアイテムの未確定名を共通tval間でシャッフルする / Shuffle flavor indices of a group of objects with given tval
245 * @param tval シャッフルしたいtval
247 * @details 巻物、各種魔道具などに利用される。
249 static void shuffle_flavors(OBJECT_TYPE_VALUE tval)
251 KIND_OBJECT_IDX *k_idx_list;
252 KIND_OBJECT_IDX k_idx_list_num = 0;
255 /* Allocate an array for a list of k_idx */
256 C_MAKE(k_idx_list, max_k_idx, KIND_OBJECT_IDX);
258 /* Search objects with given tval for shuffle */
259 for (i = 0; i < max_k_idx; i++)
261 object_kind *k_ptr = &k_info[i];
264 if (k_ptr->tval != tval) continue;
266 /* Paranoia -- Skip objects without flavor */
267 if (!k_ptr->flavor) continue;
269 /* Skip objects with a fixed flavor name */
270 if (have_flag(k_ptr->flags, TR_FIXED_FLAVOR)) continue;
273 k_idx_list[k_idx_list_num] = i;
275 /* Increase number of remembered indices */
279 /* Shuffle flavors */
280 for (i = 0; i < k_idx_list_num; i++)
282 object_kind *k1_ptr = &k_info[k_idx_list[i]];
283 object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
285 /* Swap flavors of this pair */
286 s16b tmp = k1_ptr->flavor;
287 k1_ptr->flavor = k2_ptr->flavor;
288 k2_ptr->flavor = tmp;
291 /* Free an array for a list of k_idx */
292 C_KILL(k_idx_list, max_k_idx, s16b);
296 * @brief ゲーム開始時に行われるベースアイテムの初期化ルーチン / Prepare the "variable" part of the "k_info" array.
299 * Prepare the "variable" part of the "k_info" array.\n
301 * The "color"/"metal"/"type" of an item is its "flavor".\n
302 * For the most part, flavors are assigned randomly each game.\n
304 * Initialize descriptions for the "colored" objects, including:\n
305 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.\n
307 * The first 4 entries for potions are fixed (Water, Apple Juice,\n
308 * Slime Mold Juice, Unused Potion).\n
310 * Scroll titles are always between 6 and 14 letters long. This is\n
311 * ensured because every title is composed of whole words, where every\n
312 * word is from 1 to 8 letters long (one or two syllables of 1 to 4\n
313 * letters each), and that no scroll is finished until it attempts to\n
314 * grow beyond 15 letters. The first time this can happen is when the\n
315 * current title has 6 letters and the new word has 8 letters, which\n
316 * would result in a 6 letter scroll title.\n
318 * Duplicate titles are avoided by requiring that no two scrolls share\n
319 * the same first four letters (not the most efficient method, and not\n
320 * the least efficient method, but it will always work).\n
322 * Hack -- make sure everything stays the same for each saved game\n
323 * This is accomplished by the use of a saved "random seed", as in\n
324 * "town_gen()". Since no other functions are called while the special\n
325 * seed is in effect, so this function is pretty "safe".\n
327 * Note that the "hacked seed" may provide an RNG with alternating parity!\n
329 void flavor_init(void)
332 u32b state_backup[4];
334 /* Hack -- Backup the RNG state */
335 Rand_state_backup(state_backup);
337 /* Hack -- Induce consistant flavors */
338 Rand_state_set(current_world_ptr->seed_flavor);
341 /* Initialize flavor index of each object by itself */
342 for (i = 0; i < max_k_idx; i++)
344 object_kind *k_ptr = &k_info[i];
346 /* Skip objects without flavor name */
347 if (!k_ptr->flavor_name) continue;
350 * Initialize flavor index to itself
351 * -> Shuffle it later
357 shuffle_flavors(TV_RING);
359 /* Shuffle Amulets */
360 shuffle_flavors(TV_AMULET);
363 shuffle_flavors(TV_STAFF);
366 shuffle_flavors(TV_WAND);
369 shuffle_flavors(TV_ROD);
371 /* Shuffle Mushrooms */
372 shuffle_flavors(TV_FOOD);
374 /* Shuffle Potions */
375 shuffle_flavors(TV_POTION);
377 /* Shuffle Scrolls */
378 shuffle_flavors(TV_SCROLL);
381 /* Hack -- Restore the RNG state */
382 Rand_state_restore(state_backup);
384 /* Analyze every object */
385 for (i = 1; i < max_k_idx; i++)
387 object_kind *k_ptr = &k_info[i];
389 /* Skip "empty" objects */
390 if (!k_ptr->name) continue;
392 /* No flavor yields aware */
393 if (!k_ptr->flavor) k_ptr->aware = TRUE;
395 /* Check for "easily known" */
396 k_ptr->easy_know = object_easy_know(i);
402 * @brief 対象文字配列に一文字だけをコピーする。
403 * @param t 保管先文字列ポインタ
407 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),\n
408 * and return a pointer to the terminator (t + 1).\n
410 static char *object_desc_chr(char *t, char c)
421 * @brief 対象文字配列に文字列をコピーする。
422 * @param t 保管先文字列ポインタ
423 * @param s コピーしたい文字列ポインタ
426 * Print a string "s" into a string "t", as if by strcpy(t, s),
427 * and return a pointer to the terminator.
429 static char *object_desc_str(char *t, concptr s)
431 /* Copy the string */
432 while (*s) *t++ = *s++;
440 * @brief 対象文字配列に符号なし整数値をコピーする。
441 * @param t 保管先文字列ポインタ
445 * Print an unsigned number "n" into a string "t", as if by
446 * sprintf(t, "%u", n), and return a pointer to the terminator.
448 static char *object_desc_num(char *t, uint n)
452 /* Find "size" of "n" */
453 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
455 /* Dump each digit */
461 /* Remove the digit */
464 /* Process next digit */
478 * @brief 日本語の個数表示ルーチン
479 * @param t 保管先文字列ポインタ
480 * @param o_ptr 記述したいオブジェクトの構造体参照ポインタ
483 * cmd1.c で流用するために object_desc_japanese から移動した。
485 char *object_desc_kosuu(char *t, object_type *o_ptr)
487 t = object_desc_num(t, o_ptr->number);
499 t = object_desc_str(t, "本");
504 t = object_desc_str(t, "巻");
509 t = object_desc_str(t, "服");
513 case TV_SORCERY_BOOK:
521 case TV_CRUSADE_BOOK:
523 case TV_HISSATSU_BOOK:
526 t = object_desc_str(t, "冊");
534 t = object_desc_str(t, "着");
541 t = object_desc_str(t, "振");
546 t = object_desc_str(t, "足");
551 t = object_desc_str(t, "枚");
557 if (o_ptr->sval == SV_FOOD_JERKY)
559 t = object_desc_str(t, "切れ");
565 if (o_ptr->number < 10)
567 t = object_desc_str(t, "つ");
571 t = object_desc_str(t, "個");
581 * @brief 対象文字配列に符号あり整数値をコピーする。
582 * @param t 保管先文字列ポインタ
586 * Print an signed number "v" into a string "t", as if by
587 * sprintf(t, "%+d", n), and return a pointer to the terminator.
588 * Note that we always print a sign, either "+" or "-".
590 static char *object_desc_int(char *t, sint v)
597 /* Take the absolute value */
600 /* Use a "minus" sign */
604 /* Positive (or zero) */
607 /* Use the actual number */
610 /* Use a "plus" sign */
614 /* Find "size" of "n" */
615 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
617 /* Dump each digit */
623 /* Remove the digit */
626 /* Process next digit */
637 * オブジェクトの特性表示記号テーブルの構造体 / Structs and tables for Auto Inscription for flags
639 typedef struct flag_insc_table
650 /*! オブジェクトの特性表示記号テーブルの定義(pval要素) */
651 static flag_insc_table flag_insc_plus[] =
653 { "攻", "At", TR_BLOWS, -1 },
654 { "速", "Sp", TR_SPEED, -1 },
655 { "腕", "St", TR_STR, -1 },
656 { "知", "In", TR_INT, -1 },
657 { "賢", "Wi", TR_WIS, -1 },
658 { "器", "Dx", TR_DEX, -1 },
659 { "耐", "Cn", TR_CON, -1 },
660 { "魅", "Ch", TR_CHR, -1 },
661 { "道", "Md", TR_MAGIC_MASTERY, -1 },
662 { "隠", "Sl", TR_STEALTH, -1 },
663 { "探", "Sr", TR_SEARCH, -1 },
664 { "赤", "If", TR_INFRA, -1 },
665 { "掘", "Dg", TR_TUNNEL, -1 },
666 { NULL, NULL, 0, -1 }
669 /*! オブジェクトの特性表示記号テーブルの定義(免疫) */
670 static flag_insc_table flag_insc_immune[] =
672 { "酸", "Ac", TR_IM_ACID, -1 },
673 { "電", "El", TR_IM_ELEC, -1 },
674 { "火", "Fi", TR_IM_FIRE, -1 },
675 { "冷", "Co", TR_IM_COLD, -1 },
676 { NULL, NULL, 0, -1 }
679 /*! オブジェクトの特性表示記号テーブルの定義(耐性) */
680 static flag_insc_table flag_insc_resistance[] =
682 { "酸", "Ac", TR_RES_ACID, TR_IM_ACID },
683 { "電", "El", TR_RES_ELEC, TR_IM_ELEC },
684 { "火", "Fi", TR_RES_FIRE, TR_IM_FIRE },
685 { "冷", "Co", TR_RES_COLD, TR_IM_COLD },
686 { "毒", "Po", TR_RES_POIS, -1 },
687 { "閃", "Li", TR_RES_LITE, -1 },
688 { "暗", "Dk", TR_RES_DARK, -1 },
689 { "破", "Sh", TR_RES_SHARDS, -1 },
690 { "盲", "Bl", TR_RES_BLIND, -1 },
691 { "乱", "Cf", TR_RES_CONF, -1 },
692 { "轟", "So", TR_RES_SOUND, -1 },
693 { "獄", "Nt", TR_RES_NETHER, -1 },
694 { "因", "Nx", TR_RES_NEXUS, -1 },
695 { "沌", "Ca", TR_RES_CHAOS, -1 },
696 { "劣", "Di", TR_RES_DISEN, -1 },
697 { "恐", "Fe", TR_RES_FEAR, -1 },
698 { NULL, NULL, 0, -1 }
701 /*! オブジェクトの特性表示記号テーブルの定義(その他特性) */
702 static flag_insc_table flag_insc_misc[] =
704 { "易", "Es", TR_EASY_SPELL, -1 },
705 { "減", "Dm", TR_DEC_MANA, -1 },
706 { "投", "Th", TR_THROW, -1 },
707 { "反", "Rf", TR_REFLECT, -1 },
708 { "麻", "Fa", TR_FREE_ACT, -1 },
709 { "視", "Si", TR_SEE_INVIS, -1 },
710 { "経", "Hl", TR_HOLD_EXP, -1 },
711 { "遅", "Sd", TR_SLOW_DIGEST, -1 },
712 { "活", "Rg", TR_REGEN, -1 },
713 { "浮", "Lv", TR_LEVITATION, -1 },
714 { "明", "Lu", TR_LITE_1, -1 },
715 { "明", "Lu", TR_LITE_2, -1 },
716 { "明", "Lu", TR_LITE_3, -1 },
717 { "闇", "Dl", TR_LITE_M1, -1 },
718 { "闇", "Dl", TR_LITE_M2, -1 },
719 { "闇", "Dl", TR_LITE_M3, -1 },
720 { "警", "Wr", TR_WARNING, -1 },
721 { "倍", "Xm", TR_XTRA_MIGHT, -1 },
722 { "射", "Xs", TR_XTRA_SHOTS, -1 },
723 { "瞬", "Te", TR_TELEPORT, -1 },
724 { "怒", "Ag", TR_AGGRAVATE, -1 },
725 { "祝", "Bs", TR_BLESSED, -1 },
726 { "忌", "Ty", TR_TY_CURSE, -1 },
727 { "呪", "C-", TR_ADD_L_CURSE, -1 },
728 { "詛", "C+", TR_ADD_H_CURSE, -1 },
729 { NULL, NULL, 0, -1 }
732 /*! オブジェクトの特性表示記号テーブルの定義(オーラ) */
733 static flag_insc_table flag_insc_aura[] =
735 { "炎", "F", TR_SH_FIRE, -1 },
736 { "電", "E", TR_SH_ELEC, -1 },
737 { "冷", "C", TR_SH_COLD, -1 },
738 { "魔", "M", TR_NO_MAGIC, -1 },
739 { "瞬", "T", TR_NO_TELE, -1 },
740 { NULL, NULL, 0, -1 }
743 /*! オブジェクトの特性表示記号テーブルの定義(属性スレイ) */
744 static flag_insc_table flag_insc_brand[] =
746 { "酸", "A", TR_BRAND_ACID, -1 },
747 { "電", "E", TR_BRAND_ELEC, -1 },
748 { "焼", "F", TR_BRAND_FIRE, -1 },
749 { "凍", "Co", TR_BRAND_COLD, -1 },
750 { "毒", "P", TR_BRAND_POIS, -1 },
751 { "沌", "Ca", TR_CHAOTIC, -1 },
752 { "吸", "V", TR_VAMPIRIC, -1 },
753 { "震", "Q", TR_IMPACT, -1 },
754 { "切", "S", TR_VORPAL, -1 },
755 { "理", "M", TR_FORCE_WEAPON, -1 },
756 { NULL, NULL, 0, -1 }
759 /*! オブジェクトの特性表示記号テーブルの定義(種族スレイ) */
760 static flag_insc_table flag_insc_kill[] =
762 { "邪", "*", TR_KILL_EVIL, -1 },
763 { "人", "p", TR_KILL_HUMAN, -1 },
764 { "龍", "D", TR_KILL_DRAGON, -1 },
765 { "オ", "o", TR_KILL_ORC, -1 },
766 { "ト", "T", TR_KILL_TROLL, -1 },
767 { "巨", "P", TR_KILL_GIANT, -1 },
768 { "デ", "U", TR_KILL_DEMON, -1 },
769 { "死", "L", TR_KILL_UNDEAD, -1 },
770 { "動", "Z", TR_KILL_ANIMAL, -1 },
771 { NULL, NULL, 0, -1 }
774 /*! オブジェクトの特性表示記号テーブルの定義(種族*スレイ*) */
775 static flag_insc_table flag_insc_slay[] =
777 { "邪", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
778 { "人", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
779 { "竜", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
780 { "オ", "o", TR_SLAY_ORC, TR_KILL_ORC },
781 { "ト", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
782 { "巨", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
783 { "デ", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
784 { "死", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
785 { "動", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
786 { NULL, NULL, 0, -1 }
789 /*! オブジェクトの特性表示記号テーブルの定義(ESP1) */
790 static flag_insc_table flag_insc_esp1[] =
792 { "感", "Tele", TR_TELEPATHY, -1 },
793 { "邪", "Evil", TR_ESP_EVIL, -1 },
794 { "善", "Good", TR_ESP_GOOD, -1 },
795 { "無", "Nolv", TR_ESP_NONLIVING, -1 },
796 { "個", "Uniq", TR_ESP_UNIQUE, -1 },
797 { NULL, NULL, 0, -1 }
800 /*! オブジェクトの特性表示記号テーブルの定義(ESP2) */
801 static flag_insc_table flag_insc_esp2[] =
803 { "人", "p", TR_ESP_HUMAN, -1 },
804 { "竜", "D", TR_ESP_DRAGON, -1 },
805 { "オ", "o", TR_ESP_ORC, -1 },
806 { "ト", "T", TR_ESP_TROLL, -1 },
807 { "巨", "P", TR_ESP_GIANT, -1 },
808 { "デ", "U", TR_ESP_DEMON, -1 },
809 { "死", "L", TR_ESP_UNDEAD, -1 },
810 { "動", "Z", TR_ESP_ANIMAL, -1 },
811 { NULL, NULL, 0, -1 }
814 /*! オブジェクトの特性表示記号テーブルの定義(能力維持) */
815 static flag_insc_table flag_insc_sust[] =
817 { "腕", "St", TR_SUST_STR, -1 },
818 { "知", "In", TR_SUST_INT, -1 },
819 { "賢", "Wi", TR_SUST_WIS, -1 },
820 { "器", "Dx", TR_SUST_DEX, -1 },
821 { "耐", "Cn", TR_SUST_CON, -1 },
822 { "魅", "Ch", TR_SUST_CHR, -1 },
823 { NULL, NULL, 0, -1 }
827 static flag_insc_table flag_insc_plus[] =
829 { "At", TR_BLOWS, -1 },
830 { "Sp", TR_SPEED, -1 },
831 { "St", TR_STR, -1 },
832 { "In", TR_INT, -1 },
833 { "Wi", TR_WIS, -1 },
834 { "Dx", TR_DEX, -1 },
835 { "Cn", TR_CON, -1 },
836 { "Ch", TR_CHR, -1 },
837 { "Md", TR_MAGIC_MASTERY, -1 },
838 { "Sl", TR_STEALTH, -1 },
839 { "Sr", TR_SEARCH, -1 },
840 { "If", TR_INFRA, -1 },
841 { "Dg", TR_TUNNEL, -1 },
845 static flag_insc_table flag_insc_immune[] =
847 { "Ac", TR_IM_ACID, -1 },
848 { "El", TR_IM_ELEC, -1 },
849 { "Fi", TR_IM_FIRE, -1 },
850 { "Co", TR_IM_COLD, -1 },
854 static flag_insc_table flag_insc_resistance[] =
856 { "Ac", TR_RES_ACID, TR_IM_ACID },
857 { "El", TR_RES_ELEC, TR_IM_ELEC },
858 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
859 { "Co", TR_RES_COLD, TR_IM_COLD },
860 { "Po", TR_RES_POIS, -1 },
861 { "Li", TR_RES_LITE, -1 },
862 { "Dk", TR_RES_DARK, -1 },
863 { "Sh", TR_RES_SHARDS, -1 },
864 { "Bl", TR_RES_BLIND, -1 },
865 { "Cf", TR_RES_CONF, -1 },
866 { "So", TR_RES_SOUND, -1 },
867 { "Nt", TR_RES_NETHER, -1 },
868 { "Nx", TR_RES_NEXUS, -1 },
869 { "Ca", TR_RES_CHAOS, -1 },
870 { "Di", TR_RES_DISEN, -1 },
871 { "Fe", TR_RES_FEAR, -1 },
875 static flag_insc_table flag_insc_misc[] =
877 { "Es", TR_EASY_SPELL, -1 },
878 { "Dm", TR_DEC_MANA, -1 },
879 { "Th", TR_THROW, -1 },
880 { "Rf", TR_REFLECT, -1 },
881 { "Fa", TR_FREE_ACT, -1 },
882 { "Si", TR_SEE_INVIS, -1 },
883 { "Hl", TR_HOLD_EXP, -1 },
884 { "Sd", TR_SLOW_DIGEST, -1 },
885 { "Rg", TR_REGEN, -1 },
886 { "Lv", TR_LEVITATION, -1 },
887 { "Lu", TR_LITE_1, -1 },
888 { "Lu", TR_LITE_2, -1 },
889 { "Lu", TR_LITE_3, -1 },
890 { "Dl", TR_LITE_M1, -1 },
891 { "Dl", TR_LITE_M2, -1 },
892 { "Dl", TR_LITE_M3, -1 },
893 { "Wr", TR_WARNING, -1 },
894 { "Xm", TR_XTRA_MIGHT, -1 },
895 { "Xs", TR_XTRA_SHOTS, -1 },
896 { "Te", TR_TELEPORT, -1 },
897 { "Ag", TR_AGGRAVATE, -1 },
898 { "Bs", TR_BLESSED, -1 },
899 { "Ty", TR_TY_CURSE, -1 },
900 { "C-", TR_ADD_L_CURSE, -1 },
901 { "C+", TR_ADD_H_CURSE, -1 },
905 static flag_insc_table flag_insc_aura[] =
907 { "F", TR_SH_FIRE, -1 },
908 { "E", TR_SH_ELEC, -1 },
909 { "C", TR_SH_COLD, -1 },
910 { "M", TR_NO_MAGIC, -1 },
911 { "T", TR_NO_TELE, -1 },
915 static flag_insc_table flag_insc_brand[] =
917 { "A", TR_BRAND_ACID, -1 },
918 { "E", TR_BRAND_ELEC, -1 },
919 { "F", TR_BRAND_FIRE, -1 },
920 { "Co", TR_BRAND_COLD, -1 },
921 { "P", TR_BRAND_POIS, -1 },
922 { "Ca", TR_CHAOTIC, -1 },
923 { "V", TR_VAMPIRIC, -1 },
924 { "Q", TR_IMPACT, -1 },
925 { "S", TR_VORPAL, -1 },
926 { "M", TR_FORCE_WEAPON, -1 },
930 static flag_insc_table flag_insc_kill[] =
932 { "*", TR_KILL_EVIL, -1 },
933 { "p", TR_KILL_HUMAN, -1 },
934 { "D", TR_KILL_DRAGON, -1 },
935 { "o", TR_KILL_ORC, -1 },
936 { "T", TR_KILL_TROLL, -1 },
937 { "P", TR_KILL_GIANT, -1 },
938 { "U", TR_KILL_DEMON, -1 },
939 { "L", TR_KILL_UNDEAD, -1 },
940 { "Z", TR_KILL_ANIMAL, -1 },
944 static flag_insc_table flag_insc_slay[] =
946 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
947 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
948 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
949 { "o", TR_SLAY_ORC, TR_KILL_ORC },
950 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
951 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
952 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
953 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
954 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
958 static flag_insc_table flag_insc_esp1[] =
960 { "Tele", TR_TELEPATHY, -1 },
961 { "Evil", TR_ESP_EVIL, -1 },
962 { "Good", TR_ESP_GOOD, -1 },
963 { "Nolv", TR_ESP_NONLIVING, -1 },
964 { "Uniq", TR_ESP_UNIQUE, -1 },
968 static flag_insc_table flag_insc_esp2[] =
970 { "p", TR_ESP_HUMAN, -1 },
971 { "D", TR_ESP_DRAGON, -1 },
972 { "o", TR_ESP_ORC, -1 },
973 { "T", TR_ESP_TROLL, -1 },
974 { "P", TR_ESP_GIANT, -1 },
975 { "U", TR_ESP_DEMON, -1 },
976 { "L", TR_ESP_UNDEAD, -1 },
977 { "Z", TR_ESP_ANIMAL, -1 },
981 static flag_insc_table flag_insc_sust[] =
983 { "St", TR_SUST_STR, -1 },
984 { "In", TR_SUST_INT, -1 },
985 { "Wi", TR_SUST_WIS, -1 },
986 { "Dx", TR_SUST_DEX, -1 },
987 { "Cn", TR_SUST_CON, -1 },
988 { "Ch", TR_SUST_CHR, -1 },
993 /* オブジェクトフラグを追加するための簡易なマクロ / Simple macro for get_inscription() */
994 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
997 * @brief get_inscriptionのサブセットとしてオブジェクトの特性フラグを返す / Helper function for get_inscription()
998 * @param fi_ptr 参照する特性表示記号テーブル
999 * @param flgs 対応するオブジェクトのフラグ文字列
1000 * @param kanji TRUEならば漢字記述/FALSEならば英語記述
1001 * @param ptr フラグ群を保管する文字列参照ポインタ
1002 * @return フラグ群を保管する文字列参照ポインタ(ptrと同じ)
1004 * Print an signed number "v" into a string "t", as if by
1005 * sprintf(t, "%+d", n), and return a pointer to the terminator.
1006 * Note that we always print a sign, either "+" or "-".
1008 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
1016 while (fi_ptr->english)
1018 if (have_flag(flgs, fi_ptr->flag) &&
1019 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
1021 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
1023 ADD_INSC(fi_ptr->english);
1033 * @brief オブジェクトの特性表示記号テーブル1つに従いオブジェクトの特性フラグ配列に1つでも該当の特性があるかを返す / Special variation of have_flag for auto-inscription
1034 * @param fi_ptr 参照する特性表示記号テーブル
1035 * @param flgs 対応するオブジェクトのフラグ文字列
1036 * @return 1つでも該当の特性があったらTRUEを返す。
1038 static bool have_flag_of(flag_insc_table *fi_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
1040 while (fi_ptr->english)
1042 if (have_flag(flgs, fi_ptr->flag) &&
1043 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
1052 * @brief オブジェクト名の特性短縮表記をまとめて提示する。
1053 * @param ptr 特性短縮表記を格納する文字列ポインタ
1054 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1055 * @param kanji TRUEならば漢字表記 / FALSEなら英語表記
1056 * @param all TRUEならばベースアイテム上で明らかなフラグは省略する
1057 * @return ptrと同じアドレス
1059 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
1061 char *prev_ptr = ptr;
1062 BIT_FLAGS flgs[TR_FLAG_SIZE];
1063 object_flags(o_ptr, flgs);
1065 /* Remove obvious flags */
1068 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1072 for (j = 0; j < TR_FLAG_SIZE; j++)
1073 flgs[j] &= ~k_ptr->flags[j];
1075 if (object_is_fixed_artifact(o_ptr))
1077 artifact_type *a_ptr = &a_info[o_ptr->name1];
1079 for (j = 0; j < TR_FLAG_SIZE; j++)
1080 flgs[j] &= ~a_ptr->flags[j];
1083 if (object_is_ego(o_ptr))
1085 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1087 for (j = 0; j < TR_FLAG_SIZE; j++)
1088 flgs[j] &= ~e_ptr->flags[j];
1092 /* Remove lite flags when this is a dark lite object */
1093 if (HAVE_DARK_FLAG(flgs))
1095 if (have_flag(flgs, TR_LITE_1)) remove_flag(flgs, TR_LITE_1);
1096 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1097 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1099 else if (HAVE_LITE_FLAG(flgs))
1101 add_flag(flgs, TR_LITE_1);
1102 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1103 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1107 if (have_flag_of(flag_insc_plus, flgs))
1112 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
1115 if (have_flag_of(flag_insc_immune, flgs))
1117 if (!kanji && ptr != prev_ptr)
1124 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
1127 if (have_flag_of(flag_insc_resistance, flgs))
1131 else if (ptr != prev_ptr)
1137 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1140 if (have_flag_of(flag_insc_misc, flgs))
1142 if (ptr != prev_ptr)
1148 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1151 if (have_flag_of(flag_insc_aura, flgs))
1155 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1158 if (have_flag_of(flag_insc_brand, flgs))
1160 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1163 if (have_flag_of(flag_insc_kill, flgs))
1165 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1168 if (have_flag_of(flag_insc_slay, flgs))
1170 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1175 if (have_flag_of(flag_insc_esp1, flgs) ||
1176 have_flag_of(flag_insc_esp2, flgs))
1178 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1179 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1183 if (have_flag_of(flag_insc_esp1, flgs))
1185 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1186 if (have_flag_of(flag_insc_esp2, flgs))
1188 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1192 if (have_flag_of(flag_insc_sust, flgs))
1196 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1205 * @brief オブジェクト名の特性短縮表記+刻み内容を提示する。 / Get object inscription with auto inscription of object flags.
1206 * @param buff 特性短縮表記を格納する文字列ポインタ
1207 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1210 static void get_inscription(char *buff, object_type *o_ptr)
1212 concptr insc = quark_str(o_ptr->inscription);
1215 /* Not fully identified */
1216 if (!(o_ptr->ident & IDENT_MENTAL))
1218 /* Copy until end of line or '#' */
1221 if (*insc == '#') break;
1223 if (iskanji(*insc)) *buff++ = *insc++;
1233 for (; *insc; insc++)
1235 /* Ignore fake artifact inscription */
1236 if (*insc == '#') break;
1238 /* {%} will be automatically converted */
1239 else if ('%' == *insc)
1243 concptr start = ptr;
1245 /* check for too long inscription */
1246 if (ptr >= buff + MAX_NLEN) continue;
1259 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1269 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1284 * @brief オブジェクトの各表記を返すメイン関数 / Creates a description of the item "o_ptr", and stores it in "out_val".
1285 * @param buf 表記を返すための文字列参照ポインタ
1286 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1287 * @param mode 表記に関するオプション指定
1288 * @return 現在クエスト達成目的のアイテムならばTRUEを返す。
1290 * One can choose the "verbosity" of the description, including whether\n
1291 * or not the "number" of items should be described, and how much detail\n
1292 * should be used when describing the item.\n
1294 * The given "buf" must be MAX_NLEN chars long to hold the longest possible\n
1295 * description, which can get pretty long, including incriptions, such as:\n
1296 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".\n
1297 * Note that the inscription will be clipped to keep the total description\n
1298 * under MAX_NLEN-1 chars (plus a terminator).\n
1300 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,\n
1301 * portable, versions of some common "sprintf()" commands.\n
1303 * Note that all ego-items (when known) append an "Ego-Item Name", unless\n
1304 * the item is also an artifact, which should NEVER happen.\n
1306 * Note that all artifacts (when known) append an "Artifact Name", so we\n
1307 * have special processing for "Specials" (artifact Lites, Rings, Amulets).\n
1308 * The "Specials" never use "modifiers" if they are "known", since they\n
1309 * have special "descriptions", such as "The Necklace of the Dwarves".\n
1311 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),\n
1312 * plus the artifact name, just like any other artifact, if known.\n
1314 * Special Ring's and Amulet's, if not "aware", use the same code as normal\n
1315 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or\n
1316 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,\n
1317 * they will append the artifact name, just like any artifact, if known.\n
1319 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.\n
1322 * OD_NAME_ONLY : The Cloak of Death\n
1323 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]\n
1324 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)\n
1325 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}\n
1327 * OD_OMIT_PREFIX : Forbidden numeric prefix\n
1328 * OD_NO_PLURAL : Forbidden use of plural \n
1329 * OD_STORE : Assume to be aware and known\n
1330 * OD_NO_FLAVOR : Allow to hidden flavor\n
1331 * OD_FORCE_FLAVOR : Get un-shuffled flavor name\n
1333 void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
1335 /* Extract object kind name */
1336 concptr kindname = k_name + k_info[o_ptr->k_idx].name;
1338 /* Extract default "base" string */
1339 concptr basenm = kindname;
1341 /* Assume no "modifier" string */
1342 concptr modstr = "";
1351 bool show_weapon = FALSE;
1352 bool show_armour = FALSE;
1357 char p1 = '(', p2 = ')';
1358 char b1 = '[', b2 = ']';
1359 char c1 = '{', c2 = '}';
1361 char tmp_val[MAX_NLEN + 160];
1362 char tmp_val2[MAX_NLEN + 10];
1363 char fake_insc_buf[30];
1365 BIT_FLAGS flgs[TR_FLAG_SIZE];
1367 object_type *bow_ptr;
1369 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1370 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1372 /* Extract some flags */
1373 object_flags(o_ptr, flgs);
1375 /* See if the object is "aware" */
1376 if (object_is_aware(o_ptr)) aware = TRUE;
1378 /* See if the object is "known" */
1379 if (object_is_known(o_ptr)) known = TRUE;
1381 /* Allow flavors to be hidden when aware */
1382 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1384 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1386 /* Don't show flavors */
1389 /* Pretend known and aware */
1394 /* Force to be flavor name only */
1395 if (mode & OD_FORCE_FLAVOR)
1401 /* Cancel shuffling */
1402 flavor_k_ptr = k_ptr;
1405 /* Analyze the object */
1406 switch (o_ptr->tval)
1408 /* Some objects are easy to describe */
1422 monster_race *r_ptr = &r_info[o_ptr->pval];
1428 modstr = _(" (空)", " (empty)");
1433 sprintf(tmp_val2, " (%s)", r_name + r_ptr->name);
1436 t = r_name + r_ptr->name;
1438 if (!(r_ptr->flags1 & RF1_UNIQUE))
1440 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1446 sprintf(tmp_val2, "(%s)", t);
1456 /* Figurines/Statues */
1460 monster_race *r_ptr = &r_info[o_ptr->pval];
1463 modstr = r_name + r_ptr->name;
1465 t = r_name + r_ptr->name;
1467 if (!(r_ptr->flags1 & RF1_UNIQUE))
1469 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1486 monster_race *r_ptr = &r_info[o_ptr->pval];
1488 modstr = r_name + r_ptr->name;
1493 if (r_ptr->flags1 & RF1_UNIQUE)
1494 basenm = "& % of #";
1502 /* Missiles/ Bows/ Weapons */
1531 /* Lites (including a few "Specials") */
1537 /* Amulets (including a few "Specials") */
1540 /* Known artifacts */
1543 if (object_is_fixed_artifact(o_ptr)) break;
1544 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1547 /* Color the object */
1548 modstr = k_name + flavor_k_ptr->flavor_name;
1551 if (!flavor) basenm = "%のアミュレット";
1552 else if (aware) basenm = "%の#アミュレット";
1553 else basenm = "#アミュレット";
1555 if (!flavor) basenm = "& Amulet~ of %";
1556 else if (aware) basenm = "& # Amulet~ of %";
1557 else basenm = "& # Amulet~";
1563 /* Rings (including a few "Specials") */
1566 /* Known artifacts */
1569 if (object_is_fixed_artifact(o_ptr)) break;
1570 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1573 /* Color the object */
1574 modstr = k_name + flavor_k_ptr->flavor_name;
1577 if (!flavor) basenm = "%の指輪";
1578 else if (aware) basenm = "%の#指輪";
1579 else basenm = "#指輪";
1581 if (!flavor) basenm = "& Ring~ of %";
1582 else if (aware) basenm = "& # Ring~ of %";
1583 else basenm = "& # Ring~";
1586 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1598 /* Color the object */
1599 modstr = k_name + flavor_k_ptr->flavor_name;
1602 if (!flavor) basenm = "%の杖";
1603 else if (aware) basenm = "%の#杖";
1606 if (!flavor) basenm = "& Staff~ of %";
1607 else if (aware) basenm = "& # Staff~ of %";
1608 else basenm = "& # Staff~";
1616 /* Color the object */
1617 modstr = k_name + flavor_k_ptr->flavor_name;
1620 if (!flavor) basenm = "%の魔法棒";
1621 else if (aware) basenm = "%の#魔法棒";
1622 else basenm = "#魔法棒";
1624 if (!flavor) basenm = "& Wand~ of %";
1625 else if (aware) basenm = "& # Wand~ of %";
1626 else basenm = "& # Wand~";
1634 /* Color the object */
1635 modstr = k_name + flavor_k_ptr->flavor_name;
1638 if (!flavor) basenm = "%のロッド";
1639 else if (aware) basenm = "%の#ロッド";
1640 else basenm = "#ロッド";
1642 if (!flavor) basenm = "& Rod~ of %";
1643 else if (aware) basenm = "& # Rod~ of %";
1644 else basenm = "& # Rod~";
1652 /* Color the object */
1653 modstr = k_name + flavor_k_ptr->flavor_name;
1656 if (!flavor) basenm = "%の巻物";
1657 else if (aware) basenm = "「#」と書かれた%の巻物";
1658 else basenm = "「#」と書かれた巻物";
1660 if (!flavor) basenm = "& Scroll~ of %";
1661 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1662 else basenm = "& Scroll~ titled \"#\"";
1670 /* Color the object */
1671 modstr = k_name + flavor_k_ptr->flavor_name;
1674 if (!flavor) basenm = "%の薬";
1675 else if (aware) basenm = "%の#薬";
1678 if (!flavor) basenm = "& Potion~ of %";
1679 else if (aware) basenm = "& # Potion~ of %";
1680 else basenm = "& # Potion~";
1688 /* Ordinary food is "boring" */
1689 if (!k_ptr->flavor_name) break;
1691 /* Color the object */
1692 modstr = k_name + flavor_k_ptr->flavor_name;
1695 if (!flavor) basenm = "%のキノコ";
1696 else if (aware) basenm = "%の#キノコ";
1697 else basenm = "#キノコ";
1699 if (!flavor) basenm = "& Mushroom~ of %";
1700 else if (aware) basenm = "& # Mushroom~ of %";
1701 else basenm = "& # Mushroom~";
1709 basenm = _("羊皮紙 - %", "& Parchment~ - %");
1719 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1720 basenm = "& Book~ of Life Magic %";
1722 basenm = "& Life Spellbook~ %";
1728 case TV_SORCERY_BOOK:
1733 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1734 basenm = "& Book~ of Sorcery %";
1736 basenm = "& Sorcery Spellbook~ %";
1742 case TV_NATURE_BOOK:
1747 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1748 basenm = "& Book~ of Nature Magic %";
1750 basenm = "& Nature Spellbook~ %";
1759 basenm = "カオスの魔法書%";
1761 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1762 basenm = "& Book~ of Chaos Magic %";
1764 basenm = "& Chaos Spellbook~ %";
1775 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1776 basenm = "& Book~ of Death Magic %";
1778 basenm = "& Death Spellbook~ %";
1787 basenm = "トランプの魔法書%";
1789 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1790 basenm = "& Book~ of Trump Magic %";
1792 basenm = "& Trump Spellbook~ %";
1798 case TV_ARCANE_BOOK:
1803 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1804 basenm = "& Book~ of Arcane Magic %";
1806 basenm = "& Arcane Spellbook~ %";
1817 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1818 basenm = "& Book~ of Craft Magic %";
1820 basenm = "& Craft Spellbook~ %";
1826 case TV_DAEMON_BOOK:
1831 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1832 basenm = "& Book~ of Daemon Magic %";
1834 basenm = "& Daemon Spellbook~ %";
1840 case TV_CRUSADE_BOOK:
1845 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1846 basenm = "& Book~ of Crusade Magic %";
1848 basenm = "& Crusade Spellbook~ %";
1856 basenm = _("歌集%", "& Song Book~ %");
1860 case TV_HISSATSU_BOOK:
1862 basenm = _("& 武芸の書%", "Book~ of Kendo %");
1871 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1872 basenm = "& Book~ of Hex Magic %";
1874 basenm = "& Hex Spellbook~ %";
1880 /* Hack -- Gold/Gems */
1883 strcpy(buf, basenm);
1889 strcpy(buf, _("(なし)", "(nothing)"));
1894 /* Use full name from k_info or a_info */
1895 if (aware && have_flag(flgs, TR_FULL_NAME))
1897 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1898 else basenm = kindname;
1901 /* Start dumping the result */
1905 if (basenm[0] == '&')
1911 if (mode & OD_OMIT_PREFIX)
1915 else if (o_ptr->number > 1)
1917 t = object_desc_kosuu(t, o_ptr);
1918 t = object_desc_str(t, "の ");
1921 /* 英語の場合アーティファクトは The が付くので分かるが
1922 * 日本語では分からないのでマークをつける
1926 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "★");
1927 else if (o_ptr->art_name) t = object_desc_str(t, "☆");
1932 /* The object "expects" a "number" */
1933 if (basenm[0] == '&')
1935 /* Skip the ampersand (and space) */
1939 if (mode & OD_OMIT_PREFIX)
1944 /* Hack -- None left */
1945 else if (o_ptr->number <= 0)
1947 t = object_desc_str(t, "no more ");
1950 /* Extract the number */
1951 else if (o_ptr->number > 1)
1953 t = object_desc_num(t, o_ptr->number);
1954 t = object_desc_chr(t, ' ');
1957 /* Hack -- The only one of its kind */
1958 else if ((known && object_is_artifact(o_ptr)) ||
1959 ((o_ptr->tval == TV_CORPSE) &&
1960 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1962 t = object_desc_str(t, "The ");
1972 case '#': vowel = is_a_vowel(modstr[0]); break;
1973 case '%': vowel = is_a_vowel(*kindname); break;
1974 default: vowel = is_a_vowel(*s); break;
1979 /* A single one, with a vowel */
1980 t = object_desc_str(t, "an ");
1984 /* A single one, without a vowel */
1985 t = object_desc_str(t, "a ");
1990 /* Hack -- objects that "never" take an article */
1997 if (mode & OD_OMIT_PREFIX)
2002 /* Hack -- all gone */
2003 else if (o_ptr->number <= 0)
2005 t = object_desc_str(t, "no more ");
2008 /* Prefix a number if required */
2009 else if (o_ptr->number > 1)
2011 t = object_desc_num(t, o_ptr->number);
2012 t = object_desc_chr(t, ' ');
2015 /* Hack -- The only one of its kind */
2016 else if (known && object_is_artifact(o_ptr))
2018 t = object_desc_str(t, "The ");
2021 /* Hack -- single items get no prefix */
2029 /* Paranoia -- skip illegal tildes */
2030 /* while (*s == '~') s++; */
2033 if (object_is_smith(o_ptr))
2035 t = object_desc_str(t, format("鍛冶師%sの", p_ptr->name));
2038 /* 伝説のアイテム、名のあるアイテムの名前を付加する */
2042 if (o_ptr->art_name)
2044 concptr temp = quark_str(o_ptr->art_name);
2046 /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
2047 /* 英語版のセーブファイルから来た 'of XXX' は,「XXXの」と表示する */
2048 if (strncmp(temp, "of ", 3) == 0)
2050 t = object_desc_str(t, &temp[3]);
2051 t = object_desc_str(t, "の");
2053 else if ((strncmp(temp, "『", 2) != 0) &&
2054 (strncmp(temp, "《", 2) != 0) &&
2056 t = object_desc_str(t, temp);
2059 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
2061 artifact_type *a_ptr = &a_info[o_ptr->name1];
2062 /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
2063 if (strncmp(a_name + a_ptr->name, "『", 2) != 0)
2065 t = object_desc_str(t, a_name + a_ptr->name);
2069 else if (object_is_ego(o_ptr))
2071 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2072 t = object_desc_str(t, e_name + e_ptr->name);
2077 /* Copy the string */
2078 for (s0 = NULL; *s || s0; )
2080 /* The end of the flavour/kind string. */
2087 /* Begin to append the modifier (flavor) */
2088 else if ((*s == '#') && !s0)
2093 /* Paranoia -- Never append multiple modstrs */
2097 /* Begin to append the kind name */
2098 else if ((*s == '%') && !s0)
2103 /* Paranoia -- Never append multiple kindnames */
2113 /* Add a plural if needed */
2114 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2120 /* Hack -- "Cutlass-es" and "Torch-es" */
2121 if ((k == 's') || (k == 'h')) *t++ = 'e';
2143 /* '『'から始まる伝説のアイテムの名前は最後に付加する */
2146 /* ランダムアーティファクトの名前はセーブファイルに記録
2147 されるので、英語版の名前もそれらしく変換する */
2148 if (o_ptr->art_name)
2152 strcpy(temp, quark_str(o_ptr->art_name));
2153 /* MEGA HACK by ita */
2154 if (strncmp(temp, "『", 2) == 0 ||
2155 strncmp(temp, "《", 2) == 0)
2156 t = object_desc_str(t, temp);
2157 else if (temp[0] == '\'')
2159 itemp = strlen(temp);
2160 temp[itemp - 1] = 0;
2161 t = object_desc_str(t, "『");
2162 t = object_desc_str(t, &temp[1]);
2163 t = object_desc_str(t, "』");
2166 else if (object_is_fixed_artifact(o_ptr))
2168 artifact_type *a_ptr = &a_info[o_ptr->name1];
2169 if (strncmp(a_name + a_ptr->name, "『", 2) == 0)
2171 t = object_desc_str(t, a_name + a_ptr->name);
2174 else if (o_ptr->inscription)
2176 concptr str = quark_str(o_ptr->inscription);
2185 if (*str == '#') break;
2191 concptr str_aux = my_strchr(quark_str(o_ptr->inscription), '#');
2193 /* Add the false name */
2194 t = object_desc_str(t, "『");
2195 t = object_desc_str(t, &str_aux[1]);
2196 t = object_desc_str(t, "』");
2201 if (object_is_smith(o_ptr))
2203 t = object_desc_str(t, format(" of %s the Smith", p_ptr->name));
2206 /* Hack -- Append "Artifact" or "Special" names */
2207 if (known && !have_flag(flgs, TR_FULL_NAME))
2209 /* Is it a new random artifact ? */
2210 if (o_ptr->art_name)
2212 t = object_desc_chr(t, ' ');
2213 t = object_desc_str(t, quark_str(o_ptr->art_name));
2216 /* Grab any artifact name */
2217 else if (object_is_fixed_artifact(o_ptr))
2219 artifact_type *a_ptr = &a_info[o_ptr->name1];
2221 t = object_desc_chr(t, ' ');
2222 t = object_desc_str(t, a_name + a_ptr->name);
2225 /* Grab any ego-item name */
2228 if (object_is_ego(o_ptr))
2230 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2232 t = object_desc_chr(t, ' ');
2233 t = object_desc_str(t, e_name + e_ptr->name);
2236 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2239 concptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2241 /* Add the false name */
2242 t = object_desc_chr(t, ' ');
2243 t = object_desc_str(t, &str[1]);
2250 /* No more details wanted */
2251 if (mode & OD_NAME_ONLY) goto object_desc_done;
2253 /* Hack -- Chests must be described in detail */
2254 if (o_ptr->tval == TV_CHEST)
2256 /* Not searched yet */
2262 /* May be "empty" */
2263 else if (!o_ptr->pval)
2265 t = object_desc_str(t, _("(空)", " (empty)"));
2268 /* May be "disarmed" */
2269 else if (o_ptr->pval < 0)
2271 if (chest_traps[0 - o_ptr->pval])
2273 t = object_desc_str(t, _("(解除済)", " (disarmed)"));
2277 t = object_desc_str(t, _("(非施錠)", " (unlocked)"));
2281 /* Describe the traps, if any */
2284 /* Describe the traps */
2285 switch (chest_traps[o_ptr->pval])
2289 t = object_desc_str(t, _("(施錠)", " (Locked)"));
2292 case CHEST_LOSE_STR:
2294 t = object_desc_str(t, _("(毒針)", " (Poison Needle)"));
2297 case CHEST_LOSE_CON:
2299 t = object_desc_str(t, _("(毒針)", " (Poison Needle)"));
2304 t = object_desc_str(t, _("(ガス・トラップ)", " (Gas Trap)"));
2307 case CHEST_PARALYZE:
2309 t = object_desc_str(t, _("(ガス・トラップ)", " (Gas Trap)"));
2314 t = object_desc_str(t, _("(爆発装置)", " (Explosion Device)"));
2318 case CHEST_BIRD_STORM:
2319 case CHEST_E_SUMMON:
2320 case CHEST_H_SUMMON:
2322 t = object_desc_str(t, _("(召喚のルーン)", " (Summoning Runes)"));
2325 case CHEST_RUNES_OF_EVIL:
2327 t = object_desc_str(t, _("(邪悪なルーン)", " (Gleaming Black Runes)"));
2332 t = object_desc_str(t, _("(警報装置)", " (Alarm)"));
2337 t = object_desc_str(t, _("(マルチ・トラップ)", " (Multiple Traps)"));
2345 /* Display the item like a weapon */
2346 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2348 /* Display the item like a weapon */
2349 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2352 /* Display the item like a weapon */
2353 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2355 /* Display the item like armour */
2356 if (o_ptr->ac) show_armour = TRUE;
2359 /* Dump base weapon info */
2360 switch (o_ptr->tval)
2362 /* Missiles and Weapons */
2371 /* In Vault Quest, hide the dice of target weapon. */
2372 if (object_is_quest_target(o_ptr) && !known)
2377 /* Append a "damage" string */
2378 t = object_desc_chr(t, ' ');
2379 t = object_desc_chr(t, p1);
2380 t = object_desc_num(t, o_ptr->dd);
2381 t = object_desc_chr(t, 'd');
2382 t = object_desc_num(t, o_ptr->ds);
2383 t = object_desc_chr(t, p2);
2388 /* Bows get a special "damage string" */
2391 /* Mega-Hack -- Extract the "base power" */
2392 power = bow_tmul(o_ptr->sval);
2394 /* Apply the "Extra Might" flag */
2395 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2397 /* Append a special "damage" string */
2398 t = object_desc_chr(t, ' ');
2399 t = object_desc_chr(t, p1);
2400 t = object_desc_chr(t, 'x');
2401 t = object_desc_num(t, power);
2402 t = object_desc_chr(t, p2);
2404 fire_rate = calc_num_fire(p_ptr, o_ptr);
2405 /* Show Fire rate */
2406 if (fire_rate != 0 && power > 0 && known)
2408 fire_rate = bow_energy(o_ptr->sval) / fire_rate;
2410 t = object_desc_chr(t, ' ');
2411 t = object_desc_chr(t, p1);
2412 t = object_desc_num(t, fire_rate / 100);
2413 t = object_desc_chr(t, '.');
2414 t = object_desc_num(t, fire_rate % 100);
2415 t = object_desc_str(t, "turn");
2416 t = object_desc_chr(t, p2);
2424 /* Add the weapon bonuses */
2427 /* Show the tohit/todam on request */
2430 t = object_desc_chr(t, ' ');
2431 t = object_desc_chr(t, p1);
2432 t = object_desc_int(t, o_ptr->to_h);
2433 t = object_desc_chr(t, ',');
2434 t = object_desc_int(t, o_ptr->to_d);
2435 t = object_desc_chr(t, p2);
2438 /* Show the tohit if needed */
2439 else if (o_ptr->to_h)
2441 t = object_desc_chr(t, ' ');
2442 t = object_desc_chr(t, p1);
2443 t = object_desc_int(t, o_ptr->to_h);
2444 t = object_desc_chr(t, p2);
2447 /* Show the todam if needed */
2448 else if (o_ptr->to_d)
2450 t = object_desc_chr(t, ' ');
2451 t = object_desc_chr(t, p1);
2452 t = object_desc_int(t, o_ptr->to_d);
2453 t = object_desc_chr(t, p2);
2457 bow_ptr = &p_ptr->inventory_list[INVEN_BOW];
2459 /* If have a firing weapon + ammo matches bow */
2460 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2462 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2463 int tmul = bow_tmul(bow_ptr->sval);
2464 ENERGY energy_fire = bow_energy(bow_ptr->sval);
2466 /* See if the bow is "known" - then set damage bonus */
2467 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2469 /* Effect of ammo */
2470 if (known) avgdam += (o_ptr->to_d * 10);
2472 /* Get extra "power" from "extra might" */
2473 if (p_ptr->xtra_might) tmul++;
2475 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2477 /* Launcher multiplier */
2479 avgdam /= (100 * 10);
2481 /* Get extra damage from concentration */
2482 if (p_ptr->concent) avgdam = boost_concentration_damage(p_ptr, avgdam);
2484 if (avgdam < 0) avgdam = 0;
2486 /* Display (shot damage/ shot damage with critical/ avg damage with critical) */
2487 t = object_desc_chr(t, ' ');
2488 t = object_desc_chr(t, p1);
2490 if (show_ammo_no_crit)
2492 /* Damage with no-crit */
2493 t = object_desc_num(t, avgdam);
2494 t = object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2497 /* Apply Expect damage of Critical */
2498 avgdam = calc_expect_crit_shot(p_ptr, o_ptr->weight, o_ptr->to_h, bow_ptr->to_h, avgdam);
2499 t = object_desc_num(t, avgdam);
2501 t = show_ammo_no_crit ? object_desc_str(t, show_ammo_detail ? "/crit " : "/")
2502 : object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2504 if (p_ptr->num_fire == 0)
2506 t = object_desc_chr(t, '0');
2510 /* Calc effects of energy */
2511 avgdam *= (p_ptr->num_fire * 100);
2512 avgdam /= energy_fire;
2513 t = object_desc_num(t, avgdam);
2514 t = object_desc_str(t, show_ammo_detail ? "/turn" : "");
2516 if (show_ammo_crit_ratio)
2518 int percent = calc_crit_ratio_shot(p_ptr, known ? o_ptr->to_h : 0, known ? bow_ptr->to_h : 0);
2520 t = object_desc_chr(t, '/');
2521 t = object_desc_num(t, percent / 100);
2522 t = object_desc_chr(t, '.');
2523 if (percent % 100 < 10)
2525 t = object_desc_chr(t, '0');
2527 t = object_desc_num(t, percent % 100);
2528 t = object_desc_str(t, show_ammo_detail ? "% crit" : "%");
2532 t = object_desc_chr(t, p2);
2534 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2536 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2537 s16b energy_fire = 100 - p_ptr->lev;
2539 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2541 /* Display (shot damage/ avg damage) */
2542 t = object_desc_chr(t, ' ');
2543 t = object_desc_chr(t, p1);
2544 t = object_desc_num(t, avgdam);
2545 t = object_desc_chr(t, '/');
2547 /* Calc effects of energy */
2548 avgdam = 100 * avgdam / energy_fire;
2550 t = object_desc_num(t, avgdam);
2551 t = object_desc_chr(t, p2);
2554 /* Add the armor bonuses */
2557 /* Show the armor class info */
2560 t = object_desc_chr(t, ' ');
2561 t = object_desc_chr(t, b1);
2562 t = object_desc_num(t, o_ptr->ac);
2563 t = object_desc_chr(t, ',');
2564 t = object_desc_int(t, o_ptr->to_a);
2565 t = object_desc_chr(t, b2);
2568 /* No base armor, but does increase armor */
2569 else if (o_ptr->to_a)
2571 t = object_desc_chr(t, ' ');
2572 t = object_desc_chr(t, b1);
2573 t = object_desc_int(t, o_ptr->to_a);
2574 t = object_desc_chr(t, b2);
2578 /* Hack -- always show base armor */
2579 else if (show_armour)
2581 t = object_desc_chr(t, ' ');
2582 t = object_desc_chr(t, b1);
2583 t = object_desc_num(t, o_ptr->ac);
2584 t = object_desc_chr(t, b2);
2588 /* No more details wanted */
2589 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2592 if (known) /* Known item only */
2595 * Hack -- Wands and Staffs have charges. Make certain how many charges
2596 * a stack of staffs really has is clear. -LM-
2598 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2600 /* Dump " (N charges)" */
2601 t = object_desc_chr(t, ' ');
2602 t = object_desc_chr(t, p1);
2604 /* Clear explaination for staffs. */
2605 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2607 t = object_desc_num(t, o_ptr->number);
2608 t = object_desc_str(t, "x ");
2610 t = object_desc_num(t, o_ptr->pval);
2612 t = object_desc_str(t, "回分");
2614 t = object_desc_str(t, " charge");
2615 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2618 t = object_desc_chr(t, p2);
2620 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2621 * be in any state of charge or discharge, this now includes a number. -LM-
2623 else if (o_ptr->tval == TV_ROD)
2625 /* Hack -- Dump " (# charging)" if relevant */
2628 /* Stacks of rods display an exact count of charging rods. */
2629 if (o_ptr->number > 1)
2632 if (k_ptr->pval == 0) k_ptr->pval = 1;
2634 /* Find out how many rods are charging, by dividing
2635 * current timeout by each rod's maximum timeout.
2636 * Ensure that any remainder is rounded up. Display
2637 * very discharged stacks as merely fully discharged.
2639 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2640 if (power > o_ptr->number) power = o_ptr->number;
2642 /* Display prettily. */
2643 t = object_desc_str(t, " (");
2644 t = object_desc_num(t, power);
2645 t = object_desc_str(t, _("本 充填中)", " charging)"));
2648 /* "one Rod of Perception (1 charging)" would look tacky. */
2651 t = object_desc_str(t, _("(充填中)", " (charging)"));
2656 /* Dump "pval" flags for wearable items */
2657 if (have_pval_flags(flgs))
2659 /* Start the display */
2660 t = object_desc_chr(t, ' ');
2661 t = object_desc_chr(t, p1);
2663 /* Dump the "pval" itself */
2664 t = object_desc_int(t, o_ptr->pval);
2666 /* Do not display the "pval" flags */
2667 if (have_flag(flgs, TR_HIDE_TYPE))
2672 else if (have_flag(flgs, TR_SPEED))
2674 t = object_desc_str(t, _("加速", " to speed"));
2676 else if (have_flag(flgs, TR_BLOWS))
2678 t = object_desc_str(t, _("攻撃", " attack"));
2682 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2685 else if (have_flag(flgs, TR_STEALTH))
2687 t = object_desc_str(t, _("隠密", " to stealth"));
2689 else if (have_flag(flgs, TR_SEARCH))
2691 t = object_desc_str(t, _("探索", " to searching"));
2693 else if (have_flag(flgs, TR_INFRA))
2695 t = object_desc_str(t, _("赤外線視力", " to infravision"));
2697 t = object_desc_chr(t, p2);
2700 /* Hack -- Process Lanterns/Torches */
2701 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2703 /* Hack -- Turns of light for normal lites */
2704 t = object_desc_str(t, _("(", " (with "));
2705 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2706 else t = object_desc_num(t, o_ptr->xtra4);
2707 t = object_desc_str(t, _("ターンの寿命)", " turns of light)"));
2710 /* Indicate charging objects, but not rods. */
2711 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2713 t = object_desc_str(t, _("(充填中)", " (charging)"));
2717 /* No more details wanted */
2718 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2720 /* Prepare real inscriptions in a buffer */
2723 /* Auto abbreviation inscribe */
2724 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2726 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2737 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2741 /* Use the standard inscription if available */
2742 if (o_ptr->inscription)
2745 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2746 get_inscription(buff, o_ptr);
2747 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2751 /* No fake inscription yet */
2752 fake_insc_buf[0] = '\0';
2754 /* Use the game-generated "feeling" otherwise, if available */
2757 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2760 /* Note "cursed" if the item is known to be cursed */
2761 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2763 strcpy(fake_insc_buf, _("呪われている", "cursed"));
2766 /* Note "unidentified" if the item is unidentified */
2767 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2768 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2770 && !(o_ptr->ident & IDENT_SENSE))
2772 strcpy(fake_insc_buf, _("未鑑定", "unidentified"));
2775 /* Mega-Hack -- note empty wands/staffs */
2776 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2778 strcpy(fake_insc_buf, _("空", "empty"));
2781 /* Note "tried" if the object has been tested unsuccessfully */
2782 else if (!aware && object_is_tried(o_ptr))
2784 strcpy(fake_insc_buf, _("未判明", "tried"));
2787 /* Note the discount, if any */
2788 if (o_ptr->discount)
2790 /* Hidden by real inscription unless in a store */
2791 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2793 char discount_num_buf[4];
2795 /* Append to other fake inscriptions if any */
2796 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2798 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2799 strcat(fake_insc_buf, discount_num_buf);
2800 strcat(fake_insc_buf, _("%引き", "% off"));
2805 /* Append the inscription, if any */
2806 if (fake_insc_buf[0] || tmp_val2[0])
2808 /* Append the inscription */
2809 t = object_desc_chr(t, ' ');
2810 t = object_desc_chr(t, c1);
2812 /* Append fake inscriptions */
2813 if (fake_insc_buf[0])
2815 t = object_desc_str(t, fake_insc_buf);
2818 /* Append a separater */
2819 if (fake_insc_buf[0] && tmp_val2[0])
2821 t = object_desc_chr(t, ',');
2822 t = object_desc_chr(t, ' ');
2825 /* Append real inscriptions */
2828 t = object_desc_str(t, tmp_val2);
2831 t = object_desc_chr(t, c2);
2835 my_strcpy(buf, tmp_val, MAX_NLEN);
2840 * @brief nameバッファ内からベースアイテム名を返す / Strip an "object name" into a buffer
2841 * @param buf ベースアイテム格納先の参照ポインタ
2842 * @param k_idx ベースアイテムID
2845 void strip_name(char *buf, KIND_OBJECT_IDX k_idx)
2849 object_kind *k_ptr = &k_info[k_idx];
2851 concptr str = (k_name + k_ptr->name);
2854 /* Skip past leading characters */
2855 while ((*str == ' ') || (*str == '&')) str++;
2857 /* Copy useful chars */
2858 for (t = buf; *str; str++)
2861 if (iskanji(*str)) { *t++ = *str++; *t++ = *str; continue; }
2863 if (*str != '~') *t++ = *str;
2866 /* Terminate the new name */