4 #include "object-flavor.h"
5 #include "object-hook.h"
8 * @brief アイテムに付加される可能性のある呪いを指定する。
10 * @param o_ptr 呪いをかけられる装備オブジェクトの構造体参照ポインタ
13 BIT_FLAGS get_curse(int power, object_type *o_ptr)
19 new_curse = (1 << (randint0(MAX_CURSE)+4));
22 if (!(new_curse & TRC_HEAVY_MASK)) continue;
26 if (new_curse & TRC_SPECIAL_MASK) continue;
30 if (new_curse & TRC_HEAVY_MASK) continue;
32 if (new_curse == TRC_LOW_MELEE && !object_is_weapon(o_ptr)) continue;
33 if (new_curse == TRC_LOW_AC && !object_is_armour(o_ptr)) continue;
40 * @brief 装備への呪い付加判定と付加処理
41 * @param chance 呪いの基本確率
42 * @param heavy_chance さらに重い呪いとなる確率
45 void curse_equipment(PERCENTAGE chance, PERCENTAGE heavy_chance)
50 BIT_FLAGS oflgs[TR_FLAG_SIZE];
51 object_type *o_ptr = &p_ptr->inventory_list[INVEN_RARM + randint0(12)];
52 GAME_TEXT o_name[MAX_NLEN];
54 if (randint1(100) > chance) return;
55 if (!o_ptr->k_idx) return;
56 object_flags(o_ptr, oflgs);
57 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
59 /* Extra, biased saving throw for blessed items */
60 if (have_flag(oflgs, TR_BLESSED))
63 msg_format("祝福された%sは呪いを跳ね返した!", o_name);
65 msg_format("Your blessed %s resist%s cursing!", o_name, ((o_ptr->number > 1) ? "" : "s"));
67 /* Hmmm -- can we wear multiple items? If not, this is unnecessary */
71 if ((randint1(100) <= heavy_chance) &&
72 (object_is_artifact(o_ptr) || object_is_ego(o_ptr)))
74 if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE))
76 o_ptr->curse_flags |= TRC_HEAVY_CURSE;
77 o_ptr->curse_flags |= TRC_CURSED;
82 if (!object_is_cursed(o_ptr))
84 o_ptr->curse_flags |= TRC_CURSED;
86 if (heavy_chance >= 50) curse_power++;
88 new_curse = get_curse(curse_power, o_ptr);
89 if (!(o_ptr->curse_flags & new_curse))
92 o_ptr->curse_flags |= new_curse;
97 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding %s..."), o_name);
98 o_ptr->feeling = FEEL_NONE;
100 p_ptr->update |= (PU_BONUS);