From eeb92f5915eda85109f6d4fb16321bd1f67fdf56 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 11 May 2020 01:16:27 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=88=EC=8C=80=20=EA=B5=AC=EB=A7=A4=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=9E=84=EC=8B=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/GeneralAI.php | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 509452f1..089ff3d5 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -2049,26 +2049,33 @@ class GeneralAI if($avgAmount * 2 > $goldCost + $riceCost){ if ($general->getVar('rice') < $riceCost * 2 && $general->getVar('gold') >= $goldCost * 4) { //1:1 - $cmd = buildGeneralCommandClass('che_군량매매', $general, $this->env, - [ - 'buyRice' => true, - 'amount' => Util::valueFit(Util::toInt($general->getVar('gold') - $avgAmount), 100, GameConst::$maxResourceActionAmount) - ] - ); - if($cmd->hasFullConditionMet()){ - return $cmd; + $amount = Util::valueFit(Util::toInt($general->getVar('gold') - $avgAmount), 100, GameConst::$maxResourceActionAmount); + if($amount >= $this->nationPolicy->minimumResourceActionAmount){ + $cmd = buildGeneralCommandClass('che_군량매매', $general, $this->env, + [ + 'buyRice' => true, + 'amount' => $amount + ] + ); + if($cmd->hasFullConditionMet()){ + return $cmd; + } } + } if ($general->getVar('gold') < $goldCost && $general->getVar('rice') >= $riceCost * 2) { $avgAmount = ($general->getVar('gold') + $general->getVar('rice'))/2; - $cmd = buildGeneralCommandClass('che_군량매매', $general, $this->env, - [ - 'buyRice' => false, - 'amount' => Util::valueFit(Util::toInt($general->getVar('rice') - $avgAmount), 100, GameConst::$maxResourceActionAmount) - ] - ); - if($cmd->hasFullConditionMet()){ - return $cmd; + $amount = Util::valueFit(Util::toInt($general->getVar('rice') - $avgAmount), 100, GameConst::$maxResourceActionAmount); + if($amount >= $this->nationPolicy->minimumResourceActionAmount){ + $cmd = buildGeneralCommandClass('che_군량매매', $general, $this->env, + [ + 'buyRice' => false, + 'amount' => $amount + ] + ); + if($cmd->hasFullConditionMet()){ + return $cmd; + } } } }