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";
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 val 価値を返すバッファ参照ポインタ
236 static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k)
242 /* Get local object */
245 /* Prepare a fake item */
246 object_prep(q_ptr, k);
249 q_ptr->ident |= (IDENT_KNOWN);
259 (*lev) = k_info[q_ptr->k_idx].level;
262 (*val) = object_value(q_ptr);
266 if (!buf || !dam || !wgt) return;
269 /* Description (too brief) */
270 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
290 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
300 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
315 sprintf(dam, "%d", q_ptr->ac);
322 sprintf(wgt, "%3d.%d", q_ptr->weight / 10, q_ptr->weight % 10);
327 * @brief 各ベースアイテムの情報を一行毎に記述する /
328 * Create a spoiler file for items
332 static void spoil_obj_desc(cptr fname)
334 int i, k, s, t, n = 0, group_start = 0;
344 /* Build the filename */
345 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
347 /* File type is "TEXT" */
348 FILE_TYPE(FILE_TYPE_TEXT);
351 fff = my_fopen(buf, "w");
356 msg_print("Cannot create spoiler file.");
362 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d)\n\n\n",
363 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
366 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
367 "Description", "Dam/AC", "Wgt", "Lev", "Cost");
368 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
369 "----------------------------------------",
370 "------", "---", "---", "----");
372 /* List the groups */
373 for (i = 0; TRUE; i++)
375 /* Write out the group title */
376 if (group_item[i].name)
380 /* Hack -- bubble-sort by cost and then level */
381 for (s = 0; s < n - 1; s++)
383 for (t = 0; t < n - 1; t++)
394 kind_info(NULL, NULL, NULL, &e1, &t1, who[i1]);
395 kind_info(NULL, NULL, NULL, &e2, &t2, who[i2]);
397 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
406 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
408 /* Spoil each item */
409 for (s = 0; s < n; s++)
414 /* Describe the kind */
415 kind_info(buf, dam, wgt, &e, &v, who[s]);
418 fprintf(fff, " %-45s%8s%7s%5d%9ld\n",
419 buf, dam, wgt, e, (long)(v));
422 /* Start a new set */
427 if (!group_item[i].tval) break;
429 /* Start a new set */
433 /* Acquire legal item types */
434 for (k = 1; k < max_k_idx; k++)
436 object_kind *k_ptr = &k_info[k];
438 /* Skip wrong tval's */
439 if (k_ptr->tval != group_item[i].tval) continue;
441 /* Hack -- Skip instant-artifacts */
442 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
450 /* Check for errors */
451 if (ferror(fff) || my_fclose(fff))
453 msg_print("Cannot close spoiler file.");
458 msg_print("Successfully created a spoiler file.");
463 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
468 * Returns a "+" string if a number is non-negative and an empty
471 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
474 * These are used to format the artifact spoiler file. INDENT1 is used
475 * to indent all but the first line of an artifact spoiler. INDENT2 is
476 * used when a line "wraps". (Bladeturner's resistances cause this.)
482 * MAX_LINE_LEN specifies when a line should wrap.
484 #define MAX_LINE_LEN 75
487 * Given an array, determine how many elements are in the array
489 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
492 * The artifacts categorized by type
494 static grouper group_artifact[] =
498 { TV_POLEARM, "槍/斧" },
500 { TV_DIGGING, "シャベル/つるはし" },
505 { TV_SOFT_ARMOR, "鎧" },
506 { TV_HARD_ARMOR, NULL },
507 { TV_DRAG_ARMOR, NULL },
509 { TV_CLOAK, "クローク" },
518 { TV_AMULET, "アミュレット" },
521 { TV_SWORD, "Edged Weapons" },
522 { TV_POLEARM, "Polearms" },
523 { TV_HAFTED, "Hafted Weapons" },
524 { TV_DIGGING, "Shovels/Picks" },
526 { TV_ARROW, "Ammo" },
529 { TV_SOFT_ARMOR, "Body Armor" },
530 { TV_HARD_ARMOR, NULL },
531 { TV_DRAG_ARMOR, NULL },
533 { TV_CLOAK, "Cloaks" },
534 { TV_SHIELD, "Shields" },
536 { TV_HELM, "Helms/Crowns" },
538 { TV_GLOVES, "Gloves" },
539 { TV_BOOTS, "Boots" },
541 { TV_LITE, "Light Sources" },
542 { TV_AMULET, "Amulets" },
543 { TV_RING, "Rings" },
552 * Pair together a constant flag with a textual description.
554 * Used by both "init.c" and "wiz-spo.c".
556 * Note that it sometimes more efficient to actually make an array
557 * of textual names, where entry 'N' is assumed to be paired with
558 * the flag whose value is "1L << N", but that requires hard-coding.
561 typedef struct flag_desc flag_desc;
566 const char *const desc;
572 * These are used for "+3 to STR, DEX", etc. These are separate from
573 * the other pval affected traits to simplify the case where an object
574 * affects all stats. In this case, "All stats" is used instead of
575 * listing each stat individually.
578 static flag_desc stat_flags_desc[] =
598 * Besides stats, these are the other player traits
599 * which may be affected by an object's pval
602 static flag_desc pval_flags1_desc[] =
605 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
606 { TR_STEALTH, "隠密" },
608 { TR_INFRA, "赤外線視力" },
610 { TR_BLOWS, "攻撃回数" },
613 { TR_STEALTH, "Stealth" },
614 { TR_SEARCH, "Searching" },
615 { TR_INFRA, "Infravision" },
616 { TR_TUNNEL, "Tunneling" },
617 { TR_BLOWS, "Attacks" },
618 { TR_SPEED, "Speed" }
623 * Slaying preferences for weapons
626 static flag_desc slay_flags_desc[] =
629 { TR_SLAY_ANIMAL, "動物" },
630 { TR_KILL_ANIMAL, "*動物*" },
631 { TR_SLAY_EVIL, "邪悪" },
632 { TR_KILL_EVIL, "*邪悪*" },
633 { TR_SLAY_HUMAN, "人間" },
634 { TR_KILL_HUMAN, "*人間*" },
635 { TR_SLAY_UNDEAD, "アンデッド" },
636 { TR_KILL_UNDEAD, "*アンデッド*" },
637 { TR_SLAY_DEMON, "悪魔" },
638 { TR_KILL_DEMON, "*悪魔*" },
639 { TR_SLAY_ORC, "オーク" },
640 { TR_KILL_ORC, "*オーク*" },
641 { TR_SLAY_TROLL, "トロル" },
642 { TR_KILL_TROLL, "*トロル*" },
643 { TR_SLAY_GIANT, "巨人" },
644 { TR_KILL_GIANT, "*巨人*" },
645 { TR_SLAY_DRAGON, "ドラゴン" },
646 { TR_KILL_DRAGON, "*ドラゴン*" },
648 { TR_SLAY_ANIMAL, "Animal" },
649 { TR_KILL_ANIMAL, "XAnimal" },
650 { TR_SLAY_EVIL, "Evil" },
651 { TR_KILL_EVIL, "XEvil" },
652 { TR_SLAY_HUMAN, "Human" },
653 { TR_KILL_HUMAN, "XHuman" },
654 { TR_SLAY_UNDEAD, "Undead" },
655 { TR_KILL_UNDEAD, "XUndead" },
656 { TR_SLAY_DEMON, "Demon" },
657 { TR_KILL_DEMON, "XDemon" },
658 { TR_SLAY_ORC, "Orc" },
659 { TR_KILL_ORC, "XOrc" },
660 { TR_SLAY_TROLL, "Troll" },
661 { TR_KILL_TROLL, "XTroll" },
662 { TR_SLAY_GIANT, "Giant" },
663 { TR_KILL_GIANT, "Xgiant" },
664 { TR_SLAY_DRAGON, "Dragon" },
665 { TR_KILL_DRAGON, "Xdragon" }
670 * Elemental brands for weapons
672 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
673 * coding, it has been included here along with the elemental
674 * brands. It does seem to fit in with the brands and slaying
675 * more than the miscellaneous section.
677 static flag_desc brand_flags_desc[] =
680 { TR_BRAND_ACID, "溶解" },
681 { TR_BRAND_ELEC, "電撃" },
682 { TR_BRAND_FIRE, "焼棄" },
683 { TR_BRAND_COLD, "凍結" },
684 { TR_BRAND_POIS, "毒殺" },
686 { TR_FORCE_WEAPON, "理力" },
687 { TR_CHAOTIC, "混沌" },
688 { TR_VAMPIRIC, "吸血" },
690 { TR_VORPAL, "切れ味" },
692 { TR_BRAND_ACID, "Acid Brand" },
693 { TR_BRAND_ELEC, "Lightning Brand" },
694 { TR_BRAND_FIRE, "Flame Tongue" },
695 { TR_BRAND_COLD, "Frost Brand" },
696 { TR_BRAND_POIS, "Poisoned" },
698 { TR_FORCE_WEAPON, "Force" },
699 { TR_CHAOTIC, "Mark of Chaos" },
700 { TR_VAMPIRIC, "Vampiric" },
701 { TR_IMPACT, "Earthquake impact on hit" },
702 { TR_VORPAL, "Very sharp" },
710 static const flag_desc resist_flags_desc[] =
713 { TR_RES_ACID, "酸" },
714 { TR_RES_ELEC, "電撃" },
715 { TR_RES_FIRE, "火炎" },
716 { TR_RES_COLD, "冷気" },
717 { TR_RES_POIS, "毒" },
718 { TR_RES_FEAR, "恐怖"},
719 { TR_RES_LITE, "閃光" },
720 { TR_RES_DARK, "暗黒" },
721 { TR_RES_BLIND, "盲目" },
722 { TR_RES_CONF, "混乱" },
723 { TR_RES_SOUND, "轟音" },
724 { TR_RES_SHARDS, "破片" },
725 { TR_RES_NETHER, "地獄" },
726 { TR_RES_NEXUS, "因果混乱" },
727 { TR_RES_CHAOS, "カオス" },
728 { TR_RES_DISEN, "劣化" },
730 { TR_RES_ACID, "Acid" },
731 { TR_RES_ELEC, "Lightning" },
732 { TR_RES_FIRE, "Fire" },
733 { TR_RES_COLD, "Cold" },
734 { TR_RES_POIS, "Poison" },
735 { TR_RES_FEAR, "Fear"},
736 { TR_RES_LITE, "Light" },
737 { TR_RES_DARK, "Dark" },
738 { TR_RES_BLIND, "Blindness" },
739 { TR_RES_CONF, "Confusion" },
740 { TR_RES_SOUND, "Sound" },
741 { TR_RES_SHARDS, "Shards" },
742 { TR_RES_NETHER, "Nether" },
743 { TR_RES_NEXUS, "Nexus" },
744 { TR_RES_CHAOS, "Chaos" },
745 { TR_RES_DISEN, "Disenchantment" },
750 * Elemental immunities (along with poison)
753 static const flag_desc immune_flags_desc[] =
757 { TR_IM_ELEC, "電撃" },
758 { TR_IM_FIRE, "火炎" },
759 { TR_IM_COLD, "冷気" },
761 { TR_IM_ACID, "Acid" },
762 { TR_IM_ELEC, "Lightning" },
763 { TR_IM_FIRE, "Fire" },
764 { TR_IM_COLD, "Cold" },
769 * Sustain stats - these are given their "own" line in the
770 * spoiler file, mainly for simplicity
772 static const flag_desc sustain_flags_desc[] =
775 { TR_SUST_STR, "腕力" },
776 { TR_SUST_INT, "知能" },
777 { TR_SUST_WIS, "賢さ" },
778 { TR_SUST_DEX, "器用さ" },
779 { TR_SUST_CON, "耐久力" },
780 { TR_SUST_CHR, "魅力" },
782 { TR_SUST_STR, "STR" },
783 { TR_SUST_INT, "INT" },
784 { TR_SUST_WIS, "WIS" },
785 { TR_SUST_DEX, "DEX" },
786 { TR_SUST_CON, "CON" },
787 { TR_SUST_CHR, "CHR" },
792 * Miscellaneous magic given by an object's "flags2" field
795 static const flag_desc misc_flags2_desc[] =
799 { TR_REFLECT, "反射" },
800 { TR_FREE_ACT, "麻痺知らず" },
801 { TR_HOLD_EXP, "経験値維持" },
803 { TR_THROW, "Throwing" },
804 { TR_REFLECT, "Reflection" },
805 { TR_FREE_ACT, "Free Action" },
806 { TR_HOLD_EXP, "Hold Experience" },
811 * Miscellaneous magic given by an object's "flags3" field
813 * Note that cursed artifacts and objects with permanent light
814 * are handled "directly" -- see analyze_misc_magic()
817 static const flag_desc misc_flags3_desc[] =
820 { TR_SH_FIRE, "火炎オーラ" },
821 { TR_SH_ELEC, "電撃オーラ" },
822 { TR_SH_COLD, "冷気オーラ" },
823 { TR_NO_TELE, "反テレポート" },
824 { TR_NO_MAGIC, "反魔法" },
825 { TR_LEVITATION, "浮遊" },
826 { TR_SEE_INVIS, "可視透明" },
827 { TR_TELEPATHY, "テレパシー" },
828 { TR_ESP_ANIMAL, "動物感知" },
829 { TR_ESP_UNDEAD, "不死感知" },
830 { TR_ESP_DEMON, "悪魔感知" },
831 { TR_ESP_ORC, "オーク感知" },
832 { TR_ESP_TROLL, "トロル感知" },
833 { TR_ESP_GIANT, "巨人感知" },
834 { TR_ESP_DRAGON, "ドラゴン感知" },
835 { TR_ESP_HUMAN, "人間感知" },
836 { TR_ESP_EVIL, "邪悪感知" },
837 { TR_ESP_GOOD, "善良感知" },
838 { TR_ESP_NONLIVING, "無生物感知" },
839 { TR_ESP_UNIQUE, "ユニーク感知" },
840 { TR_SLOW_DIGEST, "遅消化" },
841 { TR_REGEN, "急速回復" },
842 { TR_WARNING, "警告" },
843 /* { TR_XTRA_MIGHT, "強力射撃" }, */
844 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
845 { TR_DRAIN_EXP, "経験値吸収" },
846 { TR_AGGRAVATE, "反感" },
847 { TR_BLESSED, "祝福" },
848 { TR_DEC_MANA, "消費魔力減少" },
850 { TR_SH_FIRE, "Fiery Aura" },
851 { TR_SH_ELEC, "Electric Aura" },
852 { TR_SH_COLD, "Coldly Aura" },
853 { TR_NO_TELE, "Prevent Teleportation" },
854 { TR_NO_MAGIC, "Anti-Magic" },
855 { TR_LEVITATION, "Levitation" },
856 { TR_SEE_INVIS, "See Invisible" },
857 { TR_TELEPATHY, "ESP" },
858 { TR_ESP_ANIMAL, "Sense Animal" },
859 { TR_ESP_UNDEAD, "Sense Undead" },
860 { TR_ESP_DEMON, "Sense Demon" },
861 { TR_ESP_ORC, "Sense Orc" },
862 { TR_ESP_TROLL, "Sense Troll" },
863 { TR_ESP_GIANT, "Sense Giant" },
864 { TR_ESP_DRAGON, "Sense Dragon" },
865 { TR_ESP_HUMAN, "Sense Human" },
866 { TR_ESP_EVIL, "Sense Evil" },
867 { TR_ESP_GOOD, "Sense Good" },
868 { TR_ESP_NONLIVING, "Sense Nonliving" },
869 { TR_ESP_UNIQUE, "Sense Unique" },
870 { TR_SLOW_DIGEST, "Slow Digestion" },
871 { TR_REGEN, "Regeneration" },
872 { TR_WARNING, "Warning" },
873 /* { TR_XTRA_MIGHT, "Extra Might" }, */
874 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
875 { TR_DRAIN_EXP, "Drains Experience" },
876 { TR_AGGRAVATE, "Aggravates" },
877 { TR_BLESSED, "Blessed Blade" },
878 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
884 * A special type used just for deailing with pvals
889 * This will contain a string such as "+2", "-10", etc.
894 * A list of various player traits affected by an object's pval such
895 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
896 * this list since it will probably be desirable to format its
897 * description differently.
899 * Note that room need only be reserved for the number of stats - 1
900 * since the description "All stats" is used if an object affects all
901 * all stats. Also, room must be reserved for a sentinel NULL pointer.
903 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
905 * This list includes extra attacks, for simplicity.
907 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
908 N_ELEMENTS(pval_flags1_desc) + 1];
914 * An "object analysis structure"
916 * It will be filled with descriptive strings detailing an object's
917 * various magical powers. The "ignore X" traits are not noted since
918 * all artifacts ignore "normal" destruction.
923 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
924 char description[MAX_NLEN];
926 /* Description of what is affected by an object's pval */
927 pval_info_type pval_info;
929 /* A list of an object's slaying preferences */
930 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
932 /* A list if an object's elemental brands */
933 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
935 /* A list of immunities granted by an object */
936 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
938 /* A list of resistances granted by an object */
939 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
941 /* A list of stats sustained by an object */
942 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
944 /* A list of various magical qualities an object may have */
945 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
946 + 1 /* Permanent Light */
948 + 1 /* type of curse */
949 + 1]; /* sentinel NULL */
951 /* Additional ability or resistance */
954 /* A string describing an artifact's activation */
957 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
963 * @brief ファイルポインタ先に同じ文字を複数出力する /
964 * Write out `n' of the character `c' to the spoiler file
969 static void spoiler_out_n_chars(int n, char c)
971 while (--n >= 0) fputc(c, fff);
976 * @brief ファイルポインタ先に改行を複数出力する /
977 * Write out `n' blank lines to the spoiler file
981 static void spoiler_blanklines(int n)
983 spoiler_out_n_chars(n, '\n');
988 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
989 * Write a line to the spoiler file and then "underline" it with hypens
990 * @param str 出力したい文字列
993 static void spoiler_underline(cptr str)
995 fprintf(fff, "%s\n", str);
996 spoiler_out_n_chars(strlen(str), '-');
1003 * @brief アーティファクトの特性一覧を出力する /
1004 * Write a line to the spoiler file and then "underline" it with hypens
1005 * @param art_flags アーティファクトのフラグ群
1006 * @param flag_ptr フラグ記述情報の参照ポインタ
1007 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1008 * @param n_elmnts フラグの要素数
1009 * @return desc_ptrと同じアドレス
1012 * This function does most of the actual "analysis". Given a set of bit flags
1013 * (which will be from one of the flags fields from the object in question),
1014 * a "flag description structure", a "description list", and the number of
1015 * elements in the "flag description structure", this function sets the
1016 * "description list" members to the appropriate descriptions contained in
1017 * the "flag description structure".
1018 * The possibly updated description pointer is returned.
1021 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1022 const flag_desc *flag_ptr,
1023 cptr *desc_ptr, const int n_elmnts)
1027 for (i = 0; i < n_elmnts; ++i)
1029 if (have_flag(art_flags, flag_ptr[i].flag))
1031 *desc_ptr++ = flag_ptr[i].desc;
1040 * @brief アイテムの特定記述内容を返す /
1041 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1042 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1043 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1046 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1048 /* Get a "useful" description of the object */
1049 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1054 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1055 * List "player traits" altered by an artifact's pval. These include stats,
1056 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1057 * @param o_ptr オブジェクト構造体の参照ポインタ
1058 * @param p_ptr pval修正構造体の参照ポインタ
1061 static void analyze_pval(object_type *o_ptr, pval_info_type *p_ptr)
1063 u32b flgs[TR_FLAG_SIZE];
1067 /* If pval == 0, there is nothing to do. */
1070 /* An "empty" pval description indicates that pval == 0 */
1071 p_ptr->pval_desc[0] = '\0';
1075 /* Extract the flags */
1076 object_flags(o_ptr, flgs);
1078 affects_list = p_ptr->pval_affects;
1080 /* Create the "+N" string */
1081 sprintf(p_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1083 /* First, check to see if the pval affects all stats */
1084 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1085 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1086 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1088 *affects_list++ = _("全能力", "All stats");
1091 /* Are any stats affected? */
1092 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1093 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1094 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1096 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1098 N_ELEMENTS(stat_flags_desc));
1101 /* And now the "rest" */
1102 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1104 N_ELEMENTS(pval_flags1_desc));
1106 /* Terminate the description list */
1107 *affects_list = NULL;
1111 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1112 * Note the slaying specialties of a weapon
1113 * @param o_ptr オブジェクト構造体の参照ポインタ
1114 * @param slay_list 種族スレイ構造体の参照ポインタ
1117 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1119 u32b flgs[TR_FLAG_SIZE];
1121 object_flags(o_ptr, flgs);
1123 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1124 N_ELEMENTS(slay_flags_desc));
1126 /* Terminate the description list */
1132 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1133 * Note an object's elemental brands
1134 * @param o_ptr オブジェクト構造体の参照ポインタ
1135 * @param brand_list 属性ブランド構造体の参照ポインタ
1138 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1140 u32b flgs[TR_FLAG_SIZE];
1142 object_flags(o_ptr, flgs);
1144 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1145 N_ELEMENTS(brand_flags_desc));
1147 /* Terminate the description list */
1153 * @brief アーティファクトの通常耐性を構造体に収める /
1154 * Note an object's elemental brands
1155 * @param o_ptr オブジェクト構造体の参照ポインタ
1156 * @param resist_list 通常耐性構造体の参照ポインタ
1159 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1161 u32b flgs[TR_FLAG_SIZE];
1163 object_flags(o_ptr, flgs);
1165 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1166 resist_list, N_ELEMENTS(resist_flags_desc));
1168 /* Terminate the description list */
1169 *resist_list = NULL;
1174 * @brief アーティファクトの免疫特性を構造体に収める /
1175 * Note the immunities granted by an object
1176 * @param o_ptr オブジェクト構造体の参照ポインタ
1177 * @param immune_list 免疫構造体の参照ポインタ
1180 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1182 u32b flgs[TR_FLAG_SIZE];
1184 object_flags(o_ptr, flgs);
1186 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1187 immune_list, N_ELEMENTS(immune_flags_desc));
1189 /* Terminate the description list */
1190 *immune_list = NULL;
1195 * @brief アーティファクトの維持特性を構造体に収める /
1196 * Note which stats an object sustains
1197 * @param o_ptr オブジェクト構造体の参照ポインタ
1198 * @param sustain_list 維持特性構造体の参照ポインタ
1201 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1203 u32b flgs[TR_FLAG_SIZE];
1205 object_flags(o_ptr, flgs);
1207 /* Simplify things if an item sustains all stats */
1208 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1209 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1210 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1212 *sustain_list++ = _("全能力", "All stats");
1215 /* Should we bother? */
1216 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1217 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1218 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1220 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1222 N_ELEMENTS(sustain_flags_desc));
1225 /* Terminate the description list */
1226 *sustain_list = NULL;
1231 * @brief アーティファクトのその他の特性を構造体に収める /
1232 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1233 * free action, permanent light, etc.
1234 * @param o_ptr オブジェクト構造体の参照ポインタ
1235 * @param misc_list その他の特性構造体の参照ポインタ
1238 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1240 u32b flgs[TR_FLAG_SIZE];
1244 object_flags(o_ptr, flgs);
1246 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1247 N_ELEMENTS(misc_flags2_desc));
1249 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1250 N_ELEMENTS(misc_flags3_desc));
1253 * Glowing artifacts -- small radius light.
1256 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1257 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1258 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1259 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1260 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1261 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1263 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1265 if (have_flag(flgs, TR_LITE_FUEL))
1267 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), rad);
1271 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), rad);
1272 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), -rad);
1275 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1278 * Handle cursed objects here to avoid redundancies such as noting
1279 * that a permanently cursed object is heavily cursed as well as
1280 * being "lightly cursed".
1283 /* if (object_is_cursed(o_ptr)) */
1285 if (have_flag(flgs, TR_TY_CURSE))
1287 *misc_list++ = _("太古の怨念", "Ancient Curse");
1289 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1291 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1293 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1295 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1298 else if (o_ptr->curse_flags & TRC_CURSED)
1300 *misc_list++ = _("呪い", "Cursed");
1302 if (have_flag(flgs, TR_ADD_L_CURSE))
1304 *misc_list++ = _("呪いを増やす", "Cursing");
1306 if (have_flag(flgs, TR_ADD_H_CURSE))
1308 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1312 /* Terminate the description list */
1318 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1319 * Note additional ability and/or resistance of fixed artifacts
1320 * @param o_ptr オブジェクト構造体の参照ポインタ
1321 * @param addition 追加ランダム耐性構造体の参照ポインタ
1324 static void analyze_addition(object_type *o_ptr, char *addition)
1326 artifact_type *a_ptr = &a_info[o_ptr->name1];
1329 strcpy(addition, "");
1332 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1333 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1335 strcat(addition, "能力");
1336 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1338 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1340 strcat(addition, "耐性");
1341 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1343 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1345 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1346 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1348 strcat(addition, "Ability");
1349 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1351 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1353 strcat(addition, "Resistance");
1354 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1356 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1362 * @brief アーティファクトの基本情報を文字列に収める /
1363 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1364 * and its value in gold pieces
1365 * @param o_ptr オブジェクト構造体の参照ポインタ
1366 * @param misc_desc 基本情報を収める文字列参照ポインタ
1369 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1371 artifact_type *a_ptr = &a_info[o_ptr->name1];
1374 sprintf(misc_desc, "レベル %u, 希少度 %u, %d.%d kg, $%ld",
1375 a_ptr->level, a_ptr->rarity,
1376 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1378 sprintf(misc_desc, "Level %u, Rarity %u, %d.%d lbs, %ld Gold",
1379 a_ptr->level, a_ptr->rarity,
1380 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1386 * @brief アーティファクトの情報全体を構造体に収める /
1387 * Fill in an object description structure for a given object
1388 * and its value in gold pieces
1389 * @param o_ptr オブジェクト構造体の参照ポインタ
1390 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1393 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1395 analyze_general(o_ptr, desc_ptr->description);
1396 analyze_pval(o_ptr, &desc_ptr->pval_info);
1397 analyze_brand(o_ptr, desc_ptr->brands);
1398 analyze_slay(o_ptr, desc_ptr->slays);
1399 analyze_immune(o_ptr, desc_ptr->immunities);
1400 analyze_resist(o_ptr, desc_ptr->resistances);
1401 analyze_sustains(o_ptr, desc_ptr->sustains);
1402 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1403 analyze_addition(o_ptr, desc_ptr->addition);
1404 analyze_misc(o_ptr, desc_ptr->misc_desc);
1405 desc_ptr->activation = item_activation(o_ptr);
1410 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1413 static void print_header(void)
1417 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1418 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1419 spoiler_underline(buf);
1423 * This is somewhat ugly.
1425 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1426 * and a separator character (',', e.g.), write the list to the spoiler file
1427 * in a "nice" format, such as:
1429 * Resist Fire, Cold, Acid
1431 * That was a simple example, but when the list is long, a line wrap
1432 * should occur, and this should induce a new level of indention if
1433 * a list is being spread across lines. So for example, Bladeturner's
1434 * list of resistances should look something like this
1436 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1437 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1439 * However, the code distinguishes between a single list of many items vs.
1440 * many lists. (The separator is used to make this determination.) A single
1441 * list of many items will not cause line wrapping (since there is no
1442 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1443 * might look like this:
1445 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1448 * So comparing the two, "Regeneration" has no trailing separator and
1449 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1450 * but that's not relevant to line wrapping and indention.)
1453 /* ITEM_SEP separates items within a list */
1454 #define ITEM_SEP ','
1457 /* LIST_SEP separates lists */
1459 #define LIST_SEP ','
1461 #define LIST_SEP ';'
1465 * @brief フラグ名称を出力する汎用関数
1466 * @param header ヘッダに出力するフラグ群の名前
1467 * @param list フラグ名リスト
1468 * @param separator フラグ表示の区切り記号
1471 static void spoiler_outlist(cptr header, cptr *list, char separator)
1473 int line_len, buf_len;
1474 char line[MAX_LINE_LEN+1], buf[80];
1476 /* Ignore an empty list */
1477 if (*list == NULL) return;
1479 /* This function always indents */
1480 strcpy(line, INDENT1);
1482 /* Create header (if one was given) */
1483 if (header && (header[0]))
1485 strcat(line, header);
1489 line_len = strlen(line);
1491 /* Now begin the tedious task */
1494 /* Copy the current item to a buffer */
1497 /* Note the buffer's length */
1498 buf_len = strlen(buf);
1501 * If there is an item following this one, pad with separator and
1502 * a space and adjust the buffer length
1507 sprintf(buf + buf_len, "%c ", separator);
1512 * If the buffer will fit on the current line, just append the
1513 * buffer to the line and adjust the line length accordingly.
1516 if (line_len + buf_len <= MAX_LINE_LEN)
1519 line_len += buf_len;
1522 /* Apply line wrapping and indention semantics described above */
1526 * Don't print a trailing list separator but do print a trailing
1529 if (line_len > 1 && line[line_len - 1] == ' '
1530 && line[line_len - 2] == LIST_SEP)
1532 /* Ignore space and separator */
1533 line[line_len - 2] = '\0';
1535 /* Write to spoiler file */
1536 fprintf(fff, "%s\n", line);
1538 /* Begin new line at primary indention level */
1539 sprintf(line, "%s%s", INDENT1, buf);
1544 /* Write to spoiler file */
1545 fprintf(fff, "%s\n", line);
1547 /* Begin new line at secondary indention level */
1548 sprintf(line, "%s%s", INDENT2, buf);
1551 line_len = strlen(line);
1554 /* Advance, with break */
1555 if (!*++list) break;
1558 /* Write what's left to the spoiler file */
1559 fprintf(fff, "%s\n", line);
1563 * @brief アーティファクト一件をスポイラー出力する /
1564 * Create a spoiler file entry for an artifact
1565 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1568 static void spoiler_print_art(obj_desc_list *art_ptr)
1570 pval_info_type *pval_ptr = &art_ptr->pval_info;
1574 /* Don't indent the first line */
1575 fprintf(fff, "%s\n", art_ptr->description);
1577 /* An "empty" pval description indicates that the pval affects nothing */
1578 if (pval_ptr->pval_desc[0])
1580 /* Mention the effects of pval */
1581 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1582 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1585 /* Now deal with the description lists */
1588 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1589 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1590 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1591 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1592 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1594 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1595 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1596 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1597 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1598 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1600 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1602 if (art_ptr->addition[0])
1604 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1607 /* Write out the possible activation at the primary indention level */
1608 if (art_ptr->activation)
1610 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1613 /* End with the miscellaneous facts */
1614 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1619 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1620 * Hack -- Create a "forged" artifact
1621 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1622 * @param name1 生成するアーティファクトID
1623 * @return 生成が成功した場合TRUEを返す
1625 static bool make_fake_artifact(object_type *o_ptr, int name1)
1629 artifact_type *a_ptr = &a_info[name1];
1632 /* Ignore "empty" artifacts */
1633 if (!a_ptr->name) return FALSE;
1635 /* Acquire the "kind" index */
1636 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1639 if (!i) return (FALSE);
1641 /* Create the artifact */
1642 object_prep(o_ptr, i);
1645 o_ptr->name1 = name1;
1647 /* Extract the fields */
1648 o_ptr->pval = a_ptr->pval;
1649 o_ptr->ac = a_ptr->ac;
1650 o_ptr->dd = a_ptr->dd;
1651 o_ptr->ds = a_ptr->ds;
1652 o_ptr->to_a = a_ptr->to_a;
1653 o_ptr->to_h = a_ptr->to_h;
1654 o_ptr->to_d = a_ptr->to_d;
1655 o_ptr->weight = a_ptr->weight;
1663 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1664 * Create a spoiler file for artifacts
1665 * @param fname 生成ファイル名
1668 static void spoil_artifact(cptr fname)
1675 obj_desc_list artifact;
1680 /* Build the filename */
1681 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1683 /* File type is "TEXT" */
1684 FILE_TYPE(FILE_TYPE_TEXT);
1687 fff = my_fopen(buf, "w");
1692 msg_print("Cannot create spoiler file.");
1696 /* Dump the header */
1699 /* List the artifacts by tval */
1700 for (i = 0; group_artifact[i].tval; i++)
1702 /* Write out the group title */
1703 if (group_artifact[i].name)
1705 spoiler_blanklines(2);
1706 spoiler_underline(group_artifact[i].name);
1707 spoiler_blanklines(1);
1710 /* Now search through all of the artifacts */
1711 for (j = 1; j < max_a_idx; ++j)
1713 artifact_type *a_ptr = &a_info[j];
1715 /* We only want objects in the current group */
1716 if (a_ptr->tval != group_artifact[i].tval) continue;
1718 /* Get local object */
1721 /* Wipe the object */
1724 /* Attempt to "forge" the artifact */
1725 if (!make_fake_artifact(q_ptr, j)) continue;
1727 /* Analyze the artifact */
1728 object_analyze(q_ptr, &artifact);
1730 /* Write out the artifact description to the spoiler file */
1731 spoiler_print_art(&artifact);
1735 /* Check for errors */
1736 if (ferror(fff) || my_fclose(fff))
1738 msg_print("Cannot close spoiler file.");
1743 msg_print("Successfully created a spoiler file.");
1748 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1749 * Create a spoiler file for monsters -BEN-
1750 * @param fname 生成ファイル名
1753 static void spoil_mon_desc(cptr fname)
1770 /* Build the filename */
1771 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1773 /* File type is "TEXT" */
1774 FILE_TYPE(FILE_TYPE_TEXT);
1777 fff = my_fopen(buf, "w");
1782 msg_print("Cannot create spoiler file.");
1786 /* Allocate the "who" array */
1787 C_MAKE(who, max_r_idx, s16b);
1789 /* Dump the header */
1790 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1791 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1792 fprintf(fff, "------------------------------------------\n\n");
1794 /* Dump the header */
1795 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1796 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1797 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1798 "--------", "---", "---", "---", "--", "--", "-----------");
1801 /* Scan the monsters */
1802 for (i = 1; i < max_r_idx; i++)
1804 monster_race *r_ptr = &r_info[i];
1806 /* Use that monster */
1807 if (r_ptr->name) who[n++] = i;
1810 /* Select the sort method */
1811 ang_sort_comp = ang_sort_comp_hook;
1812 ang_sort_swap = ang_sort_swap_hook;
1814 /* Sort the array by dungeon depth of monsters */
1815 ang_sort(who, &why, n);
1818 for (i = 0; i < n; i++)
1820 monster_race *r_ptr = &r_info[who[i]];
1822 cptr name = (r_name + r_ptr->name);
1823 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1825 /* Get the "name" */
1827 else if (r_ptr->flags1 & (RF1_QUESTOR))
1829 sprintf(nam, "[Q] %s", name);
1832 else if (r_ptr->flags1 & (RF1_UNIQUE))
1834 sprintf(nam, "[U] %s", name);
1838 sprintf(nam, _(" %s", "The %s"), name);
1843 sprintf(lev, "%d", r_ptr->level);
1846 sprintf(rar, "%d", r_ptr->rarity);
1849 if (r_ptr->speed >= 110)
1851 sprintf(spd, "+%d", (r_ptr->speed - 110));
1855 sprintf(spd, "-%d", (110 - r_ptr->speed));
1859 sprintf(ac, "%d", r_ptr->ac);
1862 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1864 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1868 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1873 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1875 /* Hack -- use visual instead */
1876 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1879 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1880 nam, lev, rar, spd, hp, ac, exp);
1887 /* Free the "who" array */
1888 C_KILL(who, max_r_idx, s16b);
1890 /* Check for errors */
1891 if (ferror(fff) || my_fclose(fff))
1893 msg_print("Cannot close spoiler file.");
1898 msg_print("Successfully created a spoiler file.");
1905 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1907 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1913 * @brief 文字列をファイルポインタに出力する /
1914 * Buffer text to the given file. (-SHAWN-)
1915 * This is basically c_roff() from mon-desc.c with a few changes.
1916 * @param str 文字列参照ポインタ
1919 static void spoil_out(cptr str)
1924 static char roff_buf[256];
1927 static char roff_waiting_buf[256];
1930 bool iskanji_flag = FALSE;
1932 /* Current pointer into line roff_buf */
1933 static char *roff_p = roff_buf;
1935 /* Last space saved into roff_buf */
1936 static char *roff_s = NULL;
1938 /* Mega-Hack -- Delayed output */
1939 static bool waiting_output = FALSE;
1941 /* Special handling for "new sequence" */
1946 fputs(roff_waiting_buf, fff);
1947 waiting_output = FALSE;
1950 if (roff_p != roff_buf) roff_p--;
1951 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1953 if (roff_p == roff_buf) fprintf(fff, "\n");
1956 *(roff_p + 1) = '\0';
1957 fprintf(fff, "%s\n\n", roff_buf);
1966 /* Scan the given string, character at a time */
1971 bool k_flag = iskanji((unsigned char)(*str));
1974 bool wrap = (ch == '\n');
1977 if (!isprint(ch) && !k_flag && !iskanji_flag) ch = ' ';
1978 iskanji_flag = k_flag && !iskanji_flag;
1980 if (!isprint(ch)) ch = ' ';
1985 fputs(roff_waiting_buf, fff);
1986 if (!wrap) fputc('\n', fff);
1987 waiting_output = FALSE;
1993 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1994 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
1996 if (roff_p >= roff_buf + 75) wrap = TRUE;
1997 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2004 bool iskanji_flag_local = FALSE;
2005 cptr tail = str + (k_flag ? 2 : 1);
2007 cptr tail = str + 1;
2010 for (; *tail; tail++)
2012 if (*tail == ' ') continue;
2015 k_flag_local = iskanji((unsigned char)(*tail));
2016 if (isprint(*tail) || k_flag_local || iskanji_flag_local) break;
2017 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2019 if (isprint(*tail)) break;
2023 if (!*tail) waiting_output = TRUE;
2027 /* Handle line-wrap */
2035 if (roff_s && (ch != ' '))
2043 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2044 else strcpy(roff_waiting_buf, roff_buf);
2048 if (cbak != ' ') *roff_p++ = cbak;
2050 while (*r) *roff_p++ = *r++;
2054 if ((roff_p > roff_buf) || (ch != ' '))
2059 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2064 strncmp(str, "。", 2) != 0 &&
2065 strncmp(str, "、", 2) != 0 &&
2066 strncmp(str, "ィ", 2) != 0 &&
2067 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2070 if (ch == ' ') roff_s = roff_p;
2081 * @brief 関数ポインタ用の出力関数 /
2082 * Hook function used in spoil_mon_info()
2084 * @param str 文字列参照ポインタ
2087 static void roff_func(byte attr, cptr str)
2097 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2098 * Create a spoiler file for monsters (-SHAWN-)
2099 * @param fname ファイル名
2102 static void spoil_mon_info(cptr fname)
2111 /* Build the filename */
2112 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2114 /* File type is "TEXT" */
2115 FILE_TYPE(FILE_TYPE_TEXT);
2118 fff = my_fopen(buf, "w");
2123 msg_print("Cannot create spoiler file.");
2128 /* Dump the header */
2129 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2130 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2133 spoil_out("------------------------------------------\n\n");
2135 /* Allocate the "who" array */
2136 C_MAKE(who, max_r_idx, s16b);
2138 /* Scan the monsters */
2139 for (i = 1; i < max_r_idx; i++)
2141 monster_race *r_ptr = &r_info[i];
2143 /* Use that monster */
2144 if (r_ptr->name) who[n++] = i;
2147 /* Select the sort method */
2148 ang_sort_comp = ang_sort_comp_hook;
2149 ang_sort_swap = ang_sort_swap_hook;
2151 /* Sort the array by dungeon depth of monsters */
2152 ang_sort(who, &why, n);
2156 * List all monsters in order
2158 for (l = 0; l < n; l++)
2160 monster_race *r_ptr = &r_info[who[l]];
2162 /* Extract the flags */
2163 flags1 = r_ptr->flags1;
2167 if (flags1 & (RF1_QUESTOR))
2173 if (flags1 & (RF1_UNIQUE))
2185 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2190 spoil_out(attr_to_text(r_ptr));
2193 sprintf(buf, " '%c')\n", r_ptr->d_char);
2198 sprintf(buf, "=== ");
2202 sprintf(buf, "Num:%d ", who[l]);
2206 sprintf(buf, "Lev:%d ", r_ptr->level);
2210 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2214 if (r_ptr->speed >= 110)
2216 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2220 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2225 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2227 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2231 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2236 sprintf(buf, "Ac:%d ", r_ptr->ac);
2240 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2243 /* Reuse the code of monster recall. */
2244 output_monster_spoiler(who[l], roff_func);
2249 /* Free the "who" array */
2250 C_KILL(who, max_r_idx, s16b);
2252 /* Check for errors */
2253 if (ferror(fff) || my_fclose(fff))
2255 msg_print("Cannot close spoiler file.");
2259 msg_print("Successfully created a spoiler file.");
2264 #define MAX_EVOL_DEPTH 64
2268 * @brief int配列でstrncmp()と似た比較処理を行う /
2269 * Compare two int-type array like strncmp() and return TRUE if equals
2270 * @param a 比較するint配列1
2271 * @param b 比較するint配列2
2273 * @return 両者の値が等しければTRUEを返す
2275 static bool int_n_cmp(int *a, int *b, int length)
2277 /* Null-string comparation is always TRUE */
2278 if (!length) return TRUE;
2282 if (*a != *(b++)) return FALSE;
2283 if (!(*(a++))) break;
2292 * @brief ある木が指定された木の部分木かどうかを返す /
2293 * Returns TRUE if an evolution tree is "partial tree"
2294 * @param tree 元となる木構造リスト
2295 * @param partial_tree 部分木かどうか判定したい木構造リスト
2296 * @return 部分木ならばTRUEを返す
2298 static bool is_partial_tree(int *tree, int *partial_tree)
2300 int pt_head = *(partial_tree++);
2303 while (partial_tree[pt_len]) pt_len++;
2307 if (*(tree++) == pt_head)
2309 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2318 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2319 * Sorting hook -- Comp function
2322 * @param a 比較したいモンスター種族ID1
2323 * @param b 比較したいモンスター種族ID2
2324 * @return 2が大きければTRUEを返す
2326 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2328 int **evol_tree = (int **)u;
2330 int w1 = evol_tree[a][0];
2331 int w2 = evol_tree[b][0];
2332 monster_race *r1_ptr = &r_info[w1];
2333 monster_race *r2_ptr = &r_info[w2];
2338 /* Used tree first */
2339 if (w1 && !w2) return TRUE;
2340 if (!w1 && w2) return FALSE;
2342 /* Sort by monster level */
2343 if (r1_ptr->level < r2_ptr->level) return TRUE;
2344 if (r1_ptr->level > r2_ptr->level) return FALSE;
2346 /* Sort by monster experience */
2347 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2348 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2350 /* Compare indexes */
2355 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2356 * Sorting hook -- Swap function
2359 * @param a スワップしたい木構造1
2360 * @param b スワップしたい木構造2
2361 * @return 2が大きければTRUEを返す
2363 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2365 int **evol_tree = (int **)u;
2372 holder = evol_tree[a];
2373 evol_tree[a] = evol_tree[b];
2374 evol_tree[b] = holder;
2378 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2379 * Print monsters' evolution information to file
2380 * @param fname 出力ファイル名
2383 static void spoil_mon_evol(cptr fname)
2386 monster_race *r_ptr;
2387 int **evol_tree, i, j, n, r_idx;
2388 int *evol_tree_zero; /* For C_KILL() */
2390 /* Build the filename */
2391 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2393 /* File type is "TEXT" */
2394 FILE_TYPE(FILE_TYPE_TEXT);
2397 fff = my_fopen(buf, "w");
2402 msg_print("Cannot create spoiler file.");
2406 /* Dump the header */
2407 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2408 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2411 spoil_out("------------------------------------------\n\n");
2413 /* Allocate the "evol_tree" array (2-dimension) */
2414 C_MAKE(evol_tree, max_r_idx, int *);
2415 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2416 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2417 evol_tree_zero = *evol_tree;
2419 /* Step 1: Build the evolution tree */
2420 for (i = 1; i < max_r_idx; i++)
2425 if (!r_ptr->next_exp) continue;
2427 /* Trace evolution */
2429 evol_tree[i][n++] = i;
2432 evol_tree[i][n++] = r_ptr->next_r_idx;
2433 r_ptr = &r_info[r_ptr->next_r_idx];
2435 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2438 /* Step 2: Scan the evolution trees and remove "partial tree" */
2439 for (i = 1; i < max_r_idx; i++)
2441 /* Not evolution tree */
2442 if (!evol_tree[i][0]) continue;
2444 for (j = 1; j < max_r_idx; j++)
2447 if (i == j) continue;
2449 /* Not evolution tree */
2450 if (!evol_tree[j][0]) continue;
2452 /* Is evolution tree[i] is part of [j]? */
2453 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2455 /* Remove this evolution tree */
2456 evol_tree[i][0] = 0;
2462 /* Step 3: Sort the evolution trees */
2464 /* Select the sort method */
2465 ang_sort_comp = ang_sort_comp_evol_tree;
2466 ang_sort_swap = ang_sort_swap_evol_tree;
2468 /* Sort the array */
2469 ang_sort(evol_tree, NULL, max_r_idx);
2471 /* Step 4: Print the evolution trees */
2472 for (i = 0; i < max_r_idx; i++)
2474 r_idx = evol_tree[i][0];
2476 /* No evolution or removed evolution tree */
2477 if (!r_idx) continue;
2479 /* Trace the evolution tree */
2480 r_ptr = &r_info[r_idx];
2482 fprintf(fff, "[%d]: %s (レベル%d, '%c')\n", r_idx,
2483 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2485 fprintf(fff, "[%d]: %s (Level %d, '%c')\n", r_idx,
2486 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2488 for (n = 1; r_ptr->next_exp; n++)
2490 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2491 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2492 r_ptr = &r_info[r_ptr->next_r_idx];
2494 fprintf(fff, "%s (レベル%d, '%c')\n",
2495 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2497 fprintf(fff, "%s (Level %d, '%c')\n",
2498 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2502 /* End of evolution tree */
2506 /* Free the "evol_tree" array (2-dimension) */
2507 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2508 C_KILL(evol_tree, max_r_idx, int *);
2510 /* Check for errors */
2511 if (ferror(fff) || my_fclose(fff))
2513 msg_print("Cannot close spoiler file.");
2518 msg_print("Successfully created a spoiler file.");
2526 extern void do_cmd_spoilers(void);
2529 * @brief スポイラー出力を行うコマンドのメインルーチン /
2530 * Create Spoiler files -BEN-
2533 void do_cmd_spoilers(void)
2535 /* Save the screen */
2545 prt("Create a spoiler file.", 2, 0);
2547 /* Prompt for a file */
2548 prt("(1) Brief Object Info (obj-desc.spo)", 5, 5);
2549 prt("(2) Brief Artifact Info (artifact.spo)", 6, 5);
2550 prt("(3) Brief Monster Info (mon-desc.spo)", 7, 5);
2551 prt("(4) Full Monster Info (mon-info.spo)", 8, 5);
2552 prt("(5) Monster Evolution Info (mon-evol.spo)", 9, 5);
2555 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2562 /* Restore the screen */
2568 spoil_obj_desc("obj-desc.spo");
2573 spoil_artifact("artifact.spo");
2578 spoil_mon_desc("mon-desc.spo");
2583 spoil_mon_info("mon-info.spo");
2588 spoil_mon_evol("mon-evol.spo");
2597 /* Flush messages */
2603 * @brief ランダムアーティファクト1件を解析する /
2604 * Fill in an object description structure for a given object
2605 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2606 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2609 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2611 analyze_general(o_ptr, desc_ptr->description);
2612 analyze_pval(o_ptr, &desc_ptr->pval_info);
2613 analyze_brand(o_ptr, desc_ptr->brands);
2614 analyze_slay(o_ptr, desc_ptr->slays);
2615 analyze_immune(o_ptr, desc_ptr->immunities);
2616 analyze_resist(o_ptr, desc_ptr->resistances);
2617 analyze_sustains(o_ptr, desc_ptr->sustains);
2618 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2619 desc_ptr->activation = item_activation(o_ptr);
2621 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2622 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2624 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2625 o_ptr->weight / 10, o_ptr->weight % 10);
2630 * @brief ランダムアーティファクト1件をスポイラー出力する /
2631 * Create a spoiler file entry for an artifact
2632 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2633 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2634 * Fill in an object description structure for a given object
2637 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2639 pval_info_type *pval_ptr = &art_ptr->pval_info;
2643 /* Don't indent the first line */
2644 fprintf(fff, "%s\n", art_ptr->description);
2647 if (!(o_ptr->ident & (IDENT_MENTAL)))
2649 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2652 /* An "empty" pval description indicates that the pval affects nothing */
2653 if (pval_ptr->pval_desc[0])
2655 /* Mention the effects of pval */
2656 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2657 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2660 /* Now deal with the description lists */
2663 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2664 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2665 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2666 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2667 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2669 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2670 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2671 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2672 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2673 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2675 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2677 /* Write out the possible activation at the primary indention level */
2678 if (art_ptr->activation)
2680 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2683 /* End with the miscellaneous facts */
2684 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2689 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2690 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2691 * @param i 出力したい記録ランダムアーティファクトID
2694 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2696 obj_desc_list artifact;
2698 if (!object_is_known(o_ptr) || !o_ptr->art_name
2699 || o_ptr->tval != group_artifact[i].tval)
2702 /* Analyze the artifact */
2703 random_artifact_analyze(o_ptr, &artifact);
2705 /* Write out the artifact description to the spoiler file */
2706 spoiler_print_randart(o_ptr, &artifact);
2710 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2711 * Create a list file for random artifacts
2712 * @param fname 出力ファイル名
2715 void spoil_random_artifact(cptr fname)
2725 /* Build the filename */
2726 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2728 /* File type is "TEXT" */
2729 FILE_TYPE(FILE_TYPE_TEXT);
2732 fff = my_fopen(buf, "w");
2737 msg_print("Cannot create list file.");
2741 /* Dump the header */
2742 sprintf(buf, "Random artifacts list.\r");
2743 spoiler_underline(buf);
2745 /* List the artifacts by tval */
2746 for (j = 0; group_artifact[j].tval; j++)
2748 /* random artifacts wielding */
2749 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2751 q_ptr = &inventory[i];
2752 spoil_random_artifact_aux(q_ptr, j);
2755 /* random artifacts in inventory */
2756 for (i = 0; i < INVEN_PACK; i++)
2758 q_ptr = &inventory[i];
2759 spoil_random_artifact_aux(q_ptr, j);
2762 /* random artifacts in home */
2763 st_ptr = &town[1].store[STORE_HOME];
2764 for (i = 0; i < st_ptr->stock_num; i++)
2766 q_ptr = &st_ptr->stock[i];
2767 spoil_random_artifact_aux(q_ptr, j);
2770 /* random artifacts in museum */
2771 st_ptr = &town[1].store[STORE_MUSEUM];
2772 for (i = 0; i < st_ptr->stock_num; i++)
2774 q_ptr = &st_ptr->stock[i];
2775 spoil_random_artifact_aux(q_ptr, j);
2779 /* Check for errors */
2780 if (ferror(fff) || my_fclose(fff))
2782 msg_print("Cannot close list file.");
2787 msg_print("Successfully created a list file.");
2794 #endif /* MACINTOSH */