1 /* Purpose: Object flavor code */
4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
14 * Certain items, if aware, are known instantly
15 * This function is used only by "flavor_init()"
17 static bool object_easy_know(int i)
19 object_kind *k_ptr = &k_info[i];
21 /* Analyze the "tval" */
36 case TV_HISSATSU_BOOK:
53 /* All Food, Potions, Scrolls, Rods */
69 * Create a name from random parts.
71 void get_table_name_aux(char *out_string)
75 get_rnd_line("aname_j.txt", 1, Syllable);
76 strcpy(out_string, Syllable);
77 get_rnd_line("aname_j.txt", 2, Syllable);
78 strcat(out_string, Syllable);
80 #define MAX_SYLLABLES 164 /* Used with scrolls (see below) */
82 static cptr syllables[MAX_SYLLABLES] = {
83 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
84 "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
85 "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
86 "byt", "comp", "con", "cos", "cre", "dalf", "dan",
87 "den", "der", "doe", "dok", "eep", "el", "eng", "er", "ere", "erk",
88 "esh", "evs", "fa", "fid", "flit", "for", "fri", "fu", "gan",
89 "gar", "glen", "gop", "gre", "ha", "he", "hyd", "i",
90 "ing", "ion", "ip", "ish", "it", "ite", "iv", "jo",
91 "kho", "kli", "klis", "la", "lech", "man", "mar",
92 "me", "mi", "mic", "mik", "mon", "mung", "mur", "nag", "nej",
93 "nelg", "nep", "ner", "nes", "nis", "nih", "nin", "o",
94 "od", "ood", "org", "orn", "ox", "oxy", "pay", "pet",
95 "ple", "plu", "po", "pot", "prok", "re", "rea", "rhov",
96 "ri", "ro", "rog", "rok", "rol", "sa", "san", "sat",
97 "see", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
98 "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab",
99 "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
100 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly",
101 "vom", "wah", "wed", "werg", "wex", "whon", "wun", "x",
102 "yerg", "yp", "zun", "tri", "blaa", "jah", "bul", "on",
106 int testcounter = randint1(3) + 1;
108 strcpy(out_string, "");
110 if (randint1(3) == 2)
112 while (testcounter--)
113 strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
118 testcounter = randint1(2) + 1;
119 while (testcounter--)
121 (void)get_rnd_line("elvish.txt", 0, Syllable);
122 strcat(out_string, Syllable);
126 out_string[0] = toupper(out_string[1]);
128 out_string[16] = '\0';
134 * Create a name from random parts with quotes.
136 void get_table_name(char *out_string)
139 get_table_name_aux(buff);
142 sprintf(out_string, "¡Ø%s¡Ù", buff);
144 sprintf(out_string, "'%s'", buff);
150 * Make random Sindarin name
152 void get_table_sindarin_aux(char *out_string)
159 get_rnd_line("sname.txt", 1, Syllable);
161 strcpy(tmp, Syllable);
163 strcpy(out_string, Syllable);
166 get_rnd_line("sname.txt", 2, Syllable);
168 strcat(tmp, Syllable);
169 sindarin_to_kana(out_string, tmp);
171 strcat(out_string, Syllable);
177 * Make random Sindarin name with quotes
179 void get_table_sindarin(char *out_string)
182 get_table_sindarin_aux(buff);
185 sprintf(out_string, "¡Ø%s¡Ù", buff);
187 sprintf(out_string, "'%s'", buff);
193 * Shuffle flavor indices of a group of objects with given tval
195 static void shuffle_flavors(byte tval)
198 int k_idx_list_num = 0;
201 /* Allocate an array for a list of k_idx */
202 C_MAKE(k_idx_list, max_k_idx, s16b);
204 /* Search objects with given tval for shuffle */
205 for (i = 0; i < max_k_idx; i++)
207 object_kind *k_ptr = &k_info[i];
210 if (k_ptr->tval != tval) continue;
212 /* Paranoia -- Skip objects without flavor */
213 if (!k_ptr->flavor) continue;
215 /* Skip objects with a fixed flavor name */
216 if (have_flag(k_ptr->flags, TR_FIXED_FLAVOR)) continue;
219 k_idx_list[k_idx_list_num] = i;
221 /* Increase number of remembered indices */
225 /* Shuffle flavors */
226 for (i = 0; i < k_idx_list_num; i++)
228 object_kind *k1_ptr = &k_info[k_idx_list[i]];
229 object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
231 /* Swap flavors of this pair */
232 s16b tmp = k1_ptr->flavor;
233 k1_ptr->flavor = k2_ptr->flavor;
234 k2_ptr->flavor = tmp;
237 /* Free an array for a list of k_idx */
238 C_KILL(k_idx_list, max_k_idx, s16b);
242 * Prepare the "variable" part of the "k_info" array.
244 * The "color"/"metal"/"type" of an item is its "flavor".
245 * For the most part, flavors are assigned randomly each game.
247 * Initialize descriptions for the "colored" objects, including:
248 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.
250 * The first 4 entries for potions are fixed (Water, Apple Juice,
251 * Slime Mold Juice, Unused Potion).
253 * Scroll titles are always between 6 and 14 letters long. This is
254 * ensured because every title is composed of whole words, where every
255 * word is from 1 to 8 letters long (one or two syllables of 1 to 4
256 * letters each), and that no scroll is finished until it attempts to
257 * grow beyond 15 letters. The first time this can happen is when the
258 * current title has 6 letters and the new word has 8 letters, which
259 * would result in a 6 letter scroll title.
261 * Duplicate titles are avoided by requiring that no two scrolls share
262 * the same first four letters (not the most efficient method, and not
263 * the least efficient method, but it will always work).
265 * Hack -- make sure everything stays the same for each saved game
266 * This is accomplished by the use of a saved "random seed", as in
267 * "town_gen()". Since no other functions are called while the special
268 * seed is in effect, so this function is pretty "safe".
270 * Note that the "hacked seed" may provide an RNG with alternating parity!
272 void flavor_init(void)
276 /* Hack -- Use the "simple" RNG */
279 /* Hack -- Induce consistant flavors */
280 Rand_value = seed_flavor;
283 /* Initialize flavor index of each object by itself */
284 for (i = 0; i < max_k_idx; i++)
286 object_kind *k_ptr = &k_info[i];
288 /* Skip objects without flavor name */
289 if (!k_ptr->flavor_name) continue;
292 * Initialize flavor index to itself
293 * -> Shuffle it later
299 shuffle_flavors(TV_RING);
301 /* Shuffle Amulets */
302 shuffle_flavors(TV_AMULET);
305 shuffle_flavors(TV_STAFF);
308 shuffle_flavors(TV_WAND);
311 shuffle_flavors(TV_ROD);
313 /* Shuffle Mushrooms */
314 shuffle_flavors(TV_FOOD);
316 /* Shuffle Potions */
317 shuffle_flavors(TV_POTION);
319 /* Shuffle Scrolls */
320 shuffle_flavors(TV_SCROLL);
323 /* Hack -- Use the "complex" RNG */
326 /* Analyze every object */
327 for (i = 1; i < max_k_idx; i++)
329 object_kind *k_ptr = &k_info[i];
331 /* Skip "empty" objects */
332 if (!k_ptr->name) continue;
334 /* No flavor yields aware */
335 if (!k_ptr->flavor) k_ptr->aware = TRUE;
337 /* Check for "easily known" */
338 k_ptr->easy_know = object_easy_know(i);
344 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),
345 * and return a pointer to the terminator (t + 1).
347 static char *object_desc_chr(char *t, char c)
361 * Print a string "s" into a string "t", as if by strcpy(t, s),
362 * and return a pointer to the terminator.
364 static char *object_desc_str(char *t, cptr s)
366 /* Copy the string */
367 while (*s) *t++ = *s++;
379 * Print an unsigned number "n" into a string "t", as if by
380 * sprintf(t, "%u", n), and return a pointer to the terminator.
382 static char *object_desc_num(char *t, uint n)
386 /* Find "size" of "n" */
387 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
389 /* Dump each digit */
395 /* Remove the digit */
398 /* Process next digit */
414 * ÆüËܸì¤Î¸Ä¿ôɽ¼¨¥ë¡¼¥Á¥ó
415 *¡Êcmd1.c ¤ÇήÍѤ¹¤ë¤¿¤á¤Ë object_desc_japanese ¤«¤é°ÜÆ°¤·¤¿¡£¡Ë
418 char *object_desc_kosuu(char *t, object_type *o_ptr)
420 t = object_desc_num(t, o_ptr->number);
432 t = object_desc_str(t, "ËÜ");
437 t = object_desc_str(t, "´¬");
442 t = object_desc_str(t, "Éþ");
446 case TV_SORCERY_BOOK:
454 case TV_CRUSADE_BOOK:
456 case TV_HISSATSU_BOOK:
459 t = object_desc_str(t, "ºý");
467 t = object_desc_str(t, "Ãå");
474 t = object_desc_str(t, "¿¶");
479 t = object_desc_str(t, "");
484 t = object_desc_str(t, "Ëç");
487 /* ¿©¤Ù¤â¤Î by ita */
490 if(o_ptr->sval == SV_FOOD_JERKY)
492 t = object_desc_str(t, "ÀÚ¤ì");
498 if (o_ptr->number < 10)
500 t = object_desc_str(t, "¤Ä");
504 t = object_desc_str(t, "¸Ä");
514 * Print an signed number "v" into a string "t", as if by
515 * sprintf(t, "%+d", n), and return a pointer to the terminator.
516 * Note that we always print a sign, either "+" or "-".
518 static char *object_desc_int(char *t, sint v)
525 /* Take the absolute value */
528 /* Use a "minus" sign */
532 /* Positive (or zero) */
535 /* Use the actual number */
538 /* Use a "plus" sign */
542 /* Find "size" of "n" */
543 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
545 /* Dump each digit */
551 /* Remove the digit */
554 /* Process next digit */
567 * Structs and tables for Auto Inscription for flags
570 typedef struct flag_insc_table
581 static flag_insc_table flag_insc_plus[] =
583 { "¹¶", "At", TR_BLOWS, -1 },
584 { "®", "Sp", TR_SPEED, -1 },
585 { "ÏÓ", "St", TR_STR, -1 },
586 { "ÃÎ", "In", TR_INT, -1 },
587 { "¸", "Wi", TR_WIS, -1 },
588 { "´ï", "Dx", TR_DEX, -1 },
589 { "ÂÑ", "Cn", TR_CON, -1 },
590 { "̥", "Ch", TR_CHR, -1 },
591 { "ƻ", "Md", TR_MAGIC_MASTERY, -1 },
592 { "±£", "Sl", TR_STEALTH, -1 },
593 { "õ", "Sr", TR_SEARCH, -1 },
594 { "ÀÖ", "If", TR_INFRA, -1 },
595 { "·¡", "Dg", TR_TUNNEL, -1 },
596 { NULL, NULL, 0, -1 }
599 static flag_insc_table flag_insc_immune[] =
601 { "»À", "Ac", TR_IM_ACID, -1 },
602 { "ÅÅ", "El", TR_IM_ELEC, -1 },
603 { "²Ð", "Fi", TR_IM_FIRE, -1 },
604 { "Îä", "Co", TR_IM_COLD, -1 },
605 { NULL, NULL, 0, -1 }
608 static flag_insc_table flag_insc_resistance[] =
610 { "»À", "Ac", TR_RES_ACID, TR_IM_ACID },
611 { "ÅÅ", "El", TR_RES_ELEC, TR_IM_ELEC },
612 { "²Ð", "Fi", TR_RES_FIRE, TR_IM_FIRE },
613 { "Îä", "Co", TR_RES_COLD, TR_IM_COLD },
614 { "ÆÇ", "Po", TR_RES_POIS, -1 },
615 { "Á®", "Li", TR_RES_LITE, -1 },
616 { "°Å", "Dk", TR_RES_DARK, -1 },
617 { "ÇË", "Sh", TR_RES_SHARDS, -1 },
618 { "ÌÕ", "Bl", TR_RES_BLIND, -1 },
619 { "Íð", "Cf", TR_RES_CONF, -1 },
620 { "¹ì", "So", TR_RES_SOUND, -1 },
621 { "¹ö", "Nt", TR_RES_NETHER, -1 },
622 { "°ø", "Nx", TR_RES_NEXUS, -1 },
623 { "ÆÙ", "Ca", TR_RES_CHAOS, -1 },
624 { "Îô", "Di", TR_RES_DISEN, -1 },
625 { "¶²", "Fe", TR_RES_FEAR, -1 },
626 { NULL, NULL, 0, -1 }
629 static flag_insc_table flag_insc_misc[] =
631 { "°×", "Es", TR_EASY_SPELL, -1 },
632 { "¸º", "Dm", TR_DEC_MANA, -1 },
633 { "Åê", "Th", TR_THROW, -1 },
634 { "ȿ", "Rf", TR_REFLECT, -1 },
635 { "Ëã", "Fa", TR_FREE_ACT, -1 },
636 { "ȑ", "Si", TR_SEE_INVIS, -1 },
637 { "·Ð", "Hl", TR_HOLD_LIFE, -1 },
638 { "ÃÙ", "Sd", TR_SLOW_DIGEST, -1 },
639 { "³è", "Rg", TR_REGEN, -1 },
640 { "Éâ", "Lv", TR_LEVITATION, -1 },
641 { "ÌÀ", "Lu", TR_LITE, -1 },
642 { "·Ù", "Wr", TR_WARNING, -1 },
643 { "ÇÜ", "Xm", TR_XTRA_MIGHT, -1 },
644 { "¼Í", "Xs", TR_XTRA_SHOTS, -1 },
645 { "½Ö", "Te", TR_TELEPORT, -1 },
646 { "ÅÜ", "Ag", TR_AGGRAVATE, -1 },
647 { "½Ë", "Bs", TR_BLESSED, -1 },
648 { "´÷", "Ty", TR_TY_CURSE, -1 },
649 { NULL, NULL, 0, -1 }
652 static flag_insc_table flag_insc_aura[] =
654 { "±ê", "F", TR_SH_FIRE, -1 },
655 { "ÅÅ", "E", TR_SH_ELEC, -1 },
656 { "Îä", "C", TR_SH_COLD, -1 },
657 { "Ëâ", "M", TR_NO_MAGIC, -1 },
658 { "½Ö", "T", TR_NO_TELE, -1 },
659 { NULL, NULL, 0, -1 }
662 static flag_insc_table flag_insc_brand[] =
664 { "»À", "A", TR_BRAND_ACID, -1 },
665 { "ÅÅ", "E", TR_BRAND_ELEC, -1 },
666 { "¾Æ", "F", TR_BRAND_FIRE, -1 },
667 { "Åà", "Co", TR_BRAND_COLD, -1 },
668 { "ÆÇ", "P", TR_BRAND_POIS, -1 },
669 { "ÆÙ", "Ca", TR_CHAOTIC, -1 },
670 { "µÛ", "V", TR_VAMPIRIC, -1 },
671 { "¿Ì", "Q", TR_IMPACT, -1 },
672 { "ÀÚ", "S", TR_VORPAL, -1 },
673 { "Íý", "M", TR_FORCE_WEAPON, -1 },
674 { NULL, NULL, 0, -1 }
677 static flag_insc_table flag_insc_kill[] =
679 { "¼Ù", "*", TR_KILL_EVIL, -1 },
680 { "¿Í", "p", TR_KILL_HUMAN, -1 },
681 { "ζ", "D", TR_KILL_DRAGON, -1 },
682 { "¥ª", "o", TR_KILL_ORC, -1 },
683 { "¥È", "T", TR_KILL_TROLL, -1 },
684 { "µð", "P", TR_KILL_GIANT, -1 },
685 { "¥Ç", "U", TR_KILL_DEMON, -1 },
686 { "Ȉ", "L", TR_KILL_UNDEAD, -1 },
687 { "ư", "Z", TR_KILL_ANIMAL, -1 },
688 { NULL, NULL, 0, -1 }
691 static flag_insc_table flag_insc_slay[] =
693 { "¼Ù", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
694 { "¿Í", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
695 { "ε", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
696 { "¥ª", "o", TR_SLAY_ORC, TR_KILL_ORC },
697 { "¥È", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
698 { "µð", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
699 { "¥Ç", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
700 { "Ȉ", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
701 { "ư", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
702 { NULL, NULL, 0, -1 }
705 static flag_insc_table flag_insc_esp1[] =
707 { "´¶", "Tele", TR_TELEPATHY, -1 },
708 { "¼Ù", "Evil", TR_ESP_EVIL, -1 },
709 { "Á±", "Good", TR_ESP_GOOD, -1 },
710 { "̵", "Nolv", TR_ESP_NONLIVING, -1 },
711 { "¸Ä", "Uniq", TR_ESP_UNIQUE, -1 },
712 { NULL, NULL, 0, -1 }
715 static flag_insc_table flag_insc_esp2[] =
717 { "¿Í", "p", TR_ESP_HUMAN, -1 },
718 { "ε", "D", TR_ESP_DRAGON, -1 },
719 { "¥ª", "o", TR_ESP_ORC, -1 },
720 { "¥È", "T", TR_ESP_TROLL, -1 },
721 { "µð", "P", TR_ESP_GIANT, -1 },
722 { "¥Ç", "U", TR_ESP_DEMON, -1 },
723 { "Ȉ", "L", TR_ESP_UNDEAD, -1 },
724 { "ư", "Z", TR_ESP_ANIMAL, -1 },
725 { NULL, NULL, 0, -1 }
728 static flag_insc_table flag_insc_sust[] =
730 { "ÏÓ", "St", TR_SUST_STR, -1 },
731 { "ÃÎ", "In", TR_SUST_INT, -1 },
732 { "¸", "Wi", TR_SUST_WIS, -1 },
733 { "´ï", "Dx", TR_SUST_DEX, -1 },
734 { "ÂÑ", "Cn", TR_SUST_CON, -1 },
735 { "̥", "Ch", TR_SUST_CHR, -1 },
736 { NULL, NULL, 0, -1 }
740 static flag_insc_table flag_insc_plus[] =
742 { "At", TR_BLOWS, -1 },
743 { "Sp", TR_SPEED, -1 },
744 { "St", TR_STR, -1 },
745 { "In", TR_INT, -1 },
746 { "Wi", TR_WIS, -1 },
747 { "Dx", TR_DEX, -1 },
748 { "Cn", TR_CON, -1 },
749 { "Ch", TR_CHR, -1 },
750 { "Md", TR_MAGIC_MASTERY, -1 },
751 { "Sl", TR_STEALTH, -1 },
752 { "Sr", TR_SEARCH, -1 },
753 { "If", TR_INFRA, -1 },
754 { "Dg", TR_TUNNEL, -1 },
758 static flag_insc_table flag_insc_immune[] =
760 { "Ac", TR_IM_ACID, -1 },
761 { "El", TR_IM_ELEC, -1 },
762 { "Fi", TR_IM_FIRE, -1 },
763 { "Co", TR_IM_COLD, -1 },
767 static flag_insc_table flag_insc_resistance[] =
769 { "Ac", TR_RES_ACID, TR_IM_ACID },
770 { "El", TR_RES_ELEC, TR_IM_ELEC },
771 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
772 { "Co", TR_RES_COLD, TR_IM_COLD },
773 { "Po", TR_RES_POIS, -1 },
774 { "Li", TR_RES_LITE, -1 },
775 { "Dk", TR_RES_DARK, -1 },
776 { "Sh", TR_RES_SHARDS, -1 },
777 { "Bl", TR_RES_BLIND, -1 },
778 { "Cf", TR_RES_CONF, -1 },
779 { "So", TR_RES_SOUND, -1 },
780 { "Nt", TR_RES_NETHER, -1 },
781 { "Nx", TR_RES_NEXUS, -1 },
782 { "Ca", TR_RES_CHAOS, -1 },
783 { "Di", TR_RES_DISEN, -1 },
784 { "Fe", TR_RES_FEAR, -1 },
788 static flag_insc_table flag_insc_misc[] =
790 { "Es", TR_EASY_SPELL, -1 },
791 { "Dm", TR_DEC_MANA, -1 },
792 { "Th", TR_THROW, -1 },
793 { "Rf", TR_REFLECT, -1 },
794 { "Fa", TR_FREE_ACT, -1 },
795 { "Si", TR_SEE_INVIS, -1 },
796 { "Hl", TR_HOLD_LIFE, -1 },
797 { "Sd", TR_SLOW_DIGEST, -1 },
798 { "Rg", TR_REGEN, -1 },
799 { "Lv", TR_LEVITATION, -1 },
800 { "Lu", TR_LITE, -1 },
801 { "Wr", TR_WARNING, -1 },
802 { "Xm", TR_XTRA_MIGHT, -1 },
803 { "Xs", TR_XTRA_SHOTS, -1 },
804 { "Te", TR_TELEPORT, -1 },
805 { "Ag", TR_AGGRAVATE, -1 },
806 { "Bs", TR_BLESSED, -1 },
807 { "Ty", TR_TY_CURSE, -1 },
811 static flag_insc_table flag_insc_aura[] =
813 { "F", TR_SH_FIRE, -1 },
814 { "E", TR_SH_ELEC, -1 },
815 { "C", TR_SH_COLD, -1 },
816 { "M", TR_NO_MAGIC, -1 },
817 { "T", TR_NO_TELE, -1 },
821 static flag_insc_table flag_insc_brand[] =
823 { "A", TR_BRAND_ACID, -1 },
824 { "E", TR_BRAND_ELEC, -1 },
825 { "F", TR_BRAND_FIRE, -1 },
826 { "Co", TR_BRAND_COLD, -1 },
827 { "P", TR_BRAND_POIS, -1 },
828 { "Ca", TR_CHAOTIC, -1 },
829 { "V", TR_VAMPIRIC, -1 },
830 { "Q", TR_IMPACT, -1 },
831 { "S", TR_VORPAL, -1 },
832 { "M", TR_FORCE_WEAPON, -1 },
836 static flag_insc_table flag_insc_kill[] =
838 { "*", TR_KILL_EVIL, -1 },
839 { "p", TR_KILL_HUMAN, -1 },
840 { "D", TR_KILL_DRAGON, -1 },
841 { "o", TR_KILL_ORC, -1 },
842 { "T", TR_KILL_TROLL, -1 },
843 { "P", TR_KILL_GIANT, -1 },
844 { "U", TR_KILL_DEMON, -1 },
845 { "L", TR_KILL_UNDEAD, -1 },
846 { "Z", TR_KILL_ANIMAL, -1 },
850 static flag_insc_table flag_insc_slay[] =
852 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
853 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
854 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
855 { "o", TR_SLAY_ORC, TR_KILL_ORC },
856 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
857 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
858 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
859 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
860 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
864 static flag_insc_table flag_insc_esp1[] =
866 { "Tele", TR_TELEPATHY, -1 },
867 { "Evil", TR_ESP_EVIL, -1 },
868 { "Good", TR_ESP_GOOD, -1 },
869 { "Nolv", TR_ESP_NONLIVING, -1 },
870 { "Uniq", TR_ESP_UNIQUE, -1 },
874 static flag_insc_table flag_insc_esp2[] =
876 { "p", TR_ESP_HUMAN, -1 },
877 { "D", TR_ESP_DRAGON, -1 },
878 { "o", TR_ESP_ORC, -1 },
879 { "T", TR_ESP_TROLL, -1 },
880 { "P", TR_ESP_GIANT, -1 },
881 { "U", TR_ESP_DEMON, -1 },
882 { "L", TR_ESP_UNDEAD, -1 },
883 { "Z", TR_ESP_ANIMAL, -1 },
887 static flag_insc_table flag_insc_sust[] =
889 { "St", TR_SUST_STR, -1 },
890 { "In", TR_SUST_INT, -1 },
891 { "Wi", TR_SUST_WIS, -1 },
892 { "Dx", TR_SUST_DEX, -1 },
893 { "Cn", TR_SUST_CON, -1 },
894 { "Ch", TR_SUST_CHR, -1 },
899 /* Simple macro for get_inscription() */
900 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
903 * Helper function for get_inscription()
905 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
911 while (fi_ptr->english)
913 if (have_flag(flgs, fi_ptr->flag) &&
914 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
916 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
918 ADD_INSC(fi_ptr->english);
928 * Special variation of have_flag for auto-inscription
930 static bool have_flag_of(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE])
932 while (fi_ptr->english)
934 if (have_flag(flgs, fi_ptr->flag) &&
935 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
943 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
945 char *prev_ptr = ptr;
946 u32b flgs[TR_FLAG_SIZE];
948 /* Extract the flags */
949 object_flags(o_ptr, flgs);
952 /* Remove obvious flags */
955 object_kind *k_ptr = &k_info[o_ptr->k_idx];
959 for (j = 0; j < TR_FLAG_SIZE; j++)
960 flgs[j] &= ~k_ptr->flags[j];
962 if (object_is_fixed_artifact(o_ptr))
964 artifact_type *a_ptr = &a_info[o_ptr->name1];
966 for (j = 0; j < TR_FLAG_SIZE; j++)
967 flgs[j] &= ~a_ptr->flags[j];
970 if (object_is_ego(o_ptr))
972 ego_item_type *e_ptr = &e_info[o_ptr->name2];
974 for (j = 0; j < TR_FLAG_SIZE; j++)
975 flgs[j] &= ~e_ptr->flags[j];
981 if (have_flag_of(flag_insc_plus, flgs))
986 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
989 if (have_flag_of(flag_insc_immune, flgs))
991 if (!kanji && ptr != prev_ptr)
998 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
1001 if (have_flag_of(flag_insc_resistance, flgs))
1005 else if (ptr != prev_ptr)
1011 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1014 if (have_flag_of(flag_insc_misc, flgs))
1016 if (ptr != prev_ptr)
1022 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1025 if (have_flag_of(flag_insc_aura, flgs))
1029 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1032 if (have_flag_of(flag_insc_brand, flgs))
1034 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1037 if (have_flag_of(flag_insc_kill, flgs))
1039 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1042 if (have_flag_of(flag_insc_slay, flgs))
1044 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1049 if (have_flag_of(flag_insc_esp1, flgs) ||
1050 have_flag_of(flag_insc_esp2, flgs))
1052 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1053 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1057 if (have_flag_of(flag_insc_esp1, flgs))
1059 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1060 if (have_flag_of(flag_insc_esp2, flgs))
1062 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1066 if (have_flag_of(flag_insc_sust, flgs))
1070 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1079 * Get object inscription with auto inscription of object flags.
1081 static void get_inscription(char *buff, object_type *o_ptr)
1083 cptr insc = quark_str(o_ptr->inscription);
1086 /* Not fully identified */
1087 if (!(o_ptr->ident & IDENT_MENTAL))
1089 /* Copy until end of line or '#' */
1092 if (*insc == '#') break;
1094 if (iskanji(*insc)) *buff++ = *insc++;
1104 for (; *insc; insc++)
1106 /* Ignore fake artifact inscription */
1107 if (*insc == '#') break;
1109 /* {%} will be automatically converted */
1110 else if ('%' == *insc)
1116 /* check for too long inscription */
1117 if (ptr >= buff + MAX_NLEN) continue;
1130 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1140 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1155 * Creates a description of the item "o_ptr", and stores it in "out_val".
1157 * One can choose the "verbosity" of the description, including whether
1158 * or not the "number" of items should be described, and how much detail
1159 * should be used when describing the item.
1161 * The given "buf" must be MAX_NLEN chars long to hold the longest possible
1162 * description, which can get pretty long, including incriptions, such as:
1163 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".
1164 * Note that the inscription will be clipped to keep the total description
1165 * under MAX_NLEN-1 chars (plus a terminator).
1167 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,
1168 * portable, versions of some common "sprintf()" commands.
1170 * Note that all ego-items (when known) append an "Ego-Item Name", unless
1171 * the item is also an artifact, which should NEVER happen.
1173 * Note that all artifacts (when known) append an "Artifact Name", so we
1174 * have special processing for "Specials" (artifact Lites, Rings, Amulets).
1175 * The "Specials" never use "modifiers" if they are "known", since they
1176 * have special "descriptions", such as "The Necklace of the Dwarves".
1178 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),
1179 * plus the artifact name, just like any other artifact, if known.
1181 * Special Ring's and Amulet's, if not "aware", use the same code as normal
1182 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or
1183 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,
1184 * they will append the artifact name, just like any artifact, if known.
1186 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.
1189 * OD_NAME_ONLY : The Cloak of Death
1190 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]
1191 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)
1192 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}
1194 * OD_OMIT_PREFIX : Forbidden numeric prefix
1195 * OD_NO_PLURAL : Forbidden use of plural
1196 * OD_STORE : Assume to be aware and known
1197 * OD_NO_FLAVOR : Allow to hidden flavor
1198 * OD_FORCE_FLAVOR : Get un-shuffled flavor name
1200 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1202 /* Extract object kind name */
1203 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1205 /* Extract default "base" string */
1206 cptr basenm = kindname;
1208 /* Assume no "modifier" string */
1217 bool show_weapon = FALSE;
1218 bool show_armour = FALSE;
1223 char p1 = '(', p2 = ')';
1224 char b1 = '[', b2 = ']';
1225 char c1 = '{', c2 = '}';
1227 char tmp_val[MAX_NLEN+160];
1228 char tmp_val2[MAX_NLEN+10];
1229 char fake_insc_buf[30];
1231 u32b flgs[TR_FLAG_SIZE];
1233 object_type *bow_ptr;
1235 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1236 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1238 /* Extract some flags */
1239 object_flags(o_ptr, flgs);
1241 /* See if the object is "aware" */
1242 if (object_is_aware(o_ptr)) aware = TRUE;
1244 /* See if the object is "known" */
1245 if (object_is_known(o_ptr)) known = TRUE;
1247 /* Allow flavors to be hidden when aware */
1248 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1250 /* Object is in the inventory of a store or spoiler */
1251 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1253 /* Don't show flavors */
1256 /* Pretend known and aware */
1261 /* Force to be flavor name only */
1262 if (mode & OD_FORCE_FLAVOR)
1268 /* Cancel shuffling */
1269 flavor_k_ptr = k_ptr;
1272 /* Analyze the object */
1273 switch (o_ptr->tval)
1275 /* Some objects are easy to describe */
1289 monster_race *r_ptr = &r_info[o_ptr->pval];
1298 modstr = " (empty)";
1304 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1307 cptr t = r_name + r_ptr->name;
1309 if (!(r_ptr->flags1 & RF1_UNIQUE))
1311 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1317 sprintf(tmp_val2, "(%s)", t);
1327 /* Figurines/Statues */
1331 monster_race *r_ptr = &r_info[o_ptr->pval];
1334 modstr = r_name + r_ptr->name;
1336 cptr t = r_name + r_ptr->name;
1338 if (!(r_ptr->flags1 & RF1_UNIQUE))
1340 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1357 monster_race *r_ptr = &r_info[o_ptr->pval];
1359 modstr = r_name + r_ptr->name;
1364 if (r_ptr->flags1 & RF1_UNIQUE)
1365 basenm = "& % of #";
1373 /* Missiles/ Bows/ Weapons */
1402 /* Lites (including a few "Specials") */
1408 /* Amulets (including a few "Specials") */
1411 /* Known artifacts */
1414 if (object_is_fixed_artifact(o_ptr)) break;
1415 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1418 /* Color the object */
1419 modstr = k_name + flavor_k_ptr->flavor_name;
1422 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1423 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1424 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1426 if (!flavor) basenm = "& Amulet~ of %";
1427 else if (aware) basenm = "& # Amulet~ of %";
1428 else basenm = "& # Amulet~";
1434 /* Rings (including a few "Specials") */
1437 /* Known artifacts */
1440 if (object_is_fixed_artifact(o_ptr)) break;
1441 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1444 /* Color the object */
1445 modstr = k_name + flavor_k_ptr->flavor_name;
1448 if (!flavor) basenm = "%¤Î»ØÎØ";
1449 else if (aware) basenm = "%¤Î#»ØÎØ";
1450 else basenm = "#»ØÎØ";
1452 if (!flavor) basenm = "& Ring~ of %";
1453 else if (aware) basenm = "& # Ring~ of %";
1454 else basenm = "& # Ring~";
1457 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1469 /* Color the object */
1470 modstr = k_name + flavor_k_ptr->flavor_name;
1473 if (!flavor) basenm = "%¤Î¾ó";
1474 else if (aware) basenm = "%¤Î#¾ó";
1475 else basenm = "#¾ó";
1477 if (!flavor) basenm = "& Staff~ of %";
1478 else if (aware) basenm = "& # Staff~ of %";
1479 else basenm = "& # Staff~";
1487 /* Color the object */
1488 modstr = k_name + flavor_k_ptr->flavor_name;
1491 if (!flavor) basenm = "%¤ÎËâË¡ËÀ";
1492 else if (aware) basenm = "%¤Î#ËâË¡ËÀ";
1493 else basenm = "#ËâË¡ËÀ";
1495 if (!flavor) basenm = "& Wand~ of %";
1496 else if (aware) basenm = "& # Wand~ of %";
1497 else basenm = "& # Wand~";
1505 /* Color the object */
1506 modstr = k_name + flavor_k_ptr->flavor_name;
1509 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1510 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1511 else basenm = "#¥í¥Ã¥É";
1513 if (!flavor) basenm = "& Rod~ of %";
1514 else if (aware) basenm = "& # Rod~ of %";
1515 else basenm = "& # Rod~";
1523 /* Color the object */
1524 modstr = k_name + flavor_k_ptr->flavor_name;
1527 if (!flavor) basenm = "%¤Î´¬Êª";
1528 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1529 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1531 if (!flavor) basenm = "& Scroll~ of %";
1532 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1533 else basenm = "& Scroll~ titled \"#\"";
1541 /* Color the object */
1542 modstr = k_name + flavor_k_ptr->flavor_name;
1545 if (!flavor) basenm = "%¤ÎÌô";
1546 else if (aware) basenm = "%¤Î#Ìô";
1547 else basenm = "#Ìô";
1549 if (!flavor) basenm = "& Potion~ of %";
1550 else if (aware) basenm = "& # Potion~ of %";
1551 else basenm = "& # Potion~";
1559 /* Ordinary food is "boring" */
1560 if (!k_ptr->flavor_name) break;
1562 /* Color the object */
1563 modstr = k_name + flavor_k_ptr->flavor_name;
1566 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1567 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1568 else basenm = "#¥¥Î¥³";
1570 if (!flavor) basenm = "& Mushroom~ of %";
1571 else if (aware) basenm = "& # Mushroom~ of %";
1572 else basenm = "& # Mushroom~";
1581 basenm = "ÍÓÈé»æ - %";
1583 basenm = "& Parchment~ - %";
1592 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1594 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1595 basenm = "& Book~ of Life Magic %";
1597 basenm = "& Life Spellbook~ %";
1603 case TV_SORCERY_BOOK:
1606 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1608 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1609 basenm = "& Book~ of Sorcery %";
1611 basenm = "& Sorcery Spellbook~ %";
1617 case TV_NATURE_BOOK:
1620 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1622 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1623 basenm = "& Book~ of Nature Magic %";
1625 basenm = "& Nature Spellbook~ %";
1634 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1636 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1637 basenm = "& Book~ of Chaos Magic %";
1639 basenm = "& Chaos Spellbook~ %";
1648 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1650 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1651 basenm = "& Book~ of Death Magic %";
1653 basenm = "& Death Spellbook~ %";
1662 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1664 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1665 basenm = "& Book~ of Trump Magic %";
1667 basenm = "& Trump Spellbook~ %";
1673 case TV_ARCANE_BOOK:
1676 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1678 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1679 basenm = "& Book~ of Arcane Magic %";
1681 basenm = "& Arcane Spellbook~ %";
1690 basenm = "¾¢¤ÎËâË¡½ñ%";
1692 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1693 basenm = "& Book~ of Craft Magic %";
1695 basenm = "& Craft Spellbook~ %";
1701 case TV_DAEMON_BOOK:
1704 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1706 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1707 basenm = "& Book~ of Daemon Magic %";
1709 basenm = "& Daemon Spellbook~ %";
1715 case TV_CRUSADE_BOOK:
1718 basenm = "Ç˼٤ÎËâË¡½ñ%";
1720 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1721 basenm = "& Book~ of Crusade Magic %";
1723 basenm = "& Crusade Spellbook~ %";
1734 basenm = "& Song Book~ %";
1740 case TV_HISSATSU_BOOK:
1743 basenm = "& Éð·Ý¤Î½ñ%";
1745 basenm = "Book~ of Kendo %";
1754 basenm = "¼ö½Ñ¤ÎËâË¡½ñ%";
1756 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1757 basenm = "& Book~ of Crusade Magic %";
1759 basenm = "& Crusade Spellbook~ %";
1765 /* Hack -- Gold/Gems */
1768 strcpy(buf, basenm);
1772 /* Used in the "inventory" routine */
1776 strcpy(buf, "(¤Ê¤·)");
1778 strcpy(buf, "(nothing)");
1785 /* Use full name from k_info or a_info */
1786 if (aware && have_flag(flgs, TR_FULL_NAME))
1788 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1789 else basenm = kindname;
1792 /* Start dumping the result */
1796 if (basenm[0] == '&')
1802 if (mode & OD_OMIT_PREFIX)
1806 else if (o_ptr->number > 1)
1808 t = object_desc_kosuu(t, o_ptr);
1809 t = object_desc_str(t, "¤Î ");
1812 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1813 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1817 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1818 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1823 /* The object "expects" a "number" */
1824 if (basenm[0] == '&')
1826 /* Skip the ampersand (and space) */
1830 if (mode & OD_OMIT_PREFIX)
1835 /* Hack -- None left */
1836 else if (o_ptr->number <= 0)
1838 t = object_desc_str(t, "no more ");
1841 /* Extract the number */
1842 else if (o_ptr->number > 1)
1844 t = object_desc_num(t, o_ptr->number);
1845 t = object_desc_chr(t, ' ');
1848 /* Hack -- The only one of its kind */
1849 else if ((known && object_is_artifact(o_ptr)) ||
1850 ((o_ptr->tval == TV_CORPSE) &&
1851 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1853 t = object_desc_str(t, "The ");
1863 case '#': vowel = is_a_vowel(modstr[0]); break;
1864 case '%': vowel = is_a_vowel(*kindname); break;
1865 default: vowel = is_a_vowel(*s); break;
1870 /* A single one, with a vowel */
1871 t = object_desc_str(t, "an ");
1875 /* A single one, without a vowel */
1876 t = object_desc_str(t, "a ");
1881 /* Hack -- objects that "never" take an article */
1888 if (mode & OD_OMIT_PREFIX)
1893 /* Hack -- all gone */
1894 else if (o_ptr->number <= 0)
1896 t = object_desc_str(t, "no more ");
1899 /* Prefix a number if required */
1900 else if (o_ptr->number > 1)
1902 t = object_desc_num(t, o_ptr->number);
1903 t = object_desc_chr(t, ' ');
1906 /* Hack -- The only one of its kind */
1907 else if (known && object_is_artifact(o_ptr))
1909 t = object_desc_str(t, "The ");
1912 /* Hack -- single items get no prefix */
1920 /* Paranoia -- skip illegal tildes */
1921 /* while (*s == '~') s++; */
1924 if (object_is_smith(o_ptr))
1926 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
1929 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
1932 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
1933 if (o_ptr->art_name)
1935 cptr temp = quark_str(o_ptr->art_name);
1937 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1938 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
1939 if (strncmp(temp, "of ", 3) == 0)
1941 t = object_desc_str(t, &temp[3]);
1942 t = object_desc_str(t, "¤Î");
1944 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
1945 (strncmp(temp, "¡Ô", 2) != 0) &&
1947 t = object_desc_str(t, temp);
1949 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
1950 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
1952 artifact_type *a_ptr = &a_info[o_ptr->name1];
1953 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1954 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
1956 t = object_desc_str(t, a_name + a_ptr->name);
1959 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
1960 else if (object_is_ego(o_ptr))
1962 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1963 t = object_desc_str(t, e_name + e_ptr->name);
1968 /* Copy the string */
1969 for (s0 = NULL; *s || s0; )
1971 /* The end of the flavour/kind string. */
1978 /* Begin to append the modifier (flavor) */
1979 else if ((*s == '#') && !s0)
1984 /* Paranoia -- Never append multiple modstrs */
1988 /* Begin to append the kind name */
1989 else if ((*s == '%') && !s0)
1994 /* Paranoia -- Never append multiple kindnames */
2002 /* Add a plural if needed */
2003 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2007 /* XXX XXX XXX Mega-Hack */
2009 /* Hack -- "Cutlass-es" and "Torch-es" */
2010 if ((k == 's') || (k == 'h')) *t++ = 'e';
2032 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2035 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2036 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2037 if (o_ptr->art_name)
2041 strcpy(temp, quark_str(o_ptr->art_name));
2042 /* MEGA HACK by ita */
2043 if (strncmp(temp, "¡Ø", 2) == 0 ||
2044 strncmp(temp, "¡Ô", 2) == 0)
2045 t = object_desc_str(t, temp);
2046 else if (temp[0] == '\'')
2048 itemp = strlen(temp);
2049 temp[itemp - 1] = 0;
2050 t = object_desc_str(t, "¡Ø");
2051 t = object_desc_str(t, &temp[1]);
2052 t = object_desc_str(t, "¡Ù");
2055 else if (object_is_fixed_artifact(o_ptr))
2057 artifact_type *a_ptr = &a_info[o_ptr->name1];
2058 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2060 t = object_desc_str(t, a_name + a_ptr->name);
2063 else if (o_ptr->inscription)
2065 cptr str = quark_str(o_ptr->inscription);
2074 if (*str == '#') break;
2080 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2082 /* Add the false name */
2083 t = object_desc_str(t,"¡Ø");
2084 t = object_desc_str(t, &str[1]);
2085 t = object_desc_str(t,"¡Ù");
2090 if (object_is_smith(o_ptr))
2092 t = object_desc_str(t,format(" of %s the Smith",player_name));
2095 /* Hack -- Append "Artifact" or "Special" names */
2096 if (known && !have_flag(flgs, TR_FULL_NAME))
2098 /* Is it a new random artifact ? */
2099 if (o_ptr->art_name)
2101 t = object_desc_chr(t, ' ');
2102 t = object_desc_str(t, quark_str(o_ptr->art_name));
2105 /* Grab any artifact name */
2106 else if (object_is_fixed_artifact(o_ptr))
2108 artifact_type *a_ptr = &a_info[o_ptr->name1];
2110 t = object_desc_chr(t, ' ');
2111 t = object_desc_str(t, a_name + a_ptr->name);
2114 /* Grab any ego-item name */
2117 if (object_is_ego(o_ptr))
2119 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2121 t = object_desc_chr(t, ' ');
2122 t = object_desc_str(t, e_name + e_ptr->name);
2125 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2128 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2130 /* Add the false name */
2131 t = object_desc_chr(t, ' ');
2132 t = object_desc_str(t, &str[1]);
2139 /* No more details wanted */
2140 if (mode & OD_NAME_ONLY) goto object_desc_done;
2142 /* Hack -- Chests must be described in detail */
2143 if (o_ptr->tval == TV_CHEST)
2145 /* Not searched yet */
2151 /* May be "empty" */
2152 else if (!o_ptr->pval)
2155 t = object_desc_str(t, "(¶õ)");
2157 t = object_desc_str(t, " (empty)");
2161 /* May be "disarmed" */
2162 else if (o_ptr->pval < 0)
2164 if (chest_traps[0 - o_ptr->pval])
2167 t = object_desc_str(t, "(²ò½üºÑ)");
2169 t = object_desc_str(t, " (disarmed)");
2175 t = object_desc_str(t, "(Èó»Ü¾û)");
2177 t = object_desc_str(t, " (unlocked)");
2182 /* Describe the traps, if any */
2185 /* Describe the traps */
2186 switch (chest_traps[o_ptr->pval])
2191 t = object_desc_str(t, "(»Ü¾û)");
2193 t = object_desc_str(t, " (Locked)");
2197 case CHEST_LOSE_STR:
2200 t = object_desc_str(t, "(ÆÇ¿Ë)");
2202 t = object_desc_str(t, " (Poison Needle)");
2206 case CHEST_LOSE_CON:
2209 t = object_desc_str(t, "(ÆÇ¿Ë)");
2211 t = object_desc_str(t, " (Poison Needle)");
2218 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2220 t = object_desc_str(t, " (Gas Trap)");
2224 case CHEST_PARALYZE:
2227 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2229 t = object_desc_str(t, " (Gas Trap)");
2236 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2238 t = object_desc_str(t, " (Explosion Device)");
2243 case CHEST_BIRD_STORM:
2244 case CHEST_E_SUMMON:
2245 case CHEST_H_SUMMON:
2248 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2250 t = object_desc_str(t, " (Summoning Runes)");
2254 case CHEST_RUNES_OF_EVIL:
2257 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2259 t = object_desc_str(t, " (Gleaming Black Runes)");
2266 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2268 t = object_desc_str(t, " (Alarm)");
2275 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2277 t = object_desc_str(t, " (Multiple Traps)");
2286 /* Display the item like a weapon */
2287 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2289 /* Display the item like a weapon */
2290 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2293 /* Display the item like a weapon */
2294 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2296 /* Display the item like armour */
2297 if (o_ptr->ac) show_armour = TRUE;
2300 /* Dump base weapon info */
2301 switch (o_ptr->tval)
2303 /* Missiles and Weapons */
2312 /* Append a "damage" string */
2313 t = object_desc_chr(t, ' ');
2314 t = object_desc_chr(t, p1);
2315 t = object_desc_num(t, o_ptr->dd);
2316 t = object_desc_chr(t, 'd');
2317 t = object_desc_num(t, o_ptr->ds);
2318 t = object_desc_chr(t, p2);
2324 /* Bows get a special "damage string" */
2327 /* Mega-Hack -- Extract the "base power" */
2328 power = bow_tmul(o_ptr->sval);
2330 /* Apply the "Extra Might" flag */
2331 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2333 /* Append a special "damage" string */
2334 t = object_desc_chr(t, ' ');
2335 t = object_desc_chr(t, p1);
2336 t = object_desc_chr(t, 'x');
2337 t = object_desc_num(t, power);
2338 t = object_desc_chr(t, p2);
2345 /* Add the weapon bonuses */
2348 /* Show the tohit/todam on request */
2351 t = object_desc_chr(t, ' ');
2352 t = object_desc_chr(t, p1);
2353 t = object_desc_int(t, o_ptr->to_h);
2354 t = object_desc_chr(t, ',');
2355 t = object_desc_int(t, o_ptr->to_d);
2356 t = object_desc_chr(t, p2);
2359 /* Show the tohit if needed */
2360 else if (o_ptr->to_h)
2362 t = object_desc_chr(t, ' ');
2363 t = object_desc_chr(t, p1);
2364 t = object_desc_int(t, o_ptr->to_h);
2365 t = object_desc_chr(t, p2);
2368 /* Show the todam if needed */
2369 else if (o_ptr->to_d)
2371 t = object_desc_chr(t, ' ');
2372 t = object_desc_chr(t, p1);
2373 t = object_desc_int(t, o_ptr->to_d);
2374 t = object_desc_chr(t, p2);
2378 bow_ptr = &inventory[INVEN_BOW];
2380 /* If have a firing weapon + ammo matches bow */
2381 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2383 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2384 int tmul = bow_tmul(bow_ptr->sval);
2385 s16b energy_fire = bow_energy(bow_ptr->sval);
2387 /* See if the bow is "known" - then set damage bonus */
2388 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2390 /* Effect of ammo */
2391 if (known) avgdam += (o_ptr->to_d * 10);
2393 /* Get extra "power" from "extra might" */
2394 if (p_ptr->xtra_might) tmul++;
2396 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2398 /* Launcher multiplier */
2400 avgdam /= (100 * 10);
2402 /* Get extra damage from concentration */
2403 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2405 if (avgdam < 0) avgdam = 0;
2407 /* Display (shot damage/ avg damage) */
2408 t = object_desc_chr(t, ' ');
2409 t = object_desc_chr(t, p1);
2410 t = object_desc_num(t, avgdam);
2411 t = object_desc_chr(t, '/');
2413 if (p_ptr->num_fire == 0)
2415 t = object_desc_chr(t, '0');
2419 /* Calc effects of energy */
2420 avgdam *= (p_ptr->num_fire * 100);
2421 avgdam /= energy_fire;
2422 t = object_desc_num(t, avgdam);
2425 t = object_desc_chr(t, p2);
2427 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2429 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2430 s16b energy_fire = 100 - p_ptr->lev;
2432 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2434 /* Display (shot damage/ avg damage) */
2435 t = object_desc_chr(t, ' ');
2436 t = object_desc_chr(t, p1);
2437 t = object_desc_num(t, avgdam);
2438 t = object_desc_chr(t, '/');
2440 /* Calc effects of energy */
2441 avgdam = 100 * avgdam / energy_fire;
2443 t = object_desc_num(t, avgdam);
2444 t = object_desc_chr(t, p2);
2447 /* Add the armor bonuses */
2450 /* Show the armor class info */
2453 t = object_desc_chr(t, ' ');
2454 t = object_desc_chr(t, b1);
2455 t = object_desc_num(t, o_ptr->ac);
2456 t = object_desc_chr(t, ',');
2457 t = object_desc_int(t, o_ptr->to_a);
2458 t = object_desc_chr(t, b2);
2461 /* No base armor, but does increase armor */
2462 else if (o_ptr->to_a)
2464 t = object_desc_chr(t, ' ');
2465 t = object_desc_chr(t, b1);
2466 t = object_desc_int(t, o_ptr->to_a);
2467 t = object_desc_chr(t, b2);
2471 /* Hack -- always show base armor */
2472 else if (show_armour)
2474 t = object_desc_chr(t, ' ');
2475 t = object_desc_chr(t, b1);
2476 t = object_desc_num(t, o_ptr->ac);
2477 t = object_desc_chr(t, b2);
2481 /* No more details wanted */
2482 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2485 if (known) /* Known item only */
2488 * Hack -- Wands and Staffs have charges. Make certain how many charges
2489 * a stack of staffs really has is clear. -LM-
2491 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2493 /* Dump " (N charges)" */
2494 t = object_desc_chr(t, ' ');
2495 t = object_desc_chr(t, p1);
2497 /* Clear explaination for staffs. */
2498 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2500 t = object_desc_num(t, o_ptr->number);
2501 t = object_desc_str(t, "x ");
2503 t = object_desc_num(t, o_ptr->pval);
2505 t = object_desc_str(t, "²óʬ");
2507 t = object_desc_str(t, " charge");
2508 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2511 t = object_desc_chr(t, p2);
2513 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2514 * be in any state of charge or discharge, this now includes a number. -LM-
2516 else if (o_ptr->tval == TV_ROD)
2518 /* Hack -- Dump " (# charging)" if relevant */
2521 /* Stacks of rods display an exact count of charging rods. */
2522 if (o_ptr->number > 1)
2525 if (k_ptr->pval == 0) k_ptr->pval = 1;
2527 /* Find out how many rods are charging, by dividing
2528 * current timeout by each rod's maximum timeout.
2529 * Ensure that any remainder is rounded up. Display
2530 * very discharged stacks as merely fully discharged.
2532 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2533 if (power > o_ptr->number) power = o_ptr->number;
2535 /* Display prettily. */
2536 t = object_desc_str(t, " (");
2537 t = object_desc_num(t, power);
2539 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2541 t = object_desc_str(t, " charging)");
2545 /* "one Rod of Perception (1 charging)" would look tacky. */
2549 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2551 t = object_desc_str(t, " (charging)");
2557 /* Dump "pval" flags for wearable items */
2558 if (have_pval_flags(flgs))
2560 /* Start the display */
2561 t = object_desc_chr(t, ' ');
2562 t = object_desc_chr(t, p1);
2564 /* Dump the "pval" itself */
2565 t = object_desc_int(t, o_ptr->pval);
2567 /* Do not display the "pval" flags */
2568 if (have_flag(flgs, TR_HIDE_TYPE))
2574 else if (have_flag(flgs, TR_SPEED))
2576 /* Dump " to speed" */
2578 t = object_desc_str(t, "²Ã®");
2580 t = object_desc_str(t, " to speed");
2585 else if (have_flag(flgs, TR_BLOWS))
2589 t = object_desc_str(t, "¹¶·â");
2591 t = object_desc_str(t, " attack");
2594 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2599 else if (have_flag(flgs, TR_STEALTH))
2601 /* Dump " to stealth" */
2603 t = object_desc_str(t, "±£Ì©");
2605 t = object_desc_str(t, " to stealth");
2610 else if (have_flag(flgs, TR_SEARCH))
2612 /* Dump " to searching" */
2614 t = object_desc_str(t, "õº÷");
2616 t = object_desc_str(t, " to searching");
2621 else if (have_flag(flgs, TR_INFRA))
2623 /* Dump " to infravision" */
2625 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2627 t = object_desc_str(t, " to infravision");
2631 /* Finish the display */
2632 t = object_desc_chr(t, p2);
2635 /* Hack -- Process Lanterns/Torches */
2636 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2638 /* Hack -- Turns of light for normal lites */
2640 t = object_desc_chr(t, '(');
2642 t = object_desc_str(t, " (with ");
2645 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2646 else t = object_desc_num(t, o_ptr->xtra4);
2648 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2650 t = object_desc_str(t, " turns of light)");
2654 /* Indicate charging objects, but not rods. */
2655 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2657 /* Hack -- Dump " (charging)" if relevant */
2659 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2661 t = object_desc_str(t, " (charging)");
2667 /* No more details wanted */
2668 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2671 /* Prepare real inscriptions in a buffer */
2674 /* Auto abbreviation inscribe */
2675 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2677 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2688 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2692 /* Use the standard inscription if available */
2693 if (o_ptr->inscription)
2697 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2699 /* Get inscription and convert {%} */
2700 get_inscription(buff, o_ptr);
2702 /* strcat with correct treating of kanji */
2703 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2707 /* No fake inscription yet */
2708 fake_insc_buf[0] = '\0';
2710 /* Use the game-generated "feeling" otherwise, if available */
2713 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2716 /* Note "cursed" if the item is known to be cursed */
2717 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2720 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2722 strcpy(fake_insc_buf, "cursed");
2726 /* Note "unidentified" if the item is unidentified */
2727 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2728 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2730 && !(o_ptr->ident & IDENT_SENSE))
2733 strcpy(fake_insc_buf, "̤´ÕÄê");
2735 strcpy(fake_insc_buf, "unidentified");
2739 /* Mega-Hack -- note empty wands/staffs */
2740 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2743 strcpy(fake_insc_buf, "¶õ");
2745 strcpy(fake_insc_buf, "empty");
2749 /* Note "tried" if the object has been tested unsuccessfully */
2750 else if (!aware && object_is_tried(o_ptr))
2753 strcpy(fake_insc_buf, "̤ȽÌÀ");
2755 strcpy(fake_insc_buf, "tried");
2759 /* Note the discount, if any */
2760 if (o_ptr->discount)
2762 /* Hidden by real inscription unless in a store */
2763 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2765 char discount_num_buf[4];
2767 /* Append to other fake inscriptions if any */
2768 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2770 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2771 strcat(fake_insc_buf, discount_num_buf);
2773 strcat(fake_insc_buf, "%°ú¤");
2775 strcat(fake_insc_buf, "% off");
2781 /* Append the inscription, if any */
2782 if (fake_insc_buf[0] || tmp_val2[0])
2784 /* Append the inscription */
2785 t = object_desc_chr(t, ' ');
2786 t = object_desc_chr(t, c1);
2788 /* Append fake inscriptions */
2789 if (fake_insc_buf[0])
2791 t = object_desc_str(t, fake_insc_buf);
2794 /* Append a separater */
2795 if (fake_insc_buf[0] && tmp_val2[0])
2797 t = object_desc_chr(t, ',');
2798 t = object_desc_chr(t, ' ');
2801 /* Append real inscriptions */
2804 t = object_desc_str(t, tmp_val2);
2807 t = object_desc_chr(t, c2);
2811 my_strcpy(buf, tmp_val, MAX_NLEN);