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:
52 /* All Food, Potions, Scrolls, Rods */
68 * Create a name from random parts.
70 void get_table_name_aux(char *out_string)
74 get_rnd_line("aname_j.txt", 1, Syllable);
75 strcpy(out_string, Syllable);
76 get_rnd_line("aname_j.txt", 2, Syllable);
77 strcat(out_string, Syllable);
79 #define MAX_SYLLABLES 164 /* Used with scrolls (see below) */
81 static cptr syllables[MAX_SYLLABLES] = {
82 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
83 "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
84 "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
85 "byt", "comp", "con", "cos", "cre", "dalf", "dan",
86 "den", "der", "doe", "dok", "eep", "el", "eng", "er", "ere", "erk",
87 "esh", "evs", "fa", "fid", "flit", "for", "fri", "fu", "gan",
88 "gar", "glen", "gop", "gre", "ha", "he", "hyd", "i",
89 "ing", "ion", "ip", "ish", "it", "ite", "iv", "jo",
90 "kho", "kli", "klis", "la", "lech", "man", "mar",
91 "me", "mi", "mic", "mik", "mon", "mung", "mur", "nag", "nej",
92 "nelg", "nep", "ner", "nes", "nis", "nih", "nin", "o",
93 "od", "ood", "org", "orn", "ox", "oxy", "pay", "pet",
94 "ple", "plu", "po", "pot", "prok", "re", "rea", "rhov",
95 "ri", "ro", "rog", "rok", "rol", "sa", "san", "sat",
96 "see", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
97 "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab",
98 "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
99 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly",
100 "vom", "wah", "wed", "werg", "wex", "whon", "wun", "x",
101 "yerg", "yp", "zun", "tri", "blaa", "jah", "bul", "on",
105 int testcounter = randint1(3) + 1;
107 strcpy(out_string, "");
109 if (randint1(3) == 2)
111 while (testcounter--)
112 strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
117 testcounter = randint1(2) + 1;
118 while (testcounter--)
120 (void)get_rnd_line("elvish.txt", 0, Syllable);
121 strcat(out_string, Syllable);
125 out_string[0] = toupper(out_string[1]);
127 out_string[16] = '\0';
133 * Create a name from random parts with quotes.
135 void get_table_name(char *out_string)
138 get_table_name_aux(buff);
141 sprintf(out_string, "¡Ø%s¡Ù", buff);
143 sprintf(out_string, "'%s'", buff);
149 * Make random Sindarin name
151 void get_table_sindarin_aux(char *out_string)
158 get_rnd_line("sname.txt", 1, Syllable);
160 strcpy(tmp, Syllable);
162 strcpy(out_string, Syllable);
165 get_rnd_line("sname.txt", 2, Syllable);
167 strcat(tmp, Syllable);
168 sindarin_to_kana(out_string, tmp);
170 strcat(out_string, Syllable);
176 * Make random Sindarin name with quotes
178 void get_table_sindarin(char *out_string)
181 get_table_sindarin_aux(buff);
184 sprintf(out_string, "¡Ø%s¡Ù", buff);
186 sprintf(out_string, "'%s'", buff);
192 * Shuffle flavor indices of a group of objects with given tval
194 static void shuffle_flavors(byte tval)
197 int k_idx_list_num = 0;
200 /* Allocate an array for a list of k_idx */
201 C_MAKE(k_idx_list, max_k_idx, s16b);
203 /* Search objects with given tval for shuffle */
204 for (i = 0; i < max_k_idx; i++)
206 object_kind *k_ptr = &k_info[i];
209 if (k_ptr->tval != tval) continue;
211 /* Paranoia -- Skip objects without flavor */
212 if (!k_ptr->flavor) continue;
214 /* Skip objects with a fixed flavor name */
215 if (have_flag(k_ptr->flags, TR_FIXED_FLAVOR)) continue;
218 k_idx_list[k_idx_list_num] = i;
220 /* Increase number of remembered indices */
224 /* Shuffle flavors */
225 for (i = 0; i < k_idx_list_num; i++)
227 object_kind *k1_ptr = &k_info[k_idx_list[i]];
228 object_kind *k2_ptr = &k_info[k_idx_list[randint0(k_idx_list_num)]];
230 /* Swap flavors of this pair */
231 s16b tmp = k1_ptr->flavor;
232 k1_ptr->flavor = k2_ptr->flavor;
233 k2_ptr->flavor = tmp;
238 * Prepare the "variable" part of the "k_info" array.
240 * The "color"/"metal"/"type" of an item is its "flavor".
241 * For the most part, flavors are assigned randomly each game.
243 * Initialize descriptions for the "colored" objects, including:
244 * Rings, Amulets, Staffs, Wands, Rods, Food, Potions, Scrolls.
246 * The first 4 entries for potions are fixed (Water, Apple Juice,
247 * Slime Mold Juice, Unused Potion).
249 * Scroll titles are always between 6 and 14 letters long. This is
250 * ensured because every title is composed of whole words, where every
251 * word is from 1 to 8 letters long (one or two syllables of 1 to 4
252 * letters each), and that no scroll is finished until it attempts to
253 * grow beyond 15 letters. The first time this can happen is when the
254 * current title has 6 letters and the new word has 8 letters, which
255 * would result in a 6 letter scroll title.
257 * Duplicate titles are avoided by requiring that no two scrolls share
258 * the same first four letters (not the most efficient method, and not
259 * the least efficient method, but it will always work).
261 * Hack -- make sure everything stays the same for each saved game
262 * This is accomplished by the use of a saved "random seed", as in
263 * "town_gen()". Since no other functions are called while the special
264 * seed is in effect, so this function is pretty "safe".
266 * Note that the "hacked seed" may provide an RNG with alternating parity!
268 void flavor_init(void)
272 /* Hack -- Use the "simple" RNG */
275 /* Hack -- Induce consistant flavors */
276 Rand_value = seed_flavor;
279 /* Initialize flavor index of each object by itself */
280 for (i = 0; i < max_k_idx; i++)
282 object_kind *k_ptr = &k_info[i];
284 /* Skip objects without flavor name */
285 if (!k_ptr->flavor_name) continue;
288 * Initialize flavor index to itself
289 * -> Shuffle it later
295 shuffle_flavors(TV_RING);
297 /* Shuffle Amulets */
298 shuffle_flavors(TV_AMULET);
301 shuffle_flavors(TV_STAFF);
304 shuffle_flavors(TV_WAND);
307 shuffle_flavors(TV_ROD);
309 /* Shuffle Mushrooms */
310 shuffle_flavors(TV_FOOD);
312 /* Shuffle Potions */
313 shuffle_flavors(TV_POTION);
315 /* Shuffle Scrolls */
316 shuffle_flavors(TV_SCROLL);
319 /* Hack -- Use the "complex" RNG */
322 /* Analyze every object */
323 for (i = 1; i < max_k_idx; i++)
325 object_kind *k_ptr = &k_info[i];
327 /* Skip "empty" objects */
328 if (!k_ptr->name) continue;
330 /* No flavor yields aware */
331 if (!k_ptr->flavor) k_ptr->aware = TRUE;
333 /* Check for "easily known" */
334 k_ptr->easy_know = object_easy_know(i);
340 * Print a char "c" into a string "t", as if by sprintf(t, "%c", c),
341 * and return a pointer to the terminator (t + 1).
343 static char *object_desc_chr(char *t, char c)
357 * Print a string "s" into a string "t", as if by strcpy(t, s),
358 * and return a pointer to the terminator.
360 static char *object_desc_str(char *t, cptr s)
362 /* Copy the string */
363 while (*s) *t++ = *s++;
375 * Print an unsigned number "n" into a string "t", as if by
376 * sprintf(t, "%u", n), and return a pointer to the terminator.
378 static char *object_desc_num(char *t, uint n)
382 /* Find "size" of "n" */
383 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
385 /* Dump each digit */
391 /* Remove the digit */
394 /* Process next digit */
410 * ÆüËܸì¤Î¸Ä¿ôɽ¼¨¥ë¡¼¥Á¥ó
411 *¡Êcmd1.c ¤ÇήÍѤ¹¤ë¤¿¤á¤Ë object_desc_japanese ¤«¤é°ÜÆ°¤·¤¿¡£¡Ë
414 char *object_desc_kosuu(char *t, object_type *o_ptr)
416 t = object_desc_num(t, o_ptr->number);
428 t = object_desc_str(t, "ËÜ");
433 t = object_desc_str(t, "´¬");
438 t = object_desc_str(t, "Éþ");
442 case TV_SORCERY_BOOK:
450 case TV_CRUSADE_BOOK:
452 case TV_HISSATSU_BOOK:
454 t = object_desc_str(t, "ºý");
462 t = object_desc_str(t, "Ãå");
469 t = object_desc_str(t, "¿¶");
474 t = object_desc_str(t, "");
479 t = object_desc_str(t, "Ëç");
482 /* ¿©¤Ù¤â¤Î by ita */
485 if(o_ptr->sval == SV_FOOD_JERKY)
487 t = object_desc_str(t, "ÀÚ¤ì");
493 if (o_ptr->number < 10)
495 t = object_desc_str(t, "¤Ä");
499 t = object_desc_str(t, "¸Ä");
509 * Print an signed number "v" into a string "t", as if by
510 * sprintf(t, "%+d", n), and return a pointer to the terminator.
511 * Note that we always print a sign, either "+" or "-".
513 static char *object_desc_int(char *t, sint v)
520 /* Take the absolute value */
523 /* Use a "minus" sign */
527 /* Positive (or zero) */
530 /* Use the actual number */
533 /* Use a "plus" sign */
537 /* Find "size" of "n" */
538 for (p = 1; n >= p * 10; p = p * 10) /* loop */;
540 /* Dump each digit */
546 /* Remove the digit */
549 /* Process next digit */
562 * Structs and tables for Auto Inscription for flags
565 typedef struct flag_insc_table
576 static flag_insc_table flag_insc_plus[] =
578 { "¹¶", "At", TR_BLOWS, -1 },
579 { "®", "Sp", TR_SPEED, -1 },
580 { "ÏÓ", "St", TR_STR, -1 },
581 { "ÃÎ", "In", TR_INT, -1 },
582 { "¸", "Wi", TR_WIS, -1 },
583 { "´ï", "Dx", TR_DEX, -1 },
584 { "ÂÑ", "Cn", TR_CON, -1 },
585 { "̥", "Ch", TR_CHR, -1 },
586 { "ƻ", "Md", TR_MAGIC_MASTERY, -1 },
587 { "±£", "Sl", TR_STEALTH, -1 },
588 { "õ", "Sr", TR_SEARCH, -1 },
589 { "ÀÖ", "If", TR_INFRA, -1 },
590 { "·¡", "Dg", TR_TUNNEL, -1 },
591 { NULL, NULL, 0, -1 }
594 static flag_insc_table flag_insc_immune[] =
596 { "»À", "Ac", TR_IM_ACID, -1 },
597 { "ÅÅ", "El", TR_IM_ELEC, -1 },
598 { "²Ð", "Fi", TR_IM_FIRE, -1 },
599 { "Îä", "Co", TR_IM_COLD, -1 },
600 { NULL, NULL, 0, -1 }
603 static flag_insc_table flag_insc_resistance[] =
605 { "»À", "Ac", TR_RES_ACID, TR_IM_ACID },
606 { "ÅÅ", "El", TR_RES_ELEC, TR_IM_ELEC },
607 { "²Ð", "Fi", TR_RES_FIRE, TR_IM_FIRE },
608 { "Îä", "Co", TR_RES_COLD, TR_IM_COLD },
609 { "ÆÇ", "Po", TR_RES_POIS, -1 },
610 { "Á®", "Li", TR_RES_LITE, -1 },
611 { "°Å", "Dk", TR_RES_DARK, -1 },
612 { "ÇË", "Sh", TR_RES_SHARDS, -1 },
613 { "ÌÕ", "Bl", TR_RES_BLIND, -1 },
614 { "Íð", "Cf", TR_RES_CONF, -1 },
615 { "¹ì", "So", TR_RES_SOUND, -1 },
616 { "¹ö", "Nt", TR_RES_NETHER, -1 },
617 { "°ø", "Nx", TR_RES_NEXUS, -1 },
618 { "ÆÙ", "Ca", TR_RES_CHAOS, -1 },
619 { "Îô", "Di", TR_RES_DISEN, -1 },
620 { "¶²", "Fe", TR_RES_FEAR, -1 },
621 { NULL, NULL, 0, -1 }
624 static flag_insc_table flag_insc_misc[] =
626 { "ËâÎÏ", "Ma", TR_DEC_MANA, -1 },
627 { "Åê", "Th", TR_THROW, -1 },
628 { "ȿ", "Rf", TR_REFLECT, -1 },
629 { "Ëã", "Fa", TR_FREE_ACT, -1 },
630 { "ȑ", "Si", TR_SEE_INVIS, -1 },
631 { "·Ð", "Hl", TR_HOLD_LIFE, -1 },
632 { "ÃÙ", "Sd", TR_SLOW_DIGEST, -1 },
633 { "³è", "Rg", TR_REGEN, -1 },
634 { "Éâ", "Lv", TR_LEVITATION, -1 },
635 { "ÌÀ", "Lu", TR_LITE, -1 },
636 { "·Ù", "Wr", TR_WARNING, -1 },
637 { "ÇÜ", "Xm", TR_XTRA_MIGHT, -1 },
638 { "¼Í", "Xs", TR_XTRA_SHOTS, -1 },
639 { "½Ö", "Te", TR_TELEPORT, -1 },
640 { "ÅÜ", "Ag", TR_AGGRAVATE, -1 },
641 { "½Ë", "Bs", TR_BLESSED, -1 },
642 { "´÷", "Ty", TR_TY_CURSE, -1 },
643 { NULL, NULL, 0, -1 }
646 static flag_insc_table flag_insc_aura[] =
648 { "±ê", "F", TR_SH_FIRE, -1 },
649 { "ÅÅ", "E", TR_SH_ELEC, -1 },
650 { "Îä", "C", TR_SH_COLD, -1 },
651 { "Ëâ", "M", TR_NO_MAGIC, -1 },
652 { "½Ö", "T", TR_NO_TELE, -1 },
653 { NULL, NULL, 0, -1 }
656 static flag_insc_table flag_insc_brand[] =
658 { "»À", "A", TR_BRAND_ACID, -1 },
659 { "ÅÅ", "E", TR_BRAND_ELEC, -1 },
660 { "¾Æ", "F", TR_BRAND_FIRE, -1 },
661 { "Åà", "Co", TR_BRAND_COLD, -1 },
662 { "ÆÇ", "P", TR_BRAND_POIS, -1 },
663 { "ÆÙ", "Ca", TR_CHAOTIC, -1 },
664 { "µÛ", "V", TR_VAMPIRIC, -1 },
665 { "¿Ì", "Q", TR_IMPACT, -1 },
666 { "ÀÚ", "S", TR_VORPAL, -1 },
667 { "Íý", "M", TR_FORCE_WEAPON, -1 },
668 { NULL, NULL, 0, -1 }
671 static flag_insc_table flag_insc_kill[] =
673 { "¼Ù", "*", TR_KILL_EVIL, -1 },
674 { "¿Í", "p", TR_KILL_HUMAN, -1 },
675 { "ζ", "D", TR_KILL_DRAGON, -1 },
676 { "¥ª", "o", TR_KILL_ORC, -1 },
677 { "¥È", "T", TR_KILL_TROLL, -1 },
678 { "µð", "P", TR_KILL_GIANT, -1 },
679 { "¥Ç", "U", TR_KILL_DEMON, -1 },
680 { "Ȉ", "L", TR_KILL_UNDEAD, -1 },
681 { "ư", "Z", TR_KILL_ANIMAL, -1 },
682 { NULL, NULL, 0, -1 }
685 static flag_insc_table flag_insc_slay[] =
687 { "¼Ù", "*", TR_SLAY_EVIL, TR_KILL_EVIL },
688 { "¿Í", "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
689 { "ε", "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
690 { "¥ª", "o", TR_SLAY_ORC, TR_KILL_ORC },
691 { "¥È", "T", TR_SLAY_TROLL, TR_KILL_TROLL },
692 { "µð", "P", TR_SLAY_GIANT, TR_KILL_GIANT },
693 { "¥Ç", "U", TR_SLAY_DEMON, TR_KILL_DEMON },
694 { "Ȉ", "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
695 { "ư", "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
696 { NULL, NULL, 0, -1 }
699 static flag_insc_table flag_insc_esp1[] =
701 { "´¶", "Tele", TR_TELEPATHY, -1 },
702 { "¼Ù", "Evil", TR_ESP_EVIL, -1 },
703 { "Á±", "Good", TR_ESP_GOOD, -1 },
704 { "̵", "Nolv", TR_ESP_NONLIVING, -1 },
705 { "¸Ä", "Uniq", TR_ESP_UNIQUE, -1 },
706 { NULL, NULL, 0, -1 }
709 static flag_insc_table flag_insc_esp2[] =
711 { "¿Í", "p", TR_ESP_HUMAN, -1 },
712 { "ε", "D", TR_ESP_DRAGON, -1 },
713 { "¥ª", "o", TR_ESP_ORC, -1 },
714 { "¥È", "T", TR_ESP_TROLL, -1 },
715 { "µð", "P", TR_ESP_GIANT, -1 },
716 { "¥Ç", "U", TR_ESP_DEMON, -1 },
717 { "Ȉ", "L", TR_ESP_UNDEAD, -1 },
718 { "ư", "Z", TR_ESP_ANIMAL, -1 },
719 { NULL, NULL, 0, -1 }
722 static flag_insc_table flag_insc_sust[] =
724 { "ÏÓ", "St", TR_SUST_STR, -1 },
725 { "ÃÎ", "In", TR_SUST_INT, -1 },
726 { "¸", "Wi", TR_SUST_WIS, -1 },
727 { "´ï", "Dx", TR_SUST_DEX, -1 },
728 { "ÂÑ", "Cn", TR_SUST_CON, -1 },
729 { "̥", "Ch", TR_SUST_CHR, -1 },
730 { NULL, NULL, 0, -1 }
734 static flag_insc_table flag_insc_plus[] =
736 { "At", TR_BLOWS, -1 },
737 { "Sp", TR_SPEED, -1 },
738 { "St", TR_STR, -1 },
739 { "In", TR_INT, -1 },
740 { "Wi", TR_WIS, -1 },
741 { "Dx", TR_DEX, -1 },
742 { "Cn", TR_CON, -1 },
743 { "Ch", TR_CHR, -1 },
744 { "Md", TR_MAGIC_MASTERY, -1 },
745 { "Sl", TR_STEALTH, -1 },
746 { "Sr", TR_SEARCH, -1 },
747 { "If", TR_INFRA, -1 },
748 { "Dg", TR_TUNNEL, -1 },
752 static flag_insc_table flag_insc_immune[] =
754 { "Ac", TR_IM_ACID, -1 },
755 { "El", TR_IM_ELEC, -1 },
756 { "Fi", TR_IM_FIRE, -1 },
757 { "Co", TR_IM_COLD, -1 },
761 static flag_insc_table flag_insc_resistance[] =
763 { "Ac", TR_RES_ACID, TR_IM_ACID },
764 { "El", TR_RES_ELEC, TR_IM_ELEC },
765 { "Fi", TR_RES_FIRE, TR_IM_FIRE },
766 { "Co", TR_RES_COLD, TR_IM_COLD },
767 { "Po", TR_RES_POIS, -1 },
768 { "Li", TR_RES_LITE, -1 },
769 { "Dk", TR_RES_DARK, -1 },
770 { "Sh", TR_RES_SHARDS, -1 },
771 { "Bl", TR_RES_BLIND, -1 },
772 { "Cf", TR_RES_CONF, -1 },
773 { "So", TR_RES_SOUND, -1 },
774 { "Nt", TR_RES_NETHER, -1 },
775 { "Nx", TR_RES_NEXUS, -1 },
776 { "Ca", TR_RES_CHAOS, -1 },
777 { "Di", TR_RES_DISEN, -1 },
778 { "Fe", TR_RES_FEAR, -1 },
782 static flag_insc_table flag_insc_misc[] =
784 { "Ma", TR_DEC_MANA, -1 },
785 { "Th", TR_THROW, -1 },
786 { "Rf", TR_REFLECT, -1 },
787 { "Fa", TR_FREE_ACT, -1 },
788 { "Si", TR_SEE_INVIS, -1 },
789 { "Hl", TR_HOLD_LIFE, -1 },
790 { "Sd", TR_SLOW_DIGEST, -1 },
791 { "Rg", TR_REGEN, -1 },
792 { "Lv", TR_LEVITATION, -1 },
793 { "Lu", TR_LITE, -1 },
794 { "Wr", TR_WARNING, -1 },
795 { "Xm", TR_XTRA_MIGHT, -1 },
796 { "Xs", TR_XTRA_SHOTS, -1 },
797 { "Te", TR_TELEPORT, -1 },
798 { "Ag", TR_AGGRAVATE, -1 },
799 { "Bs", TR_BLESSED, -1 },
800 { "Ty", TR_TY_CURSE, -1 },
804 static flag_insc_table flag_insc_aura[] =
806 { "F", TR_SH_FIRE, -1 },
807 { "E", TR_SH_ELEC, -1 },
808 { "C", TR_SH_COLD, -1 },
809 { "M", TR_NO_MAGIC, -1 },
810 { "T", TR_NO_TELE, -1 },
814 static flag_insc_table flag_insc_brand[] =
816 { "A", TR_BRAND_ACID, -1 },
817 { "E", TR_BRAND_ELEC, -1 },
818 { "F", TR_BRAND_FIRE, -1 },
819 { "Co", TR_BRAND_COLD, -1 },
820 { "P", TR_BRAND_POIS, -1 },
821 { "Ca", TR_CHAOTIC, -1 },
822 { "V", TR_VAMPIRIC, -1 },
823 { "Q", TR_IMPACT, -1 },
824 { "S", TR_VORPAL, -1 },
825 { "M", TR_FORCE_WEAPON, -1 },
829 static flag_insc_table flag_insc_kill[] =
831 { "*", TR_KILL_EVIL, -1 },
832 { "p", TR_KILL_HUMAN, -1 },
833 { "D", TR_KILL_DRAGON, -1 },
834 { "o", TR_KILL_ORC, -1 },
835 { "T", TR_KILL_TROLL, -1 },
836 { "P", TR_KILL_GIANT, -1 },
837 { "U", TR_KILL_DEMON, -1 },
838 { "L", TR_KILL_UNDEAD, -1 },
839 { "Z", TR_KILL_ANIMAL, -1 },
843 static flag_insc_table flag_insc_slay[] =
845 { "*", TR_SLAY_EVIL, TR_KILL_EVIL },
846 { "p", TR_SLAY_HUMAN, TR_KILL_HUMAN },
847 { "D", TR_SLAY_DRAGON, TR_KILL_DRAGON },
848 { "o", TR_SLAY_ORC, TR_KILL_ORC },
849 { "T", TR_SLAY_TROLL, TR_KILL_TROLL },
850 { "P", TR_SLAY_GIANT, TR_KILL_GIANT },
851 { "U", TR_SLAY_DEMON, TR_KILL_DEMON },
852 { "L", TR_SLAY_UNDEAD, TR_KILL_UNDEAD },
853 { "Z", TR_SLAY_ANIMAL, TR_KILL_ANIMAL },
857 static flag_insc_table flag_insc_esp1[] =
859 { "Tele", TR_TELEPATHY, -1 },
860 { "Evil", TR_ESP_EVIL, -1 },
861 { "Good", TR_ESP_GOOD, -1 },
862 { "Nolv", TR_ESP_NONLIVING, -1 },
863 { "Uniq", TR_ESP_UNIQUE, -1 },
867 static flag_insc_table flag_insc_esp2[] =
869 { "p", TR_ESP_HUMAN, -1 },
870 { "D", TR_ESP_DRAGON, -1 },
871 { "o", TR_ESP_ORC, -1 },
872 { "T", TR_ESP_TROLL, -1 },
873 { "P", TR_ESP_GIANT, -1 },
874 { "U", TR_ESP_DEMON, -1 },
875 { "L", TR_ESP_UNDEAD, -1 },
876 { "Z", TR_ESP_ANIMAL, -1 },
880 static flag_insc_table flag_insc_sust[] =
882 { "St", TR_SUST_STR, -1 },
883 { "In", TR_SUST_INT, -1 },
884 { "Wi", TR_SUST_WIS, -1 },
885 { "Dx", TR_SUST_DEX, -1 },
886 { "Cn", TR_SUST_CON, -1 },
887 { "Ch", TR_SUST_CHR, -1 },
892 /* Simple macro for get_inscription() */
893 #define ADD_INSC(STR) (void)(ptr = object_desc_str(ptr, (STR)))
896 * Helper function for get_inscription()
898 static char *inscribe_flags_aux(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE], bool kanji, char *ptr)
904 while (fi_ptr->english)
906 if (have_flag(flgs, fi_ptr->flag) &&
907 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
909 ADD_INSC(kanji ? fi_ptr->japanese : fi_ptr->english);
911 ADD_INSC(fi_ptr->english);
921 * Special variation of have_flag for auto-inscription
923 static bool have_flag_of(flag_insc_table *fi_ptr, u32b flgs[TR_FLAG_SIZE])
925 while (fi_ptr->english)
927 if (have_flag(flgs, fi_ptr->flag) &&
928 (fi_ptr->except_flag == -1 || !have_flag(flgs, fi_ptr->except_flag)))
936 static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji, bool all)
938 char *prev_ptr = ptr;
939 u32b flgs[TR_FLAG_SIZE];
941 /* Extract the flags */
942 object_flags(o_ptr, flgs);
945 /* Remove obvious flags */
948 object_kind *k_ptr = &k_info[o_ptr->k_idx];
952 for (j = 0; j < TR_FLAG_SIZE; j++)
953 flgs[j] &= ~k_ptr->flags[j];
955 if (object_is_fixed_artifact(o_ptr))
957 artifact_type *a_ptr = &a_info[o_ptr->name1];
959 for (j = 0; j < TR_FLAG_SIZE; j++)
960 flgs[j] &= ~a_ptr->flags[j];
963 if (object_is_ego(o_ptr))
965 ego_item_type *e_ptr = &e_info[o_ptr->name2];
967 for (j = 0; j < TR_FLAG_SIZE; j++)
968 flgs[j] &= ~e_ptr->flags[j];
974 if (have_flag_of(flag_insc_plus, flgs))
979 ptr = inscribe_flags_aux(flag_insc_plus, flgs, kanji, ptr);
982 if (have_flag_of(flag_insc_immune, flgs))
984 if (!kanji && ptr != prev_ptr)
991 ptr = inscribe_flags_aux(flag_insc_immune, flgs, kanji, ptr);
994 if (have_flag_of(flag_insc_resistance, flgs))
998 else if (ptr != prev_ptr)
1004 ptr = inscribe_flags_aux(flag_insc_resistance, flgs, kanji, ptr);
1007 if (have_flag_of(flag_insc_misc, flgs))
1009 if (ptr != prev_ptr)
1015 ptr = inscribe_flags_aux(flag_insc_misc, flgs, kanji, ptr);
1018 if (have_flag_of(flag_insc_aura, flgs))
1022 ptr = inscribe_flags_aux(flag_insc_aura, flgs, kanji, ptr);
1025 if (have_flag_of(flag_insc_brand, flgs))
1027 ptr = inscribe_flags_aux(flag_insc_brand, flgs, kanji, ptr);
1030 if (have_flag_of(flag_insc_kill, flgs))
1032 ptr = inscribe_flags_aux(flag_insc_kill, flgs, kanji, ptr);
1035 if (have_flag_of(flag_insc_slay, flgs))
1037 ptr = inscribe_flags_aux(flag_insc_slay, flgs, kanji, ptr);
1042 if (have_flag_of(flag_insc_esp1, flgs) ||
1043 have_flag_of(flag_insc_esp2, flgs))
1045 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1046 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1050 if (have_flag_of(flag_insc_esp1, flgs))
1052 ptr = inscribe_flags_aux(flag_insc_esp1, flgs, kanji, ptr);
1053 if (have_flag_of(flag_insc_esp2, flgs))
1055 ptr = inscribe_flags_aux(flag_insc_esp2, flgs, kanji, ptr);
1059 if (have_flag_of(flag_insc_sust, flgs))
1063 ptr = inscribe_flags_aux(flag_insc_sust, flgs, kanji, ptr);
1072 * Get object inscription with auto inscription of object flags.
1074 static void get_inscription(char *buff, object_type *o_ptr)
1076 cptr insc = quark_str(o_ptr->inscription);
1079 /* Not fully identified */
1080 if (!(o_ptr->ident & IDENT_MENTAL))
1082 /* Copy until end of line or '#' */
1085 if (*insc == '#') break;
1087 if (iskanji(*insc)) *buff++ = *insc++;
1097 for (; *insc; insc++)
1099 /* Ignore fake artifact inscription */
1100 if (*insc == '#') break;
1102 /* {%} will be automatically converted */
1103 else if ('%' == *insc)
1109 /* check for too long inscription */
1110 if (ptr >= buff + MAX_NLEN) continue;
1123 if ('a' == insc[1] && 'l' == insc[2] && 'l' == insc[3])
1133 ptr = get_ability_abbreviation(ptr, o_ptr, kanji, all);
1148 * Creates a description of the item "o_ptr", and stores it in "out_val".
1150 * One can choose the "verbosity" of the description, including whether
1151 * or not the "number" of items should be described, and how much detail
1152 * should be used when describing the item.
1154 * The given "buf" must be MAX_NLEN chars long to hold the longest possible
1155 * description, which can get pretty long, including incriptions, such as:
1156 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".
1157 * Note that the inscription will be clipped to keep the total description
1158 * under MAX_NLEN-1 chars (plus a terminator).
1160 * Note the use of "object_desc_num()" and "object_desc_int()" as hyper-efficient,
1161 * portable, versions of some common "sprintf()" commands.
1163 * Note that all ego-items (when known) append an "Ego-Item Name", unless
1164 * the item is also an artifact, which should NEVER happen.
1166 * Note that all artifacts (when known) append an "Artifact Name", so we
1167 * have special processing for "Specials" (artifact Lites, Rings, Amulets).
1168 * The "Specials" never use "modifiers" if they are "known", since they
1169 * have special "descriptions", such as "The Necklace of the Dwarves".
1171 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),
1172 * plus the artifact name, just like any other artifact, if known.
1174 * Special Ring's and Amulet's, if not "aware", use the same code as normal
1175 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or
1176 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,
1177 * they will append the artifact name, just like any artifact, if known.
1179 * Hack -- Display "The One Ring" as "a Plain Gold Ring" until aware.
1182 * OD_NAME_ONLY : The Cloak of Death
1183 * OD_NAME_AND_ENCHANT : The Cloak of Death [1,+3]
1184 * OD_OMIT_INSCRIPTION : The Cloak of Death [1,+3] (+2 to Stealth)
1185 * 0 : The Cloak of Death [1,+3] (+2 to Stealth) {nifty}
1187 * OD_OMIT_PREFIX : Forbidden numeric prefix
1188 * OD_NO_PLURAL : Forbidden use of plural
1189 * OD_STORE : Assume to be aware and known
1190 * OD_NO_FLAVOR : Allow to hidden flavor
1191 * OD_FORCE_FLAVOR : Get un-shuffled flavor name
1193 void object_desc(char *buf, object_type *o_ptr, u32b mode)
1195 /* Extract object kind name */
1196 cptr kindname = k_name + k_info[o_ptr->k_idx].name;
1198 /* Extract default "base" string */
1199 cptr basenm = kindname;
1201 /* Assume no "modifier" string */
1210 bool show_weapon = FALSE;
1211 bool show_armour = FALSE;
1216 char p1 = '(', p2 = ')';
1217 char b1 = '[', b2 = ']';
1218 char c1 = '{', c2 = '}';
1220 char tmp_val[MAX_NLEN+160];
1221 char tmp_val2[MAX_NLEN+10];
1222 char fake_insc_buf[30];
1224 u32b flgs[TR_FLAG_SIZE];
1226 object_type *bow_ptr;
1228 object_kind *k_ptr = &k_info[o_ptr->k_idx];
1229 object_kind *flavor_k_ptr = &k_info[k_ptr->flavor];
1231 /* Extract some flags */
1232 object_flags(o_ptr, flgs);
1234 /* See if the object is "aware" */
1235 if (object_is_aware(o_ptr)) aware = TRUE;
1237 /* See if the object is "known" */
1238 if (object_is_known(o_ptr)) known = TRUE;
1240 /* Allow flavors to be hidden when aware */
1241 if (aware && ((mode & OD_NO_FLAVOR) || plain_descriptions)) flavor = FALSE;
1243 /* Object is in the inventory of a store or spoiler */
1244 if ((mode & OD_STORE) || (o_ptr->ident & IDENT_STORE))
1246 /* Don't show flavors */
1249 /* Pretend known and aware */
1254 /* Force to be flavor name only */
1255 if (mode & OD_FORCE_FLAVOR)
1261 /* Cancel shuffling */
1262 flavor_k_ptr = k_ptr;
1265 /* Analyze the object */
1266 switch (o_ptr->tval)
1268 /* Some objects are easy to describe */
1282 monster_race *r_ptr = &r_info[o_ptr->pval];
1291 modstr = " (empty)";
1297 sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
1300 cptr t = r_name + r_ptr->name;
1302 if (!(r_ptr->flags1 & RF1_UNIQUE))
1304 sprintf(tmp_val2, " (%s%s)", (is_a_vowel(*t) ? "an " : "a "), t);
1310 sprintf(tmp_val2, "(%s)", t);
1320 /* Figurines/Statues */
1324 monster_race *r_ptr = &r_info[o_ptr->pval];
1327 modstr = r_name + r_ptr->name;
1329 cptr t = r_name + r_ptr->name;
1331 if (!(r_ptr->flags1 & RF1_UNIQUE))
1333 sprintf(tmp_val2, "%s%s", (is_a_vowel(*t) ? "an " : "a "), t);
1350 monster_race *r_ptr = &r_info[o_ptr->pval];
1352 modstr = r_name + r_ptr->name;
1357 if (r_ptr->flags1 & RF1_UNIQUE)
1358 basenm = "& % of #";
1366 /* Missiles/ Bows/ Weapons */
1395 /* Lites (including a few "Specials") */
1401 /* Amulets (including a few "Specials") */
1404 /* Known artifacts */
1407 if (object_is_fixed_artifact(o_ptr)) break;
1408 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1411 /* Color the object */
1412 modstr = k_name + flavor_k_ptr->flavor_name;
1415 if (!flavor) basenm = "%¤Î¥¢¥ß¥å¥ì¥Ã¥È";
1416 else if (aware) basenm = "%¤Î#¥¢¥ß¥å¥ì¥Ã¥È";
1417 else basenm = "#¥¢¥ß¥å¥ì¥Ã¥È";
1419 if (!flavor) basenm = "& Amulet~ of %";
1420 else if (aware) basenm = "& # Amulet~ of %";
1421 else basenm = "& # Amulet~";
1427 /* Rings (including a few "Specials") */
1430 /* Known artifacts */
1433 if (object_is_fixed_artifact(o_ptr)) break;
1434 if (k_ptr->gen_flags & TRG_INSTA_ART) break;
1437 /* Color the object */
1438 modstr = k_name + flavor_k_ptr->flavor_name;
1441 if (!flavor) basenm = "%¤Î»ØÎØ";
1442 else if (aware) basenm = "%¤Î#»ØÎØ";
1443 else basenm = "#»ØÎØ";
1445 if (!flavor) basenm = "& Ring~ of %";
1446 else if (aware) basenm = "& # Ring~ of %";
1447 else basenm = "& # Ring~";
1450 if (!k_ptr->to_h && !k_ptr->to_d && (o_ptr->to_h || o_ptr->to_d)) show_weapon = TRUE;
1462 /* Color the object */
1463 modstr = k_name + flavor_k_ptr->flavor_name;
1466 if (!flavor) basenm = "%¤Î¾ó";
1467 else if (aware) basenm = "%¤Î#¾ó";
1468 else basenm = "#¾ó";
1470 if (!flavor) basenm = "& Staff~ of %";
1471 else if (aware) basenm = "& # Staff~ of %";
1472 else basenm = "& # Staff~";
1480 /* Color the object */
1481 modstr = k_name + flavor_k_ptr->flavor_name;
1484 if (!flavor) basenm = "%¤ÎËâË¡ËÀ";
1485 else if (aware) basenm = "%¤Î#ËâË¡ËÀ";
1486 else basenm = "#ËâË¡ËÀ";
1488 if (!flavor) basenm = "& Wand~ of %";
1489 else if (aware) basenm = "& # Wand~ of %";
1490 else basenm = "& # Wand~";
1498 /* Color the object */
1499 modstr = k_name + flavor_k_ptr->flavor_name;
1502 if (!flavor) basenm = "%¤Î¥í¥Ã¥É";
1503 else if (aware) basenm = "%¤Î#¥í¥Ã¥É";
1504 else basenm = "#¥í¥Ã¥É";
1506 if (!flavor) basenm = "& Rod~ of %";
1507 else if (aware) basenm = "& # Rod~ of %";
1508 else basenm = "& # Rod~";
1516 /* Color the object */
1517 modstr = k_name + flavor_k_ptr->flavor_name;
1520 if (!flavor) basenm = "%¤Î´¬Êª";
1521 else if (aware) basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿%¤Î´¬Êª";
1522 else basenm = "¡Ö#¡×¤È½ñ¤«¤ì¤¿´¬Êª";
1524 if (!flavor) basenm = "& Scroll~ of %";
1525 else if (aware) basenm = "& Scroll~ titled \"#\" of %";
1526 else basenm = "& Scroll~ titled \"#\"";
1534 /* Color the object */
1535 modstr = k_name + flavor_k_ptr->flavor_name;
1538 if (!flavor) basenm = "%¤ÎÌô";
1539 else if (aware) basenm = "%¤Î#Ìô";
1540 else basenm = "#Ìô";
1542 if (!flavor) basenm = "& Potion~ of %";
1543 else if (aware) basenm = "& # Potion~ of %";
1544 else basenm = "& # Potion~";
1552 /* Ordinary food is "boring" */
1553 if (!k_ptr->flavor_name) break;
1555 /* Color the object */
1556 modstr = k_name + flavor_k_ptr->flavor_name;
1559 if (!flavor) basenm = "%¤Î¥¥Î¥³";
1560 else if (aware) basenm = "%¤Î#¥¥Î¥³";
1561 else basenm = "#¥¥Î¥³";
1563 if (!flavor) basenm = "& Mushroom~ of %";
1564 else if (aware) basenm = "& # Mushroom~ of %";
1565 else basenm = "& # Mushroom~";
1574 basenm = "ÍÓÈé»æ - %";
1576 basenm = "& Parchment~ - %";
1585 basenm = "À¸Ì¿¤ÎËâË¡½ñ%";
1587 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1588 basenm = "& Book~ of Life Magic %";
1590 basenm = "& Life Spellbook~ %";
1596 case TV_SORCERY_BOOK:
1599 basenm = "Àç½Ñ¤ÎËâË¡½ñ%";
1601 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1602 basenm = "& Book~ of Sorcery %";
1604 basenm = "& Sorcery Spellbook~ %";
1610 case TV_NATURE_BOOK:
1613 basenm = "¼«Á³¤ÎËâË¡½ñ%";
1615 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1616 basenm = "& Book~ of Nature Magic %";
1618 basenm = "& Nature Spellbook~ %";
1627 basenm = "¥«¥ª¥¹¤ÎËâË¡½ñ%";
1629 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1630 basenm = "& Book~ of Chaos Magic %";
1632 basenm = "& Chaos Spellbook~ %";
1641 basenm = "°Å¹õ¤ÎËâË¡½ñ%";
1643 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1644 basenm = "& Book~ of Death Magic %";
1646 basenm = "& Death Spellbook~ %";
1655 basenm = "¥È¥é¥ó¥×¤ÎËâË¡½ñ%";
1657 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1658 basenm = "& Book~ of Trump Magic %";
1660 basenm = "& Trump Spellbook~ %";
1666 case TV_ARCANE_BOOK:
1669 basenm = "Èë½Ñ¤ÎËâË¡½ñ%";
1671 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1672 basenm = "& Book~ of Arcane Magic %";
1674 basenm = "& Arcane Spellbook~ %";
1683 basenm = "¾¢¤ÎËâË¡½ñ%";
1685 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1686 basenm = "& Book~ of Craft Magic %";
1688 basenm = "& Craft Spellbook~ %";
1694 case TV_DAEMON_BOOK:
1697 basenm = "°Ëâ¤ÎËâË¡½ñ%";
1699 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1700 basenm = "& Book~ of Daemon Magic %";
1702 basenm = "& Daemon Spellbook~ %";
1708 case TV_CRUSADE_BOOK:
1711 basenm = "Ç˼٤ÎËâË¡½ñ%";
1713 if (mp_ptr->spell_book == TV_LIFE_BOOK)
1714 basenm = "& Book~ of Crusade Magic %";
1716 basenm = "& Crusade Spellbook~ %";
1727 basenm = "& Song Book~ %";
1733 case TV_HISSATSU_BOOK:
1736 basenm = "& Éð·Ý¤Î½ñ%";
1738 basenm = "Book~ of Kendo %";
1744 /* Hack -- Gold/Gems */
1747 strcpy(buf, basenm);
1751 /* Used in the "inventory" routine */
1755 strcpy(buf, "(¤Ê¤·)");
1757 strcpy(buf, "(nothing)");
1764 /* Use full name from k_info or a_info */
1765 if (aware && have_flag(flgs, TR_FULL_NAME))
1767 if (known && o_ptr->name1) basenm = a_name + a_info[o_ptr->name1].name;
1768 else basenm = kindname;
1771 /* Start dumping the result */
1775 if (basenm[0] == '&')
1781 if (mode & OD_OMIT_PREFIX)
1785 else if (o_ptr->number > 1)
1787 t = object_desc_kosuu(t, o_ptr);
1788 t = object_desc_str(t, "¤Î ");
1791 /* ±Ñ¸ì¤Î¾ì¹ç¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ï The ¤¬ÉÕ¤¯¤Î¤Çʬ¤«¤ë¤¬
1792 * ÆüËܸì¤Ç¤Ïʬ¤«¤é¤Ê¤¤¤Î¤Ç¥Þ¡¼¥¯¤ò¤Ä¤±¤ë
1796 if (object_is_fixed_artifact(o_ptr)) t = object_desc_str(t, "¡ú");
1797 else if (o_ptr->art_name) t = object_desc_str(t, "¡ù");
1802 /* The object "expects" a "number" */
1803 if (basenm[0] == '&')
1805 /* Skip the ampersand (and space) */
1809 if (mode & OD_OMIT_PREFIX)
1814 /* Hack -- None left */
1815 else if (o_ptr->number <= 0)
1817 t = object_desc_str(t, "no more ");
1820 /* Extract the number */
1821 else if (o_ptr->number > 1)
1823 t = object_desc_num(t, o_ptr->number);
1824 t = object_desc_chr(t, ' ');
1827 /* Hack -- The only one of its kind */
1828 else if ((known && object_is_artifact(o_ptr)) ||
1829 ((o_ptr->tval == TV_CORPSE) &&
1830 (r_info[o_ptr->pval].flags1 & RF1_UNIQUE)))
1832 t = object_desc_str(t, "The ");
1842 case '#': vowel = is_a_vowel(modstr[0]); break;
1843 case '%': vowel = is_a_vowel(*kindname); break;
1844 default: vowel = is_a_vowel(*s); break;
1849 /* A single one, with a vowel */
1850 t = object_desc_str(t, "an ");
1854 /* A single one, without a vowel */
1855 t = object_desc_str(t, "a ");
1860 /* Hack -- objects that "never" take an article */
1867 if (mode & OD_OMIT_PREFIX)
1872 /* Hack -- all gone */
1873 else if (o_ptr->number <= 0)
1875 t = object_desc_str(t, "no more ");
1878 /* Prefix a number if required */
1879 else if (o_ptr->number > 1)
1881 t = object_desc_num(t, o_ptr->number);
1882 t = object_desc_chr(t, ' ');
1885 /* Hack -- The only one of its kind */
1886 else if (known && object_is_artifact(o_ptr))
1888 t = object_desc_str(t, "The ");
1891 /* Hack -- single items get no prefix */
1899 /* Paranoia -- skip illegal tildes */
1900 /* while (*s == '~') s++; */
1903 if (object_is_smith(o_ptr))
1905 t = object_desc_str(t, format("ÃÃÌê»Õ%s¤Î", player_name));
1908 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¢Ì¾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Î̾Á°¤òÉղ乤ë */
1911 /* ¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È */
1912 if (o_ptr->art_name)
1914 cptr temp = quark_str(o_ptr->art_name);
1916 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1917 /* ±Ñ¸ìÈǤΥ»¡¼¥Ö¥Õ¥¡¥¤¥ë¤«¤éÍ褿 'of XXX' ¤Ï,¡ÖXXX¤Î¡×¤Èɽ¼¨¤¹¤ë */
1918 if (strncmp(temp, "of ", 3) == 0)
1920 t = object_desc_str(t, &temp[3]);
1921 t = object_desc_str(t, "¤Î");
1923 else if ((strncmp(temp, "¡Ø", 2) != 0) &&
1924 (strncmp(temp, "¡Ô", 2) != 0) &&
1926 t = object_desc_str(t, temp);
1928 /* ÅÁÀâ¤Î¥¢¥¤¥Æ¥à */
1929 else if (o_ptr->name1 && !have_flag(flgs, TR_FULL_NAME))
1931 artifact_type *a_ptr = &a_info[o_ptr->name1];
1932 /* '¡Ø' ¤«¤é»Ï¤Þ¤é¤Ê¤¤ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ½é¤ËÉղ乤ë */
1933 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) != 0)
1935 t = object_desc_str(t, a_name + a_ptr->name);
1938 /* ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à */
1939 else if (object_is_ego(o_ptr))
1941 ego_item_type *e_ptr = &e_info[o_ptr->name2];
1942 t = object_desc_str(t, e_name + e_ptr->name);
1947 /* Copy the string */
1948 for (s0 = NULL; *s || s0; )
1950 /* The end of the flavour/kind string. */
1957 /* Begin to append the modifier (flavor) */
1958 else if ((*s == '#') && !s0)
1963 /* Paranoia -- Never append multiple modstrs */
1967 /* Begin to append the kind name */
1968 else if ((*s == '%') && !s0)
1973 /* Paranoia -- Never append multiple kindnames */
1981 /* Add a plural if needed */
1982 if (!(mode & OD_NO_PLURAL) && (o_ptr->number != 1))
1986 /* XXX XXX XXX Mega-Hack */
1988 /* Hack -- "Cutlass-es" and "Torch-es" */
1989 if ((k == 's') || (k == 'h')) *t++ = 'e';
2011 /* '¡Ø'¤«¤é»Ï¤Þ¤ëÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Î̾Á°¤ÏºÇ¸å¤ËÉղ乤ë */
2014 /* ¥é¥ó¥À¥à¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î̾Á°¤Ï¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ËµÏ¿
2015 ¤µ¤ì¤ë¤Î¤Ç¡¢±Ñ¸ìÈǤÎ̾Á°¤â¤½¤ì¤é¤·¤¯ÊÑ´¹¤¹¤ë */
2016 if (o_ptr->art_name)
2020 strcpy(temp, quark_str(o_ptr->art_name));
2021 /* MEGA HACK by ita */
2022 if (strncmp(temp, "¡Ø", 2) == 0 ||
2023 strncmp(temp, "¡Ô", 2) == 0)
2024 t = object_desc_str(t, temp);
2025 else if (temp[0] == '\'')
2027 itemp = strlen(temp);
2028 temp[itemp - 1] = 0;
2029 t = object_desc_str(t, "¡Ø");
2030 t = object_desc_str(t, &temp[1]);
2031 t = object_desc_str(t, "¡Ù");
2034 else if (object_is_fixed_artifact(o_ptr))
2036 artifact_type *a_ptr = &a_info[o_ptr->name1];
2037 if (strncmp(a_name + a_ptr->name, "¡Ø", 2) == 0)
2039 t = object_desc_str(t, a_name + a_ptr->name);
2042 else if (o_ptr->inscription)
2044 cptr str = quark_str(o_ptr->inscription);
2053 if (*str == '#') break;
2059 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2061 /* Add the false name */
2062 t = object_desc_str(t,"¡Ø");
2063 t = object_desc_str(t, &str[1]);
2064 t = object_desc_str(t,"¡Ù");
2069 if (object_is_smith(o_ptr))
2071 t = object_desc_str(t,format(" of %s the Smith",player_name));
2074 /* Hack -- Append "Artifact" or "Special" names */
2075 if (known && !have_flag(flgs, TR_FULL_NAME))
2077 /* Is it a new random artifact ? */
2078 if (o_ptr->art_name)
2080 t = object_desc_chr(t, ' ');
2081 t = object_desc_str(t, quark_str(o_ptr->art_name));
2084 /* Grab any artifact name */
2085 else if (object_is_fixed_artifact(o_ptr))
2087 artifact_type *a_ptr = &a_info[o_ptr->name1];
2089 t = object_desc_chr(t, ' ');
2090 t = object_desc_str(t, a_name + a_ptr->name);
2093 /* Grab any ego-item name */
2096 if (object_is_ego(o_ptr))
2098 ego_item_type *e_ptr = &e_info[o_ptr->name2];
2100 t = object_desc_chr(t, ' ');
2101 t = object_desc_str(t, e_name + e_ptr->name);
2104 if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
2107 cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
2109 /* Add the false name */
2110 t = object_desc_chr(t, ' ');
2111 t = object_desc_str(t, &str[1]);
2118 /* No more details wanted */
2119 if (mode & OD_NAME_ONLY) goto object_desc_done;
2121 /* Hack -- Chests must be described in detail */
2122 if (o_ptr->tval == TV_CHEST)
2124 /* Not searched yet */
2130 /* May be "empty" */
2131 else if (!o_ptr->pval)
2134 t = object_desc_str(t, "(¶õ)");
2136 t = object_desc_str(t, " (empty)");
2140 /* May be "disarmed" */
2141 else if (o_ptr->pval < 0)
2143 if (chest_traps[0 - o_ptr->pval])
2146 t = object_desc_str(t, "(²ò½üºÑ)");
2148 t = object_desc_str(t, " (disarmed)");
2154 t = object_desc_str(t, "(Èó»Ü¾û)");
2156 t = object_desc_str(t, " (unlocked)");
2161 /* Describe the traps, if any */
2164 /* Describe the traps */
2165 switch (chest_traps[o_ptr->pval])
2170 t = object_desc_str(t, "(»Ü¾û)");
2172 t = object_desc_str(t, " (Locked)");
2176 case CHEST_LOSE_STR:
2179 t = object_desc_str(t, "(ÆÇ¿Ë)");
2181 t = object_desc_str(t, " (Poison Needle)");
2185 case CHEST_LOSE_CON:
2188 t = object_desc_str(t, "(ÆÇ¿Ë)");
2190 t = object_desc_str(t, " (Poison Needle)");
2197 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2199 t = object_desc_str(t, " (Gas Trap)");
2203 case CHEST_PARALYZE:
2206 t = object_desc_str(t, "(¥¬¥¹¡¦¥È¥é¥Ã¥×)");
2208 t = object_desc_str(t, " (Gas Trap)");
2215 t = object_desc_str(t, "(ÇúȯÁõÃÖ)");
2217 t = object_desc_str(t, " (Explosion Device)");
2222 case CHEST_BIRD_STORM:
2223 case CHEST_E_SUMMON:
2224 case CHEST_H_SUMMON:
2227 t = object_desc_str(t, "(¾¤´¤Î¥ë¡¼¥ó)");
2229 t = object_desc_str(t, " (Summoning Runes)");
2233 case CHEST_RUNES_OF_EVIL:
2236 t = object_desc_str(t, "(¼Ù°¤Ê¥ë¡¼¥ó)");
2238 t = object_desc_str(t, " (Gleaming Black Runes)");
2245 t = object_desc_str(t, "(·ÙÊóÁõÃÖ)");
2247 t = object_desc_str(t, " (Alarm)");
2254 t = object_desc_str(t, "(¥Þ¥ë¥Á¡¦¥È¥é¥Ã¥×)");
2256 t = object_desc_str(t, " (Multiple Traps)");
2265 /* Display the item like a weapon */
2266 if (have_flag(flgs, TR_SHOW_MODS)) show_weapon = TRUE;
2268 /* Display the item like a weapon */
2269 if (object_is_smith(o_ptr) && (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
2272 /* Display the item like a weapon */
2273 if (o_ptr->to_h && o_ptr->to_d) show_weapon = TRUE;
2275 /* Display the item like armour */
2276 if (o_ptr->ac) show_armour = TRUE;
2279 /* Dump base weapon info */
2280 switch (o_ptr->tval)
2282 /* Missiles and Weapons */
2291 /* Append a "damage" string */
2292 t = object_desc_chr(t, ' ');
2293 t = object_desc_chr(t, p1);
2294 t = object_desc_num(t, o_ptr->dd);
2295 t = object_desc_chr(t, 'd');
2296 t = object_desc_num(t, o_ptr->ds);
2297 t = object_desc_chr(t, p2);
2303 /* Bows get a special "damage string" */
2306 /* Mega-Hack -- Extract the "base power" */
2307 power = bow_tmul(o_ptr->sval);
2309 /* Apply the "Extra Might" flag */
2310 if (have_flag(flgs, TR_XTRA_MIGHT)) power++;
2312 /* Append a special "damage" string */
2313 t = object_desc_chr(t, ' ');
2314 t = object_desc_chr(t, p1);
2315 t = object_desc_chr(t, 'x');
2316 t = object_desc_num(t, power);
2317 t = object_desc_chr(t, p2);
2324 /* Add the weapon bonuses */
2327 /* Show the tohit/todam on request */
2330 t = object_desc_chr(t, ' ');
2331 t = object_desc_chr(t, p1);
2332 t = object_desc_int(t, o_ptr->to_h);
2333 t = object_desc_chr(t, ',');
2334 t = object_desc_int(t, o_ptr->to_d);
2335 t = object_desc_chr(t, p2);
2338 /* Show the tohit if needed */
2339 else if (o_ptr->to_h)
2341 t = object_desc_chr(t, ' ');
2342 t = object_desc_chr(t, p1);
2343 t = object_desc_int(t, o_ptr->to_h);
2344 t = object_desc_chr(t, p2);
2347 /* Show the todam if needed */
2348 else if (o_ptr->to_d)
2350 t = object_desc_chr(t, ' ');
2351 t = object_desc_chr(t, p1);
2352 t = object_desc_int(t, o_ptr->to_d);
2353 t = object_desc_chr(t, p2);
2357 bow_ptr = &inventory[INVEN_BOW];
2359 /* If have a firing weapon + ammo matches bow */
2360 if (bow_ptr->k_idx && (o_ptr->tval == p_ptr->tval_ammo))
2362 int avgdam = o_ptr->dd * (o_ptr->ds + 1) * 10 / 2;
2363 int tmul = bow_tmul(bow_ptr->sval);
2364 s16b energy_fire = bow_energy(bow_ptr->sval);
2366 /* See if the bow is "known" - then set damage bonus */
2367 if (object_is_known(bow_ptr)) avgdam += (bow_ptr->to_d * 10);
2369 /* Effect of ammo */
2370 if (known) avgdam += (o_ptr->to_d * 10);
2372 /* Get extra "power" from "extra might" */
2373 if (p_ptr->xtra_might) tmul++;
2375 tmul = tmul * (100 + (int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
2377 /* Launcher multiplier */
2379 avgdam /= (100 * 10);
2380 if (avgdam < 0) avgdam = 0;
2382 /* Display (shot damage/ avg damage) */
2383 t = object_desc_chr(t, ' ');
2384 t = object_desc_chr(t, p1);
2385 t = object_desc_num(t, avgdam);
2386 t = object_desc_chr(t, '/');
2388 if (p_ptr->num_fire == 0)
2390 t = object_desc_chr(t, '0');
2394 /* Calc effects of energy */
2395 avgdam *= (p_ptr->num_fire * 100);
2396 avgdam /= energy_fire;
2397 t = object_desc_num(t, avgdam);
2400 t = object_desc_chr(t, p2);
2402 else if ((p_ptr->pclass == CLASS_NINJA) && (o_ptr->tval == TV_SPIKE))
2404 int avgdam = p_ptr->mighty_throw ? (1 + 3) : 1;
2405 s16b energy_fire = 100 - p_ptr->lev;
2407 avgdam += ((p_ptr->lev + 30) * (p_ptr->lev + 30) - 900) / 55;
2409 /* Display (shot damage/ avg damage) */
2410 t = object_desc_chr(t, ' ');
2411 t = object_desc_chr(t, p1);
2412 t = object_desc_num(t, avgdam);
2413 t = object_desc_chr(t, '/');
2415 /* Calc effects of energy */
2416 avgdam = 100 * avgdam / energy_fire;
2418 t = object_desc_num(t, avgdam);
2419 t = object_desc_chr(t, p2);
2422 /* Add the armor bonuses */
2425 /* Show the armor class info */
2428 t = object_desc_chr(t, ' ');
2429 t = object_desc_chr(t, b1);
2430 t = object_desc_num(t, o_ptr->ac);
2431 t = object_desc_chr(t, ',');
2432 t = object_desc_int(t, o_ptr->to_a);
2433 t = object_desc_chr(t, b2);
2436 /* No base armor, but does increase armor */
2437 else if (o_ptr->to_a)
2439 t = object_desc_chr(t, ' ');
2440 t = object_desc_chr(t, b1);
2441 t = object_desc_int(t, o_ptr->to_a);
2442 t = object_desc_chr(t, b2);
2446 /* Hack -- always show base armor */
2447 else if (show_armour)
2449 t = object_desc_chr(t, ' ');
2450 t = object_desc_chr(t, b1);
2451 t = object_desc_num(t, o_ptr->ac);
2452 t = object_desc_chr(t, b2);
2456 /* No more details wanted */
2457 if (mode & OD_NAME_AND_ENCHANT) goto object_desc_done;
2460 if (known) /* Known item only */
2463 * Hack -- Wands and Staffs have charges. Make certain how many charges
2464 * a stack of staffs really has is clear. -LM-
2466 if (((o_ptr->tval == TV_STAFF) || (o_ptr->tval == TV_WAND)))
2468 /* Dump " (N charges)" */
2469 t = object_desc_chr(t, ' ');
2470 t = object_desc_chr(t, p1);
2472 /* Clear explaination for staffs. */
2473 if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1))
2475 t = object_desc_num(t, o_ptr->number);
2476 t = object_desc_str(t, "x ");
2478 t = object_desc_num(t, o_ptr->pval);
2480 t = object_desc_str(t, "²óʬ");
2482 t = object_desc_str(t, " charge");
2483 if (o_ptr->pval != 1) t = object_desc_chr(t, 's');
2486 t = object_desc_chr(t, p2);
2488 /* Hack -- Rods have a "charging" indicator. Now that stacks of rods may
2489 * be in any state of charge or discharge, this now includes a number. -LM-
2491 else if (o_ptr->tval == TV_ROD)
2493 /* Hack -- Dump " (# charging)" if relevant */
2496 /* Stacks of rods display an exact count of charging rods. */
2497 if (o_ptr->number > 1)
2500 if (k_ptr->pval == 0) k_ptr->pval = 1;
2502 /* Find out how many rods are charging, by dividing
2503 * current timeout by each rod's maximum timeout.
2504 * Ensure that any remainder is rounded up. Display
2505 * very discharged stacks as merely fully discharged.
2507 power = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2508 if (power > o_ptr->number) power = o_ptr->number;
2510 /* Display prettily. */
2511 t = object_desc_str(t, " (");
2512 t = object_desc_num(t, power);
2514 t = object_desc_str(t, "ËÜ ½¼Å¶Ãæ)");
2516 t = object_desc_str(t, " charging)");
2520 /* "one Rod of Perception (1 charging)" would look tacky. */
2524 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2526 t = object_desc_str(t, " (charging)");
2532 /* Dump "pval" flags for wearable items */
2533 if (have_pval_flags(flgs))
2535 /* Start the display */
2536 t = object_desc_chr(t, ' ');
2537 t = object_desc_chr(t, p1);
2539 /* Dump the "pval" itself */
2540 t = object_desc_int(t, o_ptr->pval);
2542 /* Do not display the "pval" flags */
2543 if (have_flag(flgs, TR_HIDE_TYPE))
2549 else if (have_flag(flgs, TR_SPEED))
2551 /* Dump " to speed" */
2553 t = object_desc_str(t, "²Ã®");
2555 t = object_desc_str(t, " to speed");
2560 else if (have_flag(flgs, TR_BLOWS))
2564 t = object_desc_str(t, "¹¶·â");
2566 t = object_desc_str(t, " attack");
2569 if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's');
2574 else if (have_flag(flgs, TR_STEALTH))
2576 /* Dump " to stealth" */
2578 t = object_desc_str(t, "±£Ì©");
2580 t = object_desc_str(t, " to stealth");
2585 else if (have_flag(flgs, TR_SEARCH))
2587 /* Dump " to searching" */
2589 t = object_desc_str(t, "õº÷");
2591 t = object_desc_str(t, " to searching");
2596 else if (have_flag(flgs, TR_INFRA))
2598 /* Dump " to infravision" */
2600 t = object_desc_str(t, "ÀÖ³°Àþ»ëÎÏ");
2602 t = object_desc_str(t, " to infravision");
2606 /* Finish the display */
2607 t = object_desc_chr(t, p2);
2610 /* Hack -- Process Lanterns/Torches */
2611 if ((o_ptr->tval == TV_LITE) && (!(object_is_fixed_artifact(o_ptr) || (o_ptr->sval == SV_LITE_FEANOR))))
2613 /* Hack -- Turns of light for normal lites */
2615 t = object_desc_chr(t, '(');
2617 t = object_desc_str(t, " (with ");
2620 if (o_ptr->name2 == EGO_LITE_LONG) t = object_desc_num(t, o_ptr->xtra4 * 2);
2621 else t = object_desc_num(t, o_ptr->xtra4);
2623 t = object_desc_str(t, "¥¿¡¼¥ó¤Î¼÷Ì¿)");
2625 t = object_desc_str(t, " turns of light)");
2629 /* Indicate charging objects, but not rods. */
2630 if (o_ptr->timeout && (o_ptr->tval != TV_ROD))
2632 /* Hack -- Dump " (charging)" if relevant */
2634 t = object_desc_str(t, "(½¼Å¶Ãæ)");
2636 t = object_desc_str(t, " (charging)");
2642 /* No more details wanted */
2643 if (mode & OD_OMIT_INSCRIPTION) goto object_desc_done;
2646 /* Prepare real inscriptions in a buffer */
2649 /* Auto abbreviation inscribe */
2650 if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
2652 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
2663 get_ability_abbreviation(tmp_val2, o_ptr, kanji, all);
2667 /* Use the standard inscription if available */
2668 if (o_ptr->inscription)
2672 if (tmp_val2[0]) strcat(tmp_val2, ", ");
2674 /* Get inscription and convert {%} */
2675 get_inscription(buff, o_ptr);
2677 /* strcat with correct treating of kanji */
2678 my_strcat(tmp_val2, buff, sizeof(tmp_val2));
2682 /* No fake inscription yet */
2683 fake_insc_buf[0] = '\0';
2685 /* Use the game-generated "feeling" otherwise, if available */
2688 strcpy(fake_insc_buf, game_inscriptions[o_ptr->feeling]);
2691 /* Note "cursed" if the item is known to be cursed */
2692 else if (object_is_cursed(o_ptr) && (known || (o_ptr->ident & IDENT_SENSE)))
2695 strcpy(fake_insc_buf, "¼ö¤ï¤ì¤Æ¤¤¤ë");
2697 strcpy(fake_insc_buf, "cursed");
2701 /* Note "unidentified" if the item is unidentified */
2702 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)
2703 || (o_ptr->tval == TV_LITE) || (o_ptr->tval == TV_FIGURINE))
2705 && !(o_ptr->ident & IDENT_SENSE))
2708 strcpy(fake_insc_buf, "̤´ÕÄê");
2710 strcpy(fake_insc_buf, "unidentified");
2714 /* Mega-Hack -- note empty wands/staffs */
2715 else if (!known && (o_ptr->ident & IDENT_EMPTY))
2718 strcpy(fake_insc_buf, "¶õ");
2720 strcpy(fake_insc_buf, "empty");
2724 /* Note "tried" if the object has been tested unsuccessfully */
2725 else if (!aware && object_is_tried(o_ptr))
2728 strcpy(fake_insc_buf, "̤ȽÌÀ");
2730 strcpy(fake_insc_buf, "tried");
2734 /* Note the discount, if any */
2735 if (o_ptr->discount)
2737 /* Hidden by real inscription unless in a store */
2738 if (!tmp_val2[0] || (o_ptr->ident & IDENT_STORE))
2740 char discount_num_buf[4];
2742 /* Append to other fake inscriptions if any */
2743 if (fake_insc_buf[0]) strcat(fake_insc_buf, ", ");
2745 (void)object_desc_num(discount_num_buf, o_ptr->discount);
2746 strcat(fake_insc_buf, discount_num_buf);
2748 strcat(fake_insc_buf, "%°ú¤");
2750 strcat(fake_insc_buf, "% off");
2756 /* Append the inscription, if any */
2757 if (fake_insc_buf[0] || tmp_val2[0])
2759 /* Append the inscription */
2760 t = object_desc_chr(t, ' ');
2761 t = object_desc_chr(t, c1);
2763 /* Append fake inscriptions */
2764 if (fake_insc_buf[0])
2766 t = object_desc_str(t, fake_insc_buf);
2769 /* Append a separater */
2770 if (fake_insc_buf[0] && tmp_val2[0])
2772 t = object_desc_chr(t, ',');
2773 t = object_desc_chr(t, ' ');
2776 /* Append real inscriptions */
2779 t = object_desc_str(t, tmp_val2);
2782 t = object_desc_chr(t, c2);
2786 my_strcpy(buf, tmp_val, MAX_NLEN);