OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-Calc-To-Hit' into develop
[hengband/hengband.git] / src / market / building-craft-fix.c
index 3eb4b53..f3d27cb 100644 (file)
@@ -1,20 +1,32 @@
 #include "market/building-craft-fix.h"
+#include "artifact/fixed-art-types.h"
+#include "artifact/artifact-info.h"
+#include "core/asking-player.h"
+#include "core/player-update-types.h"
 #include "core/stuff-handler.h"
+#include "flavor/flavor-describer.h"
+#include "flavor/object-flavor-types.h"
+#include "floor/floor-object.h"
 #include "inventory/inventory-object.h"
-#include "inventory/player-inventory.h"
 #include "market/building-util.h"
-#include "object/artifact.h"
+#include "object-enchant/object-boost.h"
+#include "object-enchant/special-object-flags.h"
+#include "object-enchant/tr-types.h"
+#include "object-hook/hook-enchant.h"
+#include "object-hook/hook-weapon.h"
+#include "object/item-tester-hooker.h"
 #include "object/item-use-flags.h"
-#include "object/object-boost.h"
-#include "object/object-flavor.h"
-#include "object/object-hook.h"
+#include "object/object-flags.h"
+#include "object/object-kind-hook.h"
 #include "object/object-kind.h"
-#include "object/object2.h"
-#include "object/special-object-flags.h"
-#include "object/sv-other-types.h"
-#include "object/sv-weapon-types.h"
-#include "object/tr-types.h"
-#include "player/player-effects.h"
+#include "object/object-value.h"
+#include "racial/racial-android.h"
+#include "spell-realm/spells-hex.h"
+#include "sv-definition/sv-other-types.h"
+#include "sv-definition/sv-weapon-types.h"
+#include "term/screen-processor.h"
+#include "util/bit-flags-calculator.h"
+#include "view/display-messages.h"
 
 /*!
  * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
  * @param from_ptr 修復材料オブジェクトの構造体の参照ポインタ。
  * @return 修復対象になるならTRUEを返す。
  */
-static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
+static void give_one_ability_of_object(player_type *player_ptr, object_type *to_ptr, object_type *from_ptr)
 {
     BIT_FLAGS to_flgs[TR_FLAG_SIZE];
     BIT_FLAGS from_flgs[TR_FLAG_SIZE];
-    object_flags(to_ptr, to_flgs);
-    object_flags(from_ptr, from_flgs);
+    object_flags(player_ptr, to_ptr, to_flgs);
+    object_flags(player_ptr, from_ptr, from_flgs);
 
     int n = 0;
     int cand[TR_FLAG_MAX];
@@ -48,7 +60,7 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt
         case TR_FIXED_FLAVOR:
             break;
         default:
-            if (have_flag(from_flgs, i) && !have_flag(to_flgs, i)) {
+            if (has_flag(from_flgs, i) && !has_flag(to_flgs, i)) {
                 if (!(is_pval_flag(i) && (from_ptr->pval < 1)))
                     cand[n++] = i;
             }
@@ -103,7 +115,7 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
     }
 
     char basenm[MAX_NLEN];
-    object_desc(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
+    describe_flavor(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
     prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row + 3, 2);
 
     q = _("材料となる武器は?", "Which weapon for material? ");
@@ -120,20 +132,19 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
         return 0;
     }
 
-    object_desc(player_ptr, basenm, mo_ptr, OD_NAME_ONLY);
+    describe_flavor(player_ptr, basenm, mo_ptr, OD_NAME_ONLY);
     prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row + 4, 2);
-    PRICE cost = bcost + object_value_real(o_ptr) * 2;
+    PRICE cost = bcost + object_value_real(player_ptr, o_ptr) * 2;
     if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost)))
         return 0;
 
     if (player_ptr->au < cost) {
-        object_desc(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
+        describe_flavor(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
         msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
         msg_print(NULL);
         return 0;
     }
 
-    player_ptr->total_weight -= o_ptr->weight;
     KIND_OBJECT_IDX k_idx;
     if (o_ptr->sval == SV_BROKEN_DAGGER) {
         int n = 1;
@@ -196,7 +207,7 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
         o_ptr->art_flags[i] |= k_ptr->flags[i];
     if (k_ptr->pval)
         o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
-    if (have_flag(k_ptr->flags, TR_ACTIVATE))
+    if (has_flag(k_ptr->flags, TR_ACTIVATE))
         o_ptr->xtra2 = (byte)k_ptr->act_idx;
 
     if (dd_bonus > 0) {
@@ -215,12 +226,12 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
         }
     }
 
-    if (have_flag(k_ptr->flags, TR_BLOWS)) {
+    if (has_flag(k_ptr->flags, TR_BLOWS)) {
         int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
         o_ptr->pval = MIN(o_ptr->pval, bmax);
     }
 
-    give_one_ability_of_object(o_ptr, mo_ptr);
+    give_one_ability_of_object(player_ptr, o_ptr, mo_ptr);
     o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
     o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
     o_ptr->to_a += MAX(0, (mo_ptr->to_a));
@@ -231,8 +242,8 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
             add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
         }
 
-        give_one_ability_of_object(o_ptr, mo_ptr);
-        if (!activation_index(o_ptr))
+        give_one_ability_of_object(player_ptr, o_ptr, mo_ptr);
+        if (!activation_index(player_ptr, o_ptr))
             one_activation(o_ptr);
 
         if (o_ptr->name1 == ART_NARSIL) {
@@ -243,7 +254,7 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
         msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptional."));
     }
 
-    object_desc(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
+    describe_flavor(player_ptr, basenm, o_ptr, OD_NAME_ONLY);
 #ifdef JP
     msg_format("$%dで%sに修復しました。", cost, basenm);
 #else
@@ -253,7 +264,6 @@ static PRICE repair_broken_weapon_aux(player_type *player_ptr, PRICE bcost)
     o_ptr->ident &= ~(IDENT_BROKEN);
     o_ptr->discount = 99;
 
-    player_ptr->total_weight += o_ptr->weight;
     calc_android_exp(player_ptr);
     inven_item_increase(player_ptr, mater, -1);
     inven_item_optimize(player_ptr, mater);