From 9594e6eb32ecb0b5594dc75893e2c0aea8523250 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 28 Nov 2018 00:16:34 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=80=EB=8C=80=EC=9E=A5=EC=9D=80=20?= =?UTF-8?q?=EA=B8=B0=EC=88=A0=EC=97=B0=EA=B5=AC,=20=EC=A0=84=ED=88=AC?= =?UTF-8?q?=EC=8B=9C=20=EA=B8=B0=EC=88=A0=20=EC=83=81=EC=8A=B9=EC=97=90=20?= =?UTF-8?q?=EC=98=81=ED=96=A5=EC=9D=84=20=EC=A3=BC=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process.php | 27 ++++++++++++++++++--------- hwe/process_war.php | 28 ++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/hwe/func_process.php b/hwe/func_process.php index cf41db1e..0046e360 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -369,17 +369,26 @@ function process_3(&$general) { $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); - // 부드러운 기술 제한 - if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score = intdiv($score, 4); } - //장수수 구함 - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; + $gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i', $general['nation']); + $gencnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $general['nation']); + if ($gencnt_eff < GameConst::$initialNationGenLimit) { + $gencount = GameConst::$initialNationGenLimit; + $gencnt_eff = GameConst::$initialNationGenLimit; + } + + if($gencount != $gencnt_eff){ + $score *= $gencount / $gencnt_eff; + } + + // 부드러운 기술 제한 + if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score /= 4; } + // 내정 상승 - $query = "update nation set totaltech=totaltech+'$score',tech=totaltech/'$gencount' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'totaltech'=>$db->sqleval('totaltech + %i', Util::round($score)), + 'tech'=>$db->sqleval('totaltech / %i', $gencount) + ], 'nation=%i', $general['nation']); // 자금 하락, 경험치 상승 // 공헌도, 명성 상승 = $score * 10 $general['gold'] -= $admin['develcost']; diff --git a/hwe/process_war.php b/hwe/process_war.php index c5951491..9ebb7705 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -111,6 +111,30 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ $attackerIncTech = $attacker->getDead() * 0.01 * getNationTechMultiplier($rawAttackerNation['type']); $defenderIncTech = $attacker->getKilled() * 0.01 * getNationTechMultiplier($rawDefenderNation['type']); + $attackerGenCnt = $rawAttackerNation['gennum']; + $defenderGenCnt = $rawDefenderNation['gennum']; + $attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']); + $defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']); + + if($attackerGenCnt_eff < GameConst::$initialNationGenLimit){ + $attackerGenCnt = GameConst::$initialNationGenLimit; + $attackerGenCnt_eff = GameConst::$initialNationGenLimit; + } + + if($defenderGenCnt_eff < GameConst::$initialNationGenLimit){ + $defenderGenCnt = GameConst::$initialNationGenLimit; + $defenderGenCnt_eff = GameConst::$initialNationGenLimit; + } + + if($attackerGenCnt != $attackerGenCnt_eff){ + $attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff; + } + + if($defenderGenCnt != $defenderGenCnt_eff){ + $defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff; + } + + if(TechLimit($startYear, $year, $rawAttackerNation['tech'])){ $attackerIncTech /= 4; } @@ -124,8 +148,8 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ $updateAttackerNation['totaltech'] = Util::round($attackerTotalTech); $updateDefenderNation['totaltech'] = Util::round($defenderTotalTech); - $updateAttackerNation['tech'] = Util::round($attackerTotalTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum'])); - $updateDefenderNation['tech'] = Util::round($defenderTotalTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum'])); + $updateAttackerNation['tech'] = Util::round($attackerTotalTech / $attackerGenCnt); + $updateDefenderNation['tech'] = Util::round($defenderTotalTech / $defenderGenCnt); $db->update('nation', $updateAttackerNation, 'nation=%i', $attackerNationID); $db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);