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 * Write out `n' of the character `c' to the spoiler file
1002 static void spoiler_out_n_chars(int n, char c)
1004 while (--n >= 0) fputc(c, fff);
1009 * Write out `n' blank lines to the spoiler file
1011 static void spoiler_blanklines(int n)
1013 spoiler_out_n_chars(n, '\n');
1018 * Write a line to the spoiler file and then "underline" it with hypens
1020 static void spoiler_underline(cptr str)
1022 fprintf(fff, "%s\n", str);
1023 spoiler_out_n_chars(strlen(str), '-');
1030 * This function does most of the actual "analysis". Given a set of bit flags
1031 * (which will be from one of the flags fields from the object in question),
1032 * a "flag description structure", a "description list", and the number of
1033 * elements in the "flag description structure", this function sets the
1034 * "description list" members to the appropriate descriptions contained in
1035 * the "flag description structure".
1037 * The possibly updated description pointer is returned.
1039 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1040 const flag_desc *flag_ptr,
1041 cptr *desc_ptr, const int n_elmnts)
1045 for (i = 0; i < n_elmnts; ++i)
1047 if (have_flag(art_flags, flag_ptr[i].flag))
1049 *desc_ptr++ = flag_ptr[i].desc;
1058 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1060 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1062 /* Get a "useful" description of the object */
1063 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1068 * List "player traits" altered by an artifact's pval. These include stats,
1069 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1071 static void analyze_pval(object_type *o_ptr, pval_info_type *p_ptr)
1073 u32b flgs[TR_FLAG_SIZE];
1077 /* If pval == 0, there is nothing to do. */
1080 /* An "empty" pval description indicates that pval == 0 */
1081 p_ptr->pval_desc[0] = '\0';
1085 /* Extract the flags */
1086 object_flags(o_ptr, flgs);
1088 affects_list = p_ptr->pval_affects;
1090 /* Create the "+N" string */
1091 sprintf(p_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1093 /* First, check to see if the pval affects all stats */
1094 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1095 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1096 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1099 *affects_list++ = "Á´Ç½ÎÏ";
1101 *affects_list++ = "All stats";
1105 /* Are any stats affected? */
1106 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1107 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1108 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1110 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1112 N_ELEMENTS(stat_flags_desc));
1115 /* And now the "rest" */
1116 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1118 N_ELEMENTS(pval_flags1_desc));
1120 /* Terminate the description list */
1121 *affects_list = NULL;
1125 /* Note the slaying specialties of a weapon */
1126 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1128 u32b flgs[TR_FLAG_SIZE];
1130 object_flags(o_ptr, flgs);
1132 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1133 N_ELEMENTS(slay_flags_desc));
1135 /* Terminate the description list */
1139 /* Note an object's elemental brands */
1140 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1142 u32b flgs[TR_FLAG_SIZE];
1144 object_flags(o_ptr, flgs);
1146 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1147 N_ELEMENTS(brand_flags_desc));
1149 /* Terminate the description list */
1154 /* Note the resistances granted by an object */
1155 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1157 u32b flgs[TR_FLAG_SIZE];
1159 object_flags(o_ptr, flgs);
1161 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1162 resist_list, N_ELEMENTS(resist_flags_desc));
1164 /* Terminate the description list */
1165 *resist_list = NULL;
1169 /* Note the immunities granted by an object */
1170 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1172 u32b flgs[TR_FLAG_SIZE];
1174 object_flags(o_ptr, flgs);
1176 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1177 immune_list, N_ELEMENTS(immune_flags_desc));
1179 /* Terminate the description list */
1180 *immune_list = NULL;
1184 /* Note which stats an object sustains */
1185 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1187 u32b flgs[TR_FLAG_SIZE];
1189 object_flags(o_ptr, flgs);
1191 /* Simplify things if an item sustains all stats */
1192 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1193 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1194 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1197 *sustain_list++ = "Á´Ç½ÎÏ";
1199 *sustain_list++ = "All stats";
1203 /* Should we bother? */
1204 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1205 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1206 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1208 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1210 N_ELEMENTS(sustain_flags_desc));
1213 /* Terminate the description list */
1214 *sustain_list = NULL;
1219 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1220 * free action, permanent light, etc.
1222 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1224 u32b flgs[TR_FLAG_SIZE];
1228 object_flags(o_ptr, flgs);
1230 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1231 N_ELEMENTS(misc_flags2_desc));
1233 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1234 N_ELEMENTS(misc_flags3_desc));
1237 * Glowing artifacts -- small radius light.
1240 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1241 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1242 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1243 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1244 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1245 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1247 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1249 if (have_flag(flgs, TR_LITE_FUEL))
1251 if(rad > 0) sprintf(desc, _("¤½¤ì¤ÏdzÎÁÊäµë¤Ë¤è¤Ã¤ÆÌÀ¤«¤ê(Ⱦ·Â %d)¤ò¼ø¤±¤ë¡£", "It provides light (radius %d) when fueled."), rad);
1255 if(rad > 0) sprintf(desc, _("±Êµ×¸÷¸»(Ⱦ·Â %d)", "Permanent Light(radius %d)"), rad);
1256 if(rad < 0) sprintf(desc, _("±Êµ×¸÷¸»(Ⱦ·Â-%d)¡£", "Permanent Light(radius -%d)"), -rad);
1259 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1262 * Handle cursed objects here to avoid redundancies such as noting
1263 * that a permanently cursed object is heavily cursed as well as
1264 * being "lightly cursed".
1267 /* if (object_is_cursed(o_ptr)) */
1269 if (have_flag(flgs, TR_TY_CURSE))
1271 *misc_list++ = _("ÂÀ¸Å¤Î±åÇ°", "Ancient Curse");
1273 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1275 *misc_list++ = _("±Ê±ó¤Î¼ö¤¤", "Permanently Cursed");
1277 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1279 *misc_list++ = _("¶¯ÎϤʼö¤¤", "Heavily Cursed");
1282 else if (o_ptr->curse_flags & TRC_CURSED)
1284 *misc_list++ = _("¼ö¤¤", "Cursed");
1286 if (have_flag(flgs, TR_ADD_L_CURSE))
1288 *misc_list++ = _("¼ö¤¤¤òÁý¤ä¤¹", "Cursing");
1290 if (have_flag(flgs, TR_ADD_H_CURSE))
1292 *misc_list++ = _("¶¯ÎϤʼö¤¤¤òÁý¤ä¤¹", "Heavily Cursing");
1296 /* Terminate the description list */
1302 * Note additional ability and/or resistance of fixed artifacts
1304 static void analyze_addition(object_type *o_ptr, char *addition)
1306 artifact_type *a_ptr = &a_info[o_ptr->name1];
1309 strcpy(addition, "");
1312 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "ǽÎÏandÂÑÀ");
1313 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1315 strcat(addition, "ǽÎÏ");
1316 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2¤ÇandÂÑÀ)");
1318 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1320 strcat(addition, "ÂÑÀ");
1321 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2¤ÇandǽÎÏ)");
1323 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "ǽÎÏorÂÑÀ");
1325 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1326 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1328 strcat(addition, "Ability");
1329 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1331 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1333 strcat(addition, "Resistance");
1334 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1336 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1342 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1343 * and its value in gold pieces
1345 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1347 artifact_type *a_ptr = &a_info[o_ptr->name1];
1350 sprintf(misc_desc, "¥ì¥Ù¥ë %u, ´õ¾¯ÅÙ %u, %d.%d kg, ¡ð%ld",
1351 a_ptr->level, a_ptr->rarity,
1352 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1354 sprintf(misc_desc, "Level %u, Rarity %u, %d.%d lbs, %ld Gold",
1355 a_ptr->level, a_ptr->rarity,
1356 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1362 * Fill in an object description structure for a given object
1364 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1366 analyze_general(o_ptr, desc_ptr->description);
1367 analyze_pval(o_ptr, &desc_ptr->pval_info);
1368 analyze_brand(o_ptr, desc_ptr->brands);
1369 analyze_slay(o_ptr, desc_ptr->slays);
1370 analyze_immune(o_ptr, desc_ptr->immunities);
1371 analyze_resist(o_ptr, desc_ptr->resistances);
1372 analyze_sustains(o_ptr, desc_ptr->sustains);
1373 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1374 analyze_addition(o_ptr, desc_ptr->addition);
1375 analyze_misc(o_ptr, desc_ptr->misc_desc);
1376 desc_ptr->activation = item_activation(o_ptr);
1380 static void print_header(void)
1384 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1385 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1386 spoiler_underline(buf);
1390 * This is somewhat ugly.
1392 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1393 * and a separator character (',', e.g.), write the list to the spoiler file
1394 * in a "nice" format, such as:
1396 * Resist Fire, Cold, Acid
1398 * That was a simple example, but when the list is long, a line wrap
1399 * should occur, and this should induce a new level of indention if
1400 * a list is being spread across lines. So for example, Bladeturner's
1401 * list of resistances should look something like this
1403 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1404 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1406 * However, the code distinguishes between a single list of many items vs.
1407 * many lists. (The separator is used to make this determination.) A single
1408 * list of many items will not cause line wrapping (since there is no
1409 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1410 * might look like this:
1412 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1415 * So comparing the two, "Regeneration" has no trailing separator and
1416 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1417 * but that's not relevant to line wrapping and indention.)
1420 /* ITEM_SEP separates items within a list */
1421 #define ITEM_SEP ','
1424 /* LIST_SEP separates lists */
1426 #define LIST_SEP ','
1428 #define LIST_SEP ';'
1431 static void spoiler_outlist(cptr header, cptr *list, char separator)
1433 int line_len, buf_len;
1434 char line[MAX_LINE_LEN+1], buf[80];
1436 /* Ignore an empty list */
1437 if (*list == NULL) return;
1439 /* This function always indents */
1440 strcpy(line, INDENT1);
1442 /* Create header (if one was given) */
1443 if (header && (header[0]))
1445 strcat(line, header);
1449 line_len = strlen(line);
1451 /* Now begin the tedious task */
1454 /* Copy the current item to a buffer */
1457 /* Note the buffer's length */
1458 buf_len = strlen(buf);
1461 * If there is an item following this one, pad with separator and
1462 * a space and adjust the buffer length
1467 sprintf(buf + buf_len, "%c ", separator);
1472 * If the buffer will fit on the current line, just append the
1473 * buffer to the line and adjust the line length accordingly.
1476 if (line_len + buf_len <= MAX_LINE_LEN)
1479 line_len += buf_len;
1482 /* Apply line wrapping and indention semantics described above */
1486 * Don't print a trailing list separator but do print a trailing
1489 if (line_len > 1 && line[line_len - 1] == ' '
1490 && line[line_len - 2] == LIST_SEP)
1492 /* Ignore space and separator */
1493 line[line_len - 2] = '\0';
1495 /* Write to spoiler file */
1496 fprintf(fff, "%s\n", line);
1498 /* Begin new line at primary indention level */
1499 sprintf(line, "%s%s", INDENT1, buf);
1504 /* Write to spoiler file */
1505 fprintf(fff, "%s\n", line);
1507 /* Begin new line at secondary indention level */
1508 sprintf(line, "%s%s", INDENT2, buf);
1511 line_len = strlen(line);
1514 /* Advance, with break */
1515 if (!*++list) break;
1518 /* Write what's left to the spoiler file */
1519 fprintf(fff, "%s\n", line);
1523 /* Create a spoiler file entry for an artifact */
1525 static void spoiler_print_art(obj_desc_list *art_ptr)
1527 pval_info_type *pval_ptr = &art_ptr->pval_info;
1531 /* Don't indent the first line */
1532 fprintf(fff, "%s\n", art_ptr->description);
1534 /* An "empty" pval description indicates that the pval affects nothing */
1535 if (pval_ptr->pval_desc[0])
1537 /* Mention the effects of pval */
1539 sprintf(buf, "%s¤Î½¤Àµ:", pval_ptr->pval_desc);
1541 sprintf(buf, "%s to", pval_ptr->pval_desc);
1543 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1546 /* Now deal with the description lists */
1549 spoiler_outlist("ÂÐ:", art_ptr->slays, ITEM_SEP);
1550 spoiler_outlist("Éð´ï°À:", art_ptr->brands, LIST_SEP);
1551 spoiler_outlist("ÌȱÖ:", art_ptr->immunities, ITEM_SEP);
1552 spoiler_outlist("ÂÑÀ:", art_ptr->resistances, ITEM_SEP);
1553 spoiler_outlist("°Ý»ý:", art_ptr->sustains, ITEM_SEP);
1555 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1556 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1557 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1558 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1559 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1561 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1563 if (art_ptr->addition[0])
1566 fprintf(fff, "%sÄɲÃ: %s\n", INDENT1, art_ptr->addition);
1568 fprintf(fff, "%sAdditional %s\n", INDENT1, art_ptr->addition);
1572 /* Write out the possible activation at the primary indention level */
1573 if (art_ptr->activation)
1576 fprintf(fff, "%sȯư: %s\n", INDENT1, art_ptr->activation);
1578 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
1582 /* End with the miscellaneous facts */
1583 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1588 * Hack -- Create a "forged" artifact
1590 static bool make_fake_artifact(object_type *o_ptr, int name1)
1594 artifact_type *a_ptr = &a_info[name1];
1597 /* Ignore "empty" artifacts */
1598 if (!a_ptr->name) return FALSE;
1600 /* Acquire the "kind" index */
1601 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1604 if (!i) return (FALSE);
1606 /* Create the artifact */
1607 object_prep(o_ptr, i);
1610 o_ptr->name1 = name1;
1612 /* Extract the fields */
1613 o_ptr->pval = a_ptr->pval;
1614 o_ptr->ac = a_ptr->ac;
1615 o_ptr->dd = a_ptr->dd;
1616 o_ptr->ds = a_ptr->ds;
1617 o_ptr->to_a = a_ptr->to_a;
1618 o_ptr->to_h = a_ptr->to_h;
1619 o_ptr->to_d = a_ptr->to_d;
1620 o_ptr->weight = a_ptr->weight;
1628 * Create a spoiler file for artifacts
1630 static void spoil_artifact(cptr fname)
1637 obj_desc_list artifact;
1642 /* Build the filename */
1643 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1645 /* File type is "TEXT" */
1646 FILE_TYPE(FILE_TYPE_TEXT);
1649 fff = my_fopen(buf, "w");
1654 msg_print("Cannot create spoiler file.");
1658 /* Dump the header */
1661 /* List the artifacts by tval */
1662 for (i = 0; group_artifact[i].tval; i++)
1664 /* Write out the group title */
1665 if (group_artifact[i].name)
1667 spoiler_blanklines(2);
1668 spoiler_underline(group_artifact[i].name);
1669 spoiler_blanklines(1);
1672 /* Now search through all of the artifacts */
1673 for (j = 1; j < max_a_idx; ++j)
1675 artifact_type *a_ptr = &a_info[j];
1677 /* We only want objects in the current group */
1678 if (a_ptr->tval != group_artifact[i].tval) continue;
1680 /* Get local object */
1683 /* Wipe the object */
1686 /* Attempt to "forge" the artifact */
1687 if (!make_fake_artifact(q_ptr, j)) continue;
1689 /* Analyze the artifact */
1690 object_analyze(q_ptr, &artifact);
1692 /* Write out the artifact description to the spoiler file */
1693 spoiler_print_art(&artifact);
1697 /* Check for errors */
1698 if (ferror(fff) || my_fclose(fff))
1700 msg_print("Cannot close spoiler file.");
1705 msg_print("Successfully created a spoiler file.");
1713 * Create a spoiler file for monsters -BEN-
1715 static void spoil_mon_desc(cptr fname)
1732 /* Build the filename */
1733 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1735 /* File type is "TEXT" */
1736 FILE_TYPE(FILE_TYPE_TEXT);
1739 fff = my_fopen(buf, "w");
1744 msg_print("Cannot create spoiler file.");
1748 /* Allocate the "who" array */
1749 C_MAKE(who, max_r_idx, s16b);
1751 /* Dump the header */
1752 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1753 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1754 fprintf(fff, "------------------------------------------\n\n");
1756 /* Dump the header */
1757 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1758 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1759 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1760 "--------", "---", "---", "---", "--", "--", "-----------");
1763 /* Scan the monsters */
1764 for (i = 1; i < max_r_idx; i++)
1766 monster_race *r_ptr = &r_info[i];
1768 /* Use that monster */
1769 if (r_ptr->name) who[n++] = i;
1772 /* Select the sort method */
1773 ang_sort_comp = ang_sort_comp_hook;
1774 ang_sort_swap = ang_sort_swap_hook;
1776 /* Sort the array by dungeon depth of monsters */
1777 ang_sort(who, &why, n);
1780 for (i = 0; i < n; i++)
1782 monster_race *r_ptr = &r_info[who[i]];
1784 cptr name = (r_name + r_ptr->name);
1785 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1787 /* Get the "name" */
1789 else if (r_ptr->flags1 & (RF1_QUESTOR))
1791 sprintf(nam, "[Q] %s", name);
1794 else if (r_ptr->flags1 & (RF1_UNIQUE))
1796 sprintf(nam, "[U] %s", name);
1801 sprintf(nam, " %s", name);
1803 sprintf(nam, "The %s", name);
1809 sprintf(lev, "%d", r_ptr->level);
1812 sprintf(rar, "%d", r_ptr->rarity);
1815 if (r_ptr->speed >= 110)
1817 sprintf(spd, "+%d", (r_ptr->speed - 110));
1821 sprintf(spd, "-%d", (110 - r_ptr->speed));
1825 sprintf(ac, "%d", r_ptr->ac);
1828 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1830 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1834 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1839 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1841 /* Hack -- use visual instead */
1842 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1845 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1846 nam, lev, rar, spd, hp, ac, exp);
1853 /* Free the "who" array */
1854 C_KILL(who, max_r_idx, s16b);
1856 /* Check for errors */
1857 if (ferror(fff) || my_fclose(fff))
1859 msg_print("Cannot close spoiler file.");
1864 msg_print("Successfully created a spoiler file.");
1871 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1873 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1879 * Buffer text to the given file. (-SHAWN-)
1880 * This is basically c_roff() from mon-desc.c with a few changes.
1882 static void spoil_out(cptr str)
1887 static char roff_buf[256];
1890 static char roff_waiting_buf[256];
1893 bool iskanji_flag = FALSE;
1895 /* Current pointer into line roff_buf */
1896 static char *roff_p = roff_buf;
1898 /* Last space saved into roff_buf */
1899 static char *roff_s = NULL;
1901 /* Mega-Hack -- Delayed output */
1902 static bool waiting_output = FALSE;
1904 /* Special handling for "new sequence" */
1909 fputs(roff_waiting_buf, fff);
1910 waiting_output = FALSE;
1913 if (roff_p != roff_buf) roff_p--;
1914 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1916 if (roff_p == roff_buf) fprintf(fff, "\n");
1919 *(roff_p + 1) = '\0';
1920 fprintf(fff, "%s\n\n", roff_buf);
1929 /* Scan the given string, character at a time */
1934 bool k_flag = iskanji((unsigned char)(*str));
1937 bool wrap = (ch == '\n');
1940 if (!isprint(ch) && !k_flag && !iskanji_flag) ch = ' ';
1941 iskanji_flag = k_flag && !iskanji_flag;
1943 if (!isprint(ch)) ch = ' ';
1948 fputs(roff_waiting_buf, fff);
1949 if (!wrap) fputc('\n', fff);
1950 waiting_output = FALSE;
1956 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1957 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
1959 if (roff_p >= roff_buf + 75) wrap = TRUE;
1960 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
1967 bool iskanji_flag_local = FALSE;
1968 cptr tail = str + (k_flag ? 2 : 1);
1970 cptr tail = str + 1;
1973 for (; *tail; tail++)
1975 if (*tail == ' ') continue;
1978 k_flag_local = iskanji((unsigned char)(*tail));
1979 if (isprint(*tail) || k_flag_local || iskanji_flag_local) break;
1980 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
1982 if (isprint(*tail)) break;
1986 if (!*tail) waiting_output = TRUE;
1990 /* Handle line-wrap */
1998 if (roff_s && (ch != ' '))
2006 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2007 else strcpy(roff_waiting_buf, roff_buf);
2011 if (cbak != ' ') *roff_p++ = cbak;
2013 while (*r) *roff_p++ = *r++;
2017 if ((roff_p > roff_buf) || (ch != ' '))
2022 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2027 strncmp(str, "¡£", 2) != 0 &&
2028 strncmp(str, "¡¢", 2) != 0 &&
2029 strncmp(str, "¥£", 2) != 0 &&
2030 strncmp(str, "¡¼", 2) != 0) roff_s = roff_p;
2033 if (ch == ' ') roff_s = roff_p;
2044 * Hook function used in spoil_mon_info()
2046 static void roff_func(byte attr, cptr str)
2056 * Create a spoiler file for monsters (-SHAWN-)
2058 static void spoil_mon_info(cptr fname)
2067 /* Build the filename */
2068 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2070 /* File type is "TEXT" */
2071 FILE_TYPE(FILE_TYPE_TEXT);
2074 fff = my_fopen(buf, "w");
2079 msg_print("Cannot create spoiler file.");
2084 /* Dump the header */
2085 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2086 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2089 spoil_out("------------------------------------------\n\n");
2091 /* Allocate the "who" array */
2092 C_MAKE(who, max_r_idx, s16b);
2094 /* Scan the monsters */
2095 for (i = 1; i < max_r_idx; i++)
2097 monster_race *r_ptr = &r_info[i];
2099 /* Use that monster */
2100 if (r_ptr->name) who[n++] = i;
2103 /* Select the sort method */
2104 ang_sort_comp = ang_sort_comp_hook;
2105 ang_sort_swap = ang_sort_swap_hook;
2107 /* Sort the array by dungeon depth of monsters */
2108 ang_sort(who, &why, n);
2112 * List all monsters in order
2114 for (l = 0; l < n; l++)
2116 monster_race *r_ptr = &r_info[who[l]];
2118 /* Extract the flags */
2119 flags1 = r_ptr->flags1;
2123 if (flags1 & (RF1_QUESTOR))
2129 if (flags1 & (RF1_UNIQUE))
2142 sprintf(buf, "%s/%s (", (r_name + r_ptr->name),(r_name+r_ptr->E_name)); /* ---)--- */
2144 sprintf(buf, "%s (", (r_name + r_ptr->name)); /* ---)--- */
2150 spoil_out(attr_to_text(r_ptr));
2153 sprintf(buf, " '%c')\n", r_ptr->d_char);
2158 sprintf(buf, "=== ");
2162 sprintf(buf, "Num:%d ", who[l]);
2166 sprintf(buf, "Lev:%d ", r_ptr->level);
2170 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2174 if (r_ptr->speed >= 110)
2176 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2180 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2185 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2187 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2191 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2196 sprintf(buf, "Ac:%d ", r_ptr->ac);
2200 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2203 /* Reuse the code of monster recall. */
2204 output_monster_spoiler(who[l], roff_func);
2209 /* Free the "who" array */
2210 C_KILL(who, max_r_idx, s16b);
2212 /* Check for errors */
2213 if (ferror(fff) || my_fclose(fff))
2215 msg_print("Cannot close spoiler file.");
2219 msg_print("Successfully created a spoiler file.");
2224 #define MAX_EVOL_DEPTH 64
2228 * Compare two int-type array like strncmp() and return TRUE if equals
2230 static bool int_n_cmp(int *a, int *b, int length)
2232 /* Null-string comparation is always TRUE */
2233 if (!length) return TRUE;
2237 if (*a != *(b++)) return FALSE;
2238 if (!(*(a++))) break;
2247 * Returns TRUE if an evolution tree is "partial tree"
2249 static bool is_partial_tree(int *tree, int *partial_tree)
2251 int pt_head = *(partial_tree++);
2254 while (partial_tree[pt_len]) pt_len++;
2258 if (*(tree++) == pt_head)
2260 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2269 * Sorting hook -- Comp function
2271 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2273 int **evol_tree = (int **)u;
2275 int w1 = evol_tree[a][0];
2276 int w2 = evol_tree[b][0];
2277 monster_race *r1_ptr = &r_info[w1];
2278 monster_race *r2_ptr = &r_info[w2];
2283 /* Used tree first */
2284 if (w1 && !w2) return TRUE;
2285 if (!w1 && w2) return FALSE;
2287 /* Sort by monster level */
2288 if (r1_ptr->level < r2_ptr->level) return TRUE;
2289 if (r1_ptr->level > r2_ptr->level) return FALSE;
2291 /* Sort by monster experience */
2292 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2293 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2295 /* Compare indexes */
2301 * Sorting hook -- Swap function
2303 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2305 int **evol_tree = (int **)u;
2312 holder = evol_tree[a];
2313 evol_tree[a] = evol_tree[b];
2314 evol_tree[b] = holder;
2319 * Print monsters' evolution information to file
2321 static void spoil_mon_evol(cptr fname)
2324 monster_race *r_ptr;
2325 int **evol_tree, i, j, n, r_idx;
2326 int *evol_tree_zero; /* For C_KILL() */
2328 /* Build the filename */
2329 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2331 /* File type is "TEXT" */
2332 FILE_TYPE(FILE_TYPE_TEXT);
2335 fff = my_fopen(buf, "w");
2340 msg_print("Cannot create spoiler file.");
2344 /* Dump the header */
2345 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2346 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2349 spoil_out("------------------------------------------\n\n");
2351 /* Allocate the "evol_tree" array (2-dimension) */
2352 C_MAKE(evol_tree, max_r_idx, int *);
2353 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2354 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2355 evol_tree_zero = *evol_tree;
2357 /* Step 1: Build the evolution tree */
2358 for (i = 1; i < max_r_idx; i++)
2363 if (!r_ptr->next_exp) continue;
2365 /* Trace evolution */
2367 evol_tree[i][n++] = i;
2370 evol_tree[i][n++] = r_ptr->next_r_idx;
2371 r_ptr = &r_info[r_ptr->next_r_idx];
2373 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2376 /* Step 2: Scan the evolution trees and remove "partial tree" */
2377 for (i = 1; i < max_r_idx; i++)
2379 /* Not evolution tree */
2380 if (!evol_tree[i][0]) continue;
2382 for (j = 1; j < max_r_idx; j++)
2385 if (i == j) continue;
2387 /* Not evolution tree */
2388 if (!evol_tree[j][0]) continue;
2390 /* Is evolution tree[i] is part of [j]? */
2391 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2393 /* Remove this evolution tree */
2394 evol_tree[i][0] = 0;
2400 /* Step 3: Sort the evolution trees */
2402 /* Select the sort method */
2403 ang_sort_comp = ang_sort_comp_evol_tree;
2404 ang_sort_swap = ang_sort_swap_evol_tree;
2406 /* Sort the array */
2407 ang_sort(evol_tree, NULL, max_r_idx);
2409 /* Step 4: Print the evolution trees */
2410 for (i = 0; i < max_r_idx; i++)
2412 r_idx = evol_tree[i][0];
2414 /* No evolution or removed evolution tree */
2415 if (!r_idx) continue;
2417 /* Trace the evolution tree */
2418 r_ptr = &r_info[r_idx];
2420 fprintf(fff, "[%d]: %s (¥ì¥Ù¥ë%d, '%c')\n", r_idx,
2421 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2423 fprintf(fff, "[%d]: %s (Level %d, '%c')\n", r_idx,
2424 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2426 for (n = 1; r_ptr->next_exp; n++)
2428 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2429 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2430 r_ptr = &r_info[r_ptr->next_r_idx];
2432 fprintf(fff, "%s (¥ì¥Ù¥ë%d, '%c')\n",
2433 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2435 fprintf(fff, "%s (Level %d, '%c')\n",
2436 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2440 /* End of evolution tree */
2444 /* Free the "evol_tree" array (2-dimension) */
2445 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2446 C_KILL(evol_tree, max_r_idx, int *);
2448 /* Check for errors */
2449 if (ferror(fff) || my_fclose(fff))
2451 msg_print("Cannot close spoiler file.");
2456 msg_print("Successfully created a spoiler file.");
2464 extern void do_cmd_spoilers(void);
2467 * Create Spoiler files -BEN-
2469 void do_cmd_spoilers(void)
2471 /* Save the screen */
2481 prt("Create a spoiler file.", 2, 0);
2483 /* Prompt for a file */
2484 prt("(1) Brief Object Info (obj-desc.spo)", 5, 5);
2485 prt("(2) Brief Artifact Info (artifact.spo)", 6, 5);
2486 prt("(3) Brief Monster Info (mon-desc.spo)", 7, 5);
2487 prt("(4) Full Monster Info (mon-info.spo)", 8, 5);
2488 prt("(5) Monster Evolution Info (mon-evol.spo)", 9, 5);
2492 prt("¥³¥Þ¥ó¥É:", 18, 0);
2494 prt("Command: ", 12, 0);
2502 /* Restore the screen */
2508 spoil_obj_desc("obj-desc.spo");
2513 spoil_artifact("artifact.spo");
2518 spoil_mon_desc("mon-desc.spo");
2523 spoil_mon_info("mon-info.spo");
2528 spoil_mon_evol("mon-evol.spo");
2537 /* Flush messages */
2543 * Fill in an object description structure for a given object
2545 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2547 analyze_general(o_ptr, desc_ptr->description);
2548 analyze_pval(o_ptr, &desc_ptr->pval_info);
2549 analyze_brand(o_ptr, desc_ptr->brands);
2550 analyze_slay(o_ptr, desc_ptr->slays);
2551 analyze_immune(o_ptr, desc_ptr->immunities);
2552 analyze_resist(o_ptr, desc_ptr->resistances);
2553 analyze_sustains(o_ptr, desc_ptr->sustains);
2554 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2555 desc_ptr->activation = item_activation(o_ptr);
2557 sprintf(desc_ptr->misc_desc, "½Å¤µ %d.%d kg",
2558 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2560 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2561 o_ptr->weight / 10, o_ptr->weight % 10);
2565 /* Create a spoiler file entry for an artifact */
2567 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2569 pval_info_type *pval_ptr = &art_ptr->pval_info;
2573 /* Don't indent the first line */
2574 fprintf(fff, "%s\n", art_ptr->description);
2577 if (!(o_ptr->ident & (IDENT_MENTAL)))
2580 fprintf(fff, "%sÉÔÌÀ\n",INDENT1);
2582 fprintf(fff, "%sUnknown\n",INDENT1);
2586 /* An "empty" pval description indicates that the pval affects nothing */
2587 if (pval_ptr->pval_desc[0])
2589 /* Mention the effects of pval */
2591 sprintf(buf, "%s¤Î½¤Àµ:", pval_ptr->pval_desc);
2593 sprintf(buf, "%s to", pval_ptr->pval_desc);
2595 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2598 /* Now deal with the description lists */
2601 spoiler_outlist("ÂÐ:", art_ptr->slays, ITEM_SEP);
2602 spoiler_outlist("Éð´ï°À:", art_ptr->brands, LIST_SEP);
2603 spoiler_outlist("ÌȱÖ:", art_ptr->immunities, ITEM_SEP);
2604 spoiler_outlist("ÂÑÀ:", art_ptr->resistances, ITEM_SEP);
2605 spoiler_outlist("°Ý»ý:", art_ptr->sustains, ITEM_SEP);
2607 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2608 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2609 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2610 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2611 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2613 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2615 /* Write out the possible activation at the primary indention level */
2616 if (art_ptr->activation)
2619 fprintf(fff, "%sȯư: %s\n", INDENT1, art_ptr->activation);
2621 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
2625 /* End with the miscellaneous facts */
2626 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2629 /* Create a part of file for random artifacts */
2631 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2633 obj_desc_list artifact;
2635 if (!object_is_known(o_ptr) || !o_ptr->art_name
2636 || o_ptr->tval != group_artifact[i].tval)
2639 /* Analyze the artifact */
2640 random_artifact_analyze(o_ptr, &artifact);
2642 /* Write out the artifact description to the spoiler file */
2643 spoiler_print_randart(o_ptr, &artifact);
2647 * Create a list file for random artifacts
2649 void spoil_random_artifact(cptr fname)
2659 /* Build the filename */
2660 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2662 /* File type is "TEXT" */
2663 FILE_TYPE(FILE_TYPE_TEXT);
2666 fff = my_fopen(buf, "w");
2671 msg_print("Cannot create list file.");
2675 /* Dump the header */
2676 sprintf(buf, "Random artifacts list.\r");
2677 spoiler_underline(buf);
2679 /* List the artifacts by tval */
2680 for (j = 0; group_artifact[j].tval; j++)
2682 /* random artifacts wielding */
2683 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2685 q_ptr = &inventory[i];
2686 spoil_random_artifact_aux(q_ptr, j);
2689 /* random artifacts in inventory */
2690 for (i = 0; i < INVEN_PACK; i++)
2692 q_ptr = &inventory[i];
2693 spoil_random_artifact_aux(q_ptr, j);
2696 /* random artifacts in home */
2697 st_ptr = &town[1].store[STORE_HOME];
2698 for (i = 0; i < st_ptr->stock_num; i++)
2700 q_ptr = &st_ptr->stock[i];
2701 spoil_random_artifact_aux(q_ptr, j);
2704 /* random artifacts in museum */
2705 st_ptr = &town[1].store[STORE_MUSEUM];
2706 for (i = 0; i < st_ptr->stock_num; i++)
2708 q_ptr = &st_ptr->stock[i];
2709 spoil_random_artifact_aux(q_ptr, j);
2713 /* Check for errors */
2714 if (ferror(fff) || my_fclose(fff))
2716 msg_print("Cannot close list file.");
2721 msg_print("Successfully created a list file.");
2728 #endif /* MACINTOSH */