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 chance 生成機会を返すバッファ参照ポインタ
233 * @param val 価値を返すバッファ参照ポインタ
237 static void kind_info(char *buf, char *dam, char *wgt, char *chance, int *lev, s32b *val, int k)
243 /* Get local object */
246 /* Prepare a fake item */
247 object_prep(q_ptr, k);
250 q_ptr->ident |= (IDENT_KNOWN);
260 (*lev) = k_info[q_ptr->k_idx].level;
263 (*val) = object_value(q_ptr);
267 if (!buf || !dam || !chance || !wgt) return;
270 /* Description (too brief) */
271 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
291 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
301 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
316 sprintf(dam, "%d", q_ptr->ac);
323 for(i = 0; i < 4; i++)
325 char chance_aux[20] = "";
326 if(k_info[q_ptr->k_idx].chance[i] > 0)
328 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""), k_info[q_ptr->k_idx].locale[i], 100/k_info[q_ptr->k_idx].chance[i]);
329 strcat(chance, chance_aux);
335 sprintf(wgt, "%3d.%d", q_ptr->weight / 10, q_ptr->weight % 10);
340 * @brief 各ベースアイテムの情報を一行毎に記述する /
341 * Create a spoiler file for items
345 static void spoil_obj_desc(cptr fname)
347 int i, k, s, t, n = 0, group_start = 0;
358 /* Build the filename */
359 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
361 /* File type is "TEXT" */
362 FILE_TYPE(FILE_TYPE_TEXT);
365 fff = my_fopen(buf, "w");
370 msg_print("Cannot create spoiler file.");
376 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
377 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
380 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
381 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
382 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
383 "-------------------------------------", "------", "---", "---", "----------------", "----");
385 /* List the groups */
386 for (i = 0; TRUE; i++)
388 /* Write out the group title */
389 if (group_item[i].name)
393 /* Hack -- bubble-sort by cost and then level */
394 for (s = 0; s < n - 1; s++)
396 for (t = 0; t < n - 1; t++)
407 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
408 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
410 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
419 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
421 /* Spoil each item */
422 for (s = 0; s < n; s++)
427 /* Describe the kind */
428 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
431 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
432 buf, dam, wgt, e, chance, (long)(v));
435 /* Start a new set */
440 if (!group_item[i].tval) break;
442 /* Start a new set */
446 /* Acquire legal item types */
447 for (k = 1; k < max_k_idx; k++)
449 object_kind *k_ptr = &k_info[k];
451 /* Skip wrong tval's */
452 if (k_ptr->tval != group_item[i].tval) continue;
454 /* Hack -- Skip instant-artifacts */
455 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
463 /* Check for errors */
464 if (ferror(fff) || my_fclose(fff))
466 msg_print("Cannot close spoiler file.");
471 msg_print("Successfully created a spoiler file.");
476 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
481 * Returns a "+" string if a number is non-negative and an empty
484 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
487 * These are used to format the artifact spoiler file. INDENT1 is used
488 * to indent all but the first line of an artifact spoiler. INDENT2 is
489 * used when a line "wraps". (Bladeturner's resistances cause this.)
495 * MAX_LINE_LEN specifies when a line should wrap.
497 #define MAX_LINE_LEN 75
500 * Given an array, determine how many elements are in the array
502 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
505 * The artifacts categorized by type
507 static grouper group_artifact[] =
511 { TV_POLEARM, "槍/斧" },
513 { TV_DIGGING, "シャベル/つるはし" },
518 { TV_SOFT_ARMOR, "鎧" },
519 { TV_HARD_ARMOR, NULL },
520 { TV_DRAG_ARMOR, NULL },
522 { TV_CLOAK, "クローク" },
531 { TV_AMULET, "アミュレット" },
534 { TV_SWORD, "Edged Weapons" },
535 { TV_POLEARM, "Polearms" },
536 { TV_HAFTED, "Hafted Weapons" },
537 { TV_DIGGING, "Shovels/Picks" },
539 { TV_ARROW, "Ammo" },
542 { TV_SOFT_ARMOR, "Body Armor" },
543 { TV_HARD_ARMOR, NULL },
544 { TV_DRAG_ARMOR, NULL },
546 { TV_CLOAK, "Cloaks" },
547 { TV_SHIELD, "Shields" },
549 { TV_HELM, "Helms/Crowns" },
551 { TV_GLOVES, "Gloves" },
552 { TV_BOOTS, "Boots" },
554 { TV_LITE, "Light Sources" },
555 { TV_AMULET, "Amulets" },
556 { TV_RING, "Rings" },
565 * Pair together a constant flag with a textual description.
567 * Used by both "init.c" and "wiz-spo.c".
569 * Note that it sometimes more efficient to actually make an array
570 * of textual names, where entry 'N' is assumed to be paired with
571 * the flag whose value is "1L << N", but that requires hard-coding.
574 typedef struct flag_desc flag_desc;
579 const char *const desc;
585 * These are used for "+3 to STR, DEX", etc. These are separate from
586 * the other pval affected traits to simplify the case where an object
587 * affects all stats. In this case, "All stats" is used instead of
588 * listing each stat individually.
591 static flag_desc stat_flags_desc[] =
611 * Besides stats, these are the other player traits
612 * which may be affected by an object's pval
615 static flag_desc pval_flags1_desc[] =
618 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
619 { TR_STEALTH, "隠密" },
621 { TR_INFRA, "赤外線視力" },
623 { TR_BLOWS, "攻撃回数" },
626 { TR_STEALTH, "Stealth" },
627 { TR_SEARCH, "Searching" },
628 { TR_INFRA, "Infravision" },
629 { TR_TUNNEL, "Tunneling" },
630 { TR_BLOWS, "Attacks" },
631 { TR_SPEED, "Speed" }
636 * Slaying preferences for weapons
639 static flag_desc slay_flags_desc[] =
642 { TR_SLAY_ANIMAL, "動物" },
643 { TR_KILL_ANIMAL, "*動物*" },
644 { TR_SLAY_EVIL, "邪悪" },
645 { TR_KILL_EVIL, "*邪悪*" },
646 { TR_SLAY_HUMAN, "人間" },
647 { TR_KILL_HUMAN, "*人間*" },
648 { TR_SLAY_UNDEAD, "アンデッド" },
649 { TR_KILL_UNDEAD, "*アンデッド*" },
650 { TR_SLAY_DEMON, "悪魔" },
651 { TR_KILL_DEMON, "*悪魔*" },
652 { TR_SLAY_ORC, "オーク" },
653 { TR_KILL_ORC, "*オーク*" },
654 { TR_SLAY_TROLL, "トロル" },
655 { TR_KILL_TROLL, "*トロル*" },
656 { TR_SLAY_GIANT, "巨人" },
657 { TR_KILL_GIANT, "*巨人*" },
658 { TR_SLAY_DRAGON, "ドラゴン" },
659 { TR_KILL_DRAGON, "*ドラゴン*" },
661 { TR_SLAY_ANIMAL, "Animal" },
662 { TR_KILL_ANIMAL, "XAnimal" },
663 { TR_SLAY_EVIL, "Evil" },
664 { TR_KILL_EVIL, "XEvil" },
665 { TR_SLAY_HUMAN, "Human" },
666 { TR_KILL_HUMAN, "XHuman" },
667 { TR_SLAY_UNDEAD, "Undead" },
668 { TR_KILL_UNDEAD, "XUndead" },
669 { TR_SLAY_DEMON, "Demon" },
670 { TR_KILL_DEMON, "XDemon" },
671 { TR_SLAY_ORC, "Orc" },
672 { TR_KILL_ORC, "XOrc" },
673 { TR_SLAY_TROLL, "Troll" },
674 { TR_KILL_TROLL, "XTroll" },
675 { TR_SLAY_GIANT, "Giant" },
676 { TR_KILL_GIANT, "Xgiant" },
677 { TR_SLAY_DRAGON, "Dragon" },
678 { TR_KILL_DRAGON, "Xdragon" }
683 * Elemental brands for weapons
685 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
686 * coding, it has been included here along with the elemental
687 * brands. It does seem to fit in with the brands and slaying
688 * more than the miscellaneous section.
690 static flag_desc brand_flags_desc[] =
693 { TR_BRAND_ACID, "溶解" },
694 { TR_BRAND_ELEC, "電撃" },
695 { TR_BRAND_FIRE, "焼棄" },
696 { TR_BRAND_COLD, "凍結" },
697 { TR_BRAND_POIS, "毒殺" },
699 { TR_FORCE_WEAPON, "理力" },
700 { TR_CHAOTIC, "混沌" },
701 { TR_VAMPIRIC, "吸血" },
703 { TR_VORPAL, "切れ味" },
705 { TR_BRAND_ACID, "Acid Brand" },
706 { TR_BRAND_ELEC, "Lightning Brand" },
707 { TR_BRAND_FIRE, "Flame Tongue" },
708 { TR_BRAND_COLD, "Frost Brand" },
709 { TR_BRAND_POIS, "Poisoned" },
711 { TR_FORCE_WEAPON, "Force" },
712 { TR_CHAOTIC, "Mark of Chaos" },
713 { TR_VAMPIRIC, "Vampiric" },
714 { TR_IMPACT, "Earthquake impact on hit" },
715 { TR_VORPAL, "Very sharp" },
723 static const flag_desc resist_flags_desc[] =
726 { TR_RES_ACID, "酸" },
727 { TR_RES_ELEC, "電撃" },
728 { TR_RES_FIRE, "火炎" },
729 { TR_RES_COLD, "冷気" },
730 { TR_RES_POIS, "毒" },
731 { TR_RES_FEAR, "恐怖"},
732 { TR_RES_LITE, "閃光" },
733 { TR_RES_DARK, "暗黒" },
734 { TR_RES_BLIND, "盲目" },
735 { TR_RES_CONF, "混乱" },
736 { TR_RES_SOUND, "轟音" },
737 { TR_RES_SHARDS, "破片" },
738 { TR_RES_NETHER, "地獄" },
739 { TR_RES_NEXUS, "因果混乱" },
740 { TR_RES_CHAOS, "カオス" },
741 { TR_RES_DISEN, "劣化" },
743 { TR_RES_ACID, "Acid" },
744 { TR_RES_ELEC, "Lightning" },
745 { TR_RES_FIRE, "Fire" },
746 { TR_RES_COLD, "Cold" },
747 { TR_RES_POIS, "Poison" },
748 { TR_RES_FEAR, "Fear"},
749 { TR_RES_LITE, "Light" },
750 { TR_RES_DARK, "Dark" },
751 { TR_RES_BLIND, "Blindness" },
752 { TR_RES_CONF, "Confusion" },
753 { TR_RES_SOUND, "Sound" },
754 { TR_RES_SHARDS, "Shards" },
755 { TR_RES_NETHER, "Nether" },
756 { TR_RES_NEXUS, "Nexus" },
757 { TR_RES_CHAOS, "Chaos" },
758 { TR_RES_DISEN, "Disenchantment" },
763 * Elemental immunities (along with poison)
766 static const flag_desc immune_flags_desc[] =
770 { TR_IM_ELEC, "電撃" },
771 { TR_IM_FIRE, "火炎" },
772 { TR_IM_COLD, "冷気" },
774 { TR_IM_ACID, "Acid" },
775 { TR_IM_ELEC, "Lightning" },
776 { TR_IM_FIRE, "Fire" },
777 { TR_IM_COLD, "Cold" },
782 * Sustain stats - these are given their "own" line in the
783 * spoiler file, mainly for simplicity
785 static const flag_desc sustain_flags_desc[] =
788 { TR_SUST_STR, "腕力" },
789 { TR_SUST_INT, "知能" },
790 { TR_SUST_WIS, "賢さ" },
791 { TR_SUST_DEX, "器用さ" },
792 { TR_SUST_CON, "耐久力" },
793 { TR_SUST_CHR, "魅力" },
795 { TR_SUST_STR, "STR" },
796 { TR_SUST_INT, "INT" },
797 { TR_SUST_WIS, "WIS" },
798 { TR_SUST_DEX, "DEX" },
799 { TR_SUST_CON, "CON" },
800 { TR_SUST_CHR, "CHR" },
805 * Miscellaneous magic given by an object's "flags2" field
808 static const flag_desc misc_flags2_desc[] =
812 { TR_REFLECT, "反射" },
813 { TR_FREE_ACT, "麻痺知らず" },
814 { TR_HOLD_EXP, "経験値維持" },
816 { TR_THROW, "Throwing" },
817 { TR_REFLECT, "Reflection" },
818 { TR_FREE_ACT, "Free Action" },
819 { TR_HOLD_EXP, "Hold Experience" },
824 * Miscellaneous magic given by an object's "flags3" field
826 * Note that cursed artifacts and objects with permanent light
827 * are handled "directly" -- see analyze_misc_magic()
830 static const flag_desc misc_flags3_desc[] =
833 { TR_SH_FIRE, "火炎オーラ" },
834 { TR_SH_ELEC, "電撃オーラ" },
835 { TR_SH_COLD, "冷気オーラ" },
836 { TR_NO_TELE, "反テレポート" },
837 { TR_NO_MAGIC, "反魔法" },
838 { TR_LEVITATION, "浮遊" },
839 { TR_SEE_INVIS, "可視透明" },
840 { TR_TELEPATHY, "テレパシー" },
841 { TR_ESP_ANIMAL, "動物感知" },
842 { TR_ESP_UNDEAD, "不死感知" },
843 { TR_ESP_DEMON, "悪魔感知" },
844 { TR_ESP_ORC, "オーク感知" },
845 { TR_ESP_TROLL, "トロル感知" },
846 { TR_ESP_GIANT, "巨人感知" },
847 { TR_ESP_DRAGON, "ドラゴン感知" },
848 { TR_ESP_HUMAN, "人間感知" },
849 { TR_ESP_EVIL, "邪悪感知" },
850 { TR_ESP_GOOD, "善良感知" },
851 { TR_ESP_NONLIVING, "無生物感知" },
852 { TR_ESP_UNIQUE, "ユニーク感知" },
853 { TR_SLOW_DIGEST, "遅消化" },
854 { TR_REGEN, "急速回復" },
855 { TR_WARNING, "警告" },
856 /* { TR_XTRA_MIGHT, "強力射撃" }, */
857 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
858 { TR_DRAIN_EXP, "経験値吸収" },
859 { TR_AGGRAVATE, "反感" },
860 { TR_BLESSED, "祝福" },
861 { TR_DEC_MANA, "消費魔力減少" },
863 { TR_SH_FIRE, "Fiery Aura" },
864 { TR_SH_ELEC, "Electric Aura" },
865 { TR_SH_COLD, "Coldly Aura" },
866 { TR_NO_TELE, "Prevent Teleportation" },
867 { TR_NO_MAGIC, "Anti-Magic" },
868 { TR_LEVITATION, "Levitation" },
869 { TR_SEE_INVIS, "See Invisible" },
870 { TR_TELEPATHY, "ESP" },
871 { TR_ESP_ANIMAL, "Sense Animal" },
872 { TR_ESP_UNDEAD, "Sense Undead" },
873 { TR_ESP_DEMON, "Sense Demon" },
874 { TR_ESP_ORC, "Sense Orc" },
875 { TR_ESP_TROLL, "Sense Troll" },
876 { TR_ESP_GIANT, "Sense Giant" },
877 { TR_ESP_DRAGON, "Sense Dragon" },
878 { TR_ESP_HUMAN, "Sense Human" },
879 { TR_ESP_EVIL, "Sense Evil" },
880 { TR_ESP_GOOD, "Sense Good" },
881 { TR_ESP_NONLIVING, "Sense Nonliving" },
882 { TR_ESP_UNIQUE, "Sense Unique" },
883 { TR_SLOW_DIGEST, "Slow Digestion" },
884 { TR_REGEN, "Regeneration" },
885 { TR_WARNING, "Warning" },
886 /* { TR_XTRA_MIGHT, "Extra Might" }, */
887 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
888 { TR_DRAIN_EXP, "Drains Experience" },
889 { TR_AGGRAVATE, "Aggravates" },
890 { TR_BLESSED, "Blessed Blade" },
891 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
897 * A special type used just for deailing with pvals
902 * This will contain a string such as "+2", "-10", etc.
907 * A list of various player traits affected by an object's pval such
908 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
909 * this list since it will probably be desirable to format its
910 * description differently.
912 * Note that room need only be reserved for the number of stats - 1
913 * since the description "All stats" is used if an object affects all
914 * all stats. Also, room must be reserved for a sentinel NULL pointer.
916 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
918 * This list includes extra attacks, for simplicity.
920 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
921 N_ELEMENTS(pval_flags1_desc) + 1];
927 * An "object analysis structure"
929 * It will be filled with descriptive strings detailing an object's
930 * various magical powers. The "ignore X" traits are not noted since
931 * all artifacts ignore "normal" destruction.
936 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
937 char description[MAX_NLEN];
939 /* Description of what is affected by an object's pval */
940 pval_info_type pval_info;
942 /* A list of an object's slaying preferences */
943 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
945 /* A list if an object's elemental brands */
946 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
948 /* A list of immunities granted by an object */
949 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
951 /* A list of resistances granted by an object */
952 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
954 /* A list of stats sustained by an object */
955 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
957 /* A list of various magical qualities an object may have */
958 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
959 + 1 /* Permanent Light */
961 + 1 /* type of curse */
962 + 1]; /* sentinel NULL */
964 /* Additional ability or resistance */
967 /* A string describing an artifact's activation */
970 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
976 * @brief ファイルポインタ先に同じ文字を複数出力する /
977 * Write out `n' of the character `c' to the spoiler file
982 static void spoiler_out_n_chars(int n, char c)
984 while (--n >= 0) fputc(c, fff);
989 * @brief ファイルポインタ先に改行を複数出力する /
990 * Write out `n' blank lines to the spoiler file
994 static void spoiler_blanklines(int n)
996 spoiler_out_n_chars(n, '\n');
1001 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1002 * Write a line to the spoiler file and then "underline" it with hypens
1003 * @param str 出力したい文字列
1006 static void spoiler_underline(cptr str)
1008 fprintf(fff, "%s\n", str);
1009 spoiler_out_n_chars(strlen(str), '-');
1016 * @brief アーティファクトの特性一覧を出力する /
1017 * Write a line to the spoiler file and then "underline" it with hypens
1018 * @param art_flags アーティファクトのフラグ群
1019 * @param flag_ptr フラグ記述情報の参照ポインタ
1020 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1021 * @param n_elmnts フラグの要素数
1022 * @return desc_ptrと同じアドレス
1025 * This function does most of the actual "analysis". Given a set of bit flags
1026 * (which will be from one of the flags fields from the object in question),
1027 * a "flag description structure", a "description list", and the number of
1028 * elements in the "flag description structure", this function sets the
1029 * "description list" members to the appropriate descriptions contained in
1030 * the "flag description structure".
1031 * The possibly updated description pointer is returned.
1034 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1035 const flag_desc *flag_ptr,
1036 cptr *desc_ptr, const int n_elmnts)
1040 for (i = 0; i < n_elmnts; ++i)
1042 if (have_flag(art_flags, flag_ptr[i].flag))
1044 *desc_ptr++ = flag_ptr[i].desc;
1053 * @brief アイテムの特定記述内容を返す /
1054 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1055 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1056 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1059 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1061 /* Get a "useful" description of the object */
1062 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1067 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1068 * List "player traits" altered by an artifact's pval. These include stats,
1069 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1070 * @param o_ptr オブジェクト構造体の参照ポインタ
1071 * @param p_ptr pval修正構造体の参照ポインタ
1074 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1076 u32b flgs[TR_FLAG_SIZE];
1080 /* If pval == 0, there is nothing to do. */
1083 /* An "empty" pval description indicates that pval == 0 */
1084 pi_ptr->pval_desc[0] = '\0';
1088 /* Extract the flags */
1089 object_flags(o_ptr, flgs);
1091 affects_list = pi_ptr->pval_affects;
1093 /* Create the "+N" string */
1094 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1096 /* First, check to see if the pval affects all stats */
1097 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1098 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1099 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1101 *affects_list++ = _("全能力", "All stats");
1104 /* Are any stats affected? */
1105 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1106 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1107 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1109 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1111 N_ELEMENTS(stat_flags_desc));
1114 /* And now the "rest" */
1115 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1117 N_ELEMENTS(pval_flags1_desc));
1119 /* Terminate the description list */
1120 *affects_list = NULL;
1124 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1125 * Note the slaying specialties of a weapon
1126 * @param o_ptr オブジェクト構造体の参照ポインタ
1127 * @param slay_list 種族スレイ構造体の参照ポインタ
1130 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1132 u32b flgs[TR_FLAG_SIZE];
1134 object_flags(o_ptr, flgs);
1136 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1137 N_ELEMENTS(slay_flags_desc));
1139 /* Terminate the description list */
1145 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1146 * Note an object's elemental brands
1147 * @param o_ptr オブジェクト構造体の参照ポインタ
1148 * @param brand_list 属性ブランド構造体の参照ポインタ
1151 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1153 u32b flgs[TR_FLAG_SIZE];
1155 object_flags(o_ptr, flgs);
1157 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1158 N_ELEMENTS(brand_flags_desc));
1160 /* Terminate the description list */
1166 * @brief アーティファクトの通常耐性を構造体に収める /
1167 * Note an object's elemental brands
1168 * @param o_ptr オブジェクト構造体の参照ポインタ
1169 * @param resist_list 通常耐性構造体の参照ポインタ
1172 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1174 u32b flgs[TR_FLAG_SIZE];
1176 object_flags(o_ptr, flgs);
1178 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1179 resist_list, N_ELEMENTS(resist_flags_desc));
1181 /* Terminate the description list */
1182 *resist_list = NULL;
1187 * @brief アーティファクトの免疫特性を構造体に収める /
1188 * Note the immunities granted by an object
1189 * @param o_ptr オブジェクト構造体の参照ポインタ
1190 * @param immune_list 免疫構造体の参照ポインタ
1193 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1195 u32b flgs[TR_FLAG_SIZE];
1197 object_flags(o_ptr, flgs);
1199 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1200 immune_list, N_ELEMENTS(immune_flags_desc));
1202 /* Terminate the description list */
1203 *immune_list = NULL;
1208 * @brief アーティファクトの維持特性を構造体に収める /
1209 * Note which stats an object sustains
1210 * @param o_ptr オブジェクト構造体の参照ポインタ
1211 * @param sustain_list 維持特性構造体の参照ポインタ
1214 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1216 u32b flgs[TR_FLAG_SIZE];
1218 object_flags(o_ptr, flgs);
1220 /* Simplify things if an item sustains all stats */
1221 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1222 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1223 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1225 *sustain_list++ = _("全能力", "All stats");
1228 /* Should we bother? */
1229 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1230 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1231 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1233 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1235 N_ELEMENTS(sustain_flags_desc));
1238 /* Terminate the description list */
1239 *sustain_list = NULL;
1244 * @brief アーティファクトのその他の特性を構造体に収める /
1245 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1246 * free action, permanent light, etc.
1247 * @param o_ptr オブジェクト構造体の参照ポインタ
1248 * @param misc_list その他の特性構造体の参照ポインタ
1251 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1253 u32b flgs[TR_FLAG_SIZE];
1257 object_flags(o_ptr, flgs);
1259 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1260 N_ELEMENTS(misc_flags2_desc));
1262 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1263 N_ELEMENTS(misc_flags3_desc));
1266 * Glowing artifacts -- small radius light.
1269 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1270 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1271 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1272 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1273 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1274 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1276 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1278 if (have_flag(flgs, TR_LITE_FUEL))
1280 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), rad);
1284 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), rad);
1285 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), -rad);
1288 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1291 * Handle cursed objects here to avoid redundancies such as noting
1292 * that a permanently cursed object is heavily cursed as well as
1293 * being "lightly cursed".
1296 /* if (object_is_cursed(o_ptr)) */
1298 if (have_flag(flgs, TR_TY_CURSE))
1300 *misc_list++ = _("太古の怨念", "Ancient Curse");
1302 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1304 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1306 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1308 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1311 else if (o_ptr->curse_flags & TRC_CURSED)
1313 *misc_list++ = _("呪い", "Cursed");
1315 if (have_flag(flgs, TR_ADD_L_CURSE))
1317 *misc_list++ = _("呪いを増やす", "Cursing");
1319 if (have_flag(flgs, TR_ADD_H_CURSE))
1321 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1325 /* Terminate the description list */
1331 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1332 * Note additional ability and/or resistance of fixed artifacts
1333 * @param o_ptr オブジェクト構造体の参照ポインタ
1334 * @param addition 追加ランダム耐性構造体の参照ポインタ
1337 static void analyze_addition(object_type *o_ptr, char *addition)
1339 artifact_type *a_ptr = &a_info[o_ptr->name1];
1342 strcpy(addition, "");
1345 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1346 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1348 strcat(addition, "能力");
1349 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1351 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1353 strcat(addition, "耐性");
1354 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1356 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1358 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1359 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1361 strcat(addition, "Ability");
1362 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1364 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1366 strcat(addition, "Resistance");
1367 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1369 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1375 * @brief アーティファクトの基本情報を文字列に収める /
1376 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1377 * and its value in gold pieces
1378 * @param o_ptr オブジェクト構造体の参照ポインタ
1379 * @param misc_desc 基本情報を収める文字列参照ポインタ
1382 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1384 artifact_type *a_ptr = &a_info[o_ptr->name1];
1387 sprintf(misc_desc, "レベル %u, 希少度 %u, %d.%d kg, $%ld",
1388 a_ptr->level, a_ptr->rarity,
1389 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1391 sprintf(misc_desc, "Level %u, Rarity %u, %d.%d lbs, %ld Gold",
1392 a_ptr->level, a_ptr->rarity,
1393 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1399 * @brief アーティファクトの情報全体を構造体に収める /
1400 * Fill in an object description structure for a given object
1401 * and its value in gold pieces
1402 * @param o_ptr オブジェクト構造体の参照ポインタ
1403 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1406 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1408 analyze_general(o_ptr, desc_ptr->description);
1409 analyze_pval(o_ptr, &desc_ptr->pval_info);
1410 analyze_brand(o_ptr, desc_ptr->brands);
1411 analyze_slay(o_ptr, desc_ptr->slays);
1412 analyze_immune(o_ptr, desc_ptr->immunities);
1413 analyze_resist(o_ptr, desc_ptr->resistances);
1414 analyze_sustains(o_ptr, desc_ptr->sustains);
1415 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1416 analyze_addition(o_ptr, desc_ptr->addition);
1417 analyze_misc(o_ptr, desc_ptr->misc_desc);
1418 desc_ptr->activation = item_activation(o_ptr);
1423 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1426 static void print_header(void)
1430 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1431 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1432 spoiler_underline(buf);
1436 * This is somewhat ugly.
1438 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1439 * and a separator character (',', e.g.), write the list to the spoiler file
1440 * in a "nice" format, such as:
1442 * Resist Fire, Cold, Acid
1444 * That was a simple example, but when the list is long, a line wrap
1445 * should occur, and this should induce a new level of indention if
1446 * a list is being spread across lines. So for example, Bladeturner's
1447 * list of resistances should look something like this
1449 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1450 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1452 * However, the code distinguishes between a single list of many items vs.
1453 * many lists. (The separator is used to make this determination.) A single
1454 * list of many items will not cause line wrapping (since there is no
1455 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1456 * might look like this:
1458 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1461 * So comparing the two, "Regeneration" has no trailing separator and
1462 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1463 * but that's not relevant to line wrapping and indention.)
1466 /* ITEM_SEP separates items within a list */
1467 #define ITEM_SEP ','
1470 /* LIST_SEP separates lists */
1472 #define LIST_SEP ','
1474 #define LIST_SEP ';'
1478 * @brief フラグ名称を出力する汎用関数
1479 * @param header ヘッダに出力するフラグ群の名前
1480 * @param list フラグ名リスト
1481 * @param separator フラグ表示の区切り記号
1484 static void spoiler_outlist(cptr header, cptr *list, char separator)
1486 int line_len, buf_len;
1487 char line[MAX_LINE_LEN+1], buf[80];
1489 /* Ignore an empty list */
1490 if (*list == NULL) return;
1492 /* This function always indents */
1493 strcpy(line, INDENT1);
1495 /* Create header (if one was given) */
1496 if (header && (header[0]))
1498 strcat(line, header);
1502 line_len = strlen(line);
1504 /* Now begin the tedious task */
1507 /* Copy the current item to a buffer */
1510 /* Note the buffer's length */
1511 buf_len = strlen(buf);
1514 * If there is an item following this one, pad with separator and
1515 * a space and adjust the buffer length
1520 sprintf(buf + buf_len, "%c ", separator);
1525 * If the buffer will fit on the current line, just append the
1526 * buffer to the line and adjust the line length accordingly.
1529 if (line_len + buf_len <= MAX_LINE_LEN)
1532 line_len += buf_len;
1535 /* Apply line wrapping and indention semantics described above */
1539 * Don't print a trailing list separator but do print a trailing
1542 if (line_len > 1 && line[line_len - 1] == ' '
1543 && line[line_len - 2] == LIST_SEP)
1545 /* Ignore space and separator */
1546 line[line_len - 2] = '\0';
1548 /* Write to spoiler file */
1549 fprintf(fff, "%s\n", line);
1551 /* Begin new line at primary indention level */
1552 sprintf(line, "%s%s", INDENT1, buf);
1557 /* Write to spoiler file */
1558 fprintf(fff, "%s\n", line);
1560 /* Begin new line at secondary indention level */
1561 sprintf(line, "%s%s", INDENT2, buf);
1564 line_len = strlen(line);
1567 /* Advance, with break */
1568 if (!*++list) break;
1571 /* Write what's left to the spoiler file */
1572 fprintf(fff, "%s\n", line);
1576 * @brief アーティファクト一件をスポイラー出力する /
1577 * Create a spoiler file entry for an artifact
1578 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1581 static void spoiler_print_art(obj_desc_list *art_ptr)
1583 pval_info_type *pval_ptr = &art_ptr->pval_info;
1587 /* Don't indent the first line */
1588 fprintf(fff, "%s\n", art_ptr->description);
1590 /* An "empty" pval description indicates that the pval affects nothing */
1591 if (pval_ptr->pval_desc[0])
1593 /* Mention the effects of pval */
1594 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1595 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1598 /* Now deal with the description lists */
1601 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1602 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1603 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1604 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1605 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1607 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1608 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1609 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1610 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1611 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1613 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1615 if (art_ptr->addition[0])
1617 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1620 /* Write out the possible activation at the primary indention level */
1621 if (art_ptr->activation)
1623 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1626 /* End with the miscellaneous facts */
1627 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1632 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1633 * Hack -- Create a "forged" artifact
1634 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1635 * @param name1 生成するアーティファクトID
1636 * @return 生成が成功した場合TRUEを返す
1638 static bool make_fake_artifact(object_type *o_ptr, int name1)
1642 artifact_type *a_ptr = &a_info[name1];
1645 /* Ignore "empty" artifacts */
1646 if (!a_ptr->name) return FALSE;
1648 /* Acquire the "kind" index */
1649 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1652 if (!i) return (FALSE);
1654 /* Create the artifact */
1655 object_prep(o_ptr, i);
1658 o_ptr->name1 = (byte_hack)name1;
1660 /* Extract the fields */
1661 o_ptr->pval = a_ptr->pval;
1662 o_ptr->ac = a_ptr->ac;
1663 o_ptr->dd = a_ptr->dd;
1664 o_ptr->ds = a_ptr->ds;
1665 o_ptr->to_a = a_ptr->to_a;
1666 o_ptr->to_h = a_ptr->to_h;
1667 o_ptr->to_d = a_ptr->to_d;
1668 o_ptr->weight = a_ptr->weight;
1676 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1677 * Create a spoiler file for artifacts
1678 * @param fname 生成ファイル名
1681 static void spoil_artifact(cptr fname)
1688 obj_desc_list artifact;
1693 /* Build the filename */
1694 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1696 /* File type is "TEXT" */
1697 FILE_TYPE(FILE_TYPE_TEXT);
1700 fff = my_fopen(buf, "w");
1705 msg_print("Cannot create spoiler file.");
1709 /* Dump the header */
1712 /* List the artifacts by tval */
1713 for (i = 0; group_artifact[i].tval; i++)
1715 /* Write out the group title */
1716 if (group_artifact[i].name)
1718 spoiler_blanklines(2);
1719 spoiler_underline(group_artifact[i].name);
1720 spoiler_blanklines(1);
1723 /* Now search through all of the artifacts */
1724 for (j = 1; j < max_a_idx; ++j)
1726 artifact_type *a_ptr = &a_info[j];
1728 /* We only want objects in the current group */
1729 if (a_ptr->tval != group_artifact[i].tval) continue;
1731 /* Get local object */
1734 /* Wipe the object */
1737 /* Attempt to "forge" the artifact */
1738 if (!make_fake_artifact(q_ptr, j)) continue;
1740 /* Analyze the artifact */
1741 object_analyze(q_ptr, &artifact);
1743 /* Write out the artifact description to the spoiler file */
1744 spoiler_print_art(&artifact);
1748 /* Check for errors */
1749 if (ferror(fff) || my_fclose(fff))
1751 msg_print("Cannot close spoiler file.");
1756 msg_print("Successfully created a spoiler file.");
1761 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1762 * Create a spoiler file for monsters -BEN-
1763 * @param fname 生成ファイル名
1766 static void spoil_mon_desc(cptr fname)
1783 /* Build the filename */
1784 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1786 /* File type is "TEXT" */
1787 FILE_TYPE(FILE_TYPE_TEXT);
1790 fff = my_fopen(buf, "w");
1795 msg_print("Cannot create spoiler file.");
1799 /* Allocate the "who" array */
1800 C_MAKE(who, max_r_idx, s16b);
1802 /* Dump the header */
1803 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1804 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1805 fprintf(fff, "------------------------------------------\n\n");
1807 /* Dump the header */
1808 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1809 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1810 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1811 "--------", "---", "---", "---", "--", "--", "-----------");
1814 /* Scan the monsters */
1815 for (i = 1; i < max_r_idx; i++)
1817 monster_race *r_ptr = &r_info[i];
1819 /* Use that monster */
1820 if (r_ptr->name) who[n++] = (s16b)i;
1823 /* Select the sort method */
1824 ang_sort_comp = ang_sort_comp_hook;
1825 ang_sort_swap = ang_sort_swap_hook;
1827 /* Sort the array by dungeon depth of monsters */
1828 ang_sort(who, &why, n);
1831 for (i = 0; i < n; i++)
1833 monster_race *r_ptr = &r_info[who[i]];
1835 cptr name = (r_name + r_ptr->name);
1836 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1838 /* Get the "name" */
1840 else if (r_ptr->flags1 & (RF1_QUESTOR))
1842 sprintf(nam, "[Q] %s", name);
1845 else if (r_ptr->flags1 & (RF1_UNIQUE))
1847 sprintf(nam, "[U] %s", name);
1851 sprintf(nam, _(" %s", "The %s"), name);
1856 sprintf(lev, "%d", r_ptr->level);
1859 sprintf(rar, "%d", r_ptr->rarity);
1862 if (r_ptr->speed >= 110)
1864 sprintf(spd, "+%d", (r_ptr->speed - 110));
1868 sprintf(spd, "-%d", (110 - r_ptr->speed));
1872 sprintf(ac, "%d", r_ptr->ac);
1875 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1877 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1881 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1886 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1888 /* Hack -- use visual instead */
1889 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1892 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1893 nam, lev, rar, spd, hp, ac, exp);
1900 /* Free the "who" array */
1901 C_KILL(who, max_r_idx, s16b);
1903 /* Check for errors */
1904 if (ferror(fff) || my_fclose(fff))
1906 msg_print("Cannot close spoiler file.");
1911 msg_print("Successfully created a spoiler file.");
1918 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1920 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1926 * @brief 文字列をファイルポインタに出力する /
1927 * Buffer text to the given file. (-SHAWN-)
1928 * This is basically c_roff() from mon-desc.c with a few changes.
1929 * @param str 文字列参照ポインタ
1932 static void spoil_out(cptr str)
1937 static char roff_buf[256];
1940 static char roff_waiting_buf[256];
1943 bool iskanji_flag = FALSE;
1945 /* Current pointer into line roff_buf */
1946 static char *roff_p = roff_buf;
1948 /* Last space saved into roff_buf */
1949 static char *roff_s = NULL;
1951 /* Mega-Hack -- Delayed output */
1952 static bool waiting_output = FALSE;
1954 /* Special handling for "new sequence" */
1959 fputs(roff_waiting_buf, fff);
1960 waiting_output = FALSE;
1963 if (roff_p != roff_buf) roff_p--;
1964 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1966 if (roff_p == roff_buf) fprintf(fff, "\n");
1969 *(roff_p + 1) = '\0';
1970 fprintf(fff, "%s\n\n", roff_buf);
1979 /* Scan the given string, character at a time */
1984 bool k_flag = iskanji((unsigned char)(*str));
1987 bool wrap = (ch == '\n');
1990 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1991 iskanji_flag = k_flag && !iskanji_flag;
1993 if (!isprint(ch)) ch = ' ';
1998 fputs(roff_waiting_buf, fff);
1999 if (!wrap) fputc('\n', fff);
2000 waiting_output = FALSE;
2006 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
2007 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2009 if (roff_p >= roff_buf + 75) wrap = TRUE;
2010 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2017 bool iskanji_flag_local = FALSE;
2018 cptr tail = str + (k_flag ? 2 : 1);
2020 cptr tail = str + 1;
2023 for (; *tail; tail++)
2025 if (*tail == ' ') continue;
2028 k_flag_local = iskanji((unsigned char)(*tail));
2029 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
2030 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2032 if (isprint(*tail)) break;
2036 if (!*tail) waiting_output = TRUE;
2040 /* Handle line-wrap */
2048 if (roff_s && (ch != ' '))
2056 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2057 else strcpy(roff_waiting_buf, roff_buf);
2061 if (cbak != ' ') *roff_p++ = cbak;
2063 while (*r) *roff_p++ = *r++;
2067 if ((roff_p > roff_buf) || (ch != ' '))
2072 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2077 strncmp(str, "。", 2) != 0 &&
2078 strncmp(str, "、", 2) != 0 &&
2079 strncmp(str, "ィ", 2) != 0 &&
2080 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2083 if (ch == ' ') roff_s = roff_p;
2094 * @brief 関数ポインタ用の出力関数 /
2095 * Hook function used in spoil_mon_info()
2097 * @param str 文字列参照ポインタ
2100 static void roff_func(byte attr, cptr str)
2110 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2111 * Create a spoiler file for monsters (-SHAWN-)
2112 * @param fname ファイル名
2115 static void spoil_mon_info(cptr fname)
2124 /* Build the filename */
2125 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2127 /* File type is "TEXT" */
2128 FILE_TYPE(FILE_TYPE_TEXT);
2131 fff = my_fopen(buf, "w");
2136 msg_print("Cannot create spoiler file.");
2141 /* Dump the header */
2142 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2143 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2146 spoil_out("------------------------------------------\n\n");
2148 /* Allocate the "who" array */
2149 C_MAKE(who, max_r_idx, s16b);
2151 /* Scan the monsters */
2152 for (i = 1; i < max_r_idx; i++)
2154 monster_race *r_ptr = &r_info[i];
2156 /* Use that monster */
2157 if (r_ptr->name) who[n++] = (s16b)i;
2160 /* Select the sort method */
2161 ang_sort_comp = ang_sort_comp_hook;
2162 ang_sort_swap = ang_sort_swap_hook;
2164 /* Sort the array by dungeon depth of monsters */
2165 ang_sort(who, &why, n);
2169 * List all monsters in order
2171 for (l = 0; l < n; l++)
2173 monster_race *r_ptr = &r_info[who[l]];
2175 /* Extract the flags */
2176 flags1 = r_ptr->flags1;
2180 if (flags1 & (RF1_QUESTOR))
2186 if (flags1 & (RF1_UNIQUE))
2198 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2203 spoil_out(attr_to_text(r_ptr));
2206 sprintf(buf, " '%c')\n", r_ptr->d_char);
2211 sprintf(buf, "=== ");
2215 sprintf(buf, "Num:%d ", who[l]);
2219 sprintf(buf, "Lev:%d ", r_ptr->level);
2223 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2227 if (r_ptr->speed >= 110)
2229 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2233 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2238 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2240 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2244 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2249 sprintf(buf, "Ac:%d ", r_ptr->ac);
2253 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2256 /* Reuse the code of monster recall. */
2257 output_monster_spoiler(who[l], roff_func);
2262 /* Free the "who" array */
2263 C_KILL(who, max_r_idx, s16b);
2265 /* Check for errors */
2266 if (ferror(fff) || my_fclose(fff))
2268 msg_print("Cannot close spoiler file.");
2272 msg_print("Successfully created a spoiler file.");
2277 #define MAX_EVOL_DEPTH 64
2281 * @brief int配列でstrncmp()と似た比較処理を行う /
2282 * Compare two int-type array like strncmp() and return TRUE if equals
2283 * @param a 比較するint配列1
2284 * @param b 比較するint配列2
2286 * @return 両者の値が等しければTRUEを返す
2288 static bool int_n_cmp(int *a, int *b, int length)
2290 /* Null-string comparation is always TRUE */
2291 if (!length) return TRUE;
2295 if (*a != *(b++)) return FALSE;
2296 if (!(*(a++))) break;
2305 * @brief ある木が指定された木の部分木かどうかを返す /
2306 * Returns TRUE if an evolution tree is "partial tree"
2307 * @param tree 元となる木構造リスト
2308 * @param partial_tree 部分木かどうか判定したい木構造リスト
2309 * @return 部分木ならばTRUEを返す
2311 static bool is_partial_tree(int *tree, int *partial_tree)
2313 int pt_head = *(partial_tree++);
2316 while (partial_tree[pt_len]) pt_len++;
2320 if (*(tree++) == pt_head)
2322 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2331 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2332 * Sorting hook -- Comp function
2335 * @param a 比較したいモンスター種族ID1
2336 * @param b 比較したいモンスター種族ID2
2337 * @return 2が大きければTRUEを返す
2339 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2341 int **evol_tree = (int **)u;
2343 int w1 = evol_tree[a][0];
2344 int w2 = evol_tree[b][0];
2345 monster_race *r1_ptr = &r_info[w1];
2346 monster_race *r2_ptr = &r_info[w2];
2351 /* Used tree first */
2352 if (w1 && !w2) return TRUE;
2353 if (!w1 && w2) return FALSE;
2355 /* Sort by monster level */
2356 if (r1_ptr->level < r2_ptr->level) return TRUE;
2357 if (r1_ptr->level > r2_ptr->level) return FALSE;
2359 /* Sort by monster experience */
2360 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2361 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2363 /* Compare indexes */
2368 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2369 * Sorting hook -- Swap function
2372 * @param a スワップしたい木構造1
2373 * @param b スワップしたい木構造2
2374 * @return 2が大きければTRUEを返す
2376 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2378 int **evol_tree = (int **)u;
2385 holder = evol_tree[a];
2386 evol_tree[a] = evol_tree[b];
2387 evol_tree[b] = holder;
2391 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2392 * Print monsters' evolution information to file
2393 * @param fname 出力ファイル名
2396 static void spoil_mon_evol(cptr fname)
2399 monster_race *r_ptr;
2400 int **evol_tree, i, j, n, r_idx;
2401 int *evol_tree_zero; /* For C_KILL() */
2403 /* Build the filename */
2404 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2406 /* File type is "TEXT" */
2407 FILE_TYPE(FILE_TYPE_TEXT);
2410 fff = my_fopen(buf, "w");
2415 msg_print("Cannot create spoiler file.");
2419 /* Dump the header */
2420 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2421 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2424 spoil_out("------------------------------------------\n\n");
2426 /* Allocate the "evol_tree" array (2-dimension) */
2427 C_MAKE(evol_tree, max_r_idx, int *);
2428 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2429 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2430 evol_tree_zero = *evol_tree;
2432 /* Step 1: Build the evolution tree */
2433 for (i = 1; i < max_r_idx; i++)
2438 if (!r_ptr->next_exp) continue;
2440 /* Trace evolution */
2442 evol_tree[i][n++] = i;
2445 evol_tree[i][n++] = r_ptr->next_r_idx;
2446 r_ptr = &r_info[r_ptr->next_r_idx];
2448 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2451 /* Step 2: Scan the evolution trees and remove "partial tree" */
2452 for (i = 1; i < max_r_idx; i++)
2454 /* Not evolution tree */
2455 if (!evol_tree[i][0]) continue;
2457 for (j = 1; j < max_r_idx; j++)
2460 if (i == j) continue;
2462 /* Not evolution tree */
2463 if (!evol_tree[j][0]) continue;
2465 /* Is evolution tree[i] is part of [j]? */
2466 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2468 /* Remove this evolution tree */
2469 evol_tree[i][0] = 0;
2475 /* Step 3: Sort the evolution trees */
2477 /* Select the sort method */
2478 ang_sort_comp = ang_sort_comp_evol_tree;
2479 ang_sort_swap = ang_sort_swap_evol_tree;
2481 /* Sort the array */
2482 ang_sort(evol_tree, NULL, max_r_idx);
2484 /* Step 4: Print the evolution trees */
2485 for (i = 0; i < max_r_idx; i++)
2487 r_idx = evol_tree[i][0];
2489 /* No evolution or removed evolution tree */
2490 if (!r_idx) continue;
2492 /* Trace the evolution tree */
2493 r_ptr = &r_info[r_idx];
2495 fprintf(fff, "[%d]: %s (レベル%d, '%c')\n", r_idx,
2496 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2498 fprintf(fff, "[%d]: %s (Level %d, '%c')\n", r_idx,
2499 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2501 for (n = 1; r_ptr->next_exp; n++)
2503 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2504 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2505 r_ptr = &r_info[r_ptr->next_r_idx];
2507 fprintf(fff, "%s (レベル%d, '%c')\n",
2508 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2510 fprintf(fff, "%s (Level %d, '%c')\n",
2511 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2515 /* End of evolution tree */
2519 /* Free the "evol_tree" array (2-dimension) */
2520 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2521 C_KILL(evol_tree, max_r_idx, int *);
2523 /* Check for errors */
2524 if (ferror(fff) || my_fclose(fff))
2526 msg_print("Cannot close spoiler file.");
2531 msg_print("Successfully created a spoiler file.");
2539 extern void do_cmd_spoilers(void);
2542 * @brief スポイラー出力を行うコマンドのメインルーチン /
2543 * Create Spoiler files -BEN-
2546 void do_cmd_spoilers(void)
2548 /* Save the screen */
2558 prt("Create a spoiler file.", 2, 0);
2560 /* Prompt for a file */
2561 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2562 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2563 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2564 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2565 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2568 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2575 /* Restore the screen */
2581 spoil_obj_desc("obj-desc.txt");
2586 spoil_artifact("artifact.txt");
2591 spoil_mon_desc("mon-desc.txt");
2596 spoil_mon_info("mon-info.txt");
2601 spoil_mon_evol("mon-evol.txt");
2610 /* Flush messages */
2616 * @brief ランダムアーティファクト1件を解析する /
2617 * Fill in an object description structure for a given object
2618 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2619 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2622 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2624 analyze_general(o_ptr, desc_ptr->description);
2625 analyze_pval(o_ptr, &desc_ptr->pval_info);
2626 analyze_brand(o_ptr, desc_ptr->brands);
2627 analyze_slay(o_ptr, desc_ptr->slays);
2628 analyze_immune(o_ptr, desc_ptr->immunities);
2629 analyze_resist(o_ptr, desc_ptr->resistances);
2630 analyze_sustains(o_ptr, desc_ptr->sustains);
2631 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2632 desc_ptr->activation = item_activation(o_ptr);
2634 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2635 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2637 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2638 o_ptr->weight / 10, o_ptr->weight % 10);
2643 * @brief ランダムアーティファクト1件をスポイラー出力する /
2644 * Create a spoiler file entry for an artifact
2645 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2646 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2647 * Fill in an object description structure for a given object
2650 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2652 pval_info_type *pval_ptr = &art_ptr->pval_info;
2656 /* Don't indent the first line */
2657 fprintf(fff, "%s\n", art_ptr->description);
2660 if (!(o_ptr->ident & (IDENT_MENTAL)))
2662 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2665 /* An "empty" pval description indicates that the pval affects nothing */
2666 if (pval_ptr->pval_desc[0])
2668 /* Mention the effects of pval */
2669 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2670 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2673 /* Now deal with the description lists */
2676 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2677 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2678 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2679 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2680 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2682 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2683 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2684 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2685 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2686 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2688 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2690 /* Write out the possible activation at the primary indention level */
2691 if (art_ptr->activation)
2693 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2696 /* End with the miscellaneous facts */
2697 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2702 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2703 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2704 * @param i 出力したい記録ランダムアーティファクトID
2707 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2709 obj_desc_list artifact;
2711 if (!object_is_known(o_ptr) || !o_ptr->art_name
2712 || o_ptr->tval != group_artifact[i].tval)
2715 /* Analyze the artifact */
2716 random_artifact_analyze(o_ptr, &artifact);
2718 /* Write out the artifact description to the spoiler file */
2719 spoiler_print_randart(o_ptr, &artifact);
2723 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2724 * Create a list file for random artifacts
2725 * @param fname 出力ファイル名
2728 void spoil_random_artifact(cptr fname)
2738 /* Build the filename */
2739 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2741 /* File type is "TEXT" */
2742 FILE_TYPE(FILE_TYPE_TEXT);
2745 fff = my_fopen(buf, "w");
2750 msg_print("Cannot create list file.");
2754 /* Dump the header */
2755 sprintf(buf, "Random artifacts list.\r");
2756 spoiler_underline(buf);
2758 /* List the artifacts by tval */
2759 for (j = 0; group_artifact[j].tval; j++)
2761 /* random artifacts wielding */
2762 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2764 q_ptr = &inventory[i];
2765 spoil_random_artifact_aux(q_ptr, j);
2768 /* random artifacts in inventory */
2769 for (i = 0; i < INVEN_PACK; i++)
2771 q_ptr = &inventory[i];
2772 spoil_random_artifact_aux(q_ptr, j);
2775 /* random artifacts in home */
2776 st_ptr = &town[1].store[STORE_HOME];
2777 for (i = 0; i < st_ptr->stock_num; i++)
2779 q_ptr = &st_ptr->stock[i];
2780 spoil_random_artifact_aux(q_ptr, j);
2783 /* random artifacts in museum */
2784 st_ptr = &town[1].store[STORE_MUSEUM];
2785 for (i = 0; i < st_ptr->stock_num; i++)
2787 q_ptr = &st_ptr->stock[i];
2788 spoil_random_artifact_aux(q_ptr, j);
2792 /* Check for errors */
2793 if (ferror(fff) || my_fclose(fff))
2795 msg_print("Cannot close list file.");
2800 msg_print("Successfully created a list file.");
2807 #endif /* MACINTOSH */