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 * @brief ºÇ½é¤«¤é´Ê°×¤Ê̾¾Î¤¬ÌÀ¤é¤«¤Ë¤Ê¤ë¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤ÎȽÄê¡£ / Certain items, if aware, are known instantly
17 * @param i ¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
18 * @return ´Ê°×̾¾Î¤òÌÀ¤é¤«¤Ë¤¹¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
20 * This function is used only by "flavor_init()"
22 static bool object_easy_know(int i)
24 object_kind *k_ptr = &k_info[i];
26 /* Analyze the "tval" */
41 case TV_HISSATSU_BOOK:
58 /* All Food, Potions, Scrolls, Rods */
73 * @brief ³Æ¼ï¸ì×䫤é¥é¥ó¥À¥à¤Ê̾Á°¤òºîÀ®¤¹¤ë / Create a name from random parts.
74 * @param out_string ºîÀ®¤·¤¿Ì¾¤òÊݴɤ¹¤ë»²¾È¥Ý¥¤¥ó¥¿
76 * @details ÆüËܸì¤Î¾ì¹ç aname_j.txt ±Ñ¸ì¤Î¾ì¹ç³ÎΨ¤Ë±þ¤¸¤Æ
77 * syllables ÇÛÎó¤È elvish.txt ¤òÁȤ߹ç¤ï¤»¤ë¡£\n
79 void get_table_name_aux(char *out_string)
83 get_rnd_line("aname_j.txt", 1, Syllable);
84 strcpy(out_string, Syllable);
85 get_rnd_line("aname_j.txt", 2, Syllable);
86 strcat(out_string, Syllable);
88 #define MAX_SYLLABLES 164 /* Used with scrolls (see below) */
90 static cptr syllables[MAX_SYLLABLES] = {
91 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
92 "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
93 "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
94 "byt", "comp", "con", "cos", "cre", "dalf", "dan",
95 "den", "der", "doe", "dok", "eep", "el", "eng", "er", "ere", "erk",
96 "esh", "evs", "fa", "fid", "flit", "for", "fri", "fu", "gan",
97 "gar", "glen", "gop", "gre", "ha", "he", "hyd", "i",
98 "ing", "ion", "ip", "ish", "it", "ite", "iv", "jo",
99 "kho", "kli", "klis", "la", "lech", "man", "mar",
100 "me", "mi", "mic", "mik", "mon", "mung", "mur", "nag", "nej",
101 "nelg", "nep", "ner", "nes", "nis", "nih", "nin", "o",
102 "od", "ood", "org", "orn", "ox", "oxy", "pay", "pet",
103 "ple", "plu", "po", "pot", "prok", "re", "rea", "rhov",
104 "ri", "ro", "rog", "rok", "rol", "sa", "san", "sat",
105 "see", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
106 "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab",
107 "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
108 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly",
109 "vom", "wah", "wed", "werg", "wex", "whon", "wun", "x",
110 "yerg", "yp", "zun", "tri", "blaa", "jah", "bul", "on",
114 int testcounter = randint1(3) + 1;
116 strcpy(out_string, "");
118 if (randint1(3) == 2)
120 while (testcounter--)
121 strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
126 testcounter = randint1(2) + 1;
127 while (testcounter--)
129 (void)get_rnd_line("elvish.txt", 0, Syllable);
130 strcat(out_string, Syllable);
134 out_string[0] = toupper(out_string[1]);
136 out_string[16] = '\0';
141 * @brief ¥é¥ó¥À¥à¤Ê̾Á°¤ò¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÌäȤ·¤ÆÀ°·Á¤¹¤ë¡£ / Create a name from random parts with quotes.
142 * @param out_string ºîÀ®¤·¤¿Ì¾¤òÊݴɤ¹¤ë»²¾È¥Ý¥¤¥ó¥¿
144 * @details get_table_name_aux()¤Û¤Ü´°Á´¤Ë¼ÂÁõ¤ò°Í¸¤·¤Æ¤¤¤ë¡£
146 void get_table_name(char *out_string)
149 get_table_name_aux(buff);
152 sprintf(out_string, "¡Ø%s¡Ù", buff);
154 sprintf(out_string, "'%s'", buff);
159 * @brief ¥é¥ó¥À¥à¤Ê¥·¥ó¥À¥ê¥óÌäòºîÀ®¤¹¤ë / Make random Sindarin name
160 * @param out_string ºîÀ®¤·¤¿Ì¾¤òÊݴɤ¹¤ë»²¾È¥Ý¥¤¥ó¥¿
162 * @details sname.txt¤¬¸ì´´¤Î¼½ñ¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
164 void get_table_sindarin_aux(char *out_string)
171 get_rnd_line("sname.txt", 1, Syllable);
173 strcpy(tmp, Syllable);
175 strcpy(out_string, Syllable);
178 get_rnd_line("sname.txt", 2, Syllable);
180 strcat(tmp, Syllable);
181 sindarin_to_kana(out_string, tmp);
183 strcat(out_string, Syllable);
188 * @brief ¥·¥ó¥À¥ê¥óÌäò¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥ÈÍѤËÀ°·Á¤¹¤ë¡£ / Make random Sindarin name with quotes
189 * @param out_string ºîÀ®¤·¤¿Ì¾¤òÊݴɤ¹¤ë»²¾È¥Ý¥¤¥ó¥¿
191 * @details get_table_sindarin_aux()¤Û¤Ü´°Á´¤Ë¼ÂÁõ¤ò°Í¸¤·¤Æ¤¤¤ë¡£
193 void get_table_sindarin(char *out_string)
196 get_table_sindarin_aux(buff);
199 sprintf(out_string, "¡Ø%s¡Ù", buff);
201 sprintf(out_string, "'%s'", buff);
207 * @brief ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Î̤³ÎÄê̾¤ò¶¦ÄÌtval´Ö¤Ç¥·¥ã¥Ã¥Õ¥ë¤¹¤ë / Shuffle flavor indices of a group of objects with given tval
208 * @param byte ¥·¥ã¥Ã¥Õ¥ë¤·¤¿¤¤tval
210 * @details ´¬Êª¡¢³Æ¼ïËâÆ»¶ñ¤Ê¤É¤ËÍøÍѤµ¤ì¤ë¡£
212 static void shuffle_flavors(byte tval)
215 int k_idx_list_num = 0;
218 /* Allocate an array for a list of k_idx */
219 C_MAKE(k_idx_list, max_k_idx, s16b);
221 /* Search objects with given tval for shuffle */
222 for (i = 0; i < max_k_idx; i++)
224 object_kind *k_ptr = &k_info[i];
227 if (k_ptr->tval != tval) continue;
229 /* Paranoia -- Skip objects without flavor */
230 if (!k_ptr->flavor) continue;
232 /* Skip objects with a fixed flavor name */
233 if (have_flag(k_ptr->flags, TR_FIXED_FLAVOR)) continue;
236 k_idx_list[k_idx_list_num] = i;
238 /* Increase number of remembered indices */
242 /* Shuffle flavors */
243 for (i = 0; i < k_idx_list_num; i++)
245 object_kind *k1_ptr = &k_info[k_idx_list[i]];
246 object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
248 /* Swap flavors of this pair */
249 s16b tmp = k1_ptr->flavor;
250 k1_ptr->flavor = k2_ptr->flavor;
251 k2_ptr->flavor = tmp;
254 /* Free an array for a list of k_idx */
255 C_KILL(k_idx_list, max_k_idx, s16b);
259 * @brief ¥²¡¼¥à³«»Ï»þ¤Ë¹Ô¤ï¤ì¤ë¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Î½é´ü²½¥ë¡¼¥Á¥ó / Prepare the "variable" part of the "k_info" array.
262 * Prepare the "variable" part of the "k_info" array.\n
264 * The "color"/"metal"/"type" of an item is its "flavor".\n
265 * For the most part, flavors are assigned randomly each game.\n
267 * Initialize descriptions for the "colored" objects, including:\n
268 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.\n
270 * The first 4 entries for potions are fixed (Water, Apple Juice,\n
271 * Slime Mold Juice, Unused Potion).\n
273 * Scroll titles are always between 6 and 14 letters long. This is\n
274 * ensured because every title is composed of whole words, where every\n
275 * word is from 1 to 8 letters long (one or two syllables of 1 to 4\n
276 * letters each), and that no scroll is finished until it attempts to\n
277 * grow beyond 15 letters. The first time this can happen is when the\n
278 * current title has 6 letters and the new word has 8 letters, which\n
279 * would result in a 6 letter scroll title.\n
281 * Duplicate titles are avoided by requiring that no two scrolls share\n
282 * the same first four letters (not the most efficient method, and not\n
283 * the least efficient method, but it will always work).\n
285 * Hack -- make sure everything stays the same for each saved game\n
286 * This is accomplished by the use of a saved "random seed", as in\n
287 * "town_gen()". Since no other functions are called while the special\n
288 * seed is in effect, so this function is pretty "safe".\n
290 * Note that the "hacked seed" may provide an RNG with alternating parity!\n
292 void flavor_init(void)
295 u32b state_backup[4];
297 /* Hack -- Backup the RNG state */
298 Rand_state_backup(state_backup);
300 /* Hack -- Induce consistant flavors */
301 Rand_state_init(seed_flavor);
304 /* Initialize flavor index of each object by itself */
305 for (i = 0; i < max_k_idx; i++)
307 object_kind *k_ptr = &k_info[i];
309 /* Skip objects without flavor name */
310 if (!k_ptr->flavor_name) continue;
313 * Initialize flavor index to itself
314 * -> Shuffle it later
320 shuffle_flavors(TV_RING);
322 /* Shuffle Amulets */
323 shuffle_flavors(TV_AMULET);
326 shuffle_flavors(TV_STAFF);
329 shuffle_flavors(TV_WAND);
332 shuffle_flavors(TV_ROD);
334 /* Shuffle Mushrooms */
335 shuffle_flavors(TV_FOOD);
337 /* Shuffle Potions */
338 shuffle_flavors(TV_POTION);
340 /* Shuffle Scrolls */
341 shuffle_flavors(TV_SCROLL);
344 /* Hack -- Restore the RNG state */
345 Rand_state_restore(state_backup);
347 /* Analyze every object */
348 for (i = 1; i < max_k_idx; i++)
350 object_kind *k_ptr = &k_info[i];
352 /* Skip "empty" objects */
353 if (!k_ptr->name) continue;
355 /* No flavor yields aware */
356 if (!k_ptr->flavor) k_ptr->aware = TRUE;
358 /* Check for "easily known" */
359 k_ptr->easy_know = object_easy_know(i);
365 * @brief ÂоÝʸ»úÇÛÎó¤Ë°ìʸ»ú¤À¤±¤ò¥³¥Ô¡¼¤¹¤ë¡£
366 * @param t ÊÝ´ÉÀèʸ»úÎó¥Ý¥¤¥ó¥¿
367 * @param c Êݴɤ·¤¿¤¤1ʸ»ú
370 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),\n
371 * and return a pointer to the terminator (t + 1).\n
373 static char *object_desc_chr(char *t, char c)
386 * @brief ÂоÝʸ»úÇÛÎó¤Ëʸ»úÎó¤ò¥³¥Ô¡¼¤¹¤ë¡£
387 * @param t ÊÝ´ÉÀèʸ»úÎó¥Ý¥¤¥ó¥¿
388 * @param c ¥³¥Ô¡¼¤·¤¿¤¤Ê¸»úÎó¥Ý¥¤¥ó¥¿
391 * Print a string "s" into a string "t", as if by strcpy(t, s),
392 * and return a pointer to the terminator.
394 static char *object_desc_str(char *t, cptr s)
396 /* Copy the string */
397 while (*s) *t++ = *s++;
407 * @brief ÂоÝʸ»úÇÛÎó¤ËÉä¹æ¤Ê¤·À°¿ôÃͤò¥³¥Ô¡¼¤¹¤ë¡£
408 * @param t ÊÝ´ÉÀèʸ»úÎó¥Ý¥¤¥ó¥¿
409 * @param n ¥³¥Ô¡¼¤·¤¿¤¤¿ôÃÍ
412 * Print an unsigned number "n" into a string "t", as if by
413 * sprintf(t, "%u", n), and return a pointer to the terminator.
415 static char *object_desc_num(char *t, uint n)
419 /* Find "size" of "n" */
420 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
422 /* Dump each digit */
428 /* Remove the digit */
431 /* Process next digit */
447 * @brief ÆüËܸì¤Î¸Ä¿ôɽ¼¨¥ë¡¼¥Á¥ó
448 * @param t ÊÝ´ÉÀèʸ»úÎó¥Ý¥¤¥ó¥¿
449 * @param o_ptr µ½Ò¤·¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
452 * cmd1.c ¤ÇήÍѤ¹¤ë¤¿¤á¤Ë object_desc_japanese ¤«¤é°ÜÆ°¤·¤¿¡£
454 char *object_desc_kosuu(char *t, object_type *o_ptr)
456 t = object_desc_num(t, o_ptr->number);
468 t = object_desc_str(t, "ËÜ");
473 t = object_desc_str(t, "´¬");
478 t = object_desc_str(t, "Éþ");
482 case TV_SORCERY_BOOK:
490 case TV_CRUSADE_BOOK:
492 case TV_HISSATSU_BOOK:
495 t = object_desc_str(t, "ºý");
503 t = object_desc_str(t, "Ãå");
510 t = object_desc_str(t, "¿¶");
515 t = object_desc_str(t, "");
520 t = object_desc_str(t, "Ëç");
523 /* ¿©¤Ù¤â¤Î by ita */
526 if(o_ptr->sval == SV_FOOD_JERKY)
528 t = object_desc_str(t, "ÀÚ¤ì");
534 if (o_ptr->number < 10)
536 t = object_desc_str(t, "¤Ä");
540 t = object_desc_str(t, "¸Ä");
550 * @brief ÂоÝʸ»úÇÛÎó¤ËÉä¹æ¤¢¤êÀ°¿ôÃͤò¥³¥Ô¡¼¤¹¤ë¡£
551 * @param t ÊÝ´ÉÀèʸ»úÎó¥Ý¥¤¥ó¥¿
552 * @param v ¥³¥Ô¡¼¤·¤¿¤¤¿ôÃÍ
555 * Print an signed number "v" into a string "t", as if by
556 * sprintf(t, "%+d", n), and return a pointer to the terminator.
557 * Note that we always print a sign, either "+" or "-".
559 static char *object_desc_int(char *t, sint v)
566 /* Take the absolute value */
569 /* Use a "minus" sign */
573 /* Positive (or zero) */
576 /* Use the actual number */
579 /* Use a "plus" sign */
583 /* Find "size" of "n" */
584 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
586 /* Dump each digit */
592 /* Remove the digit */
595 /* Process next digit */
608 * ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤Î¹½Â¤ÂÎ / Structs and tables for Auto Inscription for flags
610 typedef struct flag_insc_table
621 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(pvalÍ×ÁÇ) */
622 static flag_insc_table flag_insc_plus[] =
624 { "¹¶", "At", TR_BLOWS, -1 },
625 { "®", "Sp", TR_SPEED, -1 },
626 { "ÏÓ", "St", TR_STR, -1 },
627 { "ÃÎ", "In", TR_INT, -1 },
628 { "¸", "Wi", TR_WIS, -1 },
629 { "´ï", "Dx", TR_DEX, -1 },
630 { "ÂÑ", "Cn", TR_CON, -1 },
631 { "̥", "Ch", TR_CHR, -1 },
632 { "ƻ", "Md", TR_MAGIC_MASTERY, -1 },
633 { "±£", "Sl", TR_STEALTH, -1 },
634 { "õ", "Sr", TR_SEARCH, -1 },
635 { "ÀÖ", "If", TR_INFRA, -1 },
636 { "·¡", "Dg", TR_TUNNEL, -1 },
637 { NULL, NULL, 0, -1 }
640 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(ÌȱÖ) */
641 static flag_insc_table flag_insc_immune[] =
643 { "»À", "Ac", TR_IM_ACID, -1 },
644 { "ÅÅ", "El", TR_IM_ELEC, -1 },
645 { "²Ð", "Fi", TR_IM_FIRE, -1 },
646 { "Îä", "Co", TR_IM_COLD, -1 },
647 { NULL, NULL, 0, -1 }
650 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(ÂÑÀ) */
651 static flag_insc_table flag_insc_resistance[] =
653 { "»À", "Ac", TR_RES_ACID, TR_IM_ACID },
654 { "ÅÅ", "El", TR_RES_ELEC, TR_IM_ELEC },
655 { "²Ð", "Fi", TR_RES_FIRE, TR_IM_FIRE },
656 { "Îä", "Co", TR_RES_COLD, TR_IM_COLD },
657 { "ÆÇ", "Po", TR_RES_POIS, -1 },
658 { "Á®", "Li", TR_RES_LITE, -1 },
659 { "°Å", "Dk", TR_RES_DARK, -1 },
660 { "ÇË", "Sh", TR_RES_SHARDS, -1 },
661 { "ÌÕ", "Bl", TR_RES_BLIND, -1 },
662 { "Íð", "Cf", TR_RES_CONF, -1 },
663 { "¹ì", "So", TR_RES_SOUND, -1 },
664 { "¹ö", "Nt", TR_RES_NETHER, -1 },
665 { "°ø", "Nx", TR_RES_NEXUS, -1 },
666 { "ÆÙ", "Ca", TR_RES_CHAOS, -1 },
667 { "Îô", "Di", TR_RES_DISEN, -1 },
668 { "¶²", "Fe", TR_RES_FEAR, -1 },
669 { NULL, NULL, 0, -1 }
672 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(¤½¤Î¾ÆÃÀ) */
673 static flag_insc_table flag_insc_misc[] =
675 { "°×", "Es", TR_EASY_SPELL, -1 },
676 { "¸º", "Dm", TR_DEC_MANA, -1 },
677 { "Åê", "Th", TR_THROW, -1 },
678 { "ȿ", "Rf", TR_REFLECT, -1 },
679 { "Ëã", "Fa", TR_FREE_ACT, -1 },
680 { "ȑ", "Si", TR_SEE_INVIS, -1 },
681 { "·Ð", "Hl", TR_HOLD_LIFE, -1 },
682 { "ÃÙ", "Sd", TR_SLOW_DIGEST, -1 },
683 { "³è", "Rg", TR_REGEN, -1 },
684 { "Éâ", "Lv", TR_LEVITATION, -1 },
685 { "ÌÀ", "Lu", TR_LITE_1, -1 },
686 { "ÌÀ", "Lu", TR_LITE_2, -1 },
687 { "ÌÀ", "Lu", TR_LITE_3, -1 },
688 { "°Ç", "Dl", TR_LITE_M1, -1 },
689 { "°Ç", "Dl", TR_LITE_M2, -1 },
690 { "°Ç", "Dl", TR_LITE_M3, -1 },
691 { "·Ù", "Wr", TR_WARNING, -1 },
692 { "ÇÜ", "Xm", TR_XTRA_MIGHT, -1 },
693 { "¼Í", "Xs", TR_XTRA_SHOTS, -1 },
694 { "½Ö", "Te", TR_TELEPORT, -1 },
695 { "ÅÜ", "Ag", TR_AGGRAVATE, -1 },
696 { "½Ë", "Bs", TR_BLESSED, -1 },
697 { "´÷", "Ty", TR_TY_CURSE, -1 },
698 { "¼ö", "C-", TR_ADD_L_CURSE, -1 },
699 { "ëÇ", "C+", TR_ADD_H_CURSE, -1 },
700 { NULL, NULL, 0, -1 }
703 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(¥ª¡¼¥é) */
704 static flag_insc_table flag_insc_aura[] =
706 { "±ê", "F", TR_SH_FIRE, -1 },
707 { "ÅÅ", "E", TR_SH_ELEC, -1 },
708 { "Îä", "C", TR_SH_COLD, -1 },
709 { "Ëâ", "M", TR_NO_MAGIC, -1 },
710 { "½Ö", "T", TR_NO_TELE, -1 },
711 { NULL, NULL, 0, -1 }
714 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(°À¥¹¥ì¥¤) */
715 static flag_insc_table flag_insc_brand[] =
717 { "»À", "A", TR_BRAND_ACID, -1 },
718 { "ÅÅ", "E", TR_BRAND_ELEC, -1 },
719 { "¾Æ", "F", TR_BRAND_FIRE, -1 },
720 { "Åà", "Co", TR_BRAND_COLD, -1 },
721 { "ÆÇ", "P", TR_BRAND_POIS, -1 },
722 { "ÆÙ", "Ca", TR_CHAOTIC, -1 },
723 { "µÛ", "V", TR_VAMPIRIC, -1 },
724 { "¿Ì", "Q", TR_IMPACT, -1 },
725 { "ÀÚ", "S", TR_VORPAL, -1 },
726 { "Íý", "M", TR_FORCE_WEAPON, -1 },
727 { NULL, NULL, 0, -1 }
730 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(¼ï²¥¹¥ì¥¤) */
731 static flag_insc_table flag_insc_kill[] =
733 { "¼Ù", "*", TR_KILL_EVIL, -1 },
734 { "¿Í", "p", TR_KILL_HUMAN, -1 },
735 { "ζ", "D", TR_KILL_DRAGON, -1 },
736 { "¥ª", "o", TR_KILL_ORC, -1 },
737 { "¥È", "T", TR_KILL_TROLL, -1 },
738 { "µð", "P", TR_KILL_GIANT, -1 },
739 { "¥Ç", "U", TR_KILL_DEMON, -1 },
740 { "Ȉ", "L", TR_KILL_UNDEAD, -1 },
741 { "ư", "Z", TR_KILL_ANIMAL, -1 },
742 { NULL, NULL, 0, -1 }
745 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(¼ï²*¥¹¥ì¥¤*) */
746 static flag_insc_table flag_insc_slay[] =
748 { "¼Ù", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
749 { "¿Í", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
750 { "ε", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
751 { "¥ª", "o", TR_SLAY_ORC, TR_KILL_ORC },
752 { "¥È", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
753 { "µð", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
754 { "¥Ç", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
755 { "Ȉ", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
756 { "ư", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
757 { NULL, NULL, 0, -1 }
760 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(ESP1) */
761 static flag_insc_table flag_insc_esp1[] =
763 { "´¶", "Tele", TR_TELEPATHY, -1 },
764 { "¼Ù", "Evil", TR_ESP_EVIL, -1 },
765 { "Á±", "Good", TR_ESP_GOOD, -1 },
766 { "̵", "Nolv", TR_ESP_NONLIVING, -1 },
767 { "¸Ä", "Uniq", TR_ESP_UNIQUE, -1 },
768 { NULL, NULL, 0, -1 }
771 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(ESP2) */
772 static flag_insc_table flag_insc_esp2[] =
774 { "¿Í", "p", TR_ESP_HUMAN, -1 },
775 { "ε", "D", TR_ESP_DRAGON, -1 },
776 { "¥ª", "o", TR_ESP_ORC, -1 },
777 { "¥È", "T", TR_ESP_TROLL, -1 },
778 { "µð", "P", TR_ESP_GIANT, -1 },
779 { "¥Ç", "U", TR_ESP_DEMON, -1 },
780 { "Ȉ", "L", TR_ESP_UNDEAD, -1 },
781 { "ư", "Z", TR_ESP_ANIMAL, -1 },
782 { NULL, NULL, 0, -1 }
785 /*! ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë¤ÎÄêµÁ(ǽÎÏ°Ý»ý) */
786 static flag_insc_table flag_insc_sust[] =
788 { "ÏÓ", "St", TR_SUST_STR, -1 },
789 { "ÃÎ", "In", TR_SUST_INT, -1 },
790 { "¸", "Wi", TR_SUST_WIS, -1 },
791 { "´ï", "Dx", TR_SUST_DEX, -1 },
792 { "ÂÑ", "Cn", TR_SUST_CON, -1 },
793 { "̥", "Ch", TR_SUST_CHR, -1 },
794 { NULL, NULL, 0, -1 }
798 static flag_insc_table flag_insc_plus[] =
800 { "At", TR_BLOWS, -1 },
801 { "Sp", TR_SPEED, -1 },
802 { "St", TR_STR, -1 },
803 { "In", TR_INT, -1 },
804 { "Wi", TR_WIS, -1 },
805 { "Dx", TR_DEX, -1 },
806 { "Cn", TR_CON, -1 },
807 { "Ch", TR_CHR, -1 },
808 { "Md", TR_MAGIC_MASTERY, -1 },
809 { "Sl", TR_STEALTH, -1 },
810 { "Sr", TR_SEARCH, -1 },
811 { "If", TR_INFRA, -1 },
812 { "Dg", TR_TUNNEL, -1 },
816 static flag_insc_table flag_insc_immune[] =
818 { "Ac", TR_IM_ACID, -1 },
819 { "El", TR_IM_ELEC, -1 },
820 { "Fi", TR_IM_FIRE, -1 },
821 { "Co", TR_IM_COLD, -1 },
825 static flag_insc_table flag_insc_resistance[] =
827 { "Ac", TR_RES_ACID, TR_IM_ACID },
828 { "El", TR_RES_ELEC, TR_IM_ELEC },
829 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
830 { "Co", TR_RES_COLD, TR_IM_COLD },
831 { "Po", TR_RES_POIS, -1 },
832 { "Li", TR_RES_LITE, -1 },
833 { "Dk", TR_RES_DARK, -1 },
834 { "Sh", TR_RES_SHARDS, -1 },
835 { "Bl", TR_RES_BLIND, -1 },
836 { "Cf", TR_RES_CONF, -1 },
837 { "So", TR_RES_SOUND, -1 },
838 { "Nt", TR_RES_NETHER, -1 },
839 { "Nx", TR_RES_NEXUS, -1 },
840 { "Ca", TR_RES_CHAOS, -1 },
841 { "Di", TR_RES_DISEN, -1 },
842 { "Fe", TR_RES_FEAR, -1 },
846 static flag_insc_table flag_insc_misc[] =
848 { "Es", TR_EASY_SPELL, -1 },
849 { "Dm", TR_DEC_MANA, -1 },
850 { "Th", TR_THROW, -1 },
851 { "Rf", TR_REFLECT, -1 },
852 { "Fa", TR_FREE_ACT, -1 },
853 { "Si", TR_SEE_INVIS, -1 },
854 { "Hl", TR_HOLD_LIFE, -1 },
855 { "Sd", TR_SLOW_DIGEST, -1 },
856 { "Rg", TR_REGEN, -1 },
857 { "Lv", TR_LEVITATION, -1 },
858 { "Lu", TR_LITE_1, -1 },
859 { "Lu", TR_LITE_2, -1 },
860 { "Lu", TR_LITE_3, -1 },
861 { "Dl", TR_LITE_M1, -1 },
862 { "Dl", TR_LITE_M2, -1 },
863 { "Dl", TR_LITE_M3, -1 },
864 { "Wr", TR_WARNING, -1 },
865 { "Xm", TR_XTRA_MIGHT, -1 },
866 { "Xs", TR_XTRA_SHOTS, -1 },
867 { "Te", TR_TELEPORT, -1 },
868 { "Ag", TR_AGGRAVATE, -1 },
869 { "Bs", TR_BLESSED, -1 },
870 { "Ty", TR_TY_CURSE, -1 },
871 { "C-", TR_ADD_L_CURSE, -1 },
872 { "C+", TR_ADD_H_CURSE, -1 },
876 static flag_insc_table flag_insc_aura[] =
878 { "F", TR_SH_FIRE, -1 },
879 { "E", TR_SH_ELEC, -1 },
880 { "C", TR_SH_COLD, -1 },
881 { "M", TR_NO_MAGIC, -1 },
882 { "T", TR_NO_TELE, -1 },
886 static flag_insc_table flag_insc_brand[] =
888 { "A", TR_BRAND_ACID, -1 },
889 { "E", TR_BRAND_ELEC, -1 },
890 { "F", TR_BRAND_FIRE, -1 },
891 { "Co", TR_BRAND_COLD, -1 },
892 { "P", TR_BRAND_POIS, -1 },
893 { "Ca", TR_CHAOTIC, -1 },
894 { "V", TR_VAMPIRIC, -1 },
895 { "Q", TR_IMPACT, -1 },
896 { "S", TR_VORPAL, -1 },
897 { "M", TR_FORCE_WEAPON, -1 },
901 static flag_insc_table flag_insc_kill[] =
903 { "*", TR_KILL_EVIL, -1 },
904 { "p", TR_KILL_HUMAN, -1 },
905 { "D", TR_KILL_DRAGON, -1 },
906 { "o", TR_KILL_ORC, -1 },
907 { "T", TR_KILL_TROLL, -1 },
908 { "P", TR_KILL_GIANT, -1 },
909 { "U", TR_KILL_DEMON, -1 },
910 { "L", TR_KILL_UNDEAD, -1 },
911 { "Z", TR_KILL_ANIMAL, -1 },
915 static flag_insc_table flag_insc_slay[] =
917 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
918 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
919 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
920 { "o", TR_SLAY_ORC, TR_KILL_ORC },
921 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
922 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
923 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
924 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
925 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
929 static flag_insc_table flag_insc_esp1[] =
931 { "Tele", TR_TELEPATHY, -1 },
932 { "Evil", TR_ESP_EVIL, -1 },
933 { "Good", TR_ESP_GOOD, -1 },
934 { "Nolv", TR_ESP_NONLIVING, -1 },
935 { "Uniq", TR_ESP_UNIQUE, -1 },
939 static flag_insc_table flag_insc_esp2[] =
941 { "p", TR_ESP_HUMAN, -1 },
942 { "D", TR_ESP_DRAGON, -1 },
943 { "o", TR_ESP_ORC, -1 },
944 { "T", TR_ESP_TROLL, -1 },
945 { "P", TR_ESP_GIANT, -1 },
946 { "U", TR_ESP_DEMON, -1 },
947 { "L", TR_ESP_UNDEAD, -1 },
948 { "Z", TR_ESP_ANIMAL, -1 },
952 static flag_insc_table flag_insc_sust[] =
954 { "St", TR_SUST_STR, -1 },
955 { "In", TR_SUST_INT, -1 },
956 { "Wi", TR_SUST_WIS, -1 },
957 { "Dx", TR_SUST_DEX, -1 },
958 { "Cn", TR_SUST_CON, -1 },
959 { "Ch", TR_SUST_CHR, -1 },
964 /* ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥é¥°¤òÄɲ乤뤿¤á¤Î´Ê°×¤Ê¥Þ¥¯¥í / Simple macro for get_inscription() */
965 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
968 * @brief get_inscription¤Î¥µ¥Ö¥»¥Ã¥È¤È¤·¤Æ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀ¥Õ¥é¥°¤òÊÖ¤¹ / Helper function for get_inscription()
969 * @param fi_ptr »²¾È¤¹¤ëÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë
970 * @param flgs Âбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Õ¥é¥°Ê¸»úÎó
971 * @param kanji TRUE¤Ê¤é¤Ð´Á»úµ½Ò/FALSE¤Ê¤é¤Ð±Ñ¸ìµ½Ò
972 * @param ptr ¥Õ¥é¥°·²¤òÊݴɤ¹¤ëʸ»úÎ󻲾ȥݥ¤¥ó¥¿
973 * @return ¥Õ¥é¥°·²¤òÊݴɤ¹¤ëʸ»úÎ󻲾ȥݥ¤¥ó¥¿(ptr¤ÈƱ¤¸)
975 * Print an signed number "v" into a string "t", as if by
976 * sprintf(t, "%+d", n), and return a pointer to the terminator.
977 * Note that we always print a sign, either "+" or "-".
979 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
985 while (fi_ptr->english)
987 if (have_flag(flgs, fi_ptr->flag) &&
988 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
990 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
992 ADD_INSC(fi_ptr->english);
1002 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë1¤Ä¤Ë½¾¤¤¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆÃÀ¥Õ¥é¥°ÇÛÎó¤Ë1¤Ä¤Ç¤â³ºÅö¤ÎÆÃÀ¤¬¤¢¤ë¤«¤òÊÖ¤¹ / Special variation of have_flag for auto-inscription
1003 * @param fi_ptr »²¾È¤¹¤ëÆÃÀɽ¼¨µ¹æ¥Æ¡¼¥Ö¥ë
1004 * @param flgs Âбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Õ¥é¥°Ê¸»úÎó
1005 * @return 1¤Ä¤Ç¤â³ºÅö¤ÎÆÃÀ¤¬¤¢¤Ã¤¿¤éTRUE¤òÊÖ¤¹¡£
1007 static bool have_flag_of(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE])
1009 while (fi_ptr->english)
1011 if (have_flag(flgs, fi_ptr->flag) &&
1012 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
1021 * @brief ¥ª¥Ö¥¸¥§¥¯¥È̾¤ÎÆÃÀû½Ìɽµ¤ò¤Þ¤È¤á¤ÆÄ󼨤¹¤ë¡£
1022 * @param ptr ÆÃÀû½Ìɽµ¤ò³ÊǼ¤¹¤ëʸ»úÎó¥Ý¥¤¥ó¥¿
1023 * @param o_ptr ÆÃÀû½Ìɽµ¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1024 * @param kanji TRUE¤Ê¤é¤Ð´Á»úɽµ / FALSE¤Ê¤é±Ñ¸ìɽµ
1025 * @param all TRUE¤Ê¤é¤Ð¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¾å¤ÇÌÀ¤é¤«¤Ê¥Õ¥é¥°¤Ï¾Êά¤¹¤ë
1026 * @return ptr¤ÈƱ¤¸¥¢¥É¥ì¥¹
1028 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
1030 char *prev_ptr = ptr;
1031 u32b flgs[TR_FLAG_SIZE];
1033 /* Extract the flags */
1034 object_flags(o_ptr, flgs);
1036 /* Remove obvious flags */
1039 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1043 for (j = 0; j < TR_FLAG_SIZE; j++)
1044 flgs[j] &= ~k_ptr->flags[j];
1046 if (object_is_fixed_artifact(o_ptr))
1048 artifact_type *a_ptr = &a_info[o_ptr->name1];
1050 for (j = 0; j < TR_FLAG_SIZE; j++)
1051 flgs[j] &= ~a_ptr->flags[j];
1054 if (object_is_ego(o_ptr))
1056 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1058 for (j = 0; j < TR_FLAG_SIZE; j++)
1059 flgs[j] &= ~e_ptr->flags[j];
1063 /* Remove lite flags when this is a dark lite object */
1064 if (have_dark_flag(flgs))
1066 if (have_flag(flgs, TR_LITE_1)) remove_flag(flgs, TR_LITE_1);
1067 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1068 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1070 else if (have_lite_flag(flgs))
1072 add_flag(flgs, TR_LITE_1);
1073 if (have_flag(flgs, TR_LITE_2)) remove_flag(flgs, TR_LITE_2);
1074 if (have_flag(flgs, TR_LITE_3)) remove_flag(flgs, TR_LITE_3);
1078 if (have_flag_of(flag_insc_plus, flgs))
1083 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
1086 if (have_flag_of(flag_insc_immune, flgs))
1088 if (!kanji && ptr != prev_ptr)
1095 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
1098 if (have_flag_of(flag_insc_resistance, flgs))
1102 else if (ptr != prev_ptr)
1108 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1111 if (have_flag_of(flag_insc_misc, flgs))
1113 if (ptr != prev_ptr)
1119 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1122 if (have_flag_of(flag_insc_aura, flgs))
1126 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1129 if (have_flag_of(flag_insc_brand, flgs))
1131 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1134 if (have_flag_of(flag_insc_kill, flgs))
1136 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1139 if (have_flag_of(flag_insc_slay, flgs))
1141 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1146 if (have_flag_of(flag_insc_esp1, flgs) ||
1147 have_flag_of(flag_insc_esp2, flgs))
1149 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1150 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1154 if (have_flag_of(flag_insc_esp1, flgs))
1156 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1157 if (have_flag_of(flag_insc_esp2, flgs))
1159 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1163 if (have_flag_of(flag_insc_sust, flgs))
1167 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1176 * @brief ¥ª¥Ö¥¸¥§¥¯¥È̾¤ÎÆÃÀû½Ìɽµ¡Ü¹ï¤ßÆâÍƤòÄ󼨤¹¤ë¡£ / Get object inscription with auto inscription of object flags.
1177 * @param buff ÆÃÀû½Ìɽµ¤ò³ÊǼ¤¹¤ëʸ»úÎó¥Ý¥¤¥ó¥¿
1178 * @param o_ptr ÆÃÀû½Ìɽµ¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1181 static void get_inscription(char *buff, object_type *o_ptr)
1183 cptr insc = quark_str(o_ptr->inscription);
1186 /* Not fully identified */
1187 if (!(o_ptr->ident & IDENT_MENTAL))
1189 /* Copy until end of line or '#' */
1192 if (*insc == '#') break;
1194 if (iskanji(*insc)) *buff++ = *insc++;
1204 for (; *insc; insc++)
1206 /* Ignore fake artifact inscription */
1207 if (*insc == '#') break;
1209 /* {%} will be automatically converted */
1210 else if ('%' == *insc)
1216 /* check for too long inscription */
1217 if (ptr >= buff + MAX_NLEN) continue;
1230 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1240 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1254 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¯¥¨¥¹¥È¤ÎãÀ®ÌÜŪ¤«Èݤ«¤òÊÖ¤¹¡£
1255 * @param o_ptr ÆÃÀû½Ìɽµ¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1256 * @return ¸½ºß¥¯¥¨¥¹¥ÈãÀ®ÌÜŪ¤Î¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
1258 bool object_is_quest_target(object_type *o_ptr)
1260 if (p_ptr->inside_quest)
1262 int a_idx = quest[p_ptr->inside_quest].k_idx;
1265 artifact_type *a_ptr = &a_info[a_idx];
1266 if (!(a_ptr->gen_flags & TRG_INSTA_ART))
1268 if((o_ptr->tval == a_ptr->tval) && (o_ptr->sval == a_ptr->sval))
1280 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î³Æɽµ¤òÊÖ¤¹¥á¥¤¥ó´Ø¿ô / Creates a description of the item "o_ptr", and stores it in "out_val".
1281 * @param o_ptr ÆÃÀû½Ìɽµ¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1282 * @return ¸½ºß¥¯¥¨¥¹¥ÈãÀ®ÌÜŪ¤Î¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
1284 * One can choose the "verbosity" of the description, including whether\n
1285 * or not the "number" of items should be described, and how much detail\n
1286 * should be used when describing the item.\n
1288 * The given "buf" must be MAX_NLEN chars long to hold the longest possible\n
1289 * description, which can get pretty long, including incriptions, such as:\n
1290 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".\n
1291 * Note that the inscription will be clipped to keep the total description\n
1292 * under MAX_NLEN-1 chars (plus a terminator).\n
1294 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,\n
1295 * portable, versions of some common "sprintf()" commands.\n
1297 * Note that all ego-items (when known) append an "Ego-Item Name", unless\n
1298 * the item is also an artifact, which should NEVER happen.\n
1300 * Note that all artifacts (when known) append an "Artifact Name", so we\n
1301 * have special processing for "Specials" (artifact Lites, Rings, Amulets).\n
1302 * The "Specials" never use "modifiers" if they are "known", since they\n
1303 * have special "descriptions", such as "The Necklace of the Dwarves".\n
1305 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),\n
1306 * plus the artifact name, just like any other artifact, if known.\n
1308 * Special Ring's and Amulet's, if not "aware", use the same code as normal\n
1309 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or\n
1310 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,\n
1311 * they will append the artifact name, just like any artifact, if known.\n
1313 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.\n
1316 * OD_NAME_ONLY : The Cloak of Death\n
1317 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]\n
1318 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)\n
1319 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}\n
1321 * OD_OMIT_PREFIX : Forbidden numeric prefix\n
1322 * OD_NO_PLURAL : Forbidden use of plural \n
1323 * OD_STORE : Assume to be aware and known\n
1324 * OD_NO_FLAVOR : Allow to hidden flavor\n
1325 * OD_FORCE_FLAVOR : Get un-shuffled flavor name\n
1327 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1329 /* Extract object kind name */
1330 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1332 /* Extract default "base" string */
1333 cptr basenm = kindname;
1335 /* Assume no "modifier" string */
1345 bool show_weapon = FALSE;
1346 bool show_armour = FALSE;
1351 char p1 = '(', p2 = ')';
1352 char b1 = '[', b2 = ']';
1353 char c1 = '{', c2 = '}';
1355 char tmp_val[MAX_NLEN+160];
1356 char tmp_val2[MAX_NLEN+10];
1357 char fake_insc_buf[30];
1359 u32b flgs[TR_FLAG_SIZE];
1361 object_type *bow_ptr;
1363 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1364 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1366 /* Extract some flags */
1367 object_flags(o_ptr, flgs);
1369 /* See if the object is "aware" */
1370 if (object_is_aware(o_ptr)) aware = TRUE;
1372 /* See if the object is "known" */
1373 if (object_is_known(o_ptr)) known = TRUE;
1375 /* Allow flavors to be hidden when aware */
1376 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1378 /* Object is in the inventory of a store or spoiler */
1379 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1381 /* Don't show flavors */
1384 /* Pretend known and aware */
1389 /* Force to be flavor name only */
1390 if (mode & OD_FORCE_FLAVOR)
1396 /* Cancel shuffling */
1397 flavor_k_ptr = k_ptr;
1400 /* Analyze the object */
1401 switch (o_ptr->tval)
1403 /* Some objects are easy to describe */
1417 monster_race *r_ptr = &r_info[o_ptr->pval];
1426 modstr = " (empty)";
1432 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1435 cptr t = r_name + r_ptr->name;
1437 if (!(r_ptr->flags1 & RF1_UNIQUE))
1439 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1445 sprintf(tmp_val2, "(%s)", t);
1455 /* Figurines/Statues */
1459 monster_race *r_ptr = &r_info[o_ptr->pval];
1462 modstr = r_name + r_ptr->name;
1464 cptr t = r_name + r_ptr->name;
1466 if (!(r_ptr->flags1 & RF1_UNIQUE))
1468 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1485 monster_race *r_ptr = &r_info[o_ptr->pval];
1487 modstr = r_name + r_ptr->name;
1492 if (r_ptr->flags1 & RF1_UNIQUE)
1493 basenm = "& % of #";
1501 /* Missiles/ Bows/ Weapons */
1530 /* Lites (including a few "Specials") */
1536 /* Amulets (including a few "Specials") */
1539 /* Known artifacts */
1542 if (object_is_fixed_artifact(o_ptr)) break;
1543 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1546 /* Color the object */
1547 modstr = k_name + flavor_k_ptr->flavor_name;
1550 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1551 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1552 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1554 if (!flavor) basenm = "& Amulet~ of %";
1555 else if (aware) basenm = "& # Amulet~ of %";
1556 else basenm = "& # Amulet~";
1562 /* Rings (including a few "Specials") */
1565 /* Known artifacts */
1568 if (object_is_fixed_artifact(o_ptr)) break;
1569 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1572 /* Color the object */
1573 modstr = k_name + flavor_k_ptr->flavor_name;
1576 if (!flavor) basenm = "%¤Î»ØÎØ";
1577 else if (aware) basenm = "%¤Î#»ØÎØ";
1578 else basenm = "#»ØÎØ";
1580 if (!flavor) basenm = "& Ring~ of %";
1581 else if (aware) basenm = "& # Ring~ of %";
1582 else basenm = "& # Ring~";
1585 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1597 /* Color the object */
1598 modstr = k_name + flavor_k_ptr->flavor_name;
1601 if (!flavor) basenm = "%¤Î¾ó";
1602 else if (aware) basenm = "%¤Î#¾ó";
1603 else basenm = "#¾ó";
1605 if (!flavor) basenm = "& Staff~ of %";
1606 else if (aware) basenm = "& # Staff~ of %";
1607 else basenm = "& # Staff~";
1615 /* Color the object */
1616 modstr = k_name + flavor_k_ptr->flavor_name;
1619 if (!flavor) basenm = "%¤ÎËâË¡ËÀ";
1620 else if (aware) basenm = "%¤Î#ËâË¡ËÀ";
1621 else basenm = "#ËâË¡ËÀ";
1623 if (!flavor) basenm = "& Wand~ of %";
1624 else if (aware) basenm = "& # Wand~ of %";
1625 else basenm = "& # Wand~";
1633 /* Color the object */
1634 modstr = k_name + flavor_k_ptr->flavor_name;
1637 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1638 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1639 else basenm = "#¥í¥Ã¥É";
1641 if (!flavor) basenm = "& Rod~ of %";
1642 else if (aware) basenm = "& # Rod~ of %";
1643 else basenm = "& # Rod~";
1651 /* Color the object */
1652 modstr = k_name + flavor_k_ptr->flavor_name;
1655 if (!flavor) basenm = "%¤Î´¬Êª";
1656 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1657 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1659 if (!flavor) basenm = "& Scroll~ of %";
1660 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1661 else basenm = "& Scroll~ titled \"#\"";
1669 /* Color the object */
1670 modstr = k_name + flavor_k_ptr->flavor_name;
1673 if (!flavor) basenm = "%¤ÎÌô";
1674 else if (aware) basenm = "%¤Î#Ìô";
1675 else basenm = "#Ìô";
1677 if (!flavor) basenm = "& Potion~ of %";
1678 else if (aware) basenm = "& # Potion~ of %";
1679 else basenm = "& # Potion~";
1687 /* Ordinary food is "boring" */
1688 if (!k_ptr->flavor_name) break;
1690 /* Color the object */
1691 modstr = k_name + flavor_k_ptr->flavor_name;
1694 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1695 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1696 else basenm = "#¥¥Î¥³";
1698 if (!flavor) basenm = "& Mushroom~ of %";
1699 else if (aware) basenm = "& # Mushroom~ of %";
1700 else basenm = "& # Mushroom~";
1709 basenm = "ÍÓÈé»æ - %";
1711 basenm = "& Parchment~ - %";
1720 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1722 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1723 basenm = "& Book~ of Life Magic %";
1725 basenm = "& Life Spellbook~ %";
1731 case TV_SORCERY_BOOK:
1734 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1736 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1737 basenm = "& Book~ of Sorcery %";
1739 basenm = "& Sorcery Spellbook~ %";
1745 case TV_NATURE_BOOK:
1748 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1750 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1751 basenm = "& Book~ of Nature Magic %";
1753 basenm = "& Nature Spellbook~ %";
1762 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1764 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1765 basenm = "& Book~ of Chaos Magic %";
1767 basenm = "& Chaos Spellbook~ %";
1776 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1778 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1779 basenm = "& Book~ of Death Magic %";
1781 basenm = "& Death Spellbook~ %";
1790 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1792 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1793 basenm = "& Book~ of Trump Magic %";
1795 basenm = "& Trump Spellbook~ %";
1801 case TV_ARCANE_BOOK:
1804 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1806 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1807 basenm = "& Book~ of Arcane Magic %";
1809 basenm = "& Arcane Spellbook~ %";
1818 basenm = "¾¢¤ÎËâË¡½ñ%";
1820 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1821 basenm = "& Book~ of Craft Magic %";
1823 basenm = "& Craft Spellbook~ %";
1829 case TV_DAEMON_BOOK:
1832 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1834 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1835 basenm = "& Book~ of Daemon Magic %";
1837 basenm = "& Daemon Spellbook~ %";
1843 case TV_CRUSADE_BOOK:
1846 basenm = "Ç˼٤ÎËâË¡½ñ%";
1848 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1849 basenm = "& Book~ of Crusade Magic %";
1851 basenm = "& Crusade Spellbook~ %";
1862 basenm = "& Song Book~ %";
1868 case TV_HISSATSU_BOOK:
1871 basenm = "& Éð·Ý¤Î½ñ%";
1873 basenm = "Book~ of Kendo %";
1882 basenm = "¼ö½Ñ¤ÎËâË¡½ñ%";
1884 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1885 basenm = "& Book~ of Hex Magic %";
1887 basenm = "& Hex Spellbook~ %";
1893 /* Hack -- Gold/Gems */
1896 strcpy(buf, basenm);
1900 /* Used in the "inventory" routine */
1904 strcpy(buf, "(¤Ê¤·)");
1906 strcpy(buf, "(nothing)");
1913 /* Use full name from k_info or a_info */
1914 if (aware && have_flag(flgs, TR_FULL_NAME))
1916 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1917 else basenm = kindname;
1920 /* Start dumping the result */
1924 if (basenm[0] == '&')
1930 if (mode & OD_OMIT_PREFIX)
1934 else if (o_ptr->number > 1)
1936 t = object_desc_kosuu(t, o_ptr);
1937 t = object_desc_str(t, "¤Î ");
1940 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1941 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1945 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1946 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1951 /* The object "expects" a "number" */
1952 if (basenm[0] == '&')
1954 /* Skip the ampersand (and space) */
1958 if (mode & OD_OMIT_PREFIX)
1963 /* Hack -- None left */
1964 else if (o_ptr->number <= 0)
1966 t = object_desc_str(t, "no more ");
1969 /* Extract the number */
1970 else if (o_ptr->number > 1)
1972 t = object_desc_num(t, o_ptr->number);
1973 t = object_desc_chr(t, ' ');
1976 /* Hack -- The only one of its kind */
1977 else if ((known && object_is_artifact(o_ptr)) ||
1978 ((o_ptr->tval == TV_CORPSE) &&
1979 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1981 t = object_desc_str(t, "The ");
1991 case '#': vowel = is_a_vowel(modstr[0]); break;
1992 case '%': vowel = is_a_vowel(*kindname); break;
1993 default: vowel = is_a_vowel(*s); break;
1998 /* A single one, with a vowel */
1999 t = object_desc_str(t, "an ");
2003 /* A single one, without a vowel */
2004 t = object_desc_str(t, "a ");
2009 /* Hack -- objects that "never" take an article */
2016 if (mode & OD_OMIT_PREFIX)
2021 /* Hack -- all gone */
2022 else if (o_ptr->number <= 0)
2024 t = object_desc_str(t, "no more ");
2027 /* Prefix a number if required */
2028 else if (o_ptr->number > 1)
2030 t = object_desc_num(t, o_ptr->number);
2031 t = object_desc_chr(t, ' ');
2034 /* Hack -- The only one of its kind */
2035 else if (known && object_is_artifact(o_ptr))
2037 t = object_desc_str(t, "The ");
2040 /* Hack -- single items get no prefix */
2048 /* Paranoia -- skip illegal tildes */
2049 /* while (*s == '~') s++; */
2052 if (object_is_smith(o_ptr))
2054 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
2057 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
2060 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
2061 if (o_ptr->art_name)
2063 cptr temp = quark_str(o_ptr->art_name);
2065 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
2066 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
2067 if (strncmp(temp, "of ", 3) == 0)
2069 t = object_desc_str(t, &temp[3]);
2070 t = object_desc_str(t, "¤Î");
2072 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
2073 (strncmp(temp, "¡Ô", 2) != 0) &&
2075 t = object_desc_str(t, temp);
2077 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
2078 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
2080 artifact_type *a_ptr = &a_info[o_ptr->name1];
2081 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
2082 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
2084 t = object_desc_str(t, a_name + a_ptr->name);
2087 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
2088 else if (object_is_ego(o_ptr))
2090 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2091 t = object_desc_str(t, e_name + e_ptr->name);
2096 /* Copy the string */
2097 for (s0 = NULL; *s || s0; )
2099 /* The end of the flavour/kind string. */
2106 /* Begin to append the modifier (flavor) */
2107 else if ((*s == '#') && !s0)
2112 /* Paranoia -- Never append multiple modstrs */
2116 /* Begin to append the kind name */
2117 else if ((*s == '%') && !s0)
2122 /* Paranoia -- Never append multiple kindnames */
2130 /* Add a plural if needed */
2131 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2135 /* XXX XXX XXX Mega-Hack */
2137 /* Hack -- "Cutlass-es" and "Torch-es" */
2138 if ((k == 's') || (k == 'h')) *t++ = 'e';
2160 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2163 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2164 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2165 if (o_ptr->art_name)
2169 strcpy(temp, quark_str(o_ptr->art_name));
2170 /* MEGA HACK by ita */
2171 if (strncmp(temp, "¡Ø", 2) == 0 ||
2172 strncmp(temp, "¡Ô", 2) == 0)
2173 t = object_desc_str(t, temp);
2174 else if (temp[0] == '\'')
2176 itemp = strlen(temp);
2177 temp[itemp - 1] = 0;
2178 t = object_desc_str(t, "¡Ø");
2179 t = object_desc_str(t, &temp[1]);
2180 t = object_desc_str(t, "¡Ù");
2183 else if (object_is_fixed_artifact(o_ptr))
2185 artifact_type *a_ptr = &a_info[o_ptr->name1];
2186 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2188 t = object_desc_str(t, a_name + a_ptr->name);
2191 else if (o_ptr->inscription)
2193 cptr str = quark_str(o_ptr->inscription);
2202 if (*str == '#') break;
2208 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2210 /* Add the false name */
2211 t = object_desc_str(t,"¡Ø");
2212 t = object_desc_str(t, &str[1]);
2213 t = object_desc_str(t,"¡Ù");
2218 if (object_is_smith(o_ptr))
2220 t = object_desc_str(t,format(" of %s the Smith",player_name));
2223 /* Hack -- Append "Artifact" or "Special" names */
2224 if (known && !have_flag(flgs, TR_FULL_NAME))
2226 /* Is it a new random artifact ? */
2227 if (o_ptr->art_name)
2229 t = object_desc_chr(t, ' ');
2230 t = object_desc_str(t, quark_str(o_ptr->art_name));
2233 /* Grab any artifact name */
2234 else if (object_is_fixed_artifact(o_ptr))
2236 artifact_type *a_ptr = &a_info[o_ptr->name1];
2238 t = object_desc_chr(t, ' ');
2239 t = object_desc_str(t, a_name + a_ptr->name);
2242 /* Grab any ego-item name */
2245 if (object_is_ego(o_ptr))
2247 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2249 t = object_desc_chr(t, ' ');
2250 t = object_desc_str(t, e_name + e_ptr->name);
2253 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2256 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2258 /* Add the false name */
2259 t = object_desc_chr(t, ' ');
2260 t = object_desc_str(t, &str[1]);
2267 /* No more details wanted */
2268 if (mode & OD_NAME_ONLY) goto object_desc_done;
2270 /* Hack -- Chests must be described in detail */
2271 if (o_ptr->tval == TV_CHEST)
2273 /* Not searched yet */
2279 /* May be "empty" */
2280 else if (!o_ptr->pval)
2283 t = object_desc_str(t, "(¶õ)");
2285 t = object_desc_str(t, " (empty)");
2289 /* May be "disarmed" */
2290 else if (o_ptr->pval < 0)
2292 if (chest_traps[0 - o_ptr->pval])
2295 t = object_desc_str(t, "(²ò½üºÑ)");
2297 t = object_desc_str(t, " (disarmed)");
2303 t = object_desc_str(t, "(Èó»Ü¾û)");
2305 t = object_desc_str(t, " (unlocked)");
2310 /* Describe the traps, if any */
2313 /* Describe the traps */
2314 switch (chest_traps[o_ptr->pval])
2319 t = object_desc_str(t, "(»Ü¾û)");
2321 t = object_desc_str(t, " (Locked)");
2325 case CHEST_LOSE_STR:
2328 t = object_desc_str(t, "(ÆÇ¿Ë)");
2330 t = object_desc_str(t, " (Poison Needle)");
2334 case CHEST_LOSE_CON:
2337 t = object_desc_str(t, "(ÆÇ¿Ë)");
2339 t = object_desc_str(t, " (Poison Needle)");
2346 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2348 t = object_desc_str(t, " (Gas Trap)");
2352 case CHEST_PARALYZE:
2355 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2357 t = object_desc_str(t, " (Gas Trap)");
2364 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2366 t = object_desc_str(t, " (Explosion Device)");
2371 case CHEST_BIRD_STORM:
2372 case CHEST_E_SUMMON:
2373 case CHEST_H_SUMMON:
2376 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2378 t = object_desc_str(t, " (Summoning Runes)");
2382 case CHEST_RUNES_OF_EVIL:
2385 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2387 t = object_desc_str(t, " (Gleaming Black Runes)");
2394 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2396 t = object_desc_str(t, " (Alarm)");
2403 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2405 t = object_desc_str(t, " (Multiple Traps)");
2414 /* Display the item like a weapon */
2415 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2417 /* Display the item like a weapon */
2418 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2421 /* Display the item like a weapon */
2422 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2424 /* Display the item like armour */
2425 if (o_ptr->ac) show_armour = TRUE;
2428 /* Dump base weapon info */
2429 switch (o_ptr->tval)
2431 /* Missiles and Weapons */
2440 /* In Vault Quest, hide the dice of target weapon. */
2441 if(object_is_quest_target(o_ptr) && !known)
2446 /* Append a "damage" string */
2447 t = object_desc_chr(t, ' ');
2448 t = object_desc_chr(t, p1);
2449 t = object_desc_num(t, o_ptr->dd);
2450 t = object_desc_chr(t, 'd');
2451 t = object_desc_num(t, o_ptr->ds);
2452 t = object_desc_chr(t, p2);
2458 /* Bows get a special "damage string" */
2461 /* Mega-Hack -- Extract the "base power" */
2462 power = bow_tmul(o_ptr->sval);
2464 /* Apply the "Extra Might" flag */
2465 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2467 /* Append a special "damage" string */
2468 t = object_desc_chr(t, ' ');
2469 t = object_desc_chr(t, p1);
2470 t = object_desc_chr(t, 'x');
2471 t = object_desc_num(t, power);
2472 t = object_desc_chr(t, p2);
2474 fire_rate = calc_num_fire(o_ptr);
2475 /* Show Fire rate */
2476 if (fire_rate != 0 && power > 0 && known)
2478 fire_rate = bow_energy(o_ptr->sval) / fire_rate;
2480 t = object_desc_chr(t, ' ');
2481 t = object_desc_chr(t, p1);
2482 t = object_desc_num(t, fire_rate/100);
2483 t = object_desc_chr(t, '.');
2484 t = object_desc_num(t, fire_rate%100);
2485 t = object_desc_str(t, "turn");
2486 t = object_desc_chr(t, p2);
2494 /* Add the weapon bonuses */
2497 /* Show the tohit/todam on request */
2500 t = object_desc_chr(t, ' ');
2501 t = object_desc_chr(t, p1);
2502 t = object_desc_int(t, o_ptr->to_h);
2503 t = object_desc_chr(t, ',');
2504 t = object_desc_int(t, o_ptr->to_d);
2505 t = object_desc_chr(t, p2);
2508 /* Show the tohit if needed */
2509 else if (o_ptr->to_h)
2511 t = object_desc_chr(t, ' ');
2512 t = object_desc_chr(t, p1);
2513 t = object_desc_int(t, o_ptr->to_h);
2514 t = object_desc_chr(t, p2);
2517 /* Show the todam if needed */
2518 else if (o_ptr->to_d)
2520 t = object_desc_chr(t, ' ');
2521 t = object_desc_chr(t, p1);
2522 t = object_desc_int(t, o_ptr->to_d);
2523 t = object_desc_chr(t, p2);
2527 bow_ptr = &inventory[INVEN_BOW];
2529 /* If have a firing weapon + ammo matches bow */
2530 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2532 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2533 int tmul = bow_tmul(bow_ptr->sval);
2534 s16b energy_fire = bow_energy(bow_ptr->sval);
2536 /* See if the bow is "known" - then set damage bonus */
2537 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2539 /* Effect of ammo */
2540 if (known) avgdam += (o_ptr->to_d * 10);
2542 /* Get extra "power" from "extra might" */
2543 if (p_ptr->xtra_might) tmul++;
2545 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2547 /* Launcher multiplier */
2549 avgdam /= (100 * 10);
2551 /* Get extra damage from concentration */
2552 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2554 if (avgdam < 0) avgdam = 0;
2556 /* Display (shot damage/ shot damage with critical/ avg damage with critical) */
2557 t = object_desc_chr(t, ' ');
2558 t = object_desc_chr(t, p1);
2560 if(show_ammo_no_crit)
2562 /* Damage with no-crit */
2563 t = object_desc_num(t, avgdam);
2564 t = object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2567 /* Apply Expect damage of Critical */
2568 avgdam = calc_expect_crit_shot(o_ptr->weight, o_ptr->to_h, bow_ptr->to_h, avgdam);
2569 t = object_desc_num(t, avgdam);
2571 t = show_ammo_no_crit ? object_desc_str(t, show_ammo_detail ? "/crit " : "/")
2572 : object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2574 if (p_ptr->num_fire == 0)
2576 t = object_desc_chr(t, '0');
2580 /* Calc effects of energy */
2581 avgdam *= (p_ptr->num_fire * 100);
2582 avgdam /= energy_fire;
2583 t = object_desc_num(t, avgdam);
2584 t = object_desc_str(t, show_ammo_detail ? "/turn" : "");
2586 if(show_ammo_crit_ratio)
2588 int percent = calc_crit_ratio_shot(o_ptr->weight,
2589 known ? o_ptr->to_h : 0,
2590 object_is_known(bow_ptr) ? bow_ptr->to_h : 0, avgdam);
2592 t = object_desc_chr(t, '/');
2593 t = object_desc_num(t, percent / 100);
2594 t = object_desc_chr(t, '.');
2595 t = object_desc_num(t, percent % 100);
2596 t = object_desc_str(t, show_ammo_detail ? "% crit" : "%");
2600 t = object_desc_chr(t, p2);
2602 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2604 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2605 s16b energy_fire = 100 - p_ptr->lev;
2607 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2609 /* Display (shot damage/ avg damage) */
2610 t = object_desc_chr(t, ' ');
2611 t = object_desc_chr(t, p1);
2612 t = object_desc_num(t, avgdam);
2613 t = object_desc_chr(t, '/');
2615 /* Calc effects of energy */
2616 avgdam = 100 * avgdam / energy_fire;
2618 t = object_desc_num(t, avgdam);
2619 t = object_desc_chr(t, p2);
2622 /* Add the armor bonuses */
2625 /* Show the armor class info */
2628 t = object_desc_chr(t, ' ');
2629 t = object_desc_chr(t, b1);
2630 t = object_desc_num(t, o_ptr->ac);
2631 t = object_desc_chr(t, ',');
2632 t = object_desc_int(t, o_ptr->to_a);
2633 t = object_desc_chr(t, b2);
2636 /* No base armor, but does increase armor */
2637 else if (o_ptr->to_a)
2639 t = object_desc_chr(t, ' ');
2640 t = object_desc_chr(t, b1);
2641 t = object_desc_int(t, o_ptr->to_a);
2642 t = object_desc_chr(t, b2);
2646 /* Hack -- always show base armor */
2647 else if (show_armour)
2649 t = object_desc_chr(t, ' ');
2650 t = object_desc_chr(t, b1);
2651 t = object_desc_num(t, o_ptr->ac);
2652 t = object_desc_chr(t, b2);
2656 /* No more details wanted */
2657 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2660 if (known) /* Known item only */
2663 * Hack -- Wands and Staffs have charges. Make certain how many charges
2664 * a stack of staffs really has is clear. -LM-
2666 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2668 /* Dump " (N charges)" */
2669 t = object_desc_chr(t, ' ');
2670 t = object_desc_chr(t, p1);
2672 /* Clear explaination for staffs. */
2673 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2675 t = object_desc_num(t, o_ptr->number);
2676 t = object_desc_str(t, "x ");
2678 t = object_desc_num(t, o_ptr->pval);
2680 t = object_desc_str(t, "²óʬ");
2682 t = object_desc_str(t, " charge");
2683 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2686 t = object_desc_chr(t, p2);
2688 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2689 * be in any state of charge or discharge, this now includes a number. -LM-
2691 else if (o_ptr->tval == TV_ROD)
2693 /* Hack -- Dump " (# charging)" if relevant */
2696 /* Stacks of rods display an exact count of charging rods. */
2697 if (o_ptr->number > 1)
2700 if (k_ptr->pval == 0) k_ptr->pval = 1;
2702 /* Find out how many rods are charging, by dividing
2703 * current timeout by each rod's maximum timeout.
2704 * Ensure that any remainder is rounded up. Display
2705 * very discharged stacks as merely fully discharged.
2707 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2708 if (power > o_ptr->number) power = o_ptr->number;
2710 /* Display prettily. */
2711 t = object_desc_str(t, " (");
2712 t = object_desc_num(t, power);
2714 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2716 t = object_desc_str(t, " charging)");
2720 /* "one Rod of Perception (1 charging)" would look tacky. */
2724 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2726 t = object_desc_str(t, " (charging)");
2732 /* Dump "pval" flags for wearable items */
2733 if (have_pval_flags(flgs))
2735 /* Start the display */
2736 t = object_desc_chr(t, ' ');
2737 t = object_desc_chr(t, p1);
2739 /* Dump the "pval" itself */
2740 t = object_desc_int(t, o_ptr->pval);
2742 /* Do not display the "pval" flags */
2743 if (have_flag(flgs, TR_HIDE_TYPE))
2749 else if (have_flag(flgs, TR_SPEED))
2751 /* Dump " to speed" */
2753 t = object_desc_str(t, "²Ã®");
2755 t = object_desc_str(t, " to speed");
2760 else if (have_flag(flgs, TR_BLOWS))
2764 t = object_desc_str(t, "¹¶·â");
2766 t = object_desc_str(t, " attack");
2769 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2774 else if (have_flag(flgs, TR_STEALTH))
2776 /* Dump " to stealth" */
2778 t = object_desc_str(t, "±£Ì©");
2780 t = object_desc_str(t, " to stealth");
2785 else if (have_flag(flgs, TR_SEARCH))
2787 /* Dump " to searching" */
2789 t = object_desc_str(t, "õº÷");
2791 t = object_desc_str(t, " to searching");
2796 else if (have_flag(flgs, TR_INFRA))
2798 /* Dump " to infravision" */
2800 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2802 t = object_desc_str(t, " to infravision");
2806 /* Finish the display */
2807 t = object_desc_chr(t, p2);
2810 /* Hack -- Process Lanterns/Torches */
2811 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2813 /* Hack -- Turns of light for normal lites */
2815 t = object_desc_chr(t, '(');
2817 t = object_desc_str(t, " (with ");
2820 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2821 else t = object_desc_num(t, o_ptr->xtra4);
2823 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2825 t = object_desc_str(t, " turns of light)");
2829 /* Indicate charging objects, but not rods. */
2830 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2832 /* Hack -- Dump " (charging)" if relevant */
2834 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2836 t = object_desc_str(t, " (charging)");
2842 /* No more details wanted */
2843 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2846 /* Prepare real inscriptions in a buffer */
2849 /* Auto abbreviation inscribe */
2850 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2852 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2863 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2867 /* Use the standard inscription if available */
2868 if (o_ptr->inscription)
2872 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2874 /* Get inscription and convert {%} */
2875 get_inscription(buff, o_ptr);
2877 /* strcat with correct treating of kanji */
2878 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2882 /* No fake inscription yet */
2883 fake_insc_buf[0] = '\0';
2885 /* Use the game-generated "feeling" otherwise, if available */
2888 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2891 /* Note "cursed" if the item is known to be cursed */
2892 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2895 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2897 strcpy(fake_insc_buf, "cursed");
2901 /* Note "unidentified" if the item is unidentified */
2902 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2903 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2905 && !(o_ptr->ident & IDENT_SENSE))
2908 strcpy(fake_insc_buf, "̤´ÕÄê");
2910 strcpy(fake_insc_buf, "unidentified");
2914 /* Mega-Hack -- note empty wands/staffs */
2915 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2918 strcpy(fake_insc_buf, "¶õ");
2920 strcpy(fake_insc_buf, "empty");
2924 /* Note "tried" if the object has been tested unsuccessfully */
2925 else if (!aware && object_is_tried(o_ptr))
2928 strcpy(fake_insc_buf, "̤ȽÌÀ");
2930 strcpy(fake_insc_buf, "tried");
2934 /* Note the discount, if any */
2935 if (o_ptr->discount)
2937 /* Hidden by real inscription unless in a store */
2938 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2940 char discount_num_buf[4];
2942 /* Append to other fake inscriptions if any */
2943 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2945 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2946 strcat(fake_insc_buf, discount_num_buf);
2948 strcat(fake_insc_buf, "%°ú¤");
2950 strcat(fake_insc_buf, "% off");
2956 /* Append the inscription, if any */
2957 if (fake_insc_buf[0] || tmp_val2[0])
2959 /* Append the inscription */
2960 t = object_desc_chr(t, ' ');
2961 t = object_desc_chr(t, c1);
2963 /* Append fake inscriptions */
2964 if (fake_insc_buf[0])
2966 t = object_desc_str(t, fake_insc_buf);
2969 /* Append a separater */
2970 if (fake_insc_buf[0] && tmp_val2[0])
2972 t = object_desc_chr(t, ',');
2973 t = object_desc_chr(t, ' ');
2976 /* Append real inscriptions */
2979 t = object_desc_str(t, tmp_val2);
2982 t = object_desc_chr(t, c2);
2986 my_strcpy(buf, tmp_val, MAX_NLEN);