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
17 #include "player-status.h"
19 #include "objectkind.h"
20 #include "object-hook.h"
21 #include "object-flavor.h"
26 #include "monsterrace.h"
27 #include "object-ego.h"
30 * @brief 最初から簡易な名称が明らかになるベースアイテムの判定。 / Certain items, if aware, are known instantly
32 * @return 簡易名称を明らかにするならTRUEを返す。
34 * This function is used only by "flavor_init()"
36 static bool object_easy_know(int i)
38 object_kind *k_ptr = &k_info[i];
40 /* Analyze the "tval" */
55 case TV_HISSATSU_BOOK:
72 /* All Food, Potions, Scrolls, Rods */
86 * @brief 各種語彙からランダムな名前を作成する / Create a name from random parts.
87 * @param out_string 作成した名を保管する参照ポインタ
89 * @details 日本語の場合 aname_j.txt 英語の場合確率に応じて
90 * syllables 配列と elvish.txt を組み合わせる。\n
92 void get_table_name_aux(char *out_string)
96 get_rnd_line("aname_j.txt", 1, Syllable);
97 strcpy(out_string, Syllable);
98 get_rnd_line("aname_j.txt", 2, Syllable);
99 strcat(out_string, Syllable);
101 #define MAX_SYLLABLES 164 /* Used with scrolls (see below) */
103 static concptr syllables[MAX_SYLLABLES] = {
104 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
105 "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
106 "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
107 "byt", "comp", "con", "cos", "cre", "dalf", "dan",
108 "den", "der", "doe", "dok", "eep", "el", "eng", "er", "ere", "erk",
109 "esh", "evs", "fa", "fid", "flit", "for", "fri", "fu", "gan",
110 "gar", "glen", "gop", "gre", "ha", "he", "hyd", "i",
111 "ing", "ion", "ip", "ish", "it", "ite", "iv", "jo",
112 "kho", "kli", "klis", "la", "lech", "man", "mar",
113 "me", "mi", "mic", "mik", "mon", "mung", "mur", "nag", "nej",
114 "nelg", "nep", "ner", "nes", "nis", "nih", "nin", "o",
115 "od", "ood", "org", "orn", "ox", "oxy", "pay", "pet",
116 "ple", "plu", "po", "pot", "prok", "re", "rea", "rhov",
117 "ri", "ro", "rog", "rok", "rol", "sa", "san", "sat",
118 "see", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
119 "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab",
120 "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
121 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly",
122 "vom", "wah", "wed", "werg", "wex", "whon", "wun", "x",
123 "yerg", "yp", "zun", "tri", "blaa", "jah", "bul", "on",
127 int testcounter = randint1(3) + 1;
129 strcpy(out_string, "");
131 if (randint1(3) == 2)
133 while (testcounter--)
134 strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
139 testcounter = randint1(2) + 1;
140 while (testcounter--)
142 (void)get_rnd_line("elvish.txt", 0, Syllable);
143 strcat(out_string, Syllable);
147 out_string[0] = toupper(out_string[1]);
149 out_string[16] = '\0';
154 * @brief ランダムな名前をアーティファクト銘として整形する。 / Create a name from random parts with quotes.
155 * @param out_string 作成した名を保管する参照ポインタ
157 * @details get_table_name_aux()ほぼ完全に実装を依存している。
159 void get_table_name(char *out_string)
162 get_table_name_aux(buff);
163 sprintf(out_string, _("『%s』", "'%s'"), buff);
167 * @brief ランダムなシンダリン銘を作成する / Make random Sindarin name
168 * @param out_string 作成した名を保管する参照ポインタ
170 * @details sname.txtが語幹の辞書となっている。
172 void get_table_sindarin_aux(char *out_string)
179 get_rnd_line("sname.txt", 1, Syllable);
181 strcpy(tmp, Syllable);
183 strcpy(out_string, Syllable);
186 get_rnd_line("sname.txt", 2, Syllable);
188 strcat(tmp, Syllable);
189 sindarin_to_kana(out_string, tmp);
191 strcat(out_string, Syllable);
196 * @brief シンダリン銘をアーティファクト用に整形する。 / Make random Sindarin name with quotes
197 * @param out_string 作成した名を保管する参照ポインタ
199 * @details get_table_sindarin_aux()ほぼ完全に実装を依存している。
201 void get_table_sindarin(char *out_string)
204 get_table_sindarin_aux(buff);
205 sprintf(out_string, _("『%s』", "'%s'"), buff);
210 * @brief ベースアイテムの未確定名を共通tval間でシャッフルする / Shuffle flavor indices of a group of objects with given tval
211 * @param tval シャッフルしたいtval
213 * @details 巻物、各種魔道具などに利用される。
215 static void shuffle_flavors(OBJECT_TYPE_VALUE tval)
217 KIND_OBJECT_IDX *k_idx_list;
218 KIND_OBJECT_IDX k_idx_list_num = 0;
221 /* Allocate an array for a list of k_idx */
222 C_MAKE(k_idx_list, max_k_idx, KIND_OBJECT_IDX);
224 /* Search objects with given tval for shuffle */
225 for (i = 0; i < max_k_idx; i++)
227 object_kind *k_ptr = &k_info[i];
230 if (k_ptr->tval != tval) continue;
232 /* Paranoia -- Skip objects without flavor */
233 if (!k_ptr->flavor) continue;
235 /* Skip objects with a fixed flavor name */
236 if (have_flag(k_ptr->flags, TR_FIXED_FLAVOR)) continue;
239 k_idx_list[k_idx_list_num] = i;
241 /* Increase number of remembered indices */
245 /* Shuffle flavors */
246 for (i = 0; i < k_idx_list_num; i++)
248 object_kind *k1_ptr = &k_info[k_idx_list[i]];
249 object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
251 /* Swap flavors of this pair */
252 s16b tmp = k1_ptr->flavor;
253 k1_ptr->flavor = k2_ptr->flavor;
254 k2_ptr->flavor = tmp;
257 /* Free an array for a list of k_idx */
258 C_KILL(k_idx_list, max_k_idx, s16b);
262 * @brief ゲーム開始時に行われるベースアイテムの初期化ルーチン / Prepare the "variable" part of the "k_info" array.
265 * Prepare the "variable" part of the "k_info" array.\n
267 * The "color"/"metal"/"type" of an item is its "flavor".\n
268 * For the most part, flavors are assigned randomly each game.\n
270 * Initialize descriptions for the "colored" objects, including:\n
271 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.\n
273 * The first 4 entries for potions are fixed (Water, Apple Juice,\n
274 * Slime Mold Juice, Unused Potion).\n
276 * Scroll titles are always between 6 and 14 letters long. This is\n
277 * ensured because every title is composed of whole words, where every\n
278 * word is from 1 to 8 letters long (one or two syllables of 1 to 4\n
279 * letters each), and that no scroll is finished until it attempts to\n
280 * grow beyond 15 letters. The first time this can happen is when the\n
281 * current title has 6 letters and the new word has 8 letters, which\n
282 * would result in a 6 letter scroll title.\n
284 * Duplicate titles are avoided by requiring that no two scrolls share\n
285 * the same first four letters (not the most efficient method, and not\n
286 * the least efficient method, but it will always work).\n
288 * Hack -- make sure everything stays the same for each saved game\n
289 * This is accomplished by the use of a saved "random seed", as in\n
290 * "town_gen()". Since no other functions are called while the special\n
291 * seed is in effect, so this function is pretty "safe".\n
293 * Note that the "hacked seed" may provide an RNG with alternating parity!\n
295 void flavor_init(void)
298 u32b state_backup[4];
300 /* Hack -- Backup the RNG state */
301 Rand_state_backup(state_backup);
303 /* Hack -- Induce consistant flavors */
304 Rand_state_set(current_world_ptr->seed_flavor);
307 /* Initialize flavor index of each object by itself */
308 for (i = 0; i < max_k_idx; i++)
310 object_kind *k_ptr = &k_info[i];
312 /* Skip objects without flavor name */
313 if (!k_ptr->flavor_name) continue;
316 * Initialize flavor index to itself
317 * -> Shuffle it later
323 shuffle_flavors(TV_RING);
325 /* Shuffle Amulets */
326 shuffle_flavors(TV_AMULET);
329 shuffle_flavors(TV_STAFF);
332 shuffle_flavors(TV_WAND);
335 shuffle_flavors(TV_ROD);
337 /* Shuffle Mushrooms */
338 shuffle_flavors(TV_FOOD);
340 /* Shuffle Potions */
341 shuffle_flavors(TV_POTION);
343 /* Shuffle Scrolls */
344 shuffle_flavors(TV_SCROLL);
347 /* Hack -- Restore the RNG state */
348 Rand_state_restore(state_backup);
350 /* Analyze every object */
351 for (i = 1; i < max_k_idx; i++)
353 object_kind *k_ptr = &k_info[i];
355 /* Skip "empty" objects */
356 if (!k_ptr->name) continue;
358 /* No flavor yields aware */
359 if (!k_ptr->flavor) k_ptr->aware = TRUE;
361 /* Check for "easily known" */
362 k_ptr->easy_know = object_easy_know(i);
368 * @brief 対象文字配列に一文字だけをコピーする。
369 * @param t 保管先文字列ポインタ
373 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),\n
374 * and return a pointer to the terminator (t + 1).\n
376 static char *object_desc_chr(char *t, char c)
387 * @brief 対象文字配列に文字列をコピーする。
388 * @param t 保管先文字列ポインタ
389 * @param s コピーしたい文字列ポインタ
392 * Print a string "s" into a string "t", as if by strcpy(t, s),
393 * and return a pointer to the terminator.
395 static char *object_desc_str(char *t, concptr s)
397 /* Copy the string */
398 while (*s) *t++ = *s++;
406 * @brief 対象文字配列に符号なし整数値をコピーする。
407 * @param t 保管先文字列ポインタ
411 * Print an unsigned number "n" into a string "t", as if by
412 * sprintf(t, "%u", n), and return a pointer to the terminator.
414 static char *object_desc_num(char *t, uint n)
418 /* Find "size" of "n" */
419 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
421 /* Dump each digit */
427 /* Remove the digit */
430 /* Process next digit */
444 * @brief 日本語の個数表示ルーチン
445 * @param t 保管先文字列ポインタ
446 * @param o_ptr 記述したいオブジェクトの構造体参照ポインタ
449 * cmd1.c で流用するために object_desc_japanese から移動した。
451 char *object_desc_kosuu(char *t, object_type *o_ptr)
453 t = object_desc_num(t, o_ptr->number);
465 t = object_desc_str(t, "本");
470 t = object_desc_str(t, "巻");
475 t = object_desc_str(t, "服");
479 case TV_SORCERY_BOOK:
487 case TV_CRUSADE_BOOK:
489 case TV_HISSATSU_BOOK:
492 t = object_desc_str(t, "冊");
500 t = object_desc_str(t, "着");
507 t = object_desc_str(t, "振");
512 t = object_desc_str(t, "足");
517 t = object_desc_str(t, "枚");
523 if(o_ptr->sval == SV_FOOD_JERKY)
525 t = object_desc_str(t, "切れ");
531 if (o_ptr->number < 10)
533 t = object_desc_str(t, "つ");
537 t = object_desc_str(t, "個");
547 * @brief 対象文字配列に符号あり整数値をコピーする。
548 * @param t 保管先文字列ポインタ
552 * Print an signed number "v" into a string "t", as if by
553 * sprintf(t, "%+d", n), and return a pointer to the terminator.
554 * Note that we always print a sign, either "+" or "-".
556 static char *object_desc_int(char *t, sint v)
563 /* Take the absolute value */
566 /* Use a "minus" sign */
570 /* Positive (or zero) */
573 /* Use the actual number */
576 /* Use a "plus" sign */
580 /* Find "size" of "n" */
581 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
583 /* Dump each digit */
589 /* Remove the digit */
592 /* Process next digit */
603 * オブジェクトの特性表示記号テーブルの構造体 / Structs and tables for Auto Inscription for flags
605 typedef struct flag_insc_table
616 /*! オブジェクトの特性表示記号テーブルの定義(pval要素) */
617 static flag_insc_table flag_insc_plus[] =
619 { "攻", "At", TR_BLOWS, -1 },
620 { "速", "Sp", TR_SPEED, -1 },
621 { "腕", "St", TR_STR, -1 },
622 { "知", "In", TR_INT, -1 },
623 { "賢", "Wi", TR_WIS, -1 },
624 { "器", "Dx", TR_DEX, -1 },
625 { "耐", "Cn", TR_CON, -1 },
626 { "魅", "Ch", TR_CHR, -1 },
627 { "道", "Md", TR_MAGIC_MASTERY, -1 },
628 { "隠", "Sl", TR_STEALTH, -1 },
629 { "探", "Sr", TR_SEARCH, -1 },
630 { "赤", "If", TR_INFRA, -1 },
631 { "掘", "Dg", TR_TUNNEL, -1 },
632 { NULL, NULL, 0, -1 }
635 /*! オブジェクトの特性表示記号テーブルの定義(免疫) */
636 static flag_insc_table flag_insc_immune[] =
638 { "酸", "Ac", TR_IM_ACID, -1 },
639 { "電", "El", TR_IM_ELEC, -1 },
640 { "火", "Fi", TR_IM_FIRE, -1 },
641 { "冷", "Co", TR_IM_COLD, -1 },
642 { NULL, NULL, 0, -1 }
645 /*! オブジェクトの特性表示記号テーブルの定義(耐性) */
646 static flag_insc_table flag_insc_resistance[] =
648 { "酸", "Ac", TR_RES_ACID, TR_IM_ACID },
649 { "電", "El", TR_RES_ELEC, TR_IM_ELEC },
650 { "火", "Fi", TR_RES_FIRE, TR_IM_FIRE },
651 { "冷", "Co", TR_RES_COLD, TR_IM_COLD },
652 { "毒", "Po", TR_RES_POIS, -1 },
653 { "閃", "Li", TR_RES_LITE, -1 },
654 { "暗", "Dk", TR_RES_DARK, -1 },
655 { "破", "Sh", TR_RES_SHARDS, -1 },
656 { "盲", "Bl", TR_RES_BLIND, -1 },
657 { "乱", "Cf", TR_RES_CONF, -1 },
658 { "轟", "So", TR_RES_SOUND, -1 },
659 { "獄", "Nt", TR_RES_NETHER, -1 },
660 { "因", "Nx", TR_RES_NEXUS, -1 },
661 { "沌", "Ca", TR_RES_CHAOS, -1 },
662 { "劣", "Di", TR_RES_DISEN, -1 },
663 { "恐", "Fe", TR_RES_FEAR, -1 },
664 { NULL, NULL, 0, -1 }
667 /*! オブジェクトの特性表示記号テーブルの定義(その他特性) */
668 static flag_insc_table flag_insc_misc[] =
670 { "易", "Es", TR_EASY_SPELL, -1 },
671 { "減", "Dm", TR_DEC_MANA, -1 },
672 { "投", "Th", TR_THROW, -1 },
673 { "反", "Rf", TR_REFLECT, -1 },
674 { "麻", "Fa", TR_FREE_ACT, -1 },
675 { "視", "Si", TR_SEE_INVIS, -1 },
676 { "経", "Hl", TR_HOLD_EXP, -1 },
677 { "遅", "Sd", TR_SLOW_DIGEST, -1 },
678 { "活", "Rg", TR_REGEN, -1 },
679 { "浮", "Lv", TR_LEVITATION, -1 },
680 { "明", "Lu", TR_LITE_1, -1 },
681 { "明", "Lu", TR_LITE_2, -1 },
682 { "明", "Lu", TR_LITE_3, -1 },
683 { "闇", "Dl", TR_LITE_M1, -1 },
684 { "闇", "Dl", TR_LITE_M2, -1 },
685 { "闇", "Dl", TR_LITE_M3, -1 },
686 { "警", "Wr", TR_WARNING, -1 },
687 { "倍", "Xm", TR_XTRA_MIGHT, -1 },
688 { "射", "Xs", TR_XTRA_SHOTS, -1 },
689 { "瞬", "Te", TR_TELEPORT, -1 },
690 { "怒", "Ag", TR_AGGRAVATE, -1 },
691 { "祝", "Bs", TR_BLESSED, -1 },
692 { "忌", "Ty", TR_TY_CURSE, -1 },
693 { "呪", "C-", TR_ADD_L_CURSE, -1 },
694 { "詛", "C+", TR_ADD_H_CURSE, -1 },
695 { NULL, NULL, 0, -1 }
698 /*! オブジェクトの特性表示記号テーブルの定義(オーラ) */
699 static flag_insc_table flag_insc_aura[] =
701 { "炎", "F", TR_SH_FIRE, -1 },
702 { "電", "E", TR_SH_ELEC, -1 },
703 { "冷", "C", TR_SH_COLD, -1 },
704 { "魔", "M", TR_NO_MAGIC, -1 },
705 { "瞬", "T", TR_NO_TELE, -1 },
706 { NULL, NULL, 0, -1 }
709 /*! オブジェクトの特性表示記号テーブルの定義(属性スレイ) */
710 static flag_insc_table flag_insc_brand[] =
712 { "酸", "A", TR_BRAND_ACID, -1 },
713 { "電", "E", TR_BRAND_ELEC, -1 },
714 { "焼", "F", TR_BRAND_FIRE, -1 },
715 { "凍", "Co", TR_BRAND_COLD, -1 },
716 { "毒", "P", TR_BRAND_POIS, -1 },
717 { "沌", "Ca", TR_CHAOTIC, -1 },
718 { "吸", "V", TR_VAMPIRIC, -1 },
719 { "震", "Q", TR_IMPACT, -1 },
720 { "切", "S", TR_VORPAL, -1 },
721 { "理", "M", TR_FORCE_WEAPON, -1 },
722 { NULL, NULL, 0, -1 }
725 /*! オブジェクトの特性表示記号テーブルの定義(種族スレイ) */
726 static flag_insc_table flag_insc_kill[] =
728 { "邪", "*", TR_KILL_EVIL, -1 },
729 { "人", "p", TR_KILL_HUMAN, -1 },
730 { "龍", "D", TR_KILL_DRAGON, -1 },
731 { "オ", "o", TR_KILL_ORC, -1 },
732 { "ト", "T", TR_KILL_TROLL, -1 },
733 { "巨", "P", TR_KILL_GIANT, -1 },
734 { "デ", "U", TR_KILL_DEMON, -1 },
735 { "死", "L", TR_KILL_UNDEAD, -1 },
736 { "動", "Z", TR_KILL_ANIMAL, -1 },
737 { NULL, NULL, 0, -1 }
740 /*! オブジェクトの特性表示記号テーブルの定義(種族*スレイ*) */
741 static flag_insc_table flag_insc_slay[] =
743 { "邪", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
744 { "人", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
745 { "竜", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
746 { "オ", "o", TR_SLAY_ORC, TR_KILL_ORC },
747 { "ト", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
748 { "巨", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
749 { "デ", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
750 { "死", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
751 { "動", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
752 { NULL, NULL, 0, -1 }
755 /*! オブジェクトの特性表示記号テーブルの定義(ESP1) */
756 static flag_insc_table flag_insc_esp1[] =
758 { "感", "Tele", TR_TELEPATHY, -1 },
759 { "邪", "Evil", TR_ESP_EVIL, -1 },
760 { "善", "Good", TR_ESP_GOOD, -1 },
761 { "無", "Nolv", TR_ESP_NONLIVING, -1 },
762 { "個", "Uniq", TR_ESP_UNIQUE, -1 },
763 { NULL, NULL, 0, -1 }
766 /*! オブジェクトの特性表示記号テーブルの定義(ESP2) */
767 static flag_insc_table flag_insc_esp2[] =
769 { "人", "p", TR_ESP_HUMAN, -1 },
770 { "竜", "D", TR_ESP_DRAGON, -1 },
771 { "オ", "o", TR_ESP_ORC, -1 },
772 { "ト", "T", TR_ESP_TROLL, -1 },
773 { "巨", "P", TR_ESP_GIANT, -1 },
774 { "デ", "U", TR_ESP_DEMON, -1 },
775 { "死", "L", TR_ESP_UNDEAD, -1 },
776 { "動", "Z", TR_ESP_ANIMAL, -1 },
777 { NULL, NULL, 0, -1 }
780 /*! オブジェクトの特性表示記号テーブルの定義(能力維持) */
781 static flag_insc_table flag_insc_sust[] =
783 { "腕", "St", TR_SUST_STR, -1 },
784 { "知", "In", TR_SUST_INT, -1 },
785 { "賢", "Wi", TR_SUST_WIS, -1 },
786 { "器", "Dx", TR_SUST_DEX, -1 },
787 { "耐", "Cn", TR_SUST_CON, -1 },
788 { "魅", "Ch", TR_SUST_CHR, -1 },
789 { NULL, NULL, 0, -1 }
793 static flag_insc_table flag_insc_plus[] =
795 { "At", TR_BLOWS, -1 },
796 { "Sp", TR_SPEED, -1 },
797 { "St", TR_STR, -1 },
798 { "In", TR_INT, -1 },
799 { "Wi", TR_WIS, -1 },
800 { "Dx", TR_DEX, -1 },
801 { "Cn", TR_CON, -1 },
802 { "Ch", TR_CHR, -1 },
803 { "Md", TR_MAGIC_MASTERY, -1 },
804 { "Sl", TR_STEALTH, -1 },
805 { "Sr", TR_SEARCH, -1 },
806 { "If", TR_INFRA, -1 },
807 { "Dg", TR_TUNNEL, -1 },
811 static flag_insc_table flag_insc_immune[] =
813 { "Ac", TR_IM_ACID, -1 },
814 { "El", TR_IM_ELEC, -1 },
815 { "Fi", TR_IM_FIRE, -1 },
816 { "Co", TR_IM_COLD, -1 },
820 static flag_insc_table flag_insc_resistance[] =
822 { "Ac", TR_RES_ACID, TR_IM_ACID },
823 { "El", TR_RES_ELEC, TR_IM_ELEC },
824 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
825 { "Co", TR_RES_COLD, TR_IM_COLD },
826 { "Po", TR_RES_POIS, -1 },
827 { "Li", TR_RES_LITE, -1 },
828 { "Dk", TR_RES_DARK, -1 },
829 { "Sh", TR_RES_SHARDS, -1 },
830 { "Bl", TR_RES_BLIND, -1 },
831 { "Cf", TR_RES_CONF, -1 },
832 { "So", TR_RES_SOUND, -1 },
833 { "Nt", TR_RES_NETHER, -1 },
834 { "Nx", TR_RES_NEXUS, -1 },
835 { "Ca", TR_RES_CHAOS, -1 },
836 { "Di", TR_RES_DISEN, -1 },
837 { "Fe", TR_RES_FEAR, -1 },
841 static flag_insc_table flag_insc_misc[] =
843 { "Es", TR_EASY_SPELL, -1 },
844 { "Dm", TR_DEC_MANA, -1 },
845 { "Th", TR_THROW, -1 },
846 { "Rf", TR_REFLECT, -1 },
847 { "Fa", TR_FREE_ACT, -1 },
848 { "Si", TR_SEE_INVIS, -1 },
849 { "Hl", TR_HOLD_EXP, -1 },
850 { "Sd", TR_SLOW_DIGEST, -1 },
851 { "Rg", TR_REGEN, -1 },
852 { "Lv", TR_LEVITATION, -1 },
853 { "Lu", TR_LITE_1, -1 },
854 { "Lu", TR_LITE_2, -1 },
855 { "Lu", TR_LITE_3, -1 },
856 { "Dl", TR_LITE_M1, -1 },
857 { "Dl", TR_LITE_M2, -1 },
858 { "Dl", TR_LITE_M3, -1 },
859 { "Wr", TR_WARNING, -1 },
860 { "Xm", TR_XTRA_MIGHT, -1 },
861 { "Xs", TR_XTRA_SHOTS, -1 },
862 { "Te", TR_TELEPORT, -1 },
863 { "Ag", TR_AGGRAVATE, -1 },
864 { "Bs", TR_BLESSED, -1 },
865 { "Ty", TR_TY_CURSE, -1 },
866 { "C-", TR_ADD_L_CURSE, -1 },
867 { "C+", TR_ADD_H_CURSE, -1 },
871 static flag_insc_table flag_insc_aura[] =
873 { "F", TR_SH_FIRE, -1 },
874 { "E", TR_SH_ELEC, -1 },
875 { "C", TR_SH_COLD, -1 },
876 { "M", TR_NO_MAGIC, -1 },
877 { "T", TR_NO_TELE, -1 },
881 static flag_insc_table flag_insc_brand[] =
883 { "A", TR_BRAND_ACID, -1 },
884 { "E", TR_BRAND_ELEC, -1 },
885 { "F", TR_BRAND_FIRE, -1 },
886 { "Co", TR_BRAND_COLD, -1 },
887 { "P", TR_BRAND_POIS, -1 },
888 { "Ca", TR_CHAOTIC, -1 },
889 { "V", TR_VAMPIRIC, -1 },
890 { "Q", TR_IMPACT, -1 },
891 { "S", TR_VORPAL, -1 },
892 { "M", TR_FORCE_WEAPON, -1 },
896 static flag_insc_table flag_insc_kill[] =
898 { "*", TR_KILL_EVIL, -1 },
899 { "p", TR_KILL_HUMAN, -1 },
900 { "D", TR_KILL_DRAGON, -1 },
901 { "o", TR_KILL_ORC, -1 },
902 { "T", TR_KILL_TROLL, -1 },
903 { "P", TR_KILL_GIANT, -1 },
904 { "U", TR_KILL_DEMON, -1 },
905 { "L", TR_KILL_UNDEAD, -1 },
906 { "Z", TR_KILL_ANIMAL, -1 },
910 static flag_insc_table flag_insc_slay[] =
912 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
913 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
914 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
915 { "o", TR_SLAY_ORC, TR_KILL_ORC },
916 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
917 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
918 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
919 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
920 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
924 static flag_insc_table flag_insc_esp1[] =
926 { "Tele", TR_TELEPATHY, -1 },
927 { "Evil", TR_ESP_EVIL, -1 },
928 { "Good", TR_ESP_GOOD, -1 },
929 { "Nolv", TR_ESP_NONLIVING, -1 },
930 { "Uniq", TR_ESP_UNIQUE, -1 },
934 static flag_insc_table flag_insc_esp2[] =
936 { "p", TR_ESP_HUMAN, -1 },
937 { "D", TR_ESP_DRAGON, -1 },
938 { "o", TR_ESP_ORC, -1 },
939 { "T", TR_ESP_TROLL, -1 },
940 { "P", TR_ESP_GIANT, -1 },
941 { "U", TR_ESP_DEMON, -1 },
942 { "L", TR_ESP_UNDEAD, -1 },
943 { "Z", TR_ESP_ANIMAL, -1 },
947 static flag_insc_table flag_insc_sust[] =
949 { "St", TR_SUST_STR, -1 },
950 { "In", TR_SUST_INT, -1 },
951 { "Wi", TR_SUST_WIS, -1 },
952 { "Dx", TR_SUST_DEX, -1 },
953 { "Cn", TR_SUST_CON, -1 },
954 { "Ch", TR_SUST_CHR, -1 },
959 /* オブジェクトフラグを追加するための簡易なマクロ / Simple macro for get_inscription() */
960 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
963 * @brief get_inscriptionのサブセットとしてオブジェクトの特性フラグを返す / Helper function for get_inscription()
964 * @param fi_ptr 参照する特性表示記号テーブル
965 * @param flgs 対応するオブジェクトのフラグ文字列
966 * @param kanji TRUEならば漢字記述/FALSEならば英語記述
967 * @param ptr フラグ群を保管する文字列参照ポインタ
968 * @return フラグ群を保管する文字列参照ポインタ(ptrと同じ)
970 * Print an signed number "v" into a string "t", as if by
971 * sprintf(t, "%+d", n), and return a pointer to the terminator.
972 * Note that we always print a sign, either "+" or "-".
974 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
980 while (fi_ptr->english)
982 if (have_flag(flgs, fi_ptr->flag) &&
983 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
985 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
987 ADD_INSC(fi_ptr->english);
997 * @brief オブジェクトの特性表示記号テーブル1つに従いオブジェクトの特性フラグ配列に1つでも該当の特性があるかを返す / Special variation of have_flag for auto-inscription
998 * @param fi_ptr 参照する特性表示記号テーブル
999 * @param flgs 対応するオブジェクトのフラグ文字列
1000 * @return 1つでも該当の特性があったらTRUEを返す。
1002 static bool have_flag_of(flag_insc_table *fi_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
1004 while (fi_ptr->english)
1006 if (have_flag(flgs, fi_ptr->flag) &&
1007 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
1016 * @brief オブジェクト名の特性短縮表記をまとめて提示する。
1017 * @param ptr 特性短縮表記を格納する文字列ポインタ
1018 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1019 * @param kanji TRUEならば漢字表記 / FALSEなら英語表記
1020 * @param all TRUEならばベースアイテム上で明らかなフラグは省略する
1021 * @return ptrと同じアドレス
1023 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
1025 char *prev_ptr = ptr;
1026 BIT_FLAGS flgs[TR_FLAG_SIZE];
1027 object_flags(o_ptr, flgs);
1029 /* Remove obvious flags */
1032 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1036 for (j = 0; j < TR_FLAG_SIZE; j++)
1037 flgs[j] &= ~k_ptr->flags[j];
1039 if (object_is_fixed_artifact(o_ptr))
1041 artifact_type *a_ptr = &a_info[o_ptr->name1];
1043 for (j = 0; j < TR_FLAG_SIZE; j++)
1044 flgs[j] &= ~a_ptr->flags[j];
1047 if (object_is_ego(o_ptr))
1049 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1051 for (j = 0; j < TR_FLAG_SIZE; j++)
1052 flgs[j] &= ~e_ptr->flags[j];
1056 /* Remove lite flags when this is a dark lite object */
1057 if (have_dark_flag(flgs))
1059 if (have_flag(flgs, TR_LITE_1)) remove_flag(flgs, TR_LITE_1);
1060 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1061 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1063 else if (have_lite_flag(flgs))
1065 add_flag(flgs, TR_LITE_1);
1066 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1067 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1071 if (have_flag_of(flag_insc_plus, flgs))
1076 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
1079 if (have_flag_of(flag_insc_immune, flgs))
1081 if (!kanji && ptr != prev_ptr)
1088 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
1091 if (have_flag_of(flag_insc_resistance, flgs))
1095 else if (ptr != prev_ptr)
1101 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1104 if (have_flag_of(flag_insc_misc, flgs))
1106 if (ptr != prev_ptr)
1112 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1115 if (have_flag_of(flag_insc_aura, flgs))
1119 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1122 if (have_flag_of(flag_insc_brand, flgs))
1124 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1127 if (have_flag_of(flag_insc_kill, flgs))
1129 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1132 if (have_flag_of(flag_insc_slay, flgs))
1134 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1139 if (have_flag_of(flag_insc_esp1, flgs) ||
1140 have_flag_of(flag_insc_esp2, flgs))
1142 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1143 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1147 if (have_flag_of(flag_insc_esp1, flgs))
1149 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1150 if (have_flag_of(flag_insc_esp2, flgs))
1152 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1156 if (have_flag_of(flag_insc_sust, flgs))
1160 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1169 * @brief オブジェクト名の特性短縮表記+刻み内容を提示する。 / Get object inscription with auto inscription of object flags.
1170 * @param buff 特性短縮表記を格納する文字列ポインタ
1171 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1174 static void get_inscription(char *buff, object_type *o_ptr)
1176 concptr insc = quark_str(o_ptr->inscription);
1179 /* Not fully identified */
1180 if (!(o_ptr->ident & IDENT_MENTAL))
1182 /* Copy until end of line or '#' */
1185 if (*insc == '#') break;
1187 if (iskanji(*insc)) *buff++ = *insc++;
1197 for (; *insc; insc++)
1199 /* Ignore fake artifact inscription */
1200 if (*insc == '#') break;
1202 /* {%} will be automatically converted */
1203 else if ('%' == *insc)
1207 concptr start = ptr;
1209 /* check for too long inscription */
1210 if (ptr >= buff + MAX_NLEN) continue;
1223 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1233 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1248 * @brief オブジェクトの各表記を返すメイン関数 / Creates a description of the item "o_ptr", and stores it in "out_val".
1249 * @param buf 表記を返すための文字列参照ポインタ
1250 * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
1251 * @param mode 表記に関するオプション指定
1252 * @return 現在クエスト達成目的のアイテムならばTRUEを返す。
1254 * One can choose the "verbosity" of the description, including whether\n
1255 * or not the "number" of items should be described, and how much detail\n
1256 * should be used when describing the item.\n
1258 * The given "buf" must be MAX_NLEN chars long to hold the longest possible\n
1259 * description, which can get pretty long, including incriptions, such as:\n
1260 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".\n
1261 * Note that the inscription will be clipped to keep the total description\n
1262 * under MAX_NLEN-1 chars (plus a terminator).\n
1264 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,\n
1265 * portable, versions of some common "sprintf()" commands.\n
1267 * Note that all ego-items (when known) append an "Ego-Item Name", unless\n
1268 * the item is also an artifact, which should NEVER happen.\n
1270 * Note that all artifacts (when known) append an "Artifact Name", so we\n
1271 * have special processing for "Specials" (artifact Lites, Rings, Amulets).\n
1272 * The "Specials" never use "modifiers" if they are "known", since they\n
1273 * have special "descriptions", such as "The Necklace of the Dwarves".\n
1275 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),\n
1276 * plus the artifact name, just like any other artifact, if known.\n
1278 * Special Ring's and Amulet's, if not "aware", use the same code as normal\n
1279 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or\n
1280 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,\n
1281 * they will append the artifact name, just like any artifact, if known.\n
1283 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.\n
1286 * OD_NAME_ONLY : The Cloak of Death\n
1287 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]\n
1288 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)\n
1289 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}\n
1291 * OD_OMIT_PREFIX : Forbidden numeric prefix\n
1292 * OD_NO_PLURAL : Forbidden use of plural \n
1293 * OD_STORE : Assume to be aware and known\n
1294 * OD_NO_FLAVOR : Allow to hidden flavor\n
1295 * OD_FORCE_FLAVOR : Get un-shuffled flavor name\n
1297 void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
1299 /* Extract object kind name */
1300 concptr kindname = k_name + k_info[o_ptr->k_idx].name;
1302 /* Extract default "base" string */
1303 concptr basenm = kindname;
1305 /* Assume no "modifier" string */
1306 concptr modstr = "";
1315 bool show_weapon = FALSE;
1316 bool show_armour = FALSE;
1321 char p1 = '(', p2 = ')';
1322 char b1 = '[', b2 = ']';
1323 char c1 = '{', c2 = '}';
1325 char tmp_val[MAX_NLEN+160];
1326 char tmp_val2[MAX_NLEN+10];
1327 char fake_insc_buf[30];
1329 BIT_FLAGS flgs[TR_FLAG_SIZE];
1331 object_type *bow_ptr;
1333 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1334 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1336 /* Extract some flags */
1337 object_flags(o_ptr, flgs);
1339 /* See if the object is "aware" */
1340 if (object_is_aware(o_ptr)) aware = TRUE;
1342 /* See if the object is "known" */
1343 if (object_is_known(o_ptr)) known = TRUE;
1345 /* Allow flavors to be hidden when aware */
1346 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1348 /* Object is in the p_ptr->inventory_list of a store or spoiler */
1349 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1351 /* Don't show flavors */
1354 /* Pretend known and aware */
1359 /* Force to be flavor name only */
1360 if (mode & OD_FORCE_FLAVOR)
1366 /* Cancel shuffling */
1367 flavor_k_ptr = k_ptr;
1370 /* Analyze the object */
1371 switch (o_ptr->tval)
1373 /* Some objects are easy to describe */
1387 monster_race *r_ptr = &r_info[o_ptr->pval];
1393 modstr = _(" (空)", " (empty)");
1398 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1401 concptr t = r_name + r_ptr->name;
1403 if (!(r_ptr->flags1 & RF1_UNIQUE))
1405 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1411 sprintf(tmp_val2, "(%s)", t);
1421 /* Figurines/Statues */
1425 monster_race *r_ptr = &r_info[o_ptr->pval];
1428 modstr = r_name + r_ptr->name;
1430 concptr t = r_name + r_ptr->name;
1432 if (!(r_ptr->flags1 & RF1_UNIQUE))
1434 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1451 monster_race *r_ptr = &r_info[o_ptr->pval];
1453 modstr = r_name + r_ptr->name;
1458 if (r_ptr->flags1 & RF1_UNIQUE)
1459 basenm = "& % of #";
1467 /* Missiles/ Bows/ Weapons */
1496 /* Lites (including a few "Specials") */
1502 /* Amulets (including a few "Specials") */
1505 /* Known artifacts */
1508 if (object_is_fixed_artifact(o_ptr)) break;
1509 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1512 /* Color the object */
1513 modstr = k_name + flavor_k_ptr->flavor_name;
1516 if (!flavor) basenm = "%のアミュレット";
1517 else if (aware) basenm = "%の#アミュレット";
1518 else basenm = "#アミュレット";
1520 if (!flavor) basenm = "& Amulet~ of %";
1521 else if (aware) basenm = "& # Amulet~ of %";
1522 else basenm = "& # Amulet~";
1528 /* Rings (including a few "Specials") */
1531 /* Known artifacts */
1534 if (object_is_fixed_artifact(o_ptr)) break;
1535 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1538 /* Color the object */
1539 modstr = k_name + flavor_k_ptr->flavor_name;
1542 if (!flavor) basenm = "%の指輪";
1543 else if (aware) basenm = "%の#指輪";
1544 else basenm = "#指輪";
1546 if (!flavor) basenm = "& Ring~ of %";
1547 else if (aware) basenm = "& # Ring~ of %";
1548 else basenm = "& # Ring~";
1551 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1563 /* Color the object */
1564 modstr = k_name + flavor_k_ptr->flavor_name;
1567 if (!flavor) basenm = "%の杖";
1568 else if (aware) basenm = "%の#杖";
1571 if (!flavor) basenm = "& Staff~ of %";
1572 else if (aware) basenm = "& # Staff~ of %";
1573 else basenm = "& # Staff~";
1581 /* Color the object */
1582 modstr = k_name + flavor_k_ptr->flavor_name;
1585 if (!flavor) basenm = "%の魔法棒";
1586 else if (aware) basenm = "%の#魔法棒";
1587 else basenm = "#魔法棒";
1589 if (!flavor) basenm = "& Wand~ of %";
1590 else if (aware) basenm = "& # Wand~ of %";
1591 else basenm = "& # Wand~";
1599 /* Color the object */
1600 modstr = k_name + flavor_k_ptr->flavor_name;
1603 if (!flavor) basenm = "%のロッド";
1604 else if (aware) basenm = "%の#ロッド";
1605 else basenm = "#ロッド";
1607 if (!flavor) basenm = "& Rod~ of %";
1608 else if (aware) basenm = "& # Rod~ of %";
1609 else basenm = "& # Rod~";
1617 /* Color the object */
1618 modstr = k_name + flavor_k_ptr->flavor_name;
1621 if (!flavor) basenm = "%の巻物";
1622 else if (aware) basenm = "「#」と書かれた%の巻物";
1623 else basenm = "「#」と書かれた巻物";
1625 if (!flavor) basenm = "& Scroll~ of %";
1626 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1627 else basenm = "& Scroll~ titled \"#\"";
1635 /* Color the object */
1636 modstr = k_name + flavor_k_ptr->flavor_name;
1639 if (!flavor) basenm = "%の薬";
1640 else if (aware) basenm = "%の#薬";
1643 if (!flavor) basenm = "& Potion~ of %";
1644 else if (aware) basenm = "& # Potion~ of %";
1645 else basenm = "& # Potion~";
1653 /* Ordinary food is "boring" */
1654 if (!k_ptr->flavor_name) break;
1656 /* Color the object */
1657 modstr = k_name + flavor_k_ptr->flavor_name;
1660 if (!flavor) basenm = "%のキノコ";
1661 else if (aware) basenm = "%の#キノコ";
1662 else basenm = "#キノコ";
1664 if (!flavor) basenm = "& Mushroom~ of %";
1665 else if (aware) basenm = "& # Mushroom~ of %";
1666 else basenm = "& # Mushroom~";
1674 basenm = _("羊皮紙 - %", "& Parchment~ - %");
1684 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1685 basenm = "& Book~ of Life Magic %";
1687 basenm = "& Life Spellbook~ %";
1693 case TV_SORCERY_BOOK:
1698 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1699 basenm = "& Book~ of Sorcery %";
1701 basenm = "& Sorcery Spellbook~ %";
1707 case TV_NATURE_BOOK:
1712 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1713 basenm = "& Book~ of Nature Magic %";
1715 basenm = "& Nature Spellbook~ %";
1724 basenm = "カオスの魔法書%";
1726 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1727 basenm = "& Book~ of Chaos Magic %";
1729 basenm = "& Chaos Spellbook~ %";
1740 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1741 basenm = "& Book~ of Death Magic %";
1743 basenm = "& Death Spellbook~ %";
1752 basenm = "トランプの魔法書%";
1754 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1755 basenm = "& Book~ of Trump Magic %";
1757 basenm = "& Trump Spellbook~ %";
1763 case TV_ARCANE_BOOK:
1768 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1769 basenm = "& Book~ of Arcane Magic %";
1771 basenm = "& Arcane Spellbook~ %";
1782 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1783 basenm = "& Book~ of Craft Magic %";
1785 basenm = "& Craft Spellbook~ %";
1791 case TV_DAEMON_BOOK:
1796 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1797 basenm = "& Book~ of Daemon Magic %";
1799 basenm = "& Daemon Spellbook~ %";
1805 case TV_CRUSADE_BOOK:
1810 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1811 basenm = "& Book~ of Crusade Magic %";
1813 basenm = "& Crusade Spellbook~ %";
1821 basenm = _("歌集%", "& Song Book~ %");
1825 case TV_HISSATSU_BOOK:
1827 basenm = _("& 武芸の書%", "Book~ of Kendo %");
1836 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1837 basenm = "& Book~ of Hex Magic %";
1839 basenm = "& Hex Spellbook~ %";
1845 /* Hack -- Gold/Gems */
1848 strcpy(buf, basenm);
1852 /* Used in the "p_ptr->inventory_list" routine */
1855 strcpy(buf, _("(なし)", "(nothing)"));
1860 /* Use full name from k_info or a_info */
1861 if (aware && have_flag(flgs, TR_FULL_NAME))
1863 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1864 else basenm = kindname;
1867 /* Start dumping the result */
1871 if (basenm[0] == '&')
1877 if (mode & OD_OMIT_PREFIX)
1881 else if (o_ptr->number > 1)
1883 t = object_desc_kosuu(t, o_ptr);
1884 t = object_desc_str(t, "の ");
1887 /* 英語の場合アーティファクトは The が付くので分かるが
1888 * 日本語では分からないのでマークをつける
1892 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "★");
1893 else if (o_ptr->art_name) t = object_desc_str(t, "☆");
1898 /* The object "expects" a "number" */
1899 if (basenm[0] == '&')
1901 /* Skip the ampersand (and space) */
1905 if (mode & OD_OMIT_PREFIX)
1910 /* Hack -- None left */
1911 else if (o_ptr->number <= 0)
1913 t = object_desc_str(t, "no more ");
1916 /* Extract the number */
1917 else if (o_ptr->number > 1)
1919 t = object_desc_num(t, o_ptr->number);
1920 t = object_desc_chr(t, ' ');
1923 /* Hack -- The only one of its kind */
1924 else if ((known && object_is_artifact(o_ptr)) ||
1925 ((o_ptr->tval == TV_CORPSE) &&
1926 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1928 t = object_desc_str(t, "The ");
1938 case '#': vowel = is_a_vowel(modstr[0]); break;
1939 case '%': vowel = is_a_vowel(*kindname); break;
1940 default: vowel = is_a_vowel(*s); break;
1945 /* A single one, with a vowel */
1946 t = object_desc_str(t, "an ");
1950 /* A single one, without a vowel */
1951 t = object_desc_str(t, "a ");
1956 /* Hack -- objects that "never" take an article */
1963 if (mode & OD_OMIT_PREFIX)
1968 /* Hack -- all gone */
1969 else if (o_ptr->number <= 0)
1971 t = object_desc_str(t, "no more ");
1974 /* Prefix a number if required */
1975 else if (o_ptr->number > 1)
1977 t = object_desc_num(t, o_ptr->number);
1978 t = object_desc_chr(t, ' ');
1981 /* Hack -- The only one of its kind */
1982 else if (known && object_is_artifact(o_ptr))
1984 t = object_desc_str(t, "The ");
1987 /* Hack -- single items get no prefix */
1995 /* Paranoia -- skip illegal tildes */
1996 /* while (*s == '~') s++; */
1999 if (object_is_smith(o_ptr))
2001 t = object_desc_str(t, format("鍛冶師%sの", p_ptr->name));
2004 /* 伝説のアイテム、名のあるアイテムの名前を付加する */
2008 if (o_ptr->art_name)
2010 concptr temp = quark_str(o_ptr->art_name);
2012 /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
2013 /* 英語版のセーブファイルから来た 'of XXX' は,「XXXの」と表示する */
2014 if (strncmp(temp, "of ", 3) == 0)
2016 t = object_desc_str(t, &temp[3]);
2017 t = object_desc_str(t, "の");
2019 else if ((strncmp(temp, "『", 2) != 0) &&
2020 (strncmp(temp, "《", 2) != 0) &&
2022 t = object_desc_str(t, temp);
2025 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
2027 artifact_type *a_ptr = &a_info[o_ptr->name1];
2028 /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
2029 if (strncmp(a_name + a_ptr->name, "『", 2) != 0)
2031 t = object_desc_str(t, a_name + a_ptr->name);
2035 else if (object_is_ego(o_ptr))
2037 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2038 t = object_desc_str(t, e_name + e_ptr->name);
2043 /* Copy the string */
2044 for (s0 = NULL; *s || s0; )
2046 /* The end of the flavour/kind string. */
2053 /* Begin to append the modifier (flavor) */
2054 else if ((*s == '#') && !s0)
2059 /* Paranoia -- Never append multiple modstrs */
2063 /* Begin to append the kind name */
2064 else if ((*s == '%') && !s0)
2069 /* Paranoia -- Never append multiple kindnames */
2077 /* Add a plural if needed */
2078 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2084 /* Hack -- "Cutlass-es" and "Torch-es" */
2085 if ((k == 's') || (k == 'h')) *t++ = 'e';
2107 /* '『'から始まる伝説のアイテムの名前は最後に付加する */
2110 /* ランダムアーティファクトの名前はセーブファイルに記録
2111 されるので、英語版の名前もそれらしく変換する */
2112 if (o_ptr->art_name)
2116 strcpy(temp, quark_str(o_ptr->art_name));
2117 /* MEGA HACK by ita */
2118 if (strncmp(temp, "『", 2) == 0 ||
2119 strncmp(temp, "《", 2) == 0)
2120 t = object_desc_str(t, temp);
2121 else if (temp[0] == '\'')
2123 itemp = strlen(temp);
2124 temp[itemp - 1] = 0;
2125 t = object_desc_str(t, "『");
2126 t = object_desc_str(t, &temp[1]);
2127 t = object_desc_str(t, "』");
2130 else if (object_is_fixed_artifact(o_ptr))
2132 artifact_type *a_ptr = &a_info[o_ptr->name1];
2133 if (strncmp(a_name + a_ptr->name, "『", 2) == 0)
2135 t = object_desc_str(t, a_name + a_ptr->name);
2138 else if (o_ptr->inscription)
2140 concptr str = quark_str(o_ptr->inscription);
2149 if (*str == '#') break;
2155 concptr str_aux = my_strchr(quark_str(o_ptr->inscription), '#');
2157 /* Add the false name */
2158 t = object_desc_str(t,"『");
2159 t = object_desc_str(t, &str_aux[1]);
2160 t = object_desc_str(t,"』");
2165 if (object_is_smith(o_ptr))
2167 t = object_desc_str(t,format(" of %s the Smith",p_ptr->name));
2170 /* Hack -- Append "Artifact" or "Special" names */
2171 if (known && !have_flag(flgs, TR_FULL_NAME))
2173 /* Is it a new random artifact ? */
2174 if (o_ptr->art_name)
2176 t = object_desc_chr(t, ' ');
2177 t = object_desc_str(t, quark_str(o_ptr->art_name));
2180 /* Grab any artifact name */
2181 else if (object_is_fixed_artifact(o_ptr))
2183 artifact_type *a_ptr = &a_info[o_ptr->name1];
2185 t = object_desc_chr(t, ' ');
2186 t = object_desc_str(t, a_name + a_ptr->name);
2189 /* Grab any ego-item name */
2192 if (object_is_ego(o_ptr))
2194 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2196 t = object_desc_chr(t, ' ');
2197 t = object_desc_str(t, e_name + e_ptr->name);
2200 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2203 concptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2205 /* Add the false name */
2206 t = object_desc_chr(t, ' ');
2207 t = object_desc_str(t, &str[1]);
2214 /* No more details wanted */
2215 if (mode & OD_NAME_ONLY) goto object_desc_done;
2217 /* Hack -- Chests must be described in detail */
2218 if (o_ptr->tval == TV_CHEST)
2220 /* Not searched yet */
2226 /* May be "empty" */
2227 else if (!o_ptr->pval)
2229 t = object_desc_str(t, _("(空)", " (empty)"));
2232 /* May be "disarmed" */
2233 else if (o_ptr->pval < 0)
2235 if (chest_traps[0 - o_ptr->pval])
2237 t = object_desc_str(t, _("(解除済)", " (disarmed)"));
2241 t = object_desc_str(t, _("(非施錠)", " (unlocked)"));
2245 /* Describe the traps, if any */
2248 /* Describe the traps */
2249 switch (chest_traps[o_ptr->pval])
2253 t = object_desc_str(t, _("(施錠)", " (Locked)"));
2256 case CHEST_LOSE_STR:
2258 t = object_desc_str(t, _("(毒針)", " (Poison Needle)"));
2261 case CHEST_LOSE_CON:
2263 t = object_desc_str(t, _("(毒針)", " (Poison Needle)"));
2268 t = object_desc_str(t, _("(ガス・トラップ)", " (Gas Trap)"));
2271 case CHEST_PARALYZE:
2273 t = object_desc_str(t, _("(ガス・トラップ)", " (Gas Trap)"));
2278 t = object_desc_str(t, _("(爆発装置)", " (Explosion Device)"));
2282 case CHEST_BIRD_STORM:
2283 case CHEST_E_SUMMON:
2284 case CHEST_H_SUMMON:
2286 t = object_desc_str(t, _("(召喚のルーン)", " (Summoning Runes)"));
2289 case CHEST_RUNES_OF_EVIL:
2291 t = object_desc_str(t, _("(邪悪なルーン)", " (Gleaming Black Runes)"));
2296 t = object_desc_str(t, _("(警報装置)", " (Alarm)"));
2301 t = object_desc_str(t, _("(マルチ・トラップ)", " (Multiple Traps)"));
2309 /* Display the item like a weapon */
2310 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2312 /* Display the item like a weapon */
2313 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2316 /* Display the item like a weapon */
2317 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2319 /* Display the item like armour */
2320 if (o_ptr->ac) show_armour = TRUE;
2323 /* Dump base weapon info */
2324 switch (o_ptr->tval)
2326 /* Missiles and Weapons */
2335 /* In Vault Quest, hide the dice of target weapon. */
2336 if(object_is_quest_target(o_ptr) && !known)
2341 /* Append a "damage" string */
2342 t = object_desc_chr(t, ' ');
2343 t = object_desc_chr(t, p1);
2344 t = object_desc_num(t, o_ptr->dd);
2345 t = object_desc_chr(t, 'd');
2346 t = object_desc_num(t, o_ptr->ds);
2347 t = object_desc_chr(t, p2);
2353 /* Bows get a special "damage string" */
2356 /* Mega-Hack -- Extract the "base power" */
2357 power = bow_tmul(o_ptr->sval);
2359 /* Apply the "Extra Might" flag */
2360 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2362 /* Append a special "damage" string */
2363 t = object_desc_chr(t, ' ');
2364 t = object_desc_chr(t, p1);
2365 t = object_desc_chr(t, 'x');
2366 t = object_desc_num(t, power);
2367 t = object_desc_chr(t, p2);
2369 fire_rate = calc_num_fire(o_ptr);
2370 /* Show Fire rate */
2371 if (fire_rate != 0 && power > 0 && known)
2373 fire_rate = bow_energy(o_ptr->sval) / fire_rate;
2375 t = object_desc_chr(t, ' ');
2376 t = object_desc_chr(t, p1);
2377 t = object_desc_num(t, fire_rate/100);
2378 t = object_desc_chr(t, '.');
2379 t = object_desc_num(t, fire_rate%100);
2380 t = object_desc_str(t, "turn");
2381 t = object_desc_chr(t, p2);
2389 /* Add the weapon bonuses */
2392 /* Show the tohit/todam on request */
2395 t = object_desc_chr(t, ' ');
2396 t = object_desc_chr(t, p1);
2397 t = object_desc_int(t, o_ptr->to_h);
2398 t = object_desc_chr(t, ',');
2399 t = object_desc_int(t, o_ptr->to_d);
2400 t = object_desc_chr(t, p2);
2403 /* Show the tohit if needed */
2404 else if (o_ptr->to_h)
2406 t = object_desc_chr(t, ' ');
2407 t = object_desc_chr(t, p1);
2408 t = object_desc_int(t, o_ptr->to_h);
2409 t = object_desc_chr(t, p2);
2412 /* Show the todam if needed */
2413 else if (o_ptr->to_d)
2415 t = object_desc_chr(t, ' ');
2416 t = object_desc_chr(t, p1);
2417 t = object_desc_int(t, o_ptr->to_d);
2418 t = object_desc_chr(t, p2);
2422 bow_ptr = &p_ptr->inventory_list[INVEN_BOW];
2424 /* If have a firing weapon + ammo matches bow */
2425 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2427 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2428 int tmul = bow_tmul(bow_ptr->sval);
2429 ENERGY energy_fire = bow_energy(bow_ptr->sval);
2431 /* See if the bow is "known" - then set damage bonus */
2432 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2434 /* Effect of ammo */
2435 if (known) avgdam += (o_ptr->to_d * 10);
2437 /* Get extra "power" from "extra might" */
2438 if (p_ptr->xtra_might) tmul++;
2440 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2442 /* Launcher multiplier */
2444 avgdam /= (100 * 10);
2446 /* Get extra damage from concentration */
2447 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2449 if (avgdam < 0) avgdam = 0;
2451 /* Display (shot damage/ shot damage with critical/ avg damage with critical) */
2452 t = object_desc_chr(t, ' ');
2453 t = object_desc_chr(t, p1);
2455 if(show_ammo_no_crit)
2457 /* Damage with no-crit */
2458 t = object_desc_num(t, avgdam);
2459 t = object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2462 /* Apply Expect damage of Critical */
2463 avgdam = calc_expect_crit_shot(o_ptr->weight, o_ptr->to_h, bow_ptr->to_h, avgdam);
2464 t = object_desc_num(t, avgdam);
2466 t = show_ammo_no_crit ? object_desc_str(t, show_ammo_detail ? "/crit " : "/")
2467 : object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2469 if (p_ptr->num_fire == 0)
2471 t = object_desc_chr(t, '0');
2475 /* Calc effects of energy */
2476 avgdam *= (p_ptr->num_fire * 100);
2477 avgdam /= energy_fire;
2478 t = object_desc_num(t, avgdam);
2479 t = object_desc_str(t, show_ammo_detail ? "/current_world_ptr->game_turn" : "");
2481 if(show_ammo_crit_ratio)
2483 int percent = calc_crit_ratio_shot(known ? o_ptr->to_h : 0, known ? bow_ptr->to_h : 0);
2485 t = object_desc_chr(t, '/');
2486 t = object_desc_num(t, percent / 100);
2487 t = object_desc_chr(t, '.');
2488 if(percent % 100 < 10)
2490 t = object_desc_chr(t, '0');
2492 t = object_desc_num(t, percent % 100);
2493 t = object_desc_str(t, show_ammo_detail ? "% crit" : "%");
2497 t = object_desc_chr(t, p2);
2499 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2501 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2502 s16b energy_fire = 100 - p_ptr->lev;
2504 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2506 /* Display (shot damage/ avg damage) */
2507 t = object_desc_chr(t, ' ');
2508 t = object_desc_chr(t, p1);
2509 t = object_desc_num(t, avgdam);
2510 t = object_desc_chr(t, '/');
2512 /* Calc effects of energy */
2513 avgdam = 100 * avgdam / energy_fire;
2515 t = object_desc_num(t, avgdam);
2516 t = object_desc_chr(t, p2);
2519 /* Add the armor bonuses */
2522 /* Show the armor class info */
2525 t = object_desc_chr(t, ' ');
2526 t = object_desc_chr(t, b1);
2527 t = object_desc_num(t, o_ptr->ac);
2528 t = object_desc_chr(t, ',');
2529 t = object_desc_int(t, o_ptr->to_a);
2530 t = object_desc_chr(t, b2);
2533 /* No base armor, but does increase armor */
2534 else if (o_ptr->to_a)
2536 t = object_desc_chr(t, ' ');
2537 t = object_desc_chr(t, b1);
2538 t = object_desc_int(t, o_ptr->to_a);
2539 t = object_desc_chr(t, b2);
2543 /* Hack -- always show base armor */
2544 else if (show_armour)
2546 t = object_desc_chr(t, ' ');
2547 t = object_desc_chr(t, b1);
2548 t = object_desc_num(t, o_ptr->ac);
2549 t = object_desc_chr(t, b2);
2553 /* No more details wanted */
2554 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2557 if (known) /* Known item only */
2560 * Hack -- Wands and Staffs have charges. Make certain how many charges
2561 * a stack of staffs really has is clear. -LM-
2563 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2565 /* Dump " (N charges)" */
2566 t = object_desc_chr(t, ' ');
2567 t = object_desc_chr(t, p1);
2569 /* Clear explaination for staffs. */
2570 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2572 t = object_desc_num(t, o_ptr->number);
2573 t = object_desc_str(t, "x ");
2575 t = object_desc_num(t, o_ptr->pval);
2577 t = object_desc_str(t, "回分");
2579 t = object_desc_str(t, " charge");
2580 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2583 t = object_desc_chr(t, p2);
2585 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2586 * be in any state of charge or discharge, this now includes a number. -LM-
2588 else if (o_ptr->tval == TV_ROD)
2590 /* Hack -- Dump " (# charging)" if relevant */
2593 /* Stacks of rods display an exact count of charging rods. */
2594 if (o_ptr->number > 1)
2597 if (k_ptr->pval == 0) k_ptr->pval = 1;
2599 /* Find out how many rods are charging, by dividing
2600 * current timeout by each rod's maximum timeout.
2601 * Ensure that any remainder is rounded up. Display
2602 * very discharged stacks as merely fully discharged.
2604 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2605 if (power > o_ptr->number) power = o_ptr->number;
2607 /* Display prettily. */
2608 t = object_desc_str(t, " (");
2609 t = object_desc_num(t, power);
2610 t = object_desc_str(t, _("本 充填中)", " charging)"));
2613 /* "one Rod of Perception (1 charging)" would look tacky. */
2616 t = object_desc_str(t, _("(充填中)", " (charging)"));
2621 /* Dump "pval" flags for wearable items */
2622 if (have_pval_flags(flgs))
2624 /* Start the display */
2625 t = object_desc_chr(t, ' ');
2626 t = object_desc_chr(t, p1);
2628 /* Dump the "pval" itself */
2629 t = object_desc_int(t, o_ptr->pval);
2631 /* Do not display the "pval" flags */
2632 if (have_flag(flgs, TR_HIDE_TYPE))
2637 else if (have_flag(flgs, TR_SPEED))
2639 /* Dump " to speed" */
2640 t = object_desc_str(t, _("加速", " to speed"));
2644 else if (have_flag(flgs, TR_BLOWS))
2648 t = object_desc_str(t, "攻撃");
2650 t = object_desc_str(t, " attack");
2653 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2658 else if (have_flag(flgs, TR_STEALTH))
2660 /* Dump " to stealth" */
2661 t = object_desc_str(t, _("隠密", " to stealth"));
2665 else if (have_flag(flgs, TR_SEARCH))
2667 /* Dump " to searching" */
2668 t = object_desc_str(t, _("探索", " to searching"));
2672 else if (have_flag(flgs, TR_INFRA))
2674 /* Dump " to infravision" */
2675 t = object_desc_str(t, _("赤外線視力", " to infravision"));
2678 /* Finish the display */
2679 t = object_desc_chr(t, p2);
2682 /* Hack -- Process Lanterns/Torches */
2683 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2685 /* Hack -- Turns of light for normal lites */
2687 t = object_desc_chr(t, '(');
2689 t = object_desc_str(t, " (with ");
2692 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2693 else t = object_desc_num(t, o_ptr->xtra4);
2694 t = object_desc_str(t, _("ターンの寿命)", " turns of light)"));
2697 /* Indicate charging objects, but not rods. */
2698 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2700 /* Hack -- Dump " (charging)" if relevant */
2701 t = object_desc_str(t, _("(充填中)", " (charging)"));
2706 /* No more details wanted */
2707 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2710 /* Prepare real inscriptions in a buffer */
2713 /* Auto abbreviation inscribe */
2714 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2716 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2727 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2731 /* Use the standard inscription if available */
2732 if (o_ptr->inscription)
2736 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2738 /* Get inscription and convert {%} */
2739 get_inscription(buff, o_ptr);
2741 /* strcat with correct treating of kanji */
2742 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2746 /* No fake inscription yet */
2747 fake_insc_buf[0] = '\0';
2749 /* Use the game-generated "feeling" otherwise, if available */
2752 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2755 /* Note "cursed" if the item is known to be cursed */
2756 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2758 strcpy(fake_insc_buf, _("呪われている", "cursed"));
2761 /* Note "unidentified" if the item is unidentified */
2762 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2763 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2765 && !(o_ptr->ident & IDENT_SENSE))
2767 strcpy(fake_insc_buf, _("未鑑定", "unidentified"));
2770 /* Mega-Hack -- note empty wands/staffs */
2771 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2773 strcpy(fake_insc_buf, _("空", "empty"));
2776 /* Note "tried" if the object has been tested unsuccessfully */
2777 else if (!aware && object_is_tried(o_ptr))
2779 strcpy(fake_insc_buf, _("未判明", "tried"));
2782 /* Note the discount, if any */
2783 if (o_ptr->discount)
2785 /* Hidden by real inscription unless in a store */
2786 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2788 char discount_num_buf[4];
2790 /* Append to other fake inscriptions if any */
2791 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2793 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2794 strcat(fake_insc_buf, discount_num_buf);
2795 strcat(fake_insc_buf, _("%引き", "% off"));
2800 /* Append the inscription, if any */
2801 if (fake_insc_buf[0] || tmp_val2[0])
2803 /* Append the inscription */
2804 t = object_desc_chr(t, ' ');
2805 t = object_desc_chr(t, c1);
2807 /* Append fake inscriptions */
2808 if (fake_insc_buf[0])
2810 t = object_desc_str(t, fake_insc_buf);
2813 /* Append a separater */
2814 if (fake_insc_buf[0] && tmp_val2[0])
2816 t = object_desc_chr(t, ',');
2817 t = object_desc_chr(t, ' ');
2820 /* Append real inscriptions */
2823 t = object_desc_str(t, tmp_val2);
2826 t = object_desc_chr(t, c2);
2830 my_strcpy(buf, tmp_val, MAX_NLEN);
2835 * @brief nameバッファ内からベースアイテム名を返す / Strip an "object name" into a buffer
2836 * @param buf ベースアイテム格納先の参照ポインタ
2837 * @param k_idx ベースアイテムID
2840 void strip_name(char *buf, KIND_OBJECT_IDX k_idx)
2844 object_kind *k_ptr = &k_info[k_idx];
2846 concptr str = (k_name + k_ptr->name);
2849 /* Skip past leading characters */
2850 while ((*str == ' ') || (*str == '&')) str++;
2852 /* Copy useful chars */
2853 for (t = buf; *str; str++)
2856 if (iskanji(*str)) { *t++ = *str++; *t++ = *str; continue; }
2858 if (*str != '~') *t++ = *str;
2861 /* Terminate the new name */