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[] =
130 { TV_DIGGING, "武器" },
132 { TV_DIGGING, "Weapons" },
135 { TV_POLEARM, NULL },
140 { TV_SOFT_ARMOR, "防具 (体)" },
142 { TV_SOFT_ARMOR, "Armour (Body)" },
145 { TV_HARD_ARMOR, NULL },
146 { TV_DRAG_ARMOR, NULL },
149 { TV_BOOTS, "防具 (その他)" },
151 { TV_BOOTS, "Armour (Misc)" },
162 { TV_AMULET, "アミュレット" },
165 { TV_LITE, "Light Sources" },
166 { TV_AMULET, "Amulets" },
167 { TV_RING, "Rings" },
175 { TV_STAFF, "Staffs" },
176 { TV_WAND, "Wands" },
185 { TV_SCROLL, "Scrolls" },
186 { TV_POTION, "Potions" },
191 { TV_LIFE_BOOK, "魔法書 (生命)" },
192 { TV_SORCERY_BOOK, "魔法書 (仙術)" },
193 { TV_NATURE_BOOK, "魔法書 (自然)" },
194 { TV_CHAOS_BOOK, "魔法書 (カオス)" },
195 { TV_DEATH_BOOK, "魔法書 (暗黒)" },
196 { TV_TRUMP_BOOK, "魔法書 (トランプ)" },
197 { TV_ARCANE_BOOK, "魔法書 (秘術)" },
198 { TV_CRAFT_BOOK, "魔法書 (匠)" },
199 { TV_DAEMON_BOOK, "魔法書 (悪魔)" },
200 { TV_CRUSADE_BOOK, "魔法書 (破邪)" },
201 { TV_MUSIC_BOOK, "歌集" },
202 { TV_HISSATSU_BOOK, "武芸の書" },
203 { TV_HEX_BOOK, "魔法書 (呪術)" },
205 { TV_LIFE_BOOK, "Books (Life)" },
206 { TV_SORCERY_BOOK, "Books (Sorcery)" },
207 { TV_NATURE_BOOK, "Books (Nature)" },
208 { TV_CHAOS_BOOK, "Books (Chaos)" },
209 { TV_DEATH_BOOK, "Books (Death)" },
210 { TV_TRUMP_BOOK, "Books (Trump)" },
211 { TV_ARCANE_BOOK, "Books (Arcane)" },
212 { TV_CRAFT_BOOK, "Books (Craft)" },
213 { TV_DAEMON_BOOK, "Books (Daemon)" },
214 { TV_CRUSADE_BOOK, "Books (Crusade)" },
215 { TV_MUSIC_BOOK, "Song Books" },
216 { TV_HISSATSU_BOOK, "Books (Kendo)" },
217 { TV_HEX_BOOK, "Books (Hex)" },
222 { TV_CAPTURE, "キャプチャー・ボール" },
223 { TV_CARD, "エクスプレスカード" },
225 { TV_WHISTLE, "Whistle" },
226 { TV_CAPTURE, "Capture Ball" },
227 { TV_CARD, "Express Card" },
233 { TV_CHEST, "Chests" },
237 { TV_FIGURINE, "人形" },
241 { TV_FIGURINE, "Magical Figurines" },
242 { TV_STATUE, "Statues" },
243 { TV_CORPSE, "Corpses" },
247 { TV_SKELETON, "その他" },
249 { TV_SKELETON, "Misc" },
256 { TV_PARCHMENT, NULL },
263 * @brief ベースアイテムの各情報を文字列化する /
265 * @param buf 名称を返すバッファ参照ポインタ
266 * @param dam ダメージダイス記述を返すバッファ参照ポインタ
267 * @param wgt 重量記述を返すバッファ参照ポインタ
268 * @param lev 生成階記述を返すバッファ参照ポインタ
269 * @param val 価値を返すバッファ参照ポインタ
273 static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k)
279 /* Get local object */
282 /* Prepare a fake item */
283 object_prep(q_ptr, k);
286 q_ptr->ident |= (IDENT_KNOWN);
296 (*lev) = k_info[q_ptr->k_idx].level;
299 (*val) = object_value(q_ptr);
303 if (!buf || !dam || !wgt) return;
306 /* Description (too brief) */
307 object_desc(buf, q_ptr, (OD_NAME_ONLY | OD_STORE));
327 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
337 sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds);
352 sprintf(dam, "%d", q_ptr->ac);
359 sprintf(wgt, "%3d.%d", q_ptr->weight / 10, q_ptr->weight % 10);
364 * @brief 各ベースアイテムの情報を一行毎に記述する /
365 * Create a spoiler file for items
369 static void spoil_obj_desc(cptr fname)
371 int i, k, s, t, n = 0, group_start = 0;
381 /* Build the filename */
382 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
384 /* File type is "TEXT" */
385 FILE_TYPE(FILE_TYPE_TEXT);
388 fff = my_fopen(buf, "w");
393 msg_print("Cannot create spoiler file.");
399 fprintf(fff, "Spoiler File -- Basic Items (Hengband %d.%d.%d)\n\n\n",
400 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
403 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
404 "Description", "Dam/AC", "Wgt", "Lev", "Cost");
405 fprintf(fff, "%-45s %8s%7s%5s%9s\n",
406 "----------------------------------------",
407 "------", "---", "---", "----");
409 /* List the groups */
410 for (i = 0; TRUE; i++)
412 /* Write out the group title */
413 if (group_item[i].name)
417 /* Hack -- bubble-sort by cost and then level */
418 for (s = 0; s < n - 1; s++)
420 for (t = 0; t < n - 1; t++)
431 kind_info(NULL, NULL, NULL, &e1, &t1, who[i1]);
432 kind_info(NULL, NULL, NULL, &e2, &t2, who[i2]);
434 if ((t1 > t2) || ((t1 == t2) && (e1 > e2)))
443 fprintf(fff, "\n\n%s\n\n", group_item[group_start].name);
445 /* Spoil each item */
446 for (s = 0; s < n; s++)
451 /* Describe the kind */
452 kind_info(buf, dam, wgt, &e, &v, who[s]);
455 fprintf(fff, " %-45s%8s%7s%5d%9ld\n",
456 buf, dam, wgt, e, (long)(v));
459 /* Start a new set */
464 if (!group_item[i].tval) break;
466 /* Start a new set */
470 /* Acquire legal item types */
471 for (k = 1; k < max_k_idx; k++)
473 object_kind *k_ptr = &k_info[k];
475 /* Skip wrong tval's */
476 if (k_ptr->tval != group_item[i].tval) continue;
478 /* Hack -- Skip instant-artifacts */
479 if (k_ptr->gen_flags & (TRG_INSTA_ART)) continue;
487 /* Check for errors */
488 if (ferror(fff) || my_fclose(fff))
490 msg_print("Cannot close spoiler file.");
495 msg_print("Successfully created a spoiler file.");
500 * Artifact Spoilers by: randy@PICARD.tamu.edu (Randy Hutson)
505 * Returns a "+" string if a number is non-negative and an empty
508 #define POSITIZE(v) (((v) >= 0) ? "+" : "")
511 * These are used to format the artifact spoiler file. INDENT1 is used
512 * to indent all but the first line of an artifact spoiler. INDENT2 is
513 * used when a line "wraps". (Bladeturner's resistances cause this.)
519 * MAX_LINE_LEN specifies when a line should wrap.
521 #define MAX_LINE_LEN 75
524 * Given an array, determine how many elements are in the array
526 #define N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
529 * The artifacts categorized by type
531 static grouper group_artifact[] =
535 { TV_POLEARM, "槍/斧" },
537 { TV_DIGGING, "シャベル/つるはし" },
542 { TV_SOFT_ARMOR, "鎧" },
543 { TV_HARD_ARMOR, NULL },
544 { TV_DRAG_ARMOR, NULL },
546 { TV_CLOAK, "クローク" },
555 { TV_AMULET, "アミュレット" },
558 { TV_SWORD, "Edged Weapons" },
559 { TV_POLEARM, "Polearms" },
560 { TV_HAFTED, "Hafted Weapons" },
561 { TV_DIGGING, "Shovels/Picks" },
563 { TV_ARROW, "Ammo" },
566 { TV_SOFT_ARMOR, "Body Armor" },
567 { TV_HARD_ARMOR, NULL },
568 { TV_DRAG_ARMOR, NULL },
570 { TV_CLOAK, "Cloaks" },
571 { TV_SHIELD, "Shields" },
573 { TV_HELM, "Helms/Crowns" },
575 { TV_GLOVES, "Gloves" },
576 { TV_BOOTS, "Boots" },
578 { TV_LITE, "Light Sources" },
579 { TV_AMULET, "Amulets" },
580 { TV_RING, "Rings" },
589 * Pair together a constant flag with a textual description.
591 * Used by both "init.c" and "wiz-spo.c".
593 * Note that it sometimes more efficient to actually make an array
594 * of textual names, where entry 'N' is assumed to be paired with
595 * the flag whose value is "1L << N", but that requires hard-coding.
598 typedef struct flag_desc flag_desc;
603 const char *const desc;
609 * These are used for "+3 to STR, DEX", etc. These are separate from
610 * the other pval affected traits to simplify the case where an object
611 * affects all stats. In this case, "All stats" is used instead of
612 * listing each stat individually.
615 static flag_desc stat_flags_desc[] =
635 * Besides stats, these are the other player traits
636 * which may be affected by an object's pval
639 static flag_desc pval_flags1_desc[] =
642 { TR_MAGIC_MASTERY, "魔法道具使用能力" },
643 { TR_STEALTH, "隠密" },
645 { TR_INFRA, "赤外線視力" },
647 { TR_BLOWS, "攻撃回数" },
650 { TR_STEALTH, "Stealth" },
651 { TR_SEARCH, "Searching" },
652 { TR_INFRA, "Infravision" },
653 { TR_TUNNEL, "Tunneling" },
654 { TR_BLOWS, "Attacks" },
655 { TR_SPEED, "Speed" }
660 * Slaying preferences for weapons
663 static flag_desc slay_flags_desc[] =
666 { TR_SLAY_ANIMAL, "動物" },
667 { TR_KILL_ANIMAL, "*動物*" },
668 { TR_SLAY_EVIL, "邪悪" },
669 { TR_KILL_EVIL, "*邪悪*" },
670 { TR_SLAY_HUMAN, "人間" },
671 { TR_KILL_HUMAN, "*人間*" },
672 { TR_SLAY_UNDEAD, "アンデッド" },
673 { TR_KILL_UNDEAD, "*アンデッド*" },
674 { TR_SLAY_DEMON, "悪魔" },
675 { TR_KILL_DEMON, "*悪魔*" },
676 { TR_SLAY_ORC, "オーク" },
677 { TR_KILL_ORC, "*オーク*" },
678 { TR_SLAY_TROLL, "トロル" },
679 { TR_KILL_TROLL, "*トロル*" },
680 { TR_SLAY_GIANT, "巨人" },
681 { TR_KILL_GIANT, "*巨人*" },
682 { TR_SLAY_DRAGON, "ドラゴン" },
683 { TR_KILL_DRAGON, "*ドラゴン*" },
685 { TR_SLAY_ANIMAL, "Animal" },
686 { TR_KILL_ANIMAL, "XAnimal" },
687 { TR_SLAY_EVIL, "Evil" },
688 { TR_KILL_EVIL, "XEvil" },
689 { TR_SLAY_HUMAN, "Human" },
690 { TR_KILL_HUMAN, "XHuman" },
691 { TR_SLAY_UNDEAD, "Undead" },
692 { TR_KILL_UNDEAD, "XUndead" },
693 { TR_SLAY_DEMON, "Demon" },
694 { TR_KILL_DEMON, "XDemon" },
695 { TR_SLAY_ORC, "Orc" },
696 { TR_KILL_ORC, "XOrc" },
697 { TR_SLAY_TROLL, "Troll" },
698 { TR_KILL_TROLL, "XTroll" },
699 { TR_SLAY_GIANT, "Giant" },
700 { TR_KILL_GIANT, "Xgiant" },
701 { TR_SLAY_DRAGON, "Dragon" },
702 { TR_KILL_DRAGON, "Xdragon" }
707 * Elemental brands for weapons
709 * Clearly, TR1_IMPACT is a bit out of place here. To simplify
710 * coding, it has been included here along with the elemental
711 * brands. It does seem to fit in with the brands and slaying
712 * more than the miscellaneous section.
714 static flag_desc brand_flags_desc[] =
717 { TR_BRAND_ACID, "溶解" },
718 { TR_BRAND_ELEC, "電撃" },
719 { TR_BRAND_FIRE, "焼棄" },
720 { TR_BRAND_COLD, "凍結" },
721 { TR_BRAND_POIS, "毒殺" },
723 { TR_FORCE_WEAPON, "理力" },
724 { TR_CHAOTIC, "混沌" },
725 { TR_VAMPIRIC, "吸血" },
727 { TR_VORPAL, "切れ味" },
729 { TR_BRAND_ACID, "Acid Brand" },
730 { TR_BRAND_ELEC, "Lightning Brand" },
731 { TR_BRAND_FIRE, "Flame Tongue" },
732 { TR_BRAND_COLD, "Frost Brand" },
733 { TR_BRAND_POIS, "Poisoned" },
735 { TR_FORCE_WEAPON, "Force" },
736 { TR_CHAOTIC, "Mark of Chaos" },
737 { TR_VAMPIRIC, "Vampiric" },
738 { TR_IMPACT, "Earthquake impact on hit" },
739 { TR_VORPAL, "Very sharp" },
747 static const flag_desc resist_flags_desc[] =
750 { TR_RES_ACID, "酸" },
751 { TR_RES_ELEC, "電撃" },
752 { TR_RES_FIRE, "火炎" },
753 { TR_RES_COLD, "冷気" },
754 { TR_RES_POIS, "毒" },
755 { TR_RES_FEAR, "恐怖"},
756 { TR_RES_LITE, "閃光" },
757 { TR_RES_DARK, "暗黒" },
758 { TR_RES_BLIND, "盲目" },
759 { TR_RES_CONF, "混乱" },
760 { TR_RES_SOUND, "轟音" },
761 { TR_RES_SHARDS, "破片" },
762 { TR_RES_NETHER, "地獄" },
763 { TR_RES_NEXUS, "因果混乱" },
764 { TR_RES_CHAOS, "カオス" },
765 { TR_RES_DISEN, "劣化" },
767 { TR_RES_ACID, "Acid" },
768 { TR_RES_ELEC, "Lightning" },
769 { TR_RES_FIRE, "Fire" },
770 { TR_RES_COLD, "Cold" },
771 { TR_RES_POIS, "Poison" },
772 { TR_RES_FEAR, "Fear"},
773 { TR_RES_LITE, "Light" },
774 { TR_RES_DARK, "Dark" },
775 { TR_RES_BLIND, "Blindness" },
776 { TR_RES_CONF, "Confusion" },
777 { TR_RES_SOUND, "Sound" },
778 { TR_RES_SHARDS, "Shards" },
779 { TR_RES_NETHER, "Nether" },
780 { TR_RES_NEXUS, "Nexus" },
781 { TR_RES_CHAOS, "Chaos" },
782 { TR_RES_DISEN, "Disenchantment" },
787 * Elemental immunities (along with poison)
790 static const flag_desc immune_flags_desc[] =
794 { TR_IM_ELEC, "電撃" },
795 { TR_IM_FIRE, "火炎" },
796 { TR_IM_COLD, "冷気" },
798 { TR_IM_ACID, "Acid" },
799 { TR_IM_ELEC, "Lightning" },
800 { TR_IM_FIRE, "Fire" },
801 { TR_IM_COLD, "Cold" },
806 * Sustain stats - these are given their "own" line in the
807 * spoiler file, mainly for simplicity
809 static const flag_desc sustain_flags_desc[] =
812 { TR_SUST_STR, "腕力" },
813 { TR_SUST_INT, "知能" },
814 { TR_SUST_WIS, "賢さ" },
815 { TR_SUST_DEX, "器用さ" },
816 { TR_SUST_CON, "耐久力" },
817 { TR_SUST_CHR, "魅力" },
819 { TR_SUST_STR, "STR" },
820 { TR_SUST_INT, "INT" },
821 { TR_SUST_WIS, "WIS" },
822 { TR_SUST_DEX, "DEX" },
823 { TR_SUST_CON, "CON" },
824 { TR_SUST_CHR, "CHR" },
829 * Miscellaneous magic given by an object's "flags2" field
832 static const flag_desc misc_flags2_desc[] =
836 { TR_REFLECT, "反射" },
837 { TR_FREE_ACT, "麻痺知らず" },
838 { TR_HOLD_EXP, "経験値維持" },
840 { TR_THROW, "Throwing" },
841 { TR_REFLECT, "Reflection" },
842 { TR_FREE_ACT, "Free Action" },
843 { TR_HOLD_EXP, "Hold Experience" },
848 * Miscellaneous magic given by an object's "flags3" field
850 * Note that cursed artifacts and objects with permanent light
851 * are handled "directly" -- see analyze_misc_magic()
854 static const flag_desc misc_flags3_desc[] =
857 { TR_SH_FIRE, "火炎オーラ" },
858 { TR_SH_ELEC, "電撃オーラ" },
859 { TR_SH_COLD, "冷気オーラ" },
860 { TR_NO_TELE, "反テレポート" },
861 { TR_NO_MAGIC, "反魔法" },
862 { TR_LEVITATION, "浮遊" },
863 { TR_SEE_INVIS, "可視透明" },
864 { TR_TELEPATHY, "テレパシー" },
865 { TR_ESP_ANIMAL, "動物感知" },
866 { TR_ESP_UNDEAD, "不死感知" },
867 { TR_ESP_DEMON, "悪魔感知" },
868 { TR_ESP_ORC, "オーク感知" },
869 { TR_ESP_TROLL, "トロル感知" },
870 { TR_ESP_GIANT, "巨人感知" },
871 { TR_ESP_DRAGON, "ドラゴン感知" },
872 { TR_ESP_HUMAN, "人間感知" },
873 { TR_ESP_EVIL, "邪悪感知" },
874 { TR_ESP_GOOD, "善良感知" },
875 { TR_ESP_NONLIVING, "無生物感知" },
876 { TR_ESP_UNIQUE, "ユニーク感知" },
877 { TR_SLOW_DIGEST, "遅消化" },
878 { TR_REGEN, "急速回復" },
879 { TR_WARNING, "警告" },
880 /* { TR_XTRA_MIGHT, "強力射撃" }, */
881 { TR_XTRA_SHOTS, "追加射撃" }, /* always +1? */
882 { TR_DRAIN_EXP, "経験値吸収" },
883 { TR_AGGRAVATE, "反感" },
884 { TR_BLESSED, "祝福" },
885 { TR_DEC_MANA, "消費魔力減少" },
887 { TR_SH_FIRE, "Fiery Aura" },
888 { TR_SH_ELEC, "Electric Aura" },
889 { TR_SH_COLD, "Coldly Aura" },
890 { TR_NO_TELE, "Prevent Teleportation" },
891 { TR_NO_MAGIC, "Anti-Magic" },
892 { TR_LEVITATION, "Levitation" },
893 { TR_SEE_INVIS, "See Invisible" },
894 { TR_TELEPATHY, "ESP" },
895 { TR_ESP_ANIMAL, "Sense Animal" },
896 { TR_ESP_UNDEAD, "Sense Undead" },
897 { TR_ESP_DEMON, "Sense Demon" },
898 { TR_ESP_ORC, "Sense Orc" },
899 { TR_ESP_TROLL, "Sense Troll" },
900 { TR_ESP_GIANT, "Sense Giant" },
901 { TR_ESP_DRAGON, "Sense Dragon" },
902 { TR_ESP_HUMAN, "Sense Human" },
903 { TR_ESP_EVIL, "Sense Evil" },
904 { TR_ESP_GOOD, "Sense Good" },
905 { TR_ESP_NONLIVING, "Sense Nonliving" },
906 { TR_ESP_UNIQUE, "Sense Unique" },
907 { TR_SLOW_DIGEST, "Slow Digestion" },
908 { TR_REGEN, "Regeneration" },
909 { TR_WARNING, "Warning" },
910 /* { TR_XTRA_MIGHT, "Extra Might" }, */
911 { TR_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */
912 { TR_DRAIN_EXP, "Drains Experience" },
913 { TR_AGGRAVATE, "Aggravates" },
914 { TR_BLESSED, "Blessed Blade" },
915 { TR_DEC_MANA, "Decrease Mana Consumption Rate" },
921 * A special type used just for deailing with pvals
926 * This will contain a string such as "+2", "-10", etc.
931 * A list of various player traits affected by an object's pval such
932 * as stats, speed, stealth, etc. "Extra attacks" is NOT included in
933 * this list since it will probably be desirable to format its
934 * description differently.
936 * Note that room need only be reserved for the number of stats - 1
937 * since the description "All stats" is used if an object affects all
938 * all stats. Also, room must be reserved for a sentinel NULL pointer.
940 * This will be a list such as ["STR", "DEX", "Stealth", NULL] etc.
942 * This list includes extra attacks, for simplicity.
944 cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
945 N_ELEMENTS(pval_flags1_desc) + 1];
951 * An "object analysis structure"
953 * It will be filled with descriptive strings detailing an object's
954 * various magical powers. The "ignore X" traits are not noted since
955 * all artifacts ignore "normal" destruction.
960 /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
961 char description[MAX_NLEN];
963 /* Description of what is affected by an object's pval */
964 pval_info_type pval_info;
966 /* A list of an object's slaying preferences */
967 cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
969 /* A list if an object's elemental brands */
970 cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
972 /* A list of immunities granted by an object */
973 cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
975 /* A list of resistances granted by an object */
976 cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
978 /* A list of stats sustained by an object */
979 cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
981 /* A list of various magical qualities an object may have */
982 cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
983 + 1 /* Permanent Light */
985 + 1 /* type of curse */
986 + 1]; /* sentinel NULL */
988 /* Additional ability or resistance */
991 /* A string describing an artifact's activation */
994 /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
1000 * @brief ファイルポインタ先に同じ文字を複数出力する /
1001 * Write out `n' of the character `c' to the spoiler file
1003 * @param c 出力するキャラクタ
1006 static void spoiler_out_n_chars(int n, char c)
1008 while (--n >= 0) fputc(c, fff);
1013 * @brief ファイルポインタ先に改行を複数出力する /
1014 * Write out `n' blank lines to the spoiler file
1018 static void spoiler_blanklines(int n)
1020 spoiler_out_n_chars(n, '\n');
1025 * @brief ファイルポインタ先に複数のハイフンで装飾した文字列を出力する /
1026 * Write a line to the spoiler file and then "underline" it with hypens
1027 * @param str 出力したい文字列
1030 static void spoiler_underline(cptr str)
1032 fprintf(fff, "%s\n", str);
1033 spoiler_out_n_chars(strlen(str), '-');
1040 * @brief アーティファクトの特性一覧を出力する /
1041 * Write a line to the spoiler file and then "underline" it with hypens
1042 * @param art_flags アーティファクトのフラグ群
1043 * @param flag_ptr フラグ記述情報の参照ポインタ
1044 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1045 * @param n_elmnts フラグの要素数
1046 * @return desc_ptrと同じアドレス
1049 * This function does most of the actual "analysis". Given a set of bit flags
1050 * (which will be from one of the flags fields from the object in question),
1051 * a "flag description structure", a "description list", and the number of
1052 * elements in the "flag description structure", this function sets the
1053 * "description list" members to the appropriate descriptions contained in
1054 * the "flag description structure".
1055 * The possibly updated description pointer is returned.
1058 static cptr *spoiler_flag_aux(const u32b art_flags[TR_FLAG_SIZE],
1059 const flag_desc *flag_ptr,
1060 cptr *desc_ptr, const int n_elmnts)
1064 for (i = 0; i < n_elmnts; ++i)
1066 if (have_flag(art_flags, flag_ptr[i].flag))
1068 *desc_ptr++ = flag_ptr[i].desc;
1077 * @brief アイテムの特定記述内容を返す /
1078 * Acquire a "basic" description "The Cloak of Death [1,+10]"
1079 * @param o_ptr 記述を得たいオブジェクトの参照ポインタ
1080 * @param desc_ptr 記述内容を返すための文字列参照ポインタ
1083 static void analyze_general(object_type *o_ptr, char *desc_ptr)
1085 /* Get a "useful" description of the object */
1086 object_desc(desc_ptr, o_ptr, (OD_NAME_AND_ENCHANT | OD_STORE));
1091 * @brief アーティファクトがプレイヤーに与えるpval修正を構造体に収める /
1092 * List "player traits" altered by an artifact's pval. These include stats,
1093 * speed, infravision, tunneling, stealth, searching, and extra attacks.
1094 * @param o_ptr オブジェクト構造体の参照ポインタ
1095 * @param p_ptr pval修正構造体の参照ポインタ
1098 static void analyze_pval(object_type *o_ptr, pval_info_type *p_ptr)
1100 u32b flgs[TR_FLAG_SIZE];
1104 /* If pval == 0, there is nothing to do. */
1107 /* An "empty" pval description indicates that pval == 0 */
1108 p_ptr->pval_desc[0] = '\0';
1112 /* Extract the flags */
1113 object_flags(o_ptr, flgs);
1115 affects_list = p_ptr->pval_affects;
1117 /* Create the "+N" string */
1118 sprintf(p_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval);
1120 /* First, check to see if the pval affects all stats */
1121 if (have_flag(flgs, TR_STR) && have_flag(flgs, TR_INT) &&
1122 have_flag(flgs, TR_WIS) && have_flag(flgs, TR_DEX) &&
1123 have_flag(flgs, TR_CON) && have_flag(flgs, TR_CHR))
1126 *affects_list++ = "全能力";
1128 *affects_list++ = "All stats";
1132 /* Are any stats affected? */
1133 else if (have_flag(flgs, TR_STR) || have_flag(flgs, TR_INT) ||
1134 have_flag(flgs, TR_WIS) || have_flag(flgs, TR_DEX) ||
1135 have_flag(flgs, TR_CON) || have_flag(flgs, TR_CHR))
1137 affects_list = spoiler_flag_aux(flgs, stat_flags_desc,
1139 N_ELEMENTS(stat_flags_desc));
1142 /* And now the "rest" */
1143 affects_list = spoiler_flag_aux(flgs, pval_flags1_desc,
1145 N_ELEMENTS(pval_flags1_desc));
1147 /* Terminate the description list */
1148 *affects_list = NULL;
1152 * @brief アーティファクトの種族スレイ特性を構造体に収める /
1153 * Note the slaying specialties of a weapon
1154 * @param o_ptr オブジェクト構造体の参照ポインタ
1155 * @param slay_list 種族スレイ構造体の参照ポインタ
1158 static void analyze_slay(object_type *o_ptr, cptr *slay_list)
1160 u32b flgs[TR_FLAG_SIZE];
1162 object_flags(o_ptr, flgs);
1164 slay_list = spoiler_flag_aux(flgs, slay_flags_desc, slay_list,
1165 N_ELEMENTS(slay_flags_desc));
1167 /* Terminate the description list */
1173 * @brief アーティファクトの属性ブランド特性を構造体に収める /
1174 * Note an object's elemental brands
1175 * @param o_ptr オブジェクト構造体の参照ポインタ
1176 * @param brand_list 属性ブランド構造体の参照ポインタ
1179 static void analyze_brand(object_type *o_ptr, cptr *brand_list)
1181 u32b flgs[TR_FLAG_SIZE];
1183 object_flags(o_ptr, flgs);
1185 brand_list = spoiler_flag_aux(flgs, brand_flags_desc, brand_list,
1186 N_ELEMENTS(brand_flags_desc));
1188 /* Terminate the description list */
1194 * @brief アーティファクトの通常耐性を構造体に収める /
1195 * Note an object's elemental brands
1196 * @param o_ptr オブジェクト構造体の参照ポインタ
1197 * @param resist_list 通常耐性構造体の参照ポインタ
1200 static void analyze_resist(object_type *o_ptr, cptr *resist_list)
1202 u32b flgs[TR_FLAG_SIZE];
1204 object_flags(o_ptr, flgs);
1206 resist_list = spoiler_flag_aux(flgs, resist_flags_desc,
1207 resist_list, N_ELEMENTS(resist_flags_desc));
1209 /* Terminate the description list */
1210 *resist_list = NULL;
1215 * @brief アーティファクトの免疫特性を構造体に収める /
1216 * Note the immunities granted by an object
1217 * @param o_ptr オブジェクト構造体の参照ポインタ
1218 * @param immune_list 免疫構造体の参照ポインタ
1221 static void analyze_immune(object_type *o_ptr, cptr *immune_list)
1223 u32b flgs[TR_FLAG_SIZE];
1225 object_flags(o_ptr, flgs);
1227 immune_list = spoiler_flag_aux(flgs, immune_flags_desc,
1228 immune_list, N_ELEMENTS(immune_flags_desc));
1230 /* Terminate the description list */
1231 *immune_list = NULL;
1236 * @brief アーティファクトの維持特性を構造体に収める /
1237 * Note which stats an object sustains
1238 * @param o_ptr オブジェクト構造体の参照ポインタ
1239 * @param sustain_list 維持特性構造体の参照ポインタ
1242 static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
1244 u32b flgs[TR_FLAG_SIZE];
1246 object_flags(o_ptr, flgs);
1248 /* Simplify things if an item sustains all stats */
1249 if (have_flag(flgs, TR_SUST_STR) && have_flag(flgs, TR_SUST_INT) &&
1250 have_flag(flgs, TR_SUST_WIS) && have_flag(flgs, TR_SUST_DEX) &&
1251 have_flag(flgs, TR_SUST_CON) && have_flag(flgs, TR_SUST_CHR))
1254 *sustain_list++ = "全能力";
1256 *sustain_list++ = "All stats";
1260 /* Should we bother? */
1261 else if (have_flag(flgs, TR_SUST_STR) || have_flag(flgs, TR_SUST_INT) ||
1262 have_flag(flgs, TR_SUST_WIS) || have_flag(flgs, TR_SUST_DEX) ||
1263 have_flag(flgs, TR_SUST_CON) || have_flag(flgs, TR_SUST_CHR))
1265 sustain_list = spoiler_flag_aux(flgs, sustain_flags_desc,
1267 N_ELEMENTS(sustain_flags_desc));
1270 /* Terminate the description list */
1271 *sustain_list = NULL;
1276 * @brief アーティファクトのその他の特性を構造体に収める /
1277 * Note miscellaneous powers bestowed by an artifact such as see invisible,
1278 * free action, permanent light, etc.
1279 * @param o_ptr オブジェクト構造体の参照ポインタ
1280 * @param misc_list その他の特性構造体の参照ポインタ
1283 static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
1285 u32b flgs[TR_FLAG_SIZE];
1289 object_flags(o_ptr, flgs);
1291 misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list,
1292 N_ELEMENTS(misc_flags2_desc));
1294 misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list,
1295 N_ELEMENTS(misc_flags3_desc));
1298 * Glowing artifacts -- small radius light.
1301 if (have_flag(flgs, TR_LITE_1)) rad += 1;
1302 if (have_flag(flgs, TR_LITE_2)) rad += 2;
1303 if (have_flag(flgs, TR_LITE_3)) rad += 3;
1304 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
1305 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
1306 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
1308 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
1310 if (have_flag(flgs, TR_LITE_FUEL))
1312 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), rad);
1316 if(rad > 0) sprintf(desc, _("永久光源(半径 %d)", "Permanent Light(radius %d)"), rad);
1317 if(rad < 0) sprintf(desc, _("永久光源(半径-%d)。", "Permanent Light(radius -%d)"), -rad);
1320 if(rad != 0) *misc_list++ = quark_str(quark_add(desc));
1323 * Handle cursed objects here to avoid redundancies such as noting
1324 * that a permanently cursed object is heavily cursed as well as
1325 * being "lightly cursed".
1328 /* if (object_is_cursed(o_ptr)) */
1330 if (have_flag(flgs, TR_TY_CURSE))
1332 *misc_list++ = _("太古の怨念", "Ancient Curse");
1334 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1336 *misc_list++ = _("永遠の呪い", "Permanently Cursed");
1338 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1340 *misc_list++ = _("強力な呪い", "Heavily Cursed");
1343 else if (o_ptr->curse_flags & TRC_CURSED)
1345 *misc_list++ = _("呪い", "Cursed");
1347 if (have_flag(flgs, TR_ADD_L_CURSE))
1349 *misc_list++ = _("呪いを増やす", "Cursing");
1351 if (have_flag(flgs, TR_ADD_H_CURSE))
1353 *misc_list++ = _("強力な呪いを増やす", "Heavily Cursing");
1357 /* Terminate the description list */
1363 * @brief アーティファクトの追加ランダム特性を構造体に収める /
1364 * Note additional ability and/or resistance of fixed artifacts
1365 * @param o_ptr オブジェクト構造体の参照ポインタ
1366 * @param addition 追加ランダム耐性構造体の参照ポインタ
1369 static void analyze_addition(object_type *o_ptr, char *addition)
1371 artifact_type *a_ptr = &a_info[o_ptr->name1];
1374 strcpy(addition, "");
1377 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
1378 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1380 strcat(addition, "能力");
1381 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
1383 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1385 strcat(addition, "耐性");
1386 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
1388 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
1390 if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
1391 else if (a_ptr->gen_flags & TRG_XTRA_POWER)
1393 strcat(addition, "Ability");
1394 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
1396 else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
1398 strcat(addition, "Resistance");
1399 if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
1401 else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
1407 * @brief アーティファクトの基本情報を文字列に収める /
1408 * Determine the minimum depth an artifact can appear, its rarity, its weight,
1409 * and its value in gold pieces
1410 * @param o_ptr オブジェクト構造体の参照ポインタ
1411 * @param misc_desc 基本情報を収める文字列参照ポインタ
1414 static void analyze_misc(object_type *o_ptr, char *misc_desc)
1416 artifact_type *a_ptr = &a_info[o_ptr->name1];
1419 sprintf(misc_desc, "レベル %u, 希少度 %u, %d.%d kg, $%ld",
1420 a_ptr->level, a_ptr->rarity,
1421 lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost);
1423 sprintf(misc_desc, "Level %u, Rarity %u, %d.%d lbs, %ld Gold",
1424 a_ptr->level, a_ptr->rarity,
1425 a_ptr->weight / 10, a_ptr->weight % 10, a_ptr->cost);
1431 * @brief アーティファクトの情報全体を構造体に収める /
1432 * Fill in an object description structure for a given object
1433 * and its value in gold pieces
1434 * @param o_ptr オブジェクト構造体の参照ポインタ
1435 * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
1438 static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
1440 analyze_general(o_ptr, desc_ptr->description);
1441 analyze_pval(o_ptr, &desc_ptr->pval_info);
1442 analyze_brand(o_ptr, desc_ptr->brands);
1443 analyze_slay(o_ptr, desc_ptr->slays);
1444 analyze_immune(o_ptr, desc_ptr->immunities);
1445 analyze_resist(o_ptr, desc_ptr->resistances);
1446 analyze_sustains(o_ptr, desc_ptr->sustains);
1447 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
1448 analyze_addition(o_ptr, desc_ptr->addition);
1449 analyze_misc(o_ptr, desc_ptr->misc_desc);
1450 desc_ptr->activation = item_activation(o_ptr);
1455 * @brief バッファにアーティファクト出力情報ヘッダを収める /
1458 static void print_header(void)
1462 sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",
1463 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1464 spoiler_underline(buf);
1468 * This is somewhat ugly.
1470 * Given a header ("Resist", e.g.), a list ("Fire", "Cold", Acid", e.g.),
1471 * and a separator character (',', e.g.), write the list to the spoiler file
1472 * in a "nice" format, such as:
1474 * Resist Fire, Cold, Acid
1476 * That was a simple example, but when the list is long, a line wrap
1477 * should occur, and this should induce a new level of indention if
1478 * a list is being spread across lines. So for example, Bladeturner's
1479 * list of resistances should look something like this
1481 * Resist Acid, Lightning, Fire, Cold, Poison, Light, Dark, Blindness,
1482 * Confusion, Sound, Shards, Nether, Nexus, Chaos, Disenchantment
1484 * However, the code distinguishes between a single list of many items vs.
1485 * many lists. (The separator is used to make this determination.) A single
1486 * list of many items will not cause line wrapping (since there is no
1487 * apparent reason to do so). So the lists of Ulmo's miscellaneous traits
1488 * might look like this:
1490 * Free Action; Hold Life; See Invisible; Slow Digestion; Regeneration
1493 * So comparing the two, "Regeneration" has no trailing separator and
1494 * "Blessed Blade" was not indented. (Also, Ulmo's lists have no headers,
1495 * but that's not relevant to line wrapping and indention.)
1498 /* ITEM_SEP separates items within a list */
1499 #define ITEM_SEP ','
1502 /* LIST_SEP separates lists */
1504 #define LIST_SEP ','
1506 #define LIST_SEP ';'
1510 * @brief フラグ名称を出力する汎用関数
1511 * @param header ヘッダに出力するフラグ群の名前
1512 * @param list フラグ名リスト
1513 * @param separator フラグ表示の区切り記号
1516 static void spoiler_outlist(cptr header, cptr *list, char separator)
1518 int line_len, buf_len;
1519 char line[MAX_LINE_LEN+1], buf[80];
1521 /* Ignore an empty list */
1522 if (*list == NULL) return;
1524 /* This function always indents */
1525 strcpy(line, INDENT1);
1527 /* Create header (if one was given) */
1528 if (header && (header[0]))
1530 strcat(line, header);
1534 line_len = strlen(line);
1536 /* Now begin the tedious task */
1539 /* Copy the current item to a buffer */
1542 /* Note the buffer's length */
1543 buf_len = strlen(buf);
1546 * If there is an item following this one, pad with separator and
1547 * a space and adjust the buffer length
1552 sprintf(buf + buf_len, "%c ", separator);
1557 * If the buffer will fit on the current line, just append the
1558 * buffer to the line and adjust the line length accordingly.
1561 if (line_len + buf_len <= MAX_LINE_LEN)
1564 line_len += buf_len;
1567 /* Apply line wrapping and indention semantics described above */
1571 * Don't print a trailing list separator but do print a trailing
1574 if (line_len > 1 && line[line_len - 1] == ' '
1575 && line[line_len - 2] == LIST_SEP)
1577 /* Ignore space and separator */
1578 line[line_len - 2] = '\0';
1580 /* Write to spoiler file */
1581 fprintf(fff, "%s\n", line);
1583 /* Begin new line at primary indention level */
1584 sprintf(line, "%s%s", INDENT1, buf);
1589 /* Write to spoiler file */
1590 fprintf(fff, "%s\n", line);
1592 /* Begin new line at secondary indention level */
1593 sprintf(line, "%s%s", INDENT2, buf);
1596 line_len = strlen(line);
1599 /* Advance, with break */
1600 if (!*++list) break;
1603 /* Write what's left to the spoiler file */
1604 fprintf(fff, "%s\n", line);
1608 * @brief アーティファクト一件をスポイラー出力する /
1609 * Create a spoiler file entry for an artifact
1610 * @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
1613 static void spoiler_print_art(obj_desc_list *art_ptr)
1615 pval_info_type *pval_ptr = &art_ptr->pval_info;
1619 /* Don't indent the first line */
1620 fprintf(fff, "%s\n", art_ptr->description);
1622 /* An "empty" pval description indicates that the pval affects nothing */
1623 if (pval_ptr->pval_desc[0])
1625 /* Mention the effects of pval */
1627 sprintf(buf, "%sの修正:", pval_ptr->pval_desc);
1629 sprintf(buf, "%s to", pval_ptr->pval_desc);
1631 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
1634 /* Now deal with the description lists */
1637 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
1638 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
1639 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
1640 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
1641 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
1643 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
1644 spoiler_outlist("", art_ptr->brands, LIST_SEP);
1645 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
1646 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
1647 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
1649 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
1651 if (art_ptr->addition[0])
1654 fprintf(fff, "%s追加: %s\n", INDENT1, art_ptr->addition);
1656 fprintf(fff, "%sAdditional %s\n", INDENT1, art_ptr->addition);
1660 /* Write out the possible activation at the primary indention level */
1661 if (art_ptr->activation)
1664 fprintf(fff, "%s発動: %s\n", INDENT1, art_ptr->activation);
1666 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
1670 /* End with the miscellaneous facts */
1671 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
1676 * @brief アーティファクト情報を出力するためにダミー生成を行う /
1677 * Hack -- Create a "forged" artifact
1678 * @param o_ptr 一時生成先を保管するオブジェクト構造体
1679 * @param name1 生成するアーティファクトID
1680 * @return 生成が成功した場合TRUEを返す
1682 static bool make_fake_artifact(object_type *o_ptr, int name1)
1686 artifact_type *a_ptr = &a_info[name1];
1689 /* Ignore "empty" artifacts */
1690 if (!a_ptr->name) return FALSE;
1692 /* Acquire the "kind" index */
1693 i = lookup_kind(a_ptr->tval, a_ptr->sval);
1696 if (!i) return (FALSE);
1698 /* Create the artifact */
1699 object_prep(o_ptr, i);
1702 o_ptr->name1 = name1;
1704 /* Extract the fields */
1705 o_ptr->pval = a_ptr->pval;
1706 o_ptr->ac = a_ptr->ac;
1707 o_ptr->dd = a_ptr->dd;
1708 o_ptr->ds = a_ptr->ds;
1709 o_ptr->to_a = a_ptr->to_a;
1710 o_ptr->to_h = a_ptr->to_h;
1711 o_ptr->to_d = a_ptr->to_d;
1712 o_ptr->weight = a_ptr->weight;
1720 * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
1721 * Create a spoiler file for artifacts
1722 * @param fname 生成ファイル名
1725 static void spoil_artifact(cptr fname)
1732 obj_desc_list artifact;
1737 /* Build the filename */
1738 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1740 /* File type is "TEXT" */
1741 FILE_TYPE(FILE_TYPE_TEXT);
1744 fff = my_fopen(buf, "w");
1749 msg_print("Cannot create spoiler file.");
1753 /* Dump the header */
1756 /* List the artifacts by tval */
1757 for (i = 0; group_artifact[i].tval; i++)
1759 /* Write out the group title */
1760 if (group_artifact[i].name)
1762 spoiler_blanklines(2);
1763 spoiler_underline(group_artifact[i].name);
1764 spoiler_blanklines(1);
1767 /* Now search through all of the artifacts */
1768 for (j = 1; j < max_a_idx; ++j)
1770 artifact_type *a_ptr = &a_info[j];
1772 /* We only want objects in the current group */
1773 if (a_ptr->tval != group_artifact[i].tval) continue;
1775 /* Get local object */
1778 /* Wipe the object */
1781 /* Attempt to "forge" the artifact */
1782 if (!make_fake_artifact(q_ptr, j)) continue;
1784 /* Analyze the artifact */
1785 object_analyze(q_ptr, &artifact);
1787 /* Write out the artifact description to the spoiler file */
1788 spoiler_print_art(&artifact);
1792 /* Check for errors */
1793 if (ferror(fff) || my_fclose(fff))
1795 msg_print("Cannot close spoiler file.");
1800 msg_print("Successfully created a spoiler file.");
1805 * @brief モンスター簡易情報のスポイラー出力を行うメインルーチン /
1806 * Create a spoiler file for monsters -BEN-
1807 * @param fname 生成ファイル名
1810 static void spoil_mon_desc(cptr fname)
1827 /* Build the filename */
1828 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1830 /* File type is "TEXT" */
1831 FILE_TYPE(FILE_TYPE_TEXT);
1834 fff = my_fopen(buf, "w");
1839 msg_print("Cannot create spoiler file.");
1843 /* Allocate the "who" array */
1844 C_MAKE(who, max_r_idx, s16b);
1846 /* Dump the header */
1847 fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
1848 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
1849 fprintf(fff, "------------------------------------------\n\n");
1851 /* Dump the header */
1852 fprintf(fff, " %-38.38s%4s%4s%4s%7s%5s %11.11s\n",
1853 "Name", "Lev", "Rar", "Spd", "Hp", "Ac", "Visual Info");
1854 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1855 "--------", "---", "---", "---", "--", "--", "-----------");
1858 /* Scan the monsters */
1859 for (i = 1; i < max_r_idx; i++)
1861 monster_race *r_ptr = &r_info[i];
1863 /* Use that monster */
1864 if (r_ptr->name) who[n++] = i;
1867 /* Select the sort method */
1868 ang_sort_comp = ang_sort_comp_hook;
1869 ang_sort_swap = ang_sort_swap_hook;
1871 /* Sort the array by dungeon depth of monsters */
1872 ang_sort(who, &why, n);
1875 for (i = 0; i < n; i++)
1877 monster_race *r_ptr = &r_info[who[i]];
1879 cptr name = (r_name + r_ptr->name);
1880 if (r_ptr->flags7 & (RF7_KAGE)) continue;
1882 /* Get the "name" */
1884 else if (r_ptr->flags1 & (RF1_QUESTOR))
1886 sprintf(nam, "[Q] %s", name);
1889 else if (r_ptr->flags1 & (RF1_UNIQUE))
1891 sprintf(nam, "[U] %s", name);
1896 sprintf(nam, " %s", name);
1898 sprintf(nam, "The %s", name);
1904 sprintf(lev, "%d", r_ptr->level);
1907 sprintf(rar, "%d", r_ptr->rarity);
1910 if (r_ptr->speed >= 110)
1912 sprintf(spd, "+%d", (r_ptr->speed - 110));
1916 sprintf(spd, "-%d", (110 - r_ptr->speed));
1920 sprintf(ac, "%d", r_ptr->ac);
1923 if ((r_ptr->flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
1925 sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside);
1929 sprintf(hp, "%dd%d", r_ptr->hdice, r_ptr->hside);
1934 sprintf(exp, "%ld", (long)(r_ptr->mexp));
1936 /* Hack -- use visual instead */
1937 sprintf(exp, "%s '%c'", attr_to_text(r_ptr), r_ptr->d_char);
1940 fprintf(fff, "%-42.42s%4s%4s%4s%7s%5s %11.11s\n",
1941 nam, lev, rar, spd, hp, ac, exp);
1948 /* Free the "who" array */
1949 C_KILL(who, max_r_idx, s16b);
1951 /* Check for errors */
1952 if (ferror(fff) || my_fclose(fff))
1954 msg_print("Cannot close spoiler file.");
1959 msg_print("Successfully created a spoiler file.");
1966 * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse)
1968 * Primarily based on code already in mon-desc.c, mostly by -BEN-
1974 * @brief 文字列をファイルポインタに出力する /
1975 * Buffer text to the given file. (-SHAWN-)
1976 * This is basically c_roff() from mon-desc.c with a few changes.
1977 * @param str 文字列参照ポインタ
1980 static void spoil_out(cptr str)
1985 static char roff_buf[256];
1988 static char roff_waiting_buf[256];
1991 bool iskanji_flag = FALSE;
1993 /* Current pointer into line roff_buf */
1994 static char *roff_p = roff_buf;
1996 /* Last space saved into roff_buf */
1997 static char *roff_s = NULL;
1999 /* Mega-Hack -- Delayed output */
2000 static bool waiting_output = FALSE;
2002 /* Special handling for "new sequence" */
2007 fputs(roff_waiting_buf, fff);
2008 waiting_output = FALSE;
2011 if (roff_p != roff_buf) roff_p--;
2012 while (*roff_p == ' ' && roff_p != roff_buf) roff_p--;
2014 if (roff_p == roff_buf) fprintf(fff, "\n");
2017 *(roff_p + 1) = '\0';
2018 fprintf(fff, "%s\n\n", roff_buf);
2027 /* Scan the given string, character at a time */
2032 bool k_flag = iskanji((unsigned char)(*str));
2035 bool wrap = (ch == '\n');
2038 if (!isprint(ch) && !k_flag && !iskanji_flag) ch = ' ';
2039 iskanji_flag = k_flag && !iskanji_flag;
2041 if (!isprint(ch)) ch = ' ';
2046 fputs(roff_waiting_buf, fff);
2047 if (!wrap) fputc('\n', fff);
2048 waiting_output = FALSE;
2054 if (roff_p >= roff_buf + (k_flag ? 74 : 75)) wrap = TRUE;
2055 else if ((ch == ' ') && (roff_p >= roff_buf + (k_flag ? 72 : 73))) wrap = TRUE;
2057 if (roff_p >= roff_buf + 75) wrap = TRUE;
2058 else if ((ch == ' ') && (roff_p >= roff_buf + 73)) wrap = TRUE;
2065 bool iskanji_flag_local = FALSE;
2066 cptr tail = str + (k_flag ? 2 : 1);
2068 cptr tail = str + 1;
2071 for (; *tail; tail++)
2073 if (*tail == ' ') continue;
2076 k_flag_local = iskanji((unsigned char)(*tail));
2077 if (isprint(*tail) || k_flag_local || iskanji_flag_local) break;
2078 iskanji_flag_local = k_flag_local && !iskanji_flag_local;
2080 if (isprint(*tail)) break;
2084 if (!*tail) waiting_output = TRUE;
2088 /* Handle line-wrap */
2096 if (roff_s && (ch != ' '))
2104 if (!waiting_output) fprintf(fff, "%s\n", roff_buf);
2105 else strcpy(roff_waiting_buf, roff_buf);
2109 if (cbak != ' ') *roff_p++ = cbak;
2111 while (*r) *roff_p++ = *r++;
2115 if ((roff_p > roff_buf) || (ch != ' '))
2120 if ((ch == ' ') || (ch == '(')) roff_s = roff_p;
2125 strncmp(str, "。", 2) != 0 &&
2126 strncmp(str, "、", 2) != 0 &&
2127 strncmp(str, "ィ", 2) != 0 &&
2128 strncmp(str, "ー", 2) != 0) roff_s = roff_p;
2131 if (ch == ' ') roff_s = roff_p;
2142 * @brief 関数ポインタ用の出力関数 /
2143 * Hook function used in spoil_mon_info()
2145 * @param str 文字列参照ポインタ
2148 static void roff_func(byte attr, cptr str)
2158 * @brief モンスター詳細情報をスポイラー出力するメインルーチン /
2159 * Create a spoiler file for monsters (-SHAWN-)
2160 * @param fname ファイル名
2163 static void spoil_mon_info(cptr fname)
2172 /* Build the filename */
2173 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2175 /* File type is "TEXT" */
2176 FILE_TYPE(FILE_TYPE_TEXT);
2179 fff = my_fopen(buf, "w");
2184 msg_print("Cannot create spoiler file.");
2189 /* Dump the header */
2190 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2191 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2194 spoil_out("------------------------------------------\n\n");
2196 /* Allocate the "who" array */
2197 C_MAKE(who, max_r_idx, s16b);
2199 /* Scan the monsters */
2200 for (i = 1; i < max_r_idx; i++)
2202 monster_race *r_ptr = &r_info[i];
2204 /* Use that monster */
2205 if (r_ptr->name) who[n++] = i;
2208 /* Select the sort method */
2209 ang_sort_comp = ang_sort_comp_hook;
2210 ang_sort_swap = ang_sort_swap_hook;
2212 /* Sort the array by dungeon depth of monsters */
2213 ang_sort(who, &why, n);
2217 * List all monsters in order
2219 for (l = 0; l < n; l++)
2221 monster_race *r_ptr = &r_info[who[l]];
2223 /* Extract the flags */
2224 flags1 = r_ptr->flags1;
2228 if (flags1 & (RF1_QUESTOR))
2234 if (flags1 & (RF1_UNIQUE))
2247 sprintf(buf, "%s/%s (", (r_name + r_ptr->name),(r_name+r_ptr->E_name)); /* ---)--- */
2249 sprintf(buf, "%s (", (r_name + r_ptr->name)); /* ---)--- */
2255 spoil_out(attr_to_text(r_ptr));
2258 sprintf(buf, " '%c')\n", r_ptr->d_char);
2263 sprintf(buf, "=== ");
2267 sprintf(buf, "Num:%d ", who[l]);
2271 sprintf(buf, "Lev:%d ", r_ptr->level);
2275 sprintf(buf, "Rar:%d ", r_ptr->rarity);
2279 if (r_ptr->speed >= 110)
2281 sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
2285 sprintf(buf, "Spd:-%d ", (110 - r_ptr->speed));
2290 if ((flags1 & (RF1_FORCE_MAXHP)) || (r_ptr->hside == 1))
2292 sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside);
2296 sprintf(buf, "Hp:%dd%d ", r_ptr->hdice, r_ptr->hside);
2301 sprintf(buf, "Ac:%d ", r_ptr->ac);
2305 sprintf(buf, "Exp:%ld\n", (long)(r_ptr->mexp));
2308 /* Reuse the code of monster recall. */
2309 output_monster_spoiler(who[l], roff_func);
2314 /* Free the "who" array */
2315 C_KILL(who, max_r_idx, s16b);
2317 /* Check for errors */
2318 if (ferror(fff) || my_fclose(fff))
2320 msg_print("Cannot close spoiler file.");
2324 msg_print("Successfully created a spoiler file.");
2329 #define MAX_EVOL_DEPTH 64
2333 * @brief int配列でstrncmp()と似た比較処理を行う /
2334 * Compare two int-type array like strncmp() and return TRUE if equals
2335 * @param a 比較するint配列1
2336 * @param b 比較するint配列2
2338 * @return 両者の値が等しければTRUEを返す
2340 static bool int_n_cmp(int *a, int *b, int length)
2342 /* Null-string comparation is always TRUE */
2343 if (!length) return TRUE;
2347 if (*a != *(b++)) return FALSE;
2348 if (!(*(a++))) break;
2357 * @brief ある木が指定された木の部分木かどうかを返す /
2358 * Returns TRUE if an evolution tree is "partial tree"
2359 * @param tree 元となる木構造リスト
2360 * @param partial_tree 部分木かどうか判定したい木構造リスト
2361 * @return 部分木ならばTRUEを返す
2363 static bool is_partial_tree(int *tree, int *partial_tree)
2365 int pt_head = *(partial_tree++);
2368 while (partial_tree[pt_len]) pt_len++;
2372 if (*(tree++) == pt_head)
2374 if (int_n_cmp(tree, partial_tree, pt_len)) return TRUE;
2383 * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
2384 * Sorting hook -- Comp function
2387 * @param a 比較したいモンスター種族ID1
2388 * @param b 比較したいモンスター種族ID2
2389 * @return 2が大きければTRUEを返す
2391 static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
2393 int **evol_tree = (int **)u;
2395 int w1 = evol_tree[a][0];
2396 int w2 = evol_tree[b][0];
2397 monster_race *r1_ptr = &r_info[w1];
2398 monster_race *r2_ptr = &r_info[w2];
2403 /* Used tree first */
2404 if (w1 && !w2) return TRUE;
2405 if (!w1 && w2) return FALSE;
2407 /* Sort by monster level */
2408 if (r1_ptr->level < r2_ptr->level) return TRUE;
2409 if (r1_ptr->level > r2_ptr->level) return FALSE;
2411 /* Sort by monster experience */
2412 if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
2413 if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
2415 /* Compare indexes */
2420 * @brief 進化ツリーをソートするため木構造のスワップ関数 /
2421 * Sorting hook -- Swap function
2424 * @param a スワップしたい木構造1
2425 * @param b スワップしたい木構造2
2426 * @return 2が大きければTRUEを返す
2428 static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
2430 int **evol_tree = (int **)u;
2437 holder = evol_tree[a];
2438 evol_tree[a] = evol_tree[b];
2439 evol_tree[b] = holder;
2443 * @brief 進化ツリーをスポイラー出力するメインルーチン /
2444 * Print monsters' evolution information to file
2445 * @param fname 出力ファイル名
2448 static void spoil_mon_evol(cptr fname)
2451 monster_race *r_ptr;
2452 int **evol_tree, i, j, n, r_idx;
2453 int *evol_tree_zero; /* For C_KILL() */
2455 /* Build the filename */
2456 path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
2458 /* File type is "TEXT" */
2459 FILE_TYPE(FILE_TYPE_TEXT);
2462 fff = my_fopen(buf, "w");
2467 msg_print("Cannot create spoiler file.");
2471 /* Dump the header */
2472 sprintf(buf, "Monster Spoilers for Hengband Version %d.%d.%d\n",
2473 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2476 spoil_out("------------------------------------------\n\n");
2478 /* Allocate the "evol_tree" array (2-dimension) */
2479 C_MAKE(evol_tree, max_r_idx, int *);
2480 C_MAKE(*evol_tree, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2481 for (i = 1; i < max_r_idx; i++) evol_tree[i] = *evol_tree + i * (MAX_EVOL_DEPTH + 1);
2482 evol_tree_zero = *evol_tree;
2484 /* Step 1: Build the evolution tree */
2485 for (i = 1; i < max_r_idx; i++)
2490 if (!r_ptr->next_exp) continue;
2492 /* Trace evolution */
2494 evol_tree[i][n++] = i;
2497 evol_tree[i][n++] = r_ptr->next_r_idx;
2498 r_ptr = &r_info[r_ptr->next_r_idx];
2500 while (r_ptr->next_exp && (n < MAX_EVOL_DEPTH));
2503 /* Step 2: Scan the evolution trees and remove "partial tree" */
2504 for (i = 1; i < max_r_idx; i++)
2506 /* Not evolution tree */
2507 if (!evol_tree[i][0]) continue;
2509 for (j = 1; j < max_r_idx; j++)
2512 if (i == j) continue;
2514 /* Not evolution tree */
2515 if (!evol_tree[j][0]) continue;
2517 /* Is evolution tree[i] is part of [j]? */
2518 if (is_partial_tree(evol_tree[j], evol_tree[i]))
2520 /* Remove this evolution tree */
2521 evol_tree[i][0] = 0;
2527 /* Step 3: Sort the evolution trees */
2529 /* Select the sort method */
2530 ang_sort_comp = ang_sort_comp_evol_tree;
2531 ang_sort_swap = ang_sort_swap_evol_tree;
2533 /* Sort the array */
2534 ang_sort(evol_tree, NULL, max_r_idx);
2536 /* Step 4: Print the evolution trees */
2537 for (i = 0; i < max_r_idx; i++)
2539 r_idx = evol_tree[i][0];
2541 /* No evolution or removed evolution tree */
2542 if (!r_idx) continue;
2544 /* Trace the evolution tree */
2545 r_ptr = &r_info[r_idx];
2547 fprintf(fff, "[%d]: %s (レベル%d, '%c')\n", r_idx,
2548 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2550 fprintf(fff, "[%d]: %s (Level %d, '%c')\n", r_idx,
2551 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2553 for (n = 1; r_ptr->next_exp; n++)
2555 fprintf(fff, "%*s-(%ld)-> ", n * 2, "", (long int)r_ptr->next_exp);
2556 fprintf(fff, "[%d]: ", r_ptr->next_r_idx);
2557 r_ptr = &r_info[r_ptr->next_r_idx];
2559 fprintf(fff, "%s (レベル%d, '%c')\n",
2560 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2562 fprintf(fff, "%s (Level %d, '%c')\n",
2563 r_name + r_ptr->name, r_ptr->level, r_ptr->d_char);
2567 /* End of evolution tree */
2571 /* Free the "evol_tree" array (2-dimension) */
2572 C_KILL(evol_tree_zero, max_r_idx * (MAX_EVOL_DEPTH + 1), int);
2573 C_KILL(evol_tree, max_r_idx, int *);
2575 /* Check for errors */
2576 if (ferror(fff) || my_fclose(fff))
2578 msg_print("Cannot close spoiler file.");
2583 msg_print("Successfully created a spoiler file.");
2591 extern void do_cmd_spoilers(void);
2594 * @brief スポイラー出力を行うコマンドのメインルーチン /
2595 * Create Spoiler files -BEN-
2598 void do_cmd_spoilers(void)
2600 /* Save the screen */
2610 prt("Create a spoiler file.", 2, 0);
2612 /* Prompt for a file */
2613 prt("(1) Brief Object Info (obj-desc.spo)", 5, 5);
2614 prt("(2) Brief Artifact Info (artifact.spo)", 6, 5);
2615 prt("(3) Brief Monster Info (mon-desc.spo)", 7, 5);
2616 prt("(4) Full Monster Info (mon-info.spo)", 8, 5);
2617 prt("(5) Monster Evolution Info (mon-evol.spo)", 9, 5);
2621 prt("コマンド:", 18, 0);
2623 prt("Command: ", 12, 0);
2631 /* Restore the screen */
2637 spoil_obj_desc("obj-desc.spo");
2642 spoil_artifact("artifact.spo");
2647 spoil_mon_desc("mon-desc.spo");
2652 spoil_mon_info("mon-info.spo");
2657 spoil_mon_evol("mon-evol.spo");
2666 /* Flush messages */
2672 * @brief ランダムアーティファクト1件を解析する /
2673 * Fill in an object description structure for a given object
2674 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2675 * @param desc_ptr 記述内容を収める構造体参照ポインタ
2678 static void random_artifact_analyze(object_type *o_ptr, obj_desc_list *desc_ptr)
2680 analyze_general(o_ptr, desc_ptr->description);
2681 analyze_pval(o_ptr, &desc_ptr->pval_info);
2682 analyze_brand(o_ptr, desc_ptr->brands);
2683 analyze_slay(o_ptr, desc_ptr->slays);
2684 analyze_immune(o_ptr, desc_ptr->immunities);
2685 analyze_resist(o_ptr, desc_ptr->resistances);
2686 analyze_sustains(o_ptr, desc_ptr->sustains);
2687 analyze_misc_magic(o_ptr, desc_ptr->misc_magic);
2688 desc_ptr->activation = item_activation(o_ptr);
2690 sprintf(desc_ptr->misc_desc, "重さ %d.%d kg",
2691 lbtokg1(o_ptr->weight), lbtokg2(o_ptr->weight));
2693 sprintf(desc_ptr->misc_desc, "Weight %d.%d lbs",
2694 o_ptr->weight / 10, o_ptr->weight % 10);
2699 * @brief ランダムアーティファクト1件をスポイラー出力する /
2700 * Create a spoiler file entry for an artifact
2701 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2702 * @param art_ptr 記述内容を収めた構造体参照ポインタ
2703 * Fill in an object description structure for a given object
2706 static void spoiler_print_randart(object_type *o_ptr, obj_desc_list *art_ptr)
2708 pval_info_type *pval_ptr = &art_ptr->pval_info;
2712 /* Don't indent the first line */
2713 fprintf(fff, "%s\n", art_ptr->description);
2716 if (!(o_ptr->ident & (IDENT_MENTAL)))
2719 fprintf(fff, "%s不明\n",INDENT1);
2721 fprintf(fff, "%sUnknown\n",INDENT1);
2725 /* An "empty" pval description indicates that the pval affects nothing */
2726 if (pval_ptr->pval_desc[0])
2728 /* Mention the effects of pval */
2730 sprintf(buf, "%sの修正:", pval_ptr->pval_desc);
2732 sprintf(buf, "%s to", pval_ptr->pval_desc);
2734 spoiler_outlist(buf, pval_ptr->pval_affects, ITEM_SEP);
2737 /* Now deal with the description lists */
2740 spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
2741 spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
2742 spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
2743 spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
2744 spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
2746 spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
2747 spoiler_outlist("", art_ptr->brands, LIST_SEP);
2748 spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
2749 spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
2750 spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
2752 spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
2754 /* Write out the possible activation at the primary indention level */
2755 if (art_ptr->activation)
2758 fprintf(fff, "%s発動: %s\n", INDENT1, art_ptr->activation);
2760 fprintf(fff, "%sActivates for %s\n", INDENT1, art_ptr->activation);
2764 /* End with the miscellaneous facts */
2765 fprintf(fff, "%s%s\n\n", INDENT1, art_ptr->misc_desc);
2770 * @brief ランダムアーティファクト内容をスポイラー出力するサブルーチン /
2771 * @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
2772 * @param i 出力したい記録ランダムアーティファクトID
2775 static void spoil_random_artifact_aux(object_type *o_ptr, int i)
2777 obj_desc_list artifact;
2779 if (!object_is_known(o_ptr) || !o_ptr->art_name
2780 || o_ptr->tval != group_artifact[i].tval)
2783 /* Analyze the artifact */
2784 random_artifact_analyze(o_ptr, &artifact);
2786 /* Write out the artifact description to the spoiler file */
2787 spoiler_print_randart(o_ptr, &artifact);
2791 * @brief ランダムアーティファクト内容をスポイラー出力するメインルーチン /
2792 * Create a list file for random artifacts
2793 * @param fname 出力ファイル名
2796 void spoil_random_artifact(cptr fname)
2806 /* Build the filename */
2807 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2809 /* File type is "TEXT" */
2810 FILE_TYPE(FILE_TYPE_TEXT);
2813 fff = my_fopen(buf, "w");
2818 msg_print("Cannot create list file.");
2822 /* Dump the header */
2823 sprintf(buf, "Random artifacts list.\r");
2824 spoiler_underline(buf);
2826 /* List the artifacts by tval */
2827 for (j = 0; group_artifact[j].tval; j++)
2829 /* random artifacts wielding */
2830 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2832 q_ptr = &inventory[i];
2833 spoil_random_artifact_aux(q_ptr, j);
2836 /* random artifacts in inventory */
2837 for (i = 0; i < INVEN_PACK; i++)
2839 q_ptr = &inventory[i];
2840 spoil_random_artifact_aux(q_ptr, j);
2843 /* random artifacts in home */
2844 st_ptr = &town[1].store[STORE_HOME];
2845 for (i = 0; i < st_ptr->stock_num; i++)
2847 q_ptr = &st_ptr->stock[i];
2848 spoil_random_artifact_aux(q_ptr, j);
2851 /* random artifacts in museum */
2852 st_ptr = &town[1].store[STORE_MUSEUM];
2853 for (i = 0; i < st_ptr->stock_num; i++)
2855 q_ptr = &st_ptr->stock[i];
2856 spoil_random_artifact_aux(q_ptr, j);
2860 /* Check for errors */
2861 if (ferror(fff) || my_fclose(fff))
2863 msg_print("Cannot close list file.");
2868 msg_print("Successfully created a list file.");
2875 #endif /* MACINTOSH */