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 { "¼ö", "C-", TR_ADD_L_CURSE, -1 },
650 { "ëÇ", "C+", TR_ADD_H_CURSE, -1 },
651 { NULL, NULL, 0, -1 }
654 static flag_insc_table flag_insc_aura[] =
656 { "±ê", "F", TR_SH_FIRE, -1 },
657 { "ÅÅ", "E", TR_SH_ELEC, -1 },
658 { "Îä", "C", TR_SH_COLD, -1 },
659 { "Ëâ", "M", TR_NO_MAGIC, -1 },
660 { "½Ö", "T", TR_NO_TELE, -1 },
661 { NULL, NULL, 0, -1 }
664 static flag_insc_table flag_insc_brand[] =
666 { "»À", "A", TR_BRAND_ACID, -1 },
667 { "ÅÅ", "E", TR_BRAND_ELEC, -1 },
668 { "¾Æ", "F", TR_BRAND_FIRE, -1 },
669 { "Åà", "Co", TR_BRAND_COLD, -1 },
670 { "ÆÇ", "P", TR_BRAND_POIS, -1 },
671 { "ÆÙ", "Ca", TR_CHAOTIC, -1 },
672 { "µÛ", "V", TR_VAMPIRIC, -1 },
673 { "¿Ì", "Q", TR_IMPACT, -1 },
674 { "ÀÚ", "S", TR_VORPAL, -1 },
675 { "Íý", "M", TR_FORCE_WEAPON, -1 },
676 { NULL, NULL, 0, -1 }
679 static flag_insc_table flag_insc_kill[] =
681 { "¼Ù", "*", TR_KILL_EVIL, -1 },
682 { "¿Í", "p", TR_KILL_HUMAN, -1 },
683 { "ζ", "D", TR_KILL_DRAGON, -1 },
684 { "¥ª", "o", TR_KILL_ORC, -1 },
685 { "¥È", "T", TR_KILL_TROLL, -1 },
686 { "µð", "P", TR_KILL_GIANT, -1 },
687 { "¥Ç", "U", TR_KILL_DEMON, -1 },
688 { "Ȉ", "L", TR_KILL_UNDEAD, -1 },
689 { "ư", "Z", TR_KILL_ANIMAL, -1 },
690 { NULL, NULL, 0, -1 }
693 static flag_insc_table flag_insc_slay[] =
695 { "¼Ù", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
696 { "¿Í", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
697 { "ε", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
698 { "¥ª", "o", TR_SLAY_ORC, TR_KILL_ORC },
699 { "¥È", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
700 { "µð", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
701 { "¥Ç", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
702 { "Ȉ", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
703 { "ư", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
704 { NULL, NULL, 0, -1 }
707 static flag_insc_table flag_insc_esp1[] =
709 { "´¶", "Tele", TR_TELEPATHY, -1 },
710 { "¼Ù", "Evil", TR_ESP_EVIL, -1 },
711 { "Á±", "Good", TR_ESP_GOOD, -1 },
712 { "̵", "Nolv", TR_ESP_NONLIVING, -1 },
713 { "¸Ä", "Uniq", TR_ESP_UNIQUE, -1 },
714 { NULL, NULL, 0, -1 }
717 static flag_insc_table flag_insc_esp2[] =
719 { "¿Í", "p", TR_ESP_HUMAN, -1 },
720 { "ε", "D", TR_ESP_DRAGON, -1 },
721 { "¥ª", "o", TR_ESP_ORC, -1 },
722 { "¥È", "T", TR_ESP_TROLL, -1 },
723 { "µð", "P", TR_ESP_GIANT, -1 },
724 { "¥Ç", "U", TR_ESP_DEMON, -1 },
725 { "Ȉ", "L", TR_ESP_UNDEAD, -1 },
726 { "ư", "Z", TR_ESP_ANIMAL, -1 },
727 { NULL, NULL, 0, -1 }
730 static flag_insc_table flag_insc_sust[] =
732 { "ÏÓ", "St", TR_SUST_STR, -1 },
733 { "ÃÎ", "In", TR_SUST_INT, -1 },
734 { "¸", "Wi", TR_SUST_WIS, -1 },
735 { "´ï", "Dx", TR_SUST_DEX, -1 },
736 { "ÂÑ", "Cn", TR_SUST_CON, -1 },
737 { "̥", "Ch", TR_SUST_CHR, -1 },
738 { NULL, NULL, 0, -1 }
742 static flag_insc_table flag_insc_plus[] =
744 { "At", TR_BLOWS, -1 },
745 { "Sp", TR_SPEED, -1 },
746 { "St", TR_STR, -1 },
747 { "In", TR_INT, -1 },
748 { "Wi", TR_WIS, -1 },
749 { "Dx", TR_DEX, -1 },
750 { "Cn", TR_CON, -1 },
751 { "Ch", TR_CHR, -1 },
752 { "Md", TR_MAGIC_MASTERY, -1 },
753 { "Sl", TR_STEALTH, -1 },
754 { "Sr", TR_SEARCH, -1 },
755 { "If", TR_INFRA, -1 },
756 { "Dg", TR_TUNNEL, -1 },
760 static flag_insc_table flag_insc_immune[] =
762 { "Ac", TR_IM_ACID, -1 },
763 { "El", TR_IM_ELEC, -1 },
764 { "Fi", TR_IM_FIRE, -1 },
765 { "Co", TR_IM_COLD, -1 },
769 static flag_insc_table flag_insc_resistance[] =
771 { "Ac", TR_RES_ACID, TR_IM_ACID },
772 { "El", TR_RES_ELEC, TR_IM_ELEC },
773 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
774 { "Co", TR_RES_COLD, TR_IM_COLD },
775 { "Po", TR_RES_POIS, -1 },
776 { "Li", TR_RES_LITE, -1 },
777 { "Dk", TR_RES_DARK, -1 },
778 { "Sh", TR_RES_SHARDS, -1 },
779 { "Bl", TR_RES_BLIND, -1 },
780 { "Cf", TR_RES_CONF, -1 },
781 { "So", TR_RES_SOUND, -1 },
782 { "Nt", TR_RES_NETHER, -1 },
783 { "Nx", TR_RES_NEXUS, -1 },
784 { "Ca", TR_RES_CHAOS, -1 },
785 { "Di", TR_RES_DISEN, -1 },
786 { "Fe", TR_RES_FEAR, -1 },
790 static flag_insc_table flag_insc_misc[] =
792 { "Es", TR_EASY_SPELL, -1 },
793 { "Dm", TR_DEC_MANA, -1 },
794 { "Th", TR_THROW, -1 },
795 { "Rf", TR_REFLECT, -1 },
796 { "Fa", TR_FREE_ACT, -1 },
797 { "Si", TR_SEE_INVIS, -1 },
798 { "Hl", TR_HOLD_LIFE, -1 },
799 { "Sd", TR_SLOW_DIGEST, -1 },
800 { "Rg", TR_REGEN, -1 },
801 { "Lv", TR_LEVITATION, -1 },
802 { "Lu", TR_LITE, -1 },
803 { "Wr", TR_WARNING, -1 },
804 { "Xm", TR_XTRA_MIGHT, -1 },
805 { "Xs", TR_XTRA_SHOTS, -1 },
806 { "Te", TR_TELEPORT, -1 },
807 { "Ag", TR_AGGRAVATE, -1 },
808 { "Bs", TR_BLESSED, -1 },
809 { "Ty", TR_TY_CURSE, -1 },
810 { "C-", TR_ADD_L_CURSE, -1 },
811 { "C+", TR_ADD_H_CURSE, -1 },
815 static flag_insc_table flag_insc_aura[] =
817 { "F", TR_SH_FIRE, -1 },
818 { "E", TR_SH_ELEC, -1 },
819 { "C", TR_SH_COLD, -1 },
820 { "M", TR_NO_MAGIC, -1 },
821 { "T", TR_NO_TELE, -1 },
825 static flag_insc_table flag_insc_brand[] =
827 { "A", TR_BRAND_ACID, -1 },
828 { "E", TR_BRAND_ELEC, -1 },
829 { "F", TR_BRAND_FIRE, -1 },
830 { "Co", TR_BRAND_COLD, -1 },
831 { "P", TR_BRAND_POIS, -1 },
832 { "Ca", TR_CHAOTIC, -1 },
833 { "V", TR_VAMPIRIC, -1 },
834 { "Q", TR_IMPACT, -1 },
835 { "S", TR_VORPAL, -1 },
836 { "M", TR_FORCE_WEAPON, -1 },
840 static flag_insc_table flag_insc_kill[] =
842 { "*", TR_KILL_EVIL, -1 },
843 { "p", TR_KILL_HUMAN, -1 },
844 { "D", TR_KILL_DRAGON, -1 },
845 { "o", TR_KILL_ORC, -1 },
846 { "T", TR_KILL_TROLL, -1 },
847 { "P", TR_KILL_GIANT, -1 },
848 { "U", TR_KILL_DEMON, -1 },
849 { "L", TR_KILL_UNDEAD, -1 },
850 { "Z", TR_KILL_ANIMAL, -1 },
854 static flag_insc_table flag_insc_slay[] =
856 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
857 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
858 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
859 { "o", TR_SLAY_ORC, TR_KILL_ORC },
860 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
861 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
862 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
863 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
864 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
868 static flag_insc_table flag_insc_esp1[] =
870 { "Tele", TR_TELEPATHY, -1 },
871 { "Evil", TR_ESP_EVIL, -1 },
872 { "Good", TR_ESP_GOOD, -1 },
873 { "Nolv", TR_ESP_NONLIVING, -1 },
874 { "Uniq", TR_ESP_UNIQUE, -1 },
878 static flag_insc_table flag_insc_esp2[] =
880 { "p", TR_ESP_HUMAN, -1 },
881 { "D", TR_ESP_DRAGON, -1 },
882 { "o", TR_ESP_ORC, -1 },
883 { "T", TR_ESP_TROLL, -1 },
884 { "P", TR_ESP_GIANT, -1 },
885 { "U", TR_ESP_DEMON, -1 },
886 { "L", TR_ESP_UNDEAD, -1 },
887 { "Z", TR_ESP_ANIMAL, -1 },
891 static flag_insc_table flag_insc_sust[] =
893 { "St", TR_SUST_STR, -1 },
894 { "In", TR_SUST_INT, -1 },
895 { "Wi", TR_SUST_WIS, -1 },
896 { "Dx", TR_SUST_DEX, -1 },
897 { "Cn", TR_SUST_CON, -1 },
898 { "Ch", TR_SUST_CHR, -1 },
903 /* Simple macro for get_inscription() */
904 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
907 * Helper function for get_inscription()
909 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
915 while (fi_ptr->english)
917 if (have_flag(flgs, fi_ptr->flag) &&
918 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
920 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
922 ADD_INSC(fi_ptr->english);
932 * Special variation of have_flag for auto-inscription
934 static bool have_flag_of(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE])
936 while (fi_ptr->english)
938 if (have_flag(flgs, fi_ptr->flag) &&
939 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
947 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
949 char *prev_ptr = ptr;
950 u32b flgs[TR_FLAG_SIZE];
952 /* Extract the flags */
953 object_flags(o_ptr, flgs);
956 /* Remove obvious flags */
959 object_kind *k_ptr = &k_info[o_ptr->k_idx];
963 for (j = 0; j < TR_FLAG_SIZE; j++)
964 flgs[j] &= ~k_ptr->flags[j];
966 if (object_is_fixed_artifact(o_ptr))
968 artifact_type *a_ptr = &a_info[o_ptr->name1];
970 for (j = 0; j < TR_FLAG_SIZE; j++)
971 flgs[j] &= ~a_ptr->flags[j];
974 if (object_is_ego(o_ptr))
976 ego_item_type *e_ptr = &e_info[o_ptr->name2];
978 for (j = 0; j < TR_FLAG_SIZE; j++)
979 flgs[j] &= ~e_ptr->flags[j];
985 if (have_flag_of(flag_insc_plus, flgs))
990 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
993 if (have_flag_of(flag_insc_immune, flgs))
995 if (!kanji && ptr != prev_ptr)
1002 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
1005 if (have_flag_of(flag_insc_resistance, flgs))
1009 else if (ptr != prev_ptr)
1015 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1018 if (have_flag_of(flag_insc_misc, flgs))
1020 if (ptr != prev_ptr)
1026 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1029 if (have_flag_of(flag_insc_aura, flgs))
1033 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1036 if (have_flag_of(flag_insc_brand, flgs))
1038 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1041 if (have_flag_of(flag_insc_kill, flgs))
1043 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1046 if (have_flag_of(flag_insc_slay, flgs))
1048 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1053 if (have_flag_of(flag_insc_esp1, flgs) ||
1054 have_flag_of(flag_insc_esp2, flgs))
1056 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1057 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1061 if (have_flag_of(flag_insc_esp1, flgs))
1063 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1064 if (have_flag_of(flag_insc_esp2, flgs))
1066 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1070 if (have_flag_of(flag_insc_sust, flgs))
1074 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1083 * Get object inscription with auto inscription of object flags.
1085 static void get_inscription(char *buff, object_type *o_ptr)
1087 cptr insc = quark_str(o_ptr->inscription);
1090 /* Not fully identified */
1091 if (!(o_ptr->ident & IDENT_MENTAL))
1093 /* Copy until end of line or '#' */
1096 if (*insc == '#') break;
1098 if (iskanji(*insc)) *buff++ = *insc++;
1108 for (; *insc; insc++)
1110 /* Ignore fake artifact inscription */
1111 if (*insc == '#') break;
1113 /* {%} will be automatically converted */
1114 else if ('%' == *insc)
1120 /* check for too long inscription */
1121 if (ptr >= buff + MAX_NLEN) continue;
1134 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1144 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1159 * Creates a description of the item "o_ptr", and stores it in "out_val".
1161 * One can choose the "verbosity" of the description, including whether
1162 * or not the "number" of items should be described, and how much detail
1163 * should be used when describing the item.
1165 * The given "buf" must be MAX_NLEN chars long to hold the longest possible
1166 * description, which can get pretty long, including incriptions, such as:
1167 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".
1168 * Note that the inscription will be clipped to keep the total description
1169 * under MAX_NLEN-1 chars (plus a terminator).
1171 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,
1172 * portable, versions of some common "sprintf()" commands.
1174 * Note that all ego-items (when known) append an "Ego-Item Name", unless
1175 * the item is also an artifact, which should NEVER happen.
1177 * Note that all artifacts (when known) append an "Artifact Name", so we
1178 * have special processing for "Specials" (artifact Lites, Rings, Amulets).
1179 * The "Specials" never use "modifiers" if they are "known", since they
1180 * have special "descriptions", such as "The Necklace of the Dwarves".
1182 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),
1183 * plus the artifact name, just like any other artifact, if known.
1185 * Special Ring's and Amulet's, if not "aware", use the same code as normal
1186 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or
1187 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,
1188 * they will append the artifact name, just like any artifact, if known.
1190 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.
1193 * OD_NAME_ONLY : The Cloak of Death
1194 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]
1195 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)
1196 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}
1198 * OD_OMIT_PREFIX : Forbidden numeric prefix
1199 * OD_NO_PLURAL : Forbidden use of plural
1200 * OD_STORE : Assume to be aware and known
1201 * OD_NO_FLAVOR : Allow to hidden flavor
1202 * OD_FORCE_FLAVOR : Get un-shuffled flavor name
1204 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1206 /* Extract object kind name */
1207 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1209 /* Extract default "base" string */
1210 cptr basenm = kindname;
1212 /* Assume no "modifier" string */
1221 bool show_weapon = FALSE;
1222 bool show_armour = FALSE;
1227 char p1 = '(', p2 = ')';
1228 char b1 = '[', b2 = ']';
1229 char c1 = '{', c2 = '}';
1231 char tmp_val[MAX_NLEN+160];
1232 char tmp_val2[MAX_NLEN+10];
1233 char fake_insc_buf[30];
1235 u32b flgs[TR_FLAG_SIZE];
1237 object_type *bow_ptr;
1239 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1240 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1242 /* Extract some flags */
1243 object_flags(o_ptr, flgs);
1245 /* See if the object is "aware" */
1246 if (object_is_aware(o_ptr)) aware = TRUE;
1248 /* See if the object is "known" */
1249 if (object_is_known(o_ptr)) known = TRUE;
1251 /* Allow flavors to be hidden when aware */
1252 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1254 /* Object is in the inventory of a store or spoiler */
1255 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1257 /* Don't show flavors */
1260 /* Pretend known and aware */
1265 /* Force to be flavor name only */
1266 if (mode & OD_FORCE_FLAVOR)
1272 /* Cancel shuffling */
1273 flavor_k_ptr = k_ptr;
1276 /* Analyze the object */
1277 switch (o_ptr->tval)
1279 /* Some objects are easy to describe */
1293 monster_race *r_ptr = &r_info[o_ptr->pval];
1302 modstr = " (empty)";
1308 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1311 cptr t = r_name + r_ptr->name;
1313 if (!(r_ptr->flags1 & RF1_UNIQUE))
1315 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1321 sprintf(tmp_val2, "(%s)", t);
1331 /* Figurines/Statues */
1335 monster_race *r_ptr = &r_info[o_ptr->pval];
1338 modstr = r_name + r_ptr->name;
1340 cptr t = r_name + r_ptr->name;
1342 if (!(r_ptr->flags1 & RF1_UNIQUE))
1344 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1361 monster_race *r_ptr = &r_info[o_ptr->pval];
1363 modstr = r_name + r_ptr->name;
1368 if (r_ptr->flags1 & RF1_UNIQUE)
1369 basenm = "& % of #";
1377 /* Missiles/ Bows/ Weapons */
1406 /* Lites (including a few "Specials") */
1412 /* Amulets (including a few "Specials") */
1415 /* Known artifacts */
1418 if (object_is_fixed_artifact(o_ptr)) break;
1419 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1422 /* Color the object */
1423 modstr = k_name + flavor_k_ptr->flavor_name;
1426 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1427 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1428 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1430 if (!flavor) basenm = "& Amulet~ of %";
1431 else if (aware) basenm = "& # Amulet~ of %";
1432 else basenm = "& # Amulet~";
1438 /* Rings (including a few "Specials") */
1441 /* Known artifacts */
1444 if (object_is_fixed_artifact(o_ptr)) break;
1445 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1448 /* Color the object */
1449 modstr = k_name + flavor_k_ptr->flavor_name;
1452 if (!flavor) basenm = "%¤Î»ØÎØ";
1453 else if (aware) basenm = "%¤Î#»ØÎØ";
1454 else basenm = "#»ØÎØ";
1456 if (!flavor) basenm = "& Ring~ of %";
1457 else if (aware) basenm = "& # Ring~ of %";
1458 else basenm = "& # Ring~";
1461 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1473 /* Color the object */
1474 modstr = k_name + flavor_k_ptr->flavor_name;
1477 if (!flavor) basenm = "%¤Î¾ó";
1478 else if (aware) basenm = "%¤Î#¾ó";
1479 else basenm = "#¾ó";
1481 if (!flavor) basenm = "& Staff~ of %";
1482 else if (aware) basenm = "& # Staff~ of %";
1483 else basenm = "& # Staff~";
1491 /* Color the object */
1492 modstr = k_name + flavor_k_ptr->flavor_name;
1495 if (!flavor) basenm = "%¤ÎËâË¡ËÀ";
1496 else if (aware) basenm = "%¤Î#ËâË¡ËÀ";
1497 else basenm = "#ËâË¡ËÀ";
1499 if (!flavor) basenm = "& Wand~ of %";
1500 else if (aware) basenm = "& # Wand~ of %";
1501 else basenm = "& # Wand~";
1509 /* Color the object */
1510 modstr = k_name + flavor_k_ptr->flavor_name;
1513 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1514 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1515 else basenm = "#¥í¥Ã¥É";
1517 if (!flavor) basenm = "& Rod~ of %";
1518 else if (aware) basenm = "& # Rod~ of %";
1519 else basenm = "& # Rod~";
1527 /* Color the object */
1528 modstr = k_name + flavor_k_ptr->flavor_name;
1531 if (!flavor) basenm = "%¤Î´¬Êª";
1532 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1533 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1535 if (!flavor) basenm = "& Scroll~ of %";
1536 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1537 else basenm = "& Scroll~ titled \"#\"";
1545 /* Color the object */
1546 modstr = k_name + flavor_k_ptr->flavor_name;
1549 if (!flavor) basenm = "%¤ÎÌô";
1550 else if (aware) basenm = "%¤Î#Ìô";
1551 else basenm = "#Ìô";
1553 if (!flavor) basenm = "& Potion~ of %";
1554 else if (aware) basenm = "& # Potion~ of %";
1555 else basenm = "& # Potion~";
1563 /* Ordinary food is "boring" */
1564 if (!k_ptr->flavor_name) break;
1566 /* Color the object */
1567 modstr = k_name + flavor_k_ptr->flavor_name;
1570 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1571 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1572 else basenm = "#¥¥Î¥³";
1574 if (!flavor) basenm = "& Mushroom~ of %";
1575 else if (aware) basenm = "& # Mushroom~ of %";
1576 else basenm = "& # Mushroom~";
1585 basenm = "ÍÓÈé»æ - %";
1587 basenm = "& Parchment~ - %";
1596 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1598 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1599 basenm = "& Book~ of Life Magic %";
1601 basenm = "& Life Spellbook~ %";
1607 case TV_SORCERY_BOOK:
1610 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1612 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1613 basenm = "& Book~ of Sorcery %";
1615 basenm = "& Sorcery Spellbook~ %";
1621 case TV_NATURE_BOOK:
1624 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1626 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1627 basenm = "& Book~ of Nature Magic %";
1629 basenm = "& Nature Spellbook~ %";
1638 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1640 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1641 basenm = "& Book~ of Chaos Magic %";
1643 basenm = "& Chaos Spellbook~ %";
1652 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1654 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1655 basenm = "& Book~ of Death Magic %";
1657 basenm = "& Death Spellbook~ %";
1666 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1668 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1669 basenm = "& Book~ of Trump Magic %";
1671 basenm = "& Trump Spellbook~ %";
1677 case TV_ARCANE_BOOK:
1680 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1682 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1683 basenm = "& Book~ of Arcane Magic %";
1685 basenm = "& Arcane Spellbook~ %";
1694 basenm = "¾¢¤ÎËâË¡½ñ%";
1696 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1697 basenm = "& Book~ of Craft Magic %";
1699 basenm = "& Craft Spellbook~ %";
1705 case TV_DAEMON_BOOK:
1708 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1710 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1711 basenm = "& Book~ of Daemon Magic %";
1713 basenm = "& Daemon Spellbook~ %";
1719 case TV_CRUSADE_BOOK:
1722 basenm = "Ç˼٤ÎËâË¡½ñ%";
1724 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1725 basenm = "& Book~ of Crusade Magic %";
1727 basenm = "& Crusade Spellbook~ %";
1738 basenm = "& Song Book~ %";
1744 case TV_HISSATSU_BOOK:
1747 basenm = "& Éð·Ý¤Î½ñ%";
1749 basenm = "Book~ of Kendo %";
1758 basenm = "¼ö½Ñ¤ÎËâË¡½ñ%";
1760 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1761 basenm = "& Book~ of Crusade Magic %";
1763 basenm = "& Crusade Spellbook~ %";
1769 /* Hack -- Gold/Gems */
1772 strcpy(buf, basenm);
1776 /* Used in the "inventory" routine */
1780 strcpy(buf, "(¤Ê¤·)");
1782 strcpy(buf, "(nothing)");
1789 /* Use full name from k_info or a_info */
1790 if (aware && have_flag(flgs, TR_FULL_NAME))
1792 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1793 else basenm = kindname;
1796 /* Start dumping the result */
1800 if (basenm[0] == '&')
1806 if (mode & OD_OMIT_PREFIX)
1810 else if (o_ptr->number > 1)
1812 t = object_desc_kosuu(t, o_ptr);
1813 t = object_desc_str(t, "¤Î ");
1816 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1817 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1821 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1822 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1827 /* The object "expects" a "number" */
1828 if (basenm[0] == '&')
1830 /* Skip the ampersand (and space) */
1834 if (mode & OD_OMIT_PREFIX)
1839 /* Hack -- None left */
1840 else if (o_ptr->number <= 0)
1842 t = object_desc_str(t, "no more ");
1845 /* Extract the number */
1846 else if (o_ptr->number > 1)
1848 t = object_desc_num(t, o_ptr->number);
1849 t = object_desc_chr(t, ' ');
1852 /* Hack -- The only one of its kind */
1853 else if ((known && object_is_artifact(o_ptr)) ||
1854 ((o_ptr->tval == TV_CORPSE) &&
1855 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1857 t = object_desc_str(t, "The ");
1867 case '#': vowel = is_a_vowel(modstr[0]); break;
1868 case '%': vowel = is_a_vowel(*kindname); break;
1869 default: vowel = is_a_vowel(*s); break;
1874 /* A single one, with a vowel */
1875 t = object_desc_str(t, "an ");
1879 /* A single one, without a vowel */
1880 t = object_desc_str(t, "a ");
1885 /* Hack -- objects that "never" take an article */
1892 if (mode & OD_OMIT_PREFIX)
1897 /* Hack -- all gone */
1898 else if (o_ptr->number <= 0)
1900 t = object_desc_str(t, "no more ");
1903 /* Prefix a number if required */
1904 else if (o_ptr->number > 1)
1906 t = object_desc_num(t, o_ptr->number);
1907 t = object_desc_chr(t, ' ');
1910 /* Hack -- The only one of its kind */
1911 else if (known && object_is_artifact(o_ptr))
1913 t = object_desc_str(t, "The ");
1916 /* Hack -- single items get no prefix */
1924 /* Paranoia -- skip illegal tildes */
1925 /* while (*s == '~') s++; */
1928 if (object_is_smith(o_ptr))
1930 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
1933 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
1936 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
1937 if (o_ptr->art_name)
1939 cptr temp = quark_str(o_ptr->art_name);
1941 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1942 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
1943 if (strncmp(temp, "of ", 3) == 0)
1945 t = object_desc_str(t, &temp[3]);
1946 t = object_desc_str(t, "¤Î");
1948 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
1949 (strncmp(temp, "¡Ô", 2) != 0) &&
1951 t = object_desc_str(t, temp);
1953 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
1954 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
1956 artifact_type *a_ptr = &a_info[o_ptr->name1];
1957 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1958 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
1960 t = object_desc_str(t, a_name + a_ptr->name);
1963 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
1964 else if (object_is_ego(o_ptr))
1966 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1967 t = object_desc_str(t, e_name + e_ptr->name);
1972 /* Copy the string */
1973 for (s0 = NULL; *s || s0; )
1975 /* The end of the flavour/kind string. */
1982 /* Begin to append the modifier (flavor) */
1983 else if ((*s == '#') && !s0)
1988 /* Paranoia -- Never append multiple modstrs */
1992 /* Begin to append the kind name */
1993 else if ((*s == '%') && !s0)
1998 /* Paranoia -- Never append multiple kindnames */
2006 /* Add a plural if needed */
2007 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
2011 /* XXX XXX XXX Mega-Hack */
2013 /* Hack -- "Cutlass-es" and "Torch-es" */
2014 if ((k == 's') || (k == 'h')) *t++ = 'e';
2036 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2039 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2040 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2041 if (o_ptr->art_name)
2045 strcpy(temp, quark_str(o_ptr->art_name));
2046 /* MEGA HACK by ita */
2047 if (strncmp(temp, "¡Ø", 2) == 0 ||
2048 strncmp(temp, "¡Ô", 2) == 0)
2049 t = object_desc_str(t, temp);
2050 else if (temp[0] == '\'')
2052 itemp = strlen(temp);
2053 temp[itemp - 1] = 0;
2054 t = object_desc_str(t, "¡Ø");
2055 t = object_desc_str(t, &temp[1]);
2056 t = object_desc_str(t, "¡Ù");
2059 else if (object_is_fixed_artifact(o_ptr))
2061 artifact_type *a_ptr = &a_info[o_ptr->name1];
2062 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2064 t = object_desc_str(t, a_name + a_ptr->name);
2067 else if (o_ptr->inscription)
2069 cptr str = quark_str(o_ptr->inscription);
2078 if (*str == '#') break;
2084 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2086 /* Add the false name */
2087 t = object_desc_str(t,"¡Ø");
2088 t = object_desc_str(t, &str[1]);
2089 t = object_desc_str(t,"¡Ù");
2094 if (object_is_smith(o_ptr))
2096 t = object_desc_str(t,format(" of %s the Smith",player_name));
2099 /* Hack -- Append "Artifact" or "Special" names */
2100 if (known && !have_flag(flgs, TR_FULL_NAME))
2102 /* Is it a new random artifact ? */
2103 if (o_ptr->art_name)
2105 t = object_desc_chr(t, ' ');
2106 t = object_desc_str(t, quark_str(o_ptr->art_name));
2109 /* Grab any artifact name */
2110 else if (object_is_fixed_artifact(o_ptr))
2112 artifact_type *a_ptr = &a_info[o_ptr->name1];
2114 t = object_desc_chr(t, ' ');
2115 t = object_desc_str(t, a_name + a_ptr->name);
2118 /* Grab any ego-item name */
2121 if (object_is_ego(o_ptr))
2123 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2125 t = object_desc_chr(t, ' ');
2126 t = object_desc_str(t, e_name + e_ptr->name);
2129 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2132 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2134 /* Add the false name */
2135 t = object_desc_chr(t, ' ');
2136 t = object_desc_str(t, &str[1]);
2143 /* No more details wanted */
2144 if (mode & OD_NAME_ONLY) goto object_desc_done;
2146 /* Hack -- Chests must be described in detail */
2147 if (o_ptr->tval == TV_CHEST)
2149 /* Not searched yet */
2155 /* May be "empty" */
2156 else if (!o_ptr->pval)
2159 t = object_desc_str(t, "(¶õ)");
2161 t = object_desc_str(t, " (empty)");
2165 /* May be "disarmed" */
2166 else if (o_ptr->pval < 0)
2168 if (chest_traps[0 - o_ptr->pval])
2171 t = object_desc_str(t, "(²ò½üºÑ)");
2173 t = object_desc_str(t, " (disarmed)");
2179 t = object_desc_str(t, "(Èó»Ü¾û)");
2181 t = object_desc_str(t, " (unlocked)");
2186 /* Describe the traps, if any */
2189 /* Describe the traps */
2190 switch (chest_traps[o_ptr->pval])
2195 t = object_desc_str(t, "(»Ü¾û)");
2197 t = object_desc_str(t, " (Locked)");
2201 case CHEST_LOSE_STR:
2204 t = object_desc_str(t, "(ÆÇ¿Ë)");
2206 t = object_desc_str(t, " (Poison Needle)");
2210 case CHEST_LOSE_CON:
2213 t = object_desc_str(t, "(ÆÇ¿Ë)");
2215 t = object_desc_str(t, " (Poison Needle)");
2222 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2224 t = object_desc_str(t, " (Gas Trap)");
2228 case CHEST_PARALYZE:
2231 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2233 t = object_desc_str(t, " (Gas Trap)");
2240 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2242 t = object_desc_str(t, " (Explosion Device)");
2247 case CHEST_BIRD_STORM:
2248 case CHEST_E_SUMMON:
2249 case CHEST_H_SUMMON:
2252 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2254 t = object_desc_str(t, " (Summoning Runes)");
2258 case CHEST_RUNES_OF_EVIL:
2261 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2263 t = object_desc_str(t, " (Gleaming Black Runes)");
2270 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2272 t = object_desc_str(t, " (Alarm)");
2279 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2281 t = object_desc_str(t, " (Multiple Traps)");
2290 /* Display the item like a weapon */
2291 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2293 /* Display the item like a weapon */
2294 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2297 /* Display the item like a weapon */
2298 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2300 /* Display the item like armour */
2301 if (o_ptr->ac) show_armour = TRUE;
2304 /* Dump base weapon info */
2305 switch (o_ptr->tval)
2307 /* Missiles and Weapons */
2316 /* In Vault Quest, hide the dice of target weapon. */
2317 if (!known && p_ptr->inside_quest)
2319 int a_idx = quest[p_ptr->inside_quest].k_idx;
2322 artifact_type *a_ptr = &a_info[a_idx];
2323 if (!(a_ptr->gen_flags & TRG_INSTA_ART))
2325 if((o_ptr->tval == a_ptr->tval) && (o_ptr->sval == a_ptr->sval))
2333 /* Append a "damage" string */
2334 t = object_desc_chr(t, ' ');
2335 t = object_desc_chr(t, p1);
2336 t = object_desc_num(t, o_ptr->dd);
2337 t = object_desc_chr(t, 'd');
2338 t = object_desc_num(t, o_ptr->ds);
2339 t = object_desc_chr(t, p2);
2345 /* Bows get a special "damage string" */
2348 /* Mega-Hack -- Extract the "base power" */
2349 power = bow_tmul(o_ptr->sval);
2351 /* Apply the "Extra Might" flag */
2352 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2354 /* Append a special "damage" string */
2355 t = object_desc_chr(t, ' ');
2356 t = object_desc_chr(t, p1);
2357 t = object_desc_chr(t, 'x');
2358 t = object_desc_num(t, power);
2359 t = object_desc_chr(t, p2);
2366 /* Add the weapon bonuses */
2369 /* Show the tohit/todam on request */
2372 t = object_desc_chr(t, ' ');
2373 t = object_desc_chr(t, p1);
2374 t = object_desc_int(t, o_ptr->to_h);
2375 t = object_desc_chr(t, ',');
2376 t = object_desc_int(t, o_ptr->to_d);
2377 t = object_desc_chr(t, p2);
2380 /* Show the tohit if needed */
2381 else if (o_ptr->to_h)
2383 t = object_desc_chr(t, ' ');
2384 t = object_desc_chr(t, p1);
2385 t = object_desc_int(t, o_ptr->to_h);
2386 t = object_desc_chr(t, p2);
2389 /* Show the todam if needed */
2390 else if (o_ptr->to_d)
2392 t = object_desc_chr(t, ' ');
2393 t = object_desc_chr(t, p1);
2394 t = object_desc_int(t, o_ptr->to_d);
2395 t = object_desc_chr(t, p2);
2399 bow_ptr = &inventory[INVEN_BOW];
2401 /* If have a firing weapon + ammo matches bow */
2402 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2404 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2405 int tmul = bow_tmul(bow_ptr->sval);
2406 s16b energy_fire = bow_energy(bow_ptr->sval);
2408 /* See if the bow is "known" - then set damage bonus */
2409 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2411 /* Effect of ammo */
2412 if (known) avgdam += (o_ptr->to_d * 10);
2414 /* Get extra "power" from "extra might" */
2415 if (p_ptr->xtra_might) tmul++;
2417 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2419 /* Launcher multiplier */
2421 avgdam /= (100 * 10);
2423 /* Get extra damage from concentration */
2424 if (p_ptr->concent) avgdam = boost_concentration_damage(avgdam);
2426 if (avgdam < 0) avgdam = 0;
2428 /* Display (shot damage/ avg damage) */
2429 t = object_desc_chr(t, ' ');
2430 t = object_desc_chr(t, p1);
2431 t = object_desc_num(t, avgdam);
2432 t = object_desc_chr(t, '/');
2434 if (p_ptr->num_fire == 0)
2436 t = object_desc_chr(t, '0');
2440 /* Calc effects of energy */
2441 avgdam *= (p_ptr->num_fire * 100);
2442 avgdam /= energy_fire;
2443 t = object_desc_num(t, avgdam);
2446 t = object_desc_chr(t, p2);
2448 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2450 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2451 s16b energy_fire = 100 - p_ptr->lev;
2453 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2455 /* Display (shot damage/ avg damage) */
2456 t = object_desc_chr(t, ' ');
2457 t = object_desc_chr(t, p1);
2458 t = object_desc_num(t, avgdam);
2459 t = object_desc_chr(t, '/');
2461 /* Calc effects of energy */
2462 avgdam = 100 * avgdam / energy_fire;
2464 t = object_desc_num(t, avgdam);
2465 t = object_desc_chr(t, p2);
2468 /* Add the armor bonuses */
2471 /* Show the armor class info */
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, ',');
2478 t = object_desc_int(t, o_ptr->to_a);
2479 t = object_desc_chr(t, b2);
2482 /* No base armor, but does increase armor */
2483 else if (o_ptr->to_a)
2485 t = object_desc_chr(t, ' ');
2486 t = object_desc_chr(t, b1);
2487 t = object_desc_int(t, o_ptr->to_a);
2488 t = object_desc_chr(t, b2);
2492 /* Hack -- always show base armor */
2493 else if (show_armour)
2495 t = object_desc_chr(t, ' ');
2496 t = object_desc_chr(t, b1);
2497 t = object_desc_num(t, o_ptr->ac);
2498 t = object_desc_chr(t, b2);
2502 /* No more details wanted */
2503 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2506 if (known) /* Known item only */
2509 * Hack -- Wands and Staffs have charges. Make certain how many charges
2510 * a stack of staffs really has is clear. -LM-
2512 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2514 /* Dump " (N charges)" */
2515 t = object_desc_chr(t, ' ');
2516 t = object_desc_chr(t, p1);
2518 /* Clear explaination for staffs. */
2519 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2521 t = object_desc_num(t, o_ptr->number);
2522 t = object_desc_str(t, "x ");
2524 t = object_desc_num(t, o_ptr->pval);
2526 t = object_desc_str(t, "²óʬ");
2528 t = object_desc_str(t, " charge");
2529 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2532 t = object_desc_chr(t, p2);
2534 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2535 * be in any state of charge or discharge, this now includes a number. -LM-
2537 else if (o_ptr->tval == TV_ROD)
2539 /* Hack -- Dump " (# charging)" if relevant */
2542 /* Stacks of rods display an exact count of charging rods. */
2543 if (o_ptr->number > 1)
2546 if (k_ptr->pval == 0) k_ptr->pval = 1;
2548 /* Find out how many rods are charging, by dividing
2549 * current timeout by each rod's maximum timeout.
2550 * Ensure that any remainder is rounded up. Display
2551 * very discharged stacks as merely fully discharged.
2553 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2554 if (power > o_ptr->number) power = o_ptr->number;
2556 /* Display prettily. */
2557 t = object_desc_str(t, " (");
2558 t = object_desc_num(t, power);
2560 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2562 t = object_desc_str(t, " charging)");
2566 /* "one Rod of Perception (1 charging)" would look tacky. */
2570 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2572 t = object_desc_str(t, " (charging)");
2578 /* Dump "pval" flags for wearable items */
2579 if (have_pval_flags(flgs))
2581 /* Start the display */
2582 t = object_desc_chr(t, ' ');
2583 t = object_desc_chr(t, p1);
2585 /* Dump the "pval" itself */
2586 t = object_desc_int(t, o_ptr->pval);
2588 /* Do not display the "pval" flags */
2589 if (have_flag(flgs, TR_HIDE_TYPE))
2595 else if (have_flag(flgs, TR_SPEED))
2597 /* Dump " to speed" */
2599 t = object_desc_str(t, "²Ã®");
2601 t = object_desc_str(t, " to speed");
2606 else if (have_flag(flgs, TR_BLOWS))
2610 t = object_desc_str(t, "¹¶·â");
2612 t = object_desc_str(t, " attack");
2615 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2620 else if (have_flag(flgs, TR_STEALTH))
2622 /* Dump " to stealth" */
2624 t = object_desc_str(t, "±£Ì©");
2626 t = object_desc_str(t, " to stealth");
2631 else if (have_flag(flgs, TR_SEARCH))
2633 /* Dump " to searching" */
2635 t = object_desc_str(t, "õº÷");
2637 t = object_desc_str(t, " to searching");
2642 else if (have_flag(flgs, TR_INFRA))
2644 /* Dump " to infravision" */
2646 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2648 t = object_desc_str(t, " to infravision");
2652 /* Finish the display */
2653 t = object_desc_chr(t, p2);
2656 /* Hack -- Process Lanterns/Torches */
2657 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2659 /* Hack -- Turns of light for normal lites */
2661 t = object_desc_chr(t, '(');
2663 t = object_desc_str(t, " (with ");
2666 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2667 else t = object_desc_num(t, o_ptr->xtra4);
2669 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2671 t = object_desc_str(t, " turns of light)");
2675 /* Indicate charging objects, but not rods. */
2676 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2678 /* Hack -- Dump " (charging)" if relevant */
2680 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2682 t = object_desc_str(t, " (charging)");
2688 /* No more details wanted */
2689 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2692 /* Prepare real inscriptions in a buffer */
2695 /* Auto abbreviation inscribe */
2696 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2698 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2709 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2713 /* Use the standard inscription if available */
2714 if (o_ptr->inscription)
2718 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2720 /* Get inscription and convert {%} */
2721 get_inscription(buff, o_ptr);
2723 /* strcat with correct treating of kanji */
2724 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2728 /* No fake inscription yet */
2729 fake_insc_buf[0] = '\0';
2731 /* Use the game-generated "feeling" otherwise, if available */
2734 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2737 /* Note "cursed" if the item is known to be cursed */
2738 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2741 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2743 strcpy(fake_insc_buf, "cursed");
2747 /* Note "unidentified" if the item is unidentified */
2748 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2749 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2751 && !(o_ptr->ident & IDENT_SENSE))
2754 strcpy(fake_insc_buf, "̤´ÕÄê");
2756 strcpy(fake_insc_buf, "unidentified");
2760 /* Mega-Hack -- note empty wands/staffs */
2761 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2764 strcpy(fake_insc_buf, "¶õ");
2766 strcpy(fake_insc_buf, "empty");
2770 /* Note "tried" if the object has been tested unsuccessfully */
2771 else if (!aware && object_is_tried(o_ptr))
2774 strcpy(fake_insc_buf, "̤ȽÌÀ");
2776 strcpy(fake_insc_buf, "tried");
2780 /* Note the discount, if any */
2781 if (o_ptr->discount)
2783 /* Hidden by real inscription unless in a store */
2784 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2786 char discount_num_buf[4];
2788 /* Append to other fake inscriptions if any */
2789 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2791 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2792 strcat(fake_insc_buf, discount_num_buf);
2794 strcat(fake_insc_buf, "%°ú¤");
2796 strcat(fake_insc_buf, "% off");
2802 /* Append the inscription, if any */
2803 if (fake_insc_buf[0] || tmp_val2[0])
2805 /* Append the inscription */
2806 t = object_desc_chr(t, ' ');
2807 t = object_desc_chr(t, c1);
2809 /* Append fake inscriptions */
2810 if (fake_insc_buf[0])
2812 t = object_desc_str(t, fake_insc_buf);
2815 /* Append a separater */
2816 if (fake_insc_buf[0] && tmp_val2[0])
2818 t = object_desc_chr(t, ',');
2819 t = object_desc_chr(t, ' ');
2822 /* Append real inscriptions */
2825 t = object_desc_str(t, tmp_val2);
2828 t = object_desc_chr(t, c2);
2832 my_strcpy(buf, tmp_val, MAX_NLEN);