test(compare): enforce invader resume watchdog
This commit is contained in:
@@ -886,6 +886,15 @@ function comparisonUnificationInvaderResumeTrace(array $request, array $environm
|
||||
'autoresetAnchor' => $gameStorage->autoreset_united_wall_anchor,
|
||||
'autoresetAnchorRefreshed' => $gameStorage->autoreset_united_wall_anchor !== $pausedAnchor,
|
||||
];
|
||||
if (
|
||||
$decisionResult !== RaiseInvaderMessage::ACCEPTED
|
||||
|| $afterSummon['isunited'] !== 1
|
||||
|| $afterSummon['plock'] !== 0
|
||||
|| $afterSummon['invaderNationCount'] !== 7
|
||||
|| $afterSummon['autoresetAnchorRefreshed'] !== true
|
||||
) {
|
||||
throw new \RuntimeException('invader choice did not start an unlocked, watchdog-active event game');
|
||||
}
|
||||
|
||||
$resumeBoundary = addTurn(
|
||||
cutTurn(Util::toInt($gameStorage->turntime), Util::toInt($gameStorage->turnterm)),
|
||||
@@ -938,6 +947,19 @@ function comparisonUnificationInvaderResumeTrace(array $request, array $environm
|
||||
'autoresetAnchor' => $gameStorage->autoreset_united_wall_anchor,
|
||||
'autoresetAnchorRefreshed' => $gameStorage->autoreset_united_wall_anchor !== $stalledAnchor,
|
||||
];
|
||||
$expectedYear = $month === 12 ? $year + 1 : $year;
|
||||
$expectedMonth = $month === 12 ? 1 : $month + 1;
|
||||
if (
|
||||
$afterResume['turntime'] < $resumeBoundary
|
||||
|| $afterResume['year'] !== $expectedYear
|
||||
|| $afterResume['month'] !== $expectedMonth
|
||||
|| $afterResume['isunited'] !== 1
|
||||
|| $afterResume['lockedCalls'] !== 0
|
||||
|| $afterResume['plock'] !== 0
|
||||
|| $afterResume['autoresetAnchorRefreshed'] !== true
|
||||
) {
|
||||
throw new \RuntimeException('invader event game did not advance through the next monthly boundary');
|
||||
}
|
||||
|
||||
return [
|
||||
'schemaVersion' => 1,
|
||||
|
||||
Reference in New Issue
Block a user