Files
HexTrails/src/campaign-versions.js
T
cabinwandClaude Opus 5 b35ea201db fix(campaign): register c50 with the fields the app actually reads
Opening the c50 edition threw `campaign.legacyStorageKeys is not iterable`
and left the board blank — the header still drew, so the level set looked
loaded. Every other edition carries the array; the hand-written c50 entry
did not, and 197 passing tests had nothing to say about it, because nothing
tested the registration itself.

The test now walks every edition and asserts the shape app.js relies on,
including that the chapter list can actually hold the levels. It fails on the
entry as it shipped.

The task board was reading levels/prototypes/d5.json while the campaign sat in
levels/campaign-50.json, so it showed "候选关卡 18 / 50" with fifty levels
built. It reads the shipping set when there is one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:03:37 +08:00

46 lines
2.5 KiB
JavaScript

import { CAMPAIGN, LEVELS } from './levels.js';
import { ARCHIVED_LEVELS } from './levels-archive.js';
import { EXPERIENCE_CAMPAIGN, EXPERIENCE_LEVELS } from './levels-v04.js';
import { PRODUCTION_CAMPAIGN, PRODUCTION_LEVELS } from './levels-v05.js';
import { TUTORIAL_LEVELS } from './tutorial-levels.js';
import { C50_CAMPAIGN, C50_LEVELS } from './levels-c50.js';
// Public layout versions are distinct from the level JSON schema's `version: 1`.
// Historical layouts stay intact; all editions share the current game rules.
export const CAMPAIGN_VERSIONS = [
{
id:'v0.1', name:'最初设计', description:'最初的 24 关,保留原始布局与顺序。',
chapters:['转盘初体验','糖果回旋','碰撞大挑战'], chapterSize:8,
levels:ARCHIVED_LEVELS['v0.1'], legacyStorageKeys:['hex-trails-v2'],
},
{
id:'v0.2', name:'直线较多版', description:'扩展为 48 关,直线路径较多,按舒展与挑战交替推进。',
chapters:['看见出口','转出新路','连成节奏','轻巧解结','展开天地','从容变换','长路常新','自在回响'], chapterSize:6,
levels:ARCHIVED_LEVELS['v0.2'], legacyStorageKeys:['hex-trails-observe-v3-r1','hex-trails-observe-v3'],
},
{
id:'v0.3', name:'弯轨观察版', description:'48 关弯轨观察版本,以单弯与连续消除为主。',
chapters:CAMPAIGN.chapters, chapterSize:CAMPAIGN.chapterSize,
levels:LEVELS, legacyStorageKeys:[`hex-trails-${CAMPAIGN.id}-r${CAMPAIGN.revision||1}`],
},
{
id:'v0.4', name:'长路与惊喜', description:'20 关全新体验:看棋子沿长路巡游,转一下放出朝内棋子,再逐层解开整盘。',
chapters:EXPERIENCE_CAMPAIGN.chapters, chapterSize:EXPERIENCE_CAMPAIGN.chapterSize,
levels:EXPERIENCE_LEVELS, legacyStorageKeys:[],
},
{
id:'v0.5', name:'千段轨迹', description:'1000 关新旅程:沿长路巡游、清挡放行,转出花瓣与交织的出口。难度为结构预估,持续通过试玩打磨。',
chapters:PRODUCTION_CAMPAIGN.chapters, chapterSize:PRODUCTION_CAMPAIGN.chapterSize,
levels:PRODUCTION_LEVELS, tutorials:TUTORIAL_LEVELS, legacyStorageKeys:[],
},
{
id:C50_CAMPAIGN.id, name:C50_CAMPAIGN.name, description:C50_CAMPAIGN.description,
chapters:C50_CAMPAIGN.chapters, chapterSize:C50_CAMPAIGN.chapterSize, levels:C50_LEVELS,
legacyStorageKeys:[],
},
];
export const DEFAULT_CAMPAIGN_VERSION = 'v0.5';
export function campaignVersion(id) {
return CAMPAIGN_VERSIONS.find(c=>c.id===id)||CAMPAIGN_VERSIONS.find(c=>c.id===DEFAULT_CAMPAIGN_VERSION);
}