feat: exclude prior event seasons from all-star pool
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,11 @@ const OUTPUT_COLUMNS = [
|
|||||||
'selectionReasons',
|
'selectionReasons',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const EXCLUDED_EVENT_PHASES = [
|
||||||
|
5, 10, 15, 20, 25, 30, 35, 40, 45, 50,
|
||||||
|
55, 60, 65, 70, 75, 80, 85, 90, 95,
|
||||||
|
];
|
||||||
|
|
||||||
const LEGACY_SPECIAL_WAR_MAP = [
|
const LEGACY_SPECIAL_WAR_MAP = [
|
||||||
40 => 'che_event_귀병',
|
40 => 'che_event_귀병',
|
||||||
41 => 'che_event_신산',
|
41 => 'che_event_신산',
|
||||||
@@ -158,6 +163,7 @@ $rows = [];
|
|||||||
$seenSources = [];
|
$seenSources = [];
|
||||||
$nameIndexes = [];
|
$nameIndexes = [];
|
||||||
$phaseCounts = [];
|
$phaseCounts = [];
|
||||||
|
$chiefCounts = [];
|
||||||
$reasonCounts = [];
|
$reasonCounts = [];
|
||||||
$lineNo = 0;
|
$lineNo = 0;
|
||||||
|
|
||||||
@@ -182,6 +188,9 @@ while (($line = fgets(STDIN)) !== false) {
|
|||||||
foreach ($row[11] as $reason) {
|
foreach ($row[11] as $reason) {
|
||||||
$reasonGroup = str_starts_with($reason, 'chief:') ? 'chief' : 'hall';
|
$reasonGroup = str_starts_with($reason, 'chief:') ? 'chief' : 'hall';
|
||||||
$reasonCounts[$reasonGroup] = ($reasonCounts[$reasonGroup] ?? 0) + 1;
|
$reasonCounts[$reasonGroup] = ($reasonCounts[$reasonGroup] ?? 0) + 1;
|
||||||
|
if ($reasonGroup === 'chief') {
|
||||||
|
$chiefCounts[$row[8]] = ($chiefCounts[$row[8]] ?? 0) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
@@ -201,11 +210,18 @@ foreach ($nameIndexes as $generalName => $indexes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($phaseCounts, SORT_NUMERIC);
|
ksort($phaseCounts, SORT_NUMERIC);
|
||||||
if (array_keys($phaseCounts) !== range(1, 99)) {
|
$expectedPhases = array_values(array_diff(range(1, 99), EXCLUDED_EVENT_PHASES));
|
||||||
fail('input does not cover every phase from 1 through 99');
|
if (array_keys($phaseCounts) !== $expectedPhases) {
|
||||||
|
fail('input does not cover every non-event phase from 1 through 99');
|
||||||
|
}
|
||||||
|
foreach ($expectedPhases as $phase) {
|
||||||
|
if (($chiefCounts[$phase] ?? 0) !== 8) {
|
||||||
|
fail("phase {$phase}: expected 8 unification chiefs including the ruler");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
|
'excludedEventPhases' => EXCLUDED_EVENT_PHASES,
|
||||||
'columns' => OUTPUT_COLUMNS,
|
'columns' => OUTPUT_COLUMNS,
|
||||||
'data' => $rows,
|
'data' => $rows,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ phases AS (
|
|||||||
FROM emperior e
|
FROM emperior e
|
||||||
LEFT JOIN ng_games g ON g.server_id = e.server_id
|
LEFT JOIN ng_games g ON g.server_id = e.server_id
|
||||||
WHERE e.no BETWEEN 1 AND 99
|
WHERE e.no BETWEEN 1 AND 99
|
||||||
|
AND MOD(e.no, 5) <> 0
|
||||||
),
|
),
|
||||||
hall_eligible AS (
|
hall_eligible AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ final class CentennialAllStarPoolTest extends TestCase
|
|||||||
{
|
{
|
||||||
private const POOL_PATH = __DIR__ . '/../hwe/sammo/GeneralPool/Pool/UnderS100.json';
|
private const POOL_PATH = __DIR__ . '/../hwe/sammo/GeneralPool/Pool/UnderS100.json';
|
||||||
|
|
||||||
public function testPoolCoversEveryCompletedPhase(): void
|
public function testPoolCoversEveryCompletedNonEventPhase(): void
|
||||||
{
|
{
|
||||||
$pool = json_decode(
|
$pool = json_decode(
|
||||||
file_get_contents(self::POOL_PATH),
|
file_get_contents(self::POOL_PATH),
|
||||||
@@ -31,10 +31,18 @@ final class CentennialAllStarPoolTest extends TestCase
|
|||||||
],
|
],
|
||||||
$pool['columns']
|
$pool['columns']
|
||||||
);
|
);
|
||||||
self::assertCount(5757, $pool['data']);
|
self::assertCount(4682, $pool['data']);
|
||||||
|
self::assertSame(
|
||||||
|
[
|
||||||
|
5, 10, 15, 20, 25, 30, 35, 40, 45, 50,
|
||||||
|
55, 60, 65, 70, 75, 80, 85, 90, 95,
|
||||||
|
],
|
||||||
|
$pool['excludedEventPhases']
|
||||||
|
);
|
||||||
|
|
||||||
$column = array_flip($pool['columns']);
|
$column = array_flip($pool['columns']);
|
||||||
$phases = [];
|
$phases = [];
|
||||||
|
$chiefCounts = [];
|
||||||
$sourceKeys = [];
|
$sourceKeys = [];
|
||||||
$generalNames = [];
|
$generalNames = [];
|
||||||
foreach ($pool['data'] as $row) {
|
foreach ($pool['data'] as $row) {
|
||||||
@@ -57,11 +65,25 @@ final class CentennialAllStarPoolTest extends TestCase
|
|||||||
'/^(hall:[a-z0-9_]+|chief:(?:5|6|7|8|9|10|11|12))$/',
|
'/^(hall:[a-z0-9_]+|chief:(?:5|6|7|8|9|10|11|12))$/',
|
||||||
$reason
|
$reason
|
||||||
);
|
);
|
||||||
|
if (str_starts_with($reason, 'chief:')) {
|
||||||
|
$chiefCounts[$phase] = ($chiefCounts[$phase] ?? 0) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($phases, SORT_NUMERIC);
|
ksort($phases, SORT_NUMERIC);
|
||||||
self::assertSame(range(1, 99), array_keys($phases));
|
$expectedPhases = array_values(array_diff(
|
||||||
|
range(1, 99),
|
||||||
|
$pool['excludedEventPhases']
|
||||||
|
));
|
||||||
|
self::assertSame($expectedPhases, array_keys($phases));
|
||||||
|
foreach ($expectedPhases as $phase) {
|
||||||
|
self::assertSame(
|
||||||
|
8,
|
||||||
|
$chiefCounts[$phase] ?? 0,
|
||||||
|
"phase {$phase} must include the ruler and seven chiefs"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEveryHistoricalEventSpecialHasAnImplementation(): void
|
public function testEveryHistoricalEventSpecialHasAnImplementation(): void
|
||||||
|
|||||||
Reference in New Issue
Block a user