test: trace monthly speciality and betrayal actions

This commit is contained in:
Hide_D committed 2026-07-25 20:55:40 +00:00
1 parent 820c25d8dc
commit e7d86a16d5
3 files changed
+127 -2

No files matched your search

+25 -2
View File
@@ -44,7 +44,8 @@ function comparisonMonthlyPatch(string $table, int $id, array $values): void
'gold', 'rice', 'horse', 'weapon', 'book', 'item', 'aux',
'leadership', 'strength', 'intel', 'experience', 'dedication',
'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'personal', 'special',
'special2', 'bornyear', 'deadyear', 'turntime',
'specage', 'special2', 'specage2', 'betray', 'age',
'bornyear', 'deadyear', 'turntime',
],
],
];
@@ -98,7 +99,23 @@ function comparisonMonthlyDetails(array $observe, int $worldHistoryAfterId): arr
'atmos' => 'atmos',
'gold' => 'gold',
'rice' => 'rice',
'leadership' => 'leadership',
'strength' => 'strength',
'intelligence' => 'intel',
'age' => 'age',
'specialDomestic' => 'special',
'specAge' => 'specage',
'specialWar' => 'special2',
'specAge2' => 'specage2',
'betray' => 'betray',
'dex1' => 'dex1',
'dex2' => 'dex2',
'dex3' => 'dex3',
'dex4' => 'dex4',
'dex5' => 'dex5',
'aux' => 'aux',
],
['aux'],
),
comparisonRowsById('general', 'no', comparisonIntegerList($observe['generalIds'] ?? [], 'generalIds')),
);
@@ -212,6 +229,8 @@ function comparisonMonthlyEventTraceMain(): void
'FinishNationBetting',
'BlockScoutAction',
'UnblockScoutAction',
'AssignGeneralSpeciality',
'AddGlobalBetray',
];
if (!in_array($actionName, $supportedActions, true)) {
throw new \InvalidArgumentException('unsupported monthly action');
@@ -423,7 +442,7 @@ function comparisonMonthlyEventTraceMain(): void
throw new \InvalidArgumentException('ProcessSemiAnnual requires resource');
}
$action = new $actionClass($resource);
} elseif (in_array($actionName, ['CreateManyNPC', 'RegNPC', 'RegNeutralNPC', 'RaiseInvader', 'AutoDeleteInvader', 'ChangeCity', 'OpenNationBetting', 'FinishNationBetting', 'BlockScoutAction', 'UnblockScoutAction'], true)) {
} elseif (in_array($actionName, ['CreateManyNPC', 'RegNPC', 'RegNeutralNPC', 'RaiseInvader', 'AutoDeleteInvader', 'ChangeCity', 'OpenNationBetting', 'FinishNationBetting', 'BlockScoutAction', 'UnblockScoutAction', 'AddGlobalBetray'], true)) {
$args = $request['args'] ?? [];
if (!is_array($args)) {
throw new \InvalidArgumentException("{$actionName} args must be an array");
@@ -446,6 +465,9 @@ function comparisonMonthlyEventTraceMain(): void
if (in_array($actionName, ['BlockScoutAction', 'UnblockScoutAction'], true) && count($args) > 1) {
throw new \InvalidArgumentException("{$actionName} args must have at most one entry");
}
if ($actionName === 'AddGlobalBetray' && count($args) > 2) {
throw new \InvalidArgumentException('AddGlobalBetray args must have at most two entries');
}
$action = new $actionClass(...$args);
} else {
$action = new $actionClass();
@@ -733,6 +755,7 @@ function comparisonMonthlyEventTraceMain(): void
'createdEvents' => $response['createdEvents'] ?? [],
'createdDiplomacy' => $response['createdDiplomacy'] ?? [],
'gameEnvironment' => $response['gameEnvironment'] ?? [],
'logs' => $after['logs'],
'observedGeneralTurns' => $observedGeneralTurns,
'remainingEventIds' => array_map(
'intval',