test(compare): trace deterministic monthly seed progression
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
DB, Util, JosaUtil, Json,
|
||||
General,
|
||||
ActionLogger,
|
||||
LastTurn,
|
||||
@@ -118,12 +118,35 @@ class che_기술연구 extends che_상업투자{
|
||||
$score /= 4;
|
||||
}
|
||||
|
||||
$genCount = Util::valueFit(
|
||||
$db->queryFirstField('SELECT gennum FROM nation WHERE nation=%i', $general->getVar('nation')),
|
||||
GameConst::$initialNationGenLimit
|
||||
);
|
||||
|
||||
$nationUpdated = [
|
||||
$genCount = Util::valueFit(
|
||||
$db->queryFirstField('SELECT gennum FROM nation WHERE nation=%i', $general->getVar('nation')),
|
||||
GameConst::$initialNationGenLimit
|
||||
);
|
||||
|
||||
$traceGeneralIds = getenv('REF_AI_TRACE_GENERAL_IDS');
|
||||
$traceNationIds = getenv('REF_AI_TRACE_NATION_IDS');
|
||||
if (
|
||||
PHP_SAPI === 'cli'
|
||||
&& getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
|
||||
&& (
|
||||
(is_string($traceGeneralIds)
|
||||
&& in_array((string) $general->getID(), explode(',', $traceGeneralIds), true))
|
||||
|| (is_string($traceNationIds)
|
||||
&& in_array((string) $general->getVar('nation'), explode(',', $traceNationIds), true))
|
||||
)
|
||||
) {
|
||||
fwrite(STDOUT, 'AI_ACTION_PATCH_TRACE ' . Json::encode([
|
||||
'engine' => 'ref-tech',
|
||||
'generalId' => $general->getID(),
|
||||
'nationId' => $general->getVar('nation'),
|
||||
'currentTech' => $this->nation['tech'],
|
||||
'techScore' => $score,
|
||||
'generalCount' => $genCount,
|
||||
'delta' => $score / $genCount,
|
||||
]) . "\n");
|
||||
}
|
||||
|
||||
$nationUpdated = [
|
||||
'tech' => $this->nation['tech'] + $score/$genCount
|
||||
];
|
||||
$db->update('nation', $nationUpdated, 'nation=%i', $general->getVar('nation'));
|
||||
@@ -143,4 +166,4 @@ class che_기술연구 extends che_상업투자{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user