feat(#52): era templates + shared scenario types/transforms
- presets/templates/: 3 light era templates (ww2/present/near-future) + index.json manifest (id, name, year, eraDescription, suggestedPowers, tensions). - server/templates.ts: createTemplateStore (mirror of createPresetStore). - shared/scenario.ts: dependency-free contract for the dynamic scenario path — SuggestedPower / EraTemplate / TemplateMeta / WorldNation / ScenarioEvent / WorldDraft / Checkpoint types, relationFromScore, validateWorldDraft (pure, defensive, never throws), worldDraftToGameState (region-key territory via the injected expand resolver, regionStats seeded, clean turn-1 state). - tests: server/templates.test.ts (manifest order + file shape), server/scenario-shared.test.ts (15 cases: validation/clamp/dedup/null + transform). Fixes #52
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"id": "ww2",
|
||||
"name": "World War II",
|
||||
"year": 1939,
|
||||
"eraDescription": "Europe teeters on the brink of total war. Fascist powers press their advantage across the continent while the democracies marshal their strength."
|
||||
},
|
||||
{
|
||||
"id": "present",
|
||||
"name": "Present Day",
|
||||
"year": 2026,
|
||||
"eraDescription": "A multipolar world of blocs, sanctions, and tech supremacy. Climate strain, AI, and great-power rivalry shape every decision."
|
||||
},
|
||||
{
|
||||
"id": "near-future",
|
||||
"name": "Near Future",
|
||||
"year": 2035,
|
||||
"eraDescription": "Autonomous fleets, orbital assets, and climate-hamstrung coastlines. Old alliances strain under new technologies and old grievances."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "near-future",
|
||||
"name": "Near Future",
|
||||
"year": 2035,
|
||||
"eraDescription": "A near-future world: autonomous fleets, orbital assets, and climate-hamstrung coastlines. Old alliances strain under new technologies and old grievances as the great powers reach for the next horizon.",
|
||||
"suggestedPowers": [
|
||||
{ "name": "North American Union", "region": "USA", "note": "The industrial-technological core of the West." },
|
||||
{ "name": "Chinese Federation", "region": "CHN", "note": "The integrated superpower of the Pacific." },
|
||||
{ "name": "European Confederation", "region": "FRA", "note": "The united European bloc." },
|
||||
{ "name": "Russian Union", "region": "RUS", "note": "The resource frontier state." }
|
||||
],
|
||||
"tensions": [
|
||||
"Autonomous weapons and the new arms race",
|
||||
"Climate migration and resource wars",
|
||||
"The contest for space and orbital dominance"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "present",
|
||||
"name": "Present Day",
|
||||
"year": 2026,
|
||||
"eraDescription": "A multipolar world of blocs, sanctions, and tech supremacy. Climate strain, artificial intelligence, and great-power rivalry shape every decision the leaders of the age must make.",
|
||||
"suggestedPowers": [
|
||||
{ "name": "United States", "region": "USA", "note": "The military-technological leader of the Western bloc." },
|
||||
{ "name": "People's Republic of China", "region": "CHN", "note": "The industrial giant pressing on the Western Pacific." },
|
||||
{ "name": "Russian Federation", "region": "RUS", "note": "A resource-rich power testing its neighbors' resolve." },
|
||||
{ "name": "European Union", "region": "FRA", "note": "A large, internally divided economic bloc." }
|
||||
],
|
||||
"tensions": [
|
||||
"US–China tech and trade rivalry",
|
||||
"The war in Europe and the eastern flank",
|
||||
"AI and cyber dominance"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "ww2",
|
||||
"name": "World War II",
|
||||
"year": 1939,
|
||||
"eraDescription": "Europe teeters on the brink of total war. Fascist powers press their advantage across the continent while the democracies marshal their strength, and the great powers watch — and arm — from across the oceans.",
|
||||
"suggestedPowers": [
|
||||
{ "name": "German Reich", "region": "DEU", "note": "A militarized Reich at the heart of the continent, its army the most battle-hardened in Europe." },
|
||||
{ "name": "United Kingdom", "region": "GBR", "note": "An island power that commands the seas but is cut off from the continent." },
|
||||
{ "name": "Soviet Union", "region": "RUS", "note": "A vast, fragile industrial giant on the eastern frontier." },
|
||||
{ "name": "United States", "region": "USA", "note": "An industrial colossus, still politically divided over entry into the war." }
|
||||
],
|
||||
"tensions": [
|
||||
"The Axis versus the Allies",
|
||||
"The race for continental resources and sea lanes",
|
||||
"The uneasy balance before the bomb"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user