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";
97 OBJECT_TYPE_VALUE tval;
104 * Item Spoilers by: benh@phial.com (Ben Harrison)
109 * The basic items categorized by type
111 static grouper group_item[] =
113 { TV_SHOT, _("射撃物", "Ammo") },
116 { TV_BOW, _("弓", "Bows") },
117 { TV_DIGGING, _("武器", "Weapons") },
118 { TV_POLEARM, NULL },
121 { TV_SOFT_ARMOR, _("防具 (体)", "Armour (Body)") },
122 { TV_HARD_ARMOR, NULL },
123 { TV_DRAG_ARMOR, NULL },
124 { TV_BOOTS, _("防具 (その他)", "Armour (Misc)") },
131 { TV_LITE, _("光源", "Light Sources") },
132 { TV_AMULET, _("アミュレット", "Amulets" )},
133 { TV_RING, _("指輪", "Rings") },
134 { TV_STAFF, _("杖", "Staffs") },
135 { TV_WAND, _("魔法棒", "Wands") },
136 { TV_ROD, _("ロッド", "Rods") },
137 { TV_SCROLL, _("巻物", "Scrolls") },
138 { TV_POTION, _("薬", "Potions") },
139 { TV_FOOD, _("食料", "Food") },
141 { TV_LIFE_BOOK, _("魔法書 (生命)", "Books (Life)") },
142 { TV_SORCERY_BOOK, _("魔法書 (仙術)", "Books (Sorcery)") },
143 { TV_NATURE_BOOK, _("魔法書 (自然)", "Books (Nature)") },
144 { TV_CHAOS_BOOK, _("魔法書 (カオス)", "Books (Chaos)") },
145 { TV_DEATH_BOOK, _("魔法書 (暗黒)", "Books (Death)") },
146 { TV_TRUMP_BOOK, _("魔法書 (トランプ)", "Books (Trump)") },
147 { TV_ARCANE_BOOK, _("魔法書 (秘術)", "Books (Arcane)") },
148 { TV_CRAFT_BOOK, _("魔法書 (匠)", "Books (Craft)") },
149 { TV_DAEMON_BOOK, _("魔法書 (悪魔)", "Books (Daemon)") },
150 { TV_CRUSADE_BOOK, _("魔法書 (破邪)", "Books (Crusade)") },
151 { TV_MUSIC_BOOK, _("歌集", "Song Books") },
152 { TV_HISSATSU_BOOK, _("武芸の書", "Books (Kendo)") },
153 { TV_HEX_BOOK, _("魔法書 (呪術)", "Books (Hex)") },
155 { TV_WHISTLE, _("笛", "Whistle") },
156 { TV_CAPTURE, _("キャプチャー・ボール", "Capture Ball") },
157 { TV_CARD, _("エクスプレスカード", "Express Card") },
159 { TV_CHEST, _("箱", "Chests") },
161 { TV_FIGURINE, _("人形", "Magical Figurines") },
162 { TV_STATUE, _("像", "Statues") },
163 { TV_CORPSE, _("死体", "Corpses") },
165 { TV_SKELETON, _("その他", "Misc") },
170 { TV_PARCHMENT, NULL },
177 * @brief ベースアイテムの各情報を文字列化する /
179 * @param buf 名称を返すバッファ参照ポインタ
180 * @param dam ダメージダイス記述を返すバッファ参照ポインタ
181 * @param wgt 重量記述を返すバッファ参照ポインタ
182 * @param lev 生成階記述を返すバッファ参照ポインタ
183 * @param chance 生成機会を返すバッファ参照ポインタ
184 * @param val 価値を返すバッファ参照ポインタ
188 static void kind_info(char *buf, char *dam, char *wgt, char *chance, DEPTH *lev, PRICE *val, OBJECT_IDX k)
195 /* Prepare a fake item */
196 object_prep(q_ptr, k);
199 q_ptr->ident |= (IDENT_KNOWN);
209 (*lev) = k_info[q_ptr->k_idx].level;
212 (*val) = object_value(q_ptr);
216 if (!buf || !dam || !chance || !wgt) return;
219 /* Description (too brief) */
220 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
240 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
250 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
265 sprintf(dam, "%d", q_ptr->ac);
272 for(i = 0; i < 4; i++)
274 char chance_aux[20] = "";
275 if(k_info[q_ptr->k_idx].chance[i] > 0)
277 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""),
278 (int)k_info[q_ptr->k_idx].locale[i], 100/k_info[q_ptr->k_idx].chance[i]);
279 strcat(chance, chance_aux);
285 sprintf(wgt, "%3d.%d", (int)(q_ptr->weight / 10), (int)(q_ptr->weight % 10));
290 * @brief 各ベースアイテムの情報を一行毎に記述する /
291 * Create a spoiler file for items
295 static void spoil_obj_desc(cptr fname)
297 int i, k, s, t, n = 0, group_start = 0;
308 /* Build the filename */
309 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
311 /* File type is "TEXT" */
312 FILE_TYPE(FILE_TYPE_TEXT);
315 fff = my_fopen(buf, "w");
319 msg_print("Cannot create spoiler file.");
325 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
326 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
329 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
330 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
331 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
332 "-------------------------------------", "------", "---", "---", "----------------", "----");
334 /* List the groups */
335 for (i = 0; TRUE; i++)
337 /* Write out the group title */
338 if (group_item[i].name)
342 /* Hack -- bubble-sort by cost and then level */
343 for (s = 0; s < n - 1; s++)
345 for (t = 0; t < n - 1; t++)
356 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
357 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
359 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
368 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
370 /* Spoil each item */
371 for (s = 0; s < n; s++)
376 /* Describe the kind */
377 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
380 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
381 buf, dam, wgt, (int)e, chance, (long)(v));
384 /* Start a new set */
389 if (!group_item[i].tval) break;
391 /* Start a new set */
395 /* Acquire legal item types */
396 for (k = 1; k < max_k_idx; k++)
398 object_kind *k_ptr = &k_info[k];
400 /* Skip wrong tval's */
401 if (k_ptr->tval != group_item[i].tval) continue;
403 /* Hack -- Skip instant-artifacts */
404 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
412 /* Check for errors */
413 if (ferror(fff) || my_fclose(fff))
415 msg_print("Cannot close spoiler file.");
419 msg_print("Successfully created a spoiler file.");
424 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
429 * Returns a "+" string if a number is non-negative and an empty
432 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
435 * These are used to format the artifact spoiler file. INDENT1 is used
436 * to indent all but the first line of an artifact spoiler. INDENT2 is
437 * used when a line "wraps". (Bladeturner's resistances cause this.)
443 * MAX_LINE_LEN specifies when a line should wrap.
445 #define MAX_LINE_LEN 75
448 * Given an array, determine how many elements are in the array
450 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
453 * The artifacts categorized by type
455 static grouper group_artifact[] =
459 { TV_POLEARM, "槍/斧" },
461 { TV_DIGGING, "シャベル/つるはし" },
466 { TV_SOFT_ARMOR, "鎧" },
467 { TV_HARD_ARMOR, NULL },
468 { TV_DRAG_ARMOR, NULL },
470 { TV_CLOAK, "クローク" },
479 { TV_AMULET, "アミュレット" },
482 { TV_SWORD, "Edged Weapons" },
483 { TV_POLEARM, "Polearms" },
484 { TV_HAFTED, "Hafted Weapons" },
485 { TV_DIGGING, "Shovels/Picks" },
487 { TV_ARROW, "Ammo" },
490 { TV_SOFT_ARMOR, "Body Armor" },
491 { TV_HARD_ARMOR, NULL },
492 { TV_DRAG_ARMOR, NULL },
494 { TV_CLOAK, "Cloaks" },
495 { TV_SHIELD, "Shields" },
497 { TV_HELM, "Helms/Crowns" },
499 { TV_GLOVES, "Gloves" },
500 { TV_BOOTS, "Boots" },
502 { TV_LITE, "Light Sources" },
503 { TV_AMULET, "Amulets" },
504 { TV_RING, "Rings" },
513 * Pair together a constant flag with a textual description.
515 * Used by both "init.c" and "wiz-spo.c".
517 * Note that it sometimes more efficient to actually make an array
518 * of textual names, where entry 'N' is assumed to be paired with
519 * the flag whose value is "1L << N", but that requires hard-coding.
522 typedef struct flag_desc flag_desc;
527 const char *const desc;
533 * These are used for "+3 to STR, DEX", etc. These are separate from
534 * the other pval affected traits to simplify the case where an object
535 * affects all stats. In this case, "All stats" is used instead of
536 * listing each stat individually.
539 static flag_desc stat_flags_desc[] =
559 * Besides stats, these are the other player traits
560 * which may be affected by an object's pval
563 static flag_desc pval_flags1_desc[] =
566 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
567 { TR_STEALTH, "隠密" },
569 { TR_INFRA, "赤外線視力" },
571 { TR_BLOWS, "攻撃回数" },
574 { TR_STEALTH, "Stealth" },
575 { TR_SEARCH, "Searching" },
576 { TR_INFRA, "Infravision" },
577 { TR_TUNNEL, "Tunneling" },
578 { TR_BLOWS, "Attacks" },
579 { TR_SPEED, "Speed" }
584 * Slaying preferences for weapons
587 static flag_desc slay_flags_desc[] =
590 { TR_SLAY_ANIMAL, "動物" },
591 { TR_KILL_ANIMAL, "*動物*" },
592 { TR_SLAY_EVIL, "邪悪" },
593 { TR_KILL_EVIL, "*邪悪*" },
594 { TR_SLAY_HUMAN, "人間" },
595 { TR_KILL_HUMAN, "*人間*" },
596 { TR_SLAY_UNDEAD, "アンデッド" },
597 { TR_KILL_UNDEAD, "*アンデッド*" },
598 { TR_SLAY_DEMON, "悪魔" },
599 { TR_KILL_DEMON, "*悪魔*" },
600 { TR_SLAY_ORC, "オーク" },
601 { TR_KILL_ORC, "*オーク*" },
602 { TR_SLAY_TROLL, "トロル" },
603 { TR_KILL_TROLL, "*トロル*" },
604 { TR_SLAY_GIANT, "巨人" },
605 { TR_KILL_GIANT, "*巨人*" },
606 { TR_SLAY_DRAGON, "ドラゴン" },
607 { TR_KILL_DRAGON, "*ドラゴン*" },
609 { TR_SLAY_ANIMAL, "Animal" },
610 { TR_KILL_ANIMAL, "XAnimal" },
611 { TR_SLAY_EVIL, "Evil" },
612 { TR_KILL_EVIL, "XEvil" },
613 { TR_SLAY_HUMAN, "Human" },
614 { TR_KILL_HUMAN, "XHuman" },
615 { TR_SLAY_UNDEAD, "Undead" },
616 { TR_KILL_UNDEAD, "XUndead" },
617 { TR_SLAY_DEMON, "Demon" },
618 { TR_KILL_DEMON, "XDemon" },
619 { TR_SLAY_ORC, "Orc" },
620 { TR_KILL_ORC, "XOrc" },
621 { TR_SLAY_TROLL, "Troll" },
622 { TR_KILL_TROLL, "XTroll" },
623 { TR_SLAY_GIANT, "Giant" },
624 { TR_KILL_GIANT, "Xgiant" },
625 { TR_SLAY_DRAGON, "Dragon" },
626 { TR_KILL_DRAGON, "Xdragon" }
631 * Elemental brands for weapons
633 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
634 * coding, it has been included here along with the elemental
635 * brands. It does seem to fit in with the brands and slaying
636 * more than the miscellaneous section.
638 static flag_desc brand_flags_desc[] =
641 { TR_BRAND_ACID, "溶解" },
642 { TR_BRAND_ELEC, "電撃" },
643 { TR_BRAND_FIRE, "焼棄" },
644 { TR_BRAND_COLD, "凍結" },
645 { TR_BRAND_POIS, "毒殺" },
647 { TR_FORCE_WEAPON, "理力" },
648 { TR_CHAOTIC, "混沌" },
649 { TR_VAMPIRIC, "吸血" },
651 { TR_VORPAL, "切れ味" },
653 { TR_BRAND_ACID, "Acid Brand" },
654 { TR_BRAND_ELEC, "Lightning Brand" },
655 { TR_BRAND_FIRE, "Flame Tongue" },
656 { TR_BRAND_COLD, "Frost Brand" },
657 { TR_BRAND_POIS, "Poisoned" },
659 { TR_FORCE_WEAPON, "Force" },
660 { TR_CHAOTIC, "Mark of Chaos" },
661 { TR_VAMPIRIC, "Vampiric" },
662 { TR_IMPACT, "Earthquake impact on hit" },
663 { TR_VORPAL, "Very sharp" },
671 static const flag_desc resist_flags_desc[] =
674 { TR_RES_ACID, "酸" },
675 { TR_RES_ELEC, "電撃" },
676 { TR_RES_FIRE, "火炎" },
677 { TR_RES_COLD, "冷気" },
678 { TR_RES_POIS, "毒" },
679 { TR_RES_FEAR, "恐怖"},
680 { TR_RES_LITE, "閃光" },
681 { TR_RES_DARK, "暗黒" },
682 { TR_RES_BLIND, "盲目" },
683 { TR_RES_CONF, "混乱" },
684 { TR_RES_SOUND, "轟音" },
685 { TR_RES_SHARDS, "破片" },
686 { TR_RES_NETHER, "地獄" },
687 { TR_RES_NEXUS, "因果混乱" },
688 { TR_RES_CHAOS, "カオス" },
689 { TR_RES_DISEN, "劣化" },
691 { TR_RES_ACID, "Acid" },
692 { TR_RES_ELEC, "Lightning" },
693 { TR_RES_FIRE, "Fire" },
694 { TR_RES_COLD, "Cold" },
695 { TR_RES_POIS, "Poison" },
696 { TR_RES_FEAR, "Fear"},
697 { TR_RES_LITE, "Light" },
698 { TR_RES_DARK, "Dark" },
699 { TR_RES_BLIND, "Blindness" },
700 { TR_RES_CONF, "Confusion" },
701 { TR_RES_SOUND, "Sound" },
702 { TR_RES_SHARDS, "Shards" },
703 { TR_RES_NETHER, "Nether" },
704 { TR_RES_NEXUS, "Nexus" },
705 { TR_RES_CHAOS, "Chaos" },
706 { TR_RES_DISEN, "Disenchantment" },
711 * Elemental immunities (along with poison)
714 static const flag_desc immune_flags_desc[] =
718 { TR_IM_ELEC, "電撃" },
719 { TR_IM_FIRE, "火炎" },
720 { TR_IM_COLD, "冷気" },
722 { TR_IM_ACID, "Acid" },
723 { TR_IM_ELEC, "Lightning" },
724 { TR_IM_FIRE, "Fire" },
725 { TR_IM_COLD, "Cold" },
730 * Sustain stats - these are given their "own" line in the
731 * spoiler file, mainly for simplicity
733 static const flag_desc sustain_flags_desc[] =
736 { TR_SUST_STR, "腕力" },
737 { TR_SUST_INT, "知能" },
738 { TR_SUST_WIS, "賢さ" },
739 { TR_SUST_DEX, "器用さ" },
740 { TR_SUST_CON, "耐久力" },
741 { TR_SUST_CHR, "魅力" },
743 { TR_SUST_STR, "STR" },
744 { TR_SUST_INT, "INT" },
745 { TR_SUST_WIS, "WIS" },
746 { TR_SUST_DEX, "DEX" },
747 { TR_SUST_CON, "CON" },
748 { TR_SUST_CHR, "CHR" },
753 * Miscellaneous magic given by an object's "flags2" field
756 static const flag_desc misc_flags2_desc[] =
760 { TR_REFLECT, "反射" },
761 { TR_FREE_ACT, "麻痺知らず" },
762 { TR_HOLD_EXP, "経験値維持" },
764 { TR_THROW, "Throwing" },
765 { TR_REFLECT, "Reflection" },
766 { TR_FREE_ACT, "Free Action" },
767 { TR_HOLD_EXP, "Hold Experience" },
772 * Miscellaneous magic given by an object's "flags3" field
774 * Note that cursed artifacts and objects with permanent light
775 * are handled "directly" -- see analyze_misc_magic()
778 static const flag_desc misc_flags3_desc[] =
781 { TR_SH_FIRE, "火炎オーラ" },
782 { TR_SH_ELEC, "電撃オーラ" },
783 { TR_SH_COLD, "冷気オーラ" },
784 { TR_NO_TELE, "反テレポート" },
785 { TR_NO_MAGIC, "反魔法" },
786 { TR_LEVITATION, "浮遊" },
787 { TR_SEE_INVIS, "可視透明" },
788 { TR_TELEPATHY, "テレパシー" },
789 { TR_ESP_ANIMAL, "動物感知" },
790 { TR_ESP_UNDEAD, "不死感知" },
791 { TR_ESP_DEMON, "悪魔感知" },
792 { TR_ESP_ORC, "オーク感知" },
793 { TR_ESP_TROLL, "トロル感知" },
794 { TR_ESP_GIANT, "巨人感知" },
795 { TR_ESP_DRAGON, "ドラゴン感知" },
796 { TR_ESP_HUMAN, "人間感知" },
797 { TR_ESP_EVIL, "邪悪感知" },
798 { TR_ESP_GOOD, "善良感知" },
799 { TR_ESP_NONLIVING, "無生物感知" },
800 { TR_ESP_UNIQUE, "ユニーク感知" },
801 { TR_SLOW_DIGEST, "遅消化" },
802 { TR_REGEN, "急速回復" },
803 { TR_WARNING, "警告" },
804 /* { TR_XTRA_MIGHT, "強力射撃" }, */
805 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
806 { TR_DRAIN_EXP, "経験値吸収" },
807 { TR_AGGRAVATE, "反感" },
808 { TR_BLESSED, "祝福" },
809 { TR_DEC_MANA, "消費魔力減少" },
811 { TR_SH_FIRE, "Fiery Aura" },
812 { TR_SH_ELEC, "Electric Aura" },
813 { TR_SH_COLD, "Coldly Aura" },
814 { TR_NO_TELE, "Prevent Teleportation" },
815 { TR_NO_MAGIC, "Anti-Magic" },
816 { TR_LEVITATION, "Levitation" },
817 { TR_SEE_INVIS, "See Invisible" },
818 { TR_TELEPATHY, "ESP" },
819 { TR_ESP_ANIMAL, "Sense Animal" },
820 { TR_ESP_UNDEAD, "Sense Undead" },
821 { TR_ESP_DEMON, "Sense Demon" },
822 { TR_ESP_ORC, "Sense Orc" },
823 { TR_ESP_TROLL, "Sense Troll" },
824 { TR_ESP_GIANT, "Sense Giant" },
825 { TR_ESP_DRAGON, "Sense Dragon" },
826 { TR_ESP_HUMAN, "Sense Human" },
827 { TR_ESP_EVIL, "Sense Evil" },
828 { TR_ESP_GOOD, "Sense Good" },
829 { TR_ESP_NONLIVING, "Sense Nonliving" },
830 { TR_ESP_UNIQUE, "Sense Unique" },
831 { TR_SLOW_DIGEST, "Slow Digestion" },
832 { TR_REGEN, "Regeneration" },
833 { TR_WARNING, "Warning" },
834 /* { TR_XTRA_MIGHT, "Extra Might" }, */
835 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
836 { TR_DRAIN_EXP, "Drains Experience" },
837 { TR_AGGRAVATE, "Aggravates" },
838 { TR_BLESSED, "Blessed Blade" },
839 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
845 * A special type used just for deailing with pvals
850 * This will contain a string such as "+2", "-10", etc.
855 * A list of various player traits affected by an object's pval such
856 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
857 * this list since it will probably be desirable to format its
858 * description differently.
860 * Note that room need only be reserved for the number of stats - 1
861 * since the description "All stats" is used if an object affects all
862 * all stats. Also, room must be reserved for a sentinel NULL pointer.
864 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
866 * This list includes extra attacks, for simplicity.
868 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
869 N_ELEMENTS(pval_flags1_desc) + 1];
875 * An "object analysis structure"
877 * It will be filled with descriptive strings detailing an object's
878 * various magical powers. The "ignore X" traits are not noted since
879 * all artifacts ignore "normal" destruction.
884 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
885 char description[MAX_NLEN];
887 /* Description of what is affected by an object's pval */
888 pval_info_type pval_info;
890 /* A list of an object's slaying preferences */
891 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
893 /* A list if an object's elemental brands */
894 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
896 /* A list of immunities granted by an object */
897 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
899 /* A list of resistances granted by an object */
900 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
902 /* A list of stats sustained by an object */
903 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
905 /* A list of various magical qualities an object may have */
906 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
907 + 1 /* Permanent Light */
909 + 1 /* type of curse */
910 + 1]; /* sentinel NULL */
912 /* Additional ability or resistance */
915 /* A string describing an artifact's activation */
918 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
924 * @brief ファイルポインタ先に同じ文字を複数出力する /
925 * Write out `n' of the character `c' to the spoiler file
930 static void spoiler_out_n_chars(int n, char c)
932 while (--n >= 0) fputc(c, fff);
937 * @brief ファイルポインタ先に改行を複数出力する /
938 * Write out `n' blank lines to the spoiler file
942 static void spoiler_blanklines(int n)
944 spoiler_out_n_chars(n, '\n');
949 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
950 * Write a line to the spoiler file and then "underline" it with hypens
951 * @param str 出力したい文字列
954 static void spoiler_underline(cptr str)
956 fprintf(fff, "%s\n", str);
957 spoiler_out_n_chars(strlen(str), '-');
964 * @brief アーティファクトの特性一覧を出力する /
965 * Write a line to the spoiler file and then "underline" it with hypens
966 * @param art_flags アーティファクトのフラグ群
967 * @param flag_ptr フラグ記述情報の参照ポインタ
968 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
969 * @param n_elmnts フラグの要素数
970 * @return desc_ptrと同じアドレス
973 * This function does most of the actual "analysis". Given a set of bit flags
974 * (which will be from one of the flags fields from the object in question),
975 * a "flag description structure", a "description list", and the number of
976 * elements in the "flag description structure", this function sets the
977 * "description list" members to the appropriate descriptions contained in
978 * the "flag description structure".
979 * The possibly updated description pointer is returned.
982 static cptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
983 const flag_desc *flag_ptr,
984 cptr *desc_ptr, const int n_elmnts)
988 for (i = 0; i < n_elmnts; ++i)
990 if (have_flag(art_flags, flag_ptr[i].flag))
992 *desc_ptr++ = flag_ptr[i].desc;
1001 * @brief アイテムの特定記述内容を返す /
1002 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1003 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1004 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1007 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1009 /* Get a "useful" description of the object */
1010 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1015 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1016 * List "player traits" altered by an artifact's pval. These include stats,
1017 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1018 * @param o_ptr オブジェクト構造体の参照ポインタ
1019 * @param p_ptr pval修正構造体の参照ポインタ
1022 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1024 BIT_FLAGS flgs[TR_FLAG_SIZE];
1028 /* If pval == 0, there is nothing to do. */
1031 /* An "empty" pval description indicates that pval == 0 */
1032 pi_ptr->pval_desc[0] = '\0';
1036 /* Extract the flags */
1037 object_flags(o_ptr, flgs);
1039 affects_list = pi_ptr->pval_affects;
1041 /* Create the "+N" string */
1042 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1044 /* First, check to see if the pval affects all stats */
1045 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1046 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1047 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1049 *affects_list++ = _("全能力", "All stats");
1052 /* Are any stats affected? */
1053 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1054 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1055 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1057 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1059 N_ELEMENTS(stat_flags_desc));
1062 /* And now the "rest" */
1063 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1065 N_ELEMENTS(pval_flags1_desc));
1067 /* Terminate the description list */
1068 *affects_list = NULL;
1072 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1073 * Note the slaying specialties of a weapon
1074 * @param o_ptr オブジェクト構造体の参照ポインタ
1075 * @param slay_list 種族スレイ構造体の参照ポインタ
1078 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1080 BIT_FLAGS flgs[TR_FLAG_SIZE];
1082 object_flags(o_ptr, flgs);
1084 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1085 N_ELEMENTS(slay_flags_desc));
1087 /* Terminate the description list */
1093 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1094 * Note an object's elemental brands
1095 * @param o_ptr オブジェクト構造体の参照ポインタ
1096 * @param brand_list 属性ブランド構造体の参照ポインタ
1099 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1101 BIT_FLAGS flgs[TR_FLAG_SIZE];
1103 object_flags(o_ptr, flgs);
1105 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1106 N_ELEMENTS(brand_flags_desc));
1108 /* Terminate the description list */
1114 * @brief アーティファクトの通常耐性を構造体に収める /
1115 * Note an object's elemental brands
1116 * @param o_ptr オブジェクト構造体の参照ポインタ
1117 * @param resist_list 通常耐性構造体の参照ポインタ
1120 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1122 BIT_FLAGS flgs[TR_FLAG_SIZE];
1124 object_flags(o_ptr, flgs);
1126 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1127 resist_list, N_ELEMENTS(resist_flags_desc));
1129 /* Terminate the description list */
1130 *resist_list = NULL;
1135 * @brief アーティファクトの免疫特性を構造体に収める /
1136 * Note the immunities granted by an object
1137 * @param o_ptr オブジェクト構造体の参照ポインタ
1138 * @param immune_list 免疫構造体の参照ポインタ
1141 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1143 BIT_FLAGS flgs[TR_FLAG_SIZE];
1145 object_flags(o_ptr, flgs);
1147 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1148 immune_list, N_ELEMENTS(immune_flags_desc));
1150 /* Terminate the description list */
1151 *immune_list = NULL;
1156 * @brief アーティファクトの維持特性を構造体に収める /
1157 * Note which stats an object sustains
1158 * @param o_ptr オブジェクト構造体の参照ポインタ
1159 * @param sustain_list 維持特性構造体の参照ポインタ
1162 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1164 BIT_FLAGS flgs[TR_FLAG_SIZE];
1166 object_flags(o_ptr, flgs);
1168 /* Simplify things if an item sustains all stats */
1169 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1170 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1171 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1173 *sustain_list++ = _("全能力", "All stats");
1176 /* Should we bother? */
1177 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1178 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1179 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1181 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1183 N_ELEMENTS(sustain_flags_desc));
1186 /* Terminate the description list */
1187 *sustain_list = NULL;
1192 * @brief アーティファクトのその他の特性を構造体に収める /
1193 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1194 * free action, permanent light, etc.
1195 * @param o_ptr オブジェクト構造体の参照ポインタ
1196 * @param misc_list その他の特性構造体の参照ポインタ
1199 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1201 BIT_FLAGS flgs[TR_FLAG_SIZE];
1205 object_flags(o_ptr, flgs);
1207 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1208 N_ELEMENTS(misc_flags2_desc));
1210 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list, N_ELEMENTS(misc_flags3_desc));
1213 * Glowing artifacts -- small radius light.
1216 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1217 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1218 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1219 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1220 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1221 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1223 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1225 if (have_flag(flgs, TR_LITE_FUEL))
1227 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
1231 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), (int)rad);
1232 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), (int)-rad);
1235 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1238 * Handle cursed objects here to avoid redundancies such as noting
1239 * that a permanently cursed object is heavily cursed as well as
1240 * being "lightly cursed".
1243 /* if (object_is_cursed(o_ptr)) */
1245 if (have_flag(flgs, TR_TY_CURSE))
1247 *misc_list++ = _("太古の怨念", "Ancient Curse");
1249 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1251 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1253 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1255 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1258 else if (o_ptr->curse_flags & TRC_CURSED)
1260 *misc_list++ = _("呪い", "Cursed");
1262 if (have_flag(flgs, TR_ADD_L_CURSE))
1264 *misc_list++ = _("呪いを増やす", "Cursing");
1266 if (have_flag(flgs, TR_ADD_H_CURSE))
1268 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1272 /* Terminate the description list */
1278 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1279 * Note additional ability and/or resistance of fixed artifacts
1280 * @param o_ptr オブジェクト構造体の参照ポインタ
1281 * @param addition 追加ランダム耐性構造体の参照ポインタ
1284 static void analyze_addition(object_type *o_ptr, char *addition)
1286 artifact_type *a_ptr = &a_info[o_ptr->name1];
1289 strcpy(addition, "");
1292 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1293 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1295 strcat(addition, "能力");
1296 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1298 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1300 strcat(addition, "耐性");
1301 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1303 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1305 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1306 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1308 strcat(addition, "Ability");
1309 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1311 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1313 strcat(addition, "Resistance");
1314 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1316 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1322 * @brief アーティファクトの基本情報を文字列に収める /
1323 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1324 * and its value in gold pieces
1325 * @param o_ptr オブジェクト構造体の参照ポインタ
1326 * @param misc_desc 基本情報を収める文字列参照ポインタ
1329 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1331 artifact_type *a_ptr = &a_info[o_ptr->name1];
1333 sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ptr->level, a_ptr->rarity,
1335 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1337 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1343 * @brief アーティファクトの情報全体を構造体に収める /
1344 * Fill in an object description structure for a given object
1345 * and its value in gold pieces
1346 * @param o_ptr オブジェクト構造体の参照ポインタ
1347 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1350 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1352 analyze_general(o_ptr, desc_ptr->description);
1353 analyze_pval(o_ptr, &desc_ptr->pval_info);
1354 analyze_brand(o_ptr, desc_ptr->brands);
1355 analyze_slay(o_ptr, desc_ptr->slays);
1356 analyze_immune(o_ptr, desc_ptr->immunities);
1357 analyze_resist(o_ptr, desc_ptr->resistances);
1358 analyze_sustains(o_ptr, desc_ptr->sustains);
1359 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1360 analyze_addition(o_ptr, desc_ptr->addition);
1361 analyze_misc(o_ptr, desc_ptr->misc_desc);
1362 desc_ptr->activation = item_activation(o_ptr);
1367 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1370 static void print_header(void)
1374 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1375 spoiler_underline(buf);
1379 * This is somewhat ugly.
1381 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1382 * and a separator character (',', e.g.), write the list to the spoiler file
1383 * in a "nice" format, such as:
1385 * Resist Fire, Cold, Acid
1387 * That was a simple example, but when the list is long, a line wrap
1388 * should occur, and this should induce a new level of indention if
1389 * a list is being spread across lines. So for example, Bladeturner's
1390 * list of resistances should look something like this
1392 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1393 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1395 * However, the code distinguishes between a single list of many items vs.
1396 * many lists. (The separator is used to make this determination.) A single
1397 * list of many items will not cause line wrapping (since there is no
1398 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1399 * might look like this:
1401 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1404 * So comparing the two, "Regeneration" has no trailing separator and
1405 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1406 * but that's not relevant to line wrapping and indention.)
1409 /* ITEM_SEP separates items within a list */
1410 #define ITEM_SEP ','
1413 /* LIST_SEP separates lists */
1415 #define LIST_SEP ','
1417 #define LIST_SEP ';'
1421 * @brief フラグ名称を出力する汎用関数
1422 * @param header ヘッダに出力するフラグ群の名前
1423 * @param list フラグ名リスト
1424 * @param separator フラグ表示の区切り記号
1427 static void spoiler_outlist(cptr header, cptr *list, char separator)
1429 int line_len, buf_len;
1430 char line[MAX_LINE_LEN+1], buf[80];
1432 /* Ignore an empty list */
1433 if (*list == NULL) return;
1435 /* This function always indents */
1436 strcpy(line, INDENT1);
1438 /* Create header (if one was given) */
1439 if (header && (header[0]))
1441 strcat(line, header);
1445 line_len = strlen(line);
1447 /* Now begin the tedious task */
1450 /* Copy the current item to a buffer */
1453 /* Note the buffer's length */
1454 buf_len = strlen(buf);
1457 * If there is an item following this one, pad with separator and
1458 * a space and adjust the buffer length
1463 sprintf(buf + buf_len, "%c ", separator);
1468 * If the buffer will fit on the current line, just append the
1469 * buffer to the line and adjust the line length accordingly.
1472 if (line_len + buf_len <= MAX_LINE_LEN)
1475 line_len += buf_len;
1478 /* Apply line wrapping and indention semantics described above */
1482 * Don't print a trailing list separator but do print a trailing
1485 if (line_len > 1 && line[line_len - 1] == ' '
1486 && line[line_len - 2] == LIST_SEP)
1488 /* Ignore space and separator */
1489 line[line_len - 2] = '\0';
1491 /* Write to spoiler file */
1492 fprintf(fff, "%s\n", line);
1494 /* Begin new line at primary indention level */
1495 sprintf(line, "%s%s", INDENT1, buf);
1500 /* Write to spoiler file */
1501 fprintf(fff, "%s\n", line);
1503 /* Begin new line at secondary indention level */
1504 sprintf(line, "%s%s", INDENT2, buf);
1507 line_len = strlen(line);
1510 /* Advance, with break */
1511 if (!*++list) break;
1514 /* Write what's left to the spoiler file */
1515 fprintf(fff, "%s\n", line);
1519 * @brief アーティファクト一件をスポイラー出力する /
1520 * Create a spoiler file entry for an artifact
1521 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1524 static void spoiler_print_art(obj_desc_list *art_ptr)
1526 pval_info_type *pval_ptr = &art_ptr->pval_info;
1529 /* Don't indent the first line */
1530 fprintf(fff, "%s\n", art_ptr->description);
1532 /* An "empty" pval description indicates that the pval affects nothing */
1533 if (pval_ptr->pval_desc[0])
1535 /* Mention the effects of pval */
1536 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1537 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1540 /* Now deal with the description lists */
1541 spoiler_outlist(_("対:", "Slay"), art_ptr->slays, ITEM_SEP);
1542 spoiler_outlist(_("武器属性:", ""), art_ptr->brands, LIST_SEP);
1543 spoiler_outlist(_("免疫:", "Immunity to"), art_ptr->immunities, ITEM_SEP);
1544 spoiler_outlist(_("耐性:", "Resist"), art_ptr->resistances, ITEM_SEP);
1545 spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustains, ITEM_SEP);
1546 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1548 if (art_ptr->addition[0])
1550 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1553 /* Write out the possible activation at the primary indention level */
1554 if (art_ptr->activation)
1556 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1559 /* End with the miscellaneous facts */
1560 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1565 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1566 * Hack -- Create a "forged" artifact
1567 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1568 * @param name1 生成するアーティファクトID
1569 * @return 生成が成功した場合TRUEを返す
1571 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1574 artifact_type *a_ptr = &a_info[name1];
1576 /* Ignore "empty" artifacts */
1577 if (!a_ptr->name) return FALSE;
1579 /* Acquire the "kind" index */
1580 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1582 if (!i) return (FALSE);
1584 /* Create the artifact */
1585 object_prep(o_ptr, i);
1588 o_ptr->name1 = (byte_hack)name1;
1590 /* Extract the fields */
1591 o_ptr->pval = a_ptr->pval;
1592 o_ptr->ac = a_ptr->ac;
1593 o_ptr->dd = a_ptr->dd;
1594 o_ptr->ds = a_ptr->ds;
1595 o_ptr->to_a = a_ptr->to_a;
1596 o_ptr->to_h = a_ptr->to_h;
1597 o_ptr->to_d = a_ptr->to_d;
1598 o_ptr->weight = a_ptr->weight;
1606 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1607 * Create a spoiler file for artifacts
1608 * @param fname 生成ファイル名
1611 static void spoil_artifact(cptr fname)
1618 obj_desc_list artifact;
1621 /* Build the filename */
1622 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1624 /* File type is "TEXT" */
1625 FILE_TYPE(FILE_TYPE_TEXT);
1628 fff = my_fopen(buf, "w");
1632 msg_print("Cannot create spoiler file.");
1636 /* Dump the header */
1639 /* List the artifacts by tval */
1640 for (i = 0; group_artifact[i].tval; i++)
1642 /* Write out the group title */
1643 if (group_artifact[i].name)
1645 spoiler_blanklines(2);
1646 spoiler_underline(group_artifact[i].name);
1647 spoiler_blanklines(1);
1650 /* Now search through all of the artifacts */
1651 for (j = 1; j < max_a_idx; ++j)
1653 artifact_type *a_ptr = &a_info[j];
1655 /* We only want objects in the current group */
1656 if (a_ptr->tval != group_artifact[i].tval) continue;
1660 /* Attempt to "forge" the artifact */
1661 if (!make_fake_artifact(q_ptr, j)) continue;
1663 /* Analyze the artifact */
1664 object_analyze(q_ptr, &artifact);
1666 /* Write out the artifact description to the spoiler file */
1667 spoiler_print_art(&artifact);
1671 /* Check for errors */
1672 if (ferror(fff) || my_fclose(fff))
1674 msg_print("Cannot close spoiler file.");
1678 msg_print("Successfully created a spoiler file.");
1683 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1684 * Create a spoiler file for monsters -BEN-
1685 * @param fname 生成ファイル名
1688 static void spoil_mon_desc(cptr fname)
1705 /* Build the filename */
1706 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1708 /* File type is "TEXT" */
1709 FILE_TYPE(FILE_TYPE_TEXT);
1712 fff = my_fopen(buf, "w");
1716 msg_print("Cannot create spoiler file.");
1720 /* Allocate the "who" array */
1721 C_MAKE(who, max_r_idx, s16b);
1723 /* Dump the header */
1724 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1725 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1726 fprintf(fff, "------------------------------------------\n\n");
1728 /* Dump the header */
1729 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1730 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1731 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1732 "--------", "---", "---", "---", "--", "--", "-----------");
1735 /* Scan the monsters */
1736 for (i = 1; i < max_r_idx; i++)
1738 monster_race *r_ptr = &r_info[i];
1740 /* Use that monster */
1741 if (r_ptr->name) who[n++] = (s16b)i;
1744 /* Select the sort method */
1745 ang_sort_comp = ang_sort_comp_hook;
1746 ang_sort_swap = ang_sort_swap_hook;
1748 /* Sort the array by dungeon depth of monsters */
1749 ang_sort(who, &why, n);
1752 for (i = 0; i < n; i++)
1754 monster_race *r_ptr = &r_info[who[i]];
1756 cptr name = (r_name + r_ptr->name);
1757 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1759 /* Get the "name" */
1761 else if (r_ptr->flags3 & (RF3_NO_CONF))
1763 sprintf(nam, "[*] %s", name);
1766 else if (r_ptr->flags1 & (RF1_UNIQUE))
1768 sprintf(nam, "[U] %s", name);
1772 sprintf(nam, _(" %s", "The %s"), name);
1777 sprintf(lev, "%d", (int)r_ptr->level);
1780 sprintf(rar, "%d", (int)r_ptr->rarity);
1783 if (r_ptr->speed >= 110)
1785 sprintf(spd, "+%d", (r_ptr->speed - 110));
1789 sprintf(spd, "-%d", (110 - r_ptr->speed));
1793 sprintf(ac, "%d", r_ptr->ac);
1796 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1798 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1802 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1807 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1809 /* Hack -- use visual instead */
1810 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1813 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1814 nam, lev, rar, spd, hp, ac, exp);
1821 /* Free the "who" array */
1822 C_KILL(who, max_r_idx, s16b);
1824 /* Check for errors */
1825 if (ferror(fff) || my_fclose(fff))
1827 msg_print("Cannot close spoiler file.");
1832 msg_print("Successfully created a spoiler file.");
1839 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1841 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1847 * @brief 文字列をファイルポインタに出力する /
1848 * Buffer text to the given file. (-SHAWN-)
1849 * This is basically c_roff() from mon-desc.c with a few changes.
1850 * @param str 文字列参照ポインタ
1853 static void spoil_out(cptr str)
1858 static char roff_buf[256];
1861 static char roff_waiting_buf[256];
1864 bool iskanji_flag = FALSE;
1866 /* Current pointer into line roff_buf */
1867 static char *roff_p = roff_buf;
1869 /* Last space saved into roff_buf */
1870 static char *roff_s = NULL;
1872 /* Mega-Hack -- Delayed output */
1873 static bool waiting_output = FALSE;
1875 /* Special handling for "new sequence" */
1880 fputs(roff_waiting_buf, fff);
1881 waiting_output = FALSE;
1884 if (roff_p != roff_buf) roff_p--;
1885 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1887 if (roff_p == roff_buf) fprintf(fff, "\n");
1890 *(roff_p + 1) = '\0';
1891 fprintf(fff, "%s\n\n", roff_buf);
1900 /* Scan the given string, character at a time */
1905 bool k_flag = iskanji((unsigned char)(*str));
1908 bool wrap = (ch == '\n');
1911 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1912 iskanji_flag = k_flag && !iskanji_flag;
1914 if (!isprint(ch)) ch = ' ';
1919 fputs(roff_waiting_buf, fff);
1920 if (!wrap) fputc('\n', fff);
1921 waiting_output = FALSE;
1927 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1928 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
1930 if (roff_p >= roff_buf + 75) wrap = TRUE;
1931 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
1938 bool iskanji_flag_local = FALSE;
1939 cptr tail = str + (k_flag ? 2 : 1);
1941 cptr tail = str + 1;
1944 for (; *tail; tail++)
1946 if (*tail == ' ') continue;
1949 k_flag_local = iskanji((unsigned char)(*tail));
1950 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
1951 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
1953 if (isprint(*tail)) break;
1957 if (!*tail) waiting_output = TRUE;
1961 /* Handle line-wrap */
1969 if (roff_s && (ch != ' '))
1977 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
1978 else strcpy(roff_waiting_buf, roff_buf);
1982 if (cbak != ' ') *roff_p++ = cbak;
1984 while (*r) *roff_p++ = *r++;
1988 if ((roff_p > roff_buf) || (ch != ' '))
1993 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
1998 strncmp(str, "。", 2) != 0 &&
1999 strncmp(str, "、", 2) != 0 &&
2000 strncmp(str, "ィ", 2) != 0 &&
2001 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2004 if (ch == ' ') roff_s = roff_p;
2015 * @brief 関数ポインタ用の出力関数 /
2016 * Hook function used in spoil_mon_info()
2018 * @param str 文字列参照ポインタ
2021 static void roff_func(byte attr, cptr str)
2031 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2032 * Create a spoiler file for monsters (-SHAWN-)
2033 * @param fname ファイル名
2036 static void spoil_mon_info(cptr fname)
2045 /* Build the filename */
2046 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2048 /* File type is "TEXT" */
2049 FILE_TYPE(FILE_TYPE_TEXT);
2052 fff = my_fopen(buf, "w");
2056 msg_print("Cannot create spoiler file.");
2061 /* Dump the header */
2062 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2063 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2066 spoil_out("------------------------------------------\n\n");
2068 /* Allocate the "who" array */
2069 C_MAKE(who, max_r_idx, s16b);
2071 /* Scan the monsters */
2072 for (i = 1; i < max_r_idx; i++)
2074 monster_race *r_ptr = &r_info[i];
2076 /* Use that monster */
2077 if (r_ptr->name) who[n++] = (s16b)i;
2080 /* Select the sort method */
2081 ang_sort_comp = ang_sort_comp_hook;
2082 ang_sort_swap = ang_sort_swap_hook;
2084 /* Sort the array by dungeon depth of monsters */
2085 ang_sort(who, &why, n);
2089 * List all monsters in order
2091 for (l = 0; l < n; l++)
2093 monster_race *r_ptr = &r_info[who[l]];
2095 /* Extract the flags */
2096 flags1 = r_ptr->flags1;
2100 if (flags1 & (RF1_QUESTOR))
2106 if (flags1 & (RF1_UNIQUE))
2118 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2123 spoil_out(attr_to_text(r_ptr));
2126 sprintf(buf, " '%c')\n", r_ptr->d_char);
2131 sprintf(buf, "=== ");
2135 sprintf(buf, "Num:%d ", who[l]);
2139 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2143 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2147 if (r_ptr->speed >= 110)
2149 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2153 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2158 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2160 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2164 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2169 sprintf(buf, "Ac:%d ", r_ptr->ac);
2173 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2176 /* Reuse the code of monster recall. */
2177 output_monster_spoiler(who[l], roff_func);
2182 /* Free the "who" array */
2183 C_KILL(who, max_r_idx, s16b);
2185 /* Check for errors */
2186 if (ferror(fff) || my_fclose(fff))
2188 msg_print("Cannot close spoiler file.");
2192 msg_print("Successfully created a spoiler file.");
2197 #define MAX_EVOL_DEPTH 64
2201 * @brief int配列でstrncmp()と似た比較処理を行う /
2202 * Compare two int-type array like strncmp() and return TRUE if equals
2203 * @param a 比較するint配列1
2204 * @param b 比較するint配列2
2206 * @return 両者の値が等しければTRUEを返す
2208 static bool int_n_cmp(int *a, int *b, int length)
2210 /* Null-string comparation is always TRUE */
2211 if (!length) return TRUE;
2215 if (*a != *(b++)) return FALSE;
2216 if (!(*(a++))) break;
2225 * @brief ある木が指定された木の部分木かどうかを返す /
2226 * Returns TRUE if an evolution tree is "partial tree"
2227 * @param tree 元となる木構造リスト
2228 * @param partial_tree 部分木かどうか判定したい木構造リスト
2229 * @return 部分木ならばTRUEを返す
2231 static bool is_partial_tree(int *tree, int *partial_tree)
2233 int pt_head = *(partial_tree++);
2236 while (partial_tree[pt_len]) pt_len++;
2240 if (*(tree++) == pt_head)
2242 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2251 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2252 * Sorting hook -- Comp function
2255 * @param a 比較したいモンスター種族ID1
2256 * @param b 比較したいモンスター種族ID2
2257 * @return 2が大きければTRUEを返す
2259 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2261 int **evol_tree = (int **)u;
2263 int w1 = evol_tree[a][0];
2264 int w2 = evol_tree[b][0];
2265 monster_race *r1_ptr = &r_info[w1];
2266 monster_race *r2_ptr = &r_info[w2];
2271 /* Used tree first */
2272 if (w1 && !w2) return TRUE;
2273 if (!w1 && w2) return FALSE;
2275 /* Sort by monster level */
2276 if (r1_ptr->level < r2_ptr->level) return TRUE;
2277 if (r1_ptr->level > r2_ptr->level) return FALSE;
2279 /* Sort by monster experience */
2280 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2281 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2283 /* Compare indexes */
2288 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2289 * Sorting hook -- Swap function
2292 * @param a スワップしたい木構造1
2293 * @param b スワップしたい木構造2
2294 * @return 2が大きければTRUEを返す
2296 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2298 int **evol_tree = (int **)u;
2305 holder = evol_tree[a];
2306 evol_tree[a] = evol_tree[b];
2307 evol_tree[b] = holder;
2311 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2312 * Print monsters' evolution information to file
2313 * @param fname 出力ファイル名
2316 static void spoil_mon_evol(cptr fname)
2319 monster_race *r_ptr;
2320 int **evol_tree, i, j, n, r_idx;
2321 int *evol_tree_zero; /* For C_KILL() */
2323 /* Build the filename */
2324 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2326 /* File type is "TEXT" */
2327 FILE_TYPE(FILE_TYPE_TEXT);
2330 fff = my_fopen(buf, "w");
2334 msg_print("Cannot create spoiler file.");
2338 /* Dump the header */
2339 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2340 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2343 spoil_out("------------------------------------------\n\n");
2345 /* Allocate the "evol_tree" array (2-dimension) */
2346 C_MAKE(evol_tree, max_r_idx, int *);
2347 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2348 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2349 evol_tree_zero = *evol_tree;
2351 /* Step 1: Build the evolution tree */
2352 for (i = 1; i < max_r_idx; i++)
2357 if (!r_ptr->next_exp) continue;
2359 /* Trace evolution */
2361 evol_tree[i][n++] = i;
2364 evol_tree[i][n++] = r_ptr->next_r_idx;
2365 r_ptr = &r_info[r_ptr->next_r_idx];
2367 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2370 /* Step 2: Scan the evolution trees and remove "partial tree" */
2371 for (i = 1; i < max_r_idx; i++)
2373 /* Not evolution tree */
2374 if (!evol_tree[i][0]) continue;
2376 for (j = 1; j < max_r_idx; j++)
2379 if (i == j) continue;
2381 /* Not evolution tree */
2382 if (!evol_tree[j][0]) continue;
2384 /* Is evolution tree[i] is part of [j]? */
2385 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2387 /* Remove this evolution tree */
2388 evol_tree[i][0] = 0;
2394 /* Step 3: Sort the evolution trees */
2396 /* Select the sort method */
2397 ang_sort_comp = ang_sort_comp_evol_tree;
2398 ang_sort_swap = ang_sort_swap_evol_tree;
2400 /* Sort the array */
2401 ang_sort(evol_tree, NULL, max_r_idx);
2403 /* Step 4: Print the evolution trees */
2404 for (i = 0; i < max_r_idx; i++)
2406 r_idx = evol_tree[i][0];
2408 /* No evolution or removed evolution tree */
2409 if (!r_idx) continue;
2411 /* Trace the evolution tree */
2412 r_ptr = &r_info[r_idx];
2413 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2414 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2416 for (n = 1; r_ptr->next_exp; n++)
2418 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2419 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2420 r_ptr = &r_info[r_ptr->next_r_idx];
2421 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2422 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2425 /* End of evolution tree */
2429 /* Free the "evol_tree" array (2-dimension) */
2430 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2431 C_KILL(evol_tree, max_r_idx, int *);
2433 /* Check for errors */
2434 if (ferror(fff) || my_fclose(fff))
2436 msg_print("Cannot close spoiler file.");
2440 msg_print("Successfully created a spoiler file.");
2448 extern void do_cmd_spoilers(void);
2451 * @brief スポイラー出力を行うコマンドのメインルーチン /
2452 * Create Spoiler files -BEN-
2455 void do_cmd_spoilers(void)
2457 /* Save the screen */
2467 prt("Create a spoiler file.", 2, 0);
2469 /* Prompt for a file */
2470 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2471 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2472 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2473 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2474 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2477 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2484 /* Restore the screen */
2490 spoil_obj_desc("obj-desc.txt");
2495 spoil_artifact("artifact.txt");
2500 spoil_mon_desc("mon-desc.txt");
2505 spoil_mon_info("mon-info.txt");
2510 spoil_mon_evol("mon-evol.txt");
2518 /* Flush messages */
2524 * @brief ランダムアーティファクト1件を解析する /
2525 * Fill in an object description structure for a given object
2526 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2527 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2530 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2532 analyze_general(o_ptr, desc_ptr->description);
2533 analyze_pval(o_ptr, &desc_ptr->pval_info);
2534 analyze_brand(o_ptr, desc_ptr->brands);
2535 analyze_slay(o_ptr, desc_ptr->slays);
2536 analyze_immune(o_ptr, desc_ptr->immunities);
2537 analyze_resist(o_ptr, desc_ptr->resistances);
2538 analyze_sustains(o_ptr, desc_ptr->sustains);
2539 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2540 desc_ptr->activation = item_activation(o_ptr);
2542 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2543 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2545 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2546 o_ptr->weight / 10, o_ptr->weight % 10);
2551 * @brief ランダムアーティファクト1件をスポイラー出力する /
2552 * Create a spoiler file entry for an artifact
2553 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2554 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2555 * Fill in an object description structure for a given object
2558 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2560 pval_info_type *pval_ptr = &art_ptr->pval_info;
2564 /* Don't indent the first line */
2565 fprintf(fff, "%s\n", art_ptr->description);
2568 if (!(o_ptr->ident & (IDENT_MENTAL)))
2570 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2573 /* An "empty" pval description indicates that the pval affects nothing */
2574 if (pval_ptr->pval_desc[0])
2576 /* Mention the effects of pval */
2577 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2578 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2581 /* Now deal with the description lists */
2584 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2585 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2586 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2587 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2588 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2590 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2591 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2592 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2593 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2594 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2596 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2598 /* Write out the possible activation at the primary indention level */
2599 if (art_ptr->activation)
2601 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2604 /* End with the miscellaneous facts */
2605 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2610 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2611 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2612 * @param i 出力したい記録ランダムアーティファクトID
2615 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2617 obj_desc_list artifact;
2619 if (!object_is_known(o_ptr) || !o_ptr->art_name
2620 || o_ptr->tval != group_artifact[i].tval)
2623 /* Analyze the artifact */
2624 random_artifact_analyze(o_ptr, &artifact);
2626 /* Write out the artifact description to the spoiler file */
2627 spoiler_print_randart(o_ptr, &artifact);
2631 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2632 * Create a list file for random artifacts
2633 * @param fname 出力ファイル名
2636 void spoil_random_artifact(cptr fname)
2646 /* Build the filename */
2647 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2649 /* File type is "TEXT" */
2650 FILE_TYPE(FILE_TYPE_TEXT);
2653 fff = my_fopen(buf, "w");
2657 msg_print("Cannot create list file.");
2661 /* Dump the header */
2662 sprintf(buf, "Random artifacts list.\r");
2663 spoiler_underline(buf);
2665 /* List the artifacts by tval */
2666 for (j = 0; group_artifact[j].tval; j++)
2668 /* random artifacts wielding */
2669 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2671 q_ptr = &inventory[i];
2672 spoil_random_artifact_aux(q_ptr, j);
2675 /* random artifacts in inventory */
2676 for (i = 0; i < INVEN_PACK; i++)
2678 q_ptr = &inventory[i];
2679 spoil_random_artifact_aux(q_ptr, j);
2682 /* random artifacts in home */
2683 st_ptr = &town[1].store[STORE_HOME];
2684 for (i = 0; i < st_ptr->stock_num; i++)
2686 q_ptr = &st_ptr->stock[i];
2687 spoil_random_artifact_aux(q_ptr, j);
2690 /* random artifacts in museum */
2691 st_ptr = &town[1].store[STORE_MUSEUM];
2692 for (i = 0; i < st_ptr->stock_num; i++)
2694 q_ptr = &st_ptr->stock[i];
2695 spoil_random_artifact_aux(q_ptr, j);
2699 /* Check for errors */
2700 if (ferror(fff) || my_fclose(fff))
2702 msg_print("Cannot close list file.");
2706 msg_print("Successfully created a list file.");
2713 #endif /* MACINTOSH */