임관 제한을 하드코딩 10에서 Const로 전환
This commit is contained in:
@@ -200,7 +200,7 @@ if($btn == "추방") {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$nation['chemi'] -= 1;
|
||||
if($nation['chemi'] < 0) { $nation['chemi'] = 0; }
|
||||
|
||||
+1
-1
@@ -1962,7 +1962,7 @@ function updateTurntime($no) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -682,7 +682,7 @@ function checkMerge() {
|
||||
pushNationHistory($younation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>과 <D><b>{$you['makenation']}</b></>로 통합");
|
||||
|
||||
$newGenCount = $gencount + $gencount2;
|
||||
if($newGenCount < 10) { $newGenCount = 10; }
|
||||
if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; }
|
||||
$newTotalTech = $younation['totaltech'] + $mynation['totaltech'];
|
||||
$newTech = Util::round($newTotalTech / $newGenCount);
|
||||
// 자금 통합, 외교제한 5년, 기술유지
|
||||
@@ -805,7 +805,7 @@ function checkSurrender() {
|
||||
pushNationHistory($younation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaWa} 합병");
|
||||
|
||||
$newGenCount = $gencount + $gencount2;
|
||||
if($newGenCount < 10) { $newGenCount = 10; }
|
||||
if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; }
|
||||
$newTotalTech = $younation['totaltech'] + $mynation['totaltech'];
|
||||
$newTech = Util::round($newTotalTech / $newGenCount);
|
||||
// 자금 통합, 외교제한 5년, 기술유지
|
||||
@@ -932,7 +932,7 @@ function updateNationState() {
|
||||
refreshNationStaticInfo();
|
||||
}
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
//기술 및 변경횟수 업데이트
|
||||
$query = "update nation set tech=totaltech/'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
+19
-3
@@ -325,7 +325,22 @@ function processAI($no) {
|
||||
switch(rand()%5) {
|
||||
//임관 40%
|
||||
case 0: case 1:
|
||||
if($admin['scenario'] == 0 || $admin['scenario'] >= 20) {
|
||||
|
||||
$available = true;
|
||||
|
||||
if($admin['startyear']+3 > $admin['year']){
|
||||
//초기 임관 기간에서는 임관 가능한 국가가 적을수록 임관 시도가 적음
|
||||
}
|
||||
|
||||
if($general['affinity'] == 999){
|
||||
$command = EncodeCommand(0, 0, 0, 42); //견문
|
||||
}
|
||||
else{
|
||||
//랜임 커맨드 입력.
|
||||
$command = EncodeCommand(0, 0, 99, 25); //임관
|
||||
}
|
||||
/*
|
||||
if($admin['scenario'] == 0 || $admin['scenario'] >= 20 || !$admin['fiction']) {
|
||||
// 가상모드엔 랜덤임관, 초반엔 부상 적은 군주 우선 70%
|
||||
if($admin['startyear']+3 > $admin['year'] && rand()%100 < 70) {
|
||||
$query = "select nation from general where level=12 and nation not in (0{$general['nations']}0) order by injury,rand() limit 0,1";
|
||||
@@ -365,12 +380,13 @@ function processAI($no) {
|
||||
$command = EncodeCommand(0, 0, 0, 42); //견문
|
||||
}
|
||||
}
|
||||
*/
|
||||
break;
|
||||
case 2: case 3: //거병이나 견문 40%
|
||||
// 초반이면서 능력이 좋은놈 위주로 1%확률로 거병 (300명 재야시 2년간 약 10개 거병 예상)
|
||||
// 초반이면서 능력이 좋은놈 위주로 1.5%확률로 거병 (300명 재야시 2년간 약 15개 거병 예상)
|
||||
$prop = rand() % 100;
|
||||
$ratio = Util::round(($general['leader'] + $general['power'] + $general['intel']) / 3);
|
||||
if($admin['startyear']+2 > $admin['year'] && $prop < $ratio && rand()%100 < 1 && $general['makelimit'] == 0) {
|
||||
if($admin['startyear']+2 > $admin['year'] && $prop < $ratio && rand()%200 < 3 && $general['makelimit'] == 0) {
|
||||
//거병
|
||||
$command = EncodeCommand(0, 0, 0, 55);
|
||||
} else {
|
||||
|
||||
@@ -366,7 +366,7 @@ function process_3(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
// 내정 상승
|
||||
$query = "update nation set totaltech=totaltech+'$score',tech=totaltech/'$gencount' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -1400,7 +1400,7 @@ function process_71(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 10);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -1515,7 +1515,7 @@ function process_72(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -1636,7 +1636,7 @@ function process_73(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -1769,7 +1769,7 @@ function process_74(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 20);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -1911,7 +1911,7 @@ function process_75(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 40);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -2028,7 +2028,7 @@ function process_76(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
//$term2 = Util::round($genCount / 10);
|
||||
//if($term2 == 0) { $term2 = 1; }
|
||||
@@ -2202,7 +2202,7 @@ function process_76(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
// 국가보정
|
||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
||||
@@ -2259,7 +2259,7 @@ function process_77(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
$term2 = 1;
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
@@ -2389,7 +2389,7 @@ function process_78(&$general) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
if($genCount < 10) { $genCount = 10; }
|
||||
if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; }
|
||||
|
||||
$term2 = 1;
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
|
||||
@@ -67,7 +67,7 @@ function process_25(&$general) {
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'scenario', 'fiction']);
|
||||
|
||||
$query = "select nation from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -80,7 +80,7 @@ function process_25(&$general) {
|
||||
if($where == 99) {
|
||||
// 초반시 10명이하, 임관금지없음 국가
|
||||
if($admin['year'] < $admin['startyear']+3) {
|
||||
$query = "select name,nation,scout,level from nation where nation not in (0{$general['nations']}0) and gennum<10 and scout=0 order by rand() limit 0,1";
|
||||
$query = "select name,nation,scout,level from nation where nation not in (0{$general['nations']}0) and gennum<".GameConst::$initialNationGenLimit." and scout=0 order by rand() limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
} else {
|
||||
@@ -91,7 +91,7 @@ function process_25(&$general) {
|
||||
} elseif($where == 98) {
|
||||
// 초반시 10명이하, 임관금지없음 국가, 방랑군 제외
|
||||
if($admin['year'] < $admin['startyear']+3) {
|
||||
$query = "select name,nation,scout,level from nation where nation not in (0{$general['nations']}0) and gennum<10 and scout=0 and level>0 order by rand() limit 0,1";
|
||||
$query = "select name,nation,scout,level from nation where nation not in (0{$general['nations']}0) and gennum<".GameConst::$initialNationGenLimit." and scout=0 and level>0 order by rand() limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
} else {
|
||||
@@ -115,9 +115,9 @@ function process_25(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야가 아닙니다. 임관 실패. <1>$date</>";
|
||||
} elseif($nation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 국가입니다. 임관 실패. <1>$date</>";
|
||||
} elseif($nation['level'] == 0 && $gencount >= 10) {
|
||||
} elseif($nation['level'] == 0 && $gencount >= GameConst::$initialNationGenLimit) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 <D>{$nation['name']}</>{$josaUn} 임관이 제한되고 있습니다. 임관 실패.";
|
||||
} elseif($admin['year'] < $admin['startyear']+3 && $gencount >= 10) {
|
||||
} elseif($admin['year'] < $admin['startyear']+3 && $gencount >= GameConst::$initialNationGenLimit) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 <D>{$nation['name']}</>{$josaUn} 임관이 제한되고 있습니다. 임관 실패.";
|
||||
} elseif($nation['scout'] == 1 && $general['npc'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 <D>{$nation['name']}</>{$josaUn} 임관이 금지되어 있습니다. 임관 실패.";
|
||||
@@ -137,7 +137,7 @@ function process_25(&$general) {
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에 임관");
|
||||
}
|
||||
|
||||
if($gencount < 10) { $exp = 700; }
|
||||
if($gencount < GameConst::$initialNationGenLimit) { $exp = 700; }
|
||||
else { $exp = 100; }
|
||||
$ded = 0;
|
||||
|
||||
@@ -165,7 +165,7 @@ function process_25(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -202,7 +202,7 @@ function process_29(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. 인재탐색 실패. <1>$date</>";
|
||||
} elseif($nation['level'] <= 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:방랑군입니다. 인재탐색 실패. <1>$date</>";
|
||||
} elseif($admin['year'] < $admin['startyear']+3 && $nation['gennum'] >= 10) {
|
||||
} elseif($admin['year'] < $admin['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 <D>{$nation['name']}</>{$josaUn} 탐색이 제한되고 있습니다. 인재탐색 실패.";
|
||||
} elseif($general['gold'] < $admin['develcost']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 모자랍니다. 인재탐색 실패. <1>$date</>";
|
||||
@@ -409,7 +409,7 @@ function process_29(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
//국가 기술력 그대로
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'";
|
||||
@@ -540,7 +540,7 @@ function process_45(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$nation['chemi'] -= 1;
|
||||
if($nation['chemi'] < 0) { $nation['chemi'] = 0; }
|
||||
|
||||
+2
-2
@@ -99,12 +99,12 @@ function processWar($general, $city) {
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
if($gencount < 10) $gencount = 10;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
//장수수 구함
|
||||
$query = "select no from general where nation='{$destnation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$destgencount = MYDB_num_rows($result);
|
||||
if($destgencount < 10) $destgencount = 10;
|
||||
if($destgencount < GameConst::$initialNationGenLimit) $destgencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$genAtmosBonus = 0; $genTrainBonus = 0;
|
||||
$oppAtmosBonus = 0; $oppTrainBonus = 0;
|
||||
|
||||
+1
-1
@@ -995,7 +995,7 @@ function command_25($turn, $command) {
|
||||
$scoutStr .= "<tr><td align=center width=130 style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</td><td width=870 style=color:".newColor($nation['color']).";background-color:{$nation['color']}>".$nation['scoutmsg']."</td></tr>";
|
||||
}
|
||||
|
||||
if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= 10) {
|
||||
if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit) {
|
||||
echo "
|
||||
<option value={$nation['nation']} style=color:{$nation['color']};background-color:red;>【 {$nation['name']} 】</option>";
|
||||
} elseif($nation['scout'] == 1) {
|
||||
|
||||
@@ -110,13 +110,13 @@ class Personnel{
|
||||
}
|
||||
|
||||
$scoutNationGeneralCnt+=1;
|
||||
if($scoutNationGeneralCnt < 10){
|
||||
$scoutNationGeneralCnt = 10;//XXX: 상수!
|
||||
if($scoutNationGeneralCnt < GameConst::$initialNationGenLimit){
|
||||
$scoutNationGeneralCnt = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
$originalNationGeneralCnt-=1;
|
||||
if($originalNationGeneralCnt < 10){
|
||||
$originalNationGeneralCnt = 10;//XXX: 상수!
|
||||
if($originalNationGeneralCnt < GameConst::$initialNationGenLimit){
|
||||
$originalNationGeneralCnt = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
// 국가 변경, 도시 변경, 일반으로, 수도로
|
||||
|
||||
@@ -68,6 +68,9 @@ class GameConst extends GameCustomConst
|
||||
/** @var float 성인 연령 */
|
||||
public static $adultAge = 14;
|
||||
|
||||
/** @var int 초기 제한시 장수 제한 */
|
||||
public static $initialNationGenLimit = 10;
|
||||
|
||||
/** @var int 초기 최대 장수수 */
|
||||
public static $defaultMaxGeneral = 500;
|
||||
/** @var int 초기 최대 국가 수 */
|
||||
|
||||
Reference in New Issue
Block a user