긴천 위치가 엉뚱하게 되는 버그 수정.
getGenSpecial을 마구잡이로 부르는 함수로 인하여 우회
This commit is contained in:
@@ -174,6 +174,7 @@ function getGenSpecial($type) {
|
|||||||
case 73: $call = '의술'; break;
|
case 73: $call = '의술'; break;
|
||||||
case 74: $call = '격노'; break;
|
case 74: $call = '격노'; break;
|
||||||
case 75: $call = '척사'; break;
|
case 75: $call = '척사'; break;
|
||||||
|
default: $call = null;
|
||||||
}
|
}
|
||||||
return $call;
|
return $call;
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-19
@@ -1705,6 +1705,10 @@ function DeleteConflict($nation) {
|
|||||||
|
|
||||||
function getConquerNation($city) : int {
|
function getConquerNation($city) : int {
|
||||||
$conflict = Json::decode($city['conflict']);
|
$conflict = Json::decode($city['conflict']);
|
||||||
|
if(!$conflict){
|
||||||
|
//FIXME: 사실 이건 이상한 상황이다.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return Util::array_first_key($conflict);
|
return Util::array_first_key($conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1861,12 +1865,10 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
|||||||
// 멸망이 아니면
|
// 멸망이 아니면
|
||||||
} else {
|
} else {
|
||||||
// 태수,군사,시중은 일반으로...
|
// 태수,군사,시중은 일반으로...
|
||||||
$query = "update general set level='1' where no='{$city['gen1']}'";
|
$db->update('general',[
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
'level'=>1
|
||||||
$query = "update general set level='1' where no='{$city['gen2']}'";
|
], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]);
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$query = "update general set level='1' where no='{$city['gen3']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
//수도였으면 긴급 천도
|
//수도였으면 긴급 천도
|
||||||
if($destnation['capital'] == $city['city']) {
|
if($destnation['capital'] == $city['city']) {
|
||||||
$distList = searchDistance($city['city'], 99, true);
|
$distList = searchDistance($city['city'], 99, true);
|
||||||
@@ -1874,40 +1876,34 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
|||||||
$cities = [];
|
$cities = [];
|
||||||
foreach(
|
foreach(
|
||||||
DB::db()->query(
|
DB::db()->query(
|
||||||
'SELECT nation, city, pop FROM city WHERE nation=%i and city!=%i',
|
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
||||||
$destnation['nation'],
|
$destnation['nation'],
|
||||||
$city['city']
|
$city['city']
|
||||||
) as $row
|
) as $row
|
||||||
){
|
){
|
||||||
$cities[$row['city']] = $row;
|
$cities[$row['city']] = $row['pop'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$distKeys = array_keys($distList);
|
|
||||||
sort($distKeys);
|
|
||||||
|
|
||||||
$minCity = 0;
|
$minCity = 0;
|
||||||
|
|
||||||
foreach($distKeys as $dist){
|
foreach($distList as $dist=>$distSubList){
|
||||||
$hasTarget = false;
|
$hasTarget = false;
|
||||||
$maxCityPop = 0;
|
$maxCityPop = 0;
|
||||||
|
|
||||||
foreach($distList[$dist] as $cityID){
|
foreach($distSubList as $cityID){
|
||||||
if(!key_exists($cityID, $cities)){
|
if(!key_exists($cityID, $cities)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$city = $cities[$cityID];
|
$cityPop = $cities[$cityID];
|
||||||
'@phan-var array<string,mixed> $city';
|
'@phan-var array<string,mixed> $city';
|
||||||
if($city['nation'] != $destnation['nation']){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['pop'] <= $maxCityPop){
|
if($cityPop < $maxCityPop){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hasTarget = true;
|
$hasTarget = true;
|
||||||
$minCity = $cityID;
|
$minCity = $cityID;
|
||||||
$maxCityPop = $city['pop'];
|
$maxCityPop = $cityPop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hasTarget){
|
if($hasTarget){
|
||||||
@@ -1949,6 +1945,9 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
|||||||
if($general['atmos'] > $_maximumatmos) { $general['atmos'] = $_maximumatmos; }
|
if($general['atmos'] > $_maximumatmos) { $general['atmos'] = $_maximumatmos; }
|
||||||
|
|
||||||
$conquerNation = getConquerNation($city);
|
$conquerNation = getConquerNation($city);
|
||||||
|
if(!$conquerNation){
|
||||||
|
$conquerNation = $general['nation'];
|
||||||
|
}
|
||||||
|
|
||||||
if($conquerNation == $general['nation']) {
|
if($conquerNation == $general['nation']) {
|
||||||
// 이동 및 사기 변경
|
// 이동 및 사기 변경
|
||||||
|
|||||||
Reference in New Issue
Block a user