From c3d12aa55f64b1fa46434ffa114d3998d3dddce3 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 11 Aug 2020 22:36:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=EC=9F=81/=EC=84=A0=ED=8F=AC=20?= =?UTF-8?q?=EC=A4=91=EC=9D=B8=20=EA=B5=AD=EA=B0=80=EC=97=90=20=EC=84=A0?= =?UTF-8?q?=ED=8F=AC=20=ED=99=95=EB=A5=A0=20=EB=8C=80=ED=8F=AD=20=EA=B0=90?= =?UTF-8?q?=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/GeneralAI.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 17828cef..e1f1ddbe 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -1723,7 +1723,15 @@ class GeneralAI return null; } + $db = DB::db(); + $lowTargetNations = Util::convertArrayToSetLike($db->queryFirstColumn( + 'SELECT DISTINCT(me) FROM diplomacy WHERE me != %i AND state IN %li', + $nationID, + [0, 1] + )); + $nations = []; + $warNations = []; foreach(getAllNationStaticInfo() as $destNation){ if($destNation['level'] == 0){ continue; @@ -1733,10 +1741,26 @@ class GeneralAI if (!isNeighbor($nationID, $destNationID)) { continue; } - $nations[$destNationID] = 1 / sqrt($destNationPower + 1); + + if(!key_exists($destNationID, $lowTargetNations)){ + $nations[$destNationID] = 1 / sqrt($destNationPower + 1); + } + else{ + $warNations[$destNationID] = 1 / sqrt($destNationPower + 1); + } + } if (!$nations) { - return null; + if(!$warNations){ + return null; + } + if(!$lowTargetNations){ + return null; + } + if(Util::randBool(1/count($lowTargetNations))){ + return null; + } + $nations = $warNations; } $cmd = buildNationCommandClass('che_선전포고', $this->general, $this->env, $lastTurn, [