Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53f3083b73 | ||
|
|
61df5ed809 | ||
|
|
7c1baa6cf1 | ||
|
|
800d4f6cc9 | ||
|
|
1ab45af036 | ||
|
|
e9b5e4d4d1 |
@@ -1,6 +1,6 @@
|
|||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2019 Hide_D, 62che
|
Copyright (c) 2020 Hide_D, 62che
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -2786,6 +2786,71 @@ function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $from 으로 지정한 도시의 인접 도시와 $to 도시의 최단 거리를 계산해 줌
|
||||||
|
* @param $from 기준 도시 코드
|
||||||
|
* @param $to 대상 도시 코드
|
||||||
|
* @param $linkNationList 경로에 해당하는 국가 리스트
|
||||||
|
* @return array $dist=>[cityID, $nation] 배열 가장 앞이 가장 가까움
|
||||||
|
*/
|
||||||
|
function searchDistanceListToDest(int $from, int $to, array $linkNationList) {
|
||||||
|
$queue = new \SplQueue();
|
||||||
|
|
||||||
|
$cities = [];
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
|
||||||
|
$allowedCityList = [];
|
||||||
|
foreach($db->queryAllLists(
|
||||||
|
'SELECT city, nation FROM city WHERE nation IN %li',
|
||||||
|
$linkNationList
|
||||||
|
) as [$cityID, $nationID]){
|
||||||
|
$allowedCityList[$cityID] = $nationID;
|
||||||
|
}
|
||||||
|
|
||||||
|
$remainFromCities = [];
|
||||||
|
foreach(array_keys(CityConst::byID($from)->path) as $fromCityID){
|
||||||
|
if(key_exists($fromCityID, $allowedCityList)){
|
||||||
|
$remainFromCities[$fromCityID] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!key_exists($to, $allowedCityList)){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
$queue->enqueue([$to, 0]);
|
||||||
|
|
||||||
|
while(!empty($remainFromCities) && !$queue->isEmpty()){
|
||||||
|
list($cityID, $dist) = $queue->dequeue();
|
||||||
|
if(key_exists($cityID, $cities)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cities[$cityID] = $dist;
|
||||||
|
|
||||||
|
if(key_exists($cityID, $remainFromCities)){
|
||||||
|
unset($remainFromCities[$cityID]);
|
||||||
|
$result[$dist][] = [$cityID, $allowedCityList[$cityID]];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(array_keys(CityConst::byID($cityID)->path) as $connCityID){
|
||||||
|
if($allowedCityList !== null && !key_exists($connCityID, $allowedCityList)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(key_exists($connCityID, $cities)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$queue->enqueue([$connCityID, $dist+1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
function isNeighbor(int $nation1, int $nation2, bool $includeNoSupply=true) {
|
function isNeighbor(int $nation1, int $nation2, bool $includeNoSupply=true) {
|
||||||
if($nation1 === $nation2){
|
if($nation1 === $nation2){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+37
-31
@@ -982,31 +982,36 @@ function processAI($no, &$reduce_turn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count($target) == 0 && $allowedAction->warp) {
|
if(count($target) == 0 && $allowedAction->warp) {
|
||||||
//전방 도시 선택, 30% 확률로 태수 있는 전방으로 워프
|
//전방 도시 선택, 태수, 군사, 시중이 배정되어 있으면 이동 확률 증가
|
||||||
if(rand()%100 < 30) {
|
$warpCities = $db->queryAllLists('SELECT city, gen1, gen2, gen3 FROM city WHERE nation = %i AND supply = 1 AND front > 0', $general['nation']);
|
||||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front>0 order by gen1 desc,rand() limit 0,1";
|
$warpCandidates = [];
|
||||||
} else {
|
foreach($warpCities as [$cityID, $gen1, $gen2, $gen3]){
|
||||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front>0 order by rand() limit 0,1";
|
$score = 1;
|
||||||
|
if($gen1){
|
||||||
|
$score += 1;
|
||||||
|
}
|
||||||
|
if($gen2){
|
||||||
|
$score += 1;
|
||||||
|
}
|
||||||
|
if($gen3){
|
||||||
|
$score += 1;
|
||||||
|
}
|
||||||
|
$warpCandidates[$cityID] = $score;
|
||||||
}
|
}
|
||||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
if($warpCandidates){
|
||||||
$cityCount = MYDB_num_rows($result);
|
$selCity = Util::choiceRandomUsingWeight($warpCandidates);
|
||||||
if($cityCount == 0) {
|
}
|
||||||
|
else{
|
||||||
//도시 수, 랜덤(상위 20%) 선택, 저개발 도시 선택
|
//도시 수, 랜덤(상위 20%) 선택, 저개발 도시 선택
|
||||||
$query = "select city from city where nation='{$general['nation']}' and supply='1'";
|
$cityCnt = $db->queryFirstField('SELECT count(city) FROM city WHERE nation=%i AND supply=1', $general['nation']);
|
||||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
$citySelect = Util::randRangeInt(0, Util::toInt($cityCnt/5));
|
||||||
$cityCount = MYDB_num_rows($result);
|
|
||||||
$citySelect = rand() % (Util::round($cityCount/5) + 1);
|
|
||||||
|
|
||||||
$query = "select city,(def+wall)/(def2+wall2) as dev from city where nation='{$general['nation']}' and supply='1' order by dev limit {$citySelect},1";
|
$selCity = $db->queryFirstField('SELECT city, ,(def+wall)/(def2+wall2) as dev from city where nation=%i and supply=1 order by dev limit %i,1',$general['nation'], $citySelect);
|
||||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
|
||||||
$selCity = MYDB_fetch_array($result);
|
|
||||||
} else {
|
|
||||||
$selCity = MYDB_fetch_array($result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($general['city'] != $selCity['city']) {
|
if($general['city'] != $selCity) {
|
||||||
//워프
|
//워프
|
||||||
$query = "update general set city='{$selCity['city']}' where no='{$general['no']}'";
|
$query = "update general set city='{$selCity}' where no='{$general['no']}'";
|
||||||
MYDB_query($query, $connect) or Error("processAI18 ".MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error("processAI18 ".MYDB_error($connect),"");
|
||||||
|
|
||||||
$command = EncodeCommand(0, 0, 0, 50); //요양
|
$command = EncodeCommand(0, 0, 0, 50); //요양
|
||||||
@@ -1064,7 +1069,6 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
|
|
||||||
$nationCities = [];
|
$nationCities = [];
|
||||||
$frontCitiesID = [];
|
$frontCitiesID = [];
|
||||||
$frontImportantCitiesID = [];
|
|
||||||
$supplyCitiesID = [];
|
$supplyCitiesID = [];
|
||||||
$backupCitiesID = [];
|
$backupCitiesID = [];
|
||||||
|
|
||||||
@@ -1086,10 +1090,18 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
if($nationCity['supply']){
|
if($nationCity['supply']){
|
||||||
$supplyCitiesID[] = $cityID;
|
$supplyCitiesID[] = $cityID;
|
||||||
if($nationCity['front']){
|
if($nationCity['front']){
|
||||||
$frontCitiesID[] = $cityID;
|
$score = 1;
|
||||||
if($nationCity['gen1']){
|
if($nationCity['gen1']){
|
||||||
$frontImportantCitiesID[] = $cityID;
|
$score += 1;
|
||||||
}
|
}
|
||||||
|
if($nationCity['gen2']){
|
||||||
|
$score += 1;
|
||||||
|
}
|
||||||
|
if($nationCity['gen3']){
|
||||||
|
$score += 1;
|
||||||
|
}
|
||||||
|
$frontCitiesID[$cityID] = $score;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$backupCitiesID[] = $cityID;
|
$backupCitiesID[] = $cityID;
|
||||||
@@ -1097,7 +1109,6 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Util::shuffle_assoc($nationCities);
|
Util::shuffle_assoc($nationCities);
|
||||||
shuffle($frontCitiesID);
|
|
||||||
shuffle($supplyCitiesID);
|
shuffle($supplyCitiesID);
|
||||||
|
|
||||||
$nationGenerals = [];
|
$nationGenerals = [];
|
||||||
@@ -1155,7 +1166,7 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
$lostGeneral = $nationGenerals[$lostGeneralID];
|
$lostGeneral = $nationGenerals[$lostGeneralID];
|
||||||
if($lostGeneral['npc'] < 2){
|
if($lostGeneral['npc'] < 2){
|
||||||
if($dipState >= 3 && $frontCitiesID){
|
if($dipState >= 3 && $frontCitiesID){
|
||||||
$selCityID = Util::choiceRandom($frontCitiesID);
|
$selCityID = Util::choiceRandomUsingWeight($frontCitiesID);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$selCityID = Util::choiceRandom($supplyCitiesID);
|
$selCityID = Util::choiceRandom($supplyCitiesID);
|
||||||
@@ -1307,7 +1318,7 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($dipState >= 3 && $frontCitiesID){
|
if($dipState >= 3 && $frontCitiesID){
|
||||||
$selCityID = Util::choiceRandom($frontCitiesID);
|
$selCityID = Util::choiceRandomUsingWeight($frontCitiesID);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$selCityID = Util::choiceRandom($supplyCitiesID);
|
$selCityID = Util::choiceRandom($supplyCitiesID);
|
||||||
@@ -1425,12 +1436,7 @@ function NPCStaffWork($general, $nation, $dipState){
|
|||||||
$score *= 4;
|
$score *= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Util::randBool(0.3) && $frontImportantCitiesID){
|
$targetCityID = Util::choiceRandomUsingWeight($frontCitiesID);
|
||||||
$targetCityID = Util::choiceRandom($frontImportantCitiesID);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$targetCityID = Util::choiceRandom($frontCitiesID);
|
|
||||||
}
|
|
||||||
|
|
||||||
$command = EncodeCommand(0, $nationGeneral['no'], $targetCityID, 27);
|
$command = EncodeCommand(0, $nationGeneral['no'], $targetCityID, 27);
|
||||||
|
|
||||||
|
|||||||
+128
-57
@@ -1273,7 +1273,6 @@ function process_15(&$general) {
|
|||||||
function process_16(&$general) {
|
function process_16(&$general) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
$log = [];
|
||||||
$alllog = [];
|
$alllog = [];
|
||||||
@@ -1282,71 +1281,134 @@ function process_16(&$general) {
|
|||||||
|
|
||||||
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
|
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
|
||||||
|
|
||||||
$query = "select nation,war,sabotagelimit,tech from nation where nation='{$general['nation']}'";
|
$nation = $db->queryFirstRow('SELECT nation,war,sabotagelimit,tech from nation where nation=%i', $general['nation']);
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$city = $db->queryFirstRow('SELECT nation,supply from city where city=%i', $general['city']);
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($general['turn0']);
|
$command = DecodeCommand($general['turn0']);
|
||||||
$destination = $command[1];
|
$finalTarget = $command[1];
|
||||||
|
$finalDestCityName = CityConst::byID($finalTarget)->name;
|
||||||
|
|
||||||
$query = "select * from city where city='$destination'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,sabotagelimit,tech from nation where nation='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dnation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select state from diplomacy where me='{$general['nation']}' and you='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dip = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
if(key_exists($destination, CityConst::byID($general['city'])->path)){
|
|
||||||
$nearCity = true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$nearCity = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$josaRo = JosaUtil::pick($destcity['name'], '로');
|
|
||||||
if($admin['year'] < $admin['startyear']+3) {
|
if($admin['year'] < $admin['startyear']+3) {
|
||||||
$log[] = "<C>●</>{$admin['month']}월:현재 초반 제한중입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
$log[] = "<C>●</>{$admin['month']}월:현재 초반 제한중입니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
// } elseif($city['supply'] == 0) {
|
pushGenLog($general, $log);
|
||||||
// $log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
return;
|
||||||
} elseif(!$nearCity) {
|
}
|
||||||
$log[] = "<C>●</>{$admin['month']}월:인접도시가 아닙니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] == 0) {
|
if($general['level'] == 0) {
|
||||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
$log[] = "<C>●</>{$admin['month']}월:재야입니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
} elseif($general['crew'] <= 0) {
|
pushGenLog($general, $log);
|
||||||
$log[] = "<C>●</>{$admin['month']}월:병사가 없습니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
return;
|
||||||
} elseif($general['rice'] <= Util::round($general['crew']/100)) {
|
}
|
||||||
$log[] = "<C>●</>{$admin['month']}월:군량이 모자랍니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
if($general['crew'] <= 0) {
|
||||||
} elseif($dip['state'] != 0) {
|
$log[] = "<C>●</>{$admin['month']}월:병사가 없습니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
$log[] = "<C>●</>{$admin['month']}월:교전중인 국가가 아닙니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
pushGenLog($general, $log);
|
||||||
} elseif($general['nation'] != $city['nation']) {
|
return;
|
||||||
$log[] = "<C>●</>{$admin['month']}월:본국에서만 출병가능합니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
}
|
||||||
} elseif($nation['war'] == 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:현재 전쟁 금지입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
if($general['rice'] <= Util::round($general['crew']/100)) {
|
||||||
} elseif($general['nation'] == $destcity['nation']) {
|
$log[] = "<C>●</>{$admin['month']}월:군량이 모자랍니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
$log[] = "<C>●</>{$admin['month']}월:본국입니다. <G><b>{$destcity['name']}</b></>{$josaRo} 출병 실패. <1>$date</>";
|
pushGenLog($general, $log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($nation['war'] == 1) {
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:현재 전쟁 금지입니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
|
pushGenLog($general, $log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($general['nation'] != $city['nation']) {
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:본국에서만 출병가능합니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
|
pushGenLog($general, $log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($general['city'] == $finalTarget){
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:이미 도착했습니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
|
pushGenLog($general, $log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$allowedNationList = $db->queryFirstColumn('SELECT you FROM diplomacy WHERE state = 0 AND me = %i', $general['nation']);
|
||||||
|
$allowedNationList[] = $general['nation'];
|
||||||
|
$allowedNationList[] = 0;
|
||||||
|
|
||||||
|
$distanceList = searchDistanceListToDest($general['city'], $finalTarget, $allowedNationList);
|
||||||
|
|
||||||
|
if(!$distanceList){
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:경로에 도달할 방법이 없습니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
|
pushGenLog($general, $log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$candidateCities = [];
|
||||||
|
|
||||||
|
$minDist = Util::array_first_key($distanceList);
|
||||||
|
do {
|
||||||
|
//1: 최단 거리 도시 중 공격 대상이 있는가 확인
|
||||||
|
//2: 최단 거리 + 1 도시 중 공격 대상이 있는가 확인
|
||||||
|
foreach($distanceList as $dist => $distCitiesInfo){
|
||||||
|
if($dist > $minDist + 1){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$currDist = $dist;
|
||||||
|
foreach($distCitiesInfo as [$distCityID, $distCityNation]){
|
||||||
|
if($distCityNation !== $general['nation']){
|
||||||
|
$candidateCities[] = $distCityID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($candidateCities){
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//3: 최단 거리 도시 중 아군 도시 선택
|
||||||
|
foreach($distanceList[$minDist] as [$distCityID, $distCityNation]){
|
||||||
|
if($distCityNation === $general['nation']){
|
||||||
|
$candidateCities[] = $distCityID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}while(false);
|
||||||
|
|
||||||
|
$destCityID = (int)Util::choiceRandom($candidateCities);
|
||||||
|
$destCity = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $destCityID);
|
||||||
|
|
||||||
|
if($general['nation'] == $destCity['nation']) {
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:경로에 적국 도시가 없습니다. <G><b>{$finalDestCityName}</b></> 방향으로 출병 실패. <1>$date</>";
|
||||||
|
$general['turn0'] = EncodeCommand(0, 0, $destCityID, 26);
|
||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
process_21($general);
|
process_21($general);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
// 전쟁 표시
|
|
||||||
$query = "update city set state=43,term=3 where city='{$destcity['city']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
// 숙련도 증가
|
|
||||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
|
|
||||||
// 전투 처리
|
|
||||||
processWar($general, $destcity);
|
|
||||||
$log = uniqueItem($general, $log);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$destCityName = CityConst::byID($destCityID)->name;
|
||||||
|
if($finalTarget !== $destCityID){
|
||||||
|
$josaRo = JosaUtil::pick($finalDestCityName, '로');
|
||||||
|
$josaUl = JosaUtil::pick($destCityName, '을');
|
||||||
|
if($minDist == $currDist){
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$finalDestCityName}</b></>{$josaRo} 가기 위해 <G><b>{$destCityName}</b></>{$josaUl} 거쳐야 합니다. <1>$date</>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$finalDestCityName}</b></>{$josaRo} 가는 도중 <G><b>{$destCityName}</b></>{$josaUl} 거치기로 합니다. <1>$date</>";
|
||||||
|
}
|
||||||
|
|
||||||
|
pushGenLog($general, $log);
|
||||||
|
$log = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 전쟁 표시
|
||||||
|
$db->update('city', [
|
||||||
|
'state'=>43,
|
||||||
|
'term'=>3
|
||||||
|
], 'city = %i', $destCityID);
|
||||||
|
// 숙련도 증가
|
||||||
|
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
|
||||||
|
// 전투 처리
|
||||||
|
processWar($general, $destCity);
|
||||||
|
$log = uniqueItem($general, $log);
|
||||||
|
|
||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2565,9 +2627,18 @@ function process_58(&$general) {
|
|||||||
|
|
||||||
$cutDex = Util::toInt($fromOrigDex * 0.3);
|
$cutDex = Util::toInt($fromOrigDex * 0.3);
|
||||||
$fromNewDex = $fromOrigDex - $cutDex;
|
$fromNewDex = $fromOrigDex - $cutDex;
|
||||||
|
|
||||||
|
if($fromDexIdx == $toDexIdx){
|
||||||
|
$toOrigDex = $fromNewDex;
|
||||||
|
}
|
||||||
|
|
||||||
$addDex = Util::toInt($cutDex * 2 / 3);
|
$addDex = Util::toInt($cutDex * 2 / 3);
|
||||||
$toNewDex = $toOrigDex + $addDex;
|
$toNewDex = $toOrigDex + $addDex;
|
||||||
|
|
||||||
|
if($fromDexIdx == $toDexIdx){
|
||||||
|
$fromNewDex = $toNewDex;
|
||||||
|
}
|
||||||
|
|
||||||
$exp = 10;
|
$exp = 10;
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
$exp = CharExperience($exp, $general['personal']);
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -392,7 +392,8 @@ function command_16($turn, $command) {
|
|||||||
|
|
||||||
echo getMapHtml();
|
echo getMapHtml();
|
||||||
echo "<br>
|
echo "<br>
|
||||||
선택된 도시로 침공을 합니다.<br>
|
선택된 도시를 향해 침공을 합니다.<br>
|
||||||
|
침공 경로에 적군의 도시가 있다면 전투를 벌입니다.<br>
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||||
<form name=form1 action=c_double.php method=post>
|
<form name=form1 action=c_double.php method=post>
|
||||||
{$currentcity['name']} =>
|
{$currentcity['name']} =>
|
||||||
@@ -414,8 +415,6 @@ function command_16($turn, $command) {
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
printCitiesBasedOnDistance($currentcity['city'], 1);
|
|
||||||
|
|
||||||
ender();
|
ender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ function postOAuthResult(result){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="bottom_box">
|
<div id="bottom_box">
|
||||||
<div class="container"><a href="terms.2.html">개인정보처리방침</a> & <a href="terms.1.html">이용약관</a><br>© 2019 • HideD
|
<div class="container"><a href="terms.2.html">개인정보처리방침</a> & <a href="terms.1.html">이용약관</a><br>© 2020 • HideD
|
||||||
<br>크롬과 파이어폭스에 최적화되어있습니다.</div></div>
|
<br>크롬과 파이어폭스에 최적화되어있습니다.</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user