OSDN Git Service

Reword the first sentence of the English description for Yu'uichi. It is an interpol...
[hengbandforosx/hengbandosx.git] / src / birth / birth-stat.c
index 7d7ad27..06e7776 100644 (file)
@@ -1,4 +1,5 @@
 #include "birth/birth-stat.h"
+#include "birth/auto-roller.h"
 #include "core/player-redraw-types.h"
 #include "sv-definition/sv-weapon-types.h"
 #include "player/player-class.h"
@@ -9,6 +10,16 @@
 #include "spell/spells-status.h"
 #include "player/player-race-types.h"
 
+/*! オートロール能力値の乱数分布 / emulate 5 + 1d3 + 1d4 + 1d5 by randint0(60) */
+BASE_STATUS rand3_4_5[60] = {
+    8, 9, 9, 9, 10, 10, 10, 10, 10, 10, /*00-09*/
+    11, 11, 11, 11, 11, 11, 11, 11, 11, 12, /*10-19*/
+    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, /*20-29*/
+    13, 13, 13, 13, 13, 13, 13, 13, 13, 13, /*30-49*/
+    13, 14, 14, 14, 14, 14, 14, 14, 14, 14, /*40-49*/
+    15, 15, 15, 15, 15, 15, 16, 16, 16, 17 /*50-59*/
+};
+
 /*!
  * @brief プレイヤーの能力値表現に基づいて加減算を行う。
  * @param value 現在の能力値
@@ -56,39 +67,17 @@ void get_stats(player_type* creature_ptr)
             s32b tmp = randint0(60 * 60 * 60);
             BASE_STATUS val;
 
-            /* Extract 5 + 1d3 + 1d4 + 1d5 */
-            val = 5 + 3;
-            val += tmp % 3;
-            tmp /= 3;
-            val += tmp % 4;
-            tmp /= 4;
-            val += tmp % 5;
-            tmp /= 5;
-
-            sum += val;
-            creature_ptr->stat_cur[3 * i] = creature_ptr->stat_max[3 * i] = val;
-
-            /* Extract 5 + 1d3 + 1d4 + 1d5 */
-            val = 5 + 3;
-            val += tmp % 3;
-            tmp /= 3;
-            val += tmp % 4;
-            tmp /= 4;
-            val += tmp % 5;
-            tmp /= 5;
-
-            sum += val;
-            creature_ptr->stat_cur[3 * i + 1] = creature_ptr->stat_max[3 * i + 1] = val;
-
-            val = 5 + 3;
-            val += tmp % 3;
-            tmp /= 3;
-            val += tmp % 4;
-            tmp /= 4;
-            val += (BASE_STATUS)tmp;
-
-            sum += val;
-            creature_ptr->stat_cur[3 * i + 2] = creature_ptr->stat_max[3 * i + 2] = val;
+            for (int j = 0; j < 3; j++) {
+                int stat = i * 3 + j;
+
+                /* Extract 5 + 1d3 + 1d4 + 1d5 */
+                val = rand3_4_5[tmp % 60];
+
+                sum += val;
+                creature_ptr->stat_cur[stat] = creature_ptr->stat_max[stat] = val;
+
+                tmp /= 60;
+            }
         }
 
         if ((sum > 42 + 5 * 6) && (sum < 57 + 5 * 6))