OSDN Git Service

Add new option -- show critical ratio of ammo
authordis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 25 Mar 2013 14:27:57 +0000 (14:27 +0000)
committerdis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 25 Mar 2013 14:27:57 +0000 (14:27 +0000)
src/bldg.c
src/externs.h
src/flavor.c
src/tables.c
src/variable.c

index 9be4995..0f6bcb3 100644 (file)
@@ -3113,11 +3113,11 @@ static void town_history(void)
        screen_load();
 }
 
-s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
+/* critical happens at i / 10000 */
+s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow,  int dam)
 {
-       u32b num;
-       int i, k, crit;
-
+       int i;
+       
        /* Extract "shot" power */
        i = p_ptr->to_h_b * 4 + plus_ammo + (p_ptr->lev * 2);
        
@@ -3130,6 +3130,15 @@ s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
        
        if (i < 0) i = 0;
        
+       return i * 2;
+}
+
+s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
+{
+       u32b num;
+       int i, k, crit;
+       i = calc_crit_ratio_shot(weight, plus_ammo, plus_bow, dam);
+       
        k = 0;
        num = 0;
        
@@ -3151,8 +3160,8 @@ s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  int dam)
        num /= 500;
        
        num *= i;
-       num += (5000 - i) * dam;
-       num /= 5000;
+       num += (10000 - i) * dam;
+       num /= 10000;
        
        return num;
 }
index a8c1924..3680e75 100644 (file)
@@ -284,6 +284,7 @@ extern bool exp_need;       /* Show the experience needed for next level */
 extern bool ignore_unview;     /* Ignore whenever any monster does */
 extern bool show_ammo_detail;  /* Show Description of ammo damage */
 extern bool show_ammo_no_crit; /* Show No-crit damage of ammo */
+extern bool show_ammo_crit_ratio;      /* Show critical ratio of ammo */
 
 
 /*** Game-Play Options ***/
@@ -1301,6 +1302,7 @@ extern void quest_discovery(int q_idx);
 extern int quest_number(int level);
 extern int random_quest_number(int level);
 extern bool tele_town(void);
+extern s16b calc_crit_ratio_shot(int weight, int plus_ammo,int plus_bow, int dam);
 extern s16b calc_expect_crit_shot(int weight, int plus_ammo,int plus_bow, int dam);
 extern s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari);
 
index fe67653..94f0082 100644 (file)
@@ -2479,6 +2479,17 @@ void object_desc(char *buf, object_type *o_ptr, u32b mode)
                        avgdam /= energy_fire;
                        t = object_desc_num(t, avgdam);
                        t = object_desc_str(t, show_ammo_detail ? "/turn" : "");
+                       
+                       if(show_ammo_crit_ratio)
+                       {
+                               int percent = calc_crit_ratio_shot(o_ptr->weight, o_ptr->to_h, bow_ptr->to_h, avgdam);
+                               
+                               t = object_desc_chr(t, '/');
+                               t = object_desc_num(t, percent / 100);
+                               t = object_desc_chr(t, '.');
+                               t = object_desc_num(t, percent % 100);
+                               t = object_desc_str(t, show_ammo_detail ? "% crit" : "%");
+                       }
                }
 
                t = object_desc_chr(t, p2);
index 6a36170..c46e991 100644 (file)
@@ -5000,6 +5000,9 @@ const option_type option_info[] =
                
        { &show_ammo_no_crit,           FALSE, OPT_PAGE_TEXT, 2, 15,
        "show_ammo_no_crit",            _("²ñ¿´¤ò¹Íθ¤·¤Ê¤¤¾ì¹ç¤ÎÌðÃƤΥÀ¥á¡¼¥¸¤òɽ¼¨¤¹¤ë", "Show ammo damage with no critical") },
+
+       { &show_ammo_crit_ratio,           FALSE, OPT_PAGE_TEXT, 2, 16,
+       "show_ammo_crit_ratio",            _("ÌðÃƤβñ¿´È¯À¸Î¨¤òɽ¼¨¤¹¤ë", "Show critical ratio of ammo") },
                
 
        /*** Game-Play ***/
index c41f3e8..0ab6741 100644 (file)
@@ -308,6 +308,8 @@ bool autochara;     /* Autoroll for weight, height and social status */
 bool powerup_home;     /* Increase capacity of your home (*) */
 bool show_ammo_detail; /* Show Description of ammo damage */
 bool show_ammo_no_crit;        /* Show No-crit damage of ammo */
+bool show_ammo_crit_ratio;     /* Show critical ratio of ammo */
+