Retry a real upward route after an unchanged native merge drop

This commit is contained in:
NINI
2026-10-10 14:16:35 +09:00
parent 8bd6c426a8
commit 3bfcac8a58
2 changed files with 77 additions and 3 deletions
@@ -121,6 +121,8 @@ function MergeReal([int]$Stage,[string]$Name,[int]$SourceCount=0,[int]$TargetCou
$oldCount=$board.groups.Count
if($pair) {
$end=BallPoint $board $pair.tid
$dragBefore=Save "$Name-drag-$attempt-before"
Check "$Name-current-pair-projection-$attempt" (Same $board (Board $dragBefore $Stage)) 'Actual pair IDs and UI-safe endpoints use the current saved board'
# Try a short lateral contact offset, then orbit to expose another depth plane if blocked.
$after=NativeMoveAndHold "$Name-drag-$attempt" $board $pair.sid @(($end[0]+$offset),$end[1]);$newBoard=Board $after $Stage
if($null-eq$newBoard-or$newBoard.groups.Count-lt$oldCount){
@@ -128,6 +130,33 @@ function MergeReal([int]$Stage,[string]$Name,[int]$SourceCount=0,[int]$TargetCou
AssertNativeMerge "$Name-actual-$attempt" $board $actual $pair.sid $TargetCount
return $after
}
if(Same $board $newBoard){
Check "$Name-blocked-drop-whole-save-$attempt" (Same $dragBefore $after) 'An unchanged drop preserves every independent record before a real upward retry'
$routed=LiftMergeRoute $Stage "$Name-blocked-route-$attempt" $newBoard $SourceCount $TargetCount
if($routed){
$revealed=$newBoard|ConvertTo-Json -Depth 20|ConvertFrom-Json;$revealed.camera=$routed.Before.camera
Check "$Name-blocked-route-reveal-board-$attempt" (Same $revealed $routed.Before) 'Revealing the intended ID changes only its manual view'
$routedBoard=Board $routed.State $Stage
$expected=$after|ConvertTo-Json -Depth 20|ConvertFrom-Json
if($routedBoard){$expected.puzzleStates=@($expected.puzzleStates|ForEach-Object{if($_.stageId-eq$Stage){$routedBoard}else{$_}})}
else{
Check "$Name-blocked-route-completed-stage-$attempt" ($routed.State.completedStageIds-contains$Stage-and$routed.State.latestFreePlay.sourceStageId-eq$Stage) 'A missing puzzle requires actual completion and its own free-play board'
$expected.puzzleStates=@($expected.puzzleStates|Where-Object stageId -ne $Stage)
$expected.completedStageIds=@($expected.completedStageIds+@($Stage)|Sort-Object -Unique)
$expected.latestFreePlay=$routed.State.latestFreePlay
}
Check "$Name-blocked-route-independent-records-$attempt" (Same $expected $routed.State) 'Only the actual current board and its own strict completion may change'
if($routedBoard){Check "$Name-blocked-route-not-counted-$attempt" (Same $routed.Before.countedBallIds $routedBoard.countedBallIds) 'An upward retry never counts a friend'}
if($routed.Outcome-eq'MissedGrabOrbit'){
Check "$Name-blocked-route-first-hit-miss-$attempt" (IsNativeOrbitMiss $routed.BeforeState $routed.State $Stage) 'A background orbit is never a grabbed route or merge'
}elseif(!$routedBoard-or$routedBoard.groups.Count-lt$routed.Before.groups.Count){
$actual=if($routedBoard){$routedBoard}else{$routed.State.latestFreePlay}
AssertNativeMerge "$Name-blocked-route-actual-$attempt" $routed.Before $actual $routed.SourceId $TargetCount
return $routed.State
}
$newBoard=$routedBoard
}
}
$board=$newBoard
}
$fineYaw=0