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, DEPTH *lev, PRICE *val, OBJECT_IDX k)
243 /* Get local object */
246 /* Prepare a fake item */
247 object_prep(q_ptr, k);
250 q_ptr->ident |= (IDENT_KNOWN);
260 (*lev) = k_info[q_ptr->k_idx].level;
263 (*val) = object_value(q_ptr);
267 if (!buf || !dam || !chance || !wgt) return;
270 /* Description (too brief) */
271 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
291 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
301 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
316 sprintf(dam, "%d", q_ptr->ac);
323 for(i = 0; i < 4; i++)
325 char chance_aux[20] = "";
326 if(k_info[q_ptr->k_idx].chance[i] > 0)
328 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""),
329 (int)k_info[q_ptr->k_idx].locale[i], 100/k_info[q_ptr->k_idx].chance[i]);
330 strcat(chance, chance_aux);
336 sprintf(wgt, "%3d.%d", (int)(q_ptr->weight / 10), (int)(q_ptr->weight % 10));
341 * @brief 各ベースアイテムの情報を一行毎に記述する /
342 * Create a spoiler file for items
346 static void spoil_obj_desc(cptr fname)
348 int i, k, s, t, n = 0, group_start = 0;
359 /* Build the filename */
360 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
362 /* File type is "TEXT" */
363 FILE_TYPE(FILE_TYPE_TEXT);
366 fff = my_fopen(buf, "w");
371 msg_print("Cannot create spoiler file.");
377 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
378 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
381 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
382 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
383 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
384 "-------------------------------------", "------", "---", "---", "----------------", "----");
386 /* List the groups */
387 for (i = 0; TRUE; i++)
389 /* Write out the group title */
390 if (group_item[i].name)
394 /* Hack -- bubble-sort by cost and then level */
395 for (s = 0; s < n - 1; s++)
397 for (t = 0; t < n - 1; t++)
408 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
409 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
411 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
420 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
422 /* Spoil each item */
423 for (s = 0; s < n; s++)
428 /* Describe the kind */
429 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
432 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
433 buf, dam, wgt, (int)e, chance, (long)(v));
436 /* Start a new set */
441 if (!group_item[i].tval) break;
443 /* Start a new set */
447 /* Acquire legal item types */
448 for (k = 1; k < max_k_idx; k++)
450 object_kind *k_ptr = &k_info[k];
452 /* Skip wrong tval's */
453 if (k_ptr->tval != group_item[i].tval) continue;
455 /* Hack -- Skip instant-artifacts */
456 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
464 /* Check for errors */
465 if (ferror(fff) || my_fclose(fff))
467 msg_print("Cannot close spoiler file.");
472 msg_print("Successfully created a spoiler file.");
477 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
482 * Returns a "+" string if a number is non-negative and an empty
485 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
488 * These are used to format the artifact spoiler file. INDENT1 is used
489 * to indent all but the first line of an artifact spoiler. INDENT2 is
490 * used when a line "wraps". (Bladeturner's resistances cause this.)
496 * MAX_LINE_LEN specifies when a line should wrap.
498 #define MAX_LINE_LEN 75
501 * Given an array, determine how many elements are in the array
503 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
506 * The artifacts categorized by type
508 static grouper group_artifact[] =
512 { TV_POLEARM, "槍/斧" },
514 { TV_DIGGING, "シャベル/つるはし" },
519 { TV_SOFT_ARMOR, "鎧" },
520 { TV_HARD_ARMOR, NULL },
521 { TV_DRAG_ARMOR, NULL },
523 { TV_CLOAK, "クローク" },
532 { TV_AMULET, "アミュレット" },
535 { TV_SWORD, "Edged Weapons" },
536 { TV_POLEARM, "Polearms" },
537 { TV_HAFTED, "Hafted Weapons" },
538 { TV_DIGGING, "Shovels/Picks" },
540 { TV_ARROW, "Ammo" },
543 { TV_SOFT_ARMOR, "Body Armor" },
544 { TV_HARD_ARMOR, NULL },
545 { TV_DRAG_ARMOR, NULL },
547 { TV_CLOAK, "Cloaks" },
548 { TV_SHIELD, "Shields" },
550 { TV_HELM, "Helms/Crowns" },
552 { TV_GLOVES, "Gloves" },
553 { TV_BOOTS, "Boots" },
555 { TV_LITE, "Light Sources" },
556 { TV_AMULET, "Amulets" },
557 { TV_RING, "Rings" },
566 * Pair together a constant flag with a textual description.
568 * Used by both "init.c" and "wiz-spo.c".
570 * Note that it sometimes more efficient to actually make an array
571 * of textual names, where entry 'N' is assumed to be paired with
572 * the flag whose value is "1L << N", but that requires hard-coding.
575 typedef struct flag_desc flag_desc;
580 const char *const desc;
586 * These are used for "+3 to STR, DEX", etc. These are separate from
587 * the other pval affected traits to simplify the case where an object
588 * affects all stats. In this case, "All stats" is used instead of
589 * listing each stat individually.
592 static flag_desc stat_flags_desc[] =
612 * Besides stats, these are the other player traits
613 * which may be affected by an object's pval
616 static flag_desc pval_flags1_desc[] =
619 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
620 { TR_STEALTH, "隠密" },
622 { TR_INFRA, "赤外線視力" },
624 { TR_BLOWS, "攻撃回数" },
627 { TR_STEALTH, "Stealth" },
628 { TR_SEARCH, "Searching" },
629 { TR_INFRA, "Infravision" },
630 { TR_TUNNEL, "Tunneling" },
631 { TR_BLOWS, "Attacks" },
632 { TR_SPEED, "Speed" }
637 * Slaying preferences for weapons
640 static flag_desc slay_flags_desc[] =
643 { TR_SLAY_ANIMAL, "動物" },
644 { TR_KILL_ANIMAL, "*動物*" },
645 { TR_SLAY_EVIL, "邪悪" },
646 { TR_KILL_EVIL, "*邪悪*" },
647 { TR_SLAY_HUMAN, "人間" },
648 { TR_KILL_HUMAN, "*人間*" },
649 { TR_SLAY_UNDEAD, "アンデッド" },
650 { TR_KILL_UNDEAD, "*アンデッド*" },
651 { TR_SLAY_DEMON, "悪魔" },
652 { TR_KILL_DEMON, "*悪魔*" },
653 { TR_SLAY_ORC, "オーク" },
654 { TR_KILL_ORC, "*オーク*" },
655 { TR_SLAY_TROLL, "トロル" },
656 { TR_KILL_TROLL, "*トロル*" },
657 { TR_SLAY_GIANT, "巨人" },
658 { TR_KILL_GIANT, "*巨人*" },
659 { TR_SLAY_DRAGON, "ドラゴン" },
660 { TR_KILL_DRAGON, "*ドラゴン*" },
662 { TR_SLAY_ANIMAL, "Animal" },
663 { TR_KILL_ANIMAL, "XAnimal" },
664 { TR_SLAY_EVIL, "Evil" },
665 { TR_KILL_EVIL, "XEvil" },
666 { TR_SLAY_HUMAN, "Human" },
667 { TR_KILL_HUMAN, "XHuman" },
668 { TR_SLAY_UNDEAD, "Undead" },
669 { TR_KILL_UNDEAD, "XUndead" },
670 { TR_SLAY_DEMON, "Demon" },
671 { TR_KILL_DEMON, "XDemon" },
672 { TR_SLAY_ORC, "Orc" },
673 { TR_KILL_ORC, "XOrc" },
674 { TR_SLAY_TROLL, "Troll" },
675 { TR_KILL_TROLL, "XTroll" },
676 { TR_SLAY_GIANT, "Giant" },
677 { TR_KILL_GIANT, "Xgiant" },
678 { TR_SLAY_DRAGON, "Dragon" },
679 { TR_KILL_DRAGON, "Xdragon" }
684 * Elemental brands for weapons
686 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
687 * coding, it has been included here along with the elemental
688 * brands. It does seem to fit in with the brands and slaying
689 * more than the miscellaneous section.
691 static flag_desc brand_flags_desc[] =
694 { TR_BRAND_ACID, "溶解" },
695 { TR_BRAND_ELEC, "電撃" },
696 { TR_BRAND_FIRE, "焼棄" },
697 { TR_BRAND_COLD, "凍結" },
698 { TR_BRAND_POIS, "毒殺" },
700 { TR_FORCE_WEAPON, "理力" },
701 { TR_CHAOTIC, "混沌" },
702 { TR_VAMPIRIC, "吸血" },
704 { TR_VORPAL, "切れ味" },
706 { TR_BRAND_ACID, "Acid Brand" },
707 { TR_BRAND_ELEC, "Lightning Brand" },
708 { TR_BRAND_FIRE, "Flame Tongue" },
709 { TR_BRAND_COLD, "Frost Brand" },
710 { TR_BRAND_POIS, "Poisoned" },
712 { TR_FORCE_WEAPON, "Force" },
713 { TR_CHAOTIC, "Mark of Chaos" },
714 { TR_VAMPIRIC, "Vampiric" },
715 { TR_IMPACT, "Earthquake impact on hit" },
716 { TR_VORPAL, "Very sharp" },
724 static const flag_desc resist_flags_desc[] =
727 { TR_RES_ACID, "酸" },
728 { TR_RES_ELEC, "電撃" },
729 { TR_RES_FIRE, "火炎" },
730 { TR_RES_COLD, "冷気" },
731 { TR_RES_POIS, "毒" },
732 { TR_RES_FEAR, "恐怖"},
733 { TR_RES_LITE, "閃光" },
734 { TR_RES_DARK, "暗黒" },
735 { TR_RES_BLIND, "盲目" },
736 { TR_RES_CONF, "混乱" },
737 { TR_RES_SOUND, "轟音" },
738 { TR_RES_SHARDS, "破片" },
739 { TR_RES_NETHER, "地獄" },
740 { TR_RES_NEXUS, "因果混乱" },
741 { TR_RES_CHAOS, "カオス" },
742 { TR_RES_DISEN, "劣化" },
744 { TR_RES_ACID, "Acid" },
745 { TR_RES_ELEC, "Lightning" },
746 { TR_RES_FIRE, "Fire" },
747 { TR_RES_COLD, "Cold" },
748 { TR_RES_POIS, "Poison" },
749 { TR_RES_FEAR, "Fear"},
750 { TR_RES_LITE, "Light" },
751 { TR_RES_DARK, "Dark" },
752 { TR_RES_BLIND, "Blindness" },
753 { TR_RES_CONF, "Confusion" },
754 { TR_RES_SOUND, "Sound" },
755 { TR_RES_SHARDS, "Shards" },
756 { TR_RES_NETHER, "Nether" },
757 { TR_RES_NEXUS, "Nexus" },
758 { TR_RES_CHAOS, "Chaos" },
759 { TR_RES_DISEN, "Disenchantment" },
764 * Elemental immunities (along with poison)
767 static const flag_desc immune_flags_desc[] =
771 { TR_IM_ELEC, "電撃" },
772 { TR_IM_FIRE, "火炎" },
773 { TR_IM_COLD, "冷気" },
775 { TR_IM_ACID, "Acid" },
776 { TR_IM_ELEC, "Lightning" },
777 { TR_IM_FIRE, "Fire" },
778 { TR_IM_COLD, "Cold" },
783 * Sustain stats - these are given their "own" line in the
784 * spoiler file, mainly for simplicity
786 static const flag_desc sustain_flags_desc[] =
789 { TR_SUST_STR, "腕力" },
790 { TR_SUST_INT, "知能" },
791 { TR_SUST_WIS, "賢さ" },
792 { TR_SUST_DEX, "器用さ" },
793 { TR_SUST_CON, "耐久力" },
794 { TR_SUST_CHR, "魅力" },
796 { TR_SUST_STR, "STR" },
797 { TR_SUST_INT, "INT" },
798 { TR_SUST_WIS, "WIS" },
799 { TR_SUST_DEX, "DEX" },
800 { TR_SUST_CON, "CON" },
801 { TR_SUST_CHR, "CHR" },
806 * Miscellaneous magic given by an object's "flags2" field
809 static const flag_desc misc_flags2_desc[] =
813 { TR_REFLECT, "反射" },
814 { TR_FREE_ACT, "麻痺知らず" },
815 { TR_HOLD_EXP, "経験値維持" },
817 { TR_THROW, "Throwing" },
818 { TR_REFLECT, "Reflection" },
819 { TR_FREE_ACT, "Free Action" },
820 { TR_HOLD_EXP, "Hold Experience" },
825 * Miscellaneous magic given by an object's "flags3" field
827 * Note that cursed artifacts and objects with permanent light
828 * are handled "directly" -- see analyze_misc_magic()
831 static const flag_desc misc_flags3_desc[] =
834 { TR_SH_FIRE, "火炎オーラ" },
835 { TR_SH_ELEC, "電撃オーラ" },
836 { TR_SH_COLD, "冷気オーラ" },
837 { TR_NO_TELE, "反テレポート" },
838 { TR_NO_MAGIC, "反魔法" },
839 { TR_LEVITATION, "浮遊" },
840 { TR_SEE_INVIS, "可視透明" },
841 { TR_TELEPATHY, "テレパシー" },
842 { TR_ESP_ANIMAL, "動物感知" },
843 { TR_ESP_UNDEAD, "不死感知" },
844 { TR_ESP_DEMON, "悪魔感知" },
845 { TR_ESP_ORC, "オーク感知" },
846 { TR_ESP_TROLL, "トロル感知" },
847 { TR_ESP_GIANT, "巨人感知" },
848 { TR_ESP_DRAGON, "ドラゴン感知" },
849 { TR_ESP_HUMAN, "人間感知" },
850 { TR_ESP_EVIL, "邪悪感知" },
851 { TR_ESP_GOOD, "善良感知" },
852 { TR_ESP_NONLIVING, "無生物感知" },
853 { TR_ESP_UNIQUE, "ユニーク感知" },
854 { TR_SLOW_DIGEST, "遅消化" },
855 { TR_REGEN, "急速回復" },
856 { TR_WARNING, "警告" },
857 /* { TR_XTRA_MIGHT, "強力射撃" }, */
858 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
859 { TR_DRAIN_EXP, "経験値吸収" },
860 { TR_AGGRAVATE, "反感" },
861 { TR_BLESSED, "祝福" },
862 { TR_DEC_MANA, "消費魔力減少" },
864 { TR_SH_FIRE, "Fiery Aura" },
865 { TR_SH_ELEC, "Electric Aura" },
866 { TR_SH_COLD, "Coldly Aura" },
867 { TR_NO_TELE, "Prevent Teleportation" },
868 { TR_NO_MAGIC, "Anti-Magic" },
869 { TR_LEVITATION, "Levitation" },
870 { TR_SEE_INVIS, "See Invisible" },
871 { TR_TELEPATHY, "ESP" },
872 { TR_ESP_ANIMAL, "Sense Animal" },
873 { TR_ESP_UNDEAD, "Sense Undead" },
874 { TR_ESP_DEMON, "Sense Demon" },
875 { TR_ESP_ORC, "Sense Orc" },
876 { TR_ESP_TROLL, "Sense Troll" },
877 { TR_ESP_GIANT, "Sense Giant" },
878 { TR_ESP_DRAGON, "Sense Dragon" },
879 { TR_ESP_HUMAN, "Sense Human" },
880 { TR_ESP_EVIL, "Sense Evil" },
881 { TR_ESP_GOOD, "Sense Good" },
882 { TR_ESP_NONLIVING, "Sense Nonliving" },
883 { TR_ESP_UNIQUE, "Sense Unique" },
884 { TR_SLOW_DIGEST, "Slow Digestion" },
885 { TR_REGEN, "Regeneration" },
886 { TR_WARNING, "Warning" },
887 /* { TR_XTRA_MIGHT, "Extra Might" }, */
888 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
889 { TR_DRAIN_EXP, "Drains Experience" },
890 { TR_AGGRAVATE, "Aggravates" },
891 { TR_BLESSED, "Blessed Blade" },
892 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
898 * A special type used just for deailing with pvals
903 * This will contain a string such as "+2", "-10", etc.
908 * A list of various player traits affected by an object's pval such
909 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
910 * this list since it will probably be desirable to format its
911 * description differently.
913 * Note that room need only be reserved for the number of stats - 1
914 * since the description "All stats" is used if an object affects all
915 * all stats. Also, room must be reserved for a sentinel NULL pointer.
917 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
919 * This list includes extra attacks, for simplicity.
921 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
922 N_ELEMENTS(pval_flags1_desc) + 1];
928 * An "object analysis structure"
930 * It will be filled with descriptive strings detailing an object's
931 * various magical powers. The "ignore X" traits are not noted since
932 * all artifacts ignore "normal" destruction.
937 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
938 char description[MAX_NLEN];
940 /* Description of what is affected by an object's pval */
941 pval_info_type pval_info;
943 /* A list of an object's slaying preferences */
944 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
946 /* A list if an object's elemental brands */
947 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
949 /* A list of immunities granted by an object */
950 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
952 /* A list of resistances granted by an object */
953 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
955 /* A list of stats sustained by an object */
956 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
958 /* A list of various magical qualities an object may have */
959 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
960 + 1 /* Permanent Light */
962 + 1 /* type of curse */
963 + 1]; /* sentinel NULL */
965 /* Additional ability or resistance */
968 /* A string describing an artifact's activation */
971 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
977 * @brief ファイルポインタ先に同じ文字を複数出力する /
978 * Write out `n' of the character `c' to the spoiler file
983 static void spoiler_out_n_chars(int n, char c)
985 while (--n >= 0) fputc(c, fff);
990 * @brief ファイルポインタ先に改行を複数出力する /
991 * Write out `n' blank lines to the spoiler file
995 static void spoiler_blanklines(int n)
997 spoiler_out_n_chars(n, '\n');
1002 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1003 * Write a line to the spoiler file and then "underline" it with hypens
1004 * @param str 出力したい文字列
1007 static void spoiler_underline(cptr str)
1009 fprintf(fff, "%s\n", str);
1010 spoiler_out_n_chars(strlen(str), '-');
1017 * @brief アーティファクトの特性一覧を出力する /
1018 * Write a line to the spoiler file and then "underline" it with hypens
1019 * @param art_flags アーティファクトのフラグ群
1020 * @param flag_ptr フラグ記述情報の参照ポインタ
1021 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1022 * @param n_elmnts フラグの要素数
1023 * @return desc_ptrと同じアドレス
1026 * This function does most of the actual "analysis". Given a set of bit flags
1027 * (which will be from one of the flags fields from the object in question),
1028 * a "flag description structure", a "description list", and the number of
1029 * elements in the "flag description structure", this function sets the
1030 * "description list" members to the appropriate descriptions contained in
1031 * the "flag description structure".
1032 * The possibly updated description pointer is returned.
1035 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1036 const flag_desc *flag_ptr,
1037 cptr *desc_ptr, const int n_elmnts)
1041 for (i = 0; i < n_elmnts; ++i)
1043 if (have_flag(art_flags, flag_ptr[i].flag))
1045 *desc_ptr++ = flag_ptr[i].desc;
1054 * @brief アイテムの特定記述内容を返す /
1055 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1056 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1057 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1060 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1062 /* Get a "useful" description of the object */
1063 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1068 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1069 * List "player traits" altered by an artifact's pval. These include stats,
1070 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1071 * @param o_ptr オブジェクト構造体の参照ポインタ
1072 * @param p_ptr pval修正構造体の参照ポインタ
1075 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1077 u32b flgs[TR_FLAG_SIZE];
1081 /* If pval == 0, there is nothing to do. */
1084 /* An "empty" pval description indicates that pval == 0 */
1085 pi_ptr->pval_desc[0] = '\0';
1089 /* Extract the flags */
1090 object_flags(o_ptr, flgs);
1092 affects_list = pi_ptr->pval_affects;
1094 /* Create the "+N" string */
1095 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1097 /* First, check to see if the pval affects all stats */
1098 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1099 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1100 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1102 *affects_list++ = _("全能力", "All stats");
1105 /* Are any stats affected? */
1106 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1107 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1108 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1110 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1112 N_ELEMENTS(stat_flags_desc));
1115 /* And now the "rest" */
1116 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1118 N_ELEMENTS(pval_flags1_desc));
1120 /* Terminate the description list */
1121 *affects_list = NULL;
1125 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1126 * Note the slaying specialties of a weapon
1127 * @param o_ptr オブジェクト構造体の参照ポインタ
1128 * @param slay_list 種族スレイ構造体の参照ポインタ
1131 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1133 u32b flgs[TR_FLAG_SIZE];
1135 object_flags(o_ptr, flgs);
1137 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1138 N_ELEMENTS(slay_flags_desc));
1140 /* Terminate the description list */
1146 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1147 * Note an object's elemental brands
1148 * @param o_ptr オブジェクト構造体の参照ポインタ
1149 * @param brand_list 属性ブランド構造体の参照ポインタ
1152 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1154 u32b flgs[TR_FLAG_SIZE];
1156 object_flags(o_ptr, flgs);
1158 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1159 N_ELEMENTS(brand_flags_desc));
1161 /* Terminate the description list */
1167 * @brief アーティファクトの通常耐性を構造体に収める /
1168 * Note an object's elemental brands
1169 * @param o_ptr オブジェクト構造体の参照ポインタ
1170 * @param resist_list 通常耐性構造体の参照ポインタ
1173 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1175 u32b flgs[TR_FLAG_SIZE];
1177 object_flags(o_ptr, flgs);
1179 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1180 resist_list, N_ELEMENTS(resist_flags_desc));
1182 /* Terminate the description list */
1183 *resist_list = NULL;
1188 * @brief アーティファクトの免疫特性を構造体に収める /
1189 * Note the immunities granted by an object
1190 * @param o_ptr オブジェクト構造体の参照ポインタ
1191 * @param immune_list 免疫構造体の参照ポインタ
1194 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1196 u32b flgs[TR_FLAG_SIZE];
1198 object_flags(o_ptr, flgs);
1200 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1201 immune_list, N_ELEMENTS(immune_flags_desc));
1203 /* Terminate the description list */
1204 *immune_list = NULL;
1209 * @brief アーティファクトの維持特性を構造体に収める /
1210 * Note which stats an object sustains
1211 * @param o_ptr オブジェクト構造体の参照ポインタ
1212 * @param sustain_list 維持特性構造体の参照ポインタ
1215 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1217 u32b flgs[TR_FLAG_SIZE];
1219 object_flags(o_ptr, flgs);
1221 /* Simplify things if an item sustains all stats */
1222 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1223 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1224 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1226 *sustain_list++ = _("全能力", "All stats");
1229 /* Should we bother? */
1230 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1231 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1232 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1234 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1236 N_ELEMENTS(sustain_flags_desc));
1239 /* Terminate the description list */
1240 *sustain_list = NULL;
1245 * @brief アーティファクトのその他の特性を構造体に収める /
1246 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1247 * free action, permanent light, etc.
1248 * @param o_ptr オブジェクト構造体の参照ポインタ
1249 * @param misc_list その他の特性構造体の参照ポインタ
1252 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1254 u32b flgs[TR_FLAG_SIZE];
1258 object_flags(o_ptr, flgs);
1260 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1261 N_ELEMENTS(misc_flags2_desc));
1263 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1264 N_ELEMENTS(misc_flags3_desc));
1267 * Glowing artifacts -- small radius light.
1270 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1271 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1272 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1273 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1274 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1275 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1277 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1279 if (have_flag(flgs, TR_LITE_FUEL))
1281 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), rad);
1285 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), rad);
1286 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), -rad);
1289 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1292 * Handle cursed objects here to avoid redundancies such as noting
1293 * that a permanently cursed object is heavily cursed as well as
1294 * being "lightly cursed".
1297 /* if (object_is_cursed(o_ptr)) */
1299 if (have_flag(flgs, TR_TY_CURSE))
1301 *misc_list++ = _("太古の怨念", "Ancient Curse");
1303 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1305 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1307 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1309 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1312 else if (o_ptr->curse_flags & TRC_CURSED)
1314 *misc_list++ = _("呪い", "Cursed");
1316 if (have_flag(flgs, TR_ADD_L_CURSE))
1318 *misc_list++ = _("呪いを増やす", "Cursing");
1320 if (have_flag(flgs, TR_ADD_H_CURSE))
1322 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1326 /* Terminate the description list */
1332 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1333 * Note additional ability and/or resistance of fixed artifacts
1334 * @param o_ptr オブジェクト構造体の参照ポインタ
1335 * @param addition 追加ランダム耐性構造体の参照ポインタ
1338 static void analyze_addition(object_type *o_ptr, char *addition)
1340 artifact_type *a_ptr = &a_info[o_ptr->name1];
1343 strcpy(addition, "");
1346 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1347 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1349 strcat(addition, "能力");
1350 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1352 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1354 strcat(addition, "耐性");
1355 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1357 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1359 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1360 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1362 strcat(addition, "Ability");
1363 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1365 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1367 strcat(addition, "Resistance");
1368 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1370 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1376 * @brief アーティファクトの基本情報を文字列に収める /
1377 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1378 * and its value in gold pieces
1379 * @param o_ptr オブジェクト構造体の参照ポインタ
1380 * @param misc_desc 基本情報を収める文字列参照ポインタ
1383 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1385 artifact_type *a_ptr = &a_info[o_ptr->name1];
1388 sprintf(misc_desc, "レベル %d, 希少度 %u, %d.%d kg, $%ld",
1389 (int)a_ptr->level, a_ptr->rarity,
1390 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1392 sprintf(misc_desc, "Level %d, Rarity %u, %d.%d lbs, %ld Gold",
1393 (int)a_ptr->level, a_ptr->rarity,
1394 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1400 * @brief アーティファクトの情報全体を構造体に収める /
1401 * Fill in an object description structure for a given object
1402 * and its value in gold pieces
1403 * @param o_ptr オブジェクト構造体の参照ポインタ
1404 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1407 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1409 analyze_general(o_ptr, desc_ptr->description);
1410 analyze_pval(o_ptr, &desc_ptr->pval_info);
1411 analyze_brand(o_ptr, desc_ptr->brands);
1412 analyze_slay(o_ptr, desc_ptr->slays);
1413 analyze_immune(o_ptr, desc_ptr->immunities);
1414 analyze_resist(o_ptr, desc_ptr->resistances);
1415 analyze_sustains(o_ptr, desc_ptr->sustains);
1416 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1417 analyze_addition(o_ptr, desc_ptr->addition);
1418 analyze_misc(o_ptr, desc_ptr->misc_desc);
1419 desc_ptr->activation = item_activation(o_ptr);
1424 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1427 static void print_header(void)
1431 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1432 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1433 spoiler_underline(buf);
1437 * This is somewhat ugly.
1439 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1440 * and a separator character (',', e.g.), write the list to the spoiler file
1441 * in a "nice" format, such as:
1443 * Resist Fire, Cold, Acid
1445 * That was a simple example, but when the list is long, a line wrap
1446 * should occur, and this should induce a new level of indention if
1447 * a list is being spread across lines. So for example, Bladeturner's
1448 * list of resistances should look something like this
1450 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1451 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1453 * However, the code distinguishes between a single list of many items vs.
1454 * many lists. (The separator is used to make this determination.) A single
1455 * list of many items will not cause line wrapping (since there is no
1456 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1457 * might look like this:
1459 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1462 * So comparing the two, "Regeneration" has no trailing separator and
1463 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1464 * but that's not relevant to line wrapping and indention.)
1467 /* ITEM_SEP separates items within a list */
1468 #define ITEM_SEP ','
1471 /* LIST_SEP separates lists */
1473 #define LIST_SEP ','
1475 #define LIST_SEP ';'
1479 * @brief フラグ名称を出力する汎用関数
1480 * @param header ヘッダに出力するフラグ群の名前
1481 * @param list フラグ名リスト
1482 * @param separator フラグ表示の区切り記号
1485 static void spoiler_outlist(cptr header, cptr *list, char separator)
1487 int line_len, buf_len;
1488 char line[MAX_LINE_LEN+1], buf[80];
1490 /* Ignore an empty list */
1491 if (*list == NULL) return;
1493 /* This function always indents */
1494 strcpy(line, INDENT1);
1496 /* Create header (if one was given) */
1497 if (header && (header[0]))
1499 strcat(line, header);
1503 line_len = strlen(line);
1505 /* Now begin the tedious task */
1508 /* Copy the current item to a buffer */
1511 /* Note the buffer's length */
1512 buf_len = strlen(buf);
1515 * If there is an item following this one, pad with separator and
1516 * a space and adjust the buffer length
1521 sprintf(buf + buf_len, "%c ", separator);
1526 * If the buffer will fit on the current line, just append the
1527 * buffer to the line and adjust the line length accordingly.
1530 if (line_len + buf_len <= MAX_LINE_LEN)
1533 line_len += buf_len;
1536 /* Apply line wrapping and indention semantics described above */
1540 * Don't print a trailing list separator but do print a trailing
1543 if (line_len > 1 && line[line_len - 1] == ' '
1544 && line[line_len - 2] == LIST_SEP)
1546 /* Ignore space and separator */
1547 line[line_len - 2] = '\0';
1549 /* Write to spoiler file */
1550 fprintf(fff, "%s\n", line);
1552 /* Begin new line at primary indention level */
1553 sprintf(line, "%s%s", INDENT1, buf);
1558 /* Write to spoiler file */
1559 fprintf(fff, "%s\n", line);
1561 /* Begin new line at secondary indention level */
1562 sprintf(line, "%s%s", INDENT2, buf);
1565 line_len = strlen(line);
1568 /* Advance, with break */
1569 if (!*++list) break;
1572 /* Write what's left to the spoiler file */
1573 fprintf(fff, "%s\n", line);
1577 * @brief アーティファクト一件をスポイラー出力する /
1578 * Create a spoiler file entry for an artifact
1579 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1582 static void spoiler_print_art(obj_desc_list *art_ptr)
1584 pval_info_type *pval_ptr = &art_ptr->pval_info;
1588 /* Don't indent the first line */
1589 fprintf(fff, "%s\n", art_ptr->description);
1591 /* An "empty" pval description indicates that the pval affects nothing */
1592 if (pval_ptr->pval_desc[0])
1594 /* Mention the effects of pval */
1595 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1596 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1599 /* Now deal with the description lists */
1602 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1603 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1604 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1605 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1606 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1608 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1609 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1610 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1611 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1612 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1614 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1616 if (art_ptr->addition[0])
1618 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1621 /* Write out the possible activation at the primary indention level */
1622 if (art_ptr->activation)
1624 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1627 /* End with the miscellaneous facts */
1628 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1633 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1634 * Hack -- Create a "forged" artifact
1635 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1636 * @param name1 生成するアーティファクトID
1637 * @return 生成が成功した場合TRUEを返す
1639 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1643 artifact_type *a_ptr = &a_info[name1];
1646 /* Ignore "empty" artifacts */
1647 if (!a_ptr->name) return FALSE;
1649 /* Acquire the "kind" index */
1650 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1653 if (!i) return (FALSE);
1655 /* Create the artifact */
1656 object_prep(o_ptr, i);
1659 o_ptr->name1 = (byte_hack)name1;
1661 /* Extract the fields */
1662 o_ptr->pval = a_ptr->pval;
1663 o_ptr->ac = a_ptr->ac;
1664 o_ptr->dd = a_ptr->dd;
1665 o_ptr->ds = a_ptr->ds;
1666 o_ptr->to_a = a_ptr->to_a;
1667 o_ptr->to_h = a_ptr->to_h;
1668 o_ptr->to_d = a_ptr->to_d;
1669 o_ptr->weight = a_ptr->weight;
1677 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1678 * Create a spoiler file for artifacts
1679 * @param fname 生成ファイル名
1682 static void spoil_artifact(cptr fname)
1690 obj_desc_list artifact;
1695 /* Build the filename */
1696 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1698 /* File type is "TEXT" */
1699 FILE_TYPE(FILE_TYPE_TEXT);
1702 fff = my_fopen(buf, "w");
1707 msg_print("Cannot create spoiler file.");
1711 /* Dump the header */
1714 /* List the artifacts by tval */
1715 for (i = 0; group_artifact[i].tval; i++)
1717 /* Write out the group title */
1718 if (group_artifact[i].name)
1720 spoiler_blanklines(2);
1721 spoiler_underline(group_artifact[i].name);
1722 spoiler_blanklines(1);
1725 /* Now search through all of the artifacts */
1726 for (j = 1; j < max_a_idx; ++j)
1728 artifact_type *a_ptr = &a_info[j];
1730 /* We only want objects in the current group */
1731 if (a_ptr->tval != group_artifact[i].tval) continue;
1733 /* Get local object */
1736 /* Wipe the object */
1739 /* Attempt to "forge" the artifact */
1740 if (!make_fake_artifact(q_ptr, j)) continue;
1742 /* Analyze the artifact */
1743 object_analyze(q_ptr, &artifact);
1745 /* Write out the artifact description to the spoiler file */
1746 spoiler_print_art(&artifact);
1750 /* Check for errors */
1751 if (ferror(fff) || my_fclose(fff))
1753 msg_print("Cannot close spoiler file.");
1758 msg_print("Successfully created a spoiler file.");
1763 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1764 * Create a spoiler file for monsters -BEN-
1765 * @param fname 生成ファイル名
1768 static void spoil_mon_desc(cptr fname)
1785 /* Build the filename */
1786 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1788 /* File type is "TEXT" */
1789 FILE_TYPE(FILE_TYPE_TEXT);
1792 fff = my_fopen(buf, "w");
1797 msg_print("Cannot create spoiler file.");
1801 /* Allocate the "who" array */
1802 C_MAKE(who, max_r_idx, s16b);
1804 /* Dump the header */
1805 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1806 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1807 fprintf(fff, "------------------------------------------\n\n");
1809 /* Dump the header */
1810 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1811 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1812 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1813 "--------", "---", "---", "---", "--", "--", "-----------");
1816 /* Scan the monsters */
1817 for (i = 1; i < max_r_idx; i++)
1819 monster_race *r_ptr = &r_info[i];
1821 /* Use that monster */
1822 if (r_ptr->name) who[n++] = (s16b)i;
1825 /* Select the sort method */
1826 ang_sort_comp = ang_sort_comp_hook;
1827 ang_sort_swap = ang_sort_swap_hook;
1829 /* Sort the array by dungeon depth of monsters */
1830 ang_sort(who, &why, n);
1833 for (i = 0; i < n; i++)
1835 monster_race *r_ptr = &r_info[who[i]];
1837 if (!(r_ptr->flags3 & (RF3_DEMON)))
1842 cptr name = (r_name + r_ptr->name);
1843 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1845 /* Get the "name" */
1847 else if (r_ptr->flags3 & (RF3_NO_CONF))
1849 sprintf(nam, "[*] %s", name);
1852 else if (r_ptr->flags1 & (RF1_UNIQUE))
1854 sprintf(nam, "[U] %s", name);
1858 sprintf(nam, _(" %s", "The %s"), name);
1863 sprintf(lev, "%d", (int)r_ptr->level);
1866 sprintf(rar, "%d", (int)r_ptr->rarity);
1869 if (r_ptr->speed >= 110)
1871 sprintf(spd, "+%d", (r_ptr->speed - 110));
1875 sprintf(spd, "-%d", (110 - r_ptr->speed));
1879 sprintf(ac, "%d", r_ptr->ac);
1882 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1884 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1888 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1893 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1895 /* Hack -- use visual instead */
1896 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1899 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1900 nam, lev, rar, spd, hp, ac, exp);
1907 /* Free the "who" array */
1908 C_KILL(who, max_r_idx, s16b);
1910 /* Check for errors */
1911 if (ferror(fff) || my_fclose(fff))
1913 msg_print("Cannot close spoiler file.");
1918 msg_print("Successfully created a spoiler file.");
1925 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1927 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1933 * @brief 文字列をファイルポインタに出力する /
1934 * Buffer text to the given file. (-SHAWN-)
1935 * This is basically c_roff() from mon-desc.c with a few changes.
1936 * @param str 文字列参照ポインタ
1939 static void spoil_out(cptr str)
1944 static char roff_buf[256];
1947 static char roff_waiting_buf[256];
1950 bool iskanji_flag = FALSE;
1952 /* Current pointer into line roff_buf */
1953 static char *roff_p = roff_buf;
1955 /* Last space saved into roff_buf */
1956 static char *roff_s = NULL;
1958 /* Mega-Hack -- Delayed output */
1959 static bool waiting_output = FALSE;
1961 /* Special handling for "new sequence" */
1966 fputs(roff_waiting_buf, fff);
1967 waiting_output = FALSE;
1970 if (roff_p != roff_buf) roff_p--;
1971 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1973 if (roff_p == roff_buf) fprintf(fff, "\n");
1976 *(roff_p + 1) = '\0';
1977 fprintf(fff, "%s\n\n", roff_buf);
1986 /* Scan the given string, character at a time */
1991 bool k_flag = iskanji((unsigned char)(*str));
1994 bool wrap = (ch == '\n');
1997 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1998 iskanji_flag = k_flag && !iskanji_flag;
2000 if (!isprint(ch)) ch = ' ';
2005 fputs(roff_waiting_buf, fff);
2006 if (!wrap) fputc('\n', fff);
2007 waiting_output = FALSE;
2013 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
2014 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2016 if (roff_p >= roff_buf + 75) wrap = TRUE;
2017 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2024 bool iskanji_flag_local = FALSE;
2025 cptr tail = str + (k_flag ? 2 : 1);
2027 cptr tail = str + 1;
2030 for (; *tail; tail++)
2032 if (*tail == ' ') continue;
2035 k_flag_local = iskanji((unsigned char)(*tail));
2036 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
2037 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2039 if (isprint(*tail)) break;
2043 if (!*tail) waiting_output = TRUE;
2047 /* Handle line-wrap */
2055 if (roff_s && (ch != ' '))
2063 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2064 else strcpy(roff_waiting_buf, roff_buf);
2068 if (cbak != ' ') *roff_p++ = cbak;
2070 while (*r) *roff_p++ = *r++;
2074 if ((roff_p > roff_buf) || (ch != ' '))
2079 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2084 strncmp(str, "。", 2) != 0 &&
2085 strncmp(str, "、", 2) != 0 &&
2086 strncmp(str, "ィ", 2) != 0 &&
2087 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2090 if (ch == ' ') roff_s = roff_p;
2101 * @brief 関数ポインタ用の出力関数 /
2102 * Hook function used in spoil_mon_info()
2104 * @param str 文字列参照ポインタ
2107 static void roff_func(byte attr, cptr str)
2117 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2118 * Create a spoiler file for monsters (-SHAWN-)
2119 * @param fname ファイル名
2122 static void spoil_mon_info(cptr fname)
2131 /* Build the filename */
2132 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2134 /* File type is "TEXT" */
2135 FILE_TYPE(FILE_TYPE_TEXT);
2138 fff = my_fopen(buf, "w");
2143 msg_print("Cannot create spoiler file.");
2148 /* Dump the header */
2149 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2150 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2153 spoil_out("------------------------------------------\n\n");
2155 /* Allocate the "who" array */
2156 C_MAKE(who, max_r_idx, s16b);
2158 /* Scan the monsters */
2159 for (i = 1; i < max_r_idx; i++)
2161 monster_race *r_ptr = &r_info[i];
2163 /* Use that monster */
2164 if (r_ptr->name) who[n++] = (s16b)i;
2167 /* Select the sort method */
2168 ang_sort_comp = ang_sort_comp_hook;
2169 ang_sort_swap = ang_sort_swap_hook;
2171 /* Sort the array by dungeon depth of monsters */
2172 ang_sort(who, &why, n);
2176 * List all monsters in order
2178 for (l = 0; l < n; l++)
2180 monster_race *r_ptr = &r_info[who[l]];
2182 /* Extract the flags */
2183 flags1 = r_ptr->flags1;
2187 if (flags1 & (RF1_QUESTOR))
2193 if (flags1 & (RF1_UNIQUE))
2205 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2210 spoil_out(attr_to_text(r_ptr));
2213 sprintf(buf, " '%c')\n", r_ptr->d_char);
2218 sprintf(buf, "=== ");
2222 sprintf(buf, "Num:%d ", who[l]);
2226 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2230 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2234 if (r_ptr->speed >= 110)
2236 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2240 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2245 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2247 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2251 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2256 sprintf(buf, "Ac:%d ", r_ptr->ac);
2260 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2263 /* Reuse the code of monster recall. */
2264 output_monster_spoiler(who[l], roff_func);
2269 /* Free the "who" array */
2270 C_KILL(who, max_r_idx, s16b);
2272 /* Check for errors */
2273 if (ferror(fff) || my_fclose(fff))
2275 msg_print("Cannot close spoiler file.");
2279 msg_print("Successfully created a spoiler file.");
2284 #define MAX_EVOL_DEPTH 64
2288 * @brief int配列でstrncmp()と似た比較処理を行う /
2289 * Compare two int-type array like strncmp() and return TRUE if equals
2290 * @param a 比較するint配列1
2291 * @param b 比較するint配列2
2293 * @return 両者の値が等しければTRUEを返す
2295 static bool int_n_cmp(int *a, int *b, int length)
2297 /* Null-string comparation is always TRUE */
2298 if (!length) return TRUE;
2302 if (*a != *(b++)) return FALSE;
2303 if (!(*(a++))) break;
2312 * @brief ある木が指定された木の部分木かどうかを返す /
2313 * Returns TRUE if an evolution tree is "partial tree"
2314 * @param tree 元となる木構造リスト
2315 * @param partial_tree 部分木かどうか判定したい木構造リスト
2316 * @return 部分木ならばTRUEを返す
2318 static bool is_partial_tree(int *tree, int *partial_tree)
2320 int pt_head = *(partial_tree++);
2323 while (partial_tree[pt_len]) pt_len++;
2327 if (*(tree++) == pt_head)
2329 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2338 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2339 * Sorting hook -- Comp function
2342 * @param a 比較したいモンスター種族ID1
2343 * @param b 比較したいモンスター種族ID2
2344 * @return 2が大きければTRUEを返す
2346 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2348 int **evol_tree = (int **)u;
2350 int w1 = evol_tree[a][0];
2351 int w2 = evol_tree[b][0];
2352 monster_race *r1_ptr = &r_info[w1];
2353 monster_race *r2_ptr = &r_info[w2];
2358 /* Used tree first */
2359 if (w1 && !w2) return TRUE;
2360 if (!w1 && w2) return FALSE;
2362 /* Sort by monster level */
2363 if (r1_ptr->level < r2_ptr->level) return TRUE;
2364 if (r1_ptr->level > r2_ptr->level) return FALSE;
2366 /* Sort by monster experience */
2367 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2368 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2370 /* Compare indexes */
2375 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2376 * Sorting hook -- Swap function
2379 * @param a スワップしたい木構造1
2380 * @param b スワップしたい木構造2
2381 * @return 2が大きければTRUEを返す
2383 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2385 int **evol_tree = (int **)u;
2392 holder = evol_tree[a];
2393 evol_tree[a] = evol_tree[b];
2394 evol_tree[b] = holder;
2398 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2399 * Print monsters' evolution information to file
2400 * @param fname 出力ファイル名
2403 static void spoil_mon_evol(cptr fname)
2406 monster_race *r_ptr;
2407 int **evol_tree, i, j, n, r_idx;
2408 int *evol_tree_zero; /* For C_KILL() */
2410 /* Build the filename */
2411 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2413 /* File type is "TEXT" */
2414 FILE_TYPE(FILE_TYPE_TEXT);
2417 fff = my_fopen(buf, "w");
2422 msg_print("Cannot create spoiler file.");
2426 /* Dump the header */
2427 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2428 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2431 spoil_out("------------------------------------------\n\n");
2433 /* Allocate the "evol_tree" array (2-dimension) */
2434 C_MAKE(evol_tree, max_r_idx, int *);
2435 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2436 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2437 evol_tree_zero = *evol_tree;
2439 /* Step 1: Build the evolution tree */
2440 for (i = 1; i < max_r_idx; i++)
2445 if (!r_ptr->next_exp) continue;
2447 /* Trace evolution */
2449 evol_tree[i][n++] = i;
2452 evol_tree[i][n++] = r_ptr->next_r_idx;
2453 r_ptr = &r_info[r_ptr->next_r_idx];
2455 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2458 /* Step 2: Scan the evolution trees and remove "partial tree" */
2459 for (i = 1; i < max_r_idx; i++)
2461 /* Not evolution tree */
2462 if (!evol_tree[i][0]) continue;
2464 for (j = 1; j < max_r_idx; j++)
2467 if (i == j) continue;
2469 /* Not evolution tree */
2470 if (!evol_tree[j][0]) continue;
2472 /* Is evolution tree[i] is part of [j]? */
2473 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2475 /* Remove this evolution tree */
2476 evol_tree[i][0] = 0;
2482 /* Step 3: Sort the evolution trees */
2484 /* Select the sort method */
2485 ang_sort_comp = ang_sort_comp_evol_tree;
2486 ang_sort_swap = ang_sort_swap_evol_tree;
2488 /* Sort the array */
2489 ang_sort(evol_tree, NULL, max_r_idx);
2491 /* Step 4: Print the evolution trees */
2492 for (i = 0; i < max_r_idx; i++)
2494 r_idx = evol_tree[i][0];
2496 /* No evolution or removed evolution tree */
2497 if (!r_idx) continue;
2499 /* Trace the evolution tree */
2500 r_ptr = &r_info[r_idx];
2501 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2502 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2504 for (n = 1; r_ptr->next_exp; n++)
2506 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2507 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2508 r_ptr = &r_info[r_ptr->next_r_idx];
2509 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2510 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2513 /* End of evolution tree */
2517 /* Free the "evol_tree" array (2-dimension) */
2518 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2519 C_KILL(evol_tree, max_r_idx, int *);
2521 /* Check for errors */
2522 if (ferror(fff) || my_fclose(fff))
2524 msg_print("Cannot close spoiler file.");
2529 msg_print("Successfully created a spoiler file.");
2537 extern void do_cmd_spoilers(void);
2540 * @brief スポイラー出力を行うコマンドのメインルーチン /
2541 * Create Spoiler files -BEN-
2544 void do_cmd_spoilers(void)
2546 /* Save the screen */
2556 prt("Create a spoiler file.", 2, 0);
2558 /* Prompt for a file */
2559 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2560 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2561 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2562 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2563 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2566 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2573 /* Restore the screen */
2579 spoil_obj_desc("obj-desc.txt");
2584 spoil_artifact("artifact.txt");
2589 spoil_mon_desc("mon-desc.txt");
2594 spoil_mon_info("mon-info.txt");
2599 spoil_mon_evol("mon-evol.txt");
2608 /* Flush messages */
2614 * @brief ランダムアーティファクト1件を解析する /
2615 * Fill in an object description structure for a given object
2616 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2617 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2620 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2622 analyze_general(o_ptr, desc_ptr->description);
2623 analyze_pval(o_ptr, &desc_ptr->pval_info);
2624 analyze_brand(o_ptr, desc_ptr->brands);
2625 analyze_slay(o_ptr, desc_ptr->slays);
2626 analyze_immune(o_ptr, desc_ptr->immunities);
2627 analyze_resist(o_ptr, desc_ptr->resistances);
2628 analyze_sustains(o_ptr, desc_ptr->sustains);
2629 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2630 desc_ptr->activation = item_activation(o_ptr);
2632 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2633 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2635 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2636 o_ptr->weight / 10, o_ptr->weight % 10);
2641 * @brief ランダムアーティファクト1件をスポイラー出力する /
2642 * Create a spoiler file entry for an artifact
2643 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2644 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2645 * Fill in an object description structure for a given object
2648 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2650 pval_info_type *pval_ptr = &art_ptr->pval_info;
2654 /* Don't indent the first line */
2655 fprintf(fff, "%s\n", art_ptr->description);
2658 if (!(o_ptr->ident & (IDENT_MENTAL)))
2660 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2663 /* An "empty" pval description indicates that the pval affects nothing */
2664 if (pval_ptr->pval_desc[0])
2666 /* Mention the effects of pval */
2667 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2668 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2671 /* Now deal with the description lists */
2674 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2675 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2676 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2677 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2678 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2680 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2681 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2682 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2683 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2684 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2686 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2688 /* Write out the possible activation at the primary indention level */
2689 if (art_ptr->activation)
2691 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2694 /* End with the miscellaneous facts */
2695 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2700 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2701 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2702 * @param i 出力したい記録ランダムアーティファクトID
2705 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2707 obj_desc_list artifact;
2709 if (!object_is_known(o_ptr) || !o_ptr->art_name
2710 || o_ptr->tval != group_artifact[i].tval)
2713 /* Analyze the artifact */
2714 random_artifact_analyze(o_ptr, &artifact);
2716 /* Write out the artifact description to the spoiler file */
2717 spoiler_print_randart(o_ptr, &artifact);
2721 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2722 * Create a list file for random artifacts
2723 * @param fname 出力ファイル名
2726 void spoil_random_artifact(cptr fname)
2736 /* Build the filename */
2737 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2739 /* File type is "TEXT" */
2740 FILE_TYPE(FILE_TYPE_TEXT);
2743 fff = my_fopen(buf, "w");
2748 msg_print("Cannot create list file.");
2752 /* Dump the header */
2753 sprintf(buf, "Random artifacts list.\r");
2754 spoiler_underline(buf);
2756 /* List the artifacts by tval */
2757 for (j = 0; group_artifact[j].tval; j++)
2759 /* random artifacts wielding */
2760 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2762 q_ptr = &inventory[i];
2763 spoil_random_artifact_aux(q_ptr, j);
2766 /* random artifacts in inventory */
2767 for (i = 0; i < INVEN_PACK; i++)
2769 q_ptr = &inventory[i];
2770 spoil_random_artifact_aux(q_ptr, j);
2773 /* random artifacts in home */
2774 st_ptr = &town[1].store[STORE_HOME];
2775 for (i = 0; i < st_ptr->stock_num; i++)
2777 q_ptr = &st_ptr->stock[i];
2778 spoil_random_artifact_aux(q_ptr, j);
2781 /* random artifacts in museum */
2782 st_ptr = &town[1].store[STORE_MUSEUM];
2783 for (i = 0; i < st_ptr->stock_num; i++)
2785 q_ptr = &st_ptr->stock[i];
2786 spoil_random_artifact_aux(q_ptr, j);
2790 /* Check for errors */
2791 if (ferror(fff) || my_fclose(fff))
2793 msg_print("Cannot close list file.");
2798 msg_print("Successfully created a list file.");
2805 #endif /* MACINTOSH */