test: trace scenario 2400 monthly parity

This commit is contained in:
2026-08-04 18:18:48 +00:00
parent 5432590591
commit 5d897105ed
3 changed files with 90 additions and 21 deletions
+5 -2
View File
@@ -55,7 +55,9 @@ foreach ($db->query('SELECT * FROM general ORDER BY no') as $row) {
$general = monthlySnapshotPick($row, [
'id' => 'no', 'name' => 'name', 'nationId' => 'nation', 'cityId' => 'city',
'troopId' => 'troop', 'leadership' => 'leadership', 'strength' => 'strength',
'intelligence' => 'intel', 'experience' => 'experience', 'dedication' => 'dedication',
'intelligence' => 'intel', 'experience' => 'experience', 'experienceLevel' => 'explevel',
'dedication' => 'dedication', 'dedicationLevel' => 'dedlevel',
'leadershipExp' => 'leadership_exp', 'strengthExp' => 'strength_exp', 'intelligenceExp' => 'intel_exp',
'officerLevel' => 'officer_level', 'injury' => 'injury', 'gold' => 'gold',
'rice' => 'rice', 'crew' => 'crew', 'crewTypeId' => 'crewtype', 'train' => 'train',
'atmos' => 'atmos', 'age' => 'age', 'npcState' => 'npc', 'turnTime' => 'turntime',
@@ -67,7 +69,8 @@ foreach ($db->query('SELECT * FROM general ORDER BY no') as $row) {
'killTurn' => 'killturn',
], ['last_turn', 'aux']);
foreach (['id', 'nationId', 'cityId', 'troopId', 'leadership', 'strength', 'intelligence',
'experience', 'dedication', 'officerLevel', 'injury', 'gold', 'rice', 'crew',
'experience', 'experienceLevel', 'dedication', 'dedicationLevel', 'leadershipExp',
'strengthExp', 'intelligenceExp', 'officerLevel', 'injury', 'gold', 'rice', 'crew',
'crewTypeId', 'train', 'atmos', 'age', 'npcState', 'dex1', 'dex2', 'dex3',
'dex4', 'dex5', 'killTurn', 'affinity', 'birthYear', 'deathYear', 'specAge', 'specAge2'] as $key) {
$general[$key] = (int)$general[$key];
+43 -10
View File
@@ -30,7 +30,8 @@ class che_상업투자 extends Command\GeneralCommand{
static protected $actionName = '상업 투자';
static protected $debuffFront = 0.5;
protected $reqGold;
protected $reqGold;
protected $baseTrace = [];
protected function argTest():bool{
$this->arg = null;
@@ -118,10 +119,21 @@ class che_상업투자 extends Command\GeneralCommand{
throw new \sammo\MustNotBeReachedException();
}
$score *= $trust / 100;
$score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= $rng->nextRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$adjustedStat = $score;
$score *= $trust / 100;
$expLevel = $general->getVar('explevel');
$expBonus = getDomesticExpLevelBonus($expLevel);
$score *= $expBonus;
$randomMultiplier = $rng->nextRange(0.8, 1.2);
$score *= $randomMultiplier;
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$this->baseTrace = [
'adjustedStat' => $adjustedStat,
'expLevel' => $expLevel,
'expBonus' => $expBonus,
'randomMultiplier' => $randomMultiplier,
'domesticScore' => $score,
];
return $score;
}
@@ -137,7 +149,8 @@ class che_상업투자 extends Command\GeneralCommand{
$trust = Util::valueFit($this->city['trust'], 50);
$score = Util::valueFit($this->calcBaseScore($rng), 1);
$calculatedBaseScore = $this->calcBaseScore($rng);
$score = Util::valueFit($calculatedBaseScore, 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
if($trust < 80){
@@ -160,11 +173,31 @@ class che_상업투자 extends Command\GeneralCommand{
$date = $general->getTurnTime($general::TURNTIME_HM);
$score *= CriticalScoreEx($rng, $pick);
$score = Util::round($score);
$criticalMultiplier = CriticalScoreEx($rng, $pick);
$score *= $criticalMultiplier;
$score = Util::round($score);
$exp = $score * 0.7;
$ded = $score * 1.0;
$ded = $score * 1.0;
if (in_array((string)$general->getID(), array_filter(explode(',', (string)getenv('REF_AI_TRACE_GENERAL_IDS')), 'strlen'), true)) {
fwrite(STDOUT, 'DOMESTIC_CALC_TRACE ' . json_encode([
'engine' => 'ref',
'generalId' => $general->getID(),
'action' => static::class,
'trust' => $trust,
'calculatedBaseScore' => $calculatedBaseScore,
'baseTrace' => $this->baseTrace,
'successRatio' => $successRatio,
'failRatio' => $failRatio,
'normalRatio' => $normalRatio,
'pick' => $pick,
'criticalMultiplier' => $criticalMultiplier,
'rewardScore' => $score,
'exp' => $exp,
'dedication' => $ded,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n");
}
if($pick == 'success'){
updateMaxDomesticCritical($general, $score);
@@ -225,4 +258,4 @@ class che_상업투자 extends Command\GeneralCommand{
return true;
}
}
}
+42 -9
View File
@@ -29,7 +29,8 @@ class che_주민선정 extends Command\GeneralCommand{
static protected $actionKey = '민심';
static protected $actionName = '주민 선정';
protected $reqRice;
protected $reqRice;
protected $baseTrace = [];
protected function argTest():bool{
$this->arg = null;
@@ -109,10 +110,21 @@ class che_주민선정 extends Command\GeneralCommand{
throw new \sammo\MustNotBeReachedException();
}
$score *= getDomesticExpLevelBonus($general->getVar('explevel'));
$score *= $rng->nextRange(0.8, 1.2);
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$score = Util::valueFit($score, 1);
$adjustedStat = $score;
$expLevel = $general->getVar('explevel');
$expBonus = getDomesticExpLevelBonus($expLevel);
$score *= $expBonus;
$randomMultiplier = $rng->nextRange(0.8, 1.2);
$score *= $randomMultiplier;
$score = $general->onCalcDomestic(static::$actionKey, 'score', $score);
$score = Util::valueFit($score, 1);
$this->baseTrace = [
'adjustedStat' => $adjustedStat,
'expLevel' => $expLevel,
'expBonus' => $expBonus,
'randomMultiplier' => $randomMultiplier,
'domesticScore' => $score,
];
return $score;
}
@@ -126,7 +138,8 @@ class che_주민선정 extends Command\GeneralCommand{
$general = $this->generalObj;
$score = Util::valueFit($this->calcBaseScore($rng), 1);
$calculatedBaseScore = $this->calcBaseScore($rng);
$score = Util::valueFit($calculatedBaseScore, 1);
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
$successRatio = $general->onCalcDomestic(static::$actionKey, 'success', $successRatio);
@@ -146,10 +159,30 @@ class che_주민선정 extends Command\GeneralCommand{
$date = $general->getTurnTime($general::TURNTIME_HM);
$score *= CriticalScoreEx($rng, $pick);
$criticalMultiplier = CriticalScoreEx($rng, $pick);
$score *= $criticalMultiplier;
$exp = $score * 0.7;
$ded = $score * 1.0;
$ded = $score * 1.0;
if (in_array((string)$general->getID(), array_filter(explode(',', (string)getenv('REF_AI_TRACE_GENERAL_IDS')), 'strlen'), true)) {
fwrite(STDOUT, 'DOMESTIC_CALC_TRACE ' . json_encode([
'engine' => 'ref',
'generalId' => $general->getID(),
'action' => static::class,
'calculatedBaseScore' => $calculatedBaseScore,
'baseTrace' => $this->baseTrace,
'successRatio' => $successRatio,
'failRatio' => $failRatio,
'normalRatio' => $normalRatio,
'pick' => $pick,
'criticalMultiplier' => $criticalMultiplier,
'rewardScore' => $score,
'appliedScore' => $score / 10,
'exp' => $exp,
'dedication' => $ded,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n");
}
if($pick == 'success'){
updateMaxDomesticCritical($general, $score);
@@ -197,4 +230,4 @@ class che_주민선정 extends Command\GeneralCommand{
}
}
}