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.
21 * The spoiler file being created
23 static FILE *fff = NULL;
28 * @brief シンボル職の記述名を返す /
29 * Extract a textual representation of an attribute
30 * @param r_ptr モンスター種族の構造体ポインタ
33 static concptr attr_to_text(monster_race *r_ptr)
36 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "透明な";
37 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "万色の";
38 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "準ランダムな";
40 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "Clear";
41 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "Multi";
42 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "S.Rand";
45 switch (r_ptr->d_attr)
48 case TERM_DARK: return "XXXい";
49 case TERM_WHITE: return "白い";
50 case TERM_SLATE: return "青灰色の";
51 case TERM_ORANGE: return "オレンジの";
52 case TERM_RED: return "赤い";
53 case TERM_GREEN: return "緑の";
54 case TERM_BLUE: return "青い";
55 case TERM_UMBER: return "琥珀色の";
56 case TERM_L_DARK: return "灰色の";
57 case TERM_L_WHITE: return "明青灰色の";
58 case TERM_VIOLET: return "紫の";
59 case TERM_YELLOW: return "黄色い";
60 case TERM_L_RED: return "明い赤の";
61 case TERM_L_GREEN: return "明い緑の";
62 case TERM_L_BLUE: return "明い青の";
63 case TERM_L_UMBER: return "明い琥珀色の";
65 case TERM_DARK: return "xxx";
66 case TERM_WHITE: return "White";
67 case TERM_SLATE: return "Slate";
68 case TERM_ORANGE: return "Orange";
69 case TERM_RED: return "Red";
70 case TERM_GREEN: return "Green";
71 case TERM_BLUE: return "Blue";
72 case TERM_UMBER: return "Umber";
73 case TERM_L_DARK: return "L.Dark";
74 case TERM_L_WHITE: return "L.Slate";
75 case TERM_VIOLET: return "Violet";
76 case TERM_YELLOW: return "Yellow";
77 case TERM_L_RED: return "L.Red";
78 case TERM_L_GREEN: return "L.Green";
79 case TERM_L_BLUE: return "L.Blue";
80 case TERM_L_UMBER: return "L.Umber";
98 OBJECT_TYPE_VALUE tval;
105 * Item Spoilers by: benh@phial.com (Ben Harrison)
110 * The basic items categorized by type
112 static grouper group_item[] =
114 { TV_SHOT, _("射撃物", "Ammo") },
117 { TV_BOW, _("弓", "Bows") },
118 { TV_DIGGING, _("武器", "Weapons") },
119 { TV_POLEARM, NULL },
122 { TV_SOFT_ARMOR, _("防具 (体)", "Armour (Body)") },
123 { TV_HARD_ARMOR, NULL },
124 { TV_DRAG_ARMOR, NULL },
125 { TV_BOOTS, _("防具 (その他)", "Armour (Misc)") },
132 { TV_LITE, _("光源", "Light Sources") },
133 { TV_AMULET, _("アミュレット", "Amulets" )},
134 { TV_RING, _("指輪", "Rings") },
135 { TV_STAFF, _("杖", "Staffs") },
136 { TV_WAND, _("魔法棒", "Wands") },
137 { TV_ROD, _("ロッド", "Rods") },
138 { TV_SCROLL, _("巻物", "Scrolls") },
139 { TV_POTION, _("薬", "Potions") },
140 { TV_FOOD, _("食料", "Food") },
142 { TV_LIFE_BOOK, _("魔法書 (生命)", "Books (Life)") },
143 { TV_SORCERY_BOOK, _("魔法書 (仙術)", "Books (Sorcery)") },
144 { TV_NATURE_BOOK, _("魔法書 (自然)", "Books (Nature)") },
145 { TV_CHAOS_BOOK, _("魔法書 (カオス)", "Books (Chaos)") },
146 { TV_DEATH_BOOK, _("魔法書 (暗黒)", "Books (Death)") },
147 { TV_TRUMP_BOOK, _("魔法書 (トランプ)", "Books (Trump)") },
148 { TV_ARCANE_BOOK, _("魔法書 (秘術)", "Books (Arcane)") },
149 { TV_CRAFT_BOOK, _("魔法書 (匠)", "Books (Craft)") },
150 { TV_DAEMON_BOOK, _("魔法書 (悪魔)", "Books (Daemon)") },
151 { TV_CRUSADE_BOOK, _("魔法書 (破邪)", "Books (Crusade)") },
152 { TV_MUSIC_BOOK, _("歌集", "Song Books") },
153 { TV_HISSATSU_BOOK, _("武芸の書", "Books (Kendo)") },
154 { TV_HEX_BOOK, _("魔法書 (呪術)", "Books (Hex)") },
156 { TV_WHISTLE, _("笛", "Whistle") },
157 { TV_CAPTURE, _("キャプチャー・ボール", "Capture Ball") },
158 { TV_CARD, _("エクスプレスカード", "Express Card") },
160 { TV_CHEST, _("箱", "Chests") },
162 { TV_FIGURINE, _("人形", "Magical Figurines") },
163 { TV_STATUE, _("像", "Statues") },
164 { TV_CORPSE, _("死体", "Corpses") },
166 { TV_SKELETON, _("その他", "Misc") },
171 { TV_PARCHMENT, NULL },
178 * @brief ベースアイテムの各情報を文字列化する /
180 * @param buf 名称を返すバッファ参照ポインタ
181 * @param dam ダメージダイス記述を返すバッファ参照ポインタ
182 * @param wgt 重量記述を返すバッファ参照ポインタ
183 * @param lev 生成階記述を返すバッファ参照ポインタ
184 * @param chance 生成機会を返すバッファ参照ポインタ
185 * @param val 価値を返すバッファ参照ポインタ
189 static void kind_info(char *buf, char *dam, char *wgt, char *chance, DEPTH *lev, PRICE *val, OBJECT_IDX k)
196 /* Prepare a fake item */
197 object_prep(q_ptr, k);
200 q_ptr->ident |= (IDENT_KNOWN);
208 (*lev) = k_info[q_ptr->k_idx].level;
209 (*val) = object_value(q_ptr);
212 if (!buf || !dam || !chance || !wgt) return;
214 /* Description (too brief) */
215 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
234 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
244 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
259 sprintf(dam, "%d", q_ptr->ac);
266 for(i = 0; i < 4; i++)
268 char chance_aux[20] = "";
269 if(k_info[q_ptr->k_idx].chance[i] > 0)
271 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""),
272 (int)k_info[q_ptr->k_idx].locale[i], 100/k_info[q_ptr->k_idx].chance[i]);
273 strcat(chance, chance_aux);
279 sprintf(wgt, "%3d.%d", (int)(q_ptr->weight / 10), (int)(q_ptr->weight % 10));
284 * @brief 各ベースアイテムの情報を一行毎に記述する /
285 * Create a spoiler file for items
289 static void spoil_obj_desc(concptr fname)
291 int i, k, s, t, n = 0, group_start = 0;
302 /* Build the filename */
303 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
305 /* File type is "TEXT" */
306 FILE_TYPE(FILE_TYPE_TEXT);
309 fff = my_fopen(buf, "w");
313 msg_print("Cannot create spoiler file.");
319 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
320 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
323 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
324 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
325 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
326 "-------------------------------------", "------", "---", "---", "----------------", "----");
328 /* List the groups */
329 for (i = 0; TRUE; i++)
331 /* Write out the group title */
332 if (group_item[i].name)
336 /* Hack -- bubble-sort by cost and then level */
337 for (s = 0; s < n - 1; s++)
339 for (t = 0; t < n - 1; t++)
350 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
351 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
353 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
362 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
364 /* Spoil each item */
365 for (s = 0; s < n; s++)
370 /* Describe the kind */
371 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
374 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
375 buf, dam, wgt, (int)e, chance, (long)(v));
378 /* Start a new set */
383 if (!group_item[i].tval) break;
385 /* Start a new set */
389 /* Acquire legal item types */
390 for (k = 1; k < max_k_idx; k++)
392 object_kind *k_ptr = &k_info[k];
394 /* Skip wrong tval's */
395 if (k_ptr->tval != group_item[i].tval) continue;
397 /* Hack -- Skip instant-artifacts */
398 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
406 /* Check for errors */
407 if (ferror(fff) || my_fclose(fff))
409 msg_print("Cannot close spoiler file.");
413 msg_print("Successfully created a spoiler file.");
418 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
423 * Returns a "+" string if a number is non-negative and an empty
426 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
429 * These are used to format the artifact spoiler file. INDENT1 is used
430 * to indent all but the first line of an artifact spoiler. INDENT2 is
431 * used when a line "wraps". (Bladeturner's resistances cause this.)
437 * MAX_LINE_LEN specifies when a line should wrap.
439 #define MAX_LINE_LEN 75
442 * Given an array, determine how many elements are in the array
444 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
447 * The artifacts categorized by type
449 static grouper group_artifact[] =
453 { TV_POLEARM, "槍/斧" },
455 { TV_DIGGING, "シャベル/つるはし" },
460 { TV_SOFT_ARMOR, "鎧" },
461 { TV_HARD_ARMOR, NULL },
462 { TV_DRAG_ARMOR, NULL },
464 { TV_CLOAK, "クローク" },
473 { TV_AMULET, "アミュレット" },
476 { TV_SWORD, "Edged Weapons" },
477 { TV_POLEARM, "Polearms" },
478 { TV_HAFTED, "Hafted Weapons" },
479 { TV_DIGGING, "Shovels/Picks" },
481 { TV_ARROW, "Ammo" },
484 { TV_SOFT_ARMOR, "Body Armor" },
485 { TV_HARD_ARMOR, NULL },
486 { TV_DRAG_ARMOR, NULL },
488 { TV_CLOAK, "Cloaks" },
489 { TV_SHIELD, "Shields" },
491 { TV_HELM, "Helms/Crowns" },
493 { TV_GLOVES, "Gloves" },
494 { TV_BOOTS, "Boots" },
496 { TV_LITE, "Light Sources" },
497 { TV_AMULET, "Amulets" },
498 { TV_RING, "Rings" },
507 * Pair together a constant flag with a textual description.
509 * Used by both "init.c" and "wiz-spo.c".
511 * Note that it sometimes more efficient to actually make an array
512 * of textual names, where entry 'N' is assumed to be paired with
513 * the flag whose value is "1L << N", but that requires hard-coding.
516 typedef struct flag_desc flag_desc;
527 * These are used for "+3 to STR, DEX", etc. These are separate from
528 * the other pval affected traits to simplify the case where an object
529 * affects all stats. In this case, "All stats" is used instead of
530 * listing each stat individually.
533 static flag_desc stat_flags_desc[] =
553 * Besides stats, these are the other player traits
554 * which may be affected by an object's pval
557 static flag_desc pval_flags1_desc[] =
560 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
561 { TR_STEALTH, "隠密" },
563 { TR_INFRA, "赤外線視力" },
565 { TR_BLOWS, "攻撃回数" },
568 { TR_STEALTH, "Stealth" },
569 { TR_SEARCH, "Searching" },
570 { TR_INFRA, "Infravision" },
571 { TR_TUNNEL, "Tunneling" },
572 { TR_BLOWS, "Attacks" },
573 { TR_SPEED, "Speed" }
578 * Slaying preferences for weapons
581 static flag_desc slay_flags_desc[] =
584 { TR_SLAY_ANIMAL, "動物" },
585 { TR_KILL_ANIMAL, "*動物*" },
586 { TR_SLAY_EVIL, "邪悪" },
587 { TR_KILL_EVIL, "*邪悪*" },
588 { TR_SLAY_HUMAN, "人間" },
589 { TR_KILL_HUMAN, "*人間*" },
590 { TR_SLAY_UNDEAD, "アンデッド" },
591 { TR_KILL_UNDEAD, "*アンデッド*" },
592 { TR_SLAY_DEMON, "悪魔" },
593 { TR_KILL_DEMON, "*悪魔*" },
594 { TR_SLAY_ORC, "オーク" },
595 { TR_KILL_ORC, "*オーク*" },
596 { TR_SLAY_TROLL, "トロル" },
597 { TR_KILL_TROLL, "*トロル*" },
598 { TR_SLAY_GIANT, "巨人" },
599 { TR_KILL_GIANT, "*巨人*" },
600 { TR_SLAY_DRAGON, "ドラゴン" },
601 { TR_KILL_DRAGON, "*ドラゴン*" },
603 { TR_SLAY_ANIMAL, "Animal" },
604 { TR_KILL_ANIMAL, "XAnimal" },
605 { TR_SLAY_EVIL, "Evil" },
606 { TR_KILL_EVIL, "XEvil" },
607 { TR_SLAY_HUMAN, "Human" },
608 { TR_KILL_HUMAN, "XHuman" },
609 { TR_SLAY_UNDEAD, "Undead" },
610 { TR_KILL_UNDEAD, "XUndead" },
611 { TR_SLAY_DEMON, "Demon" },
612 { TR_KILL_DEMON, "XDemon" },
613 { TR_SLAY_ORC, "Orc" },
614 { TR_KILL_ORC, "XOrc" },
615 { TR_SLAY_TROLL, "Troll" },
616 { TR_KILL_TROLL, "XTroll" },
617 { TR_SLAY_GIANT, "Giant" },
618 { TR_KILL_GIANT, "Xgiant" },
619 { TR_SLAY_DRAGON, "Dragon" },
620 { TR_KILL_DRAGON, "Xdragon" }
625 * Elemental brands for weapons
627 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
628 * coding, it has been included here along with the elemental
629 * brands. It does seem to fit in with the brands and slaying
630 * more than the miscellaneous section.
632 static flag_desc brand_flags_desc[] =
635 { TR_BRAND_ACID, "溶解" },
636 { TR_BRAND_ELEC, "電撃" },
637 { TR_BRAND_FIRE, "焼棄" },
638 { TR_BRAND_COLD, "凍結" },
639 { TR_BRAND_POIS, "毒殺" },
641 { TR_FORCE_WEAPON, "理力" },
642 { TR_CHAOTIC, "混沌" },
643 { TR_VAMPIRIC, "吸血" },
645 { TR_VORPAL, "切れ味" },
647 { TR_BRAND_ACID, "Acid Brand" },
648 { TR_BRAND_ELEC, "Lightning Brand" },
649 { TR_BRAND_FIRE, "Flame Tongue" },
650 { TR_BRAND_COLD, "Frost Brand" },
651 { TR_BRAND_POIS, "Poisoned" },
653 { TR_FORCE_WEAPON, "Force" },
654 { TR_CHAOTIC, "Mark of Chaos" },
655 { TR_VAMPIRIC, "Vampiric" },
656 { TR_IMPACT, "Earthquake impact on hit" },
657 { TR_VORPAL, "Very sharp" },
665 static const flag_desc resist_flags_desc[] =
668 { TR_RES_ACID, "酸" },
669 { TR_RES_ELEC, "電撃" },
670 { TR_RES_FIRE, "火炎" },
671 { TR_RES_COLD, "冷気" },
672 { TR_RES_POIS, "毒" },
673 { TR_RES_FEAR, "恐怖"},
674 { TR_RES_LITE, "閃光" },
675 { TR_RES_DARK, "暗黒" },
676 { TR_RES_BLIND, "盲目" },
677 { TR_RES_CONF, "混乱" },
678 { TR_RES_SOUND, "轟音" },
679 { TR_RES_SHARDS, "破片" },
680 { TR_RES_NETHER, "地獄" },
681 { TR_RES_NEXUS, "因果混乱" },
682 { TR_RES_CHAOS, "カオス" },
683 { TR_RES_DISEN, "劣化" },
685 { TR_RES_ACID, "Acid" },
686 { TR_RES_ELEC, "Lightning" },
687 { TR_RES_FIRE, "Fire" },
688 { TR_RES_COLD, "Cold" },
689 { TR_RES_POIS, "Poison" },
690 { TR_RES_FEAR, "Fear"},
691 { TR_RES_LITE, "Light" },
692 { TR_RES_DARK, "Dark" },
693 { TR_RES_BLIND, "Blindness" },
694 { TR_RES_CONF, "Confusion" },
695 { TR_RES_SOUND, "Sound" },
696 { TR_RES_SHARDS, "Shards" },
697 { TR_RES_NETHER, "Nether" },
698 { TR_RES_NEXUS, "Nexus" },
699 { TR_RES_CHAOS, "Chaos" },
700 { TR_RES_DISEN, "Disenchantment" },
705 * Elemental immunities (along with poison)
708 static const flag_desc immune_flags_desc[] =
712 { TR_IM_ELEC, "電撃" },
713 { TR_IM_FIRE, "火炎" },
714 { TR_IM_COLD, "冷気" },
716 { TR_IM_ACID, "Acid" },
717 { TR_IM_ELEC, "Lightning" },
718 { TR_IM_FIRE, "Fire" },
719 { TR_IM_COLD, "Cold" },
724 * Sustain stats - these are given their "own" line in the
725 * spoiler file, mainly for simplicity
727 static const flag_desc sustain_flags_desc[] =
730 { TR_SUST_STR, "腕力" },
731 { TR_SUST_INT, "知能" },
732 { TR_SUST_WIS, "賢さ" },
733 { TR_SUST_DEX, "器用さ" },
734 { TR_SUST_CON, "耐久力" },
735 { TR_SUST_CHR, "魅力" },
737 { TR_SUST_STR, "STR" },
738 { TR_SUST_INT, "INT" },
739 { TR_SUST_WIS, "WIS" },
740 { TR_SUST_DEX, "DEX" },
741 { TR_SUST_CON, "CON" },
742 { TR_SUST_CHR, "CHR" },
747 * Miscellaneous magic given by an object's "flags2" field
750 static const flag_desc misc_flags2_desc[] =
754 { TR_REFLECT, "反射" },
755 { TR_FREE_ACT, "麻痺知らず" },
756 { TR_HOLD_EXP, "経験値維持" },
758 { TR_THROW, "Throwing" },
759 { TR_REFLECT, "Reflection" },
760 { TR_FREE_ACT, "Free Action" },
761 { TR_HOLD_EXP, "Hold Experience" },
766 * Miscellaneous magic given by an object's "flags3" field
768 * Note that cursed artifacts and objects with permanent light
769 * are handled "directly" -- see analyze_misc_magic()
772 static const flag_desc misc_flags3_desc[] =
775 { TR_SH_FIRE, "火炎オーラ" },
776 { TR_SH_ELEC, "電撃オーラ" },
777 { TR_SH_COLD, "冷気オーラ" },
778 { TR_NO_TELE, "反テレポート" },
779 { TR_NO_MAGIC, "反魔法" },
780 { TR_LEVITATION, "浮遊" },
781 { TR_SEE_INVIS, "可視透明" },
782 { TR_TELEPATHY, "テレパシー" },
783 { TR_ESP_ANIMAL, "動物感知" },
784 { TR_ESP_UNDEAD, "不死感知" },
785 { TR_ESP_DEMON, "悪魔感知" },
786 { TR_ESP_ORC, "オーク感知" },
787 { TR_ESP_TROLL, "トロル感知" },
788 { TR_ESP_GIANT, "巨人感知" },
789 { TR_ESP_DRAGON, "ドラゴン感知" },
790 { TR_ESP_HUMAN, "人間感知" },
791 { TR_ESP_EVIL, "邪悪感知" },
792 { TR_ESP_GOOD, "善良感知" },
793 { TR_ESP_NONLIVING, "無生物感知" },
794 { TR_ESP_UNIQUE, "ユニーク感知" },
795 { TR_SLOW_DIGEST, "遅消化" },
796 { TR_REGEN, "急速回復" },
797 { TR_WARNING, "警告" },
798 /* { TR_XTRA_MIGHT, "強力射撃" }, */
799 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
800 { TR_DRAIN_EXP, "経験値吸収" },
801 { TR_AGGRAVATE, "反感" },
802 { TR_BLESSED, "祝福" },
803 { TR_DEC_MANA, "消費魔力減少" },
805 { TR_SH_FIRE, "Fiery Aura" },
806 { TR_SH_ELEC, "Electric Aura" },
807 { TR_SH_COLD, "Coldly Aura" },
808 { TR_NO_TELE, "Prevent Teleportation" },
809 { TR_NO_MAGIC, "Anti-Magic" },
810 { TR_LEVITATION, "Levitation" },
811 { TR_SEE_INVIS, "See Invisible" },
812 { TR_TELEPATHY, "ESP" },
813 { TR_ESP_ANIMAL, "Sense Animal" },
814 { TR_ESP_UNDEAD, "Sense Undead" },
815 { TR_ESP_DEMON, "Sense Demon" },
816 { TR_ESP_ORC, "Sense Orc" },
817 { TR_ESP_TROLL, "Sense Troll" },
818 { TR_ESP_GIANT, "Sense Giant" },
819 { TR_ESP_DRAGON, "Sense Dragon" },
820 { TR_ESP_HUMAN, "Sense Human" },
821 { TR_ESP_EVIL, "Sense Evil" },
822 { TR_ESP_GOOD, "Sense Good" },
823 { TR_ESP_NONLIVING, "Sense Nonliving" },
824 { TR_ESP_UNIQUE, "Sense Unique" },
825 { TR_SLOW_DIGEST, "Slow Digestion" },
826 { TR_REGEN, "Regeneration" },
827 { TR_WARNING, "Warning" },
828 /* { TR_XTRA_MIGHT, "Extra Might" }, */
829 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
830 { TR_DRAIN_EXP, "Drains Experience" },
831 { TR_AGGRAVATE, "Aggravates" },
832 { TR_BLESSED, "Blessed Blade" },
833 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
839 * A special type used just for deailing with pvals
844 * This will contain a string such as "+2", "-10", etc.
849 * A list of various player traits affected by an object's pval such
850 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
851 * this list since it will probably be desirable to format its
852 * description differently.
854 * Note that room need only be reserved for the number of stats - 1
855 * since the description "All stats" is used if an object affects all
856 * all stats. Also, room must be reserved for a sentinel NULL pointer.
858 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
860 * This list includes extra attacks, for simplicity.
862 concptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
863 N_ELEMENTS(pval_flags1_desc) + 1];
869 * An "object analysis structure"
871 * It will be filled with descriptive strings detailing an object's
872 * various magical powers. The "ignore X" traits are not noted since
873 * all artifacts ignore "normal" destruction.
878 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
879 char description[MAX_NLEN];
881 /* Description of what is affected by an object's pval */
882 pval_info_type pval_info;
884 /* A list of an object's slaying preferences */
885 concptr slays[N_ELEMENTS(slay_flags_desc) + 1];
887 /* A list if an object's elemental brands */
888 concptr brands[N_ELEMENTS(brand_flags_desc) + 1];
890 /* A list of immunities granted by an object */
891 concptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
893 /* A list of resistances granted by an object */
894 concptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
896 /* A list of stats sustained by an object */
897 concptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
899 /* A list of various magical qualities an object may have */
900 concptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
901 + 1 /* Permanent Light */
903 + 1 /* type of curse */
904 + 1]; /* sentinel NULL */
906 /* Additional ability or resistance */
909 /* A string describing an artifact's activation */
912 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
918 * @brief ファイルポインタ先に同じ文字を複数出力する /
919 * Write out `n' of the character `c' to the spoiler file
924 static void spoiler_out_n_chars(int n, char c)
926 while (--n >= 0) fputc(c, fff);
931 * @brief ファイルポインタ先に改行を複数出力する /
932 * Write out `n' blank lines to the spoiler file
936 static void spoiler_blanklines(int n)
938 spoiler_out_n_chars(n, '\n');
943 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
944 * Write a line to the spoiler file and then "underline" it with hypens
945 * @param str 出力したい文字列
948 static void spoiler_underline(concptr str)
950 fprintf(fff, "%s\n", str);
951 spoiler_out_n_chars(strlen(str), '-');
958 * @brief アーティファクトの特性一覧を出力する /
959 * Write a line to the spoiler file and then "underline" it with hypens
960 * @param art_flags アーティファクトのフラグ群
961 * @param flag_ptr フラグ記述情報の参照ポインタ
962 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
963 * @param n_elmnts フラグの要素数
964 * @return desc_ptrと同じアドレス
967 * This function does most of the actual "analysis". Given a set of bit flags
968 * (which will be from one of the flags fields from the object in question),
969 * a "flag description structure", a "description list", and the number of
970 * elements in the "flag description structure", this function sets the
971 * "description list" members to the appropriate descriptions contained in
972 * the "flag description structure".
973 * The possibly updated description pointer is returned.
976 static concptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
977 const flag_desc *flag_ptr,
978 concptr *desc_ptr, const int n_elmnts)
982 for (i = 0; i < n_elmnts; ++i)
984 if (have_flag(art_flags, flag_ptr[i].flag))
986 *desc_ptr++ = flag_ptr[i].desc;
995 * @brief アイテムの特定記述内容を返す /
996 * Acquire a "basic" description "The Cloak of Death [1,+10]"
997 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
998 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1001 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1003 /* Get a "useful" description of the object */
1004 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1009 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1010 * List "player traits" altered by an artifact's pval. These include stats,
1011 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1012 * @param o_ptr オブジェクト構造体の参照ポインタ
1013 * @param p_ptr pval修正構造体の参照ポインタ
1016 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1018 BIT_FLAGS flgs[TR_FLAG_SIZE];
1020 concptr *affects_list;
1022 /* If pval == 0, there is nothing to do. */
1025 /* An "empty" pval description indicates that pval == 0 */
1026 pi_ptr->pval_desc[0] = '\0';
1029 object_flags(o_ptr, flgs);
1031 affects_list = pi_ptr->pval_affects;
1033 /* Create the "+N" string */
1034 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1036 /* First, check to see if the pval affects all stats */
1037 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1038 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1039 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1041 *affects_list++ = _("全能力", "All stats");
1044 /* Are any stats affected? */
1045 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1046 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1047 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1049 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1051 N_ELEMENTS(stat_flags_desc));
1054 /* And now the "rest" */
1055 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1057 N_ELEMENTS(pval_flags1_desc));
1059 /* Terminate the description list */
1060 *affects_list = NULL;
1064 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1065 * Note the slaying specialties of a weapon
1066 * @param o_ptr オブジェクト構造体の参照ポインタ
1067 * @param slay_list 種族スレイ構造体の参照ポインタ
1070 static void analyze_slay(object_type *o_ptr, concptr *slay_list)
1072 BIT_FLAGS flgs[TR_FLAG_SIZE];
1074 object_flags(o_ptr, flgs);
1076 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1077 N_ELEMENTS(slay_flags_desc));
1079 /* Terminate the description list */
1085 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1086 * Note an object's elemental brands
1087 * @param o_ptr オブジェクト構造体の参照ポインタ
1088 * @param brand_list 属性ブランド構造体の参照ポインタ
1091 static void analyze_brand(object_type *o_ptr, concptr *brand_list)
1093 BIT_FLAGS flgs[TR_FLAG_SIZE];
1095 object_flags(o_ptr, flgs);
1097 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1098 N_ELEMENTS(brand_flags_desc));
1100 /* Terminate the description list */
1106 * @brief アーティファクトの通常耐性を構造体に収める /
1107 * Note an object's elemental brands
1108 * @param o_ptr オブジェクト構造体の参照ポインタ
1109 * @param resist_list 通常耐性構造体の参照ポインタ
1112 static void analyze_resist(object_type *o_ptr, concptr *resist_list)
1114 BIT_FLAGS flgs[TR_FLAG_SIZE];
1116 object_flags(o_ptr, flgs);
1118 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1119 resist_list, N_ELEMENTS(resist_flags_desc));
1121 /* Terminate the description list */
1122 *resist_list = NULL;
1127 * @brief アーティファクトの免疫特性を構造体に収める /
1128 * Note the immunities granted by an object
1129 * @param o_ptr オブジェクト構造体の参照ポインタ
1130 * @param immune_list 免疫構造体の参照ポインタ
1133 static void analyze_immune(object_type *o_ptr, concptr *immune_list)
1135 BIT_FLAGS flgs[TR_FLAG_SIZE];
1137 object_flags(o_ptr, flgs);
1139 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1140 immune_list, N_ELEMENTS(immune_flags_desc));
1142 /* Terminate the description list */
1143 *immune_list = NULL;
1148 * @brief アーティファクトの維持特性を構造体に収める /
1149 * Note which stats an object sustains
1150 * @param o_ptr オブジェクト構造体の参照ポインタ
1151 * @param sustain_list 維持特性構造体の参照ポインタ
1154 static void analyze_sustains(object_type *o_ptr, concptr *sustain_list)
1156 BIT_FLAGS flgs[TR_FLAG_SIZE];
1158 object_flags(o_ptr, flgs);
1160 /* Simplify things if an item sustains all stats */
1161 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1162 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1163 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1165 *sustain_list++ = _("全能力", "All stats");
1168 /* Should we bother? */
1169 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1170 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1171 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1173 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1175 N_ELEMENTS(sustain_flags_desc));
1178 /* Terminate the description list */
1179 *sustain_list = NULL;
1184 * @brief アーティファクトのその他の特性を構造体に収める /
1185 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1186 * free action, permanent light, etc.
1187 * @param o_ptr オブジェクト構造体の参照ポインタ
1188 * @param misc_list その他の特性構造体の参照ポインタ
1191 static void analyze_misc_magic(object_type *o_ptr, concptr *misc_list)
1193 BIT_FLAGS flgs[TR_FLAG_SIZE];
1197 object_flags(o_ptr, flgs);
1199 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1200 N_ELEMENTS(misc_flags2_desc));
1202 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list, N_ELEMENTS(misc_flags3_desc));
1205 * Glowing artifacts -- small radius light.
1208 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1209 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1210 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1211 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1212 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1213 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1215 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1217 if (have_flag(flgs, TR_LITE_FUEL))
1219 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
1223 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), (int)rad);
1224 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), (int)-rad);
1227 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1230 * Handle cursed objects here to avoid redundancies such as noting
1231 * that a permanently cursed object is heavily cursed as well as
1232 * being "lightly cursed".
1235 /* if (object_is_cursed(o_ptr)) */
1237 if (have_flag(flgs, TR_TY_CURSE))
1239 *misc_list++ = _("太古の怨念", "Ancient Curse");
1241 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1243 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1245 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1247 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1250 else if (o_ptr->curse_flags & TRC_CURSED)
1252 *misc_list++ = _("呪い", "Cursed");
1254 if (have_flag(flgs, TR_ADD_L_CURSE))
1256 *misc_list++ = _("呪いを増やす", "Cursing");
1258 if (have_flag(flgs, TR_ADD_H_CURSE))
1260 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1264 /* Terminate the description list */
1270 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1271 * Note additional ability and/or resistance of fixed artifacts
1272 * @param o_ptr オブジェクト構造体の参照ポインタ
1273 * @param addition 追加ランダム耐性構造体の参照ポインタ
1276 static void analyze_addition(object_type *o_ptr, char *addition)
1278 artifact_type *a_ptr = &a_info[o_ptr->name1];
1281 strcpy(addition, "");
1283 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, _("能力and耐性", "Ability and Resistance"));
1284 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1286 strcat(addition, _("能力", "Ability"));
1287 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("(1/2でand耐性)", "(plus Resistance about 1/2)"));
1289 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1291 strcat(addition, _("耐性", "Resistance"));
1292 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("(1/2でand能力)", "(plus Ability about 1/2)"));
1294 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("能力or耐性", "Ability or Resistance"));
1299 * @brief アーティファクトの基本情報を文字列に収める /
1300 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1301 * and its value in gold pieces
1302 * @param o_ptr オブジェクト構造体の参照ポインタ
1303 * @param misc_desc 基本情報を収める文字列参照ポインタ
1306 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1308 artifact_type *a_ptr = &a_info[o_ptr->name1];
1310 sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ptr->level, a_ptr->rarity,
1312 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1314 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1320 * @brief アーティファクトの情報全体を構造体に収める /
1321 * Fill in an object description structure for a given object
1322 * and its value in gold pieces
1323 * @param o_ptr オブジェクト構造体の参照ポインタ
1324 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1327 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1329 analyze_general(o_ptr, desc_ptr->description);
1330 analyze_pval(o_ptr, &desc_ptr->pval_info);
1331 analyze_brand(o_ptr, desc_ptr->brands);
1332 analyze_slay(o_ptr, desc_ptr->slays);
1333 analyze_immune(o_ptr, desc_ptr->immunities);
1334 analyze_resist(o_ptr, desc_ptr->resistances);
1335 analyze_sustains(o_ptr, desc_ptr->sustains);
1336 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1337 analyze_addition(o_ptr, desc_ptr->addition);
1338 analyze_misc(o_ptr, desc_ptr->misc_desc);
1339 desc_ptr->activation = item_activation(o_ptr);
1344 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1347 static void print_header(void)
1351 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1352 spoiler_underline(buf);
1356 * This is somewhat ugly.
1358 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1359 * and a separator character (',', e.g.), write the list to the spoiler file
1360 * in a "nice" format, such as:
1362 * Resist Fire, Cold, Acid
1364 * That was a simple example, but when the list is long, a line wrap
1365 * should occur, and this should induce a new level of indention if
1366 * a list is being spread across lines. So for example, Bladeturner's
1367 * list of resistances should look something like this
1369 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1370 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1372 * However, the code distinguishes between a single list of many items vs.
1373 * many lists. (The separator is used to make this determination.) A single
1374 * list of many items will not cause line wrapping (since there is no
1375 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1376 * might look like this:
1378 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1381 * So comparing the two, "Regeneration" has no trailing separator and
1382 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1383 * but that's not relevant to line wrapping and indention.)
1386 /* ITEM_SEP separates items within a list */
1387 #define ITEM_SEP ','
1390 /* LIST_SEP separates lists */
1392 #define LIST_SEP ','
1394 #define LIST_SEP ';'
1398 * @brief フラグ名称を出力する汎用関数
1399 * @param header ヘッダに出力するフラグ群の名前
1400 * @param list フラグ名リスト
1401 * @param separator フラグ表示の区切り記号
1404 static void spoiler_outlist(concptr header, concptr *list, char separator)
1406 int line_len, buf_len;
1407 char line[MAX_LINE_LEN+1], buf[80];
1409 /* Ignore an empty list */
1410 if (*list == NULL) return;
1412 /* This function always indents */
1413 strcpy(line, INDENT1);
1415 /* Create header (if one was given) */
1416 if (header && (header[0]))
1418 strcat(line, header);
1422 line_len = strlen(line);
1424 /* Now begin the tedious task */
1427 /* Copy the current item to a buffer */
1430 /* Note the buffer's length */
1431 buf_len = strlen(buf);
1434 * If there is an item following this one, pad with separator and
1435 * a space and adjust the buffer length
1440 sprintf(buf + buf_len, "%c ", separator);
1445 * If the buffer will fit on the current line, just append the
1446 * buffer to the line and adjust the line length accordingly.
1449 if (line_len + buf_len <= MAX_LINE_LEN)
1452 line_len += buf_len;
1455 /* Apply line wrapping and indention semantics described above */
1459 * Don't print a trailing list separator but do print a trailing
1462 if (line_len > 1 && line[line_len - 1] == ' '
1463 && line[line_len - 2] == LIST_SEP)
1465 /* Ignore space and separator */
1466 line[line_len - 2] = '\0';
1468 /* Write to spoiler file */
1469 fprintf(fff, "%s\n", line);
1471 /* Begin new line at primary indention level */
1472 sprintf(line, "%s%s", INDENT1, buf);
1477 /* Write to spoiler file */
1478 fprintf(fff, "%s\n", line);
1480 /* Begin new line at secondary indention level */
1481 sprintf(line, "%s%s", INDENT2, buf);
1484 line_len = strlen(line);
1487 /* Advance, with break */
1488 if (!*++list) break;
1491 /* Write what's left to the spoiler file */
1492 fprintf(fff, "%s\n", line);
1496 * @brief アーティファクト一件をスポイラー出力する /
1497 * Create a spoiler file entry for an artifact
1498 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1501 static void spoiler_print_art(obj_desc_list *art_ptr)
1503 pval_info_type *pval_ptr = &art_ptr->pval_info;
1506 /* Don't indent the first line */
1507 fprintf(fff, "%s\n", art_ptr->description);
1509 /* An "empty" pval description indicates that the pval affects nothing */
1510 if (pval_ptr->pval_desc[0])
1512 /* Mention the effects of pval */
1513 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1514 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1517 /* Now deal with the description lists */
1518 spoiler_outlist(_("対:", "Slay"), art_ptr->slays, ITEM_SEP);
1519 spoiler_outlist(_("武器属性:", ""), art_ptr->brands, LIST_SEP);
1520 spoiler_outlist(_("免疫:", "Immunity to"), art_ptr->immunities, ITEM_SEP);
1521 spoiler_outlist(_("耐性:", "Resist"), art_ptr->resistances, ITEM_SEP);
1522 spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustains, ITEM_SEP);
1523 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1525 if (art_ptr->addition[0])
1527 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1530 /* Write out the possible activation at the primary indention level */
1531 if (art_ptr->activation)
1533 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1536 /* End with the miscellaneous facts */
1537 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1542 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1543 * Hack -- Create a "forged" artifact
1544 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1545 * @param name1 生成するアーティファクトID
1546 * @return 生成が成功した場合TRUEを返す
1548 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1551 artifact_type *a_ptr = &a_info[name1];
1553 /* Ignore "empty" artifacts */
1554 if (!a_ptr->name) return FALSE;
1556 /* Acquire the "kind" index */
1557 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1559 if (!i) return (FALSE);
1561 /* Create the artifact */
1562 object_prep(o_ptr, i);
1565 o_ptr->name1 = (byte_hack)name1;
1567 /* Extract the fields */
1568 o_ptr->pval = a_ptr->pval;
1569 o_ptr->ac = a_ptr->ac;
1570 o_ptr->dd = a_ptr->dd;
1571 o_ptr->ds = a_ptr->ds;
1572 o_ptr->to_a = a_ptr->to_a;
1573 o_ptr->to_h = a_ptr->to_h;
1574 o_ptr->to_d = a_ptr->to_d;
1575 o_ptr->weight = a_ptr->weight;
1583 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1584 * Create a spoiler file for artifacts
1585 * @param fname 生成ファイル名
1588 static void spoil_artifact(concptr fname)
1595 obj_desc_list artifact;
1598 /* Build the filename */
1599 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1601 /* File type is "TEXT" */
1602 FILE_TYPE(FILE_TYPE_TEXT);
1605 fff = my_fopen(buf, "w");
1609 msg_print("Cannot create spoiler file.");
1613 /* Dump the header */
1616 /* List the artifacts by tval */
1617 for (i = 0; group_artifact[i].tval; i++)
1619 /* Write out the group title */
1620 if (group_artifact[i].name)
1622 spoiler_blanklines(2);
1623 spoiler_underline(group_artifact[i].name);
1624 spoiler_blanklines(1);
1627 /* Now search through all of the artifacts */
1628 for (j = 1; j < max_a_idx; ++j)
1630 artifact_type *a_ptr = &a_info[j];
1632 /* We only want objects in the current group */
1633 if (a_ptr->tval != group_artifact[i].tval) continue;
1637 /* Attempt to "forge" the artifact */
1638 if (!make_fake_artifact(q_ptr, j)) continue;
1640 /* Analyze the artifact */
1641 object_analyze(q_ptr, &artifact);
1643 /* Write out the artifact description to the spoiler file */
1644 spoiler_print_art(&artifact);
1648 /* Check for errors */
1649 if (ferror(fff) || my_fclose(fff))
1651 msg_print("Cannot close spoiler file.");
1655 msg_print("Successfully created a spoiler file.");
1660 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1661 * Create a spoiler file for monsters -BEN-
1662 * @param fname 生成ファイル名
1665 static void spoil_mon_desc(concptr fname)
1682 /* Build the filename */
1683 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1685 /* File type is "TEXT" */
1686 FILE_TYPE(FILE_TYPE_TEXT);
1689 fff = my_fopen(buf, "w");
1693 msg_print("Cannot create spoiler file.");
1697 /* Allocate the "who" array */
1698 C_MAKE(who, max_r_idx, s16b);
1700 /* Dump the header */
1701 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1702 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1703 fprintf(fff, "------------------------------------------\n\n");
1705 /* Dump the header */
1706 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1707 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1708 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1709 "--------", "---", "---", "---", "--", "--", "-----------");
1712 /* Scan the monsters */
1713 for (i = 1; i < max_r_idx; i++)
1715 monster_race *r_ptr = &r_info[i];
1717 /* Use that monster */
1718 if (r_ptr->name) who[n++] = (s16b)i;
1721 /* Select the sort method */
1722 ang_sort_comp = ang_sort_comp_hook;
1723 ang_sort_swap = ang_sort_swap_hook;
1725 /* Sort the array by dungeon depth of monsters */
1726 ang_sort(who, &why, n);
1729 for (i = 0; i < n; i++)
1731 monster_race *r_ptr = &r_info[who[i]];
1733 concptr name = (r_name + r_ptr->name);
1734 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1736 /* Get the "name" */
1738 else if (r_ptr->flags3 & (RF3_NO_CONF))
1740 sprintf(nam, "[*] %s", name);
1743 else if (r_ptr->flags1 & (RF1_UNIQUE))
1745 sprintf(nam, "[U] %s", name);
1749 sprintf(nam, _(" %s", "The %s"), name);
1754 sprintf(lev, "%d", (int)r_ptr->level);
1757 sprintf(rar, "%d", (int)r_ptr->rarity);
1760 if (r_ptr->speed >= 110)
1762 sprintf(spd, "+%d", (r_ptr->speed - 110));
1766 sprintf(spd, "-%d", (110 - r_ptr->speed));
1770 sprintf(ac, "%d", r_ptr->ac);
1773 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1775 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1779 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1784 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1786 /* Hack -- use visual instead */
1787 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1790 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1791 nam, lev, rar, spd, hp, ac, exp);
1798 /* Free the "who" array */
1799 C_KILL(who, max_r_idx, s16b);
1801 /* Check for errors */
1802 if (ferror(fff) || my_fclose(fff))
1804 msg_print("Cannot close spoiler file.");
1809 msg_print("Successfully created a spoiler file.");
1816 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1818 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1824 * @brief 文字列をファイルポインタに出力する /
1825 * Buffer text to the given file. (-SHAWN-)
1826 * This is basically c_roff() from mon-desc.c with a few changes.
1827 * @param str 文字列参照ポインタ
1830 static void spoil_out(concptr str)
1835 static char roff_buf[256];
1838 static char roff_waiting_buf[256];
1841 bool iskanji_flag = FALSE;
1843 /* Current pointer into line roff_buf */
1844 static char *roff_p = roff_buf;
1846 /* Last space saved into roff_buf */
1847 static char *roff_s = NULL;
1849 /* Mega-Hack -- Delayed output */
1850 static bool waiting_output = FALSE;
1852 /* Special handling for "new sequence" */
1857 fputs(roff_waiting_buf, fff);
1858 waiting_output = FALSE;
1861 if (roff_p != roff_buf) roff_p--;
1862 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1864 if (roff_p == roff_buf) fprintf(fff, "\n");
1867 *(roff_p + 1) = '\0';
1868 fprintf(fff, "%s\n\n", roff_buf);
1877 /* Scan the given string, character at a time */
1882 bool k_flag = iskanji((unsigned char)(*str));
1885 bool wrap = (ch == '\n');
1888 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1889 iskanji_flag = k_flag && !iskanji_flag;
1891 if (!isprint(ch)) ch = ' ';
1896 fputs(roff_waiting_buf, fff);
1897 if (!wrap) fputc('\n', fff);
1898 waiting_output = FALSE;
1904 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1905 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
1907 if (roff_p >= roff_buf + 75) wrap = TRUE;
1908 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
1915 bool iskanji_flag_local = FALSE;
1916 concptr tail = str + (k_flag ? 2 : 1);
1918 concptr tail = str + 1;
1921 for (; *tail; tail++)
1923 if (*tail == ' ') continue;
1926 k_flag_local = iskanji((unsigned char)(*tail));
1927 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
1928 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
1930 if (isprint(*tail)) break;
1934 if (!*tail) waiting_output = TRUE;
1938 /* Handle line-wrap */
1946 if (roff_s && (ch != ' '))
1954 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
1955 else strcpy(roff_waiting_buf, roff_buf);
1959 if (cbak != ' ') *roff_p++ = cbak;
1961 while (*r) *roff_p++ = *r++;
1965 if ((roff_p > roff_buf) || (ch != ' '))
1970 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
1975 strncmp(str, "。", 2) != 0 &&
1976 strncmp(str, "、", 2) != 0 &&
1977 strncmp(str, "ィ", 2) != 0 &&
1978 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
1981 if (ch == ' ') roff_s = roff_p;
1992 * @brief 関数ポインタ用の出力関数 /
1993 * Hook function used in spoil_mon_info()
1995 * @param str 文字列参照ポインタ
1998 static void roff_func(TERM_COLOR attr, concptr str)
2008 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2009 * Create a spoiler file for monsters (-SHAWN-)
2010 * @param fname ファイル名
2013 static void spoil_mon_info(concptr fname)
2022 /* Build the filename */
2023 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2025 /* File type is "TEXT" */
2026 FILE_TYPE(FILE_TYPE_TEXT);
2029 fff = my_fopen(buf, "w");
2033 msg_print("Cannot create spoiler file.");
2038 /* Dump the header */
2039 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2040 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2043 spoil_out("------------------------------------------\n\n");
2045 /* Allocate the "who" array */
2046 C_MAKE(who, max_r_idx, s16b);
2048 /* Scan the monsters */
2049 for (i = 1; i < max_r_idx; i++)
2051 monster_race *r_ptr = &r_info[i];
2053 /* Use that monster */
2054 if (r_ptr->name) who[n++] = (s16b)i;
2057 /* Select the sort method */
2058 ang_sort_comp = ang_sort_comp_hook;
2059 ang_sort_swap = ang_sort_swap_hook;
2061 /* Sort the array by dungeon depth of monsters */
2062 ang_sort(who, &why, n);
2066 * List all monsters in order
2068 for (l = 0; l < n; l++)
2070 monster_race *r_ptr = &r_info[who[l]];
2071 flags1 = r_ptr->flags1;
2075 if (flags1 & (RF1_QUESTOR))
2081 if (flags1 & (RF1_UNIQUE))
2093 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2098 spoil_out(attr_to_text(r_ptr));
2101 sprintf(buf, " '%c')\n", r_ptr->d_char);
2106 sprintf(buf, "=== ");
2110 sprintf(buf, "Num:%d ", who[l]);
2114 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2118 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2122 if (r_ptr->speed >= 110)
2124 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2128 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2133 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2135 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2139 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2144 sprintf(buf, "Ac:%d ", r_ptr->ac);
2148 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2151 /* Reuse the code of monster recall. */
2152 output_monster_spoiler(who[l], roff_func);
2157 /* Free the "who" array */
2158 C_KILL(who, max_r_idx, s16b);
2160 /* Check for errors */
2161 if (ferror(fff) || my_fclose(fff))
2163 msg_print("Cannot close spoiler file.");
2167 msg_print("Successfully created a spoiler file.");
2172 #define MAX_EVOL_DEPTH 64
2176 * @brief int配列でstrncmp()と似た比較処理を行う /
2177 * Compare two int-type array like strncmp() and return TRUE if equals
2178 * @param a 比較するint配列1
2179 * @param b 比較するint配列2
2181 * @return 両者の値が等しければTRUEを返す
2183 static bool int_n_cmp(int *a, int *b, int length)
2185 /* Null-string comparation is always TRUE */
2186 if (!length) return TRUE;
2190 if (*a != *(b++)) return FALSE;
2191 if (!(*(a++))) break;
2200 * @brief ある木が指定された木の部分木かどうかを返す /
2201 * Returns TRUE if an evolution tree is "partial tree"
2202 * @param tree 元となる木構造リスト
2203 * @param partial_tree 部分木かどうか判定したい木構造リスト
2204 * @return 部分木ならばTRUEを返す
2206 static bool is_partial_tree(int *tree, int *partial_tree)
2208 int pt_head = *(partial_tree++);
2211 while (partial_tree[pt_len]) pt_len++;
2215 if (*(tree++) == pt_head)
2217 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2226 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2227 * Sorting hook -- Comp function
2230 * @param a 比較したいモンスター種族ID1
2231 * @param b 比較したいモンスター種族ID2
2232 * @return 2が大きければTRUEを返す
2234 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2236 int **evol_tree = (int **)u;
2238 int w1 = evol_tree[a][0];
2239 int w2 = evol_tree[b][0];
2240 monster_race *r1_ptr = &r_info[w1];
2241 monster_race *r2_ptr = &r_info[w2];
2246 /* Used tree first */
2247 if (w1 && !w2) return TRUE;
2248 if (!w1 && w2) return FALSE;
2250 /* Sort by monster level */
2251 if (r1_ptr->level < r2_ptr->level) return TRUE;
2252 if (r1_ptr->level > r2_ptr->level) return FALSE;
2254 /* Sort by monster experience */
2255 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2256 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2258 /* Compare indexes */
2263 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2264 * Sorting hook -- Swap function
2267 * @param a スワップしたい木構造1
2268 * @param b スワップしたい木構造2
2269 * @return 2が大きければTRUEを返す
2271 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2273 int **evol_tree = (int **)u;
2280 holder = evol_tree[a];
2281 evol_tree[a] = evol_tree[b];
2282 evol_tree[b] = holder;
2286 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2287 * Print monsters' evolution information to file
2288 * @param fname 出力ファイル名
2291 static void spoil_mon_evol(concptr fname)
2294 monster_race *r_ptr;
2295 int **evol_tree, i, j, n, r_idx;
2296 int *evol_tree_zero; /* For C_KILL() */
2298 /* Build the filename */
2299 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2301 /* File type is "TEXT" */
2302 FILE_TYPE(FILE_TYPE_TEXT);
2305 fff = my_fopen(buf, "w");
2309 msg_print("Cannot create spoiler file.");
2313 /* Dump the header */
2314 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2315 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2318 spoil_out("------------------------------------------\n\n");
2320 /* Allocate the "evol_tree" array (2-dimension) */
2321 C_MAKE(evol_tree, max_r_idx, int *);
2322 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2323 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2324 evol_tree_zero = *evol_tree;
2326 /* Step 1: Build the evolution tree */
2327 for (i = 1; i < max_r_idx; i++)
2332 if (!r_ptr->next_exp) continue;
2334 /* Trace evolution */
2336 evol_tree[i][n++] = i;
2339 evol_tree[i][n++] = r_ptr->next_r_idx;
2340 r_ptr = &r_info[r_ptr->next_r_idx];
2342 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2345 /* Step 2: Scan the evolution trees and remove "partial tree" */
2346 for (i = 1; i < max_r_idx; i++)
2348 /* Not evolution tree */
2349 if (!evol_tree[i][0]) continue;
2351 for (j = 1; j < max_r_idx; j++)
2354 if (i == j) continue;
2356 /* Not evolution tree */
2357 if (!evol_tree[j][0]) continue;
2359 /* Is evolution tree[i] is part of [j]? */
2360 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2362 /* Remove this evolution tree */
2363 evol_tree[i][0] = 0;
2369 /* Step 3: Sort the evolution trees */
2371 /* Select the sort method */
2372 ang_sort_comp = ang_sort_comp_evol_tree;
2373 ang_sort_swap = ang_sort_swap_evol_tree;
2375 /* Sort the array */
2376 ang_sort(evol_tree, NULL, max_r_idx);
2378 /* Step 4: Print the evolution trees */
2379 for (i = 0; i < max_r_idx; i++)
2381 r_idx = evol_tree[i][0];
2383 /* No evolution or removed evolution tree */
2384 if (!r_idx) continue;
2386 /* Trace the evolution tree */
2387 r_ptr = &r_info[r_idx];
2388 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2389 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2391 for (n = 1; r_ptr->next_exp; n++)
2393 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2394 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2395 r_ptr = &r_info[r_ptr->next_r_idx];
2396 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2397 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2400 /* End of evolution tree */
2404 /* Free the "evol_tree" array (2-dimension) */
2405 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2406 C_KILL(evol_tree, max_r_idx, int *);
2408 /* Check for errors */
2409 if (ferror(fff) || my_fclose(fff))
2411 msg_print("Cannot close spoiler file.");
2415 msg_print("Successfully created a spoiler file.");
2423 extern void do_cmd_spoilers(void);
2426 * @brief スポイラー出力を行うコマンドのメインルーチン /
2427 * Create Spoiler files -BEN-
2430 void do_cmd_spoilers(void)
2440 prt("Create a spoiler file.", 2, 0);
2442 /* Prompt for a file */
2443 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2444 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2445 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2446 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2447 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2450 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2462 spoil_obj_desc("obj-desc.txt");
2467 spoil_artifact("artifact.txt");
2472 spoil_mon_desc("mon-desc.txt");
2477 spoil_mon_info("mon-info.txt");
2482 spoil_mon_evol("mon-evol.txt");
2495 * @brief ランダムアーティファクト1件を解析する /
2496 * Fill in an object description structure for a given object
2497 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2498 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2501 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2503 analyze_general(o_ptr, desc_ptr->description);
2504 analyze_pval(o_ptr, &desc_ptr->pval_info);
2505 analyze_brand(o_ptr, desc_ptr->brands);
2506 analyze_slay(o_ptr, desc_ptr->slays);
2507 analyze_immune(o_ptr, desc_ptr->immunities);
2508 analyze_resist(o_ptr, desc_ptr->resistances);
2509 analyze_sustains(o_ptr, desc_ptr->sustains);
2510 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2511 desc_ptr->activation = item_activation(o_ptr);
2513 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2514 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2516 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2517 o_ptr->weight / 10, o_ptr->weight % 10);
2522 * @brief ランダムアーティファクト1件をスポイラー出力する /
2523 * Create a spoiler file entry for an artifact
2524 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2525 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2526 * Fill in an object description structure for a given object
2529 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2531 pval_info_type *pval_ptr = &art_ptr->pval_info;
2535 /* Don't indent the first line */
2536 fprintf(fff, "%s\n", art_ptr->description);
2539 if (!(o_ptr->ident & (IDENT_MENTAL)))
2541 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2544 /* An "empty" pval description indicates that the pval affects nothing */
2545 if (pval_ptr->pval_desc[0])
2547 /* Mention the effects of pval */
2548 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2549 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2552 /* Now deal with the description lists */
2554 spoiler_outlist(_("対:", "Slay"), art_ptr->slays, ITEM_SEP);
2555 spoiler_outlist(_("武器属性:", ""), art_ptr->brands, LIST_SEP);
2556 spoiler_outlist(_("免疫:", "Immunity to"), art_ptr->immunities, ITEM_SEP);
2557 spoiler_outlist(_("耐性:", "Resist"), art_ptr->resistances, ITEM_SEP);
2558 spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustains, ITEM_SEP);
2559 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2561 /* Write out the possible activation at the primary indention level */
2562 if (art_ptr->activation)
2564 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2567 /* End with the miscellaneous facts */
2568 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2573 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2574 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2575 * @param i 出力したい記録ランダムアーティファクトID
2578 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2580 obj_desc_list artifact;
2582 if (!object_is_known(o_ptr) || !o_ptr->art_name
2583 || o_ptr->tval != group_artifact[i].tval)
2586 /* Analyze the artifact */
2587 random_artifact_analyze(o_ptr, &artifact);
2589 /* Write out the artifact description to the spoiler file */
2590 spoiler_print_randart(o_ptr, &artifact);
2594 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2595 * Create a list file for random artifacts
2596 * @param fname 出力ファイル名
2599 void spoil_random_artifact(concptr fname)
2608 /* Build the filename */
2609 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2611 /* File type is "TEXT" */
2612 FILE_TYPE(FILE_TYPE_TEXT);
2615 fff = my_fopen(buf, "w");
2619 msg_print("Cannot create list file.");
2623 /* Dump the header */
2624 sprintf(buf, "Random artifacts list.\r");
2625 spoiler_underline(buf);
2627 /* List the artifacts by tval */
2628 for (j = 0; group_artifact[j].tval; j++)
2630 /* random artifacts wielding */
2631 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2633 q_ptr = &inventory[i];
2634 spoil_random_artifact_aux(q_ptr, j);
2637 /* random artifacts in inventory */
2638 for (i = 0; i < INVEN_PACK; i++)
2640 q_ptr = &inventory[i];
2641 spoil_random_artifact_aux(q_ptr, j);
2644 /* random artifacts in home */
2645 st_ptr = &town[1].store[STORE_HOME];
2646 for (i = 0; i < st_ptr->stock_num; i++)
2648 q_ptr = &st_ptr->stock[i];
2649 spoil_random_artifact_aux(q_ptr, j);
2652 /* random artifacts in museum */
2653 st_ptr = &town[1].store[STORE_MUSEUM];
2654 for (i = 0; i < st_ptr->stock_num; i++)
2656 q_ptr = &st_ptr->stock[i];
2657 spoil_random_artifact_aux(q_ptr, j);
2661 /* Check for errors */
2662 if (ferror(fff) || my_fclose(fff))
2664 msg_print("Cannot close list file.");
2668 msg_print("Successfully created a list file.");
2675 #endif /* MACINTOSH */