1 #include "system/angband.h"
3 #include "object-enchant/item-feeling.h"
4 #include "object-enchant/object-curse.h"
5 #include "object/object-flavor.h"
6 #include "object/object-hook.h"
7 #include "object/object1.h"
8 #include "object-enchant/tr-types.h"
9 #include "object-enchant/trc-types.h"
12 #define TRC_SPECIAL_MASK (TRC_TY_CURSE | TRC_AGGRAVATE)
13 #define TRC_HEAVY_MASK (TRC_TY_CURSE | TRC_AGGRAVATE | TRC_DRAIN_EXP | TRC_ADD_H_CURSE | TRC_CALL_DEMON | TRC_CALL_DRAGON | TRC_CALL_UNDEAD | TRC_TELEPORT)
16 * @brief アイテムに付加される可能性のある呪いを指定する。
18 * @param o_ptr 呪いをかけられる装備オブジェクトの構造体参照ポインタ
21 BIT_FLAGS get_curse(int power, object_type *o_ptr)
27 new_curse = (1 << (randint0(MAX_CURSE)+4));
30 if (!(new_curse & TRC_HEAVY_MASK)) continue;
34 if (new_curse & TRC_SPECIAL_MASK) continue;
38 if (new_curse & TRC_HEAVY_MASK) continue;
41 if (new_curse == TRC_LOW_MELEE && !object_is_weapon(o_ptr)) continue;
42 if (new_curse == TRC_LOW_AC && !object_is_armour(o_ptr)) continue;
51 * @brief 装備への呪い付加判定と付加処理
52 * @param owner_ptr プレーヤーへの参照ポインタ
53 * @param chance 呪いの基本確率
54 * @param heavy_chance さらに重い呪いとなる確率
57 void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy_chance)
59 if (randint1(100) > chance) return;
61 object_type *o_ptr = &owner_ptr->inventory_list[INVEN_RARM + randint0(12)];
62 if (!o_ptr->k_idx) return;
63 BIT_FLAGS oflgs[TR_FLAG_SIZE];
64 object_flags(o_ptr, oflgs);
65 GAME_TEXT o_name[MAX_NLEN];
66 object_desc(owner_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
68 /* Extra, biased saving throw for blessed items */
69 if (have_flag(oflgs, TR_BLESSED))
72 msg_format("祝福された%sは呪いを跳ね返した!", o_name);
74 msg_format("Your blessed %s resist%s cursing!", o_name, ((o_ptr->number > 1) ? "" : "s"));
76 /* Hmmm -- can we wear multiple items? If not, this is unnecessary */
82 if ((randint1(100) <= heavy_chance) &&
83 (object_is_artifact(o_ptr) || object_is_ego(o_ptr)))
85 if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE))
87 o_ptr->curse_flags |= TRC_HEAVY_CURSE;
88 o_ptr->curse_flags |= TRC_CURSED;
93 if (!object_is_cursed(o_ptr))
95 o_ptr->curse_flags |= TRC_CURSED;
98 if (heavy_chance >= 50) curse_power++;
100 BIT_FLAGS new_curse = get_curse(curse_power, o_ptr);
101 if (!(o_ptr->curse_flags & new_curse))
104 o_ptr->curse_flags |= new_curse;
109 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding %s..."), o_name);
110 o_ptr->feeling = FEEL_NONE;
113 owner_ptr->update |= PU_BONUS;