3 * @brief ウィザードモードの処理(スポイラー出力中心) / Spoiler generation -BEN-
6 * Copyright (c) 1997 Ben Harrison, and others
7 * This software may be copied and distributed for educational, research,
8 * and not for profit purposes provided that this copyright and statement
9 * are included in all such copies. Other copyrights may also apply.
10 * 2013 Deskull rearranged comment for Doxygen.
20 * The spoiler file being created
22 static FILE *fff = NULL;
27 * @brief シンボル職の記述名を返す /
28 * Extract a textual representation of an attribute
29 * @param r_ptr モンスター種族の構造体ポインタ
32 static cptr attr_to_text(monster_race *r_ptr)
35 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "透明な";
36 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "万色の";
37 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "準ランダムな";
39 if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "Clear";
40 if (r_ptr->flags1 & RF1_ATTR_MULTI) return "Multi";
41 if (r_ptr->flags1 & RF1_ATTR_SEMIRAND) return "S.Rand";
44 switch (r_ptr->d_attr)
47 case TERM_DARK: return "XXXい";
48 case TERM_WHITE: return "白い";
49 case TERM_SLATE: return "青灰色の";
50 case TERM_ORANGE: return "オレンジの";
51 case TERM_RED: return "赤い";
52 case TERM_GREEN: return "緑の";
53 case TERM_BLUE: return "青い";
54 case TERM_UMBER: return "琥珀色の";
55 case TERM_L_DARK: return "灰色の";
56 case TERM_L_WHITE: return "明青灰色の";
57 case TERM_VIOLET: return "紫の";
58 case TERM_YELLOW: return "黄色い";
59 case TERM_L_RED: return "明い赤の";
60 case TERM_L_GREEN: return "明い緑の";
61 case TERM_L_BLUE: return "明い青の";
62 case TERM_L_UMBER: return "明い琥珀色の";
64 case TERM_DARK: return "xxx";
65 case TERM_WHITE: return "White";
66 case TERM_SLATE: return "Slate";
67 case TERM_ORANGE: return "Orange";
68 case TERM_RED: return "Red";
69 case TERM_GREEN: return "Green";
70 case TERM_BLUE: return "Blue";
71 case TERM_UMBER: return "Umber";
72 case TERM_L_DARK: return "L.Dark";
73 case TERM_L_WHITE: return "L.Slate";
74 case TERM_VIOLET: return "Violet";
75 case TERM_YELLOW: return "Yellow";
76 case TERM_L_RED: return "L.Red";
77 case TERM_L_GREEN: return "L.Green";
78 case TERM_L_BLUE: return "L.Blue";
79 case TERM_L_UMBER: return "L.Umber";
97 OBJECT_TYPE_VALUE tval;
104 * Item Spoilers by: benh@phial.com (Ben Harrison)
109 * The basic items categorized by type
111 static grouper group_item[] =
113 { TV_SHOT, _("射撃物", "Ammo") },
116 { TV_BOW, _("弓", "Bows") },
117 { TV_DIGGING, _("武器", "Weapons") },
118 { TV_POLEARM, NULL },
121 { TV_SOFT_ARMOR, _("防具 (体)", "Armour (Body)") },
122 { TV_HARD_ARMOR, NULL },
123 { TV_DRAG_ARMOR, NULL },
124 { TV_BOOTS, _("防具 (その他)", "Armour (Misc)") },
133 { TV_AMULET, "アミュレット" },
136 { TV_LITE, "Light Sources" },
137 { TV_AMULET, "Amulets" },
138 { TV_RING, "Rings" },
146 { TV_STAFF, "Staffs" },
147 { TV_WAND, "Wands" },
156 { TV_SCROLL, "Scrolls" },
157 { TV_POTION, "Potions" },
162 { TV_LIFE_BOOK, "魔法書 (生命)" },
163 { TV_SORCERY_BOOK, "魔法書 (仙術)" },
164 { TV_NATURE_BOOK, "魔法書 (自然)" },
165 { TV_CHAOS_BOOK, "魔法書 (カオス)" },
166 { TV_DEATH_BOOK, "魔法書 (暗黒)" },
167 { TV_TRUMP_BOOK, "魔法書 (トランプ)" },
168 { TV_ARCANE_BOOK, "魔法書 (秘術)" },
169 { TV_CRAFT_BOOK, "魔法書 (匠)" },
170 { TV_DAEMON_BOOK, "魔法書 (悪魔)" },
171 { TV_CRUSADE_BOOK, "魔法書 (破邪)" },
172 { TV_MUSIC_BOOK, "歌集" },
173 { TV_HISSATSU_BOOK, "武芸の書" },
174 { TV_HEX_BOOK, "魔法書 (呪術)" },
176 { TV_LIFE_BOOK, "Books (Life)" },
177 { TV_SORCERY_BOOK, "Books (Sorcery)" },
178 { TV_NATURE_BOOK, "Books (Nature)" },
179 { TV_CHAOS_BOOK, "Books (Chaos)" },
180 { TV_DEATH_BOOK, "Books (Death)" },
181 { TV_TRUMP_BOOK, "Books (Trump)" },
182 { TV_ARCANE_BOOK, "Books (Arcane)" },
183 { TV_CRAFT_BOOK, "Books (Craft)" },
184 { TV_DAEMON_BOOK, "Books (Daemon)" },
185 { TV_CRUSADE_BOOK, "Books (Crusade)" },
186 { TV_MUSIC_BOOK, "Song Books" },
187 { TV_HISSATSU_BOOK, "Books (Kendo)" },
188 { TV_HEX_BOOK, "Books (Hex)" },
193 { TV_CAPTURE, "キャプチャー・ボール" },
194 { TV_CARD, "エクスプレスカード" },
196 { TV_WHISTLE, "Whistle" },
197 { TV_CAPTURE, "Capture Ball" },
198 { TV_CARD, "Express Card" },
201 { TV_CHEST, _("箱", "Chests") },
204 { TV_FIGURINE, "人形" },
208 { TV_FIGURINE, "Magical Figurines" },
209 { TV_STATUE, "Statues" },
210 { TV_CORPSE, "Corpses" },
213 { TV_SKELETON, _("その他", "Misc") },
218 { TV_PARCHMENT, NULL },
225 * @brief ベースアイテムの各情報を文字列化する /
227 * @param buf 名称を返すバッファ参照ポインタ
228 * @param dam ダメージダイス記述を返すバッファ参照ポインタ
229 * @param wgt 重量記述を返すバッファ参照ポインタ
230 * @param lev 生成階記述を返すバッファ参照ポインタ
231 * @param chance 生成機会を返すバッファ参照ポインタ
232 * @param val 価値を返すバッファ参照ポインタ
236 static void kind_info(char *buf, char *dam, char *wgt, char *chance, DEPTH *lev, PRICE *val, OBJECT_IDX k)
242 /* Get local object */
245 /* Prepare a fake item */
246 object_prep(q_ptr, k);
249 q_ptr->ident |= (IDENT_KNOWN);
259 (*lev) = k_info[q_ptr->k_idx].level;
262 (*val) = object_value(q_ptr);
266 if (!buf || !dam || !chance || !wgt) return;
269 /* Description (too brief) */
270 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
290 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
300 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
315 sprintf(dam, "%d", q_ptr->ac);
322 for(i = 0; i < 4; i++)
324 char chance_aux[20] = "";
325 if(k_info[q_ptr->k_idx].chance[i] > 0)
327 sprintf(chance_aux, "%s%3dF:%+4d", (i != 0 ? "/" : ""),
328 (int)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", (int)(q_ptr->weight / 10), (int)(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");
369 msg_print("Cannot create spoiler file.");
375 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d.%d)\n\n\n",
376 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
379 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
380 "Description", "Dam/AC", "Wgt", "Lev", "Chance", "Cost");
381 fprintf(fff, "%-37s%8s%7s%5s %40s%9s\n",
382 "-------------------------------------", "------", "---", "---", "----------------", "----");
384 /* List the groups */
385 for (i = 0; TRUE; i++)
387 /* Write out the group title */
388 if (group_item[i].name)
392 /* Hack -- bubble-sort by cost and then level */
393 for (s = 0; s < n - 1; s++)
395 for (t = 0; t < n - 1; t++)
406 kind_info(NULL, NULL, NULL, NULL, &e1, &t1, who[i1]);
407 kind_info(NULL, NULL, NULL, NULL, &e2, &t2, who[i2]);
409 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
418 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
420 /* Spoil each item */
421 for (s = 0; s < n; s++)
426 /* Describe the kind */
427 kind_info(buf, dam, wgt, chance, &e, &v, who[s]);
430 fprintf(fff, " %-35s%8s%7s%5d %-40s%9ld\n",
431 buf, dam, wgt, (int)e, chance, (long)(v));
434 /* Start a new set */
439 if (!group_item[i].tval) break;
441 /* Start a new set */
445 /* Acquire legal item types */
446 for (k = 1; k < max_k_idx; k++)
448 object_kind *k_ptr = &k_info[k];
450 /* Skip wrong tval's */
451 if (k_ptr->tval != group_item[i].tval) continue;
453 /* Hack -- Skip instant-artifacts */
454 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
462 /* Check for errors */
463 if (ferror(fff) || my_fclose(fff))
465 msg_print("Cannot close spoiler file.");
469 msg_print("Successfully created a spoiler file.");
474 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
479 * Returns a "+" string if a number is non-negative and an empty
482 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
485 * These are used to format the artifact spoiler file. INDENT1 is used
486 * to indent all but the first line of an artifact spoiler. INDENT2 is
487 * used when a line "wraps". (Bladeturner's resistances cause this.)
493 * MAX_LINE_LEN specifies when a line should wrap.
495 #define MAX_LINE_LEN 75
498 * Given an array, determine how many elements are in the array
500 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
503 * The artifacts categorized by type
505 static grouper group_artifact[] =
509 { TV_POLEARM, "槍/斧" },
511 { TV_DIGGING, "シャベル/つるはし" },
516 { TV_SOFT_ARMOR, "鎧" },
517 { TV_HARD_ARMOR, NULL },
518 { TV_DRAG_ARMOR, NULL },
520 { TV_CLOAK, "クローク" },
529 { TV_AMULET, "アミュレット" },
532 { TV_SWORD, "Edged Weapons" },
533 { TV_POLEARM, "Polearms" },
534 { TV_HAFTED, "Hafted Weapons" },
535 { TV_DIGGING, "Shovels/Picks" },
537 { TV_ARROW, "Ammo" },
540 { TV_SOFT_ARMOR, "Body Armor" },
541 { TV_HARD_ARMOR, NULL },
542 { TV_DRAG_ARMOR, NULL },
544 { TV_CLOAK, "Cloaks" },
545 { TV_SHIELD, "Shields" },
547 { TV_HELM, "Helms/Crowns" },
549 { TV_GLOVES, "Gloves" },
550 { TV_BOOTS, "Boots" },
552 { TV_LITE, "Light Sources" },
553 { TV_AMULET, "Amulets" },
554 { TV_RING, "Rings" },
563 * Pair together a constant flag with a textual description.
565 * Used by both "init.c" and "wiz-spo.c".
567 * Note that it sometimes more efficient to actually make an array
568 * of textual names, where entry 'N' is assumed to be paired with
569 * the flag whose value is "1L << N", but that requires hard-coding.
572 typedef struct flag_desc flag_desc;
577 const char *const desc;
583 * These are used for "+3 to STR, DEX", etc. These are separate from
584 * the other pval affected traits to simplify the case where an object
585 * affects all stats. In this case, "All stats" is used instead of
586 * listing each stat individually.
589 static flag_desc stat_flags_desc[] =
609 * Besides stats, these are the other player traits
610 * which may be affected by an object's pval
613 static flag_desc pval_flags1_desc[] =
616 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
617 { TR_STEALTH, "隠密" },
619 { TR_INFRA, "赤外線視力" },
621 { TR_BLOWS, "攻撃回数" },
624 { TR_STEALTH, "Stealth" },
625 { TR_SEARCH, "Searching" },
626 { TR_INFRA, "Infravision" },
627 { TR_TUNNEL, "Tunneling" },
628 { TR_BLOWS, "Attacks" },
629 { TR_SPEED, "Speed" }
634 * Slaying preferences for weapons
637 static flag_desc slay_flags_desc[] =
640 { TR_SLAY_ANIMAL, "動物" },
641 { TR_KILL_ANIMAL, "*動物*" },
642 { TR_SLAY_EVIL, "邪悪" },
643 { TR_KILL_EVIL, "*邪悪*" },
644 { TR_SLAY_HUMAN, "人間" },
645 { TR_KILL_HUMAN, "*人間*" },
646 { TR_SLAY_UNDEAD, "アンデッド" },
647 { TR_KILL_UNDEAD, "*アンデッド*" },
648 { TR_SLAY_DEMON, "悪魔" },
649 { TR_KILL_DEMON, "*悪魔*" },
650 { TR_SLAY_ORC, "オーク" },
651 { TR_KILL_ORC, "*オーク*" },
652 { TR_SLAY_TROLL, "トロル" },
653 { TR_KILL_TROLL, "*トロル*" },
654 { TR_SLAY_GIANT, "巨人" },
655 { TR_KILL_GIANT, "*巨人*" },
656 { TR_SLAY_DRAGON, "ドラゴン" },
657 { TR_KILL_DRAGON, "*ドラゴン*" },
659 { TR_SLAY_ANIMAL, "Animal" },
660 { TR_KILL_ANIMAL, "XAnimal" },
661 { TR_SLAY_EVIL, "Evil" },
662 { TR_KILL_EVIL, "XEvil" },
663 { TR_SLAY_HUMAN, "Human" },
664 { TR_KILL_HUMAN, "XHuman" },
665 { TR_SLAY_UNDEAD, "Undead" },
666 { TR_KILL_UNDEAD, "XUndead" },
667 { TR_SLAY_DEMON, "Demon" },
668 { TR_KILL_DEMON, "XDemon" },
669 { TR_SLAY_ORC, "Orc" },
670 { TR_KILL_ORC, "XOrc" },
671 { TR_SLAY_TROLL, "Troll" },
672 { TR_KILL_TROLL, "XTroll" },
673 { TR_SLAY_GIANT, "Giant" },
674 { TR_KILL_GIANT, "Xgiant" },
675 { TR_SLAY_DRAGON, "Dragon" },
676 { TR_KILL_DRAGON, "Xdragon" }
681 * Elemental brands for weapons
683 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
684 * coding, it has been included here along with the elemental
685 * brands. It does seem to fit in with the brands and slaying
686 * more than the miscellaneous section.
688 static flag_desc brand_flags_desc[] =
691 { TR_BRAND_ACID, "溶解" },
692 { TR_BRAND_ELEC, "電撃" },
693 { TR_BRAND_FIRE, "焼棄" },
694 { TR_BRAND_COLD, "凍結" },
695 { TR_BRAND_POIS, "毒殺" },
697 { TR_FORCE_WEAPON, "理力" },
698 { TR_CHAOTIC, "混沌" },
699 { TR_VAMPIRIC, "吸血" },
701 { TR_VORPAL, "切れ味" },
703 { TR_BRAND_ACID, "Acid Brand" },
704 { TR_BRAND_ELEC, "Lightning Brand" },
705 { TR_BRAND_FIRE, "Flame Tongue" },
706 { TR_BRAND_COLD, "Frost Brand" },
707 { TR_BRAND_POIS, "Poisoned" },
709 { TR_FORCE_WEAPON, "Force" },
710 { TR_CHAOTIC, "Mark of Chaos" },
711 { TR_VAMPIRIC, "Vampiric" },
712 { TR_IMPACT, "Earthquake impact on hit" },
713 { TR_VORPAL, "Very sharp" },
721 static const flag_desc resist_flags_desc[] =
724 { TR_RES_ACID, "酸" },
725 { TR_RES_ELEC, "電撃" },
726 { TR_RES_FIRE, "火炎" },
727 { TR_RES_COLD, "冷気" },
728 { TR_RES_POIS, "毒" },
729 { TR_RES_FEAR, "恐怖"},
730 { TR_RES_LITE, "閃光" },
731 { TR_RES_DARK, "暗黒" },
732 { TR_RES_BLIND, "盲目" },
733 { TR_RES_CONF, "混乱" },
734 { TR_RES_SOUND, "轟音" },
735 { TR_RES_SHARDS, "破片" },
736 { TR_RES_NETHER, "地獄" },
737 { TR_RES_NEXUS, "因果混乱" },
738 { TR_RES_CHAOS, "カオス" },
739 { TR_RES_DISEN, "劣化" },
741 { TR_RES_ACID, "Acid" },
742 { TR_RES_ELEC, "Lightning" },
743 { TR_RES_FIRE, "Fire" },
744 { TR_RES_COLD, "Cold" },
745 { TR_RES_POIS, "Poison" },
746 { TR_RES_FEAR, "Fear"},
747 { TR_RES_LITE, "Light" },
748 { TR_RES_DARK, "Dark" },
749 { TR_RES_BLIND, "Blindness" },
750 { TR_RES_CONF, "Confusion" },
751 { TR_RES_SOUND, "Sound" },
752 { TR_RES_SHARDS, "Shards" },
753 { TR_RES_NETHER, "Nether" },
754 { TR_RES_NEXUS, "Nexus" },
755 { TR_RES_CHAOS, "Chaos" },
756 { TR_RES_DISEN, "Disenchantment" },
761 * Elemental immunities (along with poison)
764 static const flag_desc immune_flags_desc[] =
768 { TR_IM_ELEC, "電撃" },
769 { TR_IM_FIRE, "火炎" },
770 { TR_IM_COLD, "冷気" },
772 { TR_IM_ACID, "Acid" },
773 { TR_IM_ELEC, "Lightning" },
774 { TR_IM_FIRE, "Fire" },
775 { TR_IM_COLD, "Cold" },
780 * Sustain stats - these are given their "own" line in the
781 * spoiler file, mainly for simplicity
783 static const flag_desc sustain_flags_desc[] =
786 { TR_SUST_STR, "腕力" },
787 { TR_SUST_INT, "知能" },
788 { TR_SUST_WIS, "賢さ" },
789 { TR_SUST_DEX, "器用さ" },
790 { TR_SUST_CON, "耐久力" },
791 { TR_SUST_CHR, "魅力" },
793 { TR_SUST_STR, "STR" },
794 { TR_SUST_INT, "INT" },
795 { TR_SUST_WIS, "WIS" },
796 { TR_SUST_DEX, "DEX" },
797 { TR_SUST_CON, "CON" },
798 { TR_SUST_CHR, "CHR" },
803 * Miscellaneous magic given by an object's "flags2" field
806 static const flag_desc misc_flags2_desc[] =
810 { TR_REFLECT, "反射" },
811 { TR_FREE_ACT, "麻痺知らず" },
812 { TR_HOLD_EXP, "経験値維持" },
814 { TR_THROW, "Throwing" },
815 { TR_REFLECT, "Reflection" },
816 { TR_FREE_ACT, "Free Action" },
817 { TR_HOLD_EXP, "Hold Experience" },
822 * Miscellaneous magic given by an object's "flags3" field
824 * Note that cursed artifacts and objects with permanent light
825 * are handled "directly" -- see analyze_misc_magic()
828 static const flag_desc misc_flags3_desc[] =
831 { TR_SH_FIRE, "火炎オーラ" },
832 { TR_SH_ELEC, "電撃オーラ" },
833 { TR_SH_COLD, "冷気オーラ" },
834 { TR_NO_TELE, "反テレポート" },
835 { TR_NO_MAGIC, "反魔法" },
836 { TR_LEVITATION, "浮遊" },
837 { TR_SEE_INVIS, "可視透明" },
838 { TR_TELEPATHY, "テレパシー" },
839 { TR_ESP_ANIMAL, "動物感知" },
840 { TR_ESP_UNDEAD, "不死感知" },
841 { TR_ESP_DEMON, "悪魔感知" },
842 { TR_ESP_ORC, "オーク感知" },
843 { TR_ESP_TROLL, "トロル感知" },
844 { TR_ESP_GIANT, "巨人感知" },
845 { TR_ESP_DRAGON, "ドラゴン感知" },
846 { TR_ESP_HUMAN, "人間感知" },
847 { TR_ESP_EVIL, "邪悪感知" },
848 { TR_ESP_GOOD, "善良感知" },
849 { TR_ESP_NONLIVING, "無生物感知" },
850 { TR_ESP_UNIQUE, "ユニーク感知" },
851 { TR_SLOW_DIGEST, "遅消化" },
852 { TR_REGEN, "急速回復" },
853 { TR_WARNING, "警告" },
854 /* { TR_XTRA_MIGHT, "強力射撃" }, */
855 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
856 { TR_DRAIN_EXP, "経験値吸収" },
857 { TR_AGGRAVATE, "反感" },
858 { TR_BLESSED, "祝福" },
859 { TR_DEC_MANA, "消費魔力減少" },
861 { TR_SH_FIRE, "Fiery Aura" },
862 { TR_SH_ELEC, "Electric Aura" },
863 { TR_SH_COLD, "Coldly Aura" },
864 { TR_NO_TELE, "Prevent Teleportation" },
865 { TR_NO_MAGIC, "Anti-Magic" },
866 { TR_LEVITATION, "Levitation" },
867 { TR_SEE_INVIS, "See Invisible" },
868 { TR_TELEPATHY, "ESP" },
869 { TR_ESP_ANIMAL, "Sense Animal" },
870 { TR_ESP_UNDEAD, "Sense Undead" },
871 { TR_ESP_DEMON, "Sense Demon" },
872 { TR_ESP_ORC, "Sense Orc" },
873 { TR_ESP_TROLL, "Sense Troll" },
874 { TR_ESP_GIANT, "Sense Giant" },
875 { TR_ESP_DRAGON, "Sense Dragon" },
876 { TR_ESP_HUMAN, "Sense Human" },
877 { TR_ESP_EVIL, "Sense Evil" },
878 { TR_ESP_GOOD, "Sense Good" },
879 { TR_ESP_NONLIVING, "Sense Nonliving" },
880 { TR_ESP_UNIQUE, "Sense Unique" },
881 { TR_SLOW_DIGEST, "Slow Digestion" },
882 { TR_REGEN, "Regeneration" },
883 { TR_WARNING, "Warning" },
884 /* { TR_XTRA_MIGHT, "Extra Might" }, */
885 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
886 { TR_DRAIN_EXP, "Drains Experience" },
887 { TR_AGGRAVATE, "Aggravates" },
888 { TR_BLESSED, "Blessed Blade" },
889 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
895 * A special type used just for deailing with pvals
900 * This will contain a string such as "+2", "-10", etc.
905 * A list of various player traits affected by an object's pval such
906 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
907 * this list since it will probably be desirable to format its
908 * description differently.
910 * Note that room need only be reserved for the number of stats - 1
911 * since the description "All stats" is used if an object affects all
912 * all stats. Also, room must be reserved for a sentinel NULL pointer.
914 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
916 * This list includes extra attacks, for simplicity.
918 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
919 N_ELEMENTS(pval_flags1_desc) + 1];
925 * An "object analysis structure"
927 * It will be filled with descriptive strings detailing an object's
928 * various magical powers. The "ignore X" traits are not noted since
929 * all artifacts ignore "normal" destruction.
934 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
935 char description[MAX_NLEN];
937 /* Description of what is affected by an object's pval */
938 pval_info_type pval_info;
940 /* A list of an object's slaying preferences */
941 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
943 /* A list if an object's elemental brands */
944 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
946 /* A list of immunities granted by an object */
947 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
949 /* A list of resistances granted by an object */
950 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
952 /* A list of stats sustained by an object */
953 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
955 /* A list of various magical qualities an object may have */
956 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
957 + 1 /* Permanent Light */
959 + 1 /* type of curse */
960 + 1]; /* sentinel NULL */
962 /* Additional ability or resistance */
965 /* A string describing an artifact's activation */
968 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
974 * @brief ファイルポインタ先に同じ文字を複数出力する /
975 * Write out `n' of the character `c' to the spoiler file
980 static void spoiler_out_n_chars(int n, char c)
982 while (--n >= 0) fputc(c, fff);
987 * @brief ファイルポインタ先に改行を複数出力する /
988 * Write out `n' blank lines to the spoiler file
992 static void spoiler_blanklines(int n)
994 spoiler_out_n_chars(n, '\n');
999 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1000 * Write a line to the spoiler file and then "underline" it with hypens
1001 * @param str 出力したい文字列
1004 static void spoiler_underline(cptr str)
1006 fprintf(fff, "%s\n", str);
1007 spoiler_out_n_chars(strlen(str), '-');
1014 * @brief アーティファクトの特性一覧を出力する /
1015 * Write a line to the spoiler file and then "underline" it with hypens
1016 * @param art_flags アーティファクトのフラグ群
1017 * @param flag_ptr フラグ記述情報の参照ポインタ
1018 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1019 * @param n_elmnts フラグの要素数
1020 * @return desc_ptrと同じアドレス
1023 * This function does most of the actual "analysis". Given a set of bit flags
1024 * (which will be from one of the flags fields from the object in question),
1025 * a "flag description structure", a "description list", and the number of
1026 * elements in the "flag description structure", this function sets the
1027 * "description list" members to the appropriate descriptions contained in
1028 * the "flag description structure".
1029 * The possibly updated description pointer is returned.
1032 static cptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
1033 const flag_desc *flag_ptr,
1034 cptr *desc_ptr, const int n_elmnts)
1038 for (i = 0; i < n_elmnts; ++i)
1040 if (have_flag(art_flags, flag_ptr[i].flag))
1042 *desc_ptr++ = flag_ptr[i].desc;
1051 * @brief アイテムの特定記述内容を返す /
1052 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1053 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1054 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1057 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1059 /* Get a "useful" description of the object */
1060 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1065 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1066 * List "player traits" altered by an artifact's pval. These include stats,
1067 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1068 * @param o_ptr オブジェクト構造体の参照ポインタ
1069 * @param p_ptr pval修正構造体の参照ポインタ
1072 static void analyze_pval(object_type *o_ptr, pval_info_type *pi_ptr)
1074 BIT_FLAGS flgs[TR_FLAG_SIZE];
1078 /* If pval == 0, there is nothing to do. */
1081 /* An "empty" pval description indicates that pval == 0 */
1082 pi_ptr->pval_desc[0] = '\0';
1086 /* Extract the flags */
1087 object_flags(o_ptr, flgs);
1089 affects_list = pi_ptr->pval_affects;
1091 /* Create the "+N" string */
1092 sprintf(pi_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1094 /* First, check to see if the pval affects all stats */
1095 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1096 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1097 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1099 *affects_list++ = _("全能力", "All stats");
1102 /* Are any stats affected? */
1103 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1104 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1105 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1107 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1109 N_ELEMENTS(stat_flags_desc));
1112 /* And now the "rest" */
1113 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1115 N_ELEMENTS(pval_flags1_desc));
1117 /* Terminate the description list */
1118 *affects_list = NULL;
1122 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1123 * Note the slaying specialties of a weapon
1124 * @param o_ptr オブジェクト構造体の参照ポインタ
1125 * @param slay_list 種族スレイ構造体の参照ポインタ
1128 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1130 BIT_FLAGS flgs[TR_FLAG_SIZE];
1132 object_flags(o_ptr, flgs);
1134 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1135 N_ELEMENTS(slay_flags_desc));
1137 /* Terminate the description list */
1143 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1144 * Note an object's elemental brands
1145 * @param o_ptr オブジェクト構造体の参照ポインタ
1146 * @param brand_list 属性ブランド構造体の参照ポインタ
1149 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1151 BIT_FLAGS flgs[TR_FLAG_SIZE];
1153 object_flags(o_ptr, flgs);
1155 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1156 N_ELEMENTS(brand_flags_desc));
1158 /* Terminate the description list */
1164 * @brief アーティファクトの通常耐性を構造体に収める /
1165 * Note an object's elemental brands
1166 * @param o_ptr オブジェクト構造体の参照ポインタ
1167 * @param resist_list 通常耐性構造体の参照ポインタ
1170 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1172 BIT_FLAGS flgs[TR_FLAG_SIZE];
1174 object_flags(o_ptr, flgs);
1176 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1177 resist_list, N_ELEMENTS(resist_flags_desc));
1179 /* Terminate the description list */
1180 *resist_list = NULL;
1185 * @brief アーティファクトの免疫特性を構造体に収める /
1186 * Note the immunities granted by an object
1187 * @param o_ptr オブジェクト構造体の参照ポインタ
1188 * @param immune_list 免疫構造体の参照ポインタ
1191 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1193 BIT_FLAGS flgs[TR_FLAG_SIZE];
1195 object_flags(o_ptr, flgs);
1197 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1198 immune_list, N_ELEMENTS(immune_flags_desc));
1200 /* Terminate the description list */
1201 *immune_list = NULL;
1206 * @brief アーティファクトの維持特性を構造体に収める /
1207 * Note which stats an object sustains
1208 * @param o_ptr オブジェクト構造体の参照ポインタ
1209 * @param sustain_list 維持特性構造体の参照ポインタ
1212 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1214 BIT_FLAGS flgs[TR_FLAG_SIZE];
1216 object_flags(o_ptr, flgs);
1218 /* Simplify things if an item sustains all stats */
1219 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1220 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1221 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1223 *sustain_list++ = _("全能力", "All stats");
1226 /* Should we bother? */
1227 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1228 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1229 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1231 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1233 N_ELEMENTS(sustain_flags_desc));
1236 /* Terminate the description list */
1237 *sustain_list = NULL;
1242 * @brief アーティファクトのその他の特性を構造体に収める /
1243 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1244 * free action, permanent light, etc.
1245 * @param o_ptr オブジェクト構造体の参照ポインタ
1246 * @param misc_list その他の特性構造体の参照ポインタ
1249 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1251 BIT_FLAGS flgs[TR_FLAG_SIZE];
1255 object_flags(o_ptr, flgs);
1257 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1258 N_ELEMENTS(misc_flags2_desc));
1260 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1261 N_ELEMENTS(misc_flags3_desc));
1264 * Glowing artifacts -- small radius light.
1267 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1268 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1269 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1270 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1271 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1272 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1274 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1276 if (have_flag(flgs, TR_LITE_FUEL))
1278 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
1282 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), (int)rad);
1283 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), (int)-rad);
1286 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1289 * Handle cursed objects here to avoid redundancies such as noting
1290 * that a permanently cursed object is heavily cursed as well as
1291 * being "lightly cursed".
1294 /* if (object_is_cursed(o_ptr)) */
1296 if (have_flag(flgs, TR_TY_CURSE))
1298 *misc_list++ = _("太古の怨念", "Ancient Curse");
1300 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1302 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1304 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1306 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1309 else if (o_ptr->curse_flags & TRC_CURSED)
1311 *misc_list++ = _("呪い", "Cursed");
1313 if (have_flag(flgs, TR_ADD_L_CURSE))
1315 *misc_list++ = _("呪いを増やす", "Cursing");
1317 if (have_flag(flgs, TR_ADD_H_CURSE))
1319 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1323 /* Terminate the description list */
1329 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1330 * Note additional ability and/or resistance of fixed artifacts
1331 * @param o_ptr オブジェクト構造体の参照ポインタ
1332 * @param addition 追加ランダム耐性構造体の参照ポインタ
1335 static void analyze_addition(object_type *o_ptr, char *addition)
1337 artifact_type *a_ptr = &a_info[o_ptr->name1];
1340 strcpy(addition, "");
1343 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1344 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1346 strcat(addition, "能力");
1347 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1349 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1351 strcat(addition, "耐性");
1352 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1354 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1356 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1357 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1359 strcat(addition, "Ability");
1360 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1362 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1364 strcat(addition, "Resistance");
1365 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1367 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1373 * @brief アーティファクトの基本情報を文字列に収める /
1374 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1375 * and its value in gold pieces
1376 * @param o_ptr オブジェクト構造体の参照ポインタ
1377 * @param misc_desc 基本情報を収める文字列参照ポインタ
1380 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1382 artifact_type *a_ptr = &a_info[o_ptr->name1];
1384 sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"),
1385 (int)a_ptr->level, a_ptr->rarity,
1387 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1389 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1395 * @brief アーティファクトの情報全体を構造体に収める /
1396 * Fill in an object description structure for a given object
1397 * and its value in gold pieces
1398 * @param o_ptr オブジェクト構造体の参照ポインタ
1399 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1402 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1404 analyze_general(o_ptr, desc_ptr->description);
1405 analyze_pval(o_ptr, &desc_ptr->pval_info);
1406 analyze_brand(o_ptr, desc_ptr->brands);
1407 analyze_slay(o_ptr, desc_ptr->slays);
1408 analyze_immune(o_ptr, desc_ptr->immunities);
1409 analyze_resist(o_ptr, desc_ptr->resistances);
1410 analyze_sustains(o_ptr, desc_ptr->sustains);
1411 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1412 analyze_addition(o_ptr, desc_ptr->addition);
1413 analyze_misc(o_ptr, desc_ptr->misc_desc);
1414 desc_ptr->activation = item_activation(o_ptr);
1419 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1422 static void print_header(void)
1426 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1427 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1428 spoiler_underline(buf);
1432 * This is somewhat ugly.
1434 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1435 * and a separator character (',', e.g.), write the list to the spoiler file
1436 * in a "nice" format, such as:
1438 * Resist Fire, Cold, Acid
1440 * That was a simple example, but when the list is long, a line wrap
1441 * should occur, and this should induce a new level of indention if
1442 * a list is being spread across lines. So for example, Bladeturner's
1443 * list of resistances should look something like this
1445 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1446 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1448 * However, the code distinguishes between a single list of many items vs.
1449 * many lists. (The separator is used to make this determination.) A single
1450 * list of many items will not cause line wrapping (since there is no
1451 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1452 * might look like this:
1454 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1457 * So comparing the two, "Regeneration" has no trailing separator and
1458 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1459 * but that's not relevant to line wrapping and indention.)
1462 /* ITEM_SEP separates items within a list */
1463 #define ITEM_SEP ','
1466 /* LIST_SEP separates lists */
1468 #define LIST_SEP ','
1470 #define LIST_SEP ';'
1474 * @brief フラグ名称を出力する汎用関数
1475 * @param header ヘッダに出力するフラグ群の名前
1476 * @param list フラグ名リスト
1477 * @param separator フラグ表示の区切り記号
1480 static void spoiler_outlist(cptr header, cptr *list, char separator)
1482 int line_len, buf_len;
1483 char line[MAX_LINE_LEN+1], buf[80];
1485 /* Ignore an empty list */
1486 if (*list == NULL) return;
1488 /* This function always indents */
1489 strcpy(line, INDENT1);
1491 /* Create header (if one was given) */
1492 if (header && (header[0]))
1494 strcat(line, header);
1498 line_len = strlen(line);
1500 /* Now begin the tedious task */
1503 /* Copy the current item to a buffer */
1506 /* Note the buffer's length */
1507 buf_len = strlen(buf);
1510 * If there is an item following this one, pad with separator and
1511 * a space and adjust the buffer length
1516 sprintf(buf + buf_len, "%c ", separator);
1521 * If the buffer will fit on the current line, just append the
1522 * buffer to the line and adjust the line length accordingly.
1525 if (line_len + buf_len <= MAX_LINE_LEN)
1528 line_len += buf_len;
1531 /* Apply line wrapping and indention semantics described above */
1535 * Don't print a trailing list separator but do print a trailing
1538 if (line_len > 1 && line[line_len - 1] == ' '
1539 && line[line_len - 2] == LIST_SEP)
1541 /* Ignore space and separator */
1542 line[line_len - 2] = '\0';
1544 /* Write to spoiler file */
1545 fprintf(fff, "%s\n", line);
1547 /* Begin new line at primary indention level */
1548 sprintf(line, "%s%s", INDENT1, buf);
1553 /* Write to spoiler file */
1554 fprintf(fff, "%s\n", line);
1556 /* Begin new line at secondary indention level */
1557 sprintf(line, "%s%s", INDENT2, buf);
1560 line_len = strlen(line);
1563 /* Advance, with break */
1564 if (!*++list) break;
1567 /* Write what's left to the spoiler file */
1568 fprintf(fff, "%s\n", line);
1572 * @brief アーティファクト一件をスポイラー出力する /
1573 * Create a spoiler file entry for an artifact
1574 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1577 static void spoiler_print_art(obj_desc_list *art_ptr)
1579 pval_info_type *pval_ptr = &art_ptr->pval_info;
1583 /* Don't indent the first line */
1584 fprintf(fff, "%s\n", art_ptr->description);
1586 /* An "empty" pval description indicates that the pval affects nothing */
1587 if (pval_ptr->pval_desc[0])
1589 /* Mention the effects of pval */
1590 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
1591 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1594 /* Now deal with the description lists */
1597 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1598 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1599 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1600 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1601 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1603 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1604 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1605 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1606 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1607 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1609 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1611 if (art_ptr->addition[0])
1613 fprintf(fff, _("%s追加: %s\n", "%sAdditional %s\n"), INDENT1, art_ptr->addition);
1616 /* Write out the possible activation at the primary indention level */
1617 if (art_ptr->activation)
1619 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
1622 /* End with the miscellaneous facts */
1623 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1628 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1629 * Hack -- Create a "forged" artifact
1630 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1631 * @param name1 生成するアーティファクトID
1632 * @return 生成が成功した場合TRUEを返す
1634 static bool make_fake_artifact(object_type *o_ptr, IDX name1)
1638 artifact_type *a_ptr = &a_info[name1];
1641 /* Ignore "empty" artifacts */
1642 if (!a_ptr->name) return FALSE;
1644 /* Acquire the "kind" index */
1645 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1647 if (!i) return (FALSE);
1649 /* Create the artifact */
1650 object_prep(o_ptr, i);
1653 o_ptr->name1 = (byte_hack)name1;
1655 /* Extract the fields */
1656 o_ptr->pval = a_ptr->pval;
1657 o_ptr->ac = a_ptr->ac;
1658 o_ptr->dd = a_ptr->dd;
1659 o_ptr->ds = a_ptr->ds;
1660 o_ptr->to_a = a_ptr->to_a;
1661 o_ptr->to_h = a_ptr->to_h;
1662 o_ptr->to_d = a_ptr->to_d;
1663 o_ptr->weight = a_ptr->weight;
1671 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1672 * Create a spoiler file for artifacts
1673 * @param fname 生成ファイル名
1676 static void spoil_artifact(cptr fname)
1684 obj_desc_list artifact;
1689 /* Build the filename */
1690 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1692 /* File type is "TEXT" */
1693 FILE_TYPE(FILE_TYPE_TEXT);
1696 fff = my_fopen(buf, "w");
1700 msg_print("Cannot create spoiler file.");
1704 /* Dump the header */
1707 /* List the artifacts by tval */
1708 for (i = 0; group_artifact[i].tval; i++)
1710 /* Write out the group title */
1711 if (group_artifact[i].name)
1713 spoiler_blanklines(2);
1714 spoiler_underline(group_artifact[i].name);
1715 spoiler_blanklines(1);
1718 /* Now search through all of the artifacts */
1719 for (j = 1; j < max_a_idx; ++j)
1721 artifact_type *a_ptr = &a_info[j];
1723 /* We only want objects in the current group */
1724 if (a_ptr->tval != group_artifact[i].tval) continue;
1726 /* Get local object */
1730 /* Attempt to "forge" the artifact */
1731 if (!make_fake_artifact(q_ptr, j)) continue;
1733 /* Analyze the artifact */
1734 object_analyze(q_ptr, &artifact);
1736 /* Write out the artifact description to the spoiler file */
1737 spoiler_print_art(&artifact);
1741 /* Check for errors */
1742 if (ferror(fff) || my_fclose(fff))
1744 msg_print("Cannot close spoiler file.");
1748 msg_print("Successfully created a spoiler file.");
1753 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1754 * Create a spoiler file for monsters -BEN-
1755 * @param fname 生成ファイル名
1758 static void spoil_mon_desc(cptr fname)
1775 /* Build the filename */
1776 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1778 /* File type is "TEXT" */
1779 FILE_TYPE(FILE_TYPE_TEXT);
1782 fff = my_fopen(buf, "w");
1786 msg_print("Cannot create spoiler file.");
1790 /* Allocate the "who" array */
1791 C_MAKE(who, max_r_idx, s16b);
1793 /* Dump the header */
1794 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1795 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1796 fprintf(fff, "------------------------------------------\n\n");
1798 /* Dump the header */
1799 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1800 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1801 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1802 "--------", "---", "---", "---", "--", "--", "-----------");
1805 /* Scan the monsters */
1806 for (i = 1; i < max_r_idx; i++)
1808 monster_race *r_ptr = &r_info[i];
1810 /* Use that monster */
1811 if (r_ptr->name) who[n++] = (s16b)i;
1814 /* Select the sort method */
1815 ang_sort_comp = ang_sort_comp_hook;
1816 ang_sort_swap = ang_sort_swap_hook;
1818 /* Sort the array by dungeon depth of monsters */
1819 ang_sort(who, &why, n);
1822 for (i = 0; i < n; i++)
1824 monster_race *r_ptr = &r_info[who[i]];
1826 cptr name = (r_name + r_ptr->name);
1827 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1829 /* Get the "name" */
1831 else if (r_ptr->flags3 & (RF3_NO_CONF))
1833 sprintf(nam, "[*] %s", name);
1836 else if (r_ptr->flags1 & (RF1_UNIQUE))
1838 sprintf(nam, "[U] %s", name);
1842 sprintf(nam, _(" %s", "The %s"), name);
1847 sprintf(lev, "%d", (int)r_ptr->level);
1850 sprintf(rar, "%d", (int)r_ptr->rarity);
1853 if (r_ptr->speed >= 110)
1855 sprintf(spd, "+%d", (r_ptr->speed - 110));
1859 sprintf(spd, "-%d", (110 - r_ptr->speed));
1863 sprintf(ac, "%d", r_ptr->ac);
1866 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1868 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1872 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1877 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1879 /* Hack -- use visual instead */
1880 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1883 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1884 nam, lev, rar, spd, hp, ac, exp);
1891 /* Free the "who" array */
1892 C_KILL(who, max_r_idx, s16b);
1894 /* Check for errors */
1895 if (ferror(fff) || my_fclose(fff))
1897 msg_print("Cannot close spoiler file.");
1902 msg_print("Successfully created a spoiler file.");
1909 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1911 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1917 * @brief 文字列をファイルポインタに出力する /
1918 * Buffer text to the given file. (-SHAWN-)
1919 * This is basically c_roff() from mon-desc.c with a few changes.
1920 * @param str 文字列参照ポインタ
1923 static void spoil_out(cptr str)
1928 static char roff_buf[256];
1931 static char roff_waiting_buf[256];
1934 bool iskanji_flag = FALSE;
1936 /* Current pointer into line roff_buf */
1937 static char *roff_p = roff_buf;
1939 /* Last space saved into roff_buf */
1940 static char *roff_s = NULL;
1942 /* Mega-Hack -- Delayed output */
1943 static bool waiting_output = FALSE;
1945 /* Special handling for "new sequence" */
1950 fputs(roff_waiting_buf, fff);
1951 waiting_output = FALSE;
1954 if (roff_p != roff_buf) roff_p--;
1955 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
1957 if (roff_p == roff_buf) fprintf(fff, "\n");
1960 *(roff_p + 1) = '\0';
1961 fprintf(fff, "%s\n\n", roff_buf);
1970 /* Scan the given string, character at a time */
1975 bool k_flag = iskanji((unsigned char)(*str));
1978 bool wrap = (ch == '\n');
1981 if (!isprint((unsigned char)ch) && !k_flag && !iskanji_flag) ch = ' ';
1982 iskanji_flag = k_flag && !iskanji_flag;
1984 if (!isprint(ch)) ch = ' ';
1989 fputs(roff_waiting_buf, fff);
1990 if (!wrap) fputc('\n', fff);
1991 waiting_output = FALSE;
1997 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
1998 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2000 if (roff_p >= roff_buf + 75) wrap = TRUE;
2001 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2008 bool iskanji_flag_local = FALSE;
2009 cptr tail = str + (k_flag ? 2 : 1);
2011 cptr tail = str + 1;
2014 for (; *tail; tail++)
2016 if (*tail == ' ') continue;
2019 k_flag_local = iskanji((unsigned char)(*tail));
2020 if (isprint((unsigned char)*tail) || k_flag_local || iskanji_flag_local) break;
2021 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2023 if (isprint(*tail)) break;
2027 if (!*tail) waiting_output = TRUE;
2031 /* Handle line-wrap */
2039 if (roff_s && (ch != ' '))
2047 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2048 else strcpy(roff_waiting_buf, roff_buf);
2052 if (cbak != ' ') *roff_p++ = cbak;
2054 while (*r) *roff_p++ = *r++;
2058 if ((roff_p > roff_buf) || (ch != ' '))
2063 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2068 strncmp(str, "。", 2) != 0 &&
2069 strncmp(str, "、", 2) != 0 &&
2070 strncmp(str, "ィ", 2) != 0 &&
2071 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2074 if (ch == ' ') roff_s = roff_p;
2085 * @brief 関数ポインタ用の出力関数 /
2086 * Hook function used in spoil_mon_info()
2088 * @param str 文字列参照ポインタ
2091 static void roff_func(byte attr, cptr str)
2101 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2102 * Create a spoiler file for monsters (-SHAWN-)
2103 * @param fname ファイル名
2106 static void spoil_mon_info(cptr fname)
2115 /* Build the filename */
2116 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2118 /* File type is "TEXT" */
2119 FILE_TYPE(FILE_TYPE_TEXT);
2122 fff = my_fopen(buf, "w");
2126 msg_print("Cannot create spoiler file.");
2131 /* Dump the header */
2132 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2133 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2136 spoil_out("------------------------------------------\n\n");
2138 /* Allocate the "who" array */
2139 C_MAKE(who, max_r_idx, s16b);
2141 /* Scan the monsters */
2142 for (i = 1; i < max_r_idx; i++)
2144 monster_race *r_ptr = &r_info[i];
2146 /* Use that monster */
2147 if (r_ptr->name) who[n++] = (s16b)i;
2150 /* Select the sort method */
2151 ang_sort_comp = ang_sort_comp_hook;
2152 ang_sort_swap = ang_sort_swap_hook;
2154 /* Sort the array by dungeon depth of monsters */
2155 ang_sort(who, &why, n);
2159 * List all monsters in order
2161 for (l = 0; l < n; l++)
2163 monster_race *r_ptr = &r_info[who[l]];
2165 /* Extract the flags */
2166 flags1 = r_ptr->flags1;
2170 if (flags1 & (RF1_QUESTOR))
2176 if (flags1 & (RF1_UNIQUE))
2188 sprintf(buf, _("%s/%s (", "%s ("), (r_name + r_ptr->name), _(r_name+r_ptr->E_name, "")); /* ---)--- */
2193 spoil_out(attr_to_text(r_ptr));
2196 sprintf(buf, " '%c')\n", r_ptr->d_char);
2201 sprintf(buf, "=== ");
2205 sprintf(buf, "Num:%d ", who[l]);
2209 sprintf(buf, "Lev:%d ", (int)r_ptr->level);
2213 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2217 if (r_ptr->speed >= 110)
2219 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2223 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2228 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2230 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2234 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2239 sprintf(buf, "Ac:%d ", r_ptr->ac);
2243 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2246 /* Reuse the code of monster recall. */
2247 output_monster_spoiler(who[l], roff_func);
2252 /* Free the "who" array */
2253 C_KILL(who, max_r_idx, s16b);
2255 /* Check for errors */
2256 if (ferror(fff) || my_fclose(fff))
2258 msg_print("Cannot close spoiler file.");
2262 msg_print("Successfully created a spoiler file.");
2267 #define MAX_EVOL_DEPTH 64
2271 * @brief int配列でstrncmp()と似た比較処理を行う /
2272 * Compare two int-type array like strncmp() and return TRUE if equals
2273 * @param a 比較するint配列1
2274 * @param b 比較するint配列2
2276 * @return 両者の値が等しければTRUEを返す
2278 static bool int_n_cmp(int *a, int *b, int length)
2280 /* Null-string comparation is always TRUE */
2281 if (!length) return TRUE;
2285 if (*a != *(b++)) return FALSE;
2286 if (!(*(a++))) break;
2295 * @brief ある木が指定された木の部分木かどうかを返す /
2296 * Returns TRUE if an evolution tree is "partial tree"
2297 * @param tree 元となる木構造リスト
2298 * @param partial_tree 部分木かどうか判定したい木構造リスト
2299 * @return 部分木ならばTRUEを返す
2301 static bool is_partial_tree(int *tree, int *partial_tree)
2303 int pt_head = *(partial_tree++);
2306 while (partial_tree[pt_len]) pt_len++;
2310 if (*(tree++) == pt_head)
2312 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2321 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2322 * Sorting hook -- Comp function
2325 * @param a 比較したいモンスター種族ID1
2326 * @param b 比較したいモンスター種族ID2
2327 * @return 2が大きければTRUEを返す
2329 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2331 int **evol_tree = (int **)u;
2333 int w1 = evol_tree[a][0];
2334 int w2 = evol_tree[b][0];
2335 monster_race *r1_ptr = &r_info[w1];
2336 monster_race *r2_ptr = &r_info[w2];
2341 /* Used tree first */
2342 if (w1 && !w2) return TRUE;
2343 if (!w1 && w2) return FALSE;
2345 /* Sort by monster level */
2346 if (r1_ptr->level < r2_ptr->level) return TRUE;
2347 if (r1_ptr->level > r2_ptr->level) return FALSE;
2349 /* Sort by monster experience */
2350 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2351 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2353 /* Compare indexes */
2358 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2359 * Sorting hook -- Swap function
2362 * @param a スワップしたい木構造1
2363 * @param b スワップしたい木構造2
2364 * @return 2が大きければTRUEを返す
2366 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2368 int **evol_tree = (int **)u;
2375 holder = evol_tree[a];
2376 evol_tree[a] = evol_tree[b];
2377 evol_tree[b] = holder;
2381 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2382 * Print monsters' evolution information to file
2383 * @param fname 出力ファイル名
2386 static void spoil_mon_evol(cptr fname)
2389 monster_race *r_ptr;
2390 int **evol_tree, i, j, n, r_idx;
2391 int *evol_tree_zero; /* For C_KILL() */
2393 /* Build the filename */
2394 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2396 /* File type is "TEXT" */
2397 FILE_TYPE(FILE_TYPE_TEXT);
2400 fff = my_fopen(buf, "w");
2404 msg_print("Cannot create spoiler file.");
2408 /* Dump the header */
2409 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2410 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2413 spoil_out("------------------------------------------\n\n");
2415 /* Allocate the "evol_tree" array (2-dimension) */
2416 C_MAKE(evol_tree, max_r_idx, int *);
2417 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2418 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2419 evol_tree_zero = *evol_tree;
2421 /* Step 1: Build the evolution tree */
2422 for (i = 1; i < max_r_idx; i++)
2427 if (!r_ptr->next_exp) continue;
2429 /* Trace evolution */
2431 evol_tree[i][n++] = i;
2434 evol_tree[i][n++] = r_ptr->next_r_idx;
2435 r_ptr = &r_info[r_ptr->next_r_idx];
2437 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2440 /* Step 2: Scan the evolution trees and remove "partial tree" */
2441 for (i = 1; i < max_r_idx; i++)
2443 /* Not evolution tree */
2444 if (!evol_tree[i][0]) continue;
2446 for (j = 1; j < max_r_idx; j++)
2449 if (i == j) continue;
2451 /* Not evolution tree */
2452 if (!evol_tree[j][0]) continue;
2454 /* Is evolution tree[i] is part of [j]? */
2455 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2457 /* Remove this evolution tree */
2458 evol_tree[i][0] = 0;
2464 /* Step 3: Sort the evolution trees */
2466 /* Select the sort method */
2467 ang_sort_comp = ang_sort_comp_evol_tree;
2468 ang_sort_swap = ang_sort_swap_evol_tree;
2470 /* Sort the array */
2471 ang_sort(evol_tree, NULL, max_r_idx);
2473 /* Step 4: Print the evolution trees */
2474 for (i = 0; i < max_r_idx; i++)
2476 r_idx = evol_tree[i][0];
2478 /* No evolution or removed evolution tree */
2479 if (!r_idx) continue;
2481 /* Trace the evolution tree */
2482 r_ptr = &r_info[r_idx];
2483 fprintf(fff, _("[%d]: %s (レベル%d, '%c')\n", "[%d]: %s (Level %d, '%c')\n"),
2484 r_idx, r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2486 for (n = 1; r_ptr->next_exp; n++)
2488 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2489 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2490 r_ptr = &r_info[r_ptr->next_r_idx];
2491 fprintf(fff, _("%s (レベル%d, '%c')\n", "%s (Level %d, '%c')\n"),
2492 r_name + r_ptr->name, (int)r_ptr->level, r_ptr->d_char);
2495 /* End of evolution tree */
2499 /* Free the "evol_tree" array (2-dimension) */
2500 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2501 C_KILL(evol_tree, max_r_idx, int *);
2503 /* Check for errors */
2504 if (ferror(fff) || my_fclose(fff))
2506 msg_print("Cannot close spoiler file.");
2510 msg_print("Successfully created a spoiler file.");
2518 extern void do_cmd_spoilers(void);
2521 * @brief スポイラー出力を行うコマンドのメインルーチン /
2522 * Create Spoiler files -BEN-
2525 void do_cmd_spoilers(void)
2527 /* Save the screen */
2537 prt("Create a spoiler file.", 2, 0);
2539 /* Prompt for a file */
2540 prt("(1) Brief Object Info (obj-desc.txt)", 5, 5);
2541 prt("(2) Brief Artifact Info (artifact.txt)", 6, 5);
2542 prt("(3) Brief Monster Info (mon-desc.txt)", 7, 5);
2543 prt("(4) Full Monster Info (mon-info.txt)", 8, 5);
2544 prt("(5) Monster Evolution Info (mon-evol.txt)", 9, 5);
2547 prt(_("コマンド:", "Command: "), _(18, 12), 0);
2554 /* Restore the screen */
2560 spoil_obj_desc("obj-desc.txt");
2565 spoil_artifact("artifact.txt");
2570 spoil_mon_desc("mon-desc.txt");
2575 spoil_mon_info("mon-info.txt");
2580 spoil_mon_evol("mon-evol.txt");
2588 /* Flush messages */
2594 * @brief ランダムアーティファクト1件を解析する /
2595 * Fill in an object description structure for a given object
2596 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2597 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2600 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2602 analyze_general(o_ptr, desc_ptr->description);
2603 analyze_pval(o_ptr, &desc_ptr->pval_info);
2604 analyze_brand(o_ptr, desc_ptr->brands);
2605 analyze_slay(o_ptr, desc_ptr->slays);
2606 analyze_immune(o_ptr, desc_ptr->immunities);
2607 analyze_resist(o_ptr, desc_ptr->resistances);
2608 analyze_sustains(o_ptr, desc_ptr->sustains);
2609 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2610 desc_ptr->activation = item_activation(o_ptr);
2612 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2613 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2615 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2616 o_ptr->weight / 10, o_ptr->weight % 10);
2621 * @brief ランダムアーティファクト1件をスポイラー出力する /
2622 * Create a spoiler file entry for an artifact
2623 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2624 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2625 * Fill in an object description structure for a given object
2628 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2630 pval_info_type *pval_ptr = &art_ptr->pval_info;
2634 /* Don't indent the first line */
2635 fprintf(fff, "%s\n", art_ptr->description);
2638 if (!(o_ptr->ident & (IDENT_MENTAL)))
2640 fprintf(fff, _("%s不明\n", "%sUnknown\n"),INDENT1);
2643 /* An "empty" pval description indicates that the pval affects nothing */
2644 if (pval_ptr->pval_desc[0])
2646 /* Mention the effects of pval */
2647 sprintf(buf, _("%sの修正:", "%s to"), pval_ptr->pval_desc);
2648 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2651 /* Now deal with the description lists */
2654 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2655 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2656 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2657 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2658 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2660 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2661 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2662 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2663 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2664 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2666 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2668 /* Write out the possible activation at the primary indention level */
2669 if (art_ptr->activation)
2671 fprintf(fff, _("%s発動: %s\n", "%sActivates for %s\n"), INDENT1, art_ptr->activation);
2674 /* End with the miscellaneous facts */
2675 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2680 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2681 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2682 * @param i 出力したい記録ランダムアーティファクトID
2685 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2687 obj_desc_list artifact;
2689 if (!object_is_known(o_ptr) || !o_ptr->art_name
2690 || o_ptr->tval != group_artifact[i].tval)
2693 /* Analyze the artifact */
2694 random_artifact_analyze(o_ptr, &artifact);
2696 /* Write out the artifact description to the spoiler file */
2697 spoiler_print_randart(o_ptr, &artifact);
2701 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2702 * Create a list file for random artifacts
2703 * @param fname 出力ファイル名
2706 void spoil_random_artifact(cptr fname)
2716 /* Build the filename */
2717 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2719 /* File type is "TEXT" */
2720 FILE_TYPE(FILE_TYPE_TEXT);
2723 fff = my_fopen(buf, "w");
2727 msg_print("Cannot create list file.");
2731 /* Dump the header */
2732 sprintf(buf, "Random artifacts list.\r");
2733 spoiler_underline(buf);
2735 /* List the artifacts by tval */
2736 for (j = 0; group_artifact[j].tval; j++)
2738 /* random artifacts wielding */
2739 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2741 q_ptr = &inventory[i];
2742 spoil_random_artifact_aux(q_ptr, j);
2745 /* random artifacts in inventory */
2746 for (i = 0; i < INVEN_PACK; i++)
2748 q_ptr = &inventory[i];
2749 spoil_random_artifact_aux(q_ptr, j);
2752 /* random artifacts in home */
2753 st_ptr = &town[1].store[STORE_HOME];
2754 for (i = 0; i < st_ptr->stock_num; i++)
2756 q_ptr = &st_ptr->stock[i];
2757 spoil_random_artifact_aux(q_ptr, j);
2760 /* random artifacts in museum */
2761 st_ptr = &town[1].store[STORE_MUSEUM];
2762 for (i = 0; i < st_ptr->stock_num; i++)
2764 q_ptr = &st_ptr->stock[i];
2765 spoil_random_artifact_aux(q_ptr, j);
2769 /* Check for errors */
2770 if (ferror(fff) || my_fclose(fff))
2772 msg_print("Cannot close list file.");
2776 msg_print("Successfully created a list file.");
2783 #endif /* MACINTOSH */