부대장은 기술연구, 전투시 기술 상승에 영향을 주지 않도록 변경

This commit is contained in:
2018-11-28 00:16:34 +09:00
parent 9e8111994a
commit 9594e6eb32
2 changed files with 44 additions and 11 deletions
+18 -9
View File
@@ -369,17 +369,26 @@ function process_3(&$general) {
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 부드러운 기술 제한
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score = intdiv($score, 4); }
//장수수 구함
$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 < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i', $general['nation']);
$gencnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $general['nation']);
if ($gencnt_eff < GameConst::$initialNationGenLimit) {
$gencount = GameConst::$initialNationGenLimit;
$gencnt_eff = GameConst::$initialNationGenLimit;
}
if($gencount != $gencnt_eff){
$score *= $gencount / $gencnt_eff;
}
// 부드러운 기술 제한
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score /= 4; }
// 내정 상승
$query = "update nation set totaltech=totaltech+'$score',tech=totaltech/'$gencount' where nation='{$general['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$db->update('nation', [
'totaltech'=>$db->sqleval('totaltech + %i', Util::round($score)),
'tech'=>$db->sqleval('totaltech / %i', $gencount)
], 'nation=%i', $general['nation']);
// 자금 하락, 경험치 상승 // 공헌도, 명성 상승 = $score * 10
$general['gold'] -= $admin['develcost'];
+26 -2
View File
@@ -111,6 +111,30 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
$attackerIncTech = $attacker->getDead() * 0.01 * getNationTechMultiplier($rawAttackerNation['type']);
$defenderIncTech = $attacker->getKilled() * 0.01 * getNationTechMultiplier($rawDefenderNation['type']);
$attackerGenCnt = $rawAttackerNation['gennum'];
$defenderGenCnt = $rawDefenderNation['gennum'];
$attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']);
$defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']);
if($attackerGenCnt_eff < GameConst::$initialNationGenLimit){
$attackerGenCnt = GameConst::$initialNationGenLimit;
$attackerGenCnt_eff = GameConst::$initialNationGenLimit;
}
if($defenderGenCnt_eff < GameConst::$initialNationGenLimit){
$defenderGenCnt = GameConst::$initialNationGenLimit;
$defenderGenCnt_eff = GameConst::$initialNationGenLimit;
}
if($attackerGenCnt != $attackerGenCnt_eff){
$attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff;
}
if($defenderGenCnt != $defenderGenCnt_eff){
$defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff;
}
if(TechLimit($startYear, $year, $rawAttackerNation['tech'])){
$attackerIncTech /= 4;
}
@@ -124,8 +148,8 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
$updateAttackerNation['totaltech'] = Util::round($attackerTotalTech);
$updateDefenderNation['totaltech'] = Util::round($defenderTotalTech);
$updateAttackerNation['tech'] = Util::round($attackerTotalTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum']));
$updateDefenderNation['tech'] = Util::round($defenderTotalTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum']));
$updateAttackerNation['tech'] = Util::round($attackerTotalTech / $attackerGenCnt);
$updateDefenderNation['tech'] = Util::round($defenderTotalTech / $defenderGenCnt);
$db->update('nation', $updateAttackerNation, 'nation=%i', $attackerNationID);
$db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);