1 #include "mind/mind-priest.h"
2 #include "core/player-update-types.h"
3 #include "core/window-redrawer.h"
4 #include "flavor/flavor-describer.h"
5 #include "flavor/object-flavor-types.h"
6 #include "floor/floor-object.h"
7 #include "object-enchant/item-feeling.h"
8 #include "object-enchant/special-object-flags.h"
9 #include "object-enchant/trc-types.h"
10 #include "object-enchant/tr-types.h"
11 #include "object-hook/hook-checker.h"
12 #include "object-hook/hook-enchant.h"
13 #include "object-hook/hook-weapon.h"
14 #include "object/item-tester-hooker.h"
15 #include "object/item-use-flags.h"
16 #include "object/object-flags.h"
17 #include "racial/racial-android.h"
18 #include "system/object-type-definition.h"
19 #include "system/player-type-definition.h"
20 #include "util/bit-flags-calculator.h"
21 #include "view/display-messages.h"
26 * @return ターン消費を要する処理を行ったならばTRUEを返す
28 bool bless_weapon(player_type *caster_ptr)
30 item_tester_hook = object_is_weapon;
32 concptr q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
33 concptr s = _("祝福できる武器がありません。", "You have weapon to bless.");
36 object_type *o_ptr = choose_object(caster_ptr, &item, q, s, USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT, TV_NONE);
40 GAME_TEXT o_name[MAX_NLEN];
41 describe_flavor(caster_ptr, o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
42 BIT_FLAGS flgs[TR_FLAG_SIZE];
43 object_flags(caster_ptr, o_ptr, flgs);
45 if (object_is_cursed(o_ptr)) {
46 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || has_flag(flgs, TR_ADD_L_CURSE) || has_flag(flgs, TR_ADD_H_CURSE)
47 || (o_ptr->curse_flags & TRC_PERMA_CURSE)) {
49 msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name);
51 msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name);
58 msg_format("%s から邪悪なオーラが消えた。", o_name);
60 msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name);
62 o_ptr->curse_flags = 0L;
63 set_bits(o_ptr->ident, IDENT_SENSE);
64 set_bits(o_ptr->feeling, FEEL_NONE);
65 set_bits(caster_ptr->update, PU_BONUS);
66 set_bits(caster_ptr->window_flags, PW_EQUIP | PW_FLOOR_ITEM_LIST);
70 * Next, we try to bless it. Artifacts have a 1/3 chance of
71 * being blessed, otherwise, the operation simply disenchants
72 * them, godly power negating the magic. Ok, the explanation
73 * is silly, but otherwise priests would always bless every
74 * artifact weapon they find. Ego weapons and normal weapons
75 * can be blessed automatically.
77 if (has_flag(flgs, TR_BLESSED)) {
79 msg_format("%s は既に祝福されている。", o_name);
81 msg_format("%s %s %s blessed already.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
86 if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) {
88 msg_format("%sは輝いた!", o_name);
90 msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
92 add_flag(o_ptr->art_flags, TR_BLESSED);
95 bool dis_happened = FALSE;
96 msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!"));
98 /* Disenchant tohit */
99 if (o_ptr->to_h > 0) {
104 if ((o_ptr->to_h > 5) && (randint0(100) < 33))
107 /* Disenchant todam */
108 if (o_ptr->to_d > 0) {
113 if ((o_ptr->to_d > 5) && (randint0(100) < 33))
116 /* Disenchant toac */
117 if (o_ptr->to_a > 0) {
122 if ((o_ptr->to_a > 5) && (randint0(100) < 33))
126 msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air..."));
129 msg_format("%s は劣化した!", o_name);
131 msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "were" : "was"));
136 set_bits(caster_ptr->update, PU_BONUS);
137 set_bits(caster_ptr->window_flags, PW_EQUIP | PW_PLAYER | PW_FLOOR_ITEM_LIST);
138 calc_android_exp(caster_ptr);