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;
239 * Prepare the "variable" part of the "k_info" array.
241 * The "color"/"metal"/"type" of an item is its "flavor".
242 * For the most part, flavors are assigned randomly each game.
244 * Initialize descriptions for the "colored" objects, including:
245 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.
247 * The first 4 entries for potions are fixed (Water, Apple Juice,
248 * Slime Mold Juice, Unused Potion).
250 * Scroll titles are always between 6 and 14 letters long. This is
251 * ensured because every title is composed of whole words, where every
252 * word is from 1 to 8 letters long (one or two syllables of 1 to 4
253 * letters each), and that no scroll is finished until it attempts to
254 * grow beyond 15 letters. The first time this can happen is when the
255 * current title has 6 letters and the new word has 8 letters, which
256 * would result in a 6 letter scroll title.
258 * Duplicate titles are avoided by requiring that no two scrolls share
259 * the same first four letters (not the most efficient method, and not
260 * the least efficient method, but it will always work).
262 * Hack -- make sure everything stays the same for each saved game
263 * This is accomplished by the use of a saved "random seed", as in
264 * "town_gen()". Since no other functions are called while the special
265 * seed is in effect, so this function is pretty "safe".
267 * Note that the "hacked seed" may provide an RNG with alternating parity!
269 void flavor_init(void)
273 /* Hack -- Use the "simple" RNG */
276 /* Hack -- Induce consistant flavors */
277 Rand_value = seed_flavor;
280 /* Initialize flavor index of each object by itself */
281 for (i = 0; i < max_k_idx; i++)
283 object_kind *k_ptr = &k_info[i];
285 /* Skip objects without flavor name */
286 if (!k_ptr->flavor_name) continue;
289 * Initialize flavor index to itself
290 * -> Shuffle it later
296 shuffle_flavors(TV_RING);
298 /* Shuffle Amulets */
299 shuffle_flavors(TV_AMULET);
302 shuffle_flavors(TV_STAFF);
305 shuffle_flavors(TV_WAND);
308 shuffle_flavors(TV_ROD);
310 /* Shuffle Mushrooms */
311 shuffle_flavors(TV_FOOD);
313 /* Shuffle Potions */
314 shuffle_flavors(TV_POTION);
316 /* Shuffle Scrolls */
317 shuffle_flavors(TV_SCROLL);
320 /* Hack -- Use the "complex" RNG */
323 /* Analyze every object */
324 for (i = 1; i < max_k_idx; i++)
326 object_kind *k_ptr = &k_info[i];
328 /* Skip "empty" objects */
329 if (!k_ptr->name) continue;
331 /* No flavor yields aware */
332 if (!k_ptr->flavor) k_ptr->aware = TRUE;
334 /* Check for "easily known" */
335 k_ptr->easy_know = object_easy_know(i);
341 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),
342 * and return a pointer to the terminator (t + 1).
344 static char *object_desc_chr(char *t, char c)
358 * Print a string "s" into a string "t", as if by strcpy(t, s),
359 * and return a pointer to the terminator.
361 static char *object_desc_str(char *t, cptr s)
363 /* Copy the string */
364 while (*s) *t++ = *s++;
376 * Print an unsigned number "n" into a string "t", as if by
377 * sprintf(t, "%u", n), and return a pointer to the terminator.
379 static char *object_desc_num(char *t, uint n)
383 /* Find "size" of "n" */
384 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
386 /* Dump each digit */
392 /* Remove the digit */
395 /* Process next digit */
411 * ÆüËܸì¤Î¸Ä¿ôɽ¼¨¥ë¡¼¥Á¥ó
412 *¡Êcmd1.c ¤ÇήÍѤ¹¤ë¤¿¤á¤Ë object_desc_japanese ¤«¤é°ÜÆ°¤·¤¿¡£¡Ë
415 char *object_desc_kosuu(char *t, object_type *o_ptr)
417 t = object_desc_num(t, o_ptr->number);
429 t = object_desc_str(t, "ËÜ");
434 t = object_desc_str(t, "´¬");
439 t = object_desc_str(t, "Éþ");
443 case TV_SORCERY_BOOK:
451 case TV_CRUSADE_BOOK:
453 case TV_HISSATSU_BOOK:
456 t = object_desc_str(t, "ºý");
464 t = object_desc_str(t, "Ãå");
471 t = object_desc_str(t, "¿¶");
476 t = object_desc_str(t, "");
481 t = object_desc_str(t, "Ëç");
484 /* ¿©¤Ù¤â¤Î by ita */
487 if(o_ptr->sval == SV_FOOD_JERKY)
489 t = object_desc_str(t, "ÀÚ¤ì");
495 if (o_ptr->number < 10)
497 t = object_desc_str(t, "¤Ä");
501 t = object_desc_str(t, "¸Ä");
511 * Print an signed number "v" into a string "t", as if by
512 * sprintf(t, "%+d", n), and return a pointer to the terminator.
513 * Note that we always print a sign, either "+" or "-".
515 static char *object_desc_int(char *t, sint v)
522 /* Take the absolute value */
525 /* Use a "minus" sign */
529 /* Positive (or zero) */
532 /* Use the actual number */
535 /* Use a "plus" sign */
539 /* Find "size" of "n" */
540 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
542 /* Dump each digit */
548 /* Remove the digit */
551 /* Process next digit */
564 * Structs and tables for Auto Inscription for flags
567 typedef struct flag_insc_table
578 static flag_insc_table flag_insc_plus[] =
580 { "¹¶", "At", TR_BLOWS, -1 },
581 { "®", "Sp", TR_SPEED, -1 },
582 { "ÏÓ", "St", TR_STR, -1 },
583 { "ÃÎ", "In", TR_INT, -1 },
584 { "¸", "Wi", TR_WIS, -1 },
585 { "´ï", "Dx", TR_DEX, -1 },
586 { "ÂÑ", "Cn", TR_CON, -1 },
587 { "̥", "Ch", TR_CHR, -1 },
588 { "ƻ", "Md", TR_MAGIC_MASTERY, -1 },
589 { "±£", "Sl", TR_STEALTH, -1 },
590 { "õ", "Sr", TR_SEARCH, -1 },
591 { "ÀÖ", "If", TR_INFRA, -1 },
592 { "·¡", "Dg", TR_TUNNEL, -1 },
593 { NULL, NULL, 0, -1 }
596 static flag_insc_table flag_insc_immune[] =
598 { "»À", "Ac", TR_IM_ACID, -1 },
599 { "ÅÅ", "El", TR_IM_ELEC, -1 },
600 { "²Ð", "Fi", TR_IM_FIRE, -1 },
601 { "Îä", "Co", TR_IM_COLD, -1 },
602 { NULL, NULL, 0, -1 }
605 static flag_insc_table flag_insc_resistance[] =
607 { "»À", "Ac", TR_RES_ACID, TR_IM_ACID },
608 { "ÅÅ", "El", TR_RES_ELEC, TR_IM_ELEC },
609 { "²Ð", "Fi", TR_RES_FIRE, TR_IM_FIRE },
610 { "Îä", "Co", TR_RES_COLD, TR_IM_COLD },
611 { "ÆÇ", "Po", TR_RES_POIS, -1 },
612 { "Á®", "Li", TR_RES_LITE, -1 },
613 { "°Å", "Dk", TR_RES_DARK, -1 },
614 { "ÇË", "Sh", TR_RES_SHARDS, -1 },
615 { "ÌÕ", "Bl", TR_RES_BLIND, -1 },
616 { "Íð", "Cf", TR_RES_CONF, -1 },
617 { "¹ì", "So", TR_RES_SOUND, -1 },
618 { "¹ö", "Nt", TR_RES_NETHER, -1 },
619 { "°ø", "Nx", TR_RES_NEXUS, -1 },
620 { "ÆÙ", "Ca", TR_RES_CHAOS, -1 },
621 { "Îô", "Di", TR_RES_DISEN, -1 },
622 { "¶²", "Fe", TR_RES_FEAR, -1 },
623 { NULL, NULL, 0, -1 }
626 static flag_insc_table flag_insc_misc[] =
628 { "ËâÎÏ", "Ma", TR_DEC_MANA, -1 },
629 { "Åê", "Th", TR_THROW, -1 },
630 { "ȿ", "Rf", TR_REFLECT, -1 },
631 { "Ëã", "Fa", TR_FREE_ACT, -1 },
632 { "ȑ", "Si", TR_SEE_INVIS, -1 },
633 { "·Ð", "Hl", TR_HOLD_LIFE, -1 },
634 { "ÃÙ", "Sd", TR_SLOW_DIGEST, -1 },
635 { "³è", "Rg", TR_REGEN, -1 },
636 { "Éâ", "Lv", TR_LEVITATION, -1 },
637 { "ÌÀ", "Lu", TR_LITE, -1 },
638 { "·Ù", "Wr", TR_WARNING, -1 },
639 { "ÇÜ", "Xm", TR_XTRA_MIGHT, -1 },
640 { "¼Í", "Xs", TR_XTRA_SHOTS, -1 },
641 { "½Ö", "Te", TR_TELEPORT, -1 },
642 { "ÅÜ", "Ag", TR_AGGRAVATE, -1 },
643 { "½Ë", "Bs", TR_BLESSED, -1 },
644 { "´÷", "Ty", TR_TY_CURSE, -1 },
645 { NULL, NULL, 0, -1 }
648 static flag_insc_table flag_insc_aura[] =
650 { "±ê", "F", TR_SH_FIRE, -1 },
651 { "ÅÅ", "E", TR_SH_ELEC, -1 },
652 { "Îä", "C", TR_SH_COLD, -1 },
653 { "Ëâ", "M", TR_NO_MAGIC, -1 },
654 { "½Ö", "T", TR_NO_TELE, -1 },
655 { NULL, NULL, 0, -1 }
658 static flag_insc_table flag_insc_brand[] =
660 { "»À", "A", TR_BRAND_ACID, -1 },
661 { "ÅÅ", "E", TR_BRAND_ELEC, -1 },
662 { "¾Æ", "F", TR_BRAND_FIRE, -1 },
663 { "Åà", "Co", TR_BRAND_COLD, -1 },
664 { "ÆÇ", "P", TR_BRAND_POIS, -1 },
665 { "ÆÙ", "Ca", TR_CHAOTIC, -1 },
666 { "µÛ", "V", TR_VAMPIRIC, -1 },
667 { "¿Ì", "Q", TR_IMPACT, -1 },
668 { "ÀÚ", "S", TR_VORPAL, -1 },
669 { "Íý", "M", TR_FORCE_WEAPON, -1 },
670 { NULL, NULL, 0, -1 }
673 static flag_insc_table flag_insc_kill[] =
675 { "¼Ù", "*", TR_KILL_EVIL, -1 },
676 { "¿Í", "p", TR_KILL_HUMAN, -1 },
677 { "ζ", "D", TR_KILL_DRAGON, -1 },
678 { "¥ª", "o", TR_KILL_ORC, -1 },
679 { "¥È", "T", TR_KILL_TROLL, -1 },
680 { "µð", "P", TR_KILL_GIANT, -1 },
681 { "¥Ç", "U", TR_KILL_DEMON, -1 },
682 { "Ȉ", "L", TR_KILL_UNDEAD, -1 },
683 { "ư", "Z", TR_KILL_ANIMAL, -1 },
684 { NULL, NULL, 0, -1 }
687 static flag_insc_table flag_insc_slay[] =
689 { "¼Ù", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
690 { "¿Í", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
691 { "ε", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
692 { "¥ª", "o", TR_SLAY_ORC, TR_KILL_ORC },
693 { "¥È", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
694 { "µð", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
695 { "¥Ç", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
696 { "Ȉ", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
697 { "ư", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
698 { NULL, NULL, 0, -1 }
701 static flag_insc_table flag_insc_esp1[] =
703 { "´¶", "Tele", TR_TELEPATHY, -1 },
704 { "¼Ù", "Evil", TR_ESP_EVIL, -1 },
705 { "Á±", "Good", TR_ESP_GOOD, -1 },
706 { "̵", "Nolv", TR_ESP_NONLIVING, -1 },
707 { "¸Ä", "Uniq", TR_ESP_UNIQUE, -1 },
708 { NULL, NULL, 0, -1 }
711 static flag_insc_table flag_insc_esp2[] =
713 { "¿Í", "p", TR_ESP_HUMAN, -1 },
714 { "ε", "D", TR_ESP_DRAGON, -1 },
715 { "¥ª", "o", TR_ESP_ORC, -1 },
716 { "¥È", "T", TR_ESP_TROLL, -1 },
717 { "µð", "P", TR_ESP_GIANT, -1 },
718 { "¥Ç", "U", TR_ESP_DEMON, -1 },
719 { "Ȉ", "L", TR_ESP_UNDEAD, -1 },
720 { "ư", "Z", TR_ESP_ANIMAL, -1 },
721 { NULL, NULL, 0, -1 }
724 static flag_insc_table flag_insc_sust[] =
726 { "ÏÓ", "St", TR_SUST_STR, -1 },
727 { "ÃÎ", "In", TR_SUST_INT, -1 },
728 { "¸", "Wi", TR_SUST_WIS, -1 },
729 { "´ï", "Dx", TR_SUST_DEX, -1 },
730 { "ÂÑ", "Cn", TR_SUST_CON, -1 },
731 { "̥", "Ch", TR_SUST_CHR, -1 },
732 { NULL, NULL, 0, -1 }
736 static flag_insc_table flag_insc_plus[] =
738 { "At", TR_BLOWS, -1 },
739 { "Sp", TR_SPEED, -1 },
740 { "St", TR_STR, -1 },
741 { "In", TR_INT, -1 },
742 { "Wi", TR_WIS, -1 },
743 { "Dx", TR_DEX, -1 },
744 { "Cn", TR_CON, -1 },
745 { "Ch", TR_CHR, -1 },
746 { "Md", TR_MAGIC_MASTERY, -1 },
747 { "Sl", TR_STEALTH, -1 },
748 { "Sr", TR_SEARCH, -1 },
749 { "If", TR_INFRA, -1 },
750 { "Dg", TR_TUNNEL, -1 },
754 static flag_insc_table flag_insc_immune[] =
756 { "Ac", TR_IM_ACID, -1 },
757 { "El", TR_IM_ELEC, -1 },
758 { "Fi", TR_IM_FIRE, -1 },
759 { "Co", TR_IM_COLD, -1 },
763 static flag_insc_table flag_insc_resistance[] =
765 { "Ac", TR_RES_ACID, TR_IM_ACID },
766 { "El", TR_RES_ELEC, TR_IM_ELEC },
767 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
768 { "Co", TR_RES_COLD, TR_IM_COLD },
769 { "Po", TR_RES_POIS, -1 },
770 { "Li", TR_RES_LITE, -1 },
771 { "Dk", TR_RES_DARK, -1 },
772 { "Sh", TR_RES_SHARDS, -1 },
773 { "Bl", TR_RES_BLIND, -1 },
774 { "Cf", TR_RES_CONF, -1 },
775 { "So", TR_RES_SOUND, -1 },
776 { "Nt", TR_RES_NETHER, -1 },
777 { "Nx", TR_RES_NEXUS, -1 },
778 { "Ca", TR_RES_CHAOS, -1 },
779 { "Di", TR_RES_DISEN, -1 },
780 { "Fe", TR_RES_FEAR, -1 },
784 static flag_insc_table flag_insc_misc[] =
786 { "Ma", TR_DEC_MANA, -1 },
787 { "Th", TR_THROW, -1 },
788 { "Rf", TR_REFLECT, -1 },
789 { "Fa", TR_FREE_ACT, -1 },
790 { "Si", TR_SEE_INVIS, -1 },
791 { "Hl", TR_HOLD_LIFE, -1 },
792 { "Sd", TR_SLOW_DIGEST, -1 },
793 { "Rg", TR_REGEN, -1 },
794 { "Lv", TR_LEVITATION, -1 },
795 { "Lu", TR_LITE, -1 },
796 { "Wr", TR_WARNING, -1 },
797 { "Xm", TR_XTRA_MIGHT, -1 },
798 { "Xs", TR_XTRA_SHOTS, -1 },
799 { "Te", TR_TELEPORT, -1 },
800 { "Ag", TR_AGGRAVATE, -1 },
801 { "Bs", TR_BLESSED, -1 },
802 { "Ty", TR_TY_CURSE, -1 },
806 static flag_insc_table flag_insc_aura[] =
808 { "F", TR_SH_FIRE, -1 },
809 { "E", TR_SH_ELEC, -1 },
810 { "C", TR_SH_COLD, -1 },
811 { "M", TR_NO_MAGIC, -1 },
812 { "T", TR_NO_TELE, -1 },
816 static flag_insc_table flag_insc_brand[] =
818 { "A", TR_BRAND_ACID, -1 },
819 { "E", TR_BRAND_ELEC, -1 },
820 { "F", TR_BRAND_FIRE, -1 },
821 { "Co", TR_BRAND_COLD, -1 },
822 { "P", TR_BRAND_POIS, -1 },
823 { "Ca", TR_CHAOTIC, -1 },
824 { "V", TR_VAMPIRIC, -1 },
825 { "Q", TR_IMPACT, -1 },
826 { "S", TR_VORPAL, -1 },
827 { "M", TR_FORCE_WEAPON, -1 },
831 static flag_insc_table flag_insc_kill[] =
833 { "*", TR_KILL_EVIL, -1 },
834 { "p", TR_KILL_HUMAN, -1 },
835 { "D", TR_KILL_DRAGON, -1 },
836 { "o", TR_KILL_ORC, -1 },
837 { "T", TR_KILL_TROLL, -1 },
838 { "P", TR_KILL_GIANT, -1 },
839 { "U", TR_KILL_DEMON, -1 },
840 { "L", TR_KILL_UNDEAD, -1 },
841 { "Z", TR_KILL_ANIMAL, -1 },
845 static flag_insc_table flag_insc_slay[] =
847 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
848 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
849 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
850 { "o", TR_SLAY_ORC, TR_KILL_ORC },
851 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
852 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
853 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
854 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
855 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
859 static flag_insc_table flag_insc_esp1[] =
861 { "Tele", TR_TELEPATHY, -1 },
862 { "Evil", TR_ESP_EVIL, -1 },
863 { "Good", TR_ESP_GOOD, -1 },
864 { "Nolv", TR_ESP_NONLIVING, -1 },
865 { "Uniq", TR_ESP_UNIQUE, -1 },
869 static flag_insc_table flag_insc_esp2[] =
871 { "p", TR_ESP_HUMAN, -1 },
872 { "D", TR_ESP_DRAGON, -1 },
873 { "o", TR_ESP_ORC, -1 },
874 { "T", TR_ESP_TROLL, -1 },
875 { "P", TR_ESP_GIANT, -1 },
876 { "U", TR_ESP_DEMON, -1 },
877 { "L", TR_ESP_UNDEAD, -1 },
878 { "Z", TR_ESP_ANIMAL, -1 },
882 static flag_insc_table flag_insc_sust[] =
884 { "St", TR_SUST_STR, -1 },
885 { "In", TR_SUST_INT, -1 },
886 { "Wi", TR_SUST_WIS, -1 },
887 { "Dx", TR_SUST_DEX, -1 },
888 { "Cn", TR_SUST_CON, -1 },
889 { "Ch", TR_SUST_CHR, -1 },
894 /* Simple macro for get_inscription() */
895 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
898 * Helper function for get_inscription()
900 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
906 while (fi_ptr->english)
908 if (have_flag(flgs, fi_ptr->flag) &&
909 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
911 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
913 ADD_INSC(fi_ptr->english);
923 * Special variation of have_flag for auto-inscription
925 static bool have_flag_of(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE])
927 while (fi_ptr->english)
929 if (have_flag(flgs, fi_ptr->flag) &&
930 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
938 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
940 char *prev_ptr = ptr;
941 u32b flgs[TR_FLAG_SIZE];
943 /* Extract the flags */
944 object_flags(o_ptr, flgs);
947 /* Remove obvious flags */
950 object_kind *k_ptr = &k_info[o_ptr->k_idx];
954 for (j = 0; j < TR_FLAG_SIZE; j++)
955 flgs[j] &= ~k_ptr->flags[j];
957 if (object_is_fixed_artifact(o_ptr))
959 artifact_type *a_ptr = &a_info[o_ptr->name1];
961 for (j = 0; j < TR_FLAG_SIZE; j++)
962 flgs[j] &= ~a_ptr->flags[j];
965 if (object_is_ego(o_ptr))
967 ego_item_type *e_ptr = &e_info[o_ptr->name2];
969 for (j = 0; j < TR_FLAG_SIZE; j++)
970 flgs[j] &= ~e_ptr->flags[j];
976 if (have_flag_of(flag_insc_plus, flgs))
981 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
984 if (have_flag_of(flag_insc_immune, flgs))
986 if (!kanji && ptr != prev_ptr)
993 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
996 if (have_flag_of(flag_insc_resistance, flgs))
1000 else if (ptr != prev_ptr)
1006 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1009 if (have_flag_of(flag_insc_misc, flgs))
1011 if (ptr != prev_ptr)
1017 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1020 if (have_flag_of(flag_insc_aura, flgs))
1024 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1027 if (have_flag_of(flag_insc_brand, flgs))
1029 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1032 if (have_flag_of(flag_insc_kill, flgs))
1034 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1037 if (have_flag_of(flag_insc_slay, flgs))
1039 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1044 if (have_flag_of(flag_insc_esp1, flgs) ||
1045 have_flag_of(flag_insc_esp2, flgs))
1047 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1048 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1052 if (have_flag_of(flag_insc_esp1, flgs))
1054 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1055 if (have_flag_of(flag_insc_esp2, flgs))
1057 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1061 if (have_flag_of(flag_insc_sust, flgs))
1065 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1074 * Get object inscription with auto inscription of object flags.
1076 static void get_inscription(char *buff, object_type *o_ptr)
1078 cptr insc = quark_str(o_ptr->inscription);
1081 /* Not fully identified */
1082 if (!(o_ptr->ident & IDENT_MENTAL))
1084 /* Copy until end of line or '#' */
1087 if (*insc == '#') break;
1089 if (iskanji(*insc)) *buff++ = *insc++;
1099 for (; *insc; insc++)
1101 /* Ignore fake artifact inscription */
1102 if (*insc == '#') break;
1104 /* {%} will be automatically converted */
1105 else if ('%' == *insc)
1111 /* check for too long inscription */
1112 if (ptr >= buff + MAX_NLEN) continue;
1125 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1135 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1150 * Creates a description of the item "o_ptr", and stores it in "out_val".
1152 * One can choose the "verbosity" of the description, including whether
1153 * or not the "number" of items should be described, and how much detail
1154 * should be used when describing the item.
1156 * The given "buf" must be MAX_NLEN chars long to hold the longest possible
1157 * description, which can get pretty long, including incriptions, such as:
1158 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".
1159 * Note that the inscription will be clipped to keep the total description
1160 * under MAX_NLEN-1 chars (plus a terminator).
1162 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,
1163 * portable, versions of some common "sprintf()" commands.
1165 * Note that all ego-items (when known) append an "Ego-Item Name", unless
1166 * the item is also an artifact, which should NEVER happen.
1168 * Note that all artifacts (when known) append an "Artifact Name", so we
1169 * have special processing for "Specials" (artifact Lites, Rings, Amulets).
1170 * The "Specials" never use "modifiers" if they are "known", since they
1171 * have special "descriptions", such as "The Necklace of the Dwarves".
1173 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),
1174 * plus the artifact name, just like any other artifact, if known.
1176 * Special Ring's and Amulet's, if not "aware", use the same code as normal
1177 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or
1178 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,
1179 * they will append the artifact name, just like any artifact, if known.
1181 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.
1184 * OD_NAME_ONLY : The Cloak of Death
1185 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]
1186 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)
1187 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}
1189 * OD_OMIT_PREFIX : Forbidden numeric prefix
1190 * OD_NO_PLURAL : Forbidden use of plural
1191 * OD_STORE : Assume to be aware and known
1192 * OD_NO_FLAVOR : Allow to hidden flavor
1193 * OD_FORCE_FLAVOR : Get un-shuffled flavor name
1195 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1197 /* Extract object kind name */
1198 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1200 /* Extract default "base" string */
1201 cptr basenm = kindname;
1203 /* Assume no "modifier" string */
1212 bool show_weapon = FALSE;
1213 bool show_armour = FALSE;
1218 char p1 = '(', p2 = ')';
1219 char b1 = '[', b2 = ']';
1220 char c1 = '{', c2 = '}';
1222 char tmp_val[MAX_NLEN+160];
1223 char tmp_val2[MAX_NLEN+10];
1224 char fake_insc_buf[30];
1226 u32b flgs[TR_FLAG_SIZE];
1228 object_type *bow_ptr;
1230 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1231 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1233 /* Extract some flags */
1234 object_flags(o_ptr, flgs);
1236 /* See if the object is "aware" */
1237 if (object_is_aware(o_ptr)) aware = TRUE;
1239 /* See if the object is "known" */
1240 if (object_is_known(o_ptr)) known = TRUE;
1242 /* Allow flavors to be hidden when aware */
1243 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1245 /* Object is in the inventory of a store or spoiler */
1246 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1248 /* Don't show flavors */
1251 /* Pretend known and aware */
1256 /* Force to be flavor name only */
1257 if (mode & OD_FORCE_FLAVOR)
1263 /* Cancel shuffling */
1264 flavor_k_ptr = k_ptr;
1267 /* Analyze the object */
1268 switch (o_ptr->tval)
1270 /* Some objects are easy to describe */
1284 monster_race *r_ptr = &r_info[o_ptr->pval];
1293 modstr = " (empty)";
1299 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1302 cptr t = r_name + r_ptr->name;
1304 if (!(r_ptr->flags1 & RF1_UNIQUE))
1306 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1312 sprintf(tmp_val2, "(%s)", t);
1322 /* Figurines/Statues */
1326 monster_race *r_ptr = &r_info[o_ptr->pval];
1329 modstr = r_name + r_ptr->name;
1331 cptr t = r_name + r_ptr->name;
1333 if (!(r_ptr->flags1 & RF1_UNIQUE))
1335 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1352 monster_race *r_ptr = &r_info[o_ptr->pval];
1354 modstr = r_name + r_ptr->name;
1359 if (r_ptr->flags1 & RF1_UNIQUE)
1360 basenm = "& % of #";
1368 /* Missiles/ Bows/ Weapons */
1397 /* Lites (including a few "Specials") */
1403 /* Amulets (including a few "Specials") */
1406 /* Known artifacts */
1409 if (object_is_fixed_artifact(o_ptr)) break;
1410 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1413 /* Color the object */
1414 modstr = k_name + flavor_k_ptr->flavor_name;
1417 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1418 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1419 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1421 if (!flavor) basenm = "& Amulet~ of %";
1422 else if (aware) basenm = "& # Amulet~ of %";
1423 else basenm = "& # Amulet~";
1429 /* Rings (including a few "Specials") */
1432 /* Known artifacts */
1435 if (object_is_fixed_artifact(o_ptr)) break;
1436 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1439 /* Color the object */
1440 modstr = k_name + flavor_k_ptr->flavor_name;
1443 if (!flavor) basenm = "%¤Î»ØÎØ";
1444 else if (aware) basenm = "%¤Î#»ØÎØ";
1445 else basenm = "#»ØÎØ";
1447 if (!flavor) basenm = "& Ring~ of %";
1448 else if (aware) basenm = "& # Ring~ of %";
1449 else basenm = "& # Ring~";
1452 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1464 /* Color the object */
1465 modstr = k_name + flavor_k_ptr->flavor_name;
1468 if (!flavor) basenm = "%¤Î¾ó";
1469 else if (aware) basenm = "%¤Î#¾ó";
1470 else basenm = "#¾ó";
1472 if (!flavor) basenm = "& Staff~ of %";
1473 else if (aware) basenm = "& # Staff~ of %";
1474 else basenm = "& # Staff~";
1482 /* Color the object */
1483 modstr = k_name + flavor_k_ptr->flavor_name;
1486 if (!flavor) basenm = "%¤ÎËâË¡ËÀ";
1487 else if (aware) basenm = "%¤Î#ËâË¡ËÀ";
1488 else basenm = "#ËâË¡ËÀ";
1490 if (!flavor) basenm = "& Wand~ of %";
1491 else if (aware) basenm = "& # Wand~ of %";
1492 else basenm = "& # Wand~";
1500 /* Color the object */
1501 modstr = k_name + flavor_k_ptr->flavor_name;
1504 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1505 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1506 else basenm = "#¥í¥Ã¥É";
1508 if (!flavor) basenm = "& Rod~ of %";
1509 else if (aware) basenm = "& # Rod~ of %";
1510 else basenm = "& # Rod~";
1518 /* Color the object */
1519 modstr = k_name + flavor_k_ptr->flavor_name;
1522 if (!flavor) basenm = "%¤Î´¬Êª";
1523 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1524 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1526 if (!flavor) basenm = "& Scroll~ of %";
1527 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1528 else basenm = "& Scroll~ titled \"#\"";
1536 /* Color the object */
1537 modstr = k_name + flavor_k_ptr->flavor_name;
1540 if (!flavor) basenm = "%¤ÎÌô";
1541 else if (aware) basenm = "%¤Î#Ìô";
1542 else basenm = "#Ìô";
1544 if (!flavor) basenm = "& Potion~ of %";
1545 else if (aware) basenm = "& # Potion~ of %";
1546 else basenm = "& # Potion~";
1554 /* Ordinary food is "boring" */
1555 if (!k_ptr->flavor_name) break;
1557 /* Color the object */
1558 modstr = k_name + flavor_k_ptr->flavor_name;
1561 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1562 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1563 else basenm = "#¥¥Î¥³";
1565 if (!flavor) basenm = "& Mushroom~ of %";
1566 else if (aware) basenm = "& # Mushroom~ of %";
1567 else basenm = "& # Mushroom~";
1576 basenm = "ÍÓÈé»æ - %";
1578 basenm = "& Parchment~ - %";
1587 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1589 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1590 basenm = "& Book~ of Life Magic %";
1592 basenm = "& Life Spellbook~ %";
1598 case TV_SORCERY_BOOK:
1601 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1603 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1604 basenm = "& Book~ of Sorcery %";
1606 basenm = "& Sorcery Spellbook~ %";
1612 case TV_NATURE_BOOK:
1615 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1617 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1618 basenm = "& Book~ of Nature Magic %";
1620 basenm = "& Nature Spellbook~ %";
1629 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1631 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1632 basenm = "& Book~ of Chaos Magic %";
1634 basenm = "& Chaos Spellbook~ %";
1643 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1645 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1646 basenm = "& Book~ of Death Magic %";
1648 basenm = "& Death Spellbook~ %";
1657 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1659 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1660 basenm = "& Book~ of Trump Magic %";
1662 basenm = "& Trump Spellbook~ %";
1668 case TV_ARCANE_BOOK:
1671 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1673 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1674 basenm = "& Book~ of Arcane Magic %";
1676 basenm = "& Arcane Spellbook~ %";
1685 basenm = "¾¢¤ÎËâË¡½ñ%";
1687 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1688 basenm = "& Book~ of Craft Magic %";
1690 basenm = "& Craft Spellbook~ %";
1696 case TV_DAEMON_BOOK:
1699 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1701 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1702 basenm = "& Book~ of Daemon Magic %";
1704 basenm = "& Daemon Spellbook~ %";
1710 case TV_CRUSADE_BOOK:
1713 basenm = "Ç˼٤ÎËâË¡½ñ%";
1715 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1716 basenm = "& Book~ of Crusade Magic %";
1718 basenm = "& Crusade Spellbook~ %";
1729 basenm = "& Song Book~ %";
1735 case TV_HISSATSU_BOOK:
1738 basenm = "& Éð·Ý¤Î½ñ%";
1740 basenm = "Book~ of Kendo %";
1749 basenm = "¼ö½Ñ¤ÎËâË¡½ñ%";
1751 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1752 basenm = "& Book~ of Crusade Magic %";
1754 basenm = "& Crusade Spellbook~ %";
1760 /* Hack -- Gold/Gems */
1763 strcpy(buf, basenm);
1767 /* Used in the "inventory" routine */
1771 strcpy(buf, "(¤Ê¤·)");
1773 strcpy(buf, "(nothing)");
1780 /* Use full name from k_info or a_info */
1781 if (aware && have_flag(flgs, TR_FULL_NAME))
1783 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1784 else basenm = kindname;
1787 /* Start dumping the result */
1791 if (basenm[0] == '&')
1797 if (mode & OD_OMIT_PREFIX)
1801 else if (o_ptr->number > 1)
1803 t = object_desc_kosuu(t, o_ptr);
1804 t = object_desc_str(t, "¤Î ");
1807 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1808 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1812 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1813 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1818 /* The object "expects" a "number" */
1819 if (basenm[0] == '&')
1821 /* Skip the ampersand (and space) */
1825 if (mode & OD_OMIT_PREFIX)
1830 /* Hack -- None left */
1831 else if (o_ptr->number <= 0)
1833 t = object_desc_str(t, "no more ");
1836 /* Extract the number */
1837 else if (o_ptr->number > 1)
1839 t = object_desc_num(t, o_ptr->number);
1840 t = object_desc_chr(t, ' ');
1843 /* Hack -- The only one of its kind */
1844 else if ((known && object_is_artifact(o_ptr)) ||
1845 ((o_ptr->tval == TV_CORPSE) &&
1846 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1848 t = object_desc_str(t, "The ");
1858 case '#': vowel = is_a_vowel(modstr[0]); break;
1859 case '%': vowel = is_a_vowel(*kindname); break;
1860 default: vowel = is_a_vowel(*s); break;
1865 /* A single one, with a vowel */
1866 t = object_desc_str(t, "an ");
1870 /* A single one, without a vowel */
1871 t = object_desc_str(t, "a ");
1876 /* Hack -- objects that "never" take an article */
1883 if (mode & OD_OMIT_PREFIX)
1888 /* Hack -- all gone */
1889 else if (o_ptr->number <= 0)
1891 t = object_desc_str(t, "no more ");
1894 /* Prefix a number if required */
1895 else if (o_ptr->number > 1)
1897 t = object_desc_num(t, o_ptr->number);
1898 t = object_desc_chr(t, ' ');
1901 /* Hack -- The only one of its kind */
1902 else if (known && object_is_artifact(o_ptr))
1904 t = object_desc_str(t, "The ");
1907 /* Hack -- single items get no prefix */
1915 /* Paranoia -- skip illegal tildes */
1916 /* while (*s == '~') s++; */
1919 if (object_is_smith(o_ptr))
1921 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
1924 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
1927 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
1928 if (o_ptr->art_name)
1930 cptr temp = quark_str(o_ptr->art_name);
1932 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1933 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
1934 if (strncmp(temp, "of ", 3) == 0)
1936 t = object_desc_str(t, &temp[3]);
1937 t = object_desc_str(t, "¤Î");
1939 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
1940 (strncmp(temp, "¡Ô", 2) != 0) &&
1942 t = object_desc_str(t, temp);
1944 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
1945 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
1947 artifact_type *a_ptr = &a_info[o_ptr->name1];
1948 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1949 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
1951 t = object_desc_str(t, a_name + a_ptr->name);
1954 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
1955 else if (object_is_ego(o_ptr))
1957 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1958 t = object_desc_str(t, e_name + e_ptr->name);
1963 /* Copy the string */
1964 for (s0 = NULL; *s || s0; )
1966 /* The end of the flavour/kind string. */
1973 /* Begin to append the modifier (flavor) */
1974 else if ((*s == '#') && !s0)
1979 /* Paranoia -- Never append multiple modstrs */
1983 /* Begin to append the kind name */
1984 else if ((*s == '%') && !s0)
1989 /* Paranoia -- Never append multiple kindnames */
1997 /* Add a plural if needed */
1998 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2002 /* XXX XXX XXX Mega-Hack */
2004 /* Hack -- "Cutlass-es" and "Torch-es" */
2005 if ((k == 's') || (k == 'h')) *t++ = 'e';
2027 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2030 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2031 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2032 if (o_ptr->art_name)
2036 strcpy(temp, quark_str(o_ptr->art_name));
2037 /* MEGA HACK by ita */
2038 if (strncmp(temp, "¡Ø", 2) == 0 ||
2039 strncmp(temp, "¡Ô", 2) == 0)
2040 t = object_desc_str(t, temp);
2041 else if (temp[0] == '\'')
2043 itemp = strlen(temp);
2044 temp[itemp - 1] = 0;
2045 t = object_desc_str(t, "¡Ø");
2046 t = object_desc_str(t, &temp[1]);
2047 t = object_desc_str(t, "¡Ù");
2050 else if (object_is_fixed_artifact(o_ptr))
2052 artifact_type *a_ptr = &a_info[o_ptr->name1];
2053 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2055 t = object_desc_str(t, a_name + a_ptr->name);
2058 else if (o_ptr->inscription)
2060 cptr str = quark_str(o_ptr->inscription);
2069 if (*str == '#') break;
2075 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2077 /* Add the false name */
2078 t = object_desc_str(t,"¡Ø");
2079 t = object_desc_str(t, &str[1]);
2080 t = object_desc_str(t,"¡Ù");
2085 if (object_is_smith(o_ptr))
2087 t = object_desc_str(t,format(" of %s the Smith",player_name));
2090 /* Hack -- Append "Artifact" or "Special" names */
2091 if (known && !have_flag(flgs, TR_FULL_NAME))
2093 /* Is it a new random artifact ? */
2094 if (o_ptr->art_name)
2096 t = object_desc_chr(t, ' ');
2097 t = object_desc_str(t, quark_str(o_ptr->art_name));
2100 /* Grab any artifact name */
2101 else if (object_is_fixed_artifact(o_ptr))
2103 artifact_type *a_ptr = &a_info[o_ptr->name1];
2105 t = object_desc_chr(t, ' ');
2106 t = object_desc_str(t, a_name + a_ptr->name);
2109 /* Grab any ego-item name */
2112 if (object_is_ego(o_ptr))
2114 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2116 t = object_desc_chr(t, ' ');
2117 t = object_desc_str(t, e_name + e_ptr->name);
2120 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2123 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2125 /* Add the false name */
2126 t = object_desc_chr(t, ' ');
2127 t = object_desc_str(t, &str[1]);
2134 /* No more details wanted */
2135 if (mode & OD_NAME_ONLY) goto object_desc_done;
2137 /* Hack -- Chests must be described in detail */
2138 if (o_ptr->tval == TV_CHEST)
2140 /* Not searched yet */
2146 /* May be "empty" */
2147 else if (!o_ptr->pval)
2150 t = object_desc_str(t, "(¶õ)");
2152 t = object_desc_str(t, " (empty)");
2156 /* May be "disarmed" */
2157 else if (o_ptr->pval < 0)
2159 if (chest_traps[0 - o_ptr->pval])
2162 t = object_desc_str(t, "(²ò½üºÑ)");
2164 t = object_desc_str(t, " (disarmed)");
2170 t = object_desc_str(t, "(Èó»Ü¾û)");
2172 t = object_desc_str(t, " (unlocked)");
2177 /* Describe the traps, if any */
2180 /* Describe the traps */
2181 switch (chest_traps[o_ptr->pval])
2186 t = object_desc_str(t, "(»Ü¾û)");
2188 t = object_desc_str(t, " (Locked)");
2192 case CHEST_LOSE_STR:
2195 t = object_desc_str(t, "(ÆÇ¿Ë)");
2197 t = object_desc_str(t, " (Poison Needle)");
2201 case CHEST_LOSE_CON:
2204 t = object_desc_str(t, "(ÆÇ¿Ë)");
2206 t = object_desc_str(t, " (Poison Needle)");
2213 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2215 t = object_desc_str(t, " (Gas Trap)");
2219 case CHEST_PARALYZE:
2222 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2224 t = object_desc_str(t, " (Gas Trap)");
2231 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2233 t = object_desc_str(t, " (Explosion Device)");
2238 case CHEST_BIRD_STORM:
2239 case CHEST_E_SUMMON:
2240 case CHEST_H_SUMMON:
2243 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2245 t = object_desc_str(t, " (Summoning Runes)");
2249 case CHEST_RUNES_OF_EVIL:
2252 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2254 t = object_desc_str(t, " (Gleaming Black Runes)");
2261 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2263 t = object_desc_str(t, " (Alarm)");
2270 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2272 t = object_desc_str(t, " (Multiple Traps)");
2281 /* Display the item like a weapon */
2282 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2284 /* Display the item like a weapon */
2285 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2288 /* Display the item like a weapon */
2289 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2291 /* Display the item like armour */
2292 if (o_ptr->ac) show_armour = TRUE;
2295 /* Dump base weapon info */
2296 switch (o_ptr->tval)
2298 /* Missiles and Weapons */
2307 /* Append a "damage" string */
2308 t = object_desc_chr(t, ' ');
2309 t = object_desc_chr(t, p1);
2310 t = object_desc_num(t, o_ptr->dd);
2311 t = object_desc_chr(t, 'd');
2312 t = object_desc_num(t, o_ptr->ds);
2313 t = object_desc_chr(t, p2);
2319 /* Bows get a special "damage string" */
2322 /* Mega-Hack -- Extract the "base power" */
2323 power = bow_tmul(o_ptr->sval);
2325 /* Apply the "Extra Might" flag */
2326 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2328 /* Append a special "damage" string */
2329 t = object_desc_chr(t, ' ');
2330 t = object_desc_chr(t, p1);
2331 t = object_desc_chr(t, 'x');
2332 t = object_desc_num(t, power);
2333 t = object_desc_chr(t, p2);
2340 /* Add the weapon bonuses */
2343 /* Show the tohit/todam on request */
2346 t = object_desc_chr(t, ' ');
2347 t = object_desc_chr(t, p1);
2348 t = object_desc_int(t, o_ptr->to_h);
2349 t = object_desc_chr(t, ',');
2350 t = object_desc_int(t, o_ptr->to_d);
2351 t = object_desc_chr(t, p2);
2354 /* Show the tohit if needed */
2355 else if (o_ptr->to_h)
2357 t = object_desc_chr(t, ' ');
2358 t = object_desc_chr(t, p1);
2359 t = object_desc_int(t, o_ptr->to_h);
2360 t = object_desc_chr(t, p2);
2363 /* Show the todam if needed */
2364 else if (o_ptr->to_d)
2366 t = object_desc_chr(t, ' ');
2367 t = object_desc_chr(t, p1);
2368 t = object_desc_int(t, o_ptr->to_d);
2369 t = object_desc_chr(t, p2);
2373 bow_ptr = &inventory[INVEN_BOW];
2375 /* If have a firing weapon + ammo matches bow */
2376 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2378 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2379 int tmul = bow_tmul(bow_ptr->sval);
2380 s16b energy_fire = bow_energy(bow_ptr->sval);
2382 /* See if the bow is "known" - then set damage bonus */
2383 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2385 /* Effect of ammo */
2386 if (known) avgdam += (o_ptr->to_d * 10);
2388 /* Get extra "power" from "extra might" */
2389 if (p_ptr->xtra_might) tmul++;
2391 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2393 /* Launcher multiplier */
2395 avgdam /= (100 * 10);
2397 /* Get extra damage from concentration */
2398 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2400 if (avgdam < 0) avgdam = 0;
2402 /* Display (shot damage/ avg damage) */
2403 t = object_desc_chr(t, ' ');
2404 t = object_desc_chr(t, p1);
2405 t = object_desc_num(t, avgdam);
2406 t = object_desc_chr(t, '/');
2408 if (p_ptr->num_fire == 0)
2410 t = object_desc_chr(t, '0');
2414 /* Calc effects of energy */
2415 avgdam *= (p_ptr->num_fire * 100);
2416 avgdam /= energy_fire;
2417 t = object_desc_num(t, avgdam);
2420 t = object_desc_chr(t, p2);
2422 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2424 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2425 s16b energy_fire = 100 - p_ptr->lev;
2427 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2429 /* Display (shot damage/ avg damage) */
2430 t = object_desc_chr(t, ' ');
2431 t = object_desc_chr(t, p1);
2432 t = object_desc_num(t, avgdam);
2433 t = object_desc_chr(t, '/');
2435 /* Calc effects of energy */
2436 avgdam = 100 * avgdam / energy_fire;
2438 t = object_desc_num(t, avgdam);
2439 t = object_desc_chr(t, p2);
2442 /* Add the armor bonuses */
2445 /* Show the armor class info */
2448 t = object_desc_chr(t, ' ');
2449 t = object_desc_chr(t, b1);
2450 t = object_desc_num(t, o_ptr->ac);
2451 t = object_desc_chr(t, ',');
2452 t = object_desc_int(t, o_ptr->to_a);
2453 t = object_desc_chr(t, b2);
2456 /* No base armor, but does increase armor */
2457 else if (o_ptr->to_a)
2459 t = object_desc_chr(t, ' ');
2460 t = object_desc_chr(t, b1);
2461 t = object_desc_int(t, o_ptr->to_a);
2462 t = object_desc_chr(t, b2);
2466 /* Hack -- always show base armor */
2467 else if (show_armour)
2469 t = object_desc_chr(t, ' ');
2470 t = object_desc_chr(t, b1);
2471 t = object_desc_num(t, o_ptr->ac);
2472 t = object_desc_chr(t, b2);
2476 /* No more details wanted */
2477 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2480 if (known) /* Known item only */
2483 * Hack -- Wands and Staffs have charges. Make certain how many charges
2484 * a stack of staffs really has is clear. -LM-
2486 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2488 /* Dump " (N charges)" */
2489 t = object_desc_chr(t, ' ');
2490 t = object_desc_chr(t, p1);
2492 /* Clear explaination for staffs. */
2493 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2495 t = object_desc_num(t, o_ptr->number);
2496 t = object_desc_str(t, "x ");
2498 t = object_desc_num(t, o_ptr->pval);
2500 t = object_desc_str(t, "²óʬ");
2502 t = object_desc_str(t, " charge");
2503 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2506 t = object_desc_chr(t, p2);
2508 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2509 * be in any state of charge or discharge, this now includes a number. -LM-
2511 else if (o_ptr->tval == TV_ROD)
2513 /* Hack -- Dump " (# charging)" if relevant */
2516 /* Stacks of rods display an exact count of charging rods. */
2517 if (o_ptr->number > 1)
2520 if (k_ptr->pval == 0) k_ptr->pval = 1;
2522 /* Find out how many rods are charging, by dividing
2523 * current timeout by each rod's maximum timeout.
2524 * Ensure that any remainder is rounded up. Display
2525 * very discharged stacks as merely fully discharged.
2527 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2528 if (power > o_ptr->number) power = o_ptr->number;
2530 /* Display prettily. */
2531 t = object_desc_str(t, " (");
2532 t = object_desc_num(t, power);
2534 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2536 t = object_desc_str(t, " charging)");
2540 /* "one Rod of Perception (1 charging)" would look tacky. */
2544 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2546 t = object_desc_str(t, " (charging)");
2552 /* Dump "pval" flags for wearable items */
2553 if (have_pval_flags(flgs))
2555 /* Start the display */
2556 t = object_desc_chr(t, ' ');
2557 t = object_desc_chr(t, p1);
2559 /* Dump the "pval" itself */
2560 t = object_desc_int(t, o_ptr->pval);
2562 /* Do not display the "pval" flags */
2563 if (have_flag(flgs, TR_HIDE_TYPE))
2569 else if (have_flag(flgs, TR_SPEED))
2571 /* Dump " to speed" */
2573 t = object_desc_str(t, "²Ã®");
2575 t = object_desc_str(t, " to speed");
2580 else if (have_flag(flgs, TR_BLOWS))
2584 t = object_desc_str(t, "¹¶·â");
2586 t = object_desc_str(t, " attack");
2589 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2594 else if (have_flag(flgs, TR_STEALTH))
2596 /* Dump " to stealth" */
2598 t = object_desc_str(t, "±£Ì©");
2600 t = object_desc_str(t, " to stealth");
2605 else if (have_flag(flgs, TR_SEARCH))
2607 /* Dump " to searching" */
2609 t = object_desc_str(t, "õº÷");
2611 t = object_desc_str(t, " to searching");
2616 else if (have_flag(flgs, TR_INFRA))
2618 /* Dump " to infravision" */
2620 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2622 t = object_desc_str(t, " to infravision");
2626 /* Finish the display */
2627 t = object_desc_chr(t, p2);
2630 /* Hack -- Process Lanterns/Torches */
2631 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2633 /* Hack -- Turns of light for normal lites */
2635 t = object_desc_chr(t, '(');
2637 t = object_desc_str(t, " (with ");
2640 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2641 else t = object_desc_num(t, o_ptr->xtra4);
2643 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2645 t = object_desc_str(t, " turns of light)");
2649 /* Indicate charging objects, but not rods. */
2650 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2652 /* Hack -- Dump " (charging)" if relevant */
2654 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2656 t = object_desc_str(t, " (charging)");
2662 /* No more details wanted */
2663 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2666 /* Prepare real inscriptions in a buffer */
2669 /* Auto abbreviation inscribe */
2670 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2672 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2683 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2687 /* Use the standard inscription if available */
2688 if (o_ptr->inscription)
2692 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2694 /* Get inscription and convert {%} */
2695 get_inscription(buff, o_ptr);
2697 /* strcat with correct treating of kanji */
2698 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2702 /* No fake inscription yet */
2703 fake_insc_buf[0] = '\0';
2705 /* Use the game-generated "feeling" otherwise, if available */
2708 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2711 /* Note "cursed" if the item is known to be cursed */
2712 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2715 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2717 strcpy(fake_insc_buf, "cursed");
2721 /* Note "unidentified" if the item is unidentified */
2722 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2723 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2725 && !(o_ptr->ident & IDENT_SENSE))
2728 strcpy(fake_insc_buf, "̤´ÕÄê");
2730 strcpy(fake_insc_buf, "unidentified");
2734 /* Mega-Hack -- note empty wands/staffs */
2735 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2738 strcpy(fake_insc_buf, "¶õ");
2740 strcpy(fake_insc_buf, "empty");
2744 /* Note "tried" if the object has been tested unsuccessfully */
2745 else if (!aware && object_is_tried(o_ptr))
2748 strcpy(fake_insc_buf, "̤ȽÌÀ");
2750 strcpy(fake_insc_buf, "tried");
2754 /* Note the discount, if any */
2755 if (o_ptr->discount)
2757 /* Hidden by real inscription unless in a store */
2758 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2760 char discount_num_buf[4];
2762 /* Append to other fake inscriptions if any */
2763 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2765 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2766 strcat(fake_insc_buf, discount_num_buf);
2768 strcat(fake_insc_buf, "%°ú¤");
2770 strcat(fake_insc_buf, "% off");
2776 /* Append the inscription, if any */
2777 if (fake_insc_buf[0] || tmp_val2[0])
2779 /* Append the inscription */
2780 t = object_desc_chr(t, ' ');
2781 t = object_desc_chr(t, c1);
2783 /* Append fake inscriptions */
2784 if (fake_insc_buf[0])
2786 t = object_desc_str(t, fake_insc_buf);
2789 /* Append a separater */
2790 if (fake_insc_buf[0] && tmp_val2[0])
2792 t = object_desc_chr(t, ',');
2793 t = object_desc_chr(t, ' ');
2796 /* Append real inscriptions */
2799 t = object_desc_str(t, tmp_val2);
2802 t = object_desc_chr(t, c2);
2806 my_strcpy(buf, tmp_val, MAX_NLEN);