From a949a38bdfddfafbd0e8abe379d5e3509d0050f4 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 11 Oct 2018 00:28:11 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=91=EA=B2=BD=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A5=BC=201(=EA=B3=A7=20=EC=A0=91=EA=B2=BD),=202(=EA=B3=B5?= =?UTF-8?q?=EB=B0=B1=EC=A7=80[=EC=B6=9C=EB=B3=91=EA=B0=80=EB=8A=A5]),=203(?= =?UTF-8?q?=EC=A0=81=20=EB=8F=84=EC=8B=9C[=EC=B6=9C=EB=B3=91=EA=B0=80?= =?UTF-8?q?=EB=8A=A5])=20=EC=9C=BC=EB=A1=9C=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 45 ++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index e7dede2a..83d19278 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -204,21 +204,30 @@ function SetNationFront($nationNo) { if(!$nationNo) { return; } // 도시소유 국가와 선포,교전중인 국가 - $adj = []; + $adj3 = []; + $adj2 = []; + $adj1 = []; $db = DB::db(); - $enemyCities = $db->queryFirstColumn( + foreach($db->queryFirstColumn( 'SELECT city from city where nation IN - (SELECT you from diplomacy where me = %i and (state=0 or (state=1 and term<=5)))' + (SELECT you from diplomacy where me = %i and state=0)' , $nationNo - ); - if($enemyCities) { - foreach($enemyCities as $city){ - foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ - $adj[$adjKey] = $adjVal; - } + ) as $city){ + foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ + $adj3[$adjKey] = $adjVal; } - } else { + }; + foreach($db->queryFirstColumn( + 'SELECT city from city where nation IN + (SELECT you from diplomacy where me = %i and state=1 and term<=5)' + , $nationNo + ) as $city){ + foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ + $adj1[$adjKey] = $adjVal; + } + } + if(!$adj3 && !$adj1){ //평시이면 공백지 //NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다. foreach ($db->queryFirstColumn('SELECT city from city where nation=0') as $city) { @@ -232,10 +241,20 @@ function SetNationFront($nationNo) { 'front'=>0 ], 'nation=%i', $nationNo); - if($adj){ + if($adj3){ $db->update('city', [ - 'front'=>($enemyCities?1:2), - ], 'nation=%i and city in %li', $nationNo, array_keys($adj)); + 'front'=>3, + ], 'nation=%i and city in %li', $nationNo, array_keys($adj3)); + } + if($adj2){ + $db->update('city', [ + 'front'=>2, + ], 'nation=%i and city in %li', $nationNo, array_keys($adj2)); + } + if($adj1){ + $db->update('city', [ + 'front'=>1, + ], 'nation=%i and city in %li', $nationNo, array_keys($adj1)); } }