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;
33 if (new_curse == TRC_LOW_MELEE && !object_is_weapon(o_ptr)) continue;
34 if (new_curse == TRC_LOW_AC && !object_is_armour(o_ptr)) continue;
43 * @brief 装備への呪い付加判定と付加処理
44 * @param owner_ptr プレーヤーへの参照ポインタ
45 * @param chance 呪いの基本確率
46 * @param heavy_chance さらに重い呪いとなる確率
49 void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy_chance)
51 if (randint1(100) > chance) return;
53 object_type *o_ptr = &owner_ptr->inventory_list[INVEN_RARM + randint0(12)];
54 if (!o_ptr->k_idx) return;
55 BIT_FLAGS oflgs[TR_FLAG_SIZE];
56 object_flags(o_ptr, oflgs);
57 GAME_TEXT o_name[MAX_NLEN];
58 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
60 /* Extra, biased saving throw for blessed items */
61 if (have_flag(oflgs, TR_BLESSED))
64 msg_format("祝福された%sは呪いを跳ね返した!", o_name);
66 msg_format("Your blessed %s resist%s cursing!", o_name, ((o_ptr->number > 1) ? "" : "s"));
68 /* Hmmm -- can we wear multiple items? If not, this is unnecessary */
74 if ((randint1(100) <= heavy_chance) &&
75 (object_is_artifact(o_ptr) || object_is_ego(o_ptr)))
77 if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE))
79 o_ptr->curse_flags |= TRC_HEAVY_CURSE;
80 o_ptr->curse_flags |= TRC_CURSED;
85 if (!object_is_cursed(o_ptr))
87 o_ptr->curse_flags |= TRC_CURSED;
90 if (heavy_chance >= 50) curse_power++;
92 BIT_FLAGS new_curse = get_curse(curse_power, o_ptr);
93 if (!(o_ptr->curse_flags & new_curse))
96 o_ptr->curse_flags |= new_curse;
101 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding %s..."), o_name);
102 o_ptr->feeling = FEEL_NONE;
105 owner_ptr->update |= PU_BONUS;