3 * @brief ¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Î½èÍý(¥¹¥Ý¥¤¥é¡¼½ÐÎÏÃæ¿´) / Spoiler generation -BEN-
6 * Copyright (c) 1997 Ben Harrison, and others
7 * This software may be copied and distributed for educational, research,
8 * and not for profit purposes provided that this copyright and statement
9 * are included in all such copies. Other copyrights may also apply.
10 * 2013 Deskull rearranged comment for Doxygen.
20 * The spoiler file being created
22 static FILE *fff = NULL;
27 * @brief ¥·¥ó¥Ü¥ë¿¦¤Îµ½Ò̾¤òÊÖ¤¹ /
28 * Extract a textual representation of an attribute
29 * @param r_ptr ¥â¥ó¥¹¥¿¡¼¼ï²¤Î¹½Â¤ÂΥݥ¤¥ó¥¿
30 * @return ¥·¥ó¥Ü¥ë¿¦¤Îµ½Ò̾
32 static cptr attr_to_text(monster_race *r_ptr)
35 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "Æ©ÌÀ¤Ê";
36 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "Ëü¿§¤Î";
37 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "½à¥é¥ó¥À¥à¤Ê";
39 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "Clear";
40 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "Multi";
41 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "S.Rand";
44 switch (r_ptr->d_attr)
47 case TERM_DARK: return "XXX¤¤";
48 case TERM_WHITE: return "Çò¤¤";
49 case TERM_SLATE: return "Àij¥¿§¤Î";
50 case TERM_ORANGE: return "¥ª¥ì¥ó¥¸¤Î";
51 case TERM_RED: return "ÀÖ¤¤";
52 case TERM_GREEN: return "ÎФÎ";
53 case TERM_BLUE: return "ÀĤ¤";
54 case TERM_UMBER: return "àèàῧ¤Î";
55 case TERM_L_DARK: return "³¥¿§¤Î";
56 case TERM_L_WHITE: return "ÌÀÀij¥¿§¤Î";
57 case TERM_VIOLET: return "»ç¤Î";
58 case TERM_YELLOW: return "²«¿§¤¤";
59 case TERM_L_RED: return "ÌÀ¤¤ÀÖ¤Î";
60 case TERM_L_GREEN: return "ÌÀ¤¤ÎФÎ";
61 case TERM_L_BLUE: return "ÌÀ¤¤ÀĤÎ";
62 case TERM_L_UMBER: return "ÌÀ¤¤àèàῧ¤Î";
64 case TERM_DARK: return "xxx";
65 case TERM_WHITE: return "White";
66 case TERM_SLATE: return "Slate";
67 case TERM_ORANGE: return "Orange";
68 case TERM_RED: return "Red";
69 case TERM_GREEN: return "Green";
70 case TERM_BLUE: return "Blue";
71 case TERM_UMBER: return "Umber";
72 case TERM_L_DARK: return "L.Dark";
73 case TERM_L_WHITE: return "L.Slate";
74 case TERM_VIOLET: return "Violet";
75 case TERM_YELLOW: return "Yellow";
76 case TERM_L_RED: return "L.Red";
77 case TERM_L_GREEN: return "L.Green";
78 case TERM_L_BLUE: return "L.Blue";
79 case TERM_L_UMBER: return "L.Umber";
105 * Item Spoilers by: benh@phial.com (Ben Harrison)
110 * The basic items categorized by type
112 static grouper group_item[] =
115 { TV_SHOT, "¼Í·âʪ" },
130 { TV_DIGGING, "Éð´ï" },
132 { TV_DIGGING, "Weapons" },
135 { TV_POLEARM, NULL },
140 { TV_SOFT_ARMOR, "Ëɶñ (ÂÎ)" },
142 { TV_SOFT_ARMOR, "Armour (Body)" },
145 { TV_HARD_ARMOR, NULL },
146 { TV_DRAG_ARMOR, NULL },
149 { TV_BOOTS, "Ëɶñ (¤½¤Î¾)" },
151 { TV_BOOTS, "Armour (Misc)" },
162 { TV_AMULET, "¥¢¥ß¥å¥ì¥Ã¥È" },
165 { TV_LITE, "Light Sources" },
166 { TV_AMULET, "Amulets" },
167 { TV_RING, "Rings" },
172 { TV_WAND, "ËâË¡ËÀ" },
173 { TV_ROD, "¥í¥Ã¥É" },
175 { TV_STAFF, "Staffs" },
176 { TV_WAND, "Wands" },
181 { TV_SCROLL, "´¬Êª" },
185 { TV_SCROLL, "Scrolls" },
186 { TV_POTION, "Potions" },
191 { TV_LIFE_BOOK, "ËâË¡½ñ (À¸Ì¿)" },
192 { TV_SORCERY_BOOK, "ËâË¡½ñ (Àç½Ñ)" },
193 { TV_NATURE_BOOK, "ËâË¡½ñ (¼«Á³)" },
194 { TV_CHAOS_BOOK, "ËâË¡½ñ (¥«¥ª¥¹)" },
195 { TV_DEATH_BOOK, "ËâË¡½ñ (°Å¹õ)" },
196 { TV_TRUMP_BOOK, "ËâË¡½ñ (¥È¥é¥ó¥×)" },
197 { TV_ARCANE_BOOK, "ËâË¡½ñ (Èë½Ñ)" },
198 { TV_CRAFT_BOOK, "ËâË¡½ñ (¾¢)" },
199 { TV_DAEMON_BOOK, "ËâË¡½ñ (°Ëâ)" },
200 { TV_CRUSADE_BOOK, "ËâË¡½ñ (Ç˼Ù)" },
201 { TV_MUSIC_BOOK, "²Î½¸" },
202 { TV_HISSATSU_BOOK, "Éð·Ý¤Î½ñ" },
203 { TV_HEX_BOOK, "ËâË¡½ñ (¼ö½Ñ)" },
205 { TV_LIFE_BOOK, "Books (Life)" },
206 { TV_SORCERY_BOOK, "Books (Sorcery)" },
207 { TV_NATURE_BOOK, "Books (Nature)" },
208 { TV_CHAOS_BOOK, "Books (Chaos)" },
209 { TV_DEATH_BOOK, "Books (Death)" },
210 { TV_TRUMP_BOOK, "Books (Trump)" },
211 { TV_ARCANE_BOOK, "Books (Arcane)" },
212 { TV_CRAFT_BOOK, "Books (Craft)" },
213 { TV_DAEMON_BOOK, "Books (Daemon)" },
214 { TV_CRUSADE_BOOK, "Books (Crusade)" },
215 { TV_MUSIC_BOOK, "Song Books" },
216 { TV_HISSATSU_BOOK, "Books (Kendo)" },
217 { TV_HEX_BOOK, "Books (Hex)" },
222 { TV_CAPTURE, "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë" },
223 { TV_CARD, "¥¨¥¯¥¹¥×¥ì¥¹¥«¡¼¥É" },
225 { TV_WHISTLE, "Whistle" },
226 { TV_CAPTURE, "Capture Ball" },
227 { TV_CARD, "Express Card" },
233 { TV_CHEST, "Chests" },
237 { TV_FIGURINE, "¿Í·Á" },
239 { TV_CORPSE, "»àÂÎ" },
241 { TV_FIGURINE, "Magical Figurines" },
242 { TV_STATUE, "Statues" },
243 { TV_CORPSE, "Corpses" },
247 { TV_SKELETON, "¤½¤Î¾" },
249 { TV_SKELETON, "Misc" },
256 { TV_PARCHMENT, NULL },
263 * @brief ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Î³Æ¾ðÊó¤òʸ»úÎ󲽤¹¤ë /
265 * @param buf ̾¾Î¤òÊÖ¤¹¥Ð¥Ã¥Õ¥¡»²¾È¥Ý¥¤¥ó¥¿
266 * @param dam ¥À¥á¡¼¥¸¥À¥¤¥¹µ½Ò¤òÊÖ¤¹¥Ð¥Ã¥Õ¥¡»²¾È¥Ý¥¤¥ó¥¿
267 * @param wgt ½ÅÎ̵½Ò¤òÊÖ¤¹¥Ð¥Ã¥Õ¥¡»²¾È¥Ý¥¤¥ó¥¿
268 * @param lev À¸À®³¬µ½Ò¤òÊÖ¤¹¥Ð¥Ã¥Õ¥¡»²¾È¥Ý¥¤¥ó¥¿
269 * @param val ²ÁÃͤòÊÖ¤¹¥Ð¥Ã¥Õ¥¡»²¾È¥Ý¥¤¥ó¥¿
270 * @param k ¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
273 static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k)
279 /* Get local object */
282 /* Prepare a fake item */
283 object_prep(q_ptr, k);
286 q_ptr->ident |= (IDENT_KNOWN);
296 (*lev) = k_info[q_ptr->k_idx].level;
299 (*val) = object_value(q_ptr);
303 if (!buf || !dam || !wgt) return;
306 /* Description (too brief) */
307 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
327 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
337 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
352 sprintf(dam, "%d", q_ptr->ac);
359 sprintf(wgt, "%3d.%d", q_ptr->weight / 10, q_ptr->weight % 10);
364 * @brief ³Æ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Î¾ðÊó¤ò°ì¹ÔËè¤Ëµ½Ò¤¹¤ë /
365 * Create a spoiler file for items
366 * @param fname ¥Õ¥¡¥¤¥ë̾
369 static void spoil_obj_desc(cptr fname)
371 int i, k, s, t, n = 0, group_start = 0;
381 /* Build the filename */
382 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
384 /* File type is "TEXT" */
385 FILE_TYPE(FILE_TYPE_TEXT);
388 fff = my_fopen(buf, "w");
393 msg_print("Cannot create spoiler file.");
399 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d)\n\n\n",
400 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
403 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
404 "Description", "Dam/AC", "Wgt", "Lev", "Cost");
405 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
406 "----------------------------------------",
407 "------", "---", "---", "----");
409 /* List the groups */
410 for (i = 0; TRUE; i++)
412 /* Write out the group title */
413 if (group_item[i].name)
417 /* Hack -- bubble-sort by cost and then level */
418 for (s = 0; s < n - 1; s++)
420 for (t = 0; t < n - 1; t++)
431 kind_info(NULL, NULL, NULL, &e1, &t1, who[i1]);
432 kind_info(NULL, NULL, NULL, &e2, &t2, who[i2]);
434 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
443 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
445 /* Spoil each item */
446 for (s = 0; s < n; s++)
451 /* Describe the kind */
452 kind_info(buf, dam, wgt, &e, &v, who[s]);
455 fprintf(fff, " %-45s%8s%7s%5d%9ld\n",
456 buf, dam, wgt, e, (long)(v));
459 /* Start a new set */
464 if (!group_item[i].tval) break;
466 /* Start a new set */
470 /* Acquire legal item types */
471 for (k = 1; k < max_k_idx; k++)
473 object_kind *k_ptr = &k_info[k];
475 /* Skip wrong tval's */
476 if (k_ptr->tval != group_item[i].tval) continue;
478 /* Hack -- Skip instant-artifacts */
479 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
487 /* Check for errors */
488 if (ferror(fff) || my_fclose(fff))
490 msg_print("Cannot close spoiler file.");
495 msg_print("Successfully created a spoiler file.");
500 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
505 * Returns a "+" string if a number is non-negative and an empty
508 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
511 * These are used to format the artifact spoiler file. INDENT1 is used
512 * to indent all but the first line of an artifact spoiler. INDENT2 is
513 * used when a line "wraps". (Bladeturner's resistances cause this.)
519 * MAX_LINE_LEN specifies when a line should wrap.
521 #define MAX_LINE_LEN 75
524 * Given an array, determine how many elements are in the array
526 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
529 * The artifacts categorized by type
531 static grouper group_artifact[] =
534 { TV_SWORD, "Åá·õ" },
535 { TV_POLEARM, "Áä/Éà" },
536 { TV_HAFTED, "Æß´ï" },
537 { TV_DIGGING, "¥·¥ã¥Ù¥ë/¤Ä¤ë¤Ï¤·" },
538 { TV_BOW, "Èô¤ÓÆ»¶ñ" },
542 { TV_SOFT_ARMOR, "³»" },
543 { TV_HARD_ARMOR, NULL },
544 { TV_DRAG_ARMOR, NULL },
546 { TV_CLOAK, "¥¯¥í¡¼¥¯" },
549 { TV_HELM, "³õ/´§" },
551 { TV_GLOVES, "äƼê" },
555 { TV_AMULET, "¥¢¥ß¥å¥ì¥Ã¥È" },
558 { TV_SWORD, "Edged Weapons" },
559 { TV_POLEARM, "Polearms" },
560 { TV_HAFTED, "Hafted Weapons" },
561 { TV_DIGGING, "Shovels/Picks" },
563 { TV_ARROW, "Ammo" },
566 { TV_SOFT_ARMOR, "Body Armor" },
567 { TV_HARD_ARMOR, NULL },
568 { TV_DRAG_ARMOR, NULL },
570 { TV_CLOAK, "Cloaks" },
571 { TV_SHIELD, "Shields" },
573 { TV_HELM, "Helms/Crowns" },
575 { TV_GLOVES, "Gloves" },
576 { TV_BOOTS, "Boots" },
578 { TV_LITE, "Light Sources" },
579 { TV_AMULET, "Amulets" },
580 { TV_RING, "Rings" },
589 * Pair together a constant flag with a textual description.
591 * Used by both "init.c" and "wiz-spo.c".
593 * Note that it sometimes more efficient to actually make an array
594 * of textual names, where entry 'N' is assumed to be paired with
595 * the flag whose value is "1L << N", but that requires hard-coding.
598 typedef struct flag_desc flag_desc;
603 const char *const desc;
609 * These are used for "+3 to STR, DEX", etc. These are separate from
610 * the other pval affected traits to simplify the case where an object
611 * affects all stats. In this case, "All stats" is used instead of
612 * listing each stat individually.
615 static flag_desc stat_flags_desc[] =
621 { TR_DEX, "´ïÍѤµ" },
622 { TR_CON, "Âѵ×ÎÏ" },
635 * Besides stats, these are the other player traits
636 * which may be affected by an object's pval
639 static flag_desc pval_flags1_desc[] =
642 { TR_MAGIC_MASTERY, "ËâË¡Æ»¶ñ»ÈÍÑǽÎÏ" },
643 { TR_STEALTH, "±£Ì©" },
644 { TR_SEARCH, "õº÷" },
645 { TR_INFRA, "ÀÖ³°Àþ»ëÎÏ" },
646 { TR_TUNNEL, "ºÎ·¡" },
647 { TR_BLOWS, "¹¶·â²ó¿ô" },
648 { TR_SPEED, "¥¹¥Ô¡¼¥É" }
650 { TR_STEALTH, "Stealth" },
651 { TR_SEARCH, "Searching" },
652 { TR_INFRA, "Infravision" },
653 { TR_TUNNEL, "Tunneling" },
654 { TR_BLOWS, "Attacks" },
655 { TR_SPEED, "Speed" }
660 * Slaying preferences for weapons
663 static flag_desc slay_flags_desc[] =
666 { TR_SLAY_ANIMAL, "ưʪ" },
667 { TR_KILL_ANIMAL, "*ưʪ*" },
668 { TR_SLAY_EVIL, "¼Ù°" },
669 { TR_KILL_EVIL, "*¼Ù°*" },
670 { TR_SLAY_HUMAN, "¿Í´Ö" },
671 { TR_KILL_HUMAN, "*¿Í´Ö*" },
672 { TR_SLAY_UNDEAD, "¥¢¥ó¥Ç¥Ã¥É" },
673 { TR_KILL_UNDEAD, "*¥¢¥ó¥Ç¥Ã¥É*" },
674 { TR_SLAY_DEMON, "°Ëâ" },
675 { TR_KILL_DEMON, "*°Ëâ*" },
676 { TR_SLAY_ORC, "¥ª¡¼¥¯" },
677 { TR_KILL_ORC, "*¥ª¡¼¥¯*" },
678 { TR_SLAY_TROLL, "¥È¥í¥ë" },
679 { TR_KILL_TROLL, "*¥È¥í¥ë*" },
680 { TR_SLAY_GIANT, "µð¿Í" },
681 { TR_KILL_GIANT, "*µð¿Í*" },
682 { TR_SLAY_DRAGON, "¥É¥é¥´¥ó" },
683 { TR_KILL_DRAGON, "*¥É¥é¥´¥ó*" },
685 { TR_SLAY_ANIMAL, "Animal" },
686 { TR_KILL_ANIMAL, "XAnimal" },
687 { TR_SLAY_EVIL, "Evil" },
688 { TR_KILL_EVIL, "XEvil" },
689 { TR_SLAY_HUMAN, "Human" },
690 { TR_KILL_HUMAN, "XHuman" },
691 { TR_SLAY_UNDEAD, "Undead" },
692 { TR_KILL_UNDEAD, "XUndead" },
693 { TR_SLAY_DEMON, "Demon" },
694 { TR_KILL_DEMON, "XDemon" },
695 { TR_SLAY_ORC, "Orc" },
696 { TR_KILL_ORC, "XOrc" },
697 { TR_SLAY_TROLL, "Troll" },
698 { TR_KILL_TROLL, "XTroll" },
699 { TR_SLAY_GIANT, "Giant" },
700 { TR_KILL_GIANT, "Xgiant" },
701 { TR_SLAY_DRAGON, "Dragon" },
702 { TR_KILL_DRAGON, "Xdragon" }
707 * Elemental brands for weapons
709 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
710 * coding, it has been included here along with the elemental
711 * brands. It does seem to fit in with the brands and slaying
712 * more than the miscellaneous section.
714 static flag_desc brand_flags_desc[] =
717 { TR_BRAND_ACID, "Íϲò" },
718 { TR_BRAND_ELEC, "ÅÅ·â" },
719 { TR_BRAND_FIRE, "¾Æ´þ" },
720 { TR_BRAND_COLD, "Åà·ë" },
721 { TR_BRAND_POIS, "ÆÇ»¦" },
723 { TR_FORCE_WEAPON, "ÍýÎÏ" },
724 { TR_CHAOTIC, "º®ÆÙ" },
725 { TR_VAMPIRIC, "µÛ·ì" },
726 { TR_IMPACT, "ÃÏ¿Ì" },
727 { TR_VORPAL, "ÀÚ¤ìÌ£" },
729 { TR_BRAND_ACID, "Acid Brand" },
730 { TR_BRAND_ELEC, "Lightning Brand" },
731 { TR_BRAND_FIRE, "Flame Tongue" },
732 { TR_BRAND_COLD, "Frost Brand" },
733 { TR_BRAND_POIS, "Poisoned" },
735 { TR_FORCE_WEAPON, "Force" },
736 { TR_CHAOTIC, "Mark of Chaos" },
737 { TR_VAMPIRIC, "Vampiric" },
738 { TR_IMPACT, "Earthquake impact on hit" },
739 { TR_VORPAL, "Very sharp" },
747 static const flag_desc resist_flags_desc[] =
750 { TR_RES_ACID, "»À" },
751 { TR_RES_ELEC, "ÅÅ·â" },
752 { TR_RES_FIRE, "²Ð±ê" },
753 { TR_RES_COLD, "Î䵤" },
754 { TR_RES_POIS, "ÆÇ" },
755 { TR_RES_FEAR, "¶²ÉÝ"},
756 { TR_RES_LITE, "Á®¸÷" },
757 { TR_RES_DARK, "°Å¹õ" },
758 { TR_RES_BLIND, "ÌÕÌÜ" },
759 { TR_RES_CONF, "º®Íð" },
760 { TR_RES_SOUND, "¹ì²»" },
761 { TR_RES_SHARDS, "ÇËÊÒ" },
762 { TR_RES_NETHER, "ÃϹö" },
763 { TR_RES_NEXUS, "°ø²Ìº®Íð" },
764 { TR_RES_CHAOS, "¥«¥ª¥¹" },
765 { TR_RES_DISEN, "Îô²½" },
767 { TR_RES_ACID, "Acid" },
768 { TR_RES_ELEC, "Lightning" },
769 { TR_RES_FIRE, "Fire" },
770 { TR_RES_COLD, "Cold" },
771 { TR_RES_POIS, "Poison" },
772 { TR_RES_FEAR, "Fear"},
773 { TR_RES_LITE, "Light" },
774 { TR_RES_DARK, "Dark" },
775 { TR_RES_BLIND, "Blindness" },
776 { TR_RES_CONF, "Confusion" },
777 { TR_RES_SOUND, "Sound" },
778 { TR_RES_SHARDS, "Shards" },
779 { TR_RES_NETHER, "Nether" },
780 { TR_RES_NEXUS, "Nexus" },
781 { TR_RES_CHAOS, "Chaos" },
782 { TR_RES_DISEN, "Disenchantment" },
787 * Elemental immunities (along with poison)
790 static const flag_desc immune_flags_desc[] =
793 { TR_IM_ACID, "»À" },
794 { TR_IM_ELEC, "ÅÅ·â" },
795 { TR_IM_FIRE, "²Ð±ê" },
796 { TR_IM_COLD, "Î䵤" },
798 { TR_IM_ACID, "Acid" },
799 { TR_IM_ELEC, "Lightning" },
800 { TR_IM_FIRE, "Fire" },
801 { TR_IM_COLD, "Cold" },
806 * Sustain stats - these are given their "own" line in the
807 * spoiler file, mainly for simplicity
809 static const flag_desc sustain_flags_desc[] =
812 { TR_SUST_STR, "ÏÓÎÏ" },
813 { TR_SUST_INT, "ÃÎǽ" },
814 { TR_SUST_WIS, "¸¤µ" },
815 { TR_SUST_DEX, "´ïÍѤµ" },
816 { TR_SUST_CON, "Âѵ×ÎÏ" },
817 { TR_SUST_CHR, "Ì¥ÎÏ" },
819 { TR_SUST_STR, "STR" },
820 { TR_SUST_INT, "INT" },
821 { TR_SUST_WIS, "WIS" },
822 { TR_SUST_DEX, "DEX" },
823 { TR_SUST_CON, "CON" },
824 { TR_SUST_CHR, "CHR" },
829 * Miscellaneous magic given by an object's "flags2" field
832 static const flag_desc misc_flags2_desc[] =
835 { TR_THROW, "ÅêÚ³" },
836 { TR_REFLECT, "È¿¼Í" },
837 { TR_FREE_ACT, "ËãáãÃΤ餺" },
838 { TR_HOLD_EXP, "·Ð¸³ÃÍ°Ý»ý" },
840 { TR_THROW, "Throwing" },
841 { TR_REFLECT, "Reflection" },
842 { TR_FREE_ACT, "Free Action" },
843 { TR_HOLD_EXP, "Hold Experience" },
848 * Miscellaneous magic given by an object's "flags3" field
850 * Note that cursed artifacts and objects with permanent light
851 * are handled "directly" -- see analyze_misc_magic()
854 static const flag_desc misc_flags3_desc[] =
857 { TR_SH_FIRE, "²Ð±ê¥ª¡¼¥é" },
858 { TR_SH_ELEC, "Åŷ⥪¡¼¥é" },
859 { TR_SH_COLD, "Î䵤¥ª¡¼¥é" },
860 { TR_NO_TELE, "È¿¥Æ¥ì¥Ý¡¼¥È" },
861 { TR_NO_MAGIC, "È¿ËâË¡" },
862 { TR_LEVITATION, "ÉâÍ·" },
863 { TR_SEE_INVIS, "²Ä»ëÆ©ÌÀ" },
864 { TR_TELEPATHY, "¥Æ¥ì¥Ñ¥·¡¼" },
865 { TR_ESP_ANIMAL, "ưʪ´¶ÃÎ" },
866 { TR_ESP_UNDEAD, "ÉԻശÃÎ" },
867 { TR_ESP_DEMON, "°Ëâ´¶ÃÎ" },
868 { TR_ESP_ORC, "¥ª¡¼¥¯´¶ÃÎ" },
869 { TR_ESP_TROLL, "¥È¥í¥ë´¶ÃÎ" },
870 { TR_ESP_GIANT, "µð¿Í´¶ÃÎ" },
871 { TR_ESP_DRAGON, "¥É¥é¥´¥ó´¶ÃÎ" },
872 { TR_ESP_HUMAN, "¿Í´Ö´¶ÃÎ" },
873 { TR_ESP_EVIL, "¼Ù°´¶ÃÎ" },
874 { TR_ESP_GOOD, "Á±ÎÉ´¶ÃÎ" },
875 { TR_ESP_NONLIVING, "̵À¸Êª´¶ÃÎ" },
876 { TR_ESP_UNIQUE, "¥æ¥Ë¡¼¥¯´¶ÃÎ" },
877 { TR_SLOW_DIGEST, "Ãپò½" },
878 { TR_REGEN, "µÞ®²óÉü" },
879 { TR_WARNING, "·Ù¹ð" },
880 /* { TR_XTRA_MIGHT, "¶¯Îϼͷâ" }, */
881 { TR_XTRA_SHOTS, "Äɲüͷâ" }, /* always +1? */
882 { TR_DRAIN_EXP, "·Ð¸³Ã͵ۼý" },
883 { TR_AGGRAVATE, "È¿´¶" },
884 { TR_BLESSED, "½ËÊ¡" },
885 { TR_DEC_MANA, "¾ÃÈñËâÎϸº¾¯" },
887 { TR_SH_FIRE, "Fiery Aura" },
888 { TR_SH_ELEC, "Electric Aura" },
889 { TR_SH_COLD, "Coldly Aura" },
890 { TR_NO_TELE, "Prevent Teleportation" },
891 { TR_NO_MAGIC, "Anti-Magic" },
892 { TR_LEVITATION, "Levitation" },
893 { TR_SEE_INVIS, "See Invisible" },
894 { TR_TELEPATHY, "ESP" },
895 { TR_ESP_ANIMAL, "Sense Animal" },
896 { TR_ESP_UNDEAD, "Sense Undead" },
897 { TR_ESP_DEMON, "Sense Demon" },
898 { TR_ESP_ORC, "Sense Orc" },
899 { TR_ESP_TROLL, "Sense Troll" },
900 { TR_ESP_GIANT, "Sense Giant" },
901 { TR_ESP_DRAGON, "Sense Dragon" },
902 { TR_ESP_HUMAN, "Sense Human" },
903 { TR_ESP_EVIL, "Sense Evil" },
904 { TR_ESP_GOOD, "Sense Good" },
905 { TR_ESP_NONLIVING, "Sense Nonliving" },
906 { TR_ESP_UNIQUE, "Sense Unique" },
907 { TR_SLOW_DIGEST, "Slow Digestion" },
908 { TR_REGEN, "Regeneration" },
909 { TR_WARNING, "Warning" },
910 /* { TR_XTRA_MIGHT, "Extra Might" }, */
911 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
912 { TR_DRAIN_EXP, "Drains Experience" },
913 { TR_AGGRAVATE, "Aggravates" },
914 { TR_BLESSED, "Blessed Blade" },
915 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
921 * A special type used just for deailing with pvals
926 * This will contain a string such as "+2", "-10", etc.
931 * A list of various player traits affected by an object's pval such
932 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
933 * this list since it will probably be desirable to format its
934 * description differently.
936 * Note that room need only be reserved for the number of stats - 1
937 * since the description "All stats" is used if an object affects all
938 * all stats. Also, room must be reserved for a sentinel NULL pointer.
940 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
942 * This list includes extra attacks, for simplicity.
944 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
945 N_ELEMENTS(pval_flags1_desc) + 1];
951 * An "object analysis structure"
953 * It will be filled with descriptive strings detailing an object's
954 * various magical powers. The "ignore X" traits are not noted since
955 * all artifacts ignore "normal" destruction.
960 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
961 char description[MAX_NLEN];
963 /* Description of what is affected by an object's pval */
964 pval_info_type pval_info;
966 /* A list of an object's slaying preferences */
967 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
969 /* A list if an object's elemental brands */
970 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
972 /* A list of immunities granted by an object */
973 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
975 /* A list of resistances granted by an object */
976 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
978 /* A list of stats sustained by an object */
979 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
981 /* A list of various magical qualities an object may have */
982 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
983 + 1 /* Permanent Light */
985 + 1 /* type of curse */
986 + 1]; /* sentinel NULL */
988 /* Additional ability or resistance */
991 /* A string describing an artifact's activation */
994 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
1000 * @brief ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿Àè¤ËƱ¤¸Ê¸»ú¤òÊ£¿ô½ÐÎϤ¹¤ë /
1001 * Write out `n' of the character `c' to the spoiler file
1002 * @param n ½ÐÎϤ¹¤ë¿ô
1003 * @param c ½ÐÎϤ¹¤ë¥¥ã¥é¥¯¥¿
1006 static void spoiler_out_n_chars(int n, char c)
1008 while (--n >= 0) fputc(c, fff);
1013 * @brief ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿Àè¤Ë²þ¹Ô¤òÊ£¿ô½ÐÎϤ¹¤ë /
1014 * Write out `n' blank lines to the spoiler file
1015 * @param n ²þ¹Ô¤ò½ÐÎϤ¹¤ë¿ô
1018 static void spoiler_blanklines(int n)
1020 spoiler_out_n_chars(n, '\n');
1025 * @brief ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿Àè¤ËÊ£¿ô¤Î¥Ï¥¤¥Õ¥ó¤ÇÁõ¾þ¤·¤¿Ê¸»úÎó¤ò½ÐÎϤ¹¤ë /
1026 * Write a line to the spoiler file and then "underline" it with hypens
1027 * @param str ½ÐÎϤ·¤¿¤¤Ê¸»úÎó
1030 static void spoiler_underline(cptr str)
1032 fprintf(fff, "%s\n", str);
1033 spoiler_out_n_chars(strlen(str), '-');
1040 * @brief ¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÆÃÀ°ìÍ÷¤ò½ÐÎϤ¹¤ë /
1041 * Write a line to the spoiler file and then "underline" it with hypens
1042 * @param art_flags ¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î¥Õ¥é¥°·²
1043 * @param flag_ptr ¥Õ¥é¥°µ½Ò¾ðÊó¤Î»²¾È¥Ý¥¤¥ó¥¿
1044 * @param desc_ptr µ½ÒÆâÍƤòÊÖ¤¹¤¿¤á¤Îʸ»úÎ󻲾ȥݥ¤¥ó¥¿
1045 * @param n_elmnts ¥Õ¥é¥°¤ÎÍ×ÁÇ¿ô
1046 * @return desc_ptr¤ÈƱ¤¸¥¢¥É¥ì¥¹
1049 * This function does most of the actual "analysis". Given a set of bit flags
1050 * (which will be from one of the flags fields from the object in question),
1051 * a "flag description structure", a "description list", and the number of
1052 * elements in the "flag description structure", this function sets the
1053 * "description list" members to the appropriate descriptions contained in
1054 * the "flag description structure".
1055 * The possibly updated description pointer is returned.
1058 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1059 const flag_desc *flag_ptr,
1060 cptr *desc_ptr, const int n_elmnts)
1064 for (i = 0; i < n_elmnts; ++i)
1066 if (have_flag(art_flags, flag_ptr[i].flag))
1068 *desc_ptr++ = flag_ptr[i].desc;
1077 * @brief ¥¢¥¤¥Æ¥à¤ÎÆÃÄêµ½ÒÆâÍƤòÊÖ¤¹ /
1078 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1079 * @param o_ptr µ½Ò¤òÆÀ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¥Ý¥¤¥ó¥¿
1080 * @param desc_ptr µ½ÒÆâÍƤòÊÖ¤¹¤¿¤á¤Îʸ»úÎ󻲾ȥݥ¤¥ó¥¿
1083 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1085 /* Get a "useful" description of the object */
1086 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1091 * List "player traits" altered by an artifact's pval. These include stats,
1092 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1094 static void analyze_pval(object_type *o_ptr, pval_info_type *p_ptr)
1096 u32b flgs[TR_FLAG_SIZE];
1100 /* If pval == 0, there is nothing to do. */
1103 /* An "empty" pval description indicates that pval == 0 */
1104 p_ptr->pval_desc[0] = '\0';
1108 /* Extract the flags */
1109 object_flags(o_ptr, flgs);
1111 affects_list = p_ptr->pval_affects;
1113 /* Create the "+N" string */
1114 sprintf(p_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1116 /* First, check to see if the pval affects all stats */
1117 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1118 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1119 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1122 *affects_list++ = "Á´Ç½ÎÏ";
1124 *affects_list++ = "All stats";
1128 /* Are any stats affected? */
1129 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1130 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1131 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1133 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1135 N_ELEMENTS(stat_flags_desc));
1138 /* And now the "rest" */
1139 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1141 N_ELEMENTS(pval_flags1_desc));
1143 /* Terminate the description list */
1144 *affects_list = NULL;
1148 /* Note the slaying specialties of a weapon */
1149 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1151 u32b flgs[TR_FLAG_SIZE];
1153 object_flags(o_ptr, flgs);
1155 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1156 N_ELEMENTS(slay_flags_desc));
1158 /* Terminate the description list */
1162 /* Note an object's elemental brands */
1163 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1165 u32b flgs[TR_FLAG_SIZE];
1167 object_flags(o_ptr, flgs);
1169 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1170 N_ELEMENTS(brand_flags_desc));
1172 /* Terminate the description list */
1177 /* Note the resistances granted by an object */
1178 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1180 u32b flgs[TR_FLAG_SIZE];
1182 object_flags(o_ptr, flgs);
1184 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1185 resist_list, N_ELEMENTS(resist_flags_desc));
1187 /* Terminate the description list */
1188 *resist_list = NULL;
1192 /* Note the immunities granted by an object */
1193 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1195 u32b flgs[TR_FLAG_SIZE];
1197 object_flags(o_ptr, flgs);
1199 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1200 immune_list, N_ELEMENTS(immune_flags_desc));
1202 /* Terminate the description list */
1203 *immune_list = NULL;
1207 /* Note which stats an object sustains */
1208 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1210 u32b flgs[TR_FLAG_SIZE];
1212 object_flags(o_ptr, flgs);
1214 /* Simplify things if an item sustains all stats */
1215 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1216 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1217 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1220 *sustain_list++ = "Á´Ç½ÎÏ";
1222 *sustain_list++ = "All stats";
1226 /* Should we bother? */
1227 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1228 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1229 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1231 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1233 N_ELEMENTS(sustain_flags_desc));
1236 /* Terminate the description list */
1237 *sustain_list = NULL;
1242 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1243 * free action, permanent light, etc.
1245 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1247 u32b flgs[TR_FLAG_SIZE];
1251 object_flags(o_ptr, flgs);
1253 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1254 N_ELEMENTS(misc_flags2_desc));
1256 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1257 N_ELEMENTS(misc_flags3_desc));
1260 * Glowing artifacts -- small radius light.
1263 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1264 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1265 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1266 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1267 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1268 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1270 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1272 if (have_flag(flgs, TR_LITE_FUEL))
1274 if(rad > 0) sprintf(desc, _("¤½¤ì¤ÏdzÎÁÊäµë¤Ë¤è¤Ã¤ÆÌÀ¤«¤ê(Ⱦ·Â %d)¤ò¼ø¤±¤ë¡£", "It provides light (radius %d) when fueled."), rad);
1278 if(rad > 0) sprintf(desc, _("±Êµ×¸÷¸»(Ⱦ·Â %d)", "Permanent Light(radius %d)"), rad);
1279 if(rad < 0) sprintf(desc, _("±Êµ×¸÷¸»(Ⱦ·Â-%d)¡£", "Permanent Light(radius -%d)"), -rad);
1282 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1285 * Handle cursed objects here to avoid redundancies such as noting
1286 * that a permanently cursed object is heavily cursed as well as
1287 * being "lightly cursed".
1290 /* if (object_is_cursed(o_ptr)) */
1292 if (have_flag(flgs, TR_TY_CURSE))
1294 *misc_list++ = _("ÂÀ¸Å¤Î±åÇ°", "Ancient Curse");
1296 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1298 *misc_list++ = _("±Ê±ó¤Î¼ö¤¤", "Permanently Cursed");
1300 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1302 *misc_list++ = _("¶¯ÎϤʼö¤¤", "Heavily Cursed");
1305 else if (o_ptr->curse_flags & TRC_CURSED)
1307 *misc_list++ = _("¼ö¤¤", "Cursed");
1309 if (have_flag(flgs, TR_ADD_L_CURSE))
1311 *misc_list++ = _("¼ö¤¤¤òÁý¤ä¤¹", "Cursing");
1313 if (have_flag(flgs, TR_ADD_H_CURSE))
1315 *misc_list++ = _("¶¯ÎϤʼö¤¤¤òÁý¤ä¤¹", "Heavily Cursing");
1319 /* Terminate the description list */
1325 * Note additional ability and/or resistance of fixed artifacts
1327 static void analyze_addition(object_type *o_ptr, char *addition)
1329 artifact_type *a_ptr = &a_info[o_ptr->name1];
1332 strcpy(addition, "");
1335 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "ǽÎÏandÂÑÀ");
1336 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1338 strcat(addition, "ǽÎÏ");
1339 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2¤ÇandÂÑÀ)");
1341 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1343 strcat(addition, "ÂÑÀ");
1344 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2¤ÇandǽÎÏ)");
1346 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "ǽÎÏorÂÑÀ");
1348 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1349 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1351 strcat(addition, "Ability");
1352 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1354 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1356 strcat(addition, "Resistance");
1357 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1359 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1365 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1366 * and its value in gold pieces
1368 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1370 artifact_type *a_ptr = &a_info[o_ptr->name1];
1373 sprintf(misc_desc, "¥ì¥Ù¥ë %u, ´õ¾¯ÅÙ %u, %d.%d kg, ¡ð%ld",
1374 a_ptr->level, a_ptr->rarity,
1375 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1377 sprintf(misc_desc, "Level %u, Rarity %u, %d.%d lbs, %ld Gold",
1378 a_ptr->level, a_ptr->rarity,
1379 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1385 * Fill in an object description structure for a given object
1387 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1389 analyze_general(o_ptr, desc_ptr->description);
1390 analyze_pval(o_ptr, &desc_ptr->pval_info);
1391 analyze_brand(o_ptr, desc_ptr->brands);
1392 analyze_slay(o_ptr, desc_ptr->slays);
1393 analyze_immune(o_ptr, desc_ptr->immunities);
1394 analyze_resist(o_ptr, desc_ptr->resistances);
1395 analyze_sustains(o_ptr, desc_ptr->sustains);
1396 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1397 analyze_addition(o_ptr, desc_ptr->addition);
1398 analyze_misc(o_ptr, desc_ptr->misc_desc);
1399 desc_ptr->activation = item_activation(o_ptr);
1403 static void print_header(void)
1407 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1408 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1409 spoiler_underline(buf);
1413 * This is somewhat ugly.
1415 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1416 * and a separator character (',', e.g.), write the list to the spoiler file
1417 * in a "nice" format, such as:
1419 * Resist Fire, Cold, Acid
1421 * That was a simple example, but when the list is long, a line wrap
1422 * should occur, and this should induce a new level of indention if
1423 * a list is being spread across lines. So for example, Bladeturner's
1424 * list of resistances should look something like this
1426 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1427 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1429 * However, the code distinguishes between a single list of many items vs.
1430 * many lists. (The separator is used to make this determination.) A single
1431 * list of many items will not cause line wrapping (since there is no
1432 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1433 * might look like this:
1435 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1438 * So comparing the two, "Regeneration" has no trailing separator and
1439 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1440 * but that's not relevant to line wrapping and indention.)
1443 /* ITEM_SEP separates items within a list */
1444 #define ITEM_SEP ','
1447 /* LIST_SEP separates lists */
1449 #define LIST_SEP ','
1451 #define LIST_SEP ';'
1454 static void spoiler_outlist(cptr header, cptr *list, char separator)
1456 int line_len, buf_len;
1457 char line[MAX_LINE_LEN+1], buf[80];
1459 /* Ignore an empty list */
1460 if (*list == NULL) return;
1462 /* This function always indents */
1463 strcpy(line, INDENT1);
1465 /* Create header (if one was given) */
1466 if (header && (header[0]))
1468 strcat(line, header);
1472 line_len = strlen(line);
1474 /* Now begin the tedious task */
1477 /* Copy the current item to a buffer */
1480 /* Note the buffer's length */
1481 buf_len = strlen(buf);
1484 * If there is an item following this one, pad with separator and
1485 * a space and adjust the buffer length
1490 sprintf(buf + buf_len, "%c ", separator);
1495 * If the buffer will fit on the current line, just append the
1496 * buffer to the line and adjust the line length accordingly.
1499 if (line_len + buf_len <= MAX_LINE_LEN)
1502 line_len += buf_len;
1505 /* Apply line wrapping and indention semantics described above */
1509 * Don't print a trailing list separator but do print a trailing
1512 if (line_len > 1 && line[line_len - 1] == ' '
1513 && line[line_len - 2] == LIST_SEP)
1515 /* Ignore space and separator */
1516 line[line_len - 2] = '\0';
1518 /* Write to spoiler file */
1519 fprintf(fff, "%s\n", line);
1521 /* Begin new line at primary indention level */
1522 sprintf(line, "%s%s", INDENT1, buf);
1527 /* Write to spoiler file */
1528 fprintf(fff, "%s\n", line);
1530 /* Begin new line at secondary indention level */
1531 sprintf(line, "%s%s", INDENT2, buf);
1534 line_len = strlen(line);
1537 /* Advance, with break */
1538 if (!*++list) break;
1541 /* Write what's left to the spoiler file */
1542 fprintf(fff, "%s\n", line);
1546 /* Create a spoiler file entry for an artifact */
1548 static void spoiler_print_art(obj_desc_list *art_ptr)
1550 pval_info_type *pval_ptr = &art_ptr->pval_info;
1554 /* Don't indent the first line */
1555 fprintf(fff, "%s\n", art_ptr->description);
1557 /* An "empty" pval description indicates that the pval affects nothing */
1558 if (pval_ptr->pval_desc[0])
1560 /* Mention the effects of pval */
1562 sprintf(buf, "%s¤Î½¤Àµ:", pval_ptr->pval_desc);
1564 sprintf(buf, "%s to", pval_ptr->pval_desc);
1566 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1569 /* Now deal with the description lists */
1572 spoiler_outlist("ÂÐ:", art_ptr->slays, ITEM_SEP);
1573 spoiler_outlist("Éð´ï°À:", art_ptr->brands, LIST_SEP);
1574 spoiler_outlist("ÌȱÖ:", art_ptr->immunities, ITEM_SEP);
1575 spoiler_outlist("ÂÑÀ:", art_ptr->resistances, ITEM_SEP);
1576 spoiler_outlist("°Ý»ý:", art_ptr->sustains, ITEM_SEP);
1578 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1579 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1580 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1581 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1582 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1584 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1586 if (art_ptr->addition[0])
1589 fprintf(fff, "%sÄɲÃ: %s\n", INDENT1, art_ptr->addition);
1591 fprintf(fff, "%sAdditional %s\n", INDENT1, art_ptr->addition);
1595 /* Write out the possible activation at the primary indention level */
1596 if (art_ptr->activation)
1599 fprintf(fff, "%sȯư: %s\n", INDENT1, art_ptr->activation);
1601 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
1605 /* End with the miscellaneous facts */
1606 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1611 * Hack -- Create a "forged" artifact
1613 static bool make_fake_artifact(object_type *o_ptr, int name1)
1617 artifact_type *a_ptr = &a_info[name1];
1620 /* Ignore "empty" artifacts */
1621 if (!a_ptr->name) return FALSE;
1623 /* Acquire the "kind" index */
1624 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1627 if (!i) return (FALSE);
1629 /* Create the artifact */
1630 object_prep(o_ptr, i);
1633 o_ptr->name1 = name1;
1635 /* Extract the fields */
1636 o_ptr->pval = a_ptr->pval;
1637 o_ptr->ac = a_ptr->ac;
1638 o_ptr->dd = a_ptr->dd;
1639 o_ptr->ds = a_ptr->ds;
1640 o_ptr->to_a = a_ptr->to_a;
1641 o_ptr->to_h = a_ptr->to_h;
1642 o_ptr->to_d = a_ptr->to_d;
1643 o_ptr->weight = a_ptr->weight;
1651 * Create a spoiler file for artifacts
1653 static void spoil_artifact(cptr fname)
1660 obj_desc_list artifact;
1665 /* Build the filename */
1666 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1668 /* File type is "TEXT" */
1669 FILE_TYPE(FILE_TYPE_TEXT);
1672 fff = my_fopen(buf, "w");
1677 msg_print("Cannot create spoiler file.");
1681 /* Dump the header */
1684 /* List the artifacts by tval */
1685 for (i = 0; group_artifact[i].tval; i++)
1687 /* Write out the group title */
1688 if (group_artifact[i].name)
1690 spoiler_blanklines(2);
1691 spoiler_underline(group_artifact[i].name);
1692 spoiler_blanklines(1);
1695 /* Now search through all of the artifacts */
1696 for (j = 1; j < max_a_idx; ++j)
1698 artifact_type *a_ptr = &a_info[j];
1700 /* We only want objects in the current group */
1701 if (a_ptr->tval != group_artifact[i].tval) continue;
1703 /* Get local object */
1706 /* Wipe the object */
1709 /* Attempt to "forge" the artifact */
1710 if (!make_fake_artifact(q_ptr, j)) continue;
1712 /* Analyze the artifact */
1713 object_analyze(q_ptr, &artifact);
1715 /* Write out the artifact description to the spoiler file */
1716 spoiler_print_art(&artifact);
1720 /* Check for errors */
1721 if (ferror(fff) || my_fclose(fff))
1723 msg_print("Cannot close spoiler file.");
1728 msg_print("Successfully created a spoiler file.");
1736 * Create a spoiler file for monsters -BEN-
1738 static void spoil_mon_desc(cptr fname)
1755 /* Build the filename */
1756 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1758 /* File type is "TEXT" */
1759 FILE_TYPE(FILE_TYPE_TEXT);
1762 fff = my_fopen(buf, "w");
1767 msg_print("Cannot create spoiler file.");
1771 /* Allocate the "who" array */
1772 C_MAKE(who, max_r_idx, s16b);
1774 /* Dump the header */
1775 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1776 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1777 fprintf(fff, "------------------------------------------\n\n");
1779 /* Dump the header */
1780 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1781 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1782 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1783 "--------", "---", "---", "---", "--", "--", "-----------");
1786 /* Scan the monsters */
1787 for (i = 1; i < max_r_idx; i++)
1789 monster_race *r_ptr = &r_info[i];
1791 /* Use that monster */
1792 if (r_ptr->name) who[n++] = i;
1795 /* Select the sort method */
1796 ang_sort_comp = ang_sort_comp_hook;
1797 ang_sort_swap = ang_sort_swap_hook;
1799 /* Sort the array by dungeon depth of monsters */
1800 ang_sort(who, &why, n);
1803 for (i = 0; i < n; i++)
1805 monster_race *r_ptr = &r_info[who[i]];
1807 cptr name = (r_name + r_ptr->name);
1808 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1810 /* Get the "name" */
1812 else if (r_ptr->flags1 & (RF1_QUESTOR))
1814 sprintf(nam, "[Q] %s", name);
1817 else if (r_ptr->flags1 & (RF1_UNIQUE))
1819 sprintf(nam, "[U] %s", name);
1824 sprintf(nam, " %s", name);
1826 sprintf(nam, "The %s", name);
1832 sprintf(lev, "%d", r_ptr->level);
1835 sprintf(rar, "%d", r_ptr->rarity);
1838 if (r_ptr->speed >= 110)
1840 sprintf(spd, "+%d", (r_ptr->speed - 110));
1844 sprintf(spd, "-%d", (110 - r_ptr->speed));
1848 sprintf(ac, "%d", r_ptr->ac);
1851 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1853 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1857 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1862 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1864 /* Hack -- use visual instead */
1865 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1868 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1869 nam, lev, rar, spd, hp, ac, exp);
1876 /* Free the "who" array */
1877 C_KILL(who, max_r_idx, s16b);
1879 /* Check for errors */
1880 if (ferror(fff) || my_fclose(fff))
1882 msg_print("Cannot close spoiler file.");
1887 msg_print("Successfully created a spoiler file.");
1894 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1896 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1902 * Buffer text to the given file. (-SHAWN-)
1903 * This is basically c_roff() from mon-desc.c with a few changes.
1905 static void spoil_out(cptr str)
1910 static char roff_buf[256];
1913 static char roff_waiting_buf[256];
1916 bool iskanji_flag = FALSE;
1918 /* Current pointer into line roff_buf */
1919 static char *roff_p = roff_buf;
1921 /* Last space saved into roff_buf */
1922 static char *roff_s = NULL;
1924 /* Mega-Hack -- Delayed output */
1925 static bool waiting_output = FALSE;
1927 /* Special handling for "new sequence" */
1932 fputs(roff_waiting_buf, fff);
1933 waiting_output = FALSE;
1936 if (roff_p != roff_buf) roff_p--;
1937 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1939 if (roff_p == roff_buf) fprintf(fff, "\n");
1942 *(roff_p + 1) = '\0';
1943 fprintf(fff, "%s\n\n", roff_buf);
1952 /* Scan the given string, character at a time */
1957 bool k_flag = iskanji((unsigned char)(*str));
1960 bool wrap = (ch == '\n');
1963 if (!isprint(ch) && !k_flag && !iskanji_flag) ch = ' ';
1964 iskanji_flag = k_flag && !iskanji_flag;
1966 if (!isprint(ch)) ch = ' ';
1971 fputs(roff_waiting_buf, fff);
1972 if (!wrap) fputc('\n', fff);
1973 waiting_output = FALSE;
1979 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1980 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
1982 if (roff_p >= roff_buf + 75) wrap = TRUE;
1983 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
1990 bool iskanji_flag_local = FALSE;
1991 cptr tail = str + (k_flag ? 2 : 1);
1993 cptr tail = str + 1;
1996 for (; *tail; tail++)
1998 if (*tail == ' ') continue;
2001 k_flag_local = iskanji((unsigned char)(*tail));
2002 if (isprint(*tail) || k_flag_local || iskanji_flag_local) break;
2003 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2005 if (isprint(*tail)) break;
2009 if (!*tail) waiting_output = TRUE;
2013 /* Handle line-wrap */
2021 if (roff_s && (ch != ' '))
2029 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2030 else strcpy(roff_waiting_buf, roff_buf);
2034 if (cbak != ' ') *roff_p++ = cbak;
2036 while (*r) *roff_p++ = *r++;
2040 if ((roff_p > roff_buf) || (ch != ' '))
2045 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2050 strncmp(str, "¡£", 2) != 0 &&
2051 strncmp(str, "¡¢", 2) != 0 &&
2052 strncmp(str, "¥£", 2) != 0 &&
2053 strncmp(str, "¡¼", 2) != 0) roff_s = roff_p;
2056 if (ch == ' ') roff_s = roff_p;
2067 * Hook function used in spoil_mon_info()
2069 static void roff_func(byte attr, cptr str)
2079 * Create a spoiler file for monsters (-SHAWN-)
2081 static void spoil_mon_info(cptr fname)
2090 /* Build the filename */
2091 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2093 /* File type is "TEXT" */
2094 FILE_TYPE(FILE_TYPE_TEXT);
2097 fff = my_fopen(buf, "w");
2102 msg_print("Cannot create spoiler file.");
2107 /* Dump the header */
2108 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2109 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2112 spoil_out("------------------------------------------\n\n");
2114 /* Allocate the "who" array */
2115 C_MAKE(who, max_r_idx, s16b);
2117 /* Scan the monsters */
2118 for (i = 1; i < max_r_idx; i++)
2120 monster_race *r_ptr = &r_info[i];
2122 /* Use that monster */
2123 if (r_ptr->name) who[n++] = i;
2126 /* Select the sort method */
2127 ang_sort_comp = ang_sort_comp_hook;
2128 ang_sort_swap = ang_sort_swap_hook;
2130 /* Sort the array by dungeon depth of monsters */
2131 ang_sort(who, &why, n);
2135 * List all monsters in order
2137 for (l = 0; l < n; l++)
2139 monster_race *r_ptr = &r_info[who[l]];
2141 /* Extract the flags */
2142 flags1 = r_ptr->flags1;
2146 if (flags1 & (RF1_QUESTOR))
2152 if (flags1 & (RF1_UNIQUE))
2165 sprintf(buf, "%s/%s (", (r_name + r_ptr->name),(r_name+r_ptr->E_name)); /* ---)--- */
2167 sprintf(buf, "%s (", (r_name + r_ptr->name)); /* ---)--- */
2173 spoil_out(attr_to_text(r_ptr));
2176 sprintf(buf, " '%c')\n", r_ptr->d_char);
2181 sprintf(buf, "=== ");
2185 sprintf(buf, "Num:%d ", who[l]);
2189 sprintf(buf, "Lev:%d ", r_ptr->level);
2193 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2197 if (r_ptr->speed >= 110)
2199 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2203 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2208 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2210 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2214 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2219 sprintf(buf, "Ac:%d ", r_ptr->ac);
2223 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2226 /* Reuse the code of monster recall. */
2227 output_monster_spoiler(who[l], roff_func);
2232 /* Free the "who" array */
2233 C_KILL(who, max_r_idx, s16b);
2235 /* Check for errors */
2236 if (ferror(fff) || my_fclose(fff))
2238 msg_print("Cannot close spoiler file.");
2242 msg_print("Successfully created a spoiler file.");
2247 #define MAX_EVOL_DEPTH 64
2251 * Compare two int-type array like strncmp() and return TRUE if equals
2253 static bool int_n_cmp(int *a, int *b, int length)
2255 /* Null-string comparation is always TRUE */
2256 if (!length) return TRUE;
2260 if (*a != *(b++)) return FALSE;
2261 if (!(*(a++))) break;
2270 * Returns TRUE if an evolution tree is "partial tree"
2272 static bool is_partial_tree(int *tree, int *partial_tree)
2274 int pt_head = *(partial_tree++);
2277 while (partial_tree[pt_len]) pt_len++;
2281 if (*(tree++) == pt_head)
2283 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2292 * Sorting hook -- Comp function
2294 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2296 int **evol_tree = (int **)u;
2298 int w1 = evol_tree[a][0];
2299 int w2 = evol_tree[b][0];
2300 monster_race *r1_ptr = &r_info[w1];
2301 monster_race *r2_ptr = &r_info[w2];
2306 /* Used tree first */
2307 if (w1 && !w2) return TRUE;
2308 if (!w1 && w2) return FALSE;
2310 /* Sort by monster level */
2311 if (r1_ptr->level < r2_ptr->level) return TRUE;
2312 if (r1_ptr->level > r2_ptr->level) return FALSE;
2314 /* Sort by monster experience */
2315 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2316 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2318 /* Compare indexes */
2324 * Sorting hook -- Swap function
2326 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2328 int **evol_tree = (int **)u;
2335 holder = evol_tree[a];
2336 evol_tree[a] = evol_tree[b];
2337 evol_tree[b] = holder;
2342 * Print monsters' evolution information to file
2344 static void spoil_mon_evol(cptr fname)
2347 monster_race *r_ptr;
2348 int **evol_tree, i, j, n, r_idx;
2349 int *evol_tree_zero; /* For C_KILL() */
2351 /* Build the filename */
2352 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2354 /* File type is "TEXT" */
2355 FILE_TYPE(FILE_TYPE_TEXT);
2358 fff = my_fopen(buf, "w");
2363 msg_print("Cannot create spoiler file.");
2367 /* Dump the header */
2368 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2369 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2372 spoil_out("------------------------------------------\n\n");
2374 /* Allocate the "evol_tree" array (2-dimension) */
2375 C_MAKE(evol_tree, max_r_idx, int *);
2376 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2377 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2378 evol_tree_zero = *evol_tree;
2380 /* Step 1: Build the evolution tree */
2381 for (i = 1; i < max_r_idx; i++)
2386 if (!r_ptr->next_exp) continue;
2388 /* Trace evolution */
2390 evol_tree[i][n++] = i;
2393 evol_tree[i][n++] = r_ptr->next_r_idx;
2394 r_ptr = &r_info[r_ptr->next_r_idx];
2396 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2399 /* Step 2: Scan the evolution trees and remove "partial tree" */
2400 for (i = 1; i < max_r_idx; i++)
2402 /* Not evolution tree */
2403 if (!evol_tree[i][0]) continue;
2405 for (j = 1; j < max_r_idx; j++)
2408 if (i == j) continue;
2410 /* Not evolution tree */
2411 if (!evol_tree[j][0]) continue;
2413 /* Is evolution tree[i] is part of [j]? */
2414 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2416 /* Remove this evolution tree */
2417 evol_tree[i][0] = 0;
2423 /* Step 3: Sort the evolution trees */
2425 /* Select the sort method */
2426 ang_sort_comp = ang_sort_comp_evol_tree;
2427 ang_sort_swap = ang_sort_swap_evol_tree;
2429 /* Sort the array */
2430 ang_sort(evol_tree, NULL, max_r_idx);
2432 /* Step 4: Print the evolution trees */
2433 for (i = 0; i < max_r_idx; i++)
2435 r_idx = evol_tree[i][0];
2437 /* No evolution or removed evolution tree */
2438 if (!r_idx) continue;
2440 /* Trace the evolution tree */
2441 r_ptr = &r_info[r_idx];
2443 fprintf(fff, "[%d]: %s (¥ì¥Ù¥ë%d, '%c')\n", r_idx,
2444 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2446 fprintf(fff, "[%d]: %s (Level %d, '%c')\n", r_idx,
2447 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2449 for (n = 1; r_ptr->next_exp; n++)
2451 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2452 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2453 r_ptr = &r_info[r_ptr->next_r_idx];
2455 fprintf(fff, "%s (¥ì¥Ù¥ë%d, '%c')\n",
2456 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2458 fprintf(fff, "%s (Level %d, '%c')\n",
2459 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2463 /* End of evolution tree */
2467 /* Free the "evol_tree" array (2-dimension) */
2468 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2469 C_KILL(evol_tree, max_r_idx, int *);
2471 /* Check for errors */
2472 if (ferror(fff) || my_fclose(fff))
2474 msg_print("Cannot close spoiler file.");
2479 msg_print("Successfully created a spoiler file.");
2487 extern void do_cmd_spoilers(void);
2490 * Create Spoiler files -BEN-
2492 void do_cmd_spoilers(void)
2494 /* Save the screen */
2504 prt("Create a spoiler file.", 2, 0);
2506 /* Prompt for a file */
2507 prt("(1) Brief Object Info (obj-desc.spo)", 5, 5);
2508 prt("(2) Brief Artifact Info (artifact.spo)", 6, 5);
2509 prt("(3) Brief Monster Info (mon-desc.spo)", 7, 5);
2510 prt("(4) Full Monster Info (mon-info.spo)", 8, 5);
2511 prt("(5) Monster Evolution Info (mon-evol.spo)", 9, 5);
2515 prt("¥³¥Þ¥ó¥É:", 18, 0);
2517 prt("Command: ", 12, 0);
2525 /* Restore the screen */
2531 spoil_obj_desc("obj-desc.spo");
2536 spoil_artifact("artifact.spo");
2541 spoil_mon_desc("mon-desc.spo");
2546 spoil_mon_info("mon-info.spo");
2551 spoil_mon_evol("mon-evol.spo");
2560 /* Flush messages */
2566 * Fill in an object description structure for a given object
2568 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2570 analyze_general(o_ptr, desc_ptr->description);
2571 analyze_pval(o_ptr, &desc_ptr->pval_info);
2572 analyze_brand(o_ptr, desc_ptr->brands);
2573 analyze_slay(o_ptr, desc_ptr->slays);
2574 analyze_immune(o_ptr, desc_ptr->immunities);
2575 analyze_resist(o_ptr, desc_ptr->resistances);
2576 analyze_sustains(o_ptr, desc_ptr->sustains);
2577 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2578 desc_ptr->activation = item_activation(o_ptr);
2580 sprintf(desc_ptr->misc_desc, "½Å¤µ %d.%d kg",
2581 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2583 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2584 o_ptr->weight / 10, o_ptr->weight % 10);
2588 /* Create a spoiler file entry for an artifact */
2590 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2592 pval_info_type *pval_ptr = &art_ptr->pval_info;
2596 /* Don't indent the first line */
2597 fprintf(fff, "%s\n", art_ptr->description);
2600 if (!(o_ptr->ident & (IDENT_MENTAL)))
2603 fprintf(fff, "%sÉÔÌÀ\n",INDENT1);
2605 fprintf(fff, "%sUnknown\n",INDENT1);
2609 /* An "empty" pval description indicates that the pval affects nothing */
2610 if (pval_ptr->pval_desc[0])
2612 /* Mention the effects of pval */
2614 sprintf(buf, "%s¤Î½¤Àµ:", pval_ptr->pval_desc);
2616 sprintf(buf, "%s to", pval_ptr->pval_desc);
2618 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2621 /* Now deal with the description lists */
2624 spoiler_outlist("ÂÐ:", art_ptr->slays, ITEM_SEP);
2625 spoiler_outlist("Éð´ï°À:", art_ptr->brands, LIST_SEP);
2626 spoiler_outlist("ÌȱÖ:", art_ptr->immunities, ITEM_SEP);
2627 spoiler_outlist("ÂÑÀ:", art_ptr->resistances, ITEM_SEP);
2628 spoiler_outlist("°Ý»ý:", art_ptr->sustains, ITEM_SEP);
2630 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2631 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2632 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2633 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2634 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2636 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2638 /* Write out the possible activation at the primary indention level */
2639 if (art_ptr->activation)
2642 fprintf(fff, "%sȯư: %s\n", INDENT1, art_ptr->activation);
2644 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
2648 /* End with the miscellaneous facts */
2649 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2652 /* Create a part of file for random artifacts */
2654 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2656 obj_desc_list artifact;
2658 if (!object_is_known(o_ptr) || !o_ptr->art_name
2659 || o_ptr->tval != group_artifact[i].tval)
2662 /* Analyze the artifact */
2663 random_artifact_analyze(o_ptr, &artifact);
2665 /* Write out the artifact description to the spoiler file */
2666 spoiler_print_randart(o_ptr, &artifact);
2670 * Create a list file for random artifacts
2672 void spoil_random_artifact(cptr fname)
2682 /* Build the filename */
2683 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2685 /* File type is "TEXT" */
2686 FILE_TYPE(FILE_TYPE_TEXT);
2689 fff = my_fopen(buf, "w");
2694 msg_print("Cannot create list file.");
2698 /* Dump the header */
2699 sprintf(buf, "Random artifacts list.\r");
2700 spoiler_underline(buf);
2702 /* List the artifacts by tval */
2703 for (j = 0; group_artifact[j].tval; j++)
2705 /* random artifacts wielding */
2706 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2708 q_ptr = &inventory[i];
2709 spoil_random_artifact_aux(q_ptr, j);
2712 /* random artifacts in inventory */
2713 for (i = 0; i < INVEN_PACK; i++)
2715 q_ptr = &inventory[i];
2716 spoil_random_artifact_aux(q_ptr, j);
2719 /* random artifacts in home */
2720 st_ptr = &town[1].store[STORE_HOME];
2721 for (i = 0; i < st_ptr->stock_num; i++)
2723 q_ptr = &st_ptr->stock[i];
2724 spoil_random_artifact_aux(q_ptr, j);
2727 /* random artifacts in museum */
2728 st_ptr = &town[1].store[STORE_MUSEUM];
2729 for (i = 0; i < st_ptr->stock_num; i++)
2731 q_ptr = &st_ptr->stock[i];
2732 spoil_random_artifact_aux(q_ptr, j);
2736 /* Check for errors */
2737 if (ferror(fff) || my_fclose(fff))
2739 msg_print("Cannot close list file.");
2744 msg_print("Successfully created a list file.");
2751 #endif /* MACINTOSH */