VAL2를 VAL_max로 변경
This commit is contained in:
+9
-9
@@ -210,14 +210,14 @@ for($i=0; $i < $nationCount; $i++) {
|
||||
$gen = MYDB_fetch_array($genResult);
|
||||
|
||||
$query = "select COUNT(*) as cnt,
|
||||
SUM(pop) as pop, SUM(pop2) as pop2,
|
||||
ROUND(SUM(pop)/SUM(pop2)*100, 2) as rate,
|
||||
SUM(pop) as pop, SUM(pop_max) as pop_max,
|
||||
ROUND(SUM(pop)/SUM(pop_max)*100, 2) as rate,
|
||||
trust,
|
||||
ROUND(SUM(agri)/SUM(agri2)*100, 2) as agri,
|
||||
ROUND(SUM(comm)/SUM(comm2)*100, 2) as comm,
|
||||
ROUND(SUM(secu)/SUM(secu2)*100, 2) as secu,
|
||||
ROUND(SUM(wall)/SUM(wall2)*100, 2) as wall,
|
||||
ROUND(SUM(def)/SUM(def2)*100, 2) as def
|
||||
ROUND(SUM(agri)/SUM(agri_max)*100, 2) as agri,
|
||||
ROUND(SUM(comm)/SUM(comm_max)*100, 2) as comm,
|
||||
ROUND(SUM(secu)/SUM(secu_max)*100, 2) as secu,
|
||||
ROUND(SUM(wall)/SUM(wall_max)*100, 2) as wall,
|
||||
ROUND(SUM(def)/SUM(def_max)*100, 2) as def
|
||||
from city where nation='{$nation['nation']}'";
|
||||
$cityResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityResult);
|
||||
@@ -246,8 +246,8 @@ for($i=0; $i < $nationCount; $i++) {
|
||||
<td align=right> {$nation['dex30']} </td>
|
||||
<td align=right> {$nation['dex40']} </td>
|
||||
<td align=right> {$gen['crew']}/{$gen['leadership']}00 </td>
|
||||
<td align=center> {$city['pop']}/{$city['pop2']} </td>
|
||||
<td align=center> ".sprintf('%.1f',$city['pop']/$city['pop2']*100)."% </td>
|
||||
<td align=center> {$city['pop']}/{$city['pop_max']} </td>
|
||||
<td align=center> ".sprintf('%.1f',$city['pop']/$city['pop_max']*100)."% </td>
|
||||
<td align=center> {$city['agri']}% </td>
|
||||
<td align=center> {$city['comm']}% </td>
|
||||
<td align=center> {$city['secu']}% </td>
|
||||
|
||||
@@ -416,17 +416,17 @@ foreach($generalsFormat as $general){
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=48 class=bg1>주민</td>
|
||||
<td align=center width=112><?=$city['pop']?>/<?=$city['pop2']?></td>
|
||||
<td align=center width=112><?=$city['pop']?>/<?=$city['pop_max']?></td>
|
||||
<td align=center width=48 class=bg1>농업</td>
|
||||
<td align=center width=108><?=$city['agri']?>/<?=$city['agri2']?></td>
|
||||
<td align=center width=108><?=$city['agri']?>/<?=$city['agri_max']?></td>
|
||||
<td align=center width=48 class=bg1>상업</td>
|
||||
<td align=center width=108><?=$city['comm']?>/<?=$city['comm2']?></td>
|
||||
<td align=center width=108><?=$city['comm']?>/<?=$city['comm_max']?></td>
|
||||
<td align=center width=48 class=bg1>치안</td>
|
||||
<td align=center width=108><?=$city['secu']?>/<?=$city['secu2']?></td>
|
||||
<td align=center width=108><?=$city['secu']?>/<?=$city['secu_max']?></td>
|
||||
<td align=center width=48 class=bg1>수비</td>
|
||||
<td align=center width=108><?=$city['def']?>/<?=$city['def2']?></td>
|
||||
<td align=center width=108><?=$city['def']?>/<?=$city['def_max']?></td>
|
||||
<td align=center width=48 class=bg1>성벽</td>
|
||||
<td align=center width=108><?=$city['wall']?>/<?=$city['wall2']?></td>
|
||||
<td align=center width=108><?=$city['wall']?>/<?=$city['wall_max']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center class=bg1>민심</td>
|
||||
@@ -434,7 +434,7 @@ foreach($generalsFormat as $general){
|
||||
<td align=center class=bg1>시세</td>
|
||||
<td align=center><?=$city['trade']?>%</td>
|
||||
<td align=center class=bg1>인구</td>
|
||||
<td align=center><?=round($city['pop']/$city['pop2']*100, 2)?>%</td>
|
||||
<td align=center><?=round($city['pop']/$city['pop_max']*100, 2)?>%</td>
|
||||
<td align=center class=bg1>태수</td>
|
||||
<td align=center><?=$officer[4]['name']?></td>
|
||||
<td align=center class=bg1>군사</td>
|
||||
|
||||
@@ -75,7 +75,7 @@ $sel = [$type => "selected"];
|
||||
|
||||
$nation = getNationStaticInfo($me['nation']); //국가정보
|
||||
|
||||
$query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}'";
|
||||
$query = "select *,pop/pop_max as poprate from city where nation='{$me['nation']}'";
|
||||
|
||||
switch ($type) {
|
||||
case 1: break;
|
||||
@@ -144,17 +144,17 @@ for ($j=0; $j < $citycount; $j++) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=46 id=bg1>주민</td>
|
||||
<td align=center width=140>{$city['pop']}/{$city['pop2']}</td>
|
||||
<td align=center width=140>{$city['pop']}/{$city['pop_max']}</td>
|
||||
<td align=center width=46 id=bg1>농업</td>
|
||||
<td align=center width=140>{$city['agri']}/{$city['agri2']}</td>
|
||||
<td align=center width=140>{$city['agri']}/{$city['agri_max']}</td>
|
||||
<td align=center width=46 id=bg1>상업</td>
|
||||
<td align=center width=140>{$city['comm']}/{$city['comm2']}</td>
|
||||
<td align=center width=140>{$city['comm']}/{$city['comm_max']}</td>
|
||||
<td align=center width=46 id=bg1>치안</td>
|
||||
<td align=center width=140>{$city['secu']}/{$city['secu2']}</td>
|
||||
<td align=center width=140>{$city['secu']}/{$city['secu_max']}</td>
|
||||
<td align=center width=46 id=bg1>수비</td>
|
||||
<td align=center width=140>{$city['def']}/{$city['def2']}</td>
|
||||
<td align=center width=140>{$city['def']}/{$city['def_max']}</td>
|
||||
<td align=center width=46 id=bg1>성벽</td>
|
||||
<td align=center width=140>{$city['wall']}/{$city['wall2']}</td>
|
||||
<td align=center width=140>{$city['wall']}/{$city['wall_max']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>민심</td>
|
||||
@@ -162,7 +162,7 @@ for ($j=0; $j < $citycount; $j++) {
|
||||
<td align=center id=bg1>시세</td>
|
||||
<td align=center>{$city['trade']}%</td>
|
||||
<td align=center id=bg1>인구</td>
|
||||
<td align=center>".round($city['pop']/$city['pop2']*100, 2)." %</td>
|
||||
<td align=center>".round($city['pop']/$city['pop_max']*100, 2)." %</td>
|
||||
<td align=center id=bg1>태수</td>
|
||||
<td align=center>";
|
||||
echo $officerName[4];
|
||||
|
||||
@@ -52,7 +52,7 @@ $cityNames = [];
|
||||
|
||||
foreach($cityList as $city){
|
||||
$currPop += $city['pop'];
|
||||
$maxPop += $city['pop2'];
|
||||
$maxPop += $city['pop_max'];
|
||||
if($city['city'] == $nation['capital']){
|
||||
$cityNames[] = "<span style='color:cyan;'>{$city['name']}</span>";
|
||||
}
|
||||
|
||||
+4
-4
@@ -196,7 +196,7 @@ function myNationInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop2) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$query = "select COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop_max) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
@@ -726,13 +726,13 @@ function generalInfo(General $generalObj) {
|
||||
<tr height=16>
|
||||
<td style='text-align:center;' class='bg1'><b>통솔</b></td>
|
||||
<td style='text-align:center;'> {$color}{$leadership}</font>{$lbonus} </td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('leadership2')), 20)."</td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('leadership_max')), 20)."</td>
|
||||
<td style='text-align:center;' class='bg1'><b>무력</b></td>
|
||||
<td style='text-align:center;'> {$color}{$strength}</font> </td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('strength2')), 20)."</td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('strength_max')), 20)."</td>
|
||||
<td style='text-align:center;' class='bg1'><b>지력</b></td>
|
||||
<td style='text-align:center;'> {$color}{$intel}</font> </td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('intel2')), 20)."</td>
|
||||
<td style='text-align:center;' width=45>".bar(expStatus($generalObj->getVar('intel_max')), 20)."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align:center;' class='bg1'><b>명마</b></td>
|
||||
|
||||
@@ -405,7 +405,7 @@ function postUpdateMonthly() {
|
||||
+A.tech
|
||||
+if(A.level=0,0,(
|
||||
select round(
|
||||
sum(pop)*sum(pop+agri+comm+secu+wall+def)/sum(pop2+agri2+comm2+secu2+wall2+def2)/100
|
||||
sum(pop)*sum(pop+agri+comm+secu+wall+def)/sum(pop_max+agri_max+comm_max+secu_max+wall_max+def_max)/100
|
||||
) from city where nation=A.nation and supply=1
|
||||
))
|
||||
+(select sum(leadership+strength+intel) from general where nation=A.nation)
|
||||
@@ -1054,7 +1054,7 @@ function checkStatistic() {
|
||||
);
|
||||
|
||||
$nationCityInfos = Util::convertArrayToDict(
|
||||
$db->query('SELECT nation, count(*) as cnt, sum(pop) as pop,sum(pop2) as pop2 from city GROUP BY nation'),
|
||||
$db->query('SELECT nation, count(*) as cnt, sum(pop) as pop,sum(pop_max) as pop_max from city GROUP BY nation'),
|
||||
'nation'
|
||||
);
|
||||
|
||||
@@ -1066,7 +1066,7 @@ function checkStatistic() {
|
||||
$nation['cityInfo'] = $city;
|
||||
|
||||
$nationName .= $nation['name'].'('.getNationType($nation['type']).'), ';
|
||||
$powerHist .= "{$nation['name']}({$nation['power']}/{$nation['gennum']}/{$city['cnt']}/{$city['pop']}/{$city['pop2']}/{$nation['goldrice']}/{$general['goldrice']}/{$general['abil']}/{$general['dex']}/{$general['expded']}), ";
|
||||
$powerHist .= "{$nation['name']}({$nation['power']}/{$nation['gennum']}/{$city['cnt']}/{$city['pop']}/{$city['pop_max']}/{$nation['goldrice']}/{$general['goldrice']}/{$general['abil']}/{$general['dex']}/{$general['expded']}), ";
|
||||
|
||||
if(!isset($nationHists[$nation['type']])){
|
||||
$nationHists[$nation['type']] = 0;
|
||||
@@ -1253,7 +1253,7 @@ function checkEmperior() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select SUM(pop) as totalpop,SUM(pop2) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$query = "select SUM(pop) as totalpop,SUM(pop_max) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
$pop = "{$city['totalpop']} / {$city['maxpop']}";
|
||||
|
||||
+15
-15
@@ -658,12 +658,12 @@ function process_67(&$general) {
|
||||
$db->update('city', [
|
||||
'upgrading'=>$db->sqleval('upgrading+1'),
|
||||
'level'=>$db->sqleval('level+1'),
|
||||
'pop2'=>$db->sqleval('pop2 + %i', GameConst::$expandCityPopIncreaseAmount),
|
||||
'agri2'=>$db->sqleval('agri2 + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'comm2'=>$db->sqleval('comm2 + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'secu2'=>$db->sqleval('secu2 + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'def2'=>$db->sqleval('def2 + %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'wall2'=>$db->sqleval('wall2 + %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'pop_max'=>$db->sqleval('pop_max + %i', GameConst::$expandCityPopIncreaseAmount),
|
||||
'agri_max'=>$db->sqleval('agri_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'comm_max'=>$db->sqleval('comm_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'secu_max'=>$db->sqleval('secu_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'def_max'=>$db->sqleval('def_max + %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'wall_max'=>$db->sqleval('wall_max + %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
], 'city=%i', $destcity['city']);
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -772,12 +772,12 @@ function process_68(&$general) {
|
||||
$db->update('city', [
|
||||
'upgrading'=>$db->sqleval('upgrading-1'),
|
||||
'level'=>$db->sqleval('level-1'),
|
||||
'pop2'=>$db->sqleval('pop2 - %i', GameConst::$expandCityPopIncreaseAmount),
|
||||
'agri2'=>$db->sqleval('agri2 - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'comm2'=>$db->sqleval('comm2 - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'secu2'=>$db->sqleval('secu2 - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'def2'=>$db->sqleval('def2 - %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'wall2'=>$db->sqleval('wall2 - %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'pop_max'=>$db->sqleval('pop_max - %i', GameConst::$expandCityPopIncreaseAmount),
|
||||
'agri_max'=>$db->sqleval('agri_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'comm_max'=>$db->sqleval('comm_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'secu_max'=>$db->sqleval('secu_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
||||
'def_max'=>$db->sqleval('def_max - %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'wall_max'=>$db->sqleval('wall_max - %i', GameConst::$expandCityWallIncreaseAmount),
|
||||
'pop'=>$pop,
|
||||
'agri'=>$agri,
|
||||
'comm'=>$comm,
|
||||
@@ -993,7 +993,7 @@ function process_72(&$general) {
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동");
|
||||
|
||||
//도시 성수 80%
|
||||
$query = "update city set def=def2*0.8,wall=wall2*0.8 where city='{$destcity['city']}'";
|
||||
$query = "update city set def=def_max*0.8,wall=wall_max*0.8 where city='{$destcity['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
@@ -1509,7 +1509,7 @@ function process_76(&$general) {
|
||||
$type = Util::choiceRandomUsingWeight([
|
||||
'strength0'=>1,
|
||||
'strength1'=>1,
|
||||
'strength2'=>1,
|
||||
'strength_max'=>1,
|
||||
'intel'=>3,
|
||||
'neutral'=>0
|
||||
]);
|
||||
@@ -1526,7 +1526,7 @@ function process_76(&$general) {
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal/8, $dexTotal*5/8, $dexTotal/8, $dexTotal/8];
|
||||
break;
|
||||
case 'strength2':
|
||||
case 'strength_max':
|
||||
$leadership = $stat_tier1;
|
||||
$strength = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
|
||||
+20
-20
@@ -138,15 +138,15 @@ function popIncrease() {
|
||||
|
||||
$updateVar = [];
|
||||
if($popRatio >= 0){
|
||||
$updateVar['pop'] = $db->sqleval('least(pop2, %i + pop * (1 + %d * (1 + secu / secu2 / 10)))', GameConst::$basePopIncreaseAmount, $popRatio);
|
||||
$updateVar['pop'] = $db->sqleval('least(pop_max, %i + pop * (1 + %d * (1 + secu / secu_max / 10)))', GameConst::$basePopIncreaseAmount, $popRatio);
|
||||
}
|
||||
else{
|
||||
$updateVar['pop'] = $db->sqleval('least(pop2, %i + pop * (1 + %d * (1 - secu / secu2 / 10)))', GameConst::$basePopIncreaseAmount, $popRatio);
|
||||
$updateVar['pop'] = $db->sqleval('least(pop_max, %i + pop * (1 + %d * (1 - secu / secu_max / 10)))', GameConst::$basePopIncreaseAmount, $popRatio);
|
||||
}
|
||||
|
||||
$genericRatio = (20 - $taxRate) / 200; // 20일때 0% 0일때 10% 100일때 -40%
|
||||
foreach(['agri', 'comm', 'secu', 'def', 'wall'] as $key){
|
||||
$updateVar[$key] = $db->sqleval('least(%b, %b * (1 + %d))', $key.'2', $key, $genericRatio);
|
||||
$updateVar[$key] = $db->sqleval('least(%b, %b * (1 + %d))', $key.'_max', $key, $genericRatio);
|
||||
}
|
||||
|
||||
$trustDiff = 20 - $taxRate;
|
||||
@@ -173,8 +173,8 @@ function calcCityGoldIncome(array $rawCity, int $officerCnt, bool $isCapital, in
|
||||
|
||||
$trustRatio = $rawCity['trust'] / 200 + 0.5;//0.5 ~ 1
|
||||
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['comm'] / $rawCity['comm2'] * $trustRatio / 30;
|
||||
$cityIncome *= 1 + $rawCity['secu']/$rawCity['secu2']/10;
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['comm'] / $rawCity['comm_max'] * $trustRatio / 30;
|
||||
$cityIncome *= 1 + $rawCity['secu']/$rawCity['secu_max']/10;
|
||||
$cityIncome *= pow(1.05, $officerCnt);
|
||||
if($isCapital){
|
||||
$cityIncome *= 1 + 1/(3*$nationLevel);
|
||||
@@ -191,8 +191,8 @@ function calcCityRiceIncome(array $rawCity, int $officerCnt, bool $isCapital, in
|
||||
|
||||
$trustRatio = $rawCity['trust'] / 200 + 0.5;//0.5 ~ 1
|
||||
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['agri'] / $rawCity['agri2'] * $trustRatio / 30;
|
||||
$cityIncome *= 1 + $rawCity['secu']/$rawCity['secu2']/10;
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['agri'] / $rawCity['agri_max'] * $trustRatio / 30;
|
||||
$cityIncome *= 1 + $rawCity['secu']/$rawCity['secu_max']/10;
|
||||
$cityIncome *= pow(1.05, $officerCnt);
|
||||
if($isCapital){
|
||||
$cityIncome *= 1 + 1/(3*$nationLevel);
|
||||
@@ -207,8 +207,8 @@ function calcCityWallRiceIncome(array $rawCity, int $officerCnt, bool $isCapital
|
||||
return 0;
|
||||
}
|
||||
|
||||
$wallIncome = $rawCity['def'] * $rawCity['wall'] / $rawCity['wall2'] / 3;
|
||||
$wallIncome *= 1 + $rawCity['secu']/$rawCity['secu2']/10;
|
||||
$wallIncome = $rawCity['def'] * $rawCity['wall'] / $rawCity['wall_max'] / 3;
|
||||
$wallIncome *= 1 + $rawCity['secu']/$rawCity['secu_max']/10;
|
||||
$wallIncome *= pow(1.05, $officerCnt);
|
||||
if($isCapital){
|
||||
$wallIncome *= 1 + 1/(3*$nationLevel);
|
||||
@@ -520,14 +520,14 @@ function disaster() {
|
||||
|
||||
$targetCityList = [];
|
||||
|
||||
foreach($db->query('SELECT city,name,secu,secu2 FROM city') as $city){
|
||||
foreach($db->query('SELECT city,name,secu,secu_max FROM city') as $city){
|
||||
//호황 발생 도시 선택 ( 기본 2% )
|
||||
//재해 발생 도시 선택 ( 기본 6% )
|
||||
if($isGood){
|
||||
$raiseProp = 0.02 + ($city['secu'] / $city['secu2']) * 0.05; // 2 ~ 7%
|
||||
$raiseProp = 0.02 + ($city['secu'] / $city['secu_max']) * 0.05; // 2 ~ 7%
|
||||
}
|
||||
else {
|
||||
$raiseProp = 0.06 - ($city['secu'] / $city['secu2']) * 0.05; // 1 ~ 6%
|
||||
$raiseProp = 0.06 - ($city['secu'] / $city['secu_max']) * 0.05; // 1 ~ 6%
|
||||
}
|
||||
|
||||
if(Util::randBool($raiseProp)) {
|
||||
@@ -587,7 +587,7 @@ function disaster() {
|
||||
$generalListByCity = Util::arrayGroupBy($db->query('SELECT no, nation, city, injury, crew, atmos, train FROM general WHERE city IN %li', Util::squeezeFromArray($targetCityList, 'city')), 'city');
|
||||
//NOTE: 쿼리 1번이지만 복잡하기 vs 쿼리 여러번이지만 조금 더 깔끔하기
|
||||
foreach ($targetCityList as $city) {
|
||||
$affectRatio = Util::valueFit($city['secu'] / $city['secu2'] / 0.8, 0, 1);
|
||||
$affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1);
|
||||
$affectRatio = 0.8 + $affectRatio * 0.15;
|
||||
|
||||
$db->update('city', [
|
||||
@@ -613,18 +613,18 @@ function disaster() {
|
||||
}
|
||||
else{
|
||||
foreach ($targetCityList as $city) {
|
||||
$affectRatio = Util::valueFit($city['secu'] / $city['secu2'] / 0.8, 0, 1);
|
||||
$affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1);
|
||||
$affectRatio = 1.01 + $affectRatio * 0.04;
|
||||
|
||||
$db->update('city', [
|
||||
'state'=>$stateCode,
|
||||
'pop'=>$db->sqleval('greatest(pop * %d, pop2)', $affectRatio),
|
||||
'pop'=>$db->sqleval('greatest(pop * %d, pop_max)', $affectRatio),
|
||||
'trust'=>$db->sqleval('greatest(trust * %d, 100)', $affectRatio),
|
||||
'agri'=>$db->sqleval('greatest(agri * %d, agri2)', $affectRatio),
|
||||
'comm'=>$db->sqleval('greatest(comm * %d, comm2)', $affectRatio),
|
||||
'secu'=>$db->sqleval('greatest(secu * %d, secu2)', $affectRatio),
|
||||
'def'=>$db->sqleval('greatest(def * %d, def2)', $affectRatio),
|
||||
'wall'=>$db->sqleval('greatest(wall * %d, wall2)', $affectRatio),
|
||||
'agri'=>$db->sqleval('greatest(agri * %d, agri_max)', $affectRatio),
|
||||
'comm'=>$db->sqleval('greatest(comm * %d, comm_max)', $affectRatio),
|
||||
'secu'=>$db->sqleval('greatest(secu * %d, secu_max)', $affectRatio),
|
||||
'def'=>$db->sqleval('greatest(def * %d, def_max)', $affectRatio),
|
||||
'wall'=>$db->sqleval('greatest(wall * %d, wall_max)', $affectRatio),
|
||||
], 'city = %i', $city['city']);
|
||||
|
||||
|
||||
|
||||
@@ -82,13 +82,13 @@ $rawDefenderNation = $query['defenderNation'];
|
||||
$generalCheck = [
|
||||
'required'=>[
|
||||
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
||||
'intel', 'intel2', 'book', 'strength', 'strength2', 'weapon', 'injury', 'leadership', 'leadership2', 'horse', 'item',
|
||||
'intel', 'intel_max', 'book', 'strength', 'strength_max', 'weapon', 'injury', 'leadership', 'leadership_max', 'horse', 'item',
|
||||
'explevel', 'experience', 'dedication', 'level', 'gold', 'rice', 'dex0', 'dex10', 'dex20', 'dex30', 'dex40',
|
||||
'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew', 'recwar'
|
||||
],
|
||||
'integer'=>[
|
||||
'no', 'nation', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
||||
'intel', 'intel2', 'book', 'strength', 'strength2', 'weapon', 'injury', 'leadership', 'leadership2', 'horse', 'item',
|
||||
'intel', 'intel_max', 'book', 'strength', 'strength_max', 'weapon', 'injury', 'leadership', 'leadership_max', 'horse', 'item',
|
||||
'explevel', 'experience', 'dedication', 'level', 'gold', 'rice', 'dex0', 'dex10', 'dex20', 'dex30', 'dex40',
|
||||
'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew'
|
||||
],
|
||||
@@ -156,7 +156,7 @@ $cityCheck = [
|
||||
'city', 'nation', 'supply', 'name',
|
||||
'pop', 'agri', 'comm', 'secu', 'def', 'wall',
|
||||
'trust', 'level',
|
||||
'pop2', 'agri2', 'comm2', 'secu2', 'def2', 'wall2',
|
||||
'pop_max', 'agri_max', 'comm_max', 'secu_max', 'def_max', 'wall_max',
|
||||
'dead', 'state', 'officer4', 'officer3', 'officer2', 'conflict',
|
||||
],
|
||||
'numeric'=>[
|
||||
@@ -164,7 +164,7 @@ $cityCheck = [
|
||||
],
|
||||
'integer'=>[
|
||||
'city', 'nation', 'supply',
|
||||
'pop2', 'agri2', 'comm2', 'secu2', 'def2', 'wall2',
|
||||
'pop_max', 'agri_max', 'comm_max', 'secu_max', 'def_max', 'wall_max',
|
||||
'state', 'officer4', 'officer3', 'officer2'
|
||||
],
|
||||
'min'=>[
|
||||
|
||||
+11
-11
@@ -365,9 +365,9 @@ jQuery(function($){
|
||||
city: (generalData.no)<=1 ? 1 : 3,
|
||||
turntime:'2018-08-26 12:00',
|
||||
special:defaultSpecialDomestic,
|
||||
leadership2:0,
|
||||
strength2:0,
|
||||
intel2:0,
|
||||
leadership_max:0,
|
||||
strength_max:0,
|
||||
intel_max:0,
|
||||
|
||||
gold:10000,
|
||||
|
||||
@@ -597,12 +597,12 @@ jQuery(function($){
|
||||
|
||||
trust:100,
|
||||
|
||||
pop2:600000,
|
||||
agri2:12000,
|
||||
comm2:12000,
|
||||
secu2:10000,
|
||||
def2:12000,
|
||||
wall2:12000,
|
||||
pop_max:600000,
|
||||
agri_max:12000,
|
||||
comm_max:12000,
|
||||
secu_max:10000,
|
||||
def_max:12000,
|
||||
wall_max:12000,
|
||||
|
||||
dead:0,
|
||||
|
||||
@@ -640,8 +640,8 @@ jQuery(function($){
|
||||
var defenderCity = $.extend({}, defaultCity, allData.defenderCity);
|
||||
defenderCity.nation = 2;
|
||||
defenderCity.city = 3;
|
||||
defenderCity.wall2 = defenderCity.wall/5*6;
|
||||
defenderCity.def2 = defenderCity.def/5*6;
|
||||
defenderCity.wall_max = defenderCity.wall/5*6;
|
||||
defenderCity.def_max = defenderCity.def/5*6;
|
||||
|
||||
var defenderGenerals = [];
|
||||
$.each(allData.defenderGenerals, function(){
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
|
||||
$city = new WarUnitCity($rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
||||
|
||||
$defenderList = [];
|
||||
foreach ($db->query('SELECT no,name,nation,turntime,personal,special,special2,crew,crewtype,atmos,train,intel,intel2,book,strength,strength2,weapon,injury,leadership,leadership2,horse,item,explevel,experience,dedication,level,gold,rice,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,defence_train FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city')) as $rawGeneral){
|
||||
foreach ($db->query('SELECT no,name,nation,turntime,personal,special,special2,crew,crewtype,atmos,train,intel,intel_max,book,strength,strength_max,weapon,injury,leadership,leadership_max,horse,item,explevel,experience,dedication,level,gold,rice,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,defence_train FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city')) as $rawGeneral){
|
||||
$defenderList[] = new General($rawGeneral, $rawDefenderCity, $year, $month);
|
||||
}
|
||||
|
||||
@@ -702,8 +702,8 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$query['def'] = 1000;
|
||||
$query['wall'] = 1000;
|
||||
} else {
|
||||
$query['def'] = $db->sqleval('def2/2');
|
||||
$query['wall'] = $db->sqleval('wall2/2');
|
||||
$query['def'] = $db->sqleval('def_max/2');
|
||||
$query['wall'] = $db->sqleval('wall_max/2');
|
||||
}
|
||||
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
|
||||
@@ -337,12 +337,12 @@ class CityConstBase{
|
||||
'city'=>$city->id,
|
||||
'name'=>$city->name,
|
||||
'level'=>$city->level,
|
||||
'pop2'=>$city->population,
|
||||
'agri2'=>$city->agriculture,
|
||||
'comm2'=>$city->commerce,
|
||||
'secu2'=>$city->security,
|
||||
'def2'=>$city->defence,
|
||||
'wall2'=>$city->wall,
|
||||
'pop_max'=>$city->population,
|
||||
'agri_max'=>$city->agriculture,
|
||||
'comm_max'=>$city->commerce,
|
||||
'secu_max'=>$city->security,
|
||||
'def_max'=>$city->defence,
|
||||
'wall_max'=>$city->wall,
|
||||
'region'=>$city->region
|
||||
] + $initValue + static::$buildInitCommon;
|
||||
}, array_values(static::$constID));
|
||||
|
||||
@@ -149,7 +149,7 @@ class che_강행 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -77,13 +77,13 @@ class che_견문 extends Command\GeneralCommand{
|
||||
$exp += 60;
|
||||
}
|
||||
if($type & SightseeingMessage::IncLeadership){
|
||||
$general->increaseVar('leadership2', 2);
|
||||
$general->increaseVar('leadership_max', 2);
|
||||
}
|
||||
if($type & SightseeingMessage::IncStrength){
|
||||
$general->increaseVar('strength2', 2);
|
||||
$general->increaseVar('strength_max', 2);
|
||||
}
|
||||
if($type & SightseeingMessage::IncIntel){
|
||||
$general->increaseVar('intel2', 2);
|
||||
$general->increaseVar('intel_max', 2);
|
||||
}
|
||||
if($type & SightseeingMessage::IncGold){
|
||||
$general->increaseVar('gold', 300);
|
||||
|
||||
@@ -158,9 +158,9 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
$ded = $general->onCalcStat($general, 'dedication', $ded);
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
'leadership2'=>$general->getLeadership(false, false, false, false),
|
||||
'strength2'=>$general->getStrength(false, false, false, false),
|
||||
'intel2'=>$general->getIntel(false, false, false, false)
|
||||
'leadership_max'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_max'=>$general->getStrength(false, false, false, false),
|
||||
'intel_max'=>$general->getIntel(false, false, false, false)
|
||||
]);
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
|
||||
@@ -102,7 +102,7 @@ class che_귀환 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -126,7 +126,7 @@ class che_기술연구 extends che_상업투자{
|
||||
$general->increaseVarWithLimit('gold', -$this->reqGold, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar(static::$statKey.'2', 1);
|
||||
$general->increaseVar(static::$statKey.'_max', 1);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
|
||||
@@ -116,9 +116,9 @@ class che_단련 extends Command\GeneralCommand{
|
||||
$general->addDex($general->getCrewTypeObj(), $score, false);
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
'leadership2'=>$general->getLeadership(false, false, false, false),
|
||||
'strength2'=>$general->getStrength(false, false, false, false),
|
||||
'intel2'=>$general->getIntel(false, false, false, false)
|
||||
'leadership_max'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_max'=>$general->getStrength(false, false, false, false),
|
||||
'intel_max'=>$general->getIntel(false, false, false, false)
|
||||
]);
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ class che_등용 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -111,9 +111,9 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
$ded = $general->onCalcStat($general, 'dedication', $ded);
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
'leadership2'=>$general->getLeadership(false, false, false, false),
|
||||
'strength2'=>$general->getStrength(false, false, false, false),
|
||||
'intel2'=>$general->getIntel(false, false, false, false)
|
||||
'leadership_max'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_max'=>$general->getStrength(false, false, false, false),
|
||||
'intel_max'=>$general->getIntel(false, false, false, false)
|
||||
]);
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
|
||||
@@ -100,7 +100,7 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -190,7 +190,7 @@ class che_상업투자 extends Command\GeneralCommand{
|
||||
static::$cityKey => Util::valueFit(
|
||||
$this->city[static::$cityKey] + $score,
|
||||
0,
|
||||
$this->city[static::$cityKey.'2']
|
||||
$this->city[static::$cityKey.'_max']
|
||||
)
|
||||
];
|
||||
$db->update('city', $cityUpdated, 'city=%i', $general->getVar('city'));
|
||||
@@ -198,7 +198,7 @@ class che_상업투자 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('gold', -$this->reqGold, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar(static::$statKey.'2', 1);
|
||||
$general->increaseVar(static::$statKey.'_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -147,7 +147,7 @@ class che_이동 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -129,9 +129,9 @@ class che_인재탐색 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date</>");
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
'leadership2'=>$general->getLeadership(false, false, false, false),
|
||||
'strength2'=>$general->getStrength(false, false, false, false),
|
||||
'intel2'=>$general->getIntel(false, false, false, false)
|
||||
'leadership_max'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_max'=>$general->getStrength(false, false, false, false),
|
||||
'intel_max'=>$general->getIntel(false, false, false, false)
|
||||
]);
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
@@ -290,9 +290,9 @@ class che_인재탐색 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralHistoryLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
||||
|
||||
$incStat = Util::choiceRandomUsingWeight([
|
||||
'leadership2'=>$general->getLeadership(false, false, false, false),
|
||||
'strength2'=>$general->getStrength(false, false, false, false),
|
||||
'intel2'=>$general->getIntel(false, false, false, false)
|
||||
'leadership_max'=>$general->getLeadership(false, false, false, false),
|
||||
'strength_max'=>$general->getStrength(false, false, false, false),
|
||||
'intel_max'=>$general->getIntel(false, false, false, false)
|
||||
]);
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class che_전투태세 extends Command\GeneralCommand{
|
||||
|
||||
$general->addDex($general->getCrewTypeObj(), $crew / 100 * 3, false);
|
||||
|
||||
$general->increaseVar('leadership2', 3);
|
||||
$general->increaseVar('leadership_max', 3);
|
||||
$general->setResultTurn($turnResult);
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -175,7 +175,7 @@ class che_정착장려 extends Command\GeneralCommand{
|
||||
static::$cityKey => Util::valueFit(
|
||||
$this->city[static::$cityKey] + $score,
|
||||
0,
|
||||
$this->city[static::$cityKey.'2']
|
||||
$this->city[static::$cityKey.'_max']
|
||||
)
|
||||
];
|
||||
$db->update('city', $cityUpdated, 'city=%i', $general->getVar('city'));
|
||||
@@ -183,7 +183,7 @@ class che_정착장려 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('rice', -$this->reqRice, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar(static::$statKey.'2', 1);
|
||||
$general->increaseVar(static::$statKey.'_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -181,7 +181,7 @@ class che_주민선정 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('rice', -$this->reqRice, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar(static::$statKey.'2', 1);
|
||||
$general->increaseVar(static::$statKey.'_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -153,7 +153,7 @@ class che_증여 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
|
||||
@@ -106,7 +106,7 @@ class che_집합 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -207,7 +207,7 @@ class che_징병 extends Command\GeneralCommand{
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -195,7 +195,7 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -133,7 +133,7 @@ class che_헌납 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
|
||||
@@ -98,7 +98,7 @@ class che_화계 extends Command\GeneralCommand{
|
||||
|
||||
$prob = $maxGenScore / GameConst::$sabotageProbCoefByStat;
|
||||
|
||||
$prob += $destCity['secu'] / $destCity['secu2'] / 5; //최대 20%p
|
||||
$prob += $destCity['secu'] / $destCity['secu_max'] / 5; //최대 20%p
|
||||
$prob += $destCity['supply'] ? 0.1 : 0;
|
||||
return $prob;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ class che_화계 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar($statType.'2', 1);
|
||||
$general->increaseVar($statType.'_max', 1);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
@@ -310,7 +310,7 @@ class che_화계 extends Command\GeneralCommand{
|
||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar($statType.'2', 1);
|
||||
$general->increaseVar($statType.'_max', 1);
|
||||
$general->increaseVar('firenum', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
|
||||
@@ -104,7 +104,7 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
|
||||
$general->increaseVar('experience', $exp);
|
||||
$general->increaseVar('dedication', $ded);
|
||||
$general->increaseVar('leadership2', 1);
|
||||
$general->increaseVar('leadership_max', 1);
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery($general);
|
||||
|
||||
@@ -148,8 +148,8 @@ class che_백성동원 extends Command\NationCommand{
|
||||
}
|
||||
|
||||
$db->update('city', [
|
||||
'def' => $db->sqleval('GREATEST(def2 * 0.8, def)'),
|
||||
'wall' => $db->sqleval('GREATEST(wall2 * 0.8, wall)'),
|
||||
'def' => $db->sqleval('GREATEST(def_max * 0.8, def)'),
|
||||
'wall' => $db->sqleval('GREATEST(wall_max * 0.8, wall)'),
|
||||
], 'city=%i', $destCityID);
|
||||
|
||||
$josaYiNation = JosaUtil::pick($nationName, '이');
|
||||
|
||||
@@ -17,7 +17,7 @@ class RemainCityCapacity extends Constraint{
|
||||
}
|
||||
|
||||
[$this->key, $this->keyNick] = $this->arg;
|
||||
$this->maxKey = $this->key.'2';
|
||||
$this->maxKey = $this->key.'_max';
|
||||
|
||||
if(!key_exists($this->key, $this->city)){
|
||||
if(!$throwExeception){return false; }
|
||||
|
||||
@@ -20,7 +20,7 @@ class ReqCityCapacity extends Constraint{
|
||||
|
||||
[$this->key, $this->keyNick, $this->reqVal] = $this->arg;
|
||||
|
||||
$this->maxKey = $this->key.'2';
|
||||
$this->maxKey = $this->key.'_max';
|
||||
|
||||
if(!key_exists($this->key, $this->city)){
|
||||
if(!$throwExeception){return false; }
|
||||
|
||||
@@ -38,7 +38,7 @@ class ReqDestNationValue extends Constraint{
|
||||
|
||||
$this->comp = $comp;
|
||||
|
||||
$this->maxKey = $this->key.'2';
|
||||
$this->maxKey = $this->key.'_max';
|
||||
|
||||
if(!key_exists($this->key, $this->destNation)){
|
||||
if(!$throwExeception){return false; }
|
||||
|
||||
@@ -38,7 +38,7 @@ class ReqGeneralValue extends Constraint{
|
||||
|
||||
$this->comp = $comp;
|
||||
|
||||
$this->maxKey = $this->key.'2';
|
||||
$this->maxKey = $this->key.'_max';
|
||||
|
||||
if(!key_exists($this->key, $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
|
||||
@@ -38,7 +38,7 @@ class ReqNationValue extends Constraint{
|
||||
|
||||
$this->comp = $comp;
|
||||
|
||||
$this->maxKey = $this->key.'2';
|
||||
$this->maxKey = $this->key.'_max';
|
||||
|
||||
if(!key_exists($this->key, $this->nation)){
|
||||
if(!$throwExeception){return false; }
|
||||
|
||||
@@ -92,7 +92,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
}
|
||||
|
||||
private function genSQLGeneric($key, $value){
|
||||
$keyMax = $key.'2'; //comm, comm2
|
||||
$keyMax = $key.'_max'; //comm, comm_max
|
||||
|
||||
if(is_float($value)){
|
||||
if($value < 0){
|
||||
|
||||
@@ -478,7 +478,7 @@ class General implements iAction{
|
||||
$result = false;
|
||||
|
||||
foreach($table as [$statNickName, $statName]){
|
||||
$statExpName = $statName.'2';
|
||||
$statExpName = $statName.'_max';
|
||||
|
||||
if($this->getVar($statExpName) < 0){
|
||||
$logger->pushGeneralActionLog("<R>{$statNickName}</>이 <C>1</> 떨어졌습니다!", ActionLogger::PLAIN);
|
||||
@@ -673,7 +673,7 @@ class General implements iAction{
|
||||
];
|
||||
$fullColumn = [
|
||||
'no', 'name', 'name2', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity',
|
||||
'leadership', 'leadership2', 'strength', 'strength2', 'intel', 'intel2', 'weapon', 'book', 'horse', 'item',
|
||||
'leadership', 'leadership_max', 'strength', 'strength_max', 'intel', 'intel_max', 'weapon', 'book', 'horse', 'item',
|
||||
'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
||||
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
|
||||
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
||||
|
||||
+10
-10
@@ -186,12 +186,12 @@ class GeneralAI{
|
||||
|
||||
$develRate = [
|
||||
'trust'=>$city['trust'],
|
||||
'pop'=>$city['pop']/$city['pop2'],
|
||||
'agri'=>$city['agri']/$city['agri2'],
|
||||
'comm'=>$city['comm']/$city['comm2'],
|
||||
'secu'=>$city['secu']/$city['secu2'],
|
||||
'def'=>$city['def']/$city['def2'],
|
||||
'wall'=>$city['wall']/$city['wall2'],
|
||||
'pop'=>$city['pop']/$city['pop_max'],
|
||||
'agri'=>$city['agri']/$city['agri_max'],
|
||||
'comm'=>$city['comm']/$city['comm_max'],
|
||||
'secu'=>$city['secu']/$city['secu_max'],
|
||||
'def'=>$city['def']/$city['def_max'],
|
||||
'wall'=>$city['wall']/$city['wall_max'],
|
||||
];
|
||||
|
||||
// 우선 선정
|
||||
@@ -535,7 +535,7 @@ class GeneralAI{
|
||||
$dev =
|
||||
($nationCity['agri'] + $nationCity['comm'] + $nationCity['secu'] + $nationCity['def'] + $nationCity['wall'])/
|
||||
($nationCity['agri'] + $nationCity['comm'] + $nationCity['secu'] + $nationCity['def'] + $nationCity['wall']);
|
||||
$dev += $nationCity['pop'] / $nationCity['pop2'];
|
||||
$dev += $nationCity['pop'] / $nationCity['pop_max'];
|
||||
$dev /= 50;
|
||||
|
||||
$nationCity['dev'] = $dev;
|
||||
@@ -978,7 +978,7 @@ class GeneralAI{
|
||||
if($targetCity['pop'] < 33000 + $nationGeneral->leadership){
|
||||
continue;
|
||||
}
|
||||
if (Util::randBool($targetCity['pop'] / $targetCity['pop2'])) {
|
||||
if (Util::randBool($targetCity['pop'] / $targetCity['pop_max'])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1316,7 +1316,7 @@ class GeneralAI{
|
||||
$developTurn = $this->chooseDevelopTurn($cityFull);
|
||||
|
||||
if($cityFull && Util::randBool(0.2)){
|
||||
$moveRawCities = $db->query('SELECT city,front,(pop/10+agri+comm+secu+def+wall)/(pop2/10+agri2+comm2+secu2+def2+wall2)*100 as dev, officer3 FROM city WHERE nation=%i', $nationID);
|
||||
$moveRawCities = $db->query('SELECT city,front,(pop/10+agri+comm+secu+def+wall)/(pop_max/10+agri_max+comm_max+secu_max+def_max+wall_max)*100 as dev, officer3 FROM city WHERE nation=%i', $nationID);
|
||||
|
||||
$moveCities = [];
|
||||
foreach($moveRawCities as $moveCity){
|
||||
@@ -1671,7 +1671,7 @@ class GeneralAI{
|
||||
$nationID = $this->nation['nation'];
|
||||
|
||||
$this->devRate = $db->queryFirstRow(
|
||||
'SELECT sum(pop)/sum(pop2) as pop_p,(sum(agri)+sum(comm)+sum(secu)+sum(def)+sum(wall))/(sum(agri2)+sum(comm2)+sum(secu2)+sum(def2)+sum(wall2)) as all_p from city where nation=%i',
|
||||
'SELECT sum(pop)/sum(pop_max) as pop_p,(sum(agri)+sum(comm)+sum(secu)+sum(def)+sum(wall))/(sum(agri_max)+sum(comm_max)+sum(secu_max)+sum(def_max)+sum(wall_max)) as all_p from city where nation=%i',
|
||||
$nationID
|
||||
);
|
||||
return $this->devRate;
|
||||
|
||||
@@ -122,11 +122,11 @@ class WarUnitGeneral extends WarUnit{
|
||||
function addStatExp(int $value = 1){
|
||||
$general = $this->general;
|
||||
if($this->crewType->armType == GameUnitConst::T_WIZARD) { // 귀병
|
||||
$general->increaseVar('intel2', $value);
|
||||
$general->increaseVar('intel_max', $value);
|
||||
} elseif($this->crewType->armType == GameUnitConst::T_SIEGE) { // 차병
|
||||
$general->increaseVar('leadership2', $value);
|
||||
$general->increaseVar('leadership_max', $value);
|
||||
} else {
|
||||
$general->increaseVar('strength2', $value);
|
||||
$general->increaseVar('strength_max', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -25,11 +25,11 @@ CREATE TABLE `general` (
|
||||
`city` INT(6) NOT NULL DEFAULT '3',
|
||||
`troop` INT(6) NOT NULL DEFAULT '0',
|
||||
`leadership` INT(3) NOT NULL DEFAULT '50',
|
||||
`leadership2` INT(3) NOT NULL DEFAULT '0',
|
||||
`leadership_max` INT(3) NOT NULL DEFAULT '0',
|
||||
`strength` INT(3) NOT NULL DEFAULT '50',
|
||||
`strength2` INT(3) NOT NULL DEFAULT '0',
|
||||
`strength_max` INT(3) NOT NULL DEFAULT '0',
|
||||
`intel` INT(3) NOT NULL DEFAULT '50',
|
||||
`intel2` INT(3) NOT NULL DEFAULT '0',
|
||||
`intel_max` INT(3) NOT NULL DEFAULT '0',
|
||||
`injury` INT(2) NOT NULL DEFAULT '0',
|
||||
`experience` INT(6) NOT NULL DEFAULT '0',
|
||||
`dedication` INT(6) NOT NULL DEFAULT '0',
|
||||
@@ -255,20 +255,20 @@ CREATE TABLE `city` (
|
||||
`supply` INT(1) NOT NULL DEFAULT '1',
|
||||
`front` INT(1) NOT NULL DEFAULT '0',
|
||||
`pop` INT(7) NOT NULL,
|
||||
`pop2` INT(7) NOT NULL,
|
||||
`pop_max` INT(7) NOT NULL,
|
||||
`agri` INT(5) NOT NULL,
|
||||
`agri2` INT(5) NOT NULL,
|
||||
`agri_max` INT(5) NOT NULL,
|
||||
`comm` INT(5) NOT NULL,
|
||||
`comm2` INT(5) NOT NULL,
|
||||
`comm_max` INT(5) NOT NULL,
|
||||
`secu` INT(5) NOT NULL,
|
||||
`secu2` INT(5) NOT NULL,
|
||||
`secu_max` INT(5) NOT NULL,
|
||||
`trust` FLOAT NOT NULL,
|
||||
`trade` INT(3) NULL DEFAULT NULL,
|
||||
`dead` INT(7) NOT NULL DEFAULT '0',
|
||||
`def` INT(5) NOT NULL,
|
||||
`def2` INT(5) NOT NULL,
|
||||
`def_max` INT(5) NOT NULL,
|
||||
`wall` INT(5) NOT NULL,
|
||||
`wall2` INT(5) NOT NULL,
|
||||
`wall_max` INT(5) NOT NULL,
|
||||
`officer4` INT(4) NOT NULL DEFAULT '0',
|
||||
`officer3` INT(4) NOT NULL DEFAULT '0',
|
||||
`officer2` INT(4) NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -4,44 +4,44 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>주민</b></td>
|
||||
<td height=7 colspan=3><?=$this->bar($pop/$pop2*100)?></td>
|
||||
<td height=7 colspan=3><?=$this->bar($pop/$pop_max*100)?></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>민심</b></td>
|
||||
<td height=7><?=$this->bar($trust)?></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>태수</b></td>
|
||||
<td rowspan=2 style='text-align:center;'><?=$officerName[4]?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 style='text-align:center;'><?=$pop?>/<?=$pop2?></td>
|
||||
<td colspan=3 style='text-align:center;'><?=$pop?>/<?=$pop_max?></td>
|
||||
<td style='text-align:center;'><?=round($trust, 1)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=50 rowspan=2 style='text-align:center;' class='bg1'><b>농업</b></td>
|
||||
<td width=100 height=7><?=$this->bar($agri/$agri2*100)?></td>
|
||||
<td width=100 height=7><?=$this->bar($agri/$agri_max*100)?></td>
|
||||
<td width=50 rowspan=2 style='text-align:center;' class='bg1'><b>상업</b></td>
|
||||
<td width=100 height=7><?=$this->bar($comm/$comm2*100)?></td>
|
||||
<td width=100 height=7><?=$this->bar($comm/$comm_max*100)?></td>
|
||||
<td width=50 rowspan=2 style='text-align:center;' class='bg1'><b>치안</b></td>
|
||||
<td width=100 height=7><?=$this->bar($secu/$secu2*100)?></td>
|
||||
<td width=100 height=7><?=$this->bar($secu/$secu_max*100)?></td>
|
||||
<td width=50 rowspan=2 style='text-align:center;' class='bg1'><b>군사</b></td>
|
||||
<td rowspan=2 style='text-align:center;'><?=$officerName[3]?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align:center;'><?=$agri?>/<?=$agri2?></td>
|
||||
<td style='text-align:center;'><?=$comm?>/<?=$comm2?></td>
|
||||
<td style='text-align:center;'><?=$secu?>/<?=$secu2?></td>
|
||||
<td style='text-align:center;'><?=$agri?>/<?=$agri_max?></td>
|
||||
<td style='text-align:center;'><?=$comm?>/<?=$comm_max?></td>
|
||||
<td style='text-align:center;'><?=$secu?>/<?=$secu_max?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>수비</b></td>
|
||||
<td height=7><?=$this->bar($def/$def2*100)?></td>
|
||||
<td height=7><?=$this->bar($def/$def_max*100)?></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>성벽</b></td>
|
||||
<td height=7><?=$this->bar($wall/$wall2*100)?></td>
|
||||
<td height=7><?=$this->bar($wall/$wall_max*100)?></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>시세</b></td>
|
||||
<td height=7><?=$this->bar(($trade-95)*10)?></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>종사</b></td>
|
||||
<td rowspan=2 style='text-align:center;'><?=$officerName[2]?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align:center;'><?=$def?>/<?=$def2?></td>
|
||||
<td style='text-align:center;'><?=$wall?>/<?=$wall2?></td>
|
||||
<td style='text-align:center;'><?=$def?>/<?=$def_max?></td>
|
||||
<td style='text-align:center;'><?=$wall?>/<?=$wall_max?></td>
|
||||
<td style='text-align:center;'><?=$trade?"{$trade}%":'상인없음'?></td>
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user