접경 코드를 1(곧 접경), 2(공백지[출병가능]), 3(적 도시[출병가능]) 으로 구분
This commit is contained in:
+30
-11
@@ -204,21 +204,30 @@ function SetNationFront($nationNo) {
|
|||||||
if(!$nationNo) { return; }
|
if(!$nationNo) { return; }
|
||||||
// 도시소유 국가와 선포,교전중인 국가
|
// 도시소유 국가와 선포,교전중인 국가
|
||||||
|
|
||||||
$adj = [];
|
$adj3 = [];
|
||||||
|
$adj2 = [];
|
||||||
|
$adj1 = [];
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$enemyCities = $db->queryFirstColumn(
|
foreach($db->queryFirstColumn(
|
||||||
'SELECT city from city where nation IN
|
'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
|
, $nationNo
|
||||||
);
|
) as $city){
|
||||||
if($enemyCities) {
|
|
||||||
foreach($enemyCities as $city){
|
|
||||||
foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){
|
foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){
|
||||||
$adj[$adjKey] = $adjVal;
|
$adj3[$adjKey] = $adjVal;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
if(!$adj3 && !$adj1){
|
||||||
//평시이면 공백지
|
//평시이면 공백지
|
||||||
//NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다.
|
//NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다.
|
||||||
foreach ($db->queryFirstColumn('SELECT city from city where nation=0') as $city) {
|
foreach ($db->queryFirstColumn('SELECT city from city where nation=0') as $city) {
|
||||||
@@ -232,10 +241,20 @@ function SetNationFront($nationNo) {
|
|||||||
'front'=>0
|
'front'=>0
|
||||||
], 'nation=%i', $nationNo);
|
], 'nation=%i', $nationNo);
|
||||||
|
|
||||||
if($adj){
|
if($adj3){
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
'front'=>($enemyCities?1:2),
|
'front'=>3,
|
||||||
], 'nation=%i and city in %li', $nationNo, array_keys($adj));
|
], '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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user