test(compare): trace deterministic monthly seed progression

This commit is contained in:
2026-08-03 18:57:01 +00:00
parent 3b2fd1082f
commit f16a6b6880
23 changed files with 1274 additions and 213 deletions
+28
View File
@@ -371,6 +371,34 @@ class WarUnitGeneral extends WarUnit
function applyDB(\MeekroDB $db): bool
{
$traceGeneralIds = getenv('REF_AI_TRACE_GENERAL_IDS');
if (
PHP_SAPI === 'cli'
&& getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
&& is_string($traceGeneralIds)
&& in_array((string) $this->getGeneral()->getID(), explode(',', $traceGeneralIds), true)
) {
$general = $this->getGeneral();
fwrite(STDOUT, 'AI_GENERAL_PRE_APPLY_TRACE ' . Json::encode([
'engine' => 'ref-war',
'generalId' => $general->getID(),
'stats' => [
'leadership' => $general->getVar('leadership'),
'strength' => $general->getVar('strength'),
'intelligence' => $general->getVar('intel'),
],
'meta' => [
'leadership_exp' => $general->getVar('leadership_exp'),
'strength_exp' => $general->getVar('strength_exp'),
'intel_exp' => $general->getVar('intel_exp'),
'dex1' => $general->getVar('dex1'),
'dex2' => $general->getVar('dex2'),
'dex3' => $general->getVar('dex3'),
'dex4' => $general->getVar('dex4'),
'dex5' => $general->getVar('dex5'),
],
]) . "\n");
}
$affected = $this->getGeneral()->applyDB($db);
$this->getLogger()->flush();
return $affected;