From 50edd7dfbee0146b537a1b2aa7067d9ae051469a Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 9 Mar 2019 00:33:14 +0900 Subject: [PATCH] =?UTF-8?q?m=EC=9E=A5=EC=9D=B4=20=EC=95=84=EC=A3=BC=20?= =?UTF-8?q?=EC=A0=81=EC=9D=84=EB=95=90=20=EC=9E=98=20=EB=BD=91=ED=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process_personnel.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index e445c7f1..eec0ddaf 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -312,9 +312,18 @@ function process_29(&$general) { $total_gen_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc <= 2'); $total_npc_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4'); + $gen_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc <= 2 AND nation = %i', $general['nation']); + $npc_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4 AND nation = %i', $general['nation']); + $curr_cnt = Util::toInt($total_gen_cnt + $total_npc_cnt / 2); $remain_slot = $max_gen_cnt - $curr_cnt; + if($npc_cnt < 2){ + $found_prop = 1 / ($npc_cnt + 1); + } + else{ + $found_prop = max(pow($remain_slot / $max_gen_cnt, 5), 1 / $max_gen_cnt); + } $found_prop = max(pow($remain_slot / $max_gen_cnt, 5), 1 / $max_gen_cnt); $found_npc = Util::randBool($found_prop); @@ -349,9 +358,6 @@ function process_29(&$general) { $name = "{$name}{$count}"; } - $gen_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc <= 2 AND nation = %i', $general['nation']); - $npc_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4 AND nation = %i', $general['nation']); - $join_prop = 0.3 + 0.7 * (($gen_cnt + $npc_cnt / 2) / $curr_cnt); if($nation['scout'] != 0 || !Util::randBool($join_prop)) {