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