OSDN Git Service

[Fix] #37481 hit_chance()をtest_hit_norm()に合わせるよう修正。 / Fix hit_chance() to fit test_hi...
authorDeskull <deskull@users.sourceforge.jp>
Sun, 23 Dec 2018 10:00:18 +0000 (19:00 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sun, 23 Dec 2018 10:00:18 +0000 (19:00 +0900)
src/bldg.c
src/melee1.c

index 82f1798..cfd8f6c 100644 (file)
@@ -2676,8 +2676,11 @@ static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
 
        /* Print the weapons base damage dice */
        sprintf(tmp_str, "        %2d  %2d  %2d  %2d  %2d (%%)",
-                               hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100),
-                               hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200));
+               hit_chance(o_ptr->to_h, 0),
+               hit_chance(o_ptr->to_h, 50),
+               hit_chance(o_ptr->to_h, 100),
+               hit_chance(o_ptr->to_h, 150),
+               hit_chance(o_ptr->to_h, 200));
        put_str(tmp_str, row+3, col);
        c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col);
 
index 1ff3103..983762b 100644 (file)
@@ -61,17 +61,12 @@ bool test_hit_norm(HIT_RELIABILITY chance, ARMOUR_CLASS ac, bool visible)
  */
 PERCENTAGE hit_chance(HIT_PROB to_h, ARMOUR_CLASS ac)
 {
-       PERCENTAGE chance = 0;
+       PERCENTAGE chance = 5, chance_left = 90;
        int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
 
-       if (meichuu <= 0) return 5;
+       if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
+       chance += (100 - ((ac * 75) / meichuu)) * chance_left / 100;
 
-       chance = 100 - ((ac * 75) / meichuu);
-
-       if (chance > 95) chance = 95;
-       if (chance < 5) chance = 5;
-       if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
-               chance = (chance * 19 + 9) / 20;
        return chance;
 }