fix: drive native progression from each current camera view

This commit is contained in:
NINI
2026-10-10 10:08:47 +09:00
parent e7ae849f3d
commit 8728660288
3 changed files with 155 additions and 10 deletions
+20 -10
View File
@@ -30,7 +30,7 @@ function RevealBall([int]$Stage,[string]$Id,[string]$Name) {
for($view=0;$view-lt12;$view++){
$board=Board (Save "$Name-view-$view") $Stage
if(BallClear $board $Id){return $board}
Orbit "$Name-orbit-$view" $board
Orbit "$Name-orbit-$view" $board -Pitch:($view%4-eq3)
}
throw "No safe first-hit view for actual ball $Id within a full native orbit."
}
@@ -46,17 +46,24 @@ function MergeReal([int]$Stage,[string]$Name,[int]$SourceCount=0,[int]$TargetCou
[pscustomobject]@{sid=$sid;tid=$tid;depth=[Math]::Abs($delta.Z);size=$source.ballIds.Count}
}}}}) | Sort-Object depth,size
$pair=$null
foreach($candidate in $pairs){if($candidate.depth-lt.9-and(BallClear $board $candidate.sid)){$pair=$candidate;break}}
$offset=if($attempt%2-eq0){-35}else{35}
foreach($candidate in $pairs){
if($candidate.depth-ge.9-or!(BallClear $board $candidate.sid)){continue}
$targetPoint=BallPoint $board $candidate.tid
if(WorldSafe @(($targetPoint[0]+$offset),$targetPoint[1])){$pair=$candidate;break}
}
if($pair) {
$start=BallPoint $board $pair.sid; $end=BallPoint $board $pair.tid
$end=BallPoint $board $pair.tid
# Try a short lateral contact offset, then orbit to expose another depth plane if blocked.
$offset=if($attempt%2-eq0){-35}else{35}
Step "$Name-drag-$attempt" @('shell','input','swipe',"$($start[0])","$($start[1])","$($end[0]+$offset)","$($end[1])",'500')
$after=Save "$Name-after-$attempt"; $newBoard=Board $after $Stage
if($null-eq$newBoard-or$newBoard.groups.Count-lt$oldCount){return $after}
$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){
$actual=if($newBoard){$newBoard}else{$after.latestFreePlay}
AssertNativeMerge "$Name-actual-$attempt" $board $actual $pair.sid $TargetCount
return $after
}
$board=$newBoard
}
Orbit "$Name-orbit-$attempt" $board
Orbit "$Name-orbit-$attempt" $board -Pitch:($attempt%4-eq3)
}
throw "Native merge bound reached for Stage $Stage; all actual attempts retained."
}
@@ -77,10 +84,13 @@ function SplitReal([int]$Stage,[int]$Selected,[string]$Name,[string]$OnlyId='')
foreach($id in $ids){$board=RevealBall $Stage $id "$Name-select-reveal-$attempt-$id";TapBall "$Name-select-$attempt-$id" $board $id}
$board=RevealBall $Stage $ids[-1] "$Name-drag-reveal-$attempt"
$point=BallPoint $board $ids[-1]
Step "$Name-drag-$attempt" @('shell','input','swipe',"$($point[0])","$($point[1])","$($point[0])","$($point[1]-160)",'500')
$after=Save "$Name-after-$attempt"; $actual=Board $after $Stage
$end=@($point[0],($point[1]-160))
if(!(WorldSafe $end)){$end=@($point[0],($point[1]+160))}
$after=NativeMoveAndHold "$Name-drag-$attempt" $board $ids[-1] $end;$actual=Board $after $Stage
if($null-eq$actual){$actual=$after.latestFreePlay}
if($actual.groups.Count-gt$board.groups.Count){
Check "$Name-split-original-ids-$attempt" (Same @($board.balls.id|Sort-Object) @($actual.balls.id|Sort-Object)) 'Actual split retains all original identities exactly'
Check "$Name-split-manual-camera-$attempt" (Same $board.camera $actual.camera) 'Split assistance preserves the exact saved manual pose'
if(@($actual.groups|Where-Object{(($_.ballIds|Sort-Object)-join',')-eq(($ids|Sort-Object)-join',')}).Count-ne1){
$commands.Add(@{command='Actual split selected IDs differ: preserve requested and actual memberships';expected=$ids;actualGroups=$actual.groups;utc=[DateTime]::UtcNow.ToString('o')})
if($null-eq(Board $after $Stage)){