OSDN Git Service

[Refactor] #40514 装備AC計算処理を移動. / Moved Equipment AC calculation processing.
authordeskull <deskull@users.sourceforge.jp>
Sun, 5 Jul 2020 13:56:46 +0000 (22:56 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 5 Jul 2020 13:56:46 +0000 (22:56 +0900)
src/object/object-kind.c
src/player/player-effects.c
src/player/player-status.c

index 797b993..340d91d 100644 (file)
@@ -247,10 +247,6 @@ void calc_equipment_status(player_type* creature_ptr) {
         if (o_ptr->tval == TV_CAPTURE)
             continue;
 
-        creature_ptr->to_a += o_ptr->to_a;
-        if (object_is_known(o_ptr))
-            creature_ptr->dis_to_a += o_ptr->to_a;
-
         if (o_ptr->curse_flags & TRC_LOW_MELEE) {
             int slot = i - INVEN_RARM;
             if (slot < 2) {
index 3582126..b55df4c 100644 (file)
@@ -3948,8 +3948,6 @@ void calc_timelimit_status(player_type *creature_ptr)
     }
 
     if (is_blessed(creature_ptr)) {
-        creature_ptr->to_a += 5;
-        creature_ptr->dis_to_a += 5;
         creature_ptr->to_h[0] += 10;
         creature_ptr->to_h[1] += 10;
         creature_ptr->to_h_b += 10;
index a0266ce..b635243 100644 (file)
@@ -3032,6 +3032,14 @@ static void calc_to_ac(player_type *creature_ptr)
 {
     creature_ptr->to_a = 0;
 
+    for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+        object_type *o_ptr;
+        o_ptr = &creature_ptr->inventory_list[i];
+        if (!o_ptr->k_idx)
+            continue;
+        creature_ptr->to_a += o_ptr->to_a;
+    }
+
     if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID)) {
         creature_ptr->to_a += 10 + (creature_ptr->lev * 2 / 5);
     }
@@ -3105,6 +3113,10 @@ static void calc_to_ac(player_type *creature_ptr)
     } else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef) {
         creature_ptr->to_a += 50;
     }
+
+    if (is_blessed(creature_ptr)) {
+        creature_ptr->to_a += 5;
+    }
 }
 
 static void calc_base_ac_display(player_type *creature_ptr)
@@ -3127,6 +3139,15 @@ static void calc_to_ac_display(player_type *creature_ptr)
 {
     creature_ptr->dis_to_a = 0;
 
+    for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+        object_type *o_ptr;
+        o_ptr = &creature_ptr->inventory_list[i];
+        if (!o_ptr->k_idx)
+            continue;
+        if (object_is_known(o_ptr))
+            creature_ptr->dis_to_a += o_ptr->to_a;
+    }
+
     if (is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ANDROID)) {
         creature_ptr->dis_to_a += 10 + (creature_ptr->lev * 2 / 5);
     }
@@ -3202,6 +3223,10 @@ static void calc_to_ac_display(player_type *creature_ptr)
     } else if (creature_ptr->tsubureru || creature_ptr->shield || creature_ptr->magicdef) {
         creature_ptr->dis_to_a += 50;
     }
+
+    if (is_blessed(creature_ptr)) {
+        creature_ptr->dis_to_a += 5;
+    }
 }
 
 static void calc_speed(player_type *creature_ptr)