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 buf ɽµ¤òÊÖ¤¹¤¿¤á¤Îʸ»úÎ󻲾ȥݥ¤¥ó¥¿
1282 * @param o_ptr ÆÃÀû½Ìɽµ¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
1283 * @param mode ɽµ¤Ë´Ø¤¹¤ë¥ª¥×¥·¥ç¥ó»ØÄê
1284 * @return ¸½ºß¥¯¥¨¥¹¥ÈãÀ®ÌÜŪ¤Î¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
1286 * One can choose the "verbosity" of the description, including whether\n
1287 * or not the "number" of items should be described, and how much detail\n
1288 * should be used when describing the item.\n
1290 * The given "buf" must be MAX_NLEN chars long to hold the longest possible\n
1291 * description, which can get pretty long, including incriptions, such as:\n
1292 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".\n
1293 * Note that the inscription will be clipped to keep the total description\n
1294 * under MAX_NLEN-1 chars (plus a terminator).\n
1296 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,\n
1297 * portable, versions of some common "sprintf()" commands.\n
1299 * Note that all ego-items (when known) append an "Ego-Item Name", unless\n
1300 * the item is also an artifact, which should NEVER happen.\n
1302 * Note that all artifacts (when known) append an "Artifact Name", so we\n
1303 * have special processing for "Specials" (artifact Lites, Rings, Amulets).\n
1304 * The "Specials" never use "modifiers" if they are "known", since they\n
1305 * have special "descriptions", such as "The Necklace of the Dwarves".\n
1307 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),\n
1308 * plus the artifact name, just like any other artifact, if known.\n
1310 * Special Ring's and Amulet's, if not "aware", use the same code as normal\n
1311 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or\n
1312 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,\n
1313 * they will append the artifact name, just like any artifact, if known.\n
1315 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.\n
1318 * OD_NAME_ONLY : The Cloak of Death\n
1319 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]\n
1320 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)\n
1321 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}\n
1323 * OD_OMIT_PREFIX : Forbidden numeric prefix\n
1324 * OD_NO_PLURAL : Forbidden use of plural \n
1325 * OD_STORE : Assume to be aware and known\n
1326 * OD_NO_FLAVOR : Allow to hidden flavor\n
1327 * OD_FORCE_FLAVOR : Get un-shuffled flavor name\n
1329 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1331 /* Extract object kind name */
1332 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1334 /* Extract default "base" string */
1335 cptr basenm = kindname;
1337 /* Assume no "modifier" string */
1347 bool show_weapon = FALSE;
1348 bool show_armour = FALSE;
1353 char p1 = '(', p2 = ')';
1354 char b1 = '[', b2 = ']';
1355 char c1 = '{', c2 = '}';
1357 char tmp_val[MAX_NLEN+160];
1358 char tmp_val2[MAX_NLEN+10];
1359 char fake_insc_buf[30];
1361 u32b flgs[TR_FLAG_SIZE];
1363 object_type *bow_ptr;
1365 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1366 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1368 /* Extract some flags */
1369 object_flags(o_ptr, flgs);
1371 /* See if the object is "aware" */
1372 if (object_is_aware(o_ptr)) aware = TRUE;
1374 /* See if the object is "known" */
1375 if (object_is_known(o_ptr)) known = TRUE;
1377 /* Allow flavors to be hidden when aware */
1378 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1380 /* Object is in the inventory of a store or spoiler */
1381 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1383 /* Don't show flavors */
1386 /* Pretend known and aware */
1391 /* Force to be flavor name only */
1392 if (mode & OD_FORCE_FLAVOR)
1398 /* Cancel shuffling */
1399 flavor_k_ptr = k_ptr;
1402 /* Analyze the object */
1403 switch (o_ptr->tval)
1405 /* Some objects are easy to describe */
1419 monster_race *r_ptr = &r_info[o_ptr->pval];
1428 modstr = " (empty)";
1434 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1437 cptr t = r_name + r_ptr->name;
1439 if (!(r_ptr->flags1 & RF1_UNIQUE))
1441 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1447 sprintf(tmp_val2, "(%s)", t);
1457 /* Figurines/Statues */
1461 monster_race *r_ptr = &r_info[o_ptr->pval];
1464 modstr = r_name + r_ptr->name;
1466 cptr t = r_name + r_ptr->name;
1468 if (!(r_ptr->flags1 & RF1_UNIQUE))
1470 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1487 monster_race *r_ptr = &r_info[o_ptr->pval];
1489 modstr = r_name + r_ptr->name;
1494 if (r_ptr->flags1 & RF1_UNIQUE)
1495 basenm = "& % of #";
1503 /* Missiles/ Bows/ Weapons */
1532 /* Lites (including a few "Specials") */
1538 /* Amulets (including a few "Specials") */
1541 /* Known artifacts */
1544 if (object_is_fixed_artifact(o_ptr)) break;
1545 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1548 /* Color the object */
1549 modstr = k_name + flavor_k_ptr->flavor_name;
1552 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1553 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1554 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1556 if (!flavor) basenm = "& Amulet~ of %";
1557 else if (aware) basenm = "& # Amulet~ of %";
1558 else basenm = "& # Amulet~";
1564 /* Rings (including a few "Specials") */
1567 /* Known artifacts */
1570 if (object_is_fixed_artifact(o_ptr)) break;
1571 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1574 /* Color the object */
1575 modstr = k_name + flavor_k_ptr->flavor_name;
1578 if (!flavor) basenm = "%¤Î»ØÎØ";
1579 else if (aware) basenm = "%¤Î#»ØÎØ";
1580 else basenm = "#»ØÎØ";
1582 if (!flavor) basenm = "& Ring~ of %";
1583 else if (aware) basenm = "& # Ring~ of %";
1584 else basenm = "& # Ring~";
1587 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
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 = "& Staff~ of %";
1608 else if (aware) basenm = "& # Staff~ of %";
1609 else basenm = "& # Staff~";
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 = "& Wand~ of %";
1626 else if (aware) basenm = "& # Wand~ of %";
1627 else basenm = "& # Wand~";
1635 /* Color the object */
1636 modstr = k_name + flavor_k_ptr->flavor_name;
1639 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1640 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1641 else basenm = "#¥í¥Ã¥É";
1643 if (!flavor) basenm = "& Rod~ of %";
1644 else if (aware) basenm = "& # Rod~ of %";
1645 else basenm = "& # Rod~";
1653 /* Color the object */
1654 modstr = k_name + flavor_k_ptr->flavor_name;
1657 if (!flavor) basenm = "%¤Î´¬Êª";
1658 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1659 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1661 if (!flavor) basenm = "& Scroll~ of %";
1662 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1663 else basenm = "& Scroll~ titled \"#\"";
1671 /* Color the object */
1672 modstr = k_name + flavor_k_ptr->flavor_name;
1675 if (!flavor) basenm = "%¤ÎÌô";
1676 else if (aware) basenm = "%¤Î#Ìô";
1677 else basenm = "#Ìô";
1679 if (!flavor) basenm = "& Potion~ of %";
1680 else if (aware) basenm = "& # Potion~ of %";
1681 else basenm = "& # Potion~";
1689 /* Ordinary food is "boring" */
1690 if (!k_ptr->flavor_name) break;
1692 /* Color the object */
1693 modstr = k_name + flavor_k_ptr->flavor_name;
1696 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1697 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1698 else basenm = "#¥¥Î¥³";
1700 if (!flavor) basenm = "& Mushroom~ of %";
1701 else if (aware) basenm = "& # Mushroom~ of %";
1702 else basenm = "& # Mushroom~";
1711 basenm = "ÍÓÈé»æ - %";
1713 basenm = "& Parchment~ - %";
1722 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1724 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1725 basenm = "& Book~ of Life Magic %";
1727 basenm = "& Life Spellbook~ %";
1733 case TV_SORCERY_BOOK:
1736 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1738 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1739 basenm = "& Book~ of Sorcery %";
1741 basenm = "& Sorcery Spellbook~ %";
1747 case TV_NATURE_BOOK:
1750 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1752 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1753 basenm = "& Book~ of Nature Magic %";
1755 basenm = "& Nature Spellbook~ %";
1764 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1766 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1767 basenm = "& Book~ of Chaos Magic %";
1769 basenm = "& Chaos Spellbook~ %";
1778 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1780 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1781 basenm = "& Book~ of Death Magic %";
1783 basenm = "& Death Spellbook~ %";
1792 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1794 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1795 basenm = "& Book~ of Trump Magic %";
1797 basenm = "& Trump Spellbook~ %";
1803 case TV_ARCANE_BOOK:
1806 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1808 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1809 basenm = "& Book~ of Arcane Magic %";
1811 basenm = "& Arcane Spellbook~ %";
1820 basenm = "¾¢¤ÎËâË¡½ñ%";
1822 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1823 basenm = "& Book~ of Craft Magic %";
1825 basenm = "& Craft Spellbook~ %";
1831 case TV_DAEMON_BOOK:
1834 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1836 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1837 basenm = "& Book~ of Daemon Magic %";
1839 basenm = "& Daemon Spellbook~ %";
1845 case TV_CRUSADE_BOOK:
1848 basenm = "Ç˼٤ÎËâË¡½ñ%";
1850 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1851 basenm = "& Book~ of Crusade Magic %";
1853 basenm = "& Crusade Spellbook~ %";
1864 basenm = "& Song Book~ %";
1870 case TV_HISSATSU_BOOK:
1873 basenm = "& Éð·Ý¤Î½ñ%";
1875 basenm = "Book~ of Kendo %";
1884 basenm = "¼ö½Ñ¤ÎËâË¡½ñ%";
1886 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1887 basenm = "& Book~ of Hex Magic %";
1889 basenm = "& Hex Spellbook~ %";
1895 /* Hack -- Gold/Gems */
1898 strcpy(buf, basenm);
1902 /* Used in the "inventory" routine */
1906 strcpy(buf, "(¤Ê¤·)");
1908 strcpy(buf, "(nothing)");
1915 /* Use full name from k_info or a_info */
1916 if (aware && have_flag(flgs, TR_FULL_NAME))
1918 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1919 else basenm = kindname;
1922 /* Start dumping the result */
1926 if (basenm[0] == '&')
1932 if (mode & OD_OMIT_PREFIX)
1936 else if (o_ptr->number > 1)
1938 t = object_desc_kosuu(t, o_ptr);
1939 t = object_desc_str(t, "¤Î ");
1942 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1943 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1947 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1948 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1953 /* The object "expects" a "number" */
1954 if (basenm[0] == '&')
1956 /* Skip the ampersand (and space) */
1960 if (mode & OD_OMIT_PREFIX)
1965 /* Hack -- None left */
1966 else if (o_ptr->number <= 0)
1968 t = object_desc_str(t, "no more ");
1971 /* Extract the number */
1972 else if (o_ptr->number > 1)
1974 t = object_desc_num(t, o_ptr->number);
1975 t = object_desc_chr(t, ' ');
1978 /* Hack -- The only one of its kind */
1979 else if ((known && object_is_artifact(o_ptr)) ||
1980 ((o_ptr->tval == TV_CORPSE) &&
1981 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1983 t = object_desc_str(t, "The ");
1993 case '#': vowel = is_a_vowel(modstr[0]); break;
1994 case '%': vowel = is_a_vowel(*kindname); break;
1995 default: vowel = is_a_vowel(*s); break;
2000 /* A single one, with a vowel */
2001 t = object_desc_str(t, "an ");
2005 /* A single one, without a vowel */
2006 t = object_desc_str(t, "a ");
2011 /* Hack -- objects that "never" take an article */
2018 if (mode & OD_OMIT_PREFIX)
2023 /* Hack -- all gone */
2024 else if (o_ptr->number <= 0)
2026 t = object_desc_str(t, "no more ");
2029 /* Prefix a number if required */
2030 else if (o_ptr->number > 1)
2032 t = object_desc_num(t, o_ptr->number);
2033 t = object_desc_chr(t, ' ');
2036 /* Hack -- The only one of its kind */
2037 else if (known && object_is_artifact(o_ptr))
2039 t = object_desc_str(t, "The ");
2042 /* Hack -- single items get no prefix */
2050 /* Paranoia -- skip illegal tildes */
2051 /* while (*s == '~') s++; */
2054 if (object_is_smith(o_ptr))
2056 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
2059 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
2062 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
2063 if (o_ptr->art_name)
2065 cptr temp = quark_str(o_ptr->art_name);
2067 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
2068 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
2069 if (strncmp(temp, "of ", 3) == 0)
2071 t = object_desc_str(t, &temp[3]);
2072 t = object_desc_str(t, "¤Î");
2074 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
2075 (strncmp(temp, "¡Ô", 2) != 0) &&
2077 t = object_desc_str(t, temp);
2079 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
2080 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
2082 artifact_type *a_ptr = &a_info[o_ptr->name1];
2083 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
2084 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
2086 t = object_desc_str(t, a_name + a_ptr->name);
2089 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
2090 else if (object_is_ego(o_ptr))
2092 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2093 t = object_desc_str(t, e_name + e_ptr->name);
2098 /* Copy the string */
2099 for (s0 = NULL; *s || s0; )
2101 /* The end of the flavour/kind string. */
2108 /* Begin to append the modifier (flavor) */
2109 else if ((*s == '#') && !s0)
2114 /* Paranoia -- Never append multiple modstrs */
2118 /* Begin to append the kind name */
2119 else if ((*s == '%') && !s0)
2124 /* Paranoia -- Never append multiple kindnames */
2132 /* Add a plural if needed */
2133 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2137 /* XXX XXX XXX Mega-Hack */
2139 /* Hack -- "Cutlass-es" and "Torch-es" */
2140 if ((k == 's') || (k == 'h')) *t++ = 'e';
2162 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2165 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2166 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2167 if (o_ptr->art_name)
2171 strcpy(temp, quark_str(o_ptr->art_name));
2172 /* MEGA HACK by ita */
2173 if (strncmp(temp, "¡Ø", 2) == 0 ||
2174 strncmp(temp, "¡Ô", 2) == 0)
2175 t = object_desc_str(t, temp);
2176 else if (temp[0] == '\'')
2178 itemp = strlen(temp);
2179 temp[itemp - 1] = 0;
2180 t = object_desc_str(t, "¡Ø");
2181 t = object_desc_str(t, &temp[1]);
2182 t = object_desc_str(t, "¡Ù");
2185 else if (object_is_fixed_artifact(o_ptr))
2187 artifact_type *a_ptr = &a_info[o_ptr->name1];
2188 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2190 t = object_desc_str(t, a_name + a_ptr->name);
2193 else if (o_ptr->inscription)
2195 cptr str = quark_str(o_ptr->inscription);
2204 if (*str == '#') break;
2210 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2212 /* Add the false name */
2213 t = object_desc_str(t,"¡Ø");
2214 t = object_desc_str(t, &str[1]);
2215 t = object_desc_str(t,"¡Ù");
2220 if (object_is_smith(o_ptr))
2222 t = object_desc_str(t,format(" of %s the Smith",player_name));
2225 /* Hack -- Append "Artifact" or "Special" names */
2226 if (known && !have_flag(flgs, TR_FULL_NAME))
2228 /* Is it a new random artifact ? */
2229 if (o_ptr->art_name)
2231 t = object_desc_chr(t, ' ');
2232 t = object_desc_str(t, quark_str(o_ptr->art_name));
2235 /* Grab any artifact name */
2236 else if (object_is_fixed_artifact(o_ptr))
2238 artifact_type *a_ptr = &a_info[o_ptr->name1];
2240 t = object_desc_chr(t, ' ');
2241 t = object_desc_str(t, a_name + a_ptr->name);
2244 /* Grab any ego-item name */
2247 if (object_is_ego(o_ptr))
2249 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2251 t = object_desc_chr(t, ' ');
2252 t = object_desc_str(t, e_name + e_ptr->name);
2255 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2258 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2260 /* Add the false name */
2261 t = object_desc_chr(t, ' ');
2262 t = object_desc_str(t, &str[1]);
2269 /* No more details wanted */
2270 if (mode & OD_NAME_ONLY) goto object_desc_done;
2272 /* Hack -- Chests must be described in detail */
2273 if (o_ptr->tval == TV_CHEST)
2275 /* Not searched yet */
2281 /* May be "empty" */
2282 else if (!o_ptr->pval)
2285 t = object_desc_str(t, "(¶õ)");
2287 t = object_desc_str(t, " (empty)");
2291 /* May be "disarmed" */
2292 else if (o_ptr->pval < 0)
2294 if (chest_traps[0 - o_ptr->pval])
2297 t = object_desc_str(t, "(²ò½üºÑ)");
2299 t = object_desc_str(t, " (disarmed)");
2305 t = object_desc_str(t, "(Èó»Ü¾û)");
2307 t = object_desc_str(t, " (unlocked)");
2312 /* Describe the traps, if any */
2315 /* Describe the traps */
2316 switch (chest_traps[o_ptr->pval])
2321 t = object_desc_str(t, "(»Ü¾û)");
2323 t = object_desc_str(t, " (Locked)");
2327 case CHEST_LOSE_STR:
2330 t = object_desc_str(t, "(ÆÇ¿Ë)");
2332 t = object_desc_str(t, " (Poison Needle)");
2336 case CHEST_LOSE_CON:
2339 t = object_desc_str(t, "(ÆÇ¿Ë)");
2341 t = object_desc_str(t, " (Poison Needle)");
2348 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2350 t = object_desc_str(t, " (Gas Trap)");
2354 case CHEST_PARALYZE:
2357 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2359 t = object_desc_str(t, " (Gas Trap)");
2366 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2368 t = object_desc_str(t, " (Explosion Device)");
2373 case CHEST_BIRD_STORM:
2374 case CHEST_E_SUMMON:
2375 case CHEST_H_SUMMON:
2378 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2380 t = object_desc_str(t, " (Summoning Runes)");
2384 case CHEST_RUNES_OF_EVIL:
2387 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2389 t = object_desc_str(t, " (Gleaming Black Runes)");
2396 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2398 t = object_desc_str(t, " (Alarm)");
2405 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2407 t = object_desc_str(t, " (Multiple Traps)");
2416 /* Display the item like a weapon */
2417 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2419 /* Display the item like a weapon */
2420 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2423 /* Display the item like a weapon */
2424 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2426 /* Display the item like armour */
2427 if (o_ptr->ac) show_armour = TRUE;
2430 /* Dump base weapon info */
2431 switch (o_ptr->tval)
2433 /* Missiles and Weapons */
2442 /* In Vault Quest, hide the dice of target weapon. */
2443 if(object_is_quest_target(o_ptr) && !known)
2448 /* Append a "damage" string */
2449 t = object_desc_chr(t, ' ');
2450 t = object_desc_chr(t, p1);
2451 t = object_desc_num(t, o_ptr->dd);
2452 t = object_desc_chr(t, 'd');
2453 t = object_desc_num(t, o_ptr->ds);
2454 t = object_desc_chr(t, p2);
2460 /* Bows get a special "damage string" */
2463 /* Mega-Hack -- Extract the "base power" */
2464 power = bow_tmul(o_ptr->sval);
2466 /* Apply the "Extra Might" flag */
2467 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2469 /* Append a special "damage" string */
2470 t = object_desc_chr(t, ' ');
2471 t = object_desc_chr(t, p1);
2472 t = object_desc_chr(t, 'x');
2473 t = object_desc_num(t, power);
2474 t = object_desc_chr(t, p2);
2476 fire_rate = calc_num_fire(o_ptr);
2477 /* Show Fire rate */
2478 if (fire_rate != 0 && power > 0 && known)
2480 fire_rate = bow_energy(o_ptr->sval) / fire_rate;
2482 t = object_desc_chr(t, ' ');
2483 t = object_desc_chr(t, p1);
2484 t = object_desc_num(t, fire_rate/100);
2485 t = object_desc_chr(t, '.');
2486 t = object_desc_num(t, fire_rate%100);
2487 t = object_desc_str(t, "turn");
2488 t = object_desc_chr(t, p2);
2496 /* Add the weapon bonuses */
2499 /* Show the tohit/todam on request */
2502 t = object_desc_chr(t, ' ');
2503 t = object_desc_chr(t, p1);
2504 t = object_desc_int(t, o_ptr->to_h);
2505 t = object_desc_chr(t, ',');
2506 t = object_desc_int(t, o_ptr->to_d);
2507 t = object_desc_chr(t, p2);
2510 /* Show the tohit if needed */
2511 else if (o_ptr->to_h)
2513 t = object_desc_chr(t, ' ');
2514 t = object_desc_chr(t, p1);
2515 t = object_desc_int(t, o_ptr->to_h);
2516 t = object_desc_chr(t, p2);
2519 /* Show the todam if needed */
2520 else if (o_ptr->to_d)
2522 t = object_desc_chr(t, ' ');
2523 t = object_desc_chr(t, p1);
2524 t = object_desc_int(t, o_ptr->to_d);
2525 t = object_desc_chr(t, p2);
2529 bow_ptr = &inventory[INVEN_BOW];
2531 /* If have a firing weapon + ammo matches bow */
2532 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2534 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2535 int tmul = bow_tmul(bow_ptr->sval);
2536 s16b energy_fire = bow_energy(bow_ptr->sval);
2538 /* See if the bow is "known" - then set damage bonus */
2539 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2541 /* Effect of ammo */
2542 if (known) avgdam += (o_ptr->to_d * 10);
2544 /* Get extra "power" from "extra might" */
2545 if (p_ptr->xtra_might) tmul++;
2547 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2549 /* Launcher multiplier */
2551 avgdam /= (100 * 10);
2553 /* Get extra damage from concentration */
2554 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2556 if (avgdam < 0) avgdam = 0;
2558 /* Display (shot damage/ shot damage with critical/ avg damage with critical) */
2559 t = object_desc_chr(t, ' ');
2560 t = object_desc_chr(t, p1);
2562 if(show_ammo_no_crit)
2564 /* Damage with no-crit */
2565 t = object_desc_num(t, avgdam);
2566 t = object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2569 /* Apply Expect damage of Critical */
2570 avgdam = calc_expect_crit_shot(o_ptr->weight, o_ptr->to_h, bow_ptr->to_h, avgdam);
2571 t = object_desc_num(t, avgdam);
2573 t = show_ammo_no_crit ? object_desc_str(t, show_ammo_detail ? "/crit " : "/")
2574 : object_desc_str(t, show_ammo_detail ? "/shot " : "/");
2576 if (p_ptr->num_fire == 0)
2578 t = object_desc_chr(t, '0');
2582 /* Calc effects of energy */
2583 avgdam *= (p_ptr->num_fire * 100);
2584 avgdam /= energy_fire;
2585 t = object_desc_num(t, avgdam);
2586 t = object_desc_str(t, show_ammo_detail ? "/turn" : "");
2588 if(show_ammo_crit_ratio)
2590 int percent = calc_crit_ratio_shot(o_ptr->weight,
2591 known ? o_ptr->to_h : 0,
2592 object_is_known(bow_ptr) ? bow_ptr->to_h : 0, avgdam);
2594 t = object_desc_chr(t, '/');
2595 t = object_desc_num(t, percent / 100);
2596 t = object_desc_chr(t, '.');
2597 t = object_desc_num(t, percent % 100);
2598 t = object_desc_str(t, show_ammo_detail ? "% crit" : "%");
2602 t = object_desc_chr(t, p2);
2604 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2606 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2607 s16b energy_fire = 100 - p_ptr->lev;
2609 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2611 /* Display (shot damage/ avg damage) */
2612 t = object_desc_chr(t, ' ');
2613 t = object_desc_chr(t, p1);
2614 t = object_desc_num(t, avgdam);
2615 t = object_desc_chr(t, '/');
2617 /* Calc effects of energy */
2618 avgdam = 100 * avgdam / energy_fire;
2620 t = object_desc_num(t, avgdam);
2621 t = object_desc_chr(t, p2);
2624 /* Add the armor bonuses */
2627 /* Show the armor class info */
2630 t = object_desc_chr(t, ' ');
2631 t = object_desc_chr(t, b1);
2632 t = object_desc_num(t, o_ptr->ac);
2633 t = object_desc_chr(t, ',');
2634 t = object_desc_int(t, o_ptr->to_a);
2635 t = object_desc_chr(t, b2);
2638 /* No base armor, but does increase armor */
2639 else if (o_ptr->to_a)
2641 t = object_desc_chr(t, ' ');
2642 t = object_desc_chr(t, b1);
2643 t = object_desc_int(t, o_ptr->to_a);
2644 t = object_desc_chr(t, b2);
2648 /* Hack -- always show base armor */
2649 else if (show_armour)
2651 t = object_desc_chr(t, ' ');
2652 t = object_desc_chr(t, b1);
2653 t = object_desc_num(t, o_ptr->ac);
2654 t = object_desc_chr(t, b2);
2658 /* No more details wanted */
2659 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2662 if (known) /* Known item only */
2665 * Hack -- Wands and Staffs have charges. Make certain how many charges
2666 * a stack of staffs really has is clear. -LM-
2668 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2670 /* Dump " (N charges)" */
2671 t = object_desc_chr(t, ' ');
2672 t = object_desc_chr(t, p1);
2674 /* Clear explaination for staffs. */
2675 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2677 t = object_desc_num(t, o_ptr->number);
2678 t = object_desc_str(t, "x ");
2680 t = object_desc_num(t, o_ptr->pval);
2682 t = object_desc_str(t, "²óʬ");
2684 t = object_desc_str(t, " charge");
2685 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2688 t = object_desc_chr(t, p2);
2690 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2691 * be in any state of charge or discharge, this now includes a number. -LM-
2693 else if (o_ptr->tval == TV_ROD)
2695 /* Hack -- Dump " (# charging)" if relevant */
2698 /* Stacks of rods display an exact count of charging rods. */
2699 if (o_ptr->number > 1)
2702 if (k_ptr->pval == 0) k_ptr->pval = 1;
2704 /* Find out how many rods are charging, by dividing
2705 * current timeout by each rod's maximum timeout.
2706 * Ensure that any remainder is rounded up. Display
2707 * very discharged stacks as merely fully discharged.
2709 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2710 if (power > o_ptr->number) power = o_ptr->number;
2712 /* Display prettily. */
2713 t = object_desc_str(t, " (");
2714 t = object_desc_num(t, power);
2716 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2718 t = object_desc_str(t, " charging)");
2722 /* "one Rod of Perception (1 charging)" would look tacky. */
2726 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2728 t = object_desc_str(t, " (charging)");
2734 /* Dump "pval" flags for wearable items */
2735 if (have_pval_flags(flgs))
2737 /* Start the display */
2738 t = object_desc_chr(t, ' ');
2739 t = object_desc_chr(t, p1);
2741 /* Dump the "pval" itself */
2742 t = object_desc_int(t, o_ptr->pval);
2744 /* Do not display the "pval" flags */
2745 if (have_flag(flgs, TR_HIDE_TYPE))
2751 else if (have_flag(flgs, TR_SPEED))
2753 /* Dump " to speed" */
2755 t = object_desc_str(t, "²Ã®");
2757 t = object_desc_str(t, " to speed");
2762 else if (have_flag(flgs, TR_BLOWS))
2766 t = object_desc_str(t, "¹¶·â");
2768 t = object_desc_str(t, " attack");
2771 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2776 else if (have_flag(flgs, TR_STEALTH))
2778 /* Dump " to stealth" */
2780 t = object_desc_str(t, "±£Ì©");
2782 t = object_desc_str(t, " to stealth");
2787 else if (have_flag(flgs, TR_SEARCH))
2789 /* Dump " to searching" */
2791 t = object_desc_str(t, "õº÷");
2793 t = object_desc_str(t, " to searching");
2798 else if (have_flag(flgs, TR_INFRA))
2800 /* Dump " to infravision" */
2802 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2804 t = object_desc_str(t, " to infravision");
2808 /* Finish the display */
2809 t = object_desc_chr(t, p2);
2812 /* Hack -- Process Lanterns/Torches */
2813 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2815 /* Hack -- Turns of light for normal lites */
2817 t = object_desc_chr(t, '(');
2819 t = object_desc_str(t, " (with ");
2822 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2823 else t = object_desc_num(t, o_ptr->xtra4);
2825 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2827 t = object_desc_str(t, " turns of light)");
2831 /* Indicate charging objects, but not rods. */
2832 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2834 /* Hack -- Dump " (charging)" if relevant */
2836 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2838 t = object_desc_str(t, " (charging)");
2844 /* No more details wanted */
2845 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2848 /* Prepare real inscriptions in a buffer */
2851 /* Auto abbreviation inscribe */
2852 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2854 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2865 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2869 /* Use the standard inscription if available */
2870 if (o_ptr->inscription)
2874 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2876 /* Get inscription and convert {%} */
2877 get_inscription(buff, o_ptr);
2879 /* strcat with correct treating of kanji */
2880 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2884 /* No fake inscription yet */
2885 fake_insc_buf[0] = '\0';
2887 /* Use the game-generated "feeling" otherwise, if available */
2890 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2893 /* Note "cursed" if the item is known to be cursed */
2894 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2897 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2899 strcpy(fake_insc_buf, "cursed");
2903 /* Note "unidentified" if the item is unidentified */
2904 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2905 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2907 && !(o_ptr->ident & IDENT_SENSE))
2910 strcpy(fake_insc_buf, "̤´ÕÄê");
2912 strcpy(fake_insc_buf, "unidentified");
2916 /* Mega-Hack -- note empty wands/staffs */
2917 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2920 strcpy(fake_insc_buf, "¶õ");
2922 strcpy(fake_insc_buf, "empty");
2926 /* Note "tried" if the object has been tested unsuccessfully */
2927 else if (!aware && object_is_tried(o_ptr))
2930 strcpy(fake_insc_buf, "̤ȽÌÀ");
2932 strcpy(fake_insc_buf, "tried");
2936 /* Note the discount, if any */
2937 if (o_ptr->discount)
2939 /* Hidden by real inscription unless in a store */
2940 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2942 char discount_num_buf[4];
2944 /* Append to other fake inscriptions if any */
2945 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2947 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2948 strcat(fake_insc_buf, discount_num_buf);
2950 strcat(fake_insc_buf, "%°ú¤");
2952 strcat(fake_insc_buf, "% off");
2958 /* Append the inscription, if any */
2959 if (fake_insc_buf[0] || tmp_val2[0])
2961 /* Append the inscription */
2962 t = object_desc_chr(t, ' ');
2963 t = object_desc_chr(t, c1);
2965 /* Append fake inscriptions */
2966 if (fake_insc_buf[0])
2968 t = object_desc_str(t, fake_insc_buf);
2971 /* Append a separater */
2972 if (fake_insc_buf[0] && tmp_val2[0])
2974 t = object_desc_chr(t, ',');
2975 t = object_desc_chr(t, ' ');
2978 /* Append real inscriptions */
2981 t = object_desc_str(t, tmp_val2);
2984 t = object_desc_chr(t, c2);
2988 my_strcpy(buf, tmp_val, MAX_NLEN);