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.");
471 msg_print("Successfully created a spoiler file.");
476 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
481 * Returns a "+" string if a number is non-negative and an empty
484 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
487 * These are used to format the artifact spoiler file. INDENT1 is used
488 * to indent all but the first line of an artifact spoiler. INDENT2 is
489 * used when a line "wraps". (Bladeturner's resistances cause this.)
495 * MAX_LINE_LEN specifies when a line should wrap.
497 #define MAX_LINE_LEN 75
500 * Given an array, determine how many elements are in the array
502 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
505 * The artifacts categorized by type
507 static grouper group_artifact[] =
511 { TV_POLEARM, "槍/斧" },
513 { TV_DIGGING, "シャベル/つるはし" },
518 { TV_SOFT_ARMOR, "鎧" },
519 { TV_HARD_ARMOR, NULL },
520 { TV_DRAG_ARMOR, NULL },
522 { TV_CLOAK, "クローク" },
531 { TV_AMULET, "アミュレット" },
534 { TV_SWORD, "Edged Weapons" },
535 { TV_POLEARM, "Polearms" },
536 { TV_HAFTED, "Hafted Weapons" },
537 { TV_DIGGING, "Shovels/Picks" },
539 { TV_ARROW, "Ammo" },
542 { TV_SOFT_ARMOR, "Body Armor" },
543 { TV_HARD_ARMOR, NULL },
544 { TV_DRAG_ARMOR, NULL },
546 { TV_CLOAK, "Cloaks" },
547 { TV_SHIELD, "Shields" },
549 { TV_HELM, "Helms/Crowns" },
551 { TV_GLOVES, "Gloves" },
552 { TV_BOOTS, "Boots" },
554 { TV_LITE, "Light Sources" },
555 { TV_AMULET, "Amulets" },
556 { TV_RING, "Rings" },
565 * Pair together a constant flag with a textual description.
567 * Used by both "init.c" and "wiz-spo.c".
569 * Note that it sometimes more efficient to actually make an array
570 * of textual names, where entry 'N' is assumed to be paired with
571 * the flag whose value is "1L << N", but that requires hard-coding.
574 typedef struct flag_desc flag_desc;
579 const char *const desc;
585 * These are used for "+3 to STR, DEX", etc. These are separate from
586 * the other pval affected traits to simplify the case where an object
587 * affects all stats. In this case, "All stats" is used instead of
588 * listing each stat individually.
591 static flag_desc stat_flags_desc[] =
611 * Besides stats, these are the other player traits
612 * which may be affected by an object's pval
615 static flag_desc pval_flags1_desc[] =
618 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
619 { TR_STEALTH, "隠密" },
621 { TR_INFRA, "赤外線視力" },
623 { TR_BLOWS, "攻撃回数" },
626 { TR_STEALTH, "Stealth" },
627 { TR_SEARCH, "Searching" },
628 { TR_INFRA, "Infravision" },
629 { TR_TUNNEL, "Tunneling" },
630 { TR_BLOWS, "Attacks" },
631 { TR_SPEED, "Speed" }
636 * Slaying preferences for weapons
639 static flag_desc slay_flags_desc[] =
642 { TR_SLAY_ANIMAL, "動物" },
643 { TR_KILL_ANIMAL, "*動物*" },
644 { TR_SLAY_EVIL, "邪悪" },
645 { TR_KILL_EVIL, "*邪悪*" },
646 { TR_SLAY_HUMAN, "人間" },
647 { TR_KILL_HUMAN, "*人間*" },
648 { TR_SLAY_UNDEAD, "アンデッド" },
649 { TR_KILL_UNDEAD, "*アンデッド*" },
650 { TR_SLAY_DEMON, "悪魔" },
651 { TR_KILL_DEMON, "*悪魔*" },
652 { TR_SLAY_ORC, "オーク" },
653 { TR_KILL_ORC, "*オーク*" },
654 { TR_SLAY_TROLL, "トロル" },
655 { TR_KILL_TROLL, "*トロル*" },
656 { TR_SLAY_GIANT, "巨人" },
657 { TR_KILL_GIANT, "*巨人*" },
658 { TR_SLAY_DRAGON, "ドラゴン" },
659 { TR_KILL_DRAGON, "*ドラゴン*" },
661 { TR_SLAY_ANIMAL, "Animal" },
662 { TR_KILL_ANIMAL, "XAnimal" },
663 { TR_SLAY_EVIL, "Evil" },
664 { TR_KILL_EVIL, "XEvil" },
665 { TR_SLAY_HUMAN, "Human" },
666 { TR_KILL_HUMAN, "XHuman" },
667 { TR_SLAY_UNDEAD, "Undead" },
668 { TR_KILL_UNDEAD, "XUndead" },
669 { TR_SLAY_DEMON, "Demon" },
670 { TR_KILL_DEMON, "XDemon" },
671 { TR_SLAY_ORC, "Orc" },
672 { TR_KILL_ORC, "XOrc" },
673 { TR_SLAY_TROLL, "Troll" },
674 { TR_KILL_TROLL, "XTroll" },
675 { TR_SLAY_GIANT, "Giant" },
676 { TR_KILL_GIANT, "Xgiant" },
677 { TR_SLAY_DRAGON, "Dragon" },
678 { TR_KILL_DRAGON, "Xdragon" }
683 * Elemental brands for weapons
685 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
686 * coding, it has been included here along with the elemental
687 * brands. It does seem to fit in with the brands and slaying
688 * more than the miscellaneous section.
690 static flag_desc brand_flags_desc[] =
693 { TR_BRAND_ACID, "溶解" },
694 { TR_BRAND_ELEC, "電撃" },
695 { TR_BRAND_FIRE, "焼棄" },
696 { TR_BRAND_COLD, "凍結" },
697 { TR_BRAND_POIS, "毒殺" },
699 { TR_FORCE_WEAPON, "理力" },
700 { TR_CHAOTIC, "混沌" },
701 { TR_VAMPIRIC, "吸血" },
703 { TR_VORPAL, "切れ味" },
705 { TR_BRAND_ACID, "Acid Brand" },
706 { TR_BRAND_ELEC, "Lightning Brand" },
707 { TR_BRAND_FIRE, "Flame Tongue" },
708 { TR_BRAND_COLD, "Frost Brand" },
709 { TR_BRAND_POIS, "Poisoned" },
711 { TR_FORCE_WEAPON, "Force" },
712 { TR_CHAOTIC, "Mark of Chaos" },
713 { TR_VAMPIRIC, "Vampiric" },
714 { TR_IMPACT, "Earthquake impact on hit" },
715 { TR_VORPAL, "Very sharp" },
723 static const flag_desc resist_flags_desc[] =
726 { TR_RES_ACID, "酸" },
727 { TR_RES_ELEC, "電撃" },
728 { TR_RES_FIRE, "火炎" },
729 { TR_RES_COLD, "冷気" },
730 { TR_RES_POIS, "毒" },
731 { TR_RES_FEAR, "恐怖"},
732 { TR_RES_LITE, "閃光" },
733 { TR_RES_DARK, "暗黒" },
734 { TR_RES_BLIND, "盲目" },
735 { TR_RES_CONF, "混乱" },
736 { TR_RES_SOUND, "轟音" },
737 { TR_RES_SHARDS, "破片" },
738 { TR_RES_NETHER, "地獄" },
739 { TR_RES_NEXUS, "因果混乱" },
740 { TR_RES_CHAOS, "カオス" },
741 { TR_RES_DISEN, "劣化" },
743 { TR_RES_ACID, "Acid" },
744 { TR_RES_ELEC, "Lightning" },
745 { TR_RES_FIRE, "Fire" },
746 { TR_RES_COLD, "Cold" },
747 { TR_RES_POIS, "Poison" },
748 { TR_RES_FEAR, "Fear"},
749 { TR_RES_LITE, "Light" },
750 { TR_RES_DARK, "Dark" },
751 { TR_RES_BLIND, "Blindness" },
752 { TR_RES_CONF, "Confusion" },
753 { TR_RES_SOUND, "Sound" },
754 { TR_RES_SHARDS, "Shards" },
755 { TR_RES_NETHER, "Nether" },
756 { TR_RES_NEXUS, "Nexus" },
757 { TR_RES_CHAOS, "Chaos" },
758 { TR_RES_DISEN, "Disenchantment" },
763 * Elemental immunities (along with poison)
766 static const flag_desc immune_flags_desc[] =
770 { TR_IM_ELEC, "電撃" },
771 { TR_IM_FIRE, "火炎" },
772 { TR_IM_COLD, "冷気" },
774 { TR_IM_ACID, "Acid" },
775 { TR_IM_ELEC, "Lightning" },
776 { TR_IM_FIRE, "Fire" },
777 { TR_IM_COLD, "Cold" },
782 * Sustain stats - these are given their "own" line in the
783 * spoiler file, mainly for simplicity
785 static const flag_desc sustain_flags_desc[] =
788 { TR_SUST_STR, "腕力" },
789 { TR_SUST_INT, "知能" },
790 { TR_SUST_WIS, "賢さ" },
791 { TR_SUST_DEX, "器用さ" },
792 { TR_SUST_CON, "耐久力" },
793 { TR_SUST_CHR, "魅力" },
795 { TR_SUST_STR, "STR" },
796 { TR_SUST_INT, "INT" },
797 { TR_SUST_WIS, "WIS" },
798 { TR_SUST_DEX, "DEX" },
799 { TR_SUST_CON, "CON" },
800 { TR_SUST_CHR, "CHR" },
805 * Miscellaneous magic given by an object's "flags2" field
808 static const flag_desc misc_flags2_desc[] =
812 { TR_REFLECT, "反射" },
813 { TR_FREE_ACT, "麻痺知らず" },
814 { TR_HOLD_EXP, "経験値維持" },
816 { TR_THROW, "Throwing" },
817 { TR_REFLECT, "Reflection" },
818 { TR_FREE_ACT, "Free Action" },
819 { TR_HOLD_EXP, "Hold Experience" },
824 * Miscellaneous magic given by an object's "flags3" field
826 * Note that cursed artifacts and objects with permanent light
827 * are handled "directly" -- see analyze_misc_magic()
830 static const flag_desc misc_flags3_desc[] =
833 { TR_SH_FIRE, "火炎オーラ" },
834 { TR_SH_ELEC, "電撃オーラ" },
835 { TR_SH_COLD, "冷気オーラ" },
836 { TR_NO_TELE, "反テレポート" },
837 { TR_NO_MAGIC, "反魔法" },
838 { TR_LEVITATION, "浮遊" },
839 { TR_SEE_INVIS, "可視透明" },
840 { TR_TELEPATHY, "テレパシー" },
841 { TR_ESP_ANIMAL, "動物感知" },
842 { TR_ESP_UNDEAD, "不死感知" },
843 { TR_ESP_DEMON, "悪魔感知" },
844 { TR_ESP_ORC, "オーク感知" },
845 { TR_ESP_TROLL, "トロル感知" },
846 { TR_ESP_GIANT, "巨人感知" },
847 { TR_ESP_DRAGON, "ドラゴン感知" },
848 { TR_ESP_HUMAN, "人間感知" },
849 { TR_ESP_EVIL, "邪悪感知" },
850 { TR_ESP_GOOD, "善良感知" },
851 { TR_ESP_NONLIVING, "無生物感知" },
852 { TR_ESP_UNIQUE, "ユニーク感知" },
853 { TR_SLOW_DIGEST, "遅消化" },
854 { TR_REGEN, "急速回復" },
855 { TR_WARNING, "警告" },
856 /* { TR_XTRA_MIGHT, "強力射撃" }, */
857 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
858 { TR_DRAIN_EXP, "経験値吸収" },
859 { TR_AGGRAVATE, "反感" },
860 { TR_BLESSED, "祝福" },
861 { TR_DEC_MANA, "消費魔力減少" },
863 { TR_SH_FIRE, "Fiery Aura" },
864 { TR_SH_ELEC, "Electric Aura" },
865 { TR_SH_COLD, "Coldly Aura" },
866 { TR_NO_TELE, "Prevent Teleportation" },
867 { TR_NO_MAGIC, "Anti-Magic" },
868 { TR_LEVITATION, "Levitation" },
869 { TR_SEE_INVIS, "See Invisible" },
870 { TR_TELEPATHY, "ESP" },
871 { TR_ESP_ANIMAL, "Sense Animal" },
872 { TR_ESP_UNDEAD, "Sense Undead" },
873 { TR_ESP_DEMON, "Sense Demon" },
874 { TR_ESP_ORC, "Sense Orc" },
875 { TR_ESP_TROLL, "Sense Troll" },
876 { TR_ESP_GIANT, "Sense Giant" },
877 { TR_ESP_DRAGON, "Sense Dragon" },
878 { TR_ESP_HUMAN, "Sense Human" },
879 { TR_ESP_EVIL, "Sense Evil" },
880 { TR_ESP_GOOD, "Sense Good" },
881 { TR_ESP_NONLIVING, "Sense Nonliving" },
882 { TR_ESP_UNIQUE, "Sense Unique" },
883 { TR_SLOW_DIGEST, "Slow Digestion" },
884 { TR_REGEN, "Regeneration" },
885 { TR_WARNING, "Warning" },
886 /* { TR_XTRA_MIGHT, "Extra Might" }, */
887 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
888 { TR_DRAIN_EXP, "Drains Experience" },
889 { TR_AGGRAVATE, "Aggravates" },
890 { TR_BLESSED, "Blessed Blade" },
891 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
897 * A special type used just for deailing with pvals
902 * This will contain a string such as "+2", "-10", etc.
907 * A list of various player traits affected by an object's pval such
908 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
909 * this list since it will probably be desirable to format its
910 * description differently.
912 * Note that room need only be reserved for the number of stats - 1
913 * since the description "All stats" is used if an object affects all
914 * all stats. Also, room must be reserved for a sentinel NULL pointer.
916 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
918 * This list includes extra attacks, for simplicity.
920 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
921 N_ELEMENTS(pval_flags1_desc) + 1];
927 * An "object analysis structure"
929 * It will be filled with descriptive strings detailing an object's
930 * various magical powers. The "ignore X" traits are not noted since
931 * all artifacts ignore "normal" destruction.
936 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
937 char description[MAX_NLEN];
939 /* Description of what is affected by an object's pval */
940 pval_info_type pval_info;
942 /* A list of an object's slaying preferences */
943 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
945 /* A list if an object's elemental brands */
946 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
948 /* A list of immunities granted by an object */
949 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
951 /* A list of resistances granted by an object */
952 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
954 /* A list of stats sustained by an object */
955 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
957 /* A list of various magical qualities an object may have */
958 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
959 + 1 /* Permanent Light */
961 + 1 /* type of curse */
962 + 1]; /* sentinel NULL */
964 /* Additional ability or resistance */
967 /* A string describing an artifact's activation */
970 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
976 * @brief ファイルポインタ先に同じ文字を複数出力する /
977 * Write out `n' of the character `c' to the spoiler file
982 static void spoiler_out_n_chars(int n, char c)
984 while (--n >= 0) fputc(c, fff);
989 * @brief ファイルポインタ先に改行を複数出力する /
990 * Write out `n' blank lines to the spoiler file
994 static void spoiler_blanklines(int n)
996 spoiler_out_n_chars(n, '\n');
1001 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1002 * Write a line to the spoiler file and then "underline" it with hypens
1003 * @param str 出力したい文字列
1006 static void spoiler_underline(cptr str)
1008 fprintf(fff, "%s\n", str);
1009 spoiler_out_n_chars(strlen(str), '-');
1016 * @brief アーティファクトの特性一覧を出力する /
1017 * Write a line to the spoiler file and then "underline" it with hypens
1018 * @param art_flags アーティファクトのフラグ群
1019 * @param flag_ptr フラグ記述情報の参照ポインタ
1020 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1021 * @param n_elmnts フラグの要素数
1022 * @return desc_ptrと同じアドレス
1025 * This function does most of the actual "analysis". Given a set of bit flags
1026 * (which will be from one of the flags fields from the object in question),
1027 * a "flag description structure", a "description list", and the number of
1028 * elements in the "flag description structure", this function sets the
1029 * "description list" members to the appropriate descriptions contained in
1030 * the "flag description structure".
1031 * The possibly updated description pointer is returned.
1034 static cptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
1035 const flag_desc *flag_ptr,
1036 cptr *desc_ptr, const int n_elmnts)
1040 for (i = 0; i < n_elmnts; ++i)
1042 if (have_flag(art_flags, flag_ptr[i].flag))
1044 *desc_ptr++ = flag_ptr[i].desc;
1053 * @brief アイテムの特定記述内容を返す /
1054 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1055 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1056 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1059 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1061 /* Get a "useful" description of the object */
1062 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1067 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1068 * List "player traits" altered by an artifact's pval. These include stats,
1069 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1070 * @param o_ptr オブジェクト構造体の参照ポインタ
1071 * @param p_ptr pval修正構造体の参照ポインタ
1074 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1076 BIT_FLAGS flgs[TR_FLAG_SIZE];
1080 /* If pval == 0, there is nothing to do. */
1083 /* An "empty" pval description indicates that pval == 0 */
1084 pi_ptr->pval_desc[0] = '\0';
1088 /* Extract the flags */
1089 object_flags(o_ptr, flgs);
1091 affects_list = pi_ptr->pval_affects;
1093 /* Create the "+N" string */
1094 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1096 /* First, check to see if the pval affects all stats */
1097 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1098 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1099 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1101 *affects_list++ = _("全能力", "All stats");
1104 /* Are any stats affected? */
1105 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1106 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1107 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1109 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1111 N_ELEMENTS(stat_flags_desc));
1114 /* And now the "rest" */
1115 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1117 N_ELEMENTS(pval_flags1_desc));
1119 /* Terminate the description list */
1120 *affects_list = NULL;
1124 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1125 * Note the slaying specialties of a weapon
1126 * @param o_ptr オブジェクト構造体の参照ポインタ
1127 * @param slay_list 種族スレイ構造体の参照ポインタ
1130 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1132 BIT_FLAGS flgs[TR_FLAG_SIZE];
1134 object_flags(o_ptr, flgs);
1136 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1137 N_ELEMENTS(slay_flags_desc));
1139 /* Terminate the description list */
1145 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1146 * Note an object's elemental brands
1147 * @param o_ptr オブジェクト構造体の参照ポインタ
1148 * @param brand_list 属性ブランド構造体の参照ポインタ
1151 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1153 BIT_FLAGS flgs[TR_FLAG_SIZE];
1155 object_flags(o_ptr, flgs);
1157 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1158 N_ELEMENTS(brand_flags_desc));
1160 /* Terminate the description list */
1166 * @brief アーティファクトの通常耐性を構造体に収める /
1167 * Note an object's elemental brands
1168 * @param o_ptr オブジェクト構造体の参照ポインタ
1169 * @param resist_list 通常耐性構造体の参照ポインタ
1172 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1174 BIT_FLAGS flgs[TR_FLAG_SIZE];
1176 object_flags(o_ptr, flgs);
1178 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1179 resist_list, N_ELEMENTS(resist_flags_desc));
1181 /* Terminate the description list */
1182 *resist_list = NULL;
1187 * @brief アーティファクトの免疫特性を構造体に収める /
1188 * Note the immunities granted by an object
1189 * @param o_ptr オブジェクト構造体の参照ポインタ
1190 * @param immune_list 免疫構造体の参照ポインタ
1193 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1195 BIT_FLAGS flgs[TR_FLAG_SIZE];
1197 object_flags(o_ptr, flgs);
1199 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1200 immune_list, N_ELEMENTS(immune_flags_desc));
1202 /* Terminate the description list */
1203 *immune_list = NULL;
1208 * @brief アーティファクトの維持特性を構造体に収める /
1209 * Note which stats an object sustains
1210 * @param o_ptr オブジェクト構造体の参照ポインタ
1211 * @param sustain_list 維持特性構造体の参照ポインタ
1214 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1216 BIT_FLAGS flgs[TR_FLAG_SIZE];
1218 object_flags(o_ptr, flgs);
1220 /* Simplify things if an item sustains all stats */
1221 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1222 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1223 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1225 *sustain_list++ = _("全能力", "All stats");
1228 /* Should we bother? */
1229 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1230 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1231 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1233 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1235 N_ELEMENTS(sustain_flags_desc));
1238 /* Terminate the description list */
1239 *sustain_list = NULL;
1244 * @brief アーティファクトのその他の特性を構造体に収める /
1245 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1246 * free action, permanent light, etc.
1247 * @param o_ptr オブジェクト構造体の参照ポインタ
1248 * @param misc_list その他の特性構造体の参照ポインタ
1251 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1253 BIT_FLAGS flgs[TR_FLAG_SIZE];
1257 object_flags(o_ptr, flgs);
1259 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1260 N_ELEMENTS(misc_flags2_desc));
1262 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1263 N_ELEMENTS(misc_flags3_desc));
1266 * Glowing artifacts -- small radius light.
1269 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1270 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1271 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1272 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1273 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1274 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1276 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1278 if (have_flag(flgs, TR_LITE_FUEL))
1280 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
1284 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), (int)rad);
1285 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), (int)-rad);
1288 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1291 * Handle cursed objects here to avoid redundancies such as noting
1292 * that a permanently cursed object is heavily cursed as well as
1293 * being "lightly cursed".
1296 /* if (object_is_cursed(o_ptr)) */
1298 if (have_flag(flgs, TR_TY_CURSE))
1300 *misc_list++ = _("太古の怨念", "Ancient Curse");
1302 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1304 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1306 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1308 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1311 else if (o_ptr->curse_flags & TRC_CURSED)
1313 *misc_list++ = _("呪い", "Cursed");
1315 if (have_flag(flgs, TR_ADD_L_CURSE))
1317 *misc_list++ = _("呪いを増やす", "Cursing");
1319 if (have_flag(flgs, TR_ADD_H_CURSE))
1321 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1325 /* Terminate the description list */
1331 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1332 * Note additional ability and/or resistance of fixed artifacts
1333 * @param o_ptr オブジェクト構造体の参照ポインタ
1334 * @param addition 追加ランダム耐性構造体の参照ポインタ
1337 static void analyze_addition(object_type *o_ptr, char *addition)
1339 artifact_type *a_ptr = &a_info[o_ptr->name1];
1342 strcpy(addition, "");
1345 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1346 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1348 strcat(addition, "能力");
1349 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1351 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1353 strcat(addition, "耐性");
1354 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1356 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1358 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1359 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1361 strcat(addition, "Ability");
1362 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1364 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1366 strcat(addition, "Resistance");
1367 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1369 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1375 * @brief アーティファクトの基本情報を文字列に収める /
1376 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1377 * and its value in gold pieces
1378 * @param o_ptr オブジェクト構造体の参照ポインタ
1379 * @param misc_desc 基本情報を収める文字列参照ポインタ
1382 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1384 artifact_type *a_ptr = &a_info[o_ptr->name1];
1386 sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"),
1387 (int)a_ptr->level, a_ptr->rarity,
1389 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1391 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1397 * @brief アーティファクトの情報全体を構造体に収める /
1398 * Fill in an object description structure for a given object
1399 * and its value in gold pieces
1400 * @param o_ptr オブジェクト構造体の参照ポインタ
1401 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1404 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1406 analyze_general(o_ptr, desc_ptr->description);
1407 analyze_pval(o_ptr, &desc_ptr->pval_info);
1408 analyze_brand(o_ptr, desc_ptr->brands);
1409 analyze_slay(o_ptr, desc_ptr->slays);
1410 analyze_immune(o_ptr, desc_ptr->immunities);
1411 analyze_resist(o_ptr, desc_ptr->resistances);
1412 analyze_sustains(o_ptr, desc_ptr->sustains);
1413 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1414 analyze_addition(o_ptr, desc_ptr->addition);
1415 analyze_misc(o_ptr, desc_ptr->misc_desc);
1416 desc_ptr->activation = item_activation(o_ptr);
1421 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1424 static void print_header(void)
1428 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1429 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1430 spoiler_underline(buf);
1434 * This is somewhat ugly.
1436 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1437 * and a separator character (',', e.g.), write the list to the spoiler file
1438 * in a "nice" format, such as:
1440 * Resist Fire, Cold, Acid
1442 * That was a simple example, but when the list is long, a line wrap
1443 * should occur, and this should induce a new level of indention if
1444 * a list is being spread across lines. So for example, Bladeturner's
1445 * list of resistances should look something like this
1447 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1448 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1450 * However, the code distinguishes between a single list of many items vs.
1451 * many lists. (The separator is used to make this determination.) A single
1452 * list of many items will not cause line wrapping (since there is no
1453 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1454 * might look like this:
1456 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1459 * So comparing the two, "Regeneration" has no trailing separator and
1460 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1461 * but that's not relevant to line wrapping and indention.)
1464 /* ITEM_SEP separates items within a list */
1465 #define ITEM_SEP ','
1468 /* LIST_SEP separates lists */
1470 #define LIST_SEP ','
1472 #define LIST_SEP ';'
1476 * @brief フラグ名称を出力する汎用関数
1477 * @param header ヘッダに出力するフラグ群の名前
1478 * @param list フラグ名リスト
1479 * @param separator フラグ表示の区切り記号
1482 static void spoiler_outlist(cptr header, cptr *list, char separator)
1484 int line_len, buf_len;
1485 char line[MAX_LINE_LEN+1], buf[80];
1487 /* Ignore an empty list */
1488 if (*list == NULL) return;
1490 /* This function always indents */
1491 strcpy(line, INDENT1);
1493 /* Create header (if one was given) */
1494 if (header && (header[0]))
1496 strcat(line, header);
1500 line_len = strlen(line);
1502 /* Now begin the tedious task */
1505 /* Copy the current item to a buffer */
1508 /* Note the buffer's length */
1509 buf_len = strlen(buf);
1512 * If there is an item following this one, pad with separator and
1513 * a space and adjust the buffer length
1518 sprintf(buf + buf_len, "%c ", separator);
1523 * If the buffer will fit on the current line, just append the
1524 * buffer to the line and adjust the line length accordingly.
1527 if (line_len + buf_len <= MAX_LINE_LEN)
1530 line_len += buf_len;
1533 /* Apply line wrapping and indention semantics described above */
1537 * Don't print a trailing list separator but do print a trailing
1540 if (line_len > 1 && line[line_len - 1] == ' '
1541 && line[line_len - 2] == LIST_SEP)
1543 /* Ignore space and separator */
1544 line[line_len - 2] = '\0';
1546 /* Write to spoiler file */
1547 fprintf(fff, "%s\n", line);
1549 /* Begin new line at primary indention level */
1550 sprintf(line, "%s%s", INDENT1, buf);
1555 /* Write to spoiler file */
1556 fprintf(fff, "%s\n", line);
1558 /* Begin new line at secondary indention level */
1559 sprintf(line, "%s%s", INDENT2, buf);
1562 line_len = strlen(line);
1565 /* Advance, with break */
1566 if (!*++list) break;
1569 /* Write what's left to the spoiler file */
1570 fprintf(fff, "%s\n", line);
1574 * @brief アーティファクト一件をスポイラー出力する /
1575 * Create a spoiler file entry for an artifact
1576 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1579 static void spoiler_print_art(obj_desc_list *art_ptr)
1581 pval_info_type *pval_ptr = &art_ptr->pval_info;
1585 /* Don't indent the first line */
1586 fprintf(fff, "%s\n", art_ptr->description);
1588 /* An "empty" pval description indicates that the pval affects nothing */
1589 if (pval_ptr->pval_desc[0])
1591 /* Mention the effects of pval */
1592 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1593 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1596 /* Now deal with the description lists */
1599 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1600 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1601 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1602 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1603 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1605 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1606 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1607 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1608 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1609 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1611 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1613 if (art_ptr->addition[0])
1615 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1618 /* Write out the possible activation at the primary indention level */
1619 if (art_ptr->activation)
1621 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1624 /* End with the miscellaneous facts */
1625 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1630 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1631 * Hack -- Create a "forged" artifact
1632 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1633 * @param name1 生成するアーティファクトID
1634 * @return 生成が成功した場合TRUEを返す
1636 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1640 artifact_type *a_ptr = &a_info[name1];
1643 /* Ignore "empty" artifacts */
1644 if (!a_ptr->name) return FALSE;
1646 /* Acquire the "kind" index */
1647 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1650 if (!i) return (FALSE);
1652 /* Create the artifact */
1653 object_prep(o_ptr, i);
1656 o_ptr->name1 = (byte_hack)name1;
1658 /* Extract the fields */
1659 o_ptr->pval = a_ptr->pval;
1660 o_ptr->ac = a_ptr->ac;
1661 o_ptr->dd = a_ptr->dd;
1662 o_ptr->ds = a_ptr->ds;
1663 o_ptr->to_a = a_ptr->to_a;
1664 o_ptr->to_h = a_ptr->to_h;
1665 o_ptr->to_d = a_ptr->to_d;
1666 o_ptr->weight = a_ptr->weight;
1674 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1675 * Create a spoiler file for artifacts
1676 * @param fname 生成ファイル名
1679 static void spoil_artifact(cptr fname)
1687 obj_desc_list artifact;
1692 /* Build the filename */
1693 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1695 /* File type is "TEXT" */
1696 FILE_TYPE(FILE_TYPE_TEXT);
1699 fff = my_fopen(buf, "w");
1704 msg_print("Cannot create spoiler file.");
1708 /* Dump the header */
1711 /* List the artifacts by tval */
1712 for (i = 0; group_artifact[i].tval; i++)
1714 /* Write out the group title */
1715 if (group_artifact[i].name)
1717 spoiler_blanklines(2);
1718 spoiler_underline(group_artifact[i].name);
1719 spoiler_blanklines(1);
1722 /* Now search through all of the artifacts */
1723 for (j = 1; j < max_a_idx; ++j)
1725 artifact_type *a_ptr = &a_info[j];
1727 /* We only want objects in the current group */
1728 if (a_ptr->tval != group_artifact[i].tval) continue;
1730 /* Get local object */
1733 /* Wipe the object */
1736 /* Attempt to "forge" the artifact */
1737 if (!make_fake_artifact(q_ptr, j)) continue;
1739 /* Analyze the artifact */
1740 object_analyze(q_ptr, &artifact);
1742 /* Write out the artifact description to the spoiler file */
1743 spoiler_print_art(&artifact);
1747 /* Check for errors */
1748 if (ferror(fff) || my_fclose(fff))
1750 msg_print("Cannot close spoiler file.");
1754 msg_print("Successfully created a spoiler file.");
1759 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1760 * Create a spoiler file for monsters -BEN-
1761 * @param fname 生成ファイル名
1764 static void spoil_mon_desc(cptr fname)
1781 /* Build the filename */
1782 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1784 /* File type is "TEXT" */
1785 FILE_TYPE(FILE_TYPE_TEXT);
1788 fff = my_fopen(buf, "w");
1793 msg_print("Cannot create spoiler file.");
1797 /* Allocate the "who" array */
1798 C_MAKE(who, max_r_idx, s16b);
1800 /* Dump the header */
1801 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1802 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1803 fprintf(fff, "------------------------------------------\n\n");
1805 /* Dump the header */
1806 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1807 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1808 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1809 "--------", "---", "---", "---", "--", "--", "-----------");
1812 /* Scan the monsters */
1813 for (i = 1; i < max_r_idx; i++)
1815 monster_race *r_ptr = &r_info[i];
1817 /* Use that monster */
1818 if (r_ptr->name) who[n++] = (s16b)i;
1821 /* Select the sort method */
1822 ang_sort_comp = ang_sort_comp_hook;
1823 ang_sort_swap = ang_sort_swap_hook;
1825 /* Sort the array by dungeon depth of monsters */
1826 ang_sort(who, &why, n);
1829 for (i = 0; i < n; i++)
1831 monster_race *r_ptr = &r_info[who[i]];
1833 cptr name = (r_name + r_ptr->name);
1834 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1836 /* Get the "name" */
1838 else if (r_ptr->flags3 & (RF3_NO_CONF))
1840 sprintf(nam, "[*] %s", name);
1843 else if (r_ptr->flags1 & (RF1_UNIQUE))
1845 sprintf(nam, "[U] %s", name);
1849 sprintf(nam, _(" %s", "The %s"), name);
1854 sprintf(lev, "%d", (int)r_ptr->level);
1857 sprintf(rar, "%d", (int)r_ptr->rarity);
1860 if (r_ptr->speed >= 110)
1862 sprintf(spd, "+%d", (r_ptr->speed - 110));
1866 sprintf(spd, "-%d", (110 - r_ptr->speed));
1870 sprintf(ac, "%d", r_ptr->ac);
1873 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1875 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1879 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1884 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1886 /* Hack -- use visual instead */
1887 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1890 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1891 nam, lev, rar, spd, hp, ac, exp);
1898 /* Free the "who" array */
1899 C_KILL(who, max_r_idx, s16b);
1901 /* Check for errors */
1902 if (ferror(fff) || my_fclose(fff))
1904 msg_print("Cannot close spoiler file.");
1909 msg_print("Successfully created a spoiler file.");
1916 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1918 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1924 * @brief 文字列をファイルポインタに出力する /
1925 * Buffer text to the given file. (-SHAWN-)
1926 * This is basically c_roff() from mon-desc.c with a few changes.
1927 * @param str 文字列参照ポインタ
1930 static void spoil_out(cptr str)
1935 static char roff_buf[256];
1938 static char roff_waiting_buf[256];
1941 bool iskanji_flag = FALSE;
1943 /* Current pointer into line roff_buf */
1944 static char *roff_p = roff_buf;
1946 /* Last space saved into roff_buf */
1947 static char *roff_s = NULL;
1949 /* Mega-Hack -- Delayed output */
1950 static bool waiting_output = FALSE;
1952 /* Special handling for "new sequence" */
1957 fputs(roff_waiting_buf, fff);
1958 waiting_output = FALSE;
1961 if (roff_p != roff_buf) roff_p--;
1962 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1964 if (roff_p == roff_buf) fprintf(fff, "\n");
1967 *(roff_p + 1) = '\0';
1968 fprintf(fff, "%s\n\n", roff_buf);
1977 /* Scan the given string, character at a time */
1982 bool k_flag = iskanji((unsigned char)(*str));
1985 bool wrap = (ch == '\n');
1988 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1989 iskanji_flag = k_flag && !iskanji_flag;
1991 if (!isprint(ch)) ch = ' ';
1996 fputs(roff_waiting_buf, fff);
1997 if (!wrap) fputc('\n', fff);
1998 waiting_output = FALSE;
2004 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
2005 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2007 if (roff_p >= roff_buf + 75) wrap = TRUE;
2008 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2015 bool iskanji_flag_local = FALSE;
2016 cptr tail = str + (k_flag ? 2 : 1);
2018 cptr tail = str + 1;
2021 for (; *tail; tail++)
2023 if (*tail == ' ') continue;
2026 k_flag_local = iskanji((unsigned char)(*tail));
2027 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
2028 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2030 if (isprint(*tail)) break;
2034 if (!*tail) waiting_output = TRUE;
2038 /* Handle line-wrap */
2046 if (roff_s && (ch != ' '))
2054 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2055 else strcpy(roff_waiting_buf, roff_buf);
2059 if (cbak != ' ') *roff_p++ = cbak;
2061 while (*r) *roff_p++ = *r++;
2065 if ((roff_p > roff_buf) || (ch != ' '))
2070 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2075 strncmp(str, "。", 2) != 0 &&
2076 strncmp(str, "、", 2) != 0 &&
2077 strncmp(str, "ィ", 2) != 0 &&
2078 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2081 if (ch == ' ') roff_s = roff_p;
2092 * @brief 関数ポインタ用の出力関数 /
2093 * Hook function used in spoil_mon_info()
2095 * @param str 文字列参照ポインタ
2098 static void roff_func(byte attr, cptr str)
2108 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2109 * Create a spoiler file for monsters (-SHAWN-)
2110 * @param fname ファイル名
2113 static void spoil_mon_info(cptr fname)
2122 /* Build the filename */
2123 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2125 /* File type is "TEXT" */
2126 FILE_TYPE(FILE_TYPE_TEXT);
2129 fff = my_fopen(buf, "w");
2134 msg_print("Cannot create spoiler file.");
2139 /* Dump the header */
2140 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2141 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2144 spoil_out("------------------------------------------\n\n");
2146 /* Allocate the "who" array */
2147 C_MAKE(who, max_r_idx, s16b);
2149 /* Scan the monsters */
2150 for (i = 1; i < max_r_idx; i++)
2152 monster_race *r_ptr = &r_info[i];
2154 /* Use that monster */
2155 if (r_ptr->name) who[n++] = (s16b)i;
2158 /* Select the sort method */
2159 ang_sort_comp = ang_sort_comp_hook;
2160 ang_sort_swap = ang_sort_swap_hook;
2162 /* Sort the array by dungeon depth of monsters */
2163 ang_sort(who, &why, n);
2167 * List all monsters in order
2169 for (l = 0; l < n; l++)
2171 monster_race *r_ptr = &r_info[who[l]];
2173 /* Extract the flags */
2174 flags1 = r_ptr->flags1;
2178 if (flags1 & (RF1_QUESTOR))
2184 if (flags1 & (RF1_UNIQUE))
2196 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2201 spoil_out(attr_to_text(r_ptr));
2204 sprintf(buf, " '%c')\n", r_ptr->d_char);
2209 sprintf(buf, "=== ");
2213 sprintf(buf, "Num:%d ", who[l]);
2217 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2221 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2225 if (r_ptr->speed >= 110)
2227 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2231 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2236 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2238 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2242 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2247 sprintf(buf, "Ac:%d ", r_ptr->ac);
2251 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2254 /* Reuse the code of monster recall. */
2255 output_monster_spoiler(who[l], roff_func);
2260 /* Free the "who" array */
2261 C_KILL(who, max_r_idx, s16b);
2263 /* Check for errors */
2264 if (ferror(fff) || my_fclose(fff))
2266 msg_print("Cannot close spoiler file.");
2270 msg_print("Successfully created a spoiler file.");
2275 #define MAX_EVOL_DEPTH 64
2279 * @brief int配列でstrncmp()と似た比較処理を行う /
2280 * Compare two int-type array like strncmp() and return TRUE if equals
2281 * @param a 比較するint配列1
2282 * @param b 比較するint配列2
2284 * @return 両者の値が等しければTRUEを返す
2286 static bool int_n_cmp(int *a, int *b, int length)
2288 /* Null-string comparation is always TRUE */
2289 if (!length) return TRUE;
2293 if (*a != *(b++)) return FALSE;
2294 if (!(*(a++))) break;
2303 * @brief ある木が指定された木の部分木かどうかを返す /
2304 * Returns TRUE if an evolution tree is "partial tree"
2305 * @param tree 元となる木構造リスト
2306 * @param partial_tree 部分木かどうか判定したい木構造リスト
2307 * @return 部分木ならばTRUEを返す
2309 static bool is_partial_tree(int *tree, int *partial_tree)
2311 int pt_head = *(partial_tree++);
2314 while (partial_tree[pt_len]) pt_len++;
2318 if (*(tree++) == pt_head)
2320 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2329 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2330 * Sorting hook -- Comp function
2333 * @param a 比較したいモンスター種族ID1
2334 * @param b 比較したいモンスター種族ID2
2335 * @return 2が大きければTRUEを返す
2337 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2339 int **evol_tree = (int **)u;
2341 int w1 = evol_tree[a][0];
2342 int w2 = evol_tree[b][0];
2343 monster_race *r1_ptr = &r_info[w1];
2344 monster_race *r2_ptr = &r_info[w2];
2349 /* Used tree first */
2350 if (w1 && !w2) return TRUE;
2351 if (!w1 && w2) return FALSE;
2353 /* Sort by monster level */
2354 if (r1_ptr->level < r2_ptr->level) return TRUE;
2355 if (r1_ptr->level > r2_ptr->level) return FALSE;
2357 /* Sort by monster experience */
2358 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2359 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2361 /* Compare indexes */
2366 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2367 * Sorting hook -- Swap function
2370 * @param a スワップしたい木構造1
2371 * @param b スワップしたい木構造2
2372 * @return 2が大きければTRUEを返す
2374 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2376 int **evol_tree = (int **)u;
2383 holder = evol_tree[a];
2384 evol_tree[a] = evol_tree[b];
2385 evol_tree[b] = holder;
2389 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2390 * Print monsters' evolution information to file
2391 * @param fname 出力ファイル名
2394 static void spoil_mon_evol(cptr fname)
2397 monster_race *r_ptr;
2398 int **evol_tree, i, j, n, r_idx;
2399 int *evol_tree_zero; /* For C_KILL() */
2401 /* Build the filename */
2402 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2404 /* File type is "TEXT" */
2405 FILE_TYPE(FILE_TYPE_TEXT);
2408 fff = my_fopen(buf, "w");
2413 msg_print("Cannot create spoiler file.");
2417 /* Dump the header */
2418 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2419 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2422 spoil_out("------------------------------------------\n\n");
2424 /* Allocate the "evol_tree" array (2-dimension) */
2425 C_MAKE(evol_tree, max_r_idx, int *);
2426 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2427 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2428 evol_tree_zero = *evol_tree;
2430 /* Step 1: Build the evolution tree */
2431 for (i = 1; i < max_r_idx; i++)
2436 if (!r_ptr->next_exp) continue;
2438 /* Trace evolution */
2440 evol_tree[i][n++] = i;
2443 evol_tree[i][n++] = r_ptr->next_r_idx;
2444 r_ptr = &r_info[r_ptr->next_r_idx];
2446 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2449 /* Step 2: Scan the evolution trees and remove "partial tree" */
2450 for (i = 1; i < max_r_idx; i++)
2452 /* Not evolution tree */
2453 if (!evol_tree[i][0]) continue;
2455 for (j = 1; j < max_r_idx; j++)
2458 if (i == j) continue;
2460 /* Not evolution tree */
2461 if (!evol_tree[j][0]) continue;
2463 /* Is evolution tree[i] is part of [j]? */
2464 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2466 /* Remove this evolution tree */
2467 evol_tree[i][0] = 0;
2473 /* Step 3: Sort the evolution trees */
2475 /* Select the sort method */
2476 ang_sort_comp = ang_sort_comp_evol_tree;
2477 ang_sort_swap = ang_sort_swap_evol_tree;
2479 /* Sort the array */
2480 ang_sort(evol_tree, NULL, max_r_idx);
2482 /* Step 4: Print the evolution trees */
2483 for (i = 0; i < max_r_idx; i++)
2485 r_idx = evol_tree[i][0];
2487 /* No evolution or removed evolution tree */
2488 if (!r_idx) continue;
2490 /* Trace the evolution tree */
2491 r_ptr = &r_info[r_idx];
2492 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2493 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2495 for (n = 1; r_ptr->next_exp; n++)
2497 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2498 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2499 r_ptr = &r_info[r_ptr->next_r_idx];
2500 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2501 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2504 /* End of evolution tree */
2508 /* Free the "evol_tree" array (2-dimension) */
2509 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2510 C_KILL(evol_tree, max_r_idx, int *);
2512 /* Check for errors */
2513 if (ferror(fff) || my_fclose(fff))
2515 msg_print("Cannot close spoiler file.");
2519 msg_print("Successfully created a spoiler file.");
2527 extern void do_cmd_spoilers(void);
2530 * @brief スポイラー出力を行うコマンドのメインルーチン /
2531 * Create Spoiler files -BEN-
2534 void do_cmd_spoilers(void)
2536 /* Save the screen */
2546 prt("Create a spoiler file.", 2, 0);
2548 /* Prompt for a file */
2549 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2550 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2551 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2552 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2553 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2556 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2563 /* Restore the screen */
2569 spoil_obj_desc("obj-desc.txt");
2574 spoil_artifact("artifact.txt");
2579 spoil_mon_desc("mon-desc.txt");
2584 spoil_mon_info("mon-info.txt");
2589 spoil_mon_evol("mon-evol.txt");
2598 /* Flush messages */
2604 * @brief ランダムアーティファクト1件を解析する /
2605 * Fill in an object description structure for a given object
2606 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2607 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2610 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2612 analyze_general(o_ptr, desc_ptr->description);
2613 analyze_pval(o_ptr, &desc_ptr->pval_info);
2614 analyze_brand(o_ptr, desc_ptr->brands);
2615 analyze_slay(o_ptr, desc_ptr->slays);
2616 analyze_immune(o_ptr, desc_ptr->immunities);
2617 analyze_resist(o_ptr, desc_ptr->resistances);
2618 analyze_sustains(o_ptr, desc_ptr->sustains);
2619 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2620 desc_ptr->activation = item_activation(o_ptr);
2622 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2623 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2625 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2626 o_ptr->weight / 10, o_ptr->weight % 10);
2631 * @brief ランダムアーティファクト1件をスポイラー出力する /
2632 * Create a spoiler file entry for an artifact
2633 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2634 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2635 * Fill in an object description structure for a given object
2638 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2640 pval_info_type *pval_ptr = &art_ptr->pval_info;
2644 /* Don't indent the first line */
2645 fprintf(fff, "%s\n", art_ptr->description);
2648 if (!(o_ptr->ident & (IDENT_MENTAL)))
2650 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2653 /* An "empty" pval description indicates that the pval affects nothing */
2654 if (pval_ptr->pval_desc[0])
2656 /* Mention the effects of pval */
2657 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2658 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2661 /* Now deal with the description lists */
2664 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2665 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2666 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2667 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2668 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2670 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2671 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2672 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2673 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2674 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2676 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2678 /* Write out the possible activation at the primary indention level */
2679 if (art_ptr->activation)
2681 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2684 /* End with the miscellaneous facts */
2685 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2690 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2691 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2692 * @param i 出力したい記録ランダムアーティファクトID
2695 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2697 obj_desc_list artifact;
2699 if (!object_is_known(o_ptr) || !o_ptr->art_name
2700 || o_ptr->tval != group_artifact[i].tval)
2703 /* Analyze the artifact */
2704 random_artifact_analyze(o_ptr, &artifact);
2706 /* Write out the artifact description to the spoiler file */
2707 spoiler_print_randart(o_ptr, &artifact);
2711 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2712 * Create a list file for random artifacts
2713 * @param fname 出力ファイル名
2716 void spoil_random_artifact(cptr fname)
2726 /* Build the filename */
2727 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2729 /* File type is "TEXT" */
2730 FILE_TYPE(FILE_TYPE_TEXT);
2733 fff = my_fopen(buf, "w");
2738 msg_print("Cannot create list file.");
2742 /* Dump the header */
2743 sprintf(buf, "Random artifacts list.\r");
2744 spoiler_underline(buf);
2746 /* List the artifacts by tval */
2747 for (j = 0; group_artifact[j].tval; j++)
2749 /* random artifacts wielding */
2750 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2752 q_ptr = &inventory[i];
2753 spoil_random_artifact_aux(q_ptr, j);
2756 /* random artifacts in inventory */
2757 for (i = 0; i < INVEN_PACK; i++)
2759 q_ptr = &inventory[i];
2760 spoil_random_artifact_aux(q_ptr, j);
2763 /* random artifacts in home */
2764 st_ptr = &town[1].store[STORE_HOME];
2765 for (i = 0; i < st_ptr->stock_num; i++)
2767 q_ptr = &st_ptr->stock[i];
2768 spoil_random_artifact_aux(q_ptr, j);
2771 /* random artifacts in museum */
2772 st_ptr = &town[1].store[STORE_MUSEUM];
2773 for (i = 0; i < st_ptr->stock_num; i++)
2775 q_ptr = &st_ptr->stock[i];
2776 spoil_random_artifact_aux(q_ptr, j);
2780 /* Check for errors */
2781 if (ferror(fff) || my_fclose(fff))
2783 msg_print("Cannot close list file.");
2787 msg_print("Successfully created a list file.");
2794 #endif /* MACINTOSH */