feat: consolidate unspool gameplay, 30 release levels, and 5 validation samples (026A/B, 038A, 039, 051)

This commit is contained in:
fannyxl committed 2026-11-26 09:45:05 +08:00
1 parent 96c19dca82
commit f02f9b085e
18 files changed
+2922 -39

No files matched your search

+37
View File
@@ -11,6 +11,8 @@ import {
GateEvent,
HintState,
LevelDef,
OldClothClipDef,
OldStrandDef,
PickEvent,
Point2D,
PondDef,
@@ -20,6 +22,7 @@ import {
SpoolDef,
SpoolEvent,
TargetColor,
UnspoolConfig,
YarnColor,
} from './Types';
@@ -183,6 +186,40 @@ export function isPondBridged(pond: PondDef, lines: RouteState[]): boolean {
return false;
}
export function isClipUnlocked(
clip: OldClothClipDef,
lines: RouteState[],
drawing?: RouteState | null,
): boolean {
for (const line of lines) {
if (line.deliveries.some(d => d.target.id === clip.unlockSectionId)) return true;
}
if (drawing && drawing.deliveries.some(d => d.target.id === clip.unlockSectionId)) return true;
return false;
}
export function isStrandClipLocked(
config: UnspoolConfig,
strand: OldStrandDef,
lines: RouteState[],
): OldClothClipDef | null {
if (!strand.clipId || !config.clips?.length) return null;
const clip = config.clips.find(c => c.id === strand.clipId);
if (!clip) return null;
return isClipUnlocked(clip, lines) ? null : clip;
}
export function isStrandExposed(
config: UnspoolConfig,
strand: OldStrandDef,
removedIds: Set<string>,
lines: RouteState[],
): boolean {
if (removedIds.has(strand.id)) return false;
if (isStrandClipLocked(config, strand, lines)) return false;
return strand.coveredBy.every(cid => removedIds.has(cid));
}
export function isTargetLocked(
level: LevelDef,
targetId: string,