From b7e432228b1e3f174fc86bb6159e1125c2c963b3 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 9 Mar 2019 00:39:13 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=20=EC=B7=A8=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process_personnel.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index eec0ddaf..e445c7f1 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -312,18 +312,9 @@ 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); @@ -358,6 +349,9 @@ 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)) {