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 モンスター種族の構造体ポインタ
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 "青灰色の";
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 "明青灰色の";
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";
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)") },
134 { TV_AMULET, "アミュレット" },
137 { TV_LITE, "Light Sources" },
138 { TV_AMULET, "Amulets" },
139 { TV_RING, "Rings" },
147 { TV_STAFF, "Staffs" },
148 { TV_WAND, "Wands" },
157 { TV_SCROLL, "Scrolls" },
158 { TV_POTION, "Potions" },
163 { TV_LIFE_BOOK, "魔法書 (生命)" },
164 { TV_SORCERY_BOOK, "魔法書 (仙術)" },
165 { TV_NATURE_BOOK, "魔法書 (自然)" },
166 { TV_CHAOS_BOOK, "魔法書 (カオス)" },
167 { TV_DEATH_BOOK, "魔法書 (暗黒)" },
168 { TV_TRUMP_BOOK, "魔法書 (トランプ)" },
169 { TV_ARCANE_BOOK, "魔法書 (秘術)" },
170 { TV_CRAFT_BOOK, "魔法書 (匠)" },
171 { TV_DAEMON_BOOK, "魔法書 (悪魔)" },
172 { TV_CRUSADE_BOOK, "魔法書 (破邪)" },
173 { TV_MUSIC_BOOK, "歌集" },
174 { TV_HISSATSU_BOOK, "武芸の書" },
175 { TV_HEX_BOOK, "魔法書 (呪術)" },
177 { TV_LIFE_BOOK, "Books (Life)" },
178 { TV_SORCERY_BOOK, "Books (Sorcery)" },
179 { TV_NATURE_BOOK, "Books (Nature)" },
180 { TV_CHAOS_BOOK, "Books (Chaos)" },
181 { TV_DEATH_BOOK, "Books (Death)" },
182 { TV_TRUMP_BOOK, "Books (Trump)" },
183 { TV_ARCANE_BOOK, "Books (Arcane)" },
184 { TV_CRAFT_BOOK, "Books (Craft)" },
185 { TV_DAEMON_BOOK, "Books (Daemon)" },
186 { TV_CRUSADE_BOOK, "Books (Crusade)" },
187 { TV_MUSIC_BOOK, "Song Books" },
188 { TV_HISSATSU_BOOK, "Books (Kendo)" },
189 { TV_HEX_BOOK, "Books (Hex)" },
194 { TV_CAPTURE, "キャプチャー・ボール" },
195 { TV_CARD, "エクスプレスカード" },
197 { TV_WHISTLE, "Whistle" },
198 { TV_CAPTURE, "Capture Ball" },
199 { TV_CARD, "Express Card" },
202 { TV_CHEST, _("箱", "Chests") },
205 { TV_FIGURINE, "人形" },
209 { TV_FIGURINE, "Magical Figurines" },
210 { TV_STATUE, "Statues" },
211 { TV_CORPSE, "Corpses" },
214 { TV_SKELETON, _("その他", "Misc") },
219 { TV_PARCHMENT, NULL },
226 * @brief ベースアイテムの各情報を文字列化する /
228 * @param buf 名称を返すバッファ参照ポインタ
229 * @param dam ダメージダイス記述を返すバッファ参照ポインタ
230 * @param wgt 重量記述を返すバッファ参照ポインタ
231 * @param lev 生成階記述を返すバッファ参照ポインタ
232 * @param chance 生成機会を返すバッファ参照ポインタ
233 * @param val 価値を返すバッファ参照ポインタ
237 static void kind_info(char *buf, char *dam, char *wgt, char *chance, DEPTH *lev, PRICE *val, OBJECT_IDX k)
243 /* Get local object */
246 /* Prepare a fake item */
247 object_prep(q_ptr, k);
250 q_ptr->ident |= (IDENT_KNOWN);
260 (*lev) = k_info[q_ptr->k_idx].level;
263 (*val) = object_value(q_ptr);
267 if (!buf || !dam || !chance || !wgt) return;
270 /* Description (too brief) */
271 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
291 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
301 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
316 sprintf(dam, "%d", q_ptr->ac);
323 for(i = 0; i < 4; i++)
325 char chance_aux[20] = "";
326 if(k_info[q_ptr->k_idx].chance[i] > 0)
328 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""),
329 (int)k_info[q_ptr->k_idx].locale[i], 100/k_info[q_ptr->k_idx].chance[i]);
330 strcat(chance, chance_aux);
336 sprintf(wgt, "%3d.%d", (int)(q_ptr->weight / 10), (int)(q_ptr->weight % 10));
341 * @brief 各ベースアイテムの情報を一行毎に記述する /
342 * Create a spoiler file for items
346 static void spoil_obj_desc(cptr fname)
348 int i, k, s, t, n = 0, group_start = 0;
359 /* Build the filename */
360 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
362 /* File type is "TEXT" */
363 FILE_TYPE(FILE_TYPE_TEXT);
366 fff = my_fopen(buf, "w");
371 msg_print("Cannot create spoiler file.");
377 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
378 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
381 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
382 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
383 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
384 "-------------------------------------", "------", "---", "---", "----------------", "----");
386 /* List the groups */
387 for (i = 0; TRUE; i++)
389 /* Write out the group title */
390 if (group_item[i].name)
394 /* Hack -- bubble-sort by cost and then level */
395 for (s = 0; s < n - 1; s++)
397 for (t = 0; t < n - 1; t++)
408 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
409 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
411 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
420 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
422 /* Spoil each item */
423 for (s = 0; s < n; s++)
428 /* Describe the kind */
429 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
432 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
433 buf, dam, wgt, (int)e, chance, (long)(v));
436 /* Start a new set */
441 if (!group_item[i].tval) break;
443 /* Start a new set */
447 /* Acquire legal item types */
448 for (k = 1; k < max_k_idx; k++)
450 object_kind *k_ptr = &k_info[k];
452 /* Skip wrong tval's */
453 if (k_ptr->tval != group_item[i].tval) continue;
455 /* Hack -- Skip instant-artifacts */
456 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
464 /* Check for errors */
465 if (ferror(fff) || my_fclose(fff))
467 msg_print("Cannot close spoiler file.");
472 msg_print("Successfully created a spoiler file.");
477 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
482 * Returns a "+" string if a number is non-negative and an empty
485 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
488 * These are used to format the artifact spoiler file. INDENT1 is used
489 * to indent all but the first line of an artifact spoiler. INDENT2 is
490 * used when a line "wraps". (Bladeturner's resistances cause this.)
496 * MAX_LINE_LEN specifies when a line should wrap.
498 #define MAX_LINE_LEN 75
501 * Given an array, determine how many elements are in the array
503 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
506 * The artifacts categorized by type
508 static grouper group_artifact[] =
512 { TV_POLEARM, "槍/斧" },
514 { TV_DIGGING, "シャベル/つるはし" },
519 { TV_SOFT_ARMOR, "鎧" },
520 { TV_HARD_ARMOR, NULL },
521 { TV_DRAG_ARMOR, NULL },
523 { TV_CLOAK, "クローク" },
532 { TV_AMULET, "アミュレット" },
535 { TV_SWORD, "Edged Weapons" },
536 { TV_POLEARM, "Polearms" },
537 { TV_HAFTED, "Hafted Weapons" },
538 { TV_DIGGING, "Shovels/Picks" },
540 { TV_ARROW, "Ammo" },
543 { TV_SOFT_ARMOR, "Body Armor" },
544 { TV_HARD_ARMOR, NULL },
545 { TV_DRAG_ARMOR, NULL },
547 { TV_CLOAK, "Cloaks" },
548 { TV_SHIELD, "Shields" },
550 { TV_HELM, "Helms/Crowns" },
552 { TV_GLOVES, "Gloves" },
553 { TV_BOOTS, "Boots" },
555 { TV_LITE, "Light Sources" },
556 { TV_AMULET, "Amulets" },
557 { TV_RING, "Rings" },
566 * Pair together a constant flag with a textual description.
568 * Used by both "init.c" and "wiz-spo.c".
570 * Note that it sometimes more efficient to actually make an array
571 * of textual names, where entry 'N' is assumed to be paired with
572 * the flag whose value is "1L << N", but that requires hard-coding.
575 typedef struct flag_desc flag_desc;
580 const char *const desc;
586 * These are used for "+3 to STR, DEX", etc. These are separate from
587 * the other pval affected traits to simplify the case where an object
588 * affects all stats. In this case, "All stats" is used instead of
589 * listing each stat individually.
592 static flag_desc stat_flags_desc[] =
612 * Besides stats, these are the other player traits
613 * which may be affected by an object's pval
616 static flag_desc pval_flags1_desc[] =
619 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
620 { TR_STEALTH, "隠密" },
622 { TR_INFRA, "赤外線視力" },
624 { TR_BLOWS, "攻撃回数" },
627 { TR_STEALTH, "Stealth" },
628 { TR_SEARCH, "Searching" },
629 { TR_INFRA, "Infravision" },
630 { TR_TUNNEL, "Tunneling" },
631 { TR_BLOWS, "Attacks" },
632 { TR_SPEED, "Speed" }
637 * Slaying preferences for weapons
640 static flag_desc slay_flags_desc[] =
643 { TR_SLAY_ANIMAL, "動物" },
644 { TR_KILL_ANIMAL, "*動物*" },
645 { TR_SLAY_EVIL, "邪悪" },
646 { TR_KILL_EVIL, "*邪悪*" },
647 { TR_SLAY_HUMAN, "人間" },
648 { TR_KILL_HUMAN, "*人間*" },
649 { TR_SLAY_UNDEAD, "アンデッド" },
650 { TR_KILL_UNDEAD, "*アンデッド*" },
651 { TR_SLAY_DEMON, "悪魔" },
652 { TR_KILL_DEMON, "*悪魔*" },
653 { TR_SLAY_ORC, "オーク" },
654 { TR_KILL_ORC, "*オーク*" },
655 { TR_SLAY_TROLL, "トロル" },
656 { TR_KILL_TROLL, "*トロル*" },
657 { TR_SLAY_GIANT, "巨人" },
658 { TR_KILL_GIANT, "*巨人*" },
659 { TR_SLAY_DRAGON, "ドラゴン" },
660 { TR_KILL_DRAGON, "*ドラゴン*" },
662 { TR_SLAY_ANIMAL, "Animal" },
663 { TR_KILL_ANIMAL, "XAnimal" },
664 { TR_SLAY_EVIL, "Evil" },
665 { TR_KILL_EVIL, "XEvil" },
666 { TR_SLAY_HUMAN, "Human" },
667 { TR_KILL_HUMAN, "XHuman" },
668 { TR_SLAY_UNDEAD, "Undead" },
669 { TR_KILL_UNDEAD, "XUndead" },
670 { TR_SLAY_DEMON, "Demon" },
671 { TR_KILL_DEMON, "XDemon" },
672 { TR_SLAY_ORC, "Orc" },
673 { TR_KILL_ORC, "XOrc" },
674 { TR_SLAY_TROLL, "Troll" },
675 { TR_KILL_TROLL, "XTroll" },
676 { TR_SLAY_GIANT, "Giant" },
677 { TR_KILL_GIANT, "Xgiant" },
678 { TR_SLAY_DRAGON, "Dragon" },
679 { TR_KILL_DRAGON, "Xdragon" }
684 * Elemental brands for weapons
686 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
687 * coding, it has been included here along with the elemental
688 * brands. It does seem to fit in with the brands and slaying
689 * more than the miscellaneous section.
691 static flag_desc brand_flags_desc[] =
694 { TR_BRAND_ACID, "溶解" },
695 { TR_BRAND_ELEC, "電撃" },
696 { TR_BRAND_FIRE, "焼棄" },
697 { TR_BRAND_COLD, "凍結" },
698 { TR_BRAND_POIS, "毒殺" },
700 { TR_FORCE_WEAPON, "理力" },
701 { TR_CHAOTIC, "混沌" },
702 { TR_VAMPIRIC, "吸血" },
704 { TR_VORPAL, "切れ味" },
706 { TR_BRAND_ACID, "Acid Brand" },
707 { TR_BRAND_ELEC, "Lightning Brand" },
708 { TR_BRAND_FIRE, "Flame Tongue" },
709 { TR_BRAND_COLD, "Frost Brand" },
710 { TR_BRAND_POIS, "Poisoned" },
712 { TR_FORCE_WEAPON, "Force" },
713 { TR_CHAOTIC, "Mark of Chaos" },
714 { TR_VAMPIRIC, "Vampiric" },
715 { TR_IMPACT, "Earthquake impact on hit" },
716 { TR_VORPAL, "Very sharp" },
724 static const flag_desc resist_flags_desc[] =
727 { TR_RES_ACID, "酸" },
728 { TR_RES_ELEC, "電撃" },
729 { TR_RES_FIRE, "火炎" },
730 { TR_RES_COLD, "冷気" },
731 { TR_RES_POIS, "毒" },
732 { TR_RES_FEAR, "恐怖"},
733 { TR_RES_LITE, "閃光" },
734 { TR_RES_DARK, "暗黒" },
735 { TR_RES_BLIND, "盲目" },
736 { TR_RES_CONF, "混乱" },
737 { TR_RES_SOUND, "轟音" },
738 { TR_RES_SHARDS, "破片" },
739 { TR_RES_NETHER, "地獄" },
740 { TR_RES_NEXUS, "因果混乱" },
741 { TR_RES_CHAOS, "カオス" },
742 { TR_RES_DISEN, "劣化" },
744 { TR_RES_ACID, "Acid" },
745 { TR_RES_ELEC, "Lightning" },
746 { TR_RES_FIRE, "Fire" },
747 { TR_RES_COLD, "Cold" },
748 { TR_RES_POIS, "Poison" },
749 { TR_RES_FEAR, "Fear"},
750 { TR_RES_LITE, "Light" },
751 { TR_RES_DARK, "Dark" },
752 { TR_RES_BLIND, "Blindness" },
753 { TR_RES_CONF, "Confusion" },
754 { TR_RES_SOUND, "Sound" },
755 { TR_RES_SHARDS, "Shards" },
756 { TR_RES_NETHER, "Nether" },
757 { TR_RES_NEXUS, "Nexus" },
758 { TR_RES_CHAOS, "Chaos" },
759 { TR_RES_DISEN, "Disenchantment" },
764 * Elemental immunities (along with poison)
767 static const flag_desc immune_flags_desc[] =
771 { TR_IM_ELEC, "電撃" },
772 { TR_IM_FIRE, "火炎" },
773 { TR_IM_COLD, "冷気" },
775 { TR_IM_ACID, "Acid" },
776 { TR_IM_ELEC, "Lightning" },
777 { TR_IM_FIRE, "Fire" },
778 { TR_IM_COLD, "Cold" },
783 * Sustain stats - these are given their "own" line in the
784 * spoiler file, mainly for simplicity
786 static const flag_desc sustain_flags_desc[] =
789 { TR_SUST_STR, "腕力" },
790 { TR_SUST_INT, "知能" },
791 { TR_SUST_WIS, "賢さ" },
792 { TR_SUST_DEX, "器用さ" },
793 { TR_SUST_CON, "耐久力" },
794 { TR_SUST_CHR, "魅力" },
796 { TR_SUST_STR, "STR" },
797 { TR_SUST_INT, "INT" },
798 { TR_SUST_WIS, "WIS" },
799 { TR_SUST_DEX, "DEX" },
800 { TR_SUST_CON, "CON" },
801 { TR_SUST_CHR, "CHR" },
806 * Miscellaneous magic given by an object's "flags2" field
809 static const flag_desc misc_flags2_desc[] =
813 { TR_REFLECT, "反射" },
814 { TR_FREE_ACT, "麻痺知らず" },
815 { TR_HOLD_EXP, "経験値維持" },
817 { TR_THROW, "Throwing" },
818 { TR_REFLECT, "Reflection" },
819 { TR_FREE_ACT, "Free Action" },
820 { TR_HOLD_EXP, "Hold Experience" },
825 * Miscellaneous magic given by an object's "flags3" field
827 * Note that cursed artifacts and objects with permanent light
828 * are handled "directly" -- see analyze_misc_magic()
831 static const flag_desc misc_flags3_desc[] =
834 { TR_SH_FIRE, "火炎オーラ" },
835 { TR_SH_ELEC, "電撃オーラ" },
836 { TR_SH_COLD, "冷気オーラ" },
837 { TR_NO_TELE, "反テレポート" },
838 { TR_NO_MAGIC, "反魔法" },
839 { TR_LEVITATION, "浮遊" },
840 { TR_SEE_INVIS, "可視透明" },
841 { TR_TELEPATHY, "テレパシー" },
842 { TR_ESP_ANIMAL, "動物感知" },
843 { TR_ESP_UNDEAD, "不死感知" },
844 { TR_ESP_DEMON, "悪魔感知" },
845 { TR_ESP_ORC, "オーク感知" },
846 { TR_ESP_TROLL, "トロル感知" },
847 { TR_ESP_GIANT, "巨人感知" },
848 { TR_ESP_DRAGON, "ドラゴン感知" },
849 { TR_ESP_HUMAN, "人間感知" },
850 { TR_ESP_EVIL, "邪悪感知" },
851 { TR_ESP_GOOD, "善良感知" },
852 { TR_ESP_NONLIVING, "無生物感知" },
853 { TR_ESP_UNIQUE, "ユニーク感知" },
854 { TR_SLOW_DIGEST, "遅消化" },
855 { TR_REGEN, "急速回復" },
856 { TR_WARNING, "警告" },
857 /* { TR_XTRA_MIGHT, "強力射撃" }, */
858 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
859 { TR_DRAIN_EXP, "経験値吸収" },
860 { TR_AGGRAVATE, "反感" },
861 { TR_BLESSED, "祝福" },
862 { TR_DEC_MANA, "消費魔力減少" },
864 { TR_SH_FIRE, "Fiery Aura" },
865 { TR_SH_ELEC, "Electric Aura" },
866 { TR_SH_COLD, "Coldly Aura" },
867 { TR_NO_TELE, "Prevent Teleportation" },
868 { TR_NO_MAGIC, "Anti-Magic" },
869 { TR_LEVITATION, "Levitation" },
870 { TR_SEE_INVIS, "See Invisible" },
871 { TR_TELEPATHY, "ESP" },
872 { TR_ESP_ANIMAL, "Sense Animal" },
873 { TR_ESP_UNDEAD, "Sense Undead" },
874 { TR_ESP_DEMON, "Sense Demon" },
875 { TR_ESP_ORC, "Sense Orc" },
876 { TR_ESP_TROLL, "Sense Troll" },
877 { TR_ESP_GIANT, "Sense Giant" },
878 { TR_ESP_DRAGON, "Sense Dragon" },
879 { TR_ESP_HUMAN, "Sense Human" },
880 { TR_ESP_EVIL, "Sense Evil" },
881 { TR_ESP_GOOD, "Sense Good" },
882 { TR_ESP_NONLIVING, "Sense Nonliving" },
883 { TR_ESP_UNIQUE, "Sense Unique" },
884 { TR_SLOW_DIGEST, "Slow Digestion" },
885 { TR_REGEN, "Regeneration" },
886 { TR_WARNING, "Warning" },
887 /* { TR_XTRA_MIGHT, "Extra Might" }, */
888 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
889 { TR_DRAIN_EXP, "Drains Experience" },
890 { TR_AGGRAVATE, "Aggravates" },
891 { TR_BLESSED, "Blessed Blade" },
892 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
898 * A special type used just for deailing with pvals
903 * This will contain a string such as "+2", "-10", etc.
908 * A list of various player traits affected by an object's pval such
909 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
910 * this list since it will probably be desirable to format its
911 * description differently.
913 * Note that room need only be reserved for the number of stats - 1
914 * since the description "All stats" is used if an object affects all
915 * all stats. Also, room must be reserved for a sentinel NULL pointer.
917 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
919 * This list includes extra attacks, for simplicity.
921 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
922 N_ELEMENTS(pval_flags1_desc) + 1];
928 * An "object analysis structure"
930 * It will be filled with descriptive strings detailing an object's
931 * various magical powers. The "ignore X" traits are not noted since
932 * all artifacts ignore "normal" destruction.
937 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
938 char description[MAX_NLEN];
940 /* Description of what is affected by an object's pval */
941 pval_info_type pval_info;
943 /* A list of an object's slaying preferences */
944 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
946 /* A list if an object's elemental brands */
947 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
949 /* A list of immunities granted by an object */
950 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
952 /* A list of resistances granted by an object */
953 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
955 /* A list of stats sustained by an object */
956 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
958 /* A list of various magical qualities an object may have */
959 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
960 + 1 /* Permanent Light */
962 + 1 /* type of curse */
963 + 1]; /* sentinel NULL */
965 /* Additional ability or resistance */
968 /* A string describing an artifact's activation */
971 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
977 * @brief ファイルポインタ先に同じ文字を複数出力する /
978 * Write out `n' of the character `c' to the spoiler file
983 static void spoiler_out_n_chars(int n, char c)
985 while (--n >= 0) fputc(c, fff);
990 * @brief ファイルポインタ先に改行を複数出力する /
991 * Write out `n' blank lines to the spoiler file
995 static void spoiler_blanklines(int n)
997 spoiler_out_n_chars(n, '\n');
1002 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1003 * Write a line to the spoiler file and then "underline" it with hypens
1004 * @param str 出力したい文字列
1007 static void spoiler_underline(cptr str)
1009 fprintf(fff, "%s\n", str);
1010 spoiler_out_n_chars(strlen(str), '-');
1017 * @brief アーティファクトの特性一覧を出力する /
1018 * Write a line to the spoiler file and then "underline" it with hypens
1019 * @param art_flags アーティファクトのフラグ群
1020 * @param flag_ptr フラグ記述情報の参照ポインタ
1021 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1022 * @param n_elmnts フラグの要素数
1023 * @return desc_ptrと同じアドレス
1026 * This function does most of the actual "analysis". Given a set of bit flags
1027 * (which will be from one of the flags fields from the object in question),
1028 * a "flag description structure", a "description list", and the number of
1029 * elements in the "flag description structure", this function sets the
1030 * "description list" members to the appropriate descriptions contained in
1031 * the "flag description structure".
1032 * The possibly updated description pointer is returned.
1035 static cptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
1036 const flag_desc *flag_ptr,
1037 cptr *desc_ptr, const int n_elmnts)
1041 for (i = 0; i < n_elmnts; ++i)
1043 if (have_flag(art_flags, flag_ptr[i].flag))
1045 *desc_ptr++ = flag_ptr[i].desc;
1054 * @brief アイテムの特定記述内容を返す /
1055 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1056 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1057 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
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 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1069 * List "player traits" altered by an artifact's pval. These include stats,
1070 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1071 * @param o_ptr オブジェクト構造体の参照ポインタ
1072 * @param p_ptr pval修正構造体の参照ポインタ
1075 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1077 BIT_FLAGS flgs[TR_FLAG_SIZE];
1081 /* If pval == 0, there is nothing to do. */
1084 /* An "empty" pval description indicates that pval == 0 */
1085 pi_ptr->pval_desc[0] = '\0';
1089 /* Extract the flags */
1090 object_flags(o_ptr, flgs);
1092 affects_list = pi_ptr->pval_affects;
1094 /* Create the "+N" string */
1095 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1097 /* First, check to see if the pval affects all stats */
1098 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1099 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1100 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1102 *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 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1126 * Note the slaying specialties of a weapon
1127 * @param o_ptr オブジェクト構造体の参照ポインタ
1128 * @param slay_list 種族スレイ構造体の参照ポインタ
1131 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1133 BIT_FLAGS flgs[TR_FLAG_SIZE];
1135 object_flags(o_ptr, flgs);
1137 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1138 N_ELEMENTS(slay_flags_desc));
1140 /* Terminate the description list */
1146 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1147 * Note an object's elemental brands
1148 * @param o_ptr オブジェクト構造体の参照ポインタ
1149 * @param brand_list 属性ブランド構造体の参照ポインタ
1152 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1154 BIT_FLAGS flgs[TR_FLAG_SIZE];
1156 object_flags(o_ptr, flgs);
1158 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1159 N_ELEMENTS(brand_flags_desc));
1161 /* Terminate the description list */
1167 * @brief アーティファクトの通常耐性を構造体に収める /
1168 * Note an object's elemental brands
1169 * @param o_ptr オブジェクト構造体の参照ポインタ
1170 * @param resist_list 通常耐性構造体の参照ポインタ
1173 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1175 BIT_FLAGS flgs[TR_FLAG_SIZE];
1177 object_flags(o_ptr, flgs);
1179 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1180 resist_list, N_ELEMENTS(resist_flags_desc));
1182 /* Terminate the description list */
1183 *resist_list = NULL;
1188 * @brief アーティファクトの免疫特性を構造体に収める /
1189 * Note the immunities granted by an object
1190 * @param o_ptr オブジェクト構造体の参照ポインタ
1191 * @param immune_list 免疫構造体の参照ポインタ
1194 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1196 BIT_FLAGS flgs[TR_FLAG_SIZE];
1198 object_flags(o_ptr, flgs);
1200 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1201 immune_list, N_ELEMENTS(immune_flags_desc));
1203 /* Terminate the description list */
1204 *immune_list = NULL;
1209 * @brief アーティファクトの維持特性を構造体に収める /
1210 * Note which stats an object sustains
1211 * @param o_ptr オブジェクト構造体の参照ポインタ
1212 * @param sustain_list 維持特性構造体の参照ポインタ
1215 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1217 BIT_FLAGS flgs[TR_FLAG_SIZE];
1219 object_flags(o_ptr, flgs);
1221 /* Simplify things if an item sustains all stats */
1222 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1223 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1224 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1226 *sustain_list++ = _("全能力", "All stats");
1229 /* Should we bother? */
1230 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1231 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1232 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1234 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1236 N_ELEMENTS(sustain_flags_desc));
1239 /* Terminate the description list */
1240 *sustain_list = NULL;
1245 * @brief アーティファクトのその他の特性を構造体に収める /
1246 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1247 * free action, permanent light, etc.
1248 * @param o_ptr オブジェクト構造体の参照ポインタ
1249 * @param misc_list その他の特性構造体の参照ポインタ
1252 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1254 BIT_FLAGS flgs[TR_FLAG_SIZE];
1258 object_flags(o_ptr, flgs);
1260 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1261 N_ELEMENTS(misc_flags2_desc));
1263 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1264 N_ELEMENTS(misc_flags3_desc));
1267 * Glowing artifacts -- small radius light.
1270 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1271 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1272 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1273 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1274 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1275 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1277 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1279 if (have_flag(flgs, TR_LITE_FUEL))
1281 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
1285 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), (int)rad);
1286 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), (int)-rad);
1289 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1292 * Handle cursed objects here to avoid redundancies such as noting
1293 * that a permanently cursed object is heavily cursed as well as
1294 * being "lightly cursed".
1297 /* if (object_is_cursed(o_ptr)) */
1299 if (have_flag(flgs, TR_TY_CURSE))
1301 *misc_list++ = _("太古の怨念", "Ancient Curse");
1303 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1305 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1307 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1309 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1312 else if (o_ptr->curse_flags & TRC_CURSED)
1314 *misc_list++ = _("呪い", "Cursed");
1316 if (have_flag(flgs, TR_ADD_L_CURSE))
1318 *misc_list++ = _("呪いを増やす", "Cursing");
1320 if (have_flag(flgs, TR_ADD_H_CURSE))
1322 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1326 /* Terminate the description list */
1332 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1333 * Note additional ability and/or resistance of fixed artifacts
1334 * @param o_ptr オブジェクト構造体の参照ポインタ
1335 * @param addition 追加ランダム耐性構造体の参照ポインタ
1338 static void analyze_addition(object_type *o_ptr, char *addition)
1340 artifact_type *a_ptr = &a_info[o_ptr->name1];
1343 strcpy(addition, "");
1346 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1347 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1349 strcat(addition, "能力");
1350 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1352 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1354 strcat(addition, "耐性");
1355 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1357 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1359 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1360 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1362 strcat(addition, "Ability");
1363 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1365 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1367 strcat(addition, "Resistance");
1368 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1370 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1376 * @brief アーティファクトの基本情報を文字列に収める /
1377 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1378 * and its value in gold pieces
1379 * @param o_ptr オブジェクト構造体の参照ポインタ
1380 * @param misc_desc 基本情報を収める文字列参照ポインタ
1383 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1385 artifact_type *a_ptr = &a_info[o_ptr->name1];
1387 sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"),
1388 (int)a_ptr->level, a_ptr->rarity,
1390 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1392 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1398 * @brief アーティファクトの情報全体を構造体に収める /
1399 * Fill in an object description structure for a given object
1400 * and its value in gold pieces
1401 * @param o_ptr オブジェクト構造体の参照ポインタ
1402 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1405 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1407 analyze_general(o_ptr, desc_ptr->description);
1408 analyze_pval(o_ptr, &desc_ptr->pval_info);
1409 analyze_brand(o_ptr, desc_ptr->brands);
1410 analyze_slay(o_ptr, desc_ptr->slays);
1411 analyze_immune(o_ptr, desc_ptr->immunities);
1412 analyze_resist(o_ptr, desc_ptr->resistances);
1413 analyze_sustains(o_ptr, desc_ptr->sustains);
1414 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1415 analyze_addition(o_ptr, desc_ptr->addition);
1416 analyze_misc(o_ptr, desc_ptr->misc_desc);
1417 desc_ptr->activation = item_activation(o_ptr);
1422 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1425 static void print_header(void)
1429 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1430 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1431 spoiler_underline(buf);
1435 * This is somewhat ugly.
1437 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1438 * and a separator character (',', e.g.), write the list to the spoiler file
1439 * in a "nice" format, such as:
1441 * Resist Fire, Cold, Acid
1443 * That was a simple example, but when the list is long, a line wrap
1444 * should occur, and this should induce a new level of indention if
1445 * a list is being spread across lines. So for example, Bladeturner's
1446 * list of resistances should look something like this
1448 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1449 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1451 * However, the code distinguishes between a single list of many items vs.
1452 * many lists. (The separator is used to make this determination.) A single
1453 * list of many items will not cause line wrapping (since there is no
1454 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1455 * might look like this:
1457 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1460 * So comparing the two, "Regeneration" has no trailing separator and
1461 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1462 * but that's not relevant to line wrapping and indention.)
1465 /* ITEM_SEP separates items within a list */
1466 #define ITEM_SEP ','
1469 /* LIST_SEP separates lists */
1471 #define LIST_SEP ','
1473 #define LIST_SEP ';'
1477 * @brief フラグ名称を出力する汎用関数
1478 * @param header ヘッダに出力するフラグ群の名前
1479 * @param list フラグ名リスト
1480 * @param separator フラグ表示の区切り記号
1483 static void spoiler_outlist(cptr header, cptr *list, char separator)
1485 int line_len, buf_len;
1486 char line[MAX_LINE_LEN+1], buf[80];
1488 /* Ignore an empty list */
1489 if (*list == NULL) return;
1491 /* This function always indents */
1492 strcpy(line, INDENT1);
1494 /* Create header (if one was given) */
1495 if (header && (header[0]))
1497 strcat(line, header);
1501 line_len = strlen(line);
1503 /* Now begin the tedious task */
1506 /* Copy the current item to a buffer */
1509 /* Note the buffer's length */
1510 buf_len = strlen(buf);
1513 * If there is an item following this one, pad with separator and
1514 * a space and adjust the buffer length
1519 sprintf(buf + buf_len, "%c ", separator);
1524 * If the buffer will fit on the current line, just append the
1525 * buffer to the line and adjust the line length accordingly.
1528 if (line_len + buf_len <= MAX_LINE_LEN)
1531 line_len += buf_len;
1534 /* Apply line wrapping and indention semantics described above */
1538 * Don't print a trailing list separator but do print a trailing
1541 if (line_len > 1 && line[line_len - 1] == ' '
1542 && line[line_len - 2] == LIST_SEP)
1544 /* Ignore space and separator */
1545 line[line_len - 2] = '\0';
1547 /* Write to spoiler file */
1548 fprintf(fff, "%s\n", line);
1550 /* Begin new line at primary indention level */
1551 sprintf(line, "%s%s", INDENT1, buf);
1556 /* Write to spoiler file */
1557 fprintf(fff, "%s\n", line);
1559 /* Begin new line at secondary indention level */
1560 sprintf(line, "%s%s", INDENT2, buf);
1563 line_len = strlen(line);
1566 /* Advance, with break */
1567 if (!*++list) break;
1570 /* Write what's left to the spoiler file */
1571 fprintf(fff, "%s\n", line);
1575 * @brief アーティファクト一件をスポイラー出力する /
1576 * Create a spoiler file entry for an artifact
1577 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1580 static void spoiler_print_art(obj_desc_list *art_ptr)
1582 pval_info_type *pval_ptr = &art_ptr->pval_info;
1586 /* Don't indent the first line */
1587 fprintf(fff, "%s\n", art_ptr->description);
1589 /* An "empty" pval description indicates that the pval affects nothing */
1590 if (pval_ptr->pval_desc[0])
1592 /* Mention the effects of pval */
1593 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1594 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1597 /* Now deal with the description lists */
1600 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1601 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1602 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1603 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1604 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1606 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1607 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1608 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1609 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1610 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1612 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1614 if (art_ptr->addition[0])
1616 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1619 /* Write out the possible activation at the primary indention level */
1620 if (art_ptr->activation)
1622 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1625 /* End with the miscellaneous facts */
1626 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1631 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1632 * Hack -- Create a "forged" artifact
1633 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1634 * @param name1 生成するアーティファクトID
1635 * @return 生成が成功した場合TRUEを返す
1637 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1641 artifact_type *a_ptr = &a_info[name1];
1644 /* Ignore "empty" artifacts */
1645 if (!a_ptr->name) return FALSE;
1647 /* Acquire the "kind" index */
1648 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1651 if (!i) return (FALSE);
1653 /* Create the artifact */
1654 object_prep(o_ptr, i);
1657 o_ptr->name1 = (byte_hack)name1;
1659 /* Extract the fields */
1660 o_ptr->pval = a_ptr->pval;
1661 o_ptr->ac = a_ptr->ac;
1662 o_ptr->dd = a_ptr->dd;
1663 o_ptr->ds = a_ptr->ds;
1664 o_ptr->to_a = a_ptr->to_a;
1665 o_ptr->to_h = a_ptr->to_h;
1666 o_ptr->to_d = a_ptr->to_d;
1667 o_ptr->weight = a_ptr->weight;
1675 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1676 * Create a spoiler file for artifacts
1677 * @param fname 生成ファイル名
1680 static void spoil_artifact(cptr fname)
1688 obj_desc_list artifact;
1693 /* Build the filename */
1694 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1696 /* File type is "TEXT" */
1697 FILE_TYPE(FILE_TYPE_TEXT);
1700 fff = my_fopen(buf, "w");
1705 msg_print("Cannot create spoiler file.");
1709 /* Dump the header */
1712 /* List the artifacts by tval */
1713 for (i = 0; group_artifact[i].tval; i++)
1715 /* Write out the group title */
1716 if (group_artifact[i].name)
1718 spoiler_blanklines(2);
1719 spoiler_underline(group_artifact[i].name);
1720 spoiler_blanklines(1);
1723 /* Now search through all of the artifacts */
1724 for (j = 1; j < max_a_idx; ++j)
1726 artifact_type *a_ptr = &a_info[j];
1728 /* We only want objects in the current group */
1729 if (a_ptr->tval != group_artifact[i].tval) continue;
1731 /* Get local object */
1734 /* Wipe the object */
1737 /* Attempt to "forge" the artifact */
1738 if (!make_fake_artifact(q_ptr, j)) continue;
1740 /* Analyze the artifact */
1741 object_analyze(q_ptr, &artifact);
1743 /* Write out the artifact description to the spoiler file */
1744 spoiler_print_art(&artifact);
1748 /* Check for errors */
1749 if (ferror(fff) || my_fclose(fff))
1751 msg_print("Cannot close spoiler file.");
1756 msg_print("Successfully created a spoiler file.");
1761 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1762 * Create a spoiler file for monsters -BEN-
1763 * @param fname 生成ファイル名
1766 static void spoil_mon_desc(cptr fname)
1783 /* Build the filename */
1784 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1786 /* File type is "TEXT" */
1787 FILE_TYPE(FILE_TYPE_TEXT);
1790 fff = my_fopen(buf, "w");
1795 msg_print("Cannot create spoiler file.");
1799 /* Allocate the "who" array */
1800 C_MAKE(who, max_r_idx, s16b);
1802 /* Dump the header */
1803 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1804 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1805 fprintf(fff, "------------------------------------------\n\n");
1807 /* Dump the header */
1808 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1809 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1810 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1811 "--------", "---", "---", "---", "--", "--", "-----------");
1814 /* Scan the monsters */
1815 for (i = 1; i < max_r_idx; i++)
1817 monster_race *r_ptr = &r_info[i];
1819 /* Use that monster */
1820 if (r_ptr->name) who[n++] = (s16b)i;
1823 /* Select the sort method */
1824 ang_sort_comp = ang_sort_comp_hook;
1825 ang_sort_swap = ang_sort_swap_hook;
1827 /* Sort the array by dungeon depth of monsters */
1828 ang_sort(who, &why, n);
1831 for (i = 0; i < n; i++)
1833 monster_race *r_ptr = &r_info[who[i]];
1835 cptr name = (r_name + r_ptr->name);
1836 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1838 /* Get the "name" */
1840 else if (r_ptr->flags3 & (RF3_NO_CONF))
1842 sprintf(nam, "[*] %s", name);
1845 else if (r_ptr->flags1 & (RF1_UNIQUE))
1847 sprintf(nam, "[U] %s", name);
1851 sprintf(nam, _(" %s", "The %s"), name);
1856 sprintf(lev, "%d", (int)r_ptr->level);
1859 sprintf(rar, "%d", (int)r_ptr->rarity);
1862 if (r_ptr->speed >= 110)
1864 sprintf(spd, "+%d", (r_ptr->speed - 110));
1868 sprintf(spd, "-%d", (110 - r_ptr->speed));
1872 sprintf(ac, "%d", r_ptr->ac);
1875 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1877 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1881 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1886 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1888 /* Hack -- use visual instead */
1889 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1892 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1893 nam, lev, rar, spd, hp, ac, exp);
1900 /* Free the "who" array */
1901 C_KILL(who, max_r_idx, s16b);
1903 /* Check for errors */
1904 if (ferror(fff) || my_fclose(fff))
1906 msg_print("Cannot close spoiler file.");
1911 msg_print("Successfully created a spoiler file.");
1918 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1920 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1926 * @brief 文字列をファイルポインタに出力する /
1927 * Buffer text to the given file. (-SHAWN-)
1928 * This is basically c_roff() from mon-desc.c with a few changes.
1929 * @param str 文字列参照ポインタ
1932 static void spoil_out(cptr str)
1937 static char roff_buf[256];
1940 static char roff_waiting_buf[256];
1943 bool iskanji_flag = FALSE;
1945 /* Current pointer into line roff_buf */
1946 static char *roff_p = roff_buf;
1948 /* Last space saved into roff_buf */
1949 static char *roff_s = NULL;
1951 /* Mega-Hack -- Delayed output */
1952 static bool waiting_output = FALSE;
1954 /* Special handling for "new sequence" */
1959 fputs(roff_waiting_buf, fff);
1960 waiting_output = FALSE;
1963 if (roff_p != roff_buf) roff_p--;
1964 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1966 if (roff_p == roff_buf) fprintf(fff, "\n");
1969 *(roff_p + 1) = '\0';
1970 fprintf(fff, "%s\n\n", roff_buf);
1979 /* Scan the given string, character at a time */
1984 bool k_flag = iskanji((unsigned char)(*str));
1987 bool wrap = (ch == '\n');
1990 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1991 iskanji_flag = k_flag && !iskanji_flag;
1993 if (!isprint(ch)) ch = ' ';
1998 fputs(roff_waiting_buf, fff);
1999 if (!wrap) fputc('\n', fff);
2000 waiting_output = FALSE;
2006 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
2007 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2009 if (roff_p >= roff_buf + 75) wrap = TRUE;
2010 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2017 bool iskanji_flag_local = FALSE;
2018 cptr tail = str + (k_flag ? 2 : 1);
2020 cptr tail = str + 1;
2023 for (; *tail; tail++)
2025 if (*tail == ' ') continue;
2028 k_flag_local = iskanji((unsigned char)(*tail));
2029 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
2030 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2032 if (isprint(*tail)) break;
2036 if (!*tail) waiting_output = TRUE;
2040 /* Handle line-wrap */
2048 if (roff_s && (ch != ' '))
2056 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2057 else strcpy(roff_waiting_buf, roff_buf);
2061 if (cbak != ' ') *roff_p++ = cbak;
2063 while (*r) *roff_p++ = *r++;
2067 if ((roff_p > roff_buf) || (ch != ' '))
2072 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2077 strncmp(str, "。", 2) != 0 &&
2078 strncmp(str, "、", 2) != 0 &&
2079 strncmp(str, "ィ", 2) != 0 &&
2080 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2083 if (ch == ' ') roff_s = roff_p;
2094 * @brief 関数ポインタ用の出力関数 /
2095 * Hook function used in spoil_mon_info()
2097 * @param str 文字列参照ポインタ
2100 static void roff_func(byte attr, cptr str)
2110 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2111 * Create a spoiler file for monsters (-SHAWN-)
2112 * @param fname ファイル名
2115 static void spoil_mon_info(cptr fname)
2124 /* Build the filename */
2125 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2127 /* File type is "TEXT" */
2128 FILE_TYPE(FILE_TYPE_TEXT);
2131 fff = my_fopen(buf, "w");
2136 msg_print("Cannot create spoiler file.");
2141 /* Dump the header */
2142 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2143 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2146 spoil_out("------------------------------------------\n\n");
2148 /* Allocate the "who" array */
2149 C_MAKE(who, max_r_idx, s16b);
2151 /* Scan the monsters */
2152 for (i = 1; i < max_r_idx; i++)
2154 monster_race *r_ptr = &r_info[i];
2156 /* Use that monster */
2157 if (r_ptr->name) who[n++] = (s16b)i;
2160 /* Select the sort method */
2161 ang_sort_comp = ang_sort_comp_hook;
2162 ang_sort_swap = ang_sort_swap_hook;
2164 /* Sort the array by dungeon depth of monsters */
2165 ang_sort(who, &why, n);
2169 * List all monsters in order
2171 for (l = 0; l < n; l++)
2173 monster_race *r_ptr = &r_info[who[l]];
2175 /* Extract the flags */
2176 flags1 = r_ptr->flags1;
2180 if (flags1 & (RF1_QUESTOR))
2186 if (flags1 & (RF1_UNIQUE))
2198 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2203 spoil_out(attr_to_text(r_ptr));
2206 sprintf(buf, " '%c')\n", r_ptr->d_char);
2211 sprintf(buf, "=== ");
2215 sprintf(buf, "Num:%d ", who[l]);
2219 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2223 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2227 if (r_ptr->speed >= 110)
2229 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2233 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2238 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2240 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2244 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2249 sprintf(buf, "Ac:%d ", r_ptr->ac);
2253 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2256 /* Reuse the code of monster recall. */
2257 output_monster_spoiler(who[l], roff_func);
2262 /* Free the "who" array */
2263 C_KILL(who, max_r_idx, s16b);
2265 /* Check for errors */
2266 if (ferror(fff) || my_fclose(fff))
2268 msg_print("Cannot close spoiler file.");
2272 msg_print("Successfully created a spoiler file.");
2277 #define MAX_EVOL_DEPTH 64
2281 * @brief int配列でstrncmp()と似た比較処理を行う /
2282 * Compare two int-type array like strncmp() and return TRUE if equals
2283 * @param a 比較するint配列1
2284 * @param b 比較するint配列2
2286 * @return 両者の値が等しければTRUEを返す
2288 static bool int_n_cmp(int *a, int *b, int length)
2290 /* Null-string comparation is always TRUE */
2291 if (!length) return TRUE;
2295 if (*a != *(b++)) return FALSE;
2296 if (!(*(a++))) break;
2305 * @brief ある木が指定された木の部分木かどうかを返す /
2306 * Returns TRUE if an evolution tree is "partial tree"
2307 * @param tree 元となる木構造リスト
2308 * @param partial_tree 部分木かどうか判定したい木構造リスト
2309 * @return 部分木ならばTRUEを返す
2311 static bool is_partial_tree(int *tree, int *partial_tree)
2313 int pt_head = *(partial_tree++);
2316 while (partial_tree[pt_len]) pt_len++;
2320 if (*(tree++) == pt_head)
2322 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2331 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2332 * Sorting hook -- Comp function
2335 * @param a 比較したいモンスター種族ID1
2336 * @param b 比較したいモンスター種族ID2
2337 * @return 2が大きければTRUEを返す
2339 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2341 int **evol_tree = (int **)u;
2343 int w1 = evol_tree[a][0];
2344 int w2 = evol_tree[b][0];
2345 monster_race *r1_ptr = &r_info[w1];
2346 monster_race *r2_ptr = &r_info[w2];
2351 /* Used tree first */
2352 if (w1 && !w2) return TRUE;
2353 if (!w1 && w2) return FALSE;
2355 /* Sort by monster level */
2356 if (r1_ptr->level < r2_ptr->level) return TRUE;
2357 if (r1_ptr->level > r2_ptr->level) return FALSE;
2359 /* Sort by monster experience */
2360 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2361 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2363 /* Compare indexes */
2368 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2369 * Sorting hook -- Swap function
2372 * @param a スワップしたい木構造1
2373 * @param b スワップしたい木構造2
2374 * @return 2が大きければTRUEを返す
2376 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2378 int **evol_tree = (int **)u;
2385 holder = evol_tree[a];
2386 evol_tree[a] = evol_tree[b];
2387 evol_tree[b] = holder;
2391 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2392 * Print monsters' evolution information to file
2393 * @param fname 出力ファイル名
2396 static void spoil_mon_evol(cptr fname)
2399 monster_race *r_ptr;
2400 int **evol_tree, i, j, n, r_idx;
2401 int *evol_tree_zero; /* For C_KILL() */
2403 /* Build the filename */
2404 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2406 /* File type is "TEXT" */
2407 FILE_TYPE(FILE_TYPE_TEXT);
2410 fff = my_fopen(buf, "w");
2415 msg_print("Cannot create spoiler file.");
2419 /* Dump the header */
2420 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2421 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2424 spoil_out("------------------------------------------\n\n");
2426 /* Allocate the "evol_tree" array (2-dimension) */
2427 C_MAKE(evol_tree, max_r_idx, int *);
2428 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2429 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2430 evol_tree_zero = *evol_tree;
2432 /* Step 1: Build the evolution tree */
2433 for (i = 1; i < max_r_idx; i++)
2438 if (!r_ptr->next_exp) continue;
2440 /* Trace evolution */
2442 evol_tree[i][n++] = i;
2445 evol_tree[i][n++] = r_ptr->next_r_idx;
2446 r_ptr = &r_info[r_ptr->next_r_idx];
2448 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2451 /* Step 2: Scan the evolution trees and remove "partial tree" */
2452 for (i = 1; i < max_r_idx; i++)
2454 /* Not evolution tree */
2455 if (!evol_tree[i][0]) continue;
2457 for (j = 1; j < max_r_idx; j++)
2460 if (i == j) continue;
2462 /* Not evolution tree */
2463 if (!evol_tree[j][0]) continue;
2465 /* Is evolution tree[i] is part of [j]? */
2466 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2468 /* Remove this evolution tree */
2469 evol_tree[i][0] = 0;
2475 /* Step 3: Sort the evolution trees */
2477 /* Select the sort method */
2478 ang_sort_comp = ang_sort_comp_evol_tree;
2479 ang_sort_swap = ang_sort_swap_evol_tree;
2481 /* Sort the array */
2482 ang_sort(evol_tree, NULL, max_r_idx);
2484 /* Step 4: Print the evolution trees */
2485 for (i = 0; i < max_r_idx; i++)
2487 r_idx = evol_tree[i][0];
2489 /* No evolution or removed evolution tree */
2490 if (!r_idx) continue;
2492 /* Trace the evolution tree */
2493 r_ptr = &r_info[r_idx];
2494 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2495 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2497 for (n = 1; r_ptr->next_exp; n++)
2499 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2500 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2501 r_ptr = &r_info[r_ptr->next_r_idx];
2502 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2503 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2506 /* End of evolution tree */
2510 /* Free the "evol_tree" array (2-dimension) */
2511 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2512 C_KILL(evol_tree, max_r_idx, int *);
2514 /* Check for errors */
2515 if (ferror(fff) || my_fclose(fff))
2517 msg_print("Cannot close spoiler file.");
2522 msg_print("Successfully created a spoiler file.");
2530 extern void do_cmd_spoilers(void);
2533 * @brief スポイラー出力を行うコマンドのメインルーチン /
2534 * Create Spoiler files -BEN-
2537 void do_cmd_spoilers(void)
2539 /* Save the screen */
2549 prt("Create a spoiler file.", 2, 0);
2551 /* Prompt for a file */
2552 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2553 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2554 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2555 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2556 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2559 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2566 /* Restore the screen */
2572 spoil_obj_desc("obj-desc.txt");
2577 spoil_artifact("artifact.txt");
2582 spoil_mon_desc("mon-desc.txt");
2587 spoil_mon_info("mon-info.txt");
2592 spoil_mon_evol("mon-evol.txt");
2601 /* Flush messages */
2607 * @brief ランダムアーティファクト1件を解析する /
2608 * Fill in an object description structure for a given object
2609 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2610 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2613 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2615 analyze_general(o_ptr, desc_ptr->description);
2616 analyze_pval(o_ptr, &desc_ptr->pval_info);
2617 analyze_brand(o_ptr, desc_ptr->brands);
2618 analyze_slay(o_ptr, desc_ptr->slays);
2619 analyze_immune(o_ptr, desc_ptr->immunities);
2620 analyze_resist(o_ptr, desc_ptr->resistances);
2621 analyze_sustains(o_ptr, desc_ptr->sustains);
2622 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2623 desc_ptr->activation = item_activation(o_ptr);
2625 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2626 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2628 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2629 o_ptr->weight / 10, o_ptr->weight % 10);
2634 * @brief ランダムアーティファクト1件をスポイラー出力する /
2635 * Create a spoiler file entry for an artifact
2636 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2637 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2638 * Fill in an object description structure for a given object
2641 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2643 pval_info_type *pval_ptr = &art_ptr->pval_info;
2647 /* Don't indent the first line */
2648 fprintf(fff, "%s\n", art_ptr->description);
2651 if (!(o_ptr->ident & (IDENT_MENTAL)))
2653 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2656 /* An "empty" pval description indicates that the pval affects nothing */
2657 if (pval_ptr->pval_desc[0])
2659 /* Mention the effects of pval */
2660 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2661 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2664 /* Now deal with the description lists */
2667 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2668 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2669 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2670 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2671 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2673 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2674 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2675 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2676 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2677 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2679 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2681 /* Write out the possible activation at the primary indention level */
2682 if (art_ptr->activation)
2684 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2687 /* End with the miscellaneous facts */
2688 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2693 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2694 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2695 * @param i 出力したい記録ランダムアーティファクトID
2698 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2700 obj_desc_list artifact;
2702 if (!object_is_known(o_ptr) || !o_ptr->art_name
2703 || o_ptr->tval != group_artifact[i].tval)
2706 /* Analyze the artifact */
2707 random_artifact_analyze(o_ptr, &artifact);
2709 /* Write out the artifact description to the spoiler file */
2710 spoiler_print_randart(o_ptr, &artifact);
2714 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2715 * Create a list file for random artifacts
2716 * @param fname 出力ファイル名
2719 void spoil_random_artifact(cptr fname)
2729 /* Build the filename */
2730 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2732 /* File type is "TEXT" */
2733 FILE_TYPE(FILE_TYPE_TEXT);
2736 fff = my_fopen(buf, "w");
2741 msg_print("Cannot create list file.");
2745 /* Dump the header */
2746 sprintf(buf, "Random artifacts list.\r");
2747 spoiler_underline(buf);
2749 /* List the artifacts by tval */
2750 for (j = 0; group_artifact[j].tval; j++)
2752 /* random artifacts wielding */
2753 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2755 q_ptr = &inventory[i];
2756 spoil_random_artifact_aux(q_ptr, j);
2759 /* random artifacts in inventory */
2760 for (i = 0; i < INVEN_PACK; i++)
2762 q_ptr = &inventory[i];
2763 spoil_random_artifact_aux(q_ptr, j);
2766 /* random artifacts in home */
2767 st_ptr = &town[1].store[STORE_HOME];
2768 for (i = 0; i < st_ptr->stock_num; i++)
2770 q_ptr = &st_ptr->stock[i];
2771 spoil_random_artifact_aux(q_ptr, j);
2774 /* random artifacts in museum */
2775 st_ptr = &town[1].store[STORE_MUSEUM];
2776 for (i = 0; i < st_ptr->stock_num; i++)
2778 q_ptr = &st_ptr->stock[i];
2779 spoil_random_artifact_aux(q_ptr, j);
2783 /* Check for errors */
2784 if (ferror(fff) || my_fclose(fff))
2786 msg_print("Cannot close list file.");
2791 msg_print("Successfully created a list file.");
2798 #endif /* MACINTOSH */