1 #include "market/building-enchanter.h"
2 #include "flavor/flavor-describer.h"
3 #include "flavor/object-flavor-types.h"
4 #include "floor/floor-object.h"
5 #include "game-option/disturbance-options.h"
6 #include "inventory/inventory-slot-types.h"
7 #include "market/building-util.h"
8 #include "object/item-use-flags.h"
9 #include "racial/racial-android.h"
10 #include "spell/spells-object.h"
11 #include "system/item-entity.h"
12 #include "system/player-type-definition.h"
13 #include "term/screen-processor.h"
14 #include "view/display-messages.h"
17 * @brief アイテムの強化を行う。 / Enchant item
18 * @param player_ptr プレイヤーへの参照ポインタ
20 * @param to_hit 命中をアップさせる量
21 * @param to_dam ダメージをアップさせる量
22 * @param to_ac ACをアップさせる量
25 bool enchant_item(PlayerType *player_ptr, PRICE cost, HIT_PROB to_hit, int to_dam, ARMOUR_CLASS to_ac, const ItemTester &item_tester)
28 int maxenchant = (player_ptr->lev / 5);
29 prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0);
30 prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0);
32 concptr q = _("どのアイテムを改良しますか?", "Improve which item? ");
33 concptr s = _("改良できるものがありません。", "You have nothing to improve.");
37 o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT), item_tester);
42 char tmp_str[MAX_NLEN];
43 const PRICE total_cost = cost * o_ptr->number;
44 if (player_ptr->au < total_cost) {
45 describe_flavor(player_ptr, tmp_str, o_ptr, OD_NAME_ONLY);
46 msg_format(_("%sを改良するだけのゴールドがありません!", "You do not have the gold to improve %s!"), tmp_str);
51 for (int i = 0; i < to_hit; i++) {
52 if ((o_ptr->to_h < maxenchant) && enchant_equipment(player_ptr, o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE))) {
58 for (int i = 0; i < to_dam; i++) {
59 if ((o_ptr->to_d < maxenchant) && enchant_equipment(player_ptr, o_ptr, 1, (ENCH_TODAM | ENCH_FORCE))) {
65 for (int i = 0; i < to_ac; i++) {
66 if ((o_ptr->to_a < maxenchant) && enchant_equipment(player_ptr, o_ptr, 1, (ENCH_TOAC | ENCH_FORCE))) {
76 msg_print(_("改良に失敗した。", "The improvement failed."));
80 describe_flavor(player_ptr, tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
82 msg_format("$%dで%sに改良しました。", total_cost, tmp_str);
84 msg_format("Improved into %s for %d gold.", tmp_str, total_cost);
87 player_ptr->au -= total_cost;
88 if (item >= INVEN_MAIN_HAND) {
89 calc_android_exp(player_ptr);