랜임시 장수수를 셀 때 유저장, 빙의장, n장만 카운트하도록 변경

This commit is contained in:
2018-06-13 04:17:18 +09:00
parent 96c8199092
commit 380e08d89f
+8 -5
View File
@@ -116,6 +116,13 @@ function process_25(&$general) {
}
else if($where >= 98) {
//랜임
$generals = [];
foreach($db->queryAllLists('SELECT count(no), nation FROM general WHERE npc <= 2 AND nation > 0 GROUP BY nation') as list($cnt, $nation)){
$generals[$nation] = $cnt;
}
$allGen = array_sum($generals);
$nations = $db->query(
'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`injury` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0',
$joinedNations,
@@ -123,10 +130,6 @@ function process_25(&$general) {
);
shuffle($nations);
$allGen = array_sum(array_map(function($item) {
return $item['gennum'];
}, $nations));
$randVals = [];
foreach($nations as $idx=>$testNation){
// 임관금지없음 국가, 방랑군 제외
@@ -139,7 +142,7 @@ function process_25(&$general) {
$score *= sqrt((100-max(30, $testNation['injury']))/100);
}
$score *= sqrt($allGen/$testNation['gennum']);
$score *= sqrt($allGen/$generals[$testNation['nation']]);
$randVals[$idx] = $score;
}