From 64e0fca12440add56e11a916a2d427fd9360480a Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 20 Sep 2018 01:15:50 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=EC=9F=81=20=EA=B8=B0=ED=95=9C=20?= =?UTF-8?q?=EA=B3=B5=EC=8B=9D=EC=9D=84=20=EC=8A=A4=ED=83=9D=ED=98=95?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index d9c88b6c..bdc5caa2 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -562,11 +562,14 @@ function postUpdateMonthly() { $genCount = $genNum[$dip['me']]; // 25% 참여율일때 두당 10턴에 4000명 소모한다고 계산 // 4000 / 10 * 0.25 = 100 - $term = Util::round($dip['dead'] / 100 / $genCount) + 1; - if($dip['term'] > $term) { $term = $dip['term']; } - if($term > 13) { $term = 13; } - $query = "update diplomacy set term='{$term}' where (me='{$dip['me']}' and you='{$dip['you']}')"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $term = floor($dip['dead'] / 100 / $genCount); + $dip['dead'] -= $term * 100 * $genCount; + $term = Util::valueFit($dip['term'] + $term, 0, 13); + + $db->update('diplomacy', [ + 'term' => $term, + 'dead'=> $dip['dead'], + ], 'me = %i AND you = %i', $dip['me'], $dip['you']); } //개전국 로그 @@ -609,7 +612,7 @@ function postUpdateMonthly() { } pushWorldHistory($history, $admin['year'], $admin['month']); //사상자 초기화 - $query = "update diplomacy set dead=0"; + $query = "update diplomacy set dead=0 WHERE state != 0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //외교 기한-1 $query = "update diplomacy set term=term-1 where term!=0";