From 99b459766a5bcdc6dfa67bfb28309be51b4292e5 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 24 Apr 2018 00:53:26 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B4=EC=A7=80=EC=9E=A5=20=ED=97=8C?= =?UTF-8?q?=EB=82=A9=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20=ED=8F=AC?= =?UTF-8?q?=EC=83=81=20=EB=A1=9C=EC=A7=81=EC=97=90=EC=84=9C=20=EB=AC=B4?= =?UTF-8?q?=EC=A7=80=EC=9E=A5.=20=EC=82=AC=EB=A7=9D=20=EC=98=88=EC=A0=95?= =?UTF-8?q?=EC=9E=A5=EC=9D=80=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_npc.php | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/hwe/func_npc.php b/hwe/func_npc.php index 3aea1334..7c7ce4c0 100644 --- a/hwe/func_npc.php +++ b/hwe/func_npc.php @@ -627,7 +627,7 @@ function processAI($no) { } else { // 포상 // 포상 대상 list($npcGenID, $npcGenValue) = $db->queryFirstList( - 'SELECT `no`, %b FROM general WHERE nation=%i AND `no`!=%i AND npc >= 2 ORDER BY %b ASC LIMIT 1', + 'SELECT `no`, %b FROM general WHERE nation=%i AND `no`!=%i AND npc >= 2 AND killturn > 5 AND leader >= 40 ORDER BY %b ASC LIMIT 1', $type, $general['nation'], $general['no'], @@ -636,7 +636,7 @@ function processAI($no) { ); list($userGenID, $userGenValue) = $db->queryFirstList( - 'SELECT `no`, %b FROM general WHERE nation=%i AND `no`!=%i AND npc < 2 ORDER BY %b ASC LIMIT 1', + 'SELECT `no`, %b FROM general WHERE nation=%i AND `no`!=%i AND npc < 2 AND killturn > 5 ORDER BY %b ASC LIMIT 1', $type, $general['nation'], $general['no'], @@ -709,6 +709,43 @@ function processAI($no) { MYDB_query($query, $connect) or Error("processAI23 ".MYDB_error($connect),""); return; } + + $resrc = $tech * 700;//XXX: 왜 700이지? + + if($general['leader'] < 40){ + //무지장인데 + + if( + (($nation['rice'] - GameConst::$baserice) * 3 <= $general['rice'] && $general['rice'] >= $resrc + 2100) || + ($general['rice'] >= 11000) + ){ + //쌀을 많이 들고 있다면 + $amount = $general['rice'] * 0.9; + $amount = intdiv(Util::valueFit($amount, $resrc + 700, 10000), 100); + + $command = EncodeCommand(0, 2, $amount, 44); //헌납 + $db->update('general', [ + 'turn0'=>$command + ], 'no=%i',$general['no']); + return; + } + + if( + (($nation['gold'] - GameConst::$basegold) * 3 <= $general['gold'] && $general['gold'] >= $resrc + 2100) || + ($general['gold'] >= 12000) + ){ + //금을 많이 들고 있다면 + $amount = $general['gold'] * 0.9; + $amount = intdiv(Util::valueFit($amount, $resrc + 700, 10000), 100); + + $command = EncodeCommand(0, 1, $amount, 44); //헌납 + $db->update('general', [ + 'turn0'=>$command + ], 'no=%i',$general['no']); + return; + } + } + //국가 병량이 없을때 바로 헌납 if($nation['rice'] < 2000 && $general['rice'] > 200) { $amount = intdiv($general['rice'] - 200, 100) + 1; @@ -727,7 +764,7 @@ function processAI($no) { // ┃조┃ ┃쌀삼 // 0┗━┻━━━━┻━━━> G // 100 700 - $resrc = $tech * 700; + $target = array(); // 평시거나 초반아니면서 공격가능 없으면서 병사 있으면 해제(25%) if($dipState == 0 && $isStart == 0 && $attackable == 0 && $general['crew'] > 0 && rand()% 100 < 25) {