10 #include "spells-object.h"
11 #include "object-boost.h"
12 #include "object-hook.h"
13 #include "object-flavor.h"
14 #include "object-ego.h"
15 #include "player-damage.h"
16 #include "player-status.h"
18 #include "player-effects.h"
19 #include "player-class.h"
20 #include "player-inventory.h"
21 #include "objectkind.h"
23 #include "targeting.h"
24 #include "view-mainwindow.h"
29 OBJECT_TYPE_VALUE tval;
30 OBJECT_SUBTYPE_VALUE sval;
37 * @brief 装備強化処理の失敗率定数(千分率) /
38 * Used by the "enchant" function (chance of failure)
39 * (modified for Zangband, we need better stuff there...) -- TY
42 static int enchant_table[16] =
45 300, 400, 500, 650, 800,
46 950, 987, 993, 995, 998,
52 * Scatter some "amusing" objects near the player
55 #define AMS_NOTHING 0x00 /* No restriction */
56 #define AMS_NO_UNIQUE 0x01 /* Don't make the amusing object of uniques */
57 #define AMS_FIXED_ART 0x02 /* Make a fixed artifact based on the amusing object */
58 #define AMS_MULTIPLE 0x04 /* Drop 1-3 objects for one type */
59 #define AMS_PILE 0x08 /* Drop 1-99 pile objects for one type */
61 static amuse_type amuse_info[] =
63 { TV_BOTTLE, SV_ANY, 5, AMS_NOTHING },
64 { TV_JUNK, SV_ANY, 3, AMS_MULTIPLE },
65 { TV_SPIKE, SV_ANY, 10, AMS_PILE },
66 { TV_STATUE, SV_ANY, 15, AMS_NOTHING },
67 { TV_CORPSE, SV_ANY, 15, AMS_NO_UNIQUE },
68 { TV_SKELETON, SV_ANY, 10, AMS_NO_UNIQUE },
69 { TV_FIGURINE, SV_ANY, 10, AMS_NO_UNIQUE },
70 { TV_PARCHMENT, SV_ANY, 1, AMS_NOTHING },
71 { TV_POLEARM, SV_TSURIZAO, 3, AMS_NOTHING }, //Fishing Pole of Taikobo
72 { TV_SWORD, SV_BROKEN_DAGGER, 3, AMS_FIXED_ART }, //Broken Dagger of Magician
73 { TV_SWORD, SV_BROKEN_DAGGER, 10, AMS_NOTHING },
74 { TV_SWORD, SV_BROKEN_SWORD, 5, AMS_NOTHING },
75 { TV_SCROLL, SV_SCROLL_AMUSEMENT, 10, AMS_NOTHING },
81 * @brief「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'.
82 * Hook to determine if an object is contertible in an arrow/bolt
83 * @return 製造を実際に行ったらTRUE、キャンセルしたらFALSEを返す
85 bool create_ammo(player_type *creature_ptr)
94 GAME_TEXT o_name[MAX_NLEN];
98 if (creature_ptr->lev >= 20)
99 sprintf(com, _("[S]弾, [A]矢, [B]クロスボウの矢 :", "Create [S]hots, Create [A]rrow or Create [B]olt ?"));
100 else if (creature_ptr->lev >= 10)
101 sprintf(com, _("[S]弾, [A]矢:", "Create [S]hots or Create [A]rrow ?"));
103 sprintf(com, _("[S]弾:", "Create [S]hots ?"));
105 if (cmd_limit_confused(creature_ptr)) return FALSE;
106 if (cmd_limit_blind(creature_ptr)) return FALSE;
110 if (!get_com(com, &ch, TRUE))
114 if (ch == 'S' || ch == 's')
119 if ((ch == 'A' || ch == 'a') && (creature_ptr->lev >= 10))
124 if ((ch == 'B' || ch == 'b') && (creature_ptr->lev >= 20))
131 /**********Create shots*********/
138 if (!get_rep_dir(&dir, FALSE)) return FALSE;
139 y = creature_ptr->y + ddy[dir];
140 x = creature_ptr->x + ddx[dir];
141 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
143 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_CAN_DIG))
145 msg_print(_("そこには岩石がない。", "You need pile of rubble."));
148 else if (!cave_have_flag_grid(g_ptr, FF_CAN_DIG) || !cave_have_flag_grid(g_ptr, FF_HURT_ROCK))
150 msg_print(_("硬すぎて崩せなかった。", "You failed to make ammo."));
157 /* Hack -- Give the player some small firestones */
158 object_prep(q_ptr, lookup_kind(TV_SHOT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
159 q_ptr->number = (byte)rand_range(15, 30);
162 apply_magic(q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
163 q_ptr->discount = 99;
165 slot = inven_carry(q_ptr);
167 object_desc(o_name, q_ptr, 0);
168 msg_format(_("%sを作った。", "You make some ammo."), o_name);
170 /* Auto-inscription */
171 if (slot >= 0) autopick_alter_item(slot, FALSE);
173 /* Destroy the wall */
174 cave_alter_feat(y, x, FF_HURT_ROCK);
176 creature_ptr->update |= (PU_FLOW);
179 /**********Create arrows*********/
186 item_tester_hook = item_tester_hook_convertible;
188 q = _("どのアイテムから作りますか? ", "Convert which item? ");
189 s = _("材料を持っていない。", "You have no item to convert.");
190 q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
191 if (!q_ptr) return FALSE;
195 /* Hack -- Give the player some small firestones */
196 object_prep(q_ptr, lookup_kind(TV_ARROW, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
197 q_ptr->number = (byte)rand_range(5, 10);
200 apply_magic(q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
202 q_ptr->discount = 99;
204 object_desc(o_name, q_ptr, 0);
205 msg_format(_("%sを作った。", "You make some ammo."), o_name);
208 slot = inven_carry(q_ptr);
210 /* Auto-inscription */
211 if (slot >= 0) autopick_alter_item(slot, FALSE);
213 /**********Create bolts*********/
220 item_tester_hook = item_tester_hook_convertible;
222 q = _("どのアイテムから作りますか? ", "Convert which item? ");
223 s = _("材料を持っていない。", "You have no item to convert.");
225 q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
226 if (!q_ptr) return FALSE;
230 /* Hack -- Give the player some small firestones */
231 object_prep(q_ptr, lookup_kind(TV_BOLT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
232 q_ptr->number = (byte)rand_range(4, 8);
235 apply_magic(q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
237 q_ptr->discount = 99;
239 object_desc(o_name, q_ptr, 0);
240 msg_format(_("%sを作った。", "You make some ammo."), o_name);
244 slot = inven_carry(q_ptr);
246 /* Auto-inscription */
247 if (slot >= 0) autopick_alter_item(slot, FALSE);
254 * @brief 魔道具術師の魔力取り込み処理
255 * @param user_ptr アイテムを取り込むクリーチャー
256 * @return 取り込みを実行したらTRUE、キャンセルしたらFALSEを返す
258 bool import_magic_device(player_type *user_ptr)
261 PARAMETER_VALUE pval;
265 GAME_TEXT o_name[MAX_NLEN];
267 /* Only accept legal items */
268 item_tester_hook = item_tester_hook_recharge;
270 q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
271 s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
273 o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
274 if (!o_ptr) return (FALSE);
276 if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
278 msg_print(_("この杖には発動の為の能力は何も備わっていないようだ。", "This staff doesn't have any magical ability."));
282 if (!object_is_known(o_ptr))
284 msg_print(_("鑑定されていないと取り込めない。", "You need to identify before absorbing."));
290 msg_print(_("充填中のアイテムは取り込めない。", "This item is still charging."));
295 if (o_ptr->tval == TV_ROD)
297 else if (o_ptr->tval == TV_WAND)
300 if (o_ptr->tval == TV_ROD)
302 user_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)o_ptr->number;
303 if (user_ptr->magic_num2[o_ptr->sval + ext] > 99) user_ptr->magic_num2[o_ptr->sval + ext] = 99;
308 for (num = o_ptr->number; num; num--)
311 if (o_ptr->tval == TV_WAND) gain_num = (pval + num - 1) / num;
312 if (user_ptr->magic_num2[o_ptr->sval + ext])
315 gain_num = (gain_num / 3 + randint0(gain_num / 3)) / 256;
316 if (gain_num < 1) gain_num = 1;
318 user_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)gain_num;
319 if (user_ptr->magic_num2[o_ptr->sval + ext] > 99) user_ptr->magic_num2[o_ptr->sval + ext] = 99;
320 user_ptr->magic_num1[o_ptr->sval + ext] += pval * 0x10000;
321 if (user_ptr->magic_num1[o_ptr->sval + ext] > 99 * 0x10000) user_ptr->magic_num1[o_ptr->sval + ext] = 99 * 0x10000;
322 if (user_ptr->magic_num1[o_ptr->sval + ext] > user_ptr->magic_num2[o_ptr->sval + ext] * 0x10000) user_ptr->magic_num1[o_ptr->sval + ext] = user_ptr->magic_num2[o_ptr->sval + ext] * 0x10000;
323 if (o_ptr->tval == TV_WAND) pval -= (pval + num - 1) / num;
327 object_desc(o_name, o_ptr, 0);
328 msg_format(_("%sの魔力を取り込んだ。", "You absorb magic of %s."), o_name);
330 vary_item(item, -999);
331 take_turn(user_ptr, 100);
338 * @param y1 配置したいフロアのY座標
339 * @param x1 配置したいフロアのX座標
341 * @param known TRUEならばオブジェクトが必ず*鑑定*済になる
344 void amusement(POSITION y1, POSITION x1, int num, bool known)
347 object_type object_type_body;
350 for (n = 0; amuse_info[n].tval != 0; n++)
352 t += amuse_info[n].prob;
359 KIND_OBJECT_IDX k_idx;
360 ARTIFACT_IDX a_idx = 0;
362 bool insta_art, fixed_art;
366 r -= amuse_info[i].prob;
369 i_ptr = &object_type_body;
371 k_idx = lookup_kind(amuse_info[i].tval, amuse_info[i].sval);
373 /* Paranoia - reroll if nothing */
374 if (!k_idx) continue;
376 /* Search an artifact index if need */
377 insta_art = (k_info[k_idx].gen_flags & TRG_INSTA_ART);
378 fixed_art = (amuse_info[i].flag & AMS_FIXED_ART);
380 if (insta_art || fixed_art)
382 for (a_idx = 1; a_idx < max_a_idx; a_idx++)
384 if (insta_art && !(a_info[a_idx].gen_flags & TRG_INSTA_ART)) continue;
385 if (a_info[a_idx].tval != k_info[k_idx].tval) continue;
386 if (a_info[a_idx].sval != k_info[k_idx].sval) continue;
387 if (a_info[a_idx].cur_num > 0) continue;
391 if (a_idx >= max_a_idx) continue;
394 /* Make an object (if possible) */
395 object_prep(i_ptr, k_idx);
396 if (a_idx) i_ptr->name1 = a_idx;
397 apply_magic(i_ptr, 1, AM_NO_FIXED_ART);
399 if (amuse_info[i].flag & AMS_NO_UNIQUE)
401 if (r_info[i_ptr->pval].flags1 & RF1_UNIQUE) continue;
404 if (amuse_info[i].flag & AMS_MULTIPLE) i_ptr->number = randint1(3);
405 if (amuse_info[i].flag & AMS_PILE) i_ptr->number = randint1(99);
413 /* Paranoia - reroll if nothing */
414 if (!(i_ptr->k_idx)) continue;
416 (void)drop_near(i_ptr, -1, y1, x1);
425 * Scatter some "great" objects near the player
426 * @param y1 配置したいフロアのY座標
427 * @param x1 配置したいフロアのX座標
429 * @param great TRUEならば必ず高級品以上を落とす
430 * @param special TRUEならば必ず特別品を落とす
431 * @param known TRUEならばオブジェクトが必ず*鑑定*済になる
434 void acquirement(POSITION y1, POSITION x1, int num, bool great, bool special, bool known)
437 object_type object_type_body;
438 BIT_FLAGS mode = AM_GOOD | (great || special ? AM_GREAT : 0L) | (special ? AM_SPECIAL : 0L);
443 i_ptr = &object_type_body;
446 /* Make a good (or great) object (if possible) */
447 if (!make_object(i_ptr, mode)) continue;
455 (void)drop_near(i_ptr, -1, y1, x1);
460 void acquire_chaos_weapon(player_type *creature_ptr)
463 object_type *q_ptr = &forge;
464 OBJECT_TYPE_VALUE dummy = TV_SWORD;
465 OBJECT_SUBTYPE_VALUE dummy2;
466 switch (randint1(creature_ptr->lev))
472 dummy2 = SV_MAIN_GAUCHE;
481 dummy2 = SV_SMALL_SWORD;
484 dummy2 = SV_BASILLARD;
486 case 11: case 12: case 13:
487 dummy2 = SV_SHORT_SWORD;
496 dummy2 = SV_WAKIZASHI;
505 dummy2 = SV_BROAD_SWORD;
508 dummy2 = SV_LONG_SWORD;
511 dummy2 = SV_SCIMITAR;
520 dummy2 = SV_BASTARD_SWORD;
523 dummy2 = SV_GREAT_SCIMITAR;
526 dummy2 = SV_CLAYMORE;
532 dummy2 = SV_TWO_HANDED_SWORD;
535 dummy2 = SV_FLAMBERGE;
538 dummy2 = SV_NO_DACHI;
541 dummy2 = SV_EXECUTIONERS_SWORD;
544 dummy2 = SV_ZWEIHANDER;
547 dummy2 = SV_HAYABUSA;
550 dummy2 = SV_BLADE_OF_CHAOS;
553 object_prep(q_ptr, lookup_kind(dummy, dummy2));
554 q_ptr->to_h = 3 + randint1(creature_ptr->current_floor_ptr->dun_level) % 10;
555 q_ptr->to_d = 3 + randint1(creature_ptr->current_floor_ptr->dun_level) % 10;
556 one_resistance(q_ptr);
557 q_ptr->name2 = EGO_CHAOTIC;
558 (void)drop_near(q_ptr, -1, creature_ptr->y, creature_ptr->x);
564 * Curse the players armor
565 * @return 実際に呪縛されたらTRUEを返す
567 bool curse_armor(player_type *owner_ptr)
572 GAME_TEXT o_name[MAX_NLEN];
574 /* Curse the body armor */
575 o_ptr = &owner_ptr->inventory_list[INVEN_BODY];
577 /* Nothing to curse */
578 if (!o_ptr->k_idx) return (FALSE);
580 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
582 /* Attempt a saving throw for artifacts */
583 if (object_is_artifact(o_ptr) && (randint0(100) < 50))
587 msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!",
588 "恐怖の暗黒オーラ", "防具", o_name);
590 msg_format("A %s tries to %s, but your %s resists the effects!",
591 "terrible black aura", "surround your armor", o_name);
596 /* not artifact or failed save... */
599 msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
600 chg_virtue(owner_ptr, V_ENCHANT, -5);
602 /* Blast the armor */
604 o_ptr->name2 = EGO_BLASTED;
605 o_ptr->to_a = 0 - randint1(5) - randint1(5);
612 for (i = 0; i < TR_FLAG_SIZE; i++)
613 o_ptr->art_flags[i] = 0;
616 o_ptr->curse_flags = TRC_CURSED;
619 o_ptr->ident |= (IDENT_BROKEN);
620 owner_ptr->update |= (PU_BONUS | PU_MANA);
621 owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
630 * Curse the players weapon
631 * @param owner_ptr 所持者の参照ポインタ
632 * @param force 無条件に呪縛を行うならばTRUE
633 * @param o_ptr 呪縛する武器のアイテム情報参照ポインタ
634 * @return 実際に呪縛されたらTRUEを返す
636 bool curse_weapon_object(player_type *owner_ptr, bool force, object_type *o_ptr)
639 GAME_TEXT o_name[MAX_NLEN];
641 /* Nothing to curse */
642 if (!o_ptr->k_idx) return (FALSE);
643 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
645 /* Attempt a saving throw */
646 if (object_is_artifact(o_ptr) && (randint0(100) < 50) && !force)
650 msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!",
651 "恐怖の暗黒オーラ", "武器", o_name);
653 msg_format("A %s tries to %s, but your %s resists the effects!",
654 "terrible black aura", "surround your weapon", o_name);
658 /* not artifact or failed save... */
661 if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
662 chg_virtue(owner_ptr, V_ENCHANT, -5);
664 /* Shatter the weapon */
666 o_ptr->name2 = EGO_SHATTERED;
667 o_ptr->to_h = 0 - randint1(5) - randint1(5);
668 o_ptr->to_d = 0 - randint1(5) - randint1(5);
674 for (i = 0; i < TR_FLAG_SIZE; i++)
675 o_ptr->art_flags[i] = 0;
678 o_ptr->curse_flags = TRC_CURSED;
681 o_ptr->ident |= (IDENT_BROKEN);
682 owner_ptr->update |= (PU_BONUS | PU_MANA);
683 owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
692 * @param caster_ptr 錆止め実行者の参照ポインタ
693 * @return ターン消費を要する処理を行ったならばTRUEを返す
695 bool rustproof(player_type *caster_ptr)
699 GAME_TEXT o_name[MAX_NLEN];
702 /* Select a piece of armour */
703 item_tester_hook = object_is_armour;
705 q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
706 s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
708 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
709 if (!o_ptr) return FALSE;
711 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
713 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
715 if ((o_ptr->to_a < 0) && !object_is_cursed(o_ptr))
718 msg_format("%sは新品同様になった!", o_name);
720 msg_format("%s %s look%s as good as new!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
727 msg_format("%sは腐食しなくなった。", o_name);
729 msg_format("%s %s %s now protected against corrosion.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "are" : "is"));
732 calc_android_exp(caster_ptr);
738 * @brief ボルトのエゴ化処理(火炎エゴのみ) /
740 * @param caster_ptr プレーヤーへの参照ポインタ
743 void brand_bolts(player_type *caster_ptr)
745 /* Use the first acceptable bolts */
746 for (int i = 0; i < INVEN_PACK; i++)
748 object_type *o_ptr = &caster_ptr->inventory_list[i];
751 if (o_ptr->tval != TV_BOLT) continue;
753 /* Skip artifacts and ego-items */
754 if (object_is_artifact(o_ptr) || object_is_ego(o_ptr))
757 /* Skip cursed/broken items */
758 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) continue;
761 if (randint0(100) < 75) continue;
763 msg_print(_("クロスボウの矢が炎のオーラに包まれた!", "Your bolts are covered in a fiery aura!"));
766 o_ptr->name2 = EGO_FLAME;
767 enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
771 if (flush_failure) flush();
772 msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed."));
776 bool perilous_secrets(player_type *user_ptr)
778 if (!ident_spell(user_ptr, FALSE)) return FALSE;
780 if (mp_ptr->spell_book)
782 /* Sufficient mana */
783 if (20 <= user_ptr->csp)
789 /* Over-exert the player */
792 int oops = 20 - user_ptr->csp;
796 user_ptr->csp_frac = 0;
798 msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
799 /* Hack -- Bypass free action */
800 (void)set_paralyzed(user_ptr, user_ptr->paralyzed + randint1(5 * oops + 1));
803 (void)set_confused(user_ptr, user_ptr->confused + randint1(5 * oops + 1));
805 user_ptr->redraw |= (PR_MANA);
807 take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
809 if (one_in_(5)) (void)set_confused(user_ptr, user_ptr->confused + randint1(10));
811 /* Exercise a little care... */
812 if (one_in_(20)) take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
819 * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
820 * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
821 * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
824 void get_bloody_moon_flags(object_type *o_ptr)
828 for (i = 0; i < TR_FLAG_SIZE; i++)
829 o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
831 dummy = randint1(2) + randint1(2);
832 for (i = 0; i < dummy; i++)
834 int flag = randint0(26);
835 if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
836 else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
837 else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
838 else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
842 for (i = 0; i < dummy; i++) one_resistance(o_ptr);
844 for (i = 0; i < 2; i++)
846 int tmp = randint0(11);
847 if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
848 else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
854 * @brief 寿命つき光源の燃素追加処理 /
855 * Charge a lite (torch or latern)
858 void phlogiston(player_type *caster_ptr)
860 GAME_TURN max_flog = 0;
861 object_type * o_ptr = &caster_ptr->inventory_list[INVEN_LITE];
864 if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
866 max_flog = FUEL_LAMP;
870 else if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))
872 max_flog = FUEL_TORCH;
875 /* No torch to refill */
878 msg_print(_("燃素を消費するアイテムを装備していません。", "You are not wielding anything which uses phlogiston."));
882 if (o_ptr->xtra4 >= max_flog)
884 msg_print(_("このアイテムにはこれ以上燃素を補充できません。", "No more phlogiston can be put in this item."));
889 o_ptr->xtra4 += (XTRA16)(max_flog / 2);
890 msg_print(_("照明用アイテムに燃素を補充した。", "You add phlogiston to your light item."));
892 if (o_ptr->xtra4 >= max_flog)
894 o_ptr->xtra4 = (XTRA16)max_flog;
895 msg_print(_("照明用アイテムは満タンになった。", "Your light item is full."));
898 caster_ptr->update |= (PU_TORCH);
905 * @return ターン消費を要する処理を行ったならばTRUEを返す
907 bool bless_weapon(player_type *caster_ptr)
911 BIT_FLAGS flgs[TR_FLAG_SIZE];
912 GAME_TEXT o_name[MAX_NLEN];
915 /* Bless only weapons */
916 item_tester_hook = object_is_weapon;
918 q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
919 s = _("祝福できる武器がありません。", "You have weapon to bless.");
921 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
922 if (!o_ptr) return FALSE;
924 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
925 object_flags(o_ptr, flgs);
927 if (object_is_cursed(o_ptr))
929 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) ||
930 have_flag(flgs, TR_ADD_L_CURSE) ||
931 have_flag(flgs, TR_ADD_H_CURSE) ||
932 (o_ptr->curse_flags & TRC_PERMA_CURSE))
935 msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name);
937 msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name);
944 msg_format("%s から邪悪なオーラが消えた。", o_name);
946 msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name);
950 o_ptr->curse_flags = 0L;
952 o_ptr->ident |= (IDENT_SENSE);
953 o_ptr->feeling = FEEL_NONE;
955 /* Recalculate the bonuses */
956 caster_ptr->update |= (PU_BONUS);
957 caster_ptr->window |= (PW_EQUIP);
961 * Next, we try to bless it. Artifacts have a 1/3 chance of
962 * being blessed, otherwise, the operation simply disenchants
963 * them, godly power negating the magic. Ok, the explanation
964 * is silly, but otherwise priests would always bless every
965 * artifact weapon they find. Ego weapons and normal weapons
966 * can be blessed automatically.
968 if (have_flag(flgs, TR_BLESSED))
971 msg_format("%s は既に祝福されている。", o_name);
973 msg_format("%s %s %s blessed already.",
974 ((item >= 0) ? "Your" : "The"), o_name,
975 ((o_ptr->number > 1) ? "were" : "was"));
981 if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3))
984 msg_format("%sは輝いた!", o_name);
986 msg_format("%s %s shine%s!",
987 ((item >= 0) ? "Your" : "The"), o_name,
988 ((o_ptr->number > 1) ? "" : "s"));
991 add_flag(o_ptr->art_flags, TR_BLESSED);
992 o_ptr->discount = 99;
996 bool dis_happened = FALSE;
997 msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!"));
999 /* Disenchant tohit */
1000 if (o_ptr->to_h > 0)
1003 dis_happened = TRUE;
1006 if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
1008 /* Disenchant todam */
1009 if (o_ptr->to_d > 0)
1012 dis_happened = TRUE;
1015 if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
1017 /* Disenchant toac */
1018 if (o_ptr->to_a > 0)
1021 dis_happened = TRUE;
1024 if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
1028 msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air..."));
1031 msg_format("%s は劣化した!", o_name);
1033 msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name,
1034 ((o_ptr->number > 1) ? "were" : "was"));
1040 caster_ptr->update |= (PU_BONUS);
1041 caster_ptr->window |= (PW_EQUIP | PW_PLAYER);
1042 calc_android_exp(caster_ptr);
1051 * @return ターン消費を要する処理を行ったならばTRUEを返す
1053 bool pulish_shield(player_type *caster_ptr)
1057 BIT_FLAGS flgs[TR_FLAG_SIZE];
1058 GAME_TEXT o_name[MAX_NLEN];
1061 /* Assume enchant weapon */
1062 item_tester_tval = TV_SHIELD;
1064 q = _("どの盾を磨きますか?", "Pulish which weapon? ");
1065 s = _("磨く盾がありません。", "You have weapon to pulish.");
1067 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1068 if (!o_ptr) return FALSE;
1070 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1071 object_flags(o_ptr, flgs);
1073 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1074 !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
1077 msg_format("%sは輝いた!", o_name);
1079 msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
1081 o_ptr->name2 = EGO_REFLECTION;
1082 enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOAC);
1084 o_ptr->discount = 99;
1085 chg_virtue(caster_ptr, V_ENCHANT, 2);
1091 if (flush_failure) flush();
1093 msg_print(_("失敗した。", "Failed."));
1094 chg_virtue(caster_ptr, V_ENCHANT, -2);
1096 calc_android_exp(caster_ptr);
1103 * @brief 呪いの打ち破り処理 /
1104 * Break the curse of an item
1105 * @param o_ptr 呪い装備情報の参照ポインタ
1108 static void break_curse(object_type *o_ptr)
1110 if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
1112 msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!"));
1114 o_ptr->curse_flags = 0L;
1115 o_ptr->ident |= (IDENT_SENSE);
1116 o_ptr->feeling = FEEL_NONE;
1123 * Enchants a plus onto an item. -RAK-
1124 * @param caster_ptr プレーヤーへの参照ポインタ
1125 * @param o_ptr 強化するアイテムの参照ポインタ
1127 * @param eflag 強化オプション(命中/ダメージ/AC)
1128 * @return 強化に成功した場合TRUEを返す
1131 * Revamped! Now takes item pointer, number of times to try enchanting,
1132 * and a flag of what to try enchanting. Artifacts resist enchantment
1133 * some of the time, and successful enchantment to at least +0 might
1134 * break a curse on the item. -CFT-
1136 * Note that an item can technically be enchanted all the way to +15 if
1137 * you wait a very, very, long time. Going from +9 to +10 only works
1138 * about 5% of the time, and from +10 to +11 only about 1% of the time.
1140 * Note that this function can now be used on "piles" of items, and
1141 * the larger the pile, the lower the chance of success.
1144 bool enchant(player_type *caster_ptr, object_type *o_ptr, int n, int eflag)
1146 int i, chance, prob;
1148 bool a = object_is_artifact(o_ptr);
1149 bool force = (eflag & ENCH_FORCE);
1151 /* Large piles resist enchantment */
1152 prob = o_ptr->number * 100;
1154 /* Missiles are easy to enchant */
1155 if ((o_ptr->tval == TV_BOLT) ||
1156 (o_ptr->tval == TV_ARROW) ||
1157 (o_ptr->tval == TV_SHOT))
1163 for (i = 0; i < n; i++)
1165 /* Hack -- Roll for pile resistance */
1166 if (!force && randint0(prob) >= 100) continue;
1168 /* Enchant to hit */
1169 if (eflag & ENCH_TOHIT)
1171 if (o_ptr->to_h < 0) chance = 0;
1172 else if (o_ptr->to_h > 15) chance = 1000;
1173 else chance = enchant_table[o_ptr->to_h];
1175 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
1180 /* only when you get it above -1 -CFT */
1181 if (o_ptr->to_h >= 0)
1186 /* Enchant to damage */
1187 if (eflag & ENCH_TODAM)
1189 if (o_ptr->to_d < 0) chance = 0;
1190 else if (o_ptr->to_d > 15) chance = 1000;
1191 else chance = enchant_table[o_ptr->to_d];
1193 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
1198 /* only when you get it above -1 -CFT */
1199 if (o_ptr->to_d >= 0)
1204 /* Enchant to armor class */
1205 if (eflag & ENCH_TOAC)
1207 if (o_ptr->to_a < 0) chance = 0;
1208 else if (o_ptr->to_a > 15) chance = 1000;
1209 else chance = enchant_table[o_ptr->to_a];
1211 if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
1216 /* only when you get it above -1 -CFT */
1217 if (o_ptr->to_a >= 0)
1224 if (!res) return (FALSE);
1225 caster_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
1226 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1228 calc_android_exp(caster_ptr);
1236 * @brief 装備修正強化処理のメインルーチン /
1237 * Enchant an item (in the inventory or on the floor)
1238 * @param caster_ptr プレーヤーへの参照ポインタ
1239 * @param num_hit 命中修正量
1240 * @param num_dam ダメージ修正量
1241 * @param num_ac AC修正量
1242 * @return 強化に成功した場合TRUEを返す
1244 * Note that "num_ac" requires armour, else weapon
1245 * Returns TRUE if attempted, FALSE if cancelled
1247 bool enchant_spell(player_type *caster_ptr, HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
1252 GAME_TEXT o_name[MAX_NLEN];
1255 /* Assume enchant weapon */
1256 item_tester_hook = object_allow_enchant_weapon;
1258 /* Enchant armor if requested */
1259 if (num_ac) item_tester_hook = object_is_armour;
1261 q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
1262 s = _("強化できるアイテムがない。", "You have nothing to enchant.");
1264 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1265 if (!o_ptr) return (FALSE);
1267 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1269 msg_format("%s は明るく輝いた!", o_name);
1271 msg_format("%s %s glow%s brightly!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
1275 if (enchant(caster_ptr, o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
1276 if (enchant(caster_ptr, o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
1277 if (enchant(caster_ptr, o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
1282 if (flush_failure) flush();
1283 msg_print(_("強化に失敗した。", "The enchantment failed."));
1284 if (one_in_(3)) chg_virtue(caster_ptr, V_ENCHANT, -1);
1287 chg_virtue(caster_ptr, V_ENCHANT, 1);
1289 calc_android_exp(caster_ptr);
1291 /* Something happened */
1297 * @brief 武器へのエゴ付加処理 /
1298 * Brand the current weapon
1299 * @param caster_ptr プレーヤーへの参照ポインタ
1300 * @param brand_type エゴ化ID(e_info.txtとは連動していない)
1303 void brand_weapon(player_type *caster_ptr, int brand_type)
1309 /* Assume enchant weapon */
1310 item_tester_hook = object_allow_enchant_melee_weapon;
1312 q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
1313 s = _("強化できる武器がない。", "You have nothing to enchant.");
1315 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
1318 /* you can never modify artifacts / ego-items */
1319 /* you can never modify cursed items */
1320 /* TY: You _can_ modify broken items (if you're silly enough) */
1321 if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1322 !object_is_cursed(o_ptr) &&
1323 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1324 !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1325 !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1329 /* Let's get the name before it is changed... */
1330 GAME_TEXT o_name[MAX_NLEN];
1331 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1336 if (o_ptr->tval == TV_SWORD)
1338 act = _("は鋭さを増した!", "becomes very sharp!");
1340 o_ptr->name2 = EGO_SHARPNESS;
1341 o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, caster_ptr->current_floor_ptr->dun_level) + 1;
1343 if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
1348 act = _("は破壊力を増した!", "seems very powerful.");
1349 o_ptr->name2 = EGO_EARTHQUAKES;
1350 o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, caster_ptr->current_floor_ptr->dun_level);
1354 act = _("は人間の血を求めている!", "seems to be looking for humans!");
1355 o_ptr->name2 = EGO_KILL_HUMAN;
1358 act = _("は電撃に覆われた!", "covered with lightning!");
1359 o_ptr->name2 = EGO_BRAND_ELEC;
1362 act = _("は酸に覆われた!", "coated with acid!");
1363 o_ptr->name2 = EGO_BRAND_ACID;
1366 act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
1367 o_ptr->name2 = EGO_KILL_EVIL;
1370 act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
1371 o_ptr->name2 = EGO_KILL_DEMON;
1374 act = _("は屍を求めている!", "seems to be looking for undead!");
1375 o_ptr->name2 = EGO_KILL_UNDEAD;
1378 act = _("は動物の血を求めている!", "seems to be looking for animals!");
1379 o_ptr->name2 = EGO_KILL_ANIMAL;
1382 act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
1383 o_ptr->name2 = EGO_KILL_DRAGON;
1386 act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
1387 o_ptr->name2 = EGO_KILL_TROLL;
1390 act = _("はオークの血を求めている!", "seems to be looking for orcs!");
1391 o_ptr->name2 = EGO_KILL_ORC;
1394 act = _("は巨人の血を求めている!", "seems to be looking for giants!");
1395 o_ptr->name2 = EGO_KILL_GIANT;
1398 act = _("は非常に不安定になったようだ。", "seems very unstable now.");
1399 o_ptr->name2 = EGO_TRUMP;
1400 o_ptr->pval = randint1(2);
1403 act = _("は血を求めている!", "thirsts for blood!");
1404 o_ptr->name2 = EGO_VAMPIRIC;
1407 act = _("は毒に覆われた。", "is coated with poison.");
1408 o_ptr->name2 = EGO_BRAND_POIS;
1411 act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
1412 o_ptr->name2 = EGO_CHAOTIC;
1415 act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
1416 o_ptr->name2 = EGO_BRAND_FIRE;
1419 act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
1420 o_ptr->name2 = EGO_BRAND_COLD;
1424 msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
1425 enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1427 o_ptr->discount = 99;
1428 chg_virtue(caster_ptr, V_ENCHANT, 2);
1432 if (flush_failure) flush();
1434 msg_print(_("属性付加に失敗した。", "The Branding failed."));
1435 chg_virtue(caster_ptr, V_ENCHANT, -2);
1438 calc_android_exp(caster_ptr);