Add 50 Points and group achievement tiers; release viewer 225 engine 158
This commit is contained in:
parent
ba8ee4e2d6
commit
7c06af097c
10 changed files with 709 additions and 63 deletions
|
|
@ -12,6 +12,40 @@ its existing engine hooks. The web-client tests check the generated API against
|
|||
`@boardgamers/protocol` **0.11.0** types and runtime schemas; there is no separate
|
||||
JavaScript scoring implementation.
|
||||
|
||||
## Viewer 0.1.225 / engine 0.4.158 — revision 6, 46 definitions
|
||||
|
||||
Adds **50 Points** (`score-50`): “Finish a game with at least 50 victory points in
|
||||
the final state.” Uses canonical `player.victory_points(game) >= 50`, inclusive,
|
||||
for an authoritative finished, non-dropped human seat; winning is not required.
|
||||
Reuses `achievement-score-40`. The prior 45 definitions retain identical content,
|
||||
IDs, conditions and artwork. There are still 41 unique achievement asset keys and
|
||||
58 named artwork assets overall; no new asset, upload or locale text is needed.
|
||||
The matching viewer/engine release is 0.1.225/0.4.158.
|
||||
|
||||
Catalog and earned-array order deliberately group tiers, rather than append them:
|
||||
|
||||
- Length completion/win pairs stay in their existing order.
|
||||
- Points: `score-30`, `score-40`, `score-50`, `score-60`.
|
||||
- `seven-cities`.
|
||||
- Advances: `twenty-advances`, `thirty-advances`.
|
||||
- Objectives: `three-objectives`, `five-objectives`, `seven-objectives`.
|
||||
- `two-wonders-built`, `captured-leader`, then the existing individual wonders,
|
||||
Builder completion and civilization wins, all retaining their relative order.
|
||||
|
||||
The manifest is an ordered array, not a new `order` property. The BGS game album
|
||||
(`/badges/games/clash`) renders `achievementManifest.achievements` directly, so this
|
||||
array change sets its earned/unearned catalog order without platform UI changes.
|
||||
Reordering requires a revision increment because platform catalog comparison is
|
||||
order-sensitive. Profile earned badges retain received-award order, and activity
|
||||
remains chronological; no platform/profile code changes are included.
|
||||
Release verification must compare the exact revision-6 array
|
||||
(including this intentional order), and compare all previous 45 definitions by ID
|
||||
for unchanged content, not demand the old array order. Tests pin the revision-5
|
||||
baseline and the explicit new array. Publish the frozen tested build only after matching main-branch Check and Web viewer
|
||||
CI pass. Wait for installer-owned revision 6 activation in both public and admin
|
||||
metadata. No historical backfill, live-game mutation, history repair or Fossil
|
||||
refresh is performed.
|
||||
|
||||
## Viewer 0.1.224 / engine 0.4.157 — revision 5, 45 definitions
|
||||
|
||||
Adds three independent, inclusive final-state milestones:
|
||||
|
|
@ -30,7 +64,7 @@ five-objective tiers: instant and status-phase completions count alike; held car
|
|||
printed options, bonus VP and lifetime totals do not. Advances follow the existing
|
||||
Twenty Advances tier: regular advances currently in the set, regardless of how
|
||||
acquired, excluding civilization special advances (including automatically unlocked
|
||||
ones). The prior catalog has no 50-point or 25-advance tier.
|
||||
ones). Revision 5 had no 50-point or 25-advance tier.
|
||||
|
||||
All three require an authoritative `Finished` save and an eligible non-dropped human
|
||||
civilization seat, but not a win. Existing platform eligibility responsibilities
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ const WONDERS: [(Wonder, &str, &str); 8] = [
|
|||
(Wonder::GreatStatue, "built-great-statue", "Great Statue"),
|
||||
(Wonder::GreatWall, "built-great-wall", "Great Wall"),
|
||||
];
|
||||
const FEATS: [(&str, &str, &str); 11] = [
|
||||
const FEATS: [(&str, &str, &str); 12] = [
|
||||
(
|
||||
"score-30",
|
||||
"30 Points",
|
||||
|
|
@ -90,6 +90,16 @@ const FEATS: [(&str, &str, &str); 11] = [
|
|||
"40 Points",
|
||||
"Finish a game with at least 40 victory points in the final state.",
|
||||
),
|
||||
(
|
||||
"score-50",
|
||||
"50 Points",
|
||||
"Finish a game with at least 50 victory points in the final state.",
|
||||
),
|
||||
(
|
||||
"score-60",
|
||||
"60 Points",
|
||||
"Finish a game with at least 60 victory points in the final state.",
|
||||
),
|
||||
(
|
||||
"seven-cities",
|
||||
"Seven Cities",
|
||||
|
|
@ -100,6 +110,11 @@ const FEATS: [(&str, &str, &str); 11] = [
|
|||
"Twenty Advances",
|
||||
"Finish a game with at least 20 regular advances in the final state; special advances do not count.",
|
||||
),
|
||||
(
|
||||
"thirty-advances",
|
||||
"Thirty Advances",
|
||||
"Finish a game with at least 30 regular advances in the final state; special advances do not count.",
|
||||
),
|
||||
(
|
||||
"three-objectives",
|
||||
"Three Objectives",
|
||||
|
|
@ -110,6 +125,11 @@ const FEATS: [(&str, &str, &str); 11] = [
|
|||
"Five Objectives",
|
||||
"Complete 5 objectives in a single game.",
|
||||
),
|
||||
(
|
||||
"seven-objectives",
|
||||
"Seven Objectives",
|
||||
"Finish a game with at least 7 completed objectives in the final state.",
|
||||
),
|
||||
(
|
||||
"two-wonders-built",
|
||||
"Two Wonders Built",
|
||||
|
|
@ -120,27 +140,12 @@ const FEATS: [(&str, &str, &str); 11] = [
|
|||
"Captured Leader",
|
||||
"Finish a game with at least 1 captured leader in the final state.",
|
||||
),
|
||||
(
|
||||
"score-60",
|
||||
"60 Points",
|
||||
"Finish a game with at least 60 victory points in the final state.",
|
||||
),
|
||||
(
|
||||
"seven-objectives",
|
||||
"Seven Objectives",
|
||||
"Finish a game with at least 7 completed objectives in the final state.",
|
||||
),
|
||||
(
|
||||
"thirty-advances",
|
||||
"Thirty Advances",
|
||||
"Finish a game with at least 30 regular advances in the final state; special advances do not count.",
|
||||
),
|
||||
];
|
||||
|
||||
/// The stable achievement catalogue. Array order also defines award order.
|
||||
#[must_use]
|
||||
pub fn definitions() -> Manifest {
|
||||
let mut definitions = Vec::with_capacity(45);
|
||||
let mut definitions = Vec::with_capacity(46);
|
||||
for (_, id, name) in LENGTHS {
|
||||
definitions.push(Definition {
|
||||
id: format!("complete-{id}"),
|
||||
|
|
@ -167,7 +172,7 @@ pub fn definitions() -> Manifest {
|
|||
"achievement-{}",
|
||||
match id {
|
||||
"five-objectives" | "seven-objectives" => "three-objectives",
|
||||
"score-60" => "score-40",
|
||||
"score-50" | "score-60" => "score-40",
|
||||
"thirty-advances" => "twenty-advances",
|
||||
_ => id,
|
||||
}
|
||||
|
|
@ -195,7 +200,7 @@ pub fn definitions() -> Manifest {
|
|||
icon: Some(Icon::Asset { key: format!("achievement-faction-{slug}") }),
|
||||
}));
|
||||
Manifest {
|
||||
revision: 5,
|
||||
revision: 6,
|
||||
achievements: definitions,
|
||||
}
|
||||
}
|
||||
|
|
@ -232,15 +237,16 @@ pub fn achievements(game: &Game) -> Vec<SeatAchievements> {
|
|||
let predicates = [
|
||||
score >= 30.0,
|
||||
score >= 40.0,
|
||||
score >= 50.0,
|
||||
score >= 60.0,
|
||||
p.cities.len() >= 7,
|
||||
p.advances.len() >= 20,
|
||||
p.advances.len() >= 30,
|
||||
p.completed_objectives.len() >= 3,
|
||||
p.completed_objectives.len() >= 5,
|
||||
p.completed_objectives.len() >= 7,
|
||||
p.wonders_built.len() >= 2,
|
||||
!p.captured_leaders.is_empty(),
|
||||
score >= 60.0,
|
||||
p.completed_objectives.len() >= 7,
|
||||
p.advances.len() >= 30,
|
||||
];
|
||||
for ((id, _, _), met) in FEATS.iter().zip(predicates) {
|
||||
if met {
|
||||
|
|
@ -352,8 +358,8 @@ mod tests {
|
|||
#[test]
|
||||
fn manifest_and_real_end_turn_for_all_lengths() {
|
||||
let manifest = definitions();
|
||||
assert_eq!(manifest.revision, 5);
|
||||
assert_eq!(manifest.achievements.len(), 45);
|
||||
assert_eq!(manifest.revision, 6);
|
||||
assert_eq!(manifest.achievements.len(), 46);
|
||||
assert_eq!(
|
||||
manifest
|
||||
.achievements
|
||||
|
|
@ -361,7 +367,7 @@ mod tests {
|
|||
.map(|d| &d.id)
|
||||
.collect::<HashSet<_>>()
|
||||
.len(),
|
||||
45
|
||||
46
|
||||
);
|
||||
assert!(
|
||||
manifest
|
||||
|
|
@ -438,6 +444,55 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fifty_points_threshold_and_eligibility() {
|
||||
for score in [49.0, 50.0, 51.0] {
|
||||
let mut game = finish(setup(GameLength::Standard));
|
||||
set_score(&mut game, 0, score);
|
||||
set_score(&mut game, 1, 100.0);
|
||||
assert_eq!(game.player(0).victory_points(&game), score);
|
||||
assert_eq!(has(&game, 0, "score-50"), score >= 50.0);
|
||||
assert!(!has(&game, 0, "win-standard"));
|
||||
for seat in 2..game.players.len() {
|
||||
assert!(!game.player(seat).is_human());
|
||||
set_score(&mut game, seat, 100.0);
|
||||
assert!(!has(&game, seat, "score-50"));
|
||||
}
|
||||
game.dropped_players.push(0);
|
||||
assert!(!has(&game, 0, "score-50"));
|
||||
game.dropped_players.clear();
|
||||
game.secrets_stripped = true;
|
||||
assert!(achievements(&game).is_empty());
|
||||
}
|
||||
assert!(achievements(&setup(GameLength::Standard)).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn feat_tiers_are_contiguous_and_ascending() {
|
||||
let expected = [
|
||||
"score-30",
|
||||
"score-40",
|
||||
"score-50",
|
||||
"score-60",
|
||||
"seven-cities",
|
||||
"twenty-advances",
|
||||
"thirty-advances",
|
||||
"three-objectives",
|
||||
"five-objectives",
|
||||
"seven-objectives",
|
||||
"two-wonders-built",
|
||||
"captured-leader",
|
||||
];
|
||||
assert_eq!(FEATS.map(|(id, _, _)| id), expected);
|
||||
assert_eq!(
|
||||
definitions().achievements[10..22]
|
||||
.iter()
|
||||
.map(|d| d.id.as_str())
|
||||
.collect::<Vec<_>>(),
|
||||
expected
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn final_state_counts_not_special_advances_or_owned_wonders() {
|
||||
let mut game = finish(setup(GameLength::Standard));
|
||||
|
|
@ -610,10 +665,10 @@ mod tests {
|
|||
FACTIONS.iter().map(|(name, _)| (*name).into()).collect()
|
||||
);
|
||||
let manifest = serde_json::to_value(definitions()).unwrap();
|
||||
assert_eq!(manifest["revision"], 5);
|
||||
assert_eq!(manifest["revision"], 6);
|
||||
assert_eq!(manifest.as_object().unwrap().len(), 2);
|
||||
let entries = manifest["achievements"].as_array().unwrap();
|
||||
assert_eq!(entries.len(), 45);
|
||||
assert_eq!(entries.len(), 46);
|
||||
for entry in entries {
|
||||
let faction = FACTIONS
|
||||
.iter()
|
||||
|
|
@ -635,7 +690,7 @@ mod tests {
|
|||
"achievement-{}",
|
||||
match entry["id"].as_str().unwrap() {
|
||||
"five-objectives" | "seven-objectives" => "three-objectives",
|
||||
"score-60" => "score-40",
|
||||
"score-50" | "score-60" => "score-40",
|
||||
"thirty-advances" => "twenty-advances",
|
||||
id => id,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1601,3 +1601,20 @@ Independently download and compare every viewer asset, engine archive and all 58
|
|||
existing named assets. Preserve real-game gallery, game-length labels/order and
|
||||
Standard default, plus all unrelated metadata. No historical award backfill,
|
||||
live-game moves, history repair or Fossil refresh is included.
|
||||
|
||||
# Viewer 0.1.225 / engine 0.4.158
|
||||
|
||||
Adds 50 Points at canonical final VP >= 50 for eligible finished, non-dropped human
|
||||
seats, independent of winning, reusing `achievement-score-40`. Achievement catalog
|
||||
revision 6 has 46 definitions: points 30/40/50/60, Seven Cities, advances 20/30,
|
||||
objectives 3/5/7, Two Wonders Built, Captured Leader, then the unchanged remaining
|
||||
groups. All 45 prior definitions retain identical content; only catalog/award-array
|
||||
order changes, not profile earned-badge or chronological feed order. There are still
|
||||
41 unique achievement artwork keys and 58 named assets; no artwork upload is needed.
|
||||
|
||||
Push matching source to main and require green Check and Web viewer CI before
|
||||
publishing the frozen tested viewer/engine. Independently download and byte-verify
|
||||
the full viewer bundle and engine, then verify installer-owned revision 6 and the
|
||||
exact ordered catalog in both public and admin metadata. Preserve gallery, Standard
|
||||
length default and unrelated metadata. No backfill, live-game moves, history repair
|
||||
or Fossil refresh. See `docs/achievements.md` for the catalog contract.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.224",
|
||||
"version": "0.1.225",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.224",
|
||||
"version": "0.1.225",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.11.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.224",
|
||||
"version": "0.1.225",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
"web-client/src/civilization-emblems.ts": "01b0cbf3fa77a8466532ccd73d63c1a3ddc9bbc79fc06ce7224b425322a9c9f0",
|
||||
"web-client/src/civilization-flags.ts": "cd176076bfe05b3059093b80c88596b7ae46b77898695c6c7406cbe1a3a0f78b",
|
||||
"server/src/content/civilizations.rs": "73602f3db506f3dc2dbc6de43d01179440fd3bb034c997ff209336faaef2a332",
|
||||
"web-client/package-lock.json": "e4f33a57d5e2b65923711e1c11de61261c4d7b62e3f5344322cf8116d675de70",
|
||||
"web-client/package-lock.json": "c5436f27b8198441b70fb5b5ad0d8cf231fc1fdfd6982f064811ced63aca68ec",
|
||||
"web-client/node_modules/lucide-svelte/dist/Icon.svelte": "f7b49ab842c143fa680fa8bd9a54a9efdc48c2e2d49fa574bd5ccf8f6cfca5be",
|
||||
"web-client/node_modules/lucide-svelte/dist/defaultAttributes.js": "5b8981c6e3434ae6538716af9e0403554e7708c4087f18d060950a7bef00d96a",
|
||||
"web-client/node_modules/lucide-svelte/LICENSE": "668dcc52803480e0a026b31140a4cae668772663cd764e5991d252eef03f98db"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-server",
|
||||
"version": "0.4.157",
|
||||
"version": "0.4.158",
|
||||
"description": "Clash of Cultures: Monumental edition engine for Boardgamers Space",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
|
|
|
|||
|
|
@ -4,37 +4,58 @@ import { execFileSync } from 'node:child_process';
|
|||
import { readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { chromium } from 'playwright';
|
||||
import { inspectEngine } from '@boardgamers/protocol/engine';
|
||||
import { ids } from './nonfaction-art.mjs';
|
||||
import { validateOutputs, outputDir } from './nonfaction-assets.mjs';
|
||||
import { root } from './achievement-asset-inputs.mjs';
|
||||
// Last source release before the three additive revision-5 milestones.
|
||||
const baseline = '59fd2671380391889d1dff0e0f15db16fdc215ff';
|
||||
test('existing evaluation and faction assets are unchanged apart from the three new milestones', async () => {
|
||||
// Last delivered release: revision 5, 45 definitions.
|
||||
const baseline = 'ba8ee4e2';
|
||||
test('existing evaluation and assets are unchanged apart from score-50 and deliberate tier ordering', async () => {
|
||||
const file = 'server/src/achievements.rs';
|
||||
const old = execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' });
|
||||
const current = await readFile(path.join(root, file), 'utf8');
|
||||
const body = (s) => s.split('pub fn achievements(game: &Game)')[1].split('#[cfg(test)]')[0];
|
||||
// Only these three inclusive predicates may change evaluation.
|
||||
let evaluator = body(current);
|
||||
for (const predicate of [
|
||||
' score >= 60.0,\n',
|
||||
' p.completed_objectives.len() >= 7,\n',
|
||||
' p.advances.len() >= 30,\n',
|
||||
]) {
|
||||
assert.equal(evaluator.split(predicate).length, 2);
|
||||
evaluator = evaluator.replace(predicate, '');
|
||||
}
|
||||
assert.equal(evaluator, body(old));
|
||||
const predicates = (s) =>
|
||||
s
|
||||
.match(/let predicates = \[([\s\S]*?)\];/)[1]
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((v) => v.trim());
|
||||
const oldPredicates = predicates(body(old));
|
||||
const newPredicates = predicates(body(current));
|
||||
// Exact new order: each predicate stays aligned with its corresponding feat ID.
|
||||
assert.deepEqual(newPredicates, [
|
||||
oldPredicates[0],
|
||||
oldPredicates[1],
|
||||
'score >= 50.0,',
|
||||
oldPredicates[8],
|
||||
oldPredicates[2],
|
||||
oldPredicates[3],
|
||||
oldPredicates[10],
|
||||
oldPredicates[4],
|
||||
oldPredicates[5],
|
||||
oldPredicates[9],
|
||||
oldPredicates[6],
|
||||
oldPredicates[7],
|
||||
]);
|
||||
const withoutPredicates = (s) => s.replace(/let predicates = \[[\s\S]*?\];/, 'PREDICATES');
|
||||
assert.equal(withoutPredicates(body(current)), withoutPredicates(body(old)));
|
||||
const artworkFile = 'web-client/release/achievement-assets.json';
|
||||
const previousArtwork = JSON.parse(
|
||||
execFileSync('git', ['show', `${baseline}:${artworkFile}`], { cwd: root, encoding: 'utf8' }),
|
||||
);
|
||||
const currentArtwork = JSON.parse(await readFile(path.join(root, artworkFile), 'utf8'));
|
||||
// Only the wrapper-version lockfile integrity pin changes; artwork is identical.
|
||||
previousArtwork.integrity['web-client/package-lock.json'] =
|
||||
currentArtwork.integrity['web-client/package-lock.json'];
|
||||
// Only the wrapper-version lockfile hash changes; artwork inputs stay identical.
|
||||
const lockfile = 'web-client/package-lock.json';
|
||||
assert.equal(
|
||||
currentArtwork.integrity[lockfile],
|
||||
createHash('sha256')
|
||||
.update(await readFile(path.join(root, lockfile)))
|
||||
.digest('hex'),
|
||||
);
|
||||
previousArtwork.integrity[lockfile] = currentArtwork.integrity[lockfile];
|
||||
assert.deepEqual(currentArtwork, previousArtwork);
|
||||
for (const file of [
|
||||
'web-client/release/achievement-assets-nonfaction.json',
|
||||
|
|
@ -46,19 +67,53 @@ test('existing evaluation and faction assets are unchanged apart from the three
|
|||
execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' }),
|
||||
);
|
||||
});
|
||||
test('generated engine schema, 45 definitions sharing 41 existing assets', async () => {
|
||||
test('generated engine schema, 46 definitions sharing 41 existing assets', async () => {
|
||||
// Test current local WASM, not a stale published archive; an explicit packed
|
||||
// engine can still be supplied during a future release verification.
|
||||
const engine = createRequire(import.meta.url)(process.env.CLASH_TEST_ENGINE ?? '../.engine/server.js');
|
||||
assert.ok(inspectEngine(engine).compatible);
|
||||
const m = engine.achievementDefinitions();
|
||||
assert.equal(m.revision, 5);
|
||||
assert.equal(m.achievements.length, 45);
|
||||
assert.equal(m.revision, 6);
|
||||
assert.equal(m.achievements.length, 46);
|
||||
const baselineManifest = JSON.parse(
|
||||
await readFile(path.join(root, 'web-client/src/fixtures/achievements-revision-5.json'), 'utf8'),
|
||||
);
|
||||
const previous = new Map(baselineManifest.achievements.map((a) => [a.id, a]));
|
||||
const expectedIds = [
|
||||
...baselineManifest.achievements.slice(0, 10).map((a) => a.id),
|
||||
'score-30',
|
||||
'score-40',
|
||||
'score-50',
|
||||
'score-60',
|
||||
'seven-cities',
|
||||
'twenty-advances',
|
||||
'thirty-advances',
|
||||
'three-objectives',
|
||||
'five-objectives',
|
||||
'seven-objectives',
|
||||
'two-wonders-built',
|
||||
'captured-leader',
|
||||
...baselineManifest.achievements.slice(21).map((a) => a.id),
|
||||
];
|
||||
assert.deepEqual(
|
||||
m.achievements,
|
||||
expectedIds.map((id) =>
|
||||
id === 'score-50'
|
||||
? {
|
||||
id,
|
||||
name: '50 Points',
|
||||
description: 'Finish a game with at least 50 victory points in the final state.',
|
||||
icon: { type: 'asset', key: 'achievement-score-40' },
|
||||
}
|
||||
: previous.get(id),
|
||||
),
|
||||
);
|
||||
const factions = JSON.parse(
|
||||
await readFile(path.join(root, 'web-client/release/achievement-assets.json')),
|
||||
).assets;
|
||||
const reused = {
|
||||
'five-objectives': 'three-objectives',
|
||||
'score-50': 'score-40',
|
||||
'score-60': 'score-40',
|
||||
'seven-objectives': 'three-objectives',
|
||||
'thirty-advances': 'twenty-advances',
|
||||
|
|
|
|||
|
|
@ -22,8 +22,34 @@ const finish = () => engine.tryMove(fixture, JSON.stringify({ Playing: 'EndTurn'
|
|||
|
||||
test('WASM achievement catalog follows official protocol 0.11.0', () => {
|
||||
const manifest = achievementManifestSchema.parse(hooks.achievementDefinitions());
|
||||
assert.equal(manifest.revision, 5);
|
||||
assert.equal(manifest.achievements.length, 45);
|
||||
assert.equal(manifest.revision, 6);
|
||||
assert.equal(manifest.achievements.length, 46);
|
||||
assert.deepEqual(
|
||||
manifest.achievements.slice(10, 22).map((a) => a.id),
|
||||
[
|
||||
'score-30',
|
||||
'score-40',
|
||||
'score-50',
|
||||
'score-60',
|
||||
'seven-cities',
|
||||
'twenty-advances',
|
||||
'thirty-advances',
|
||||
'three-objectives',
|
||||
'five-objectives',
|
||||
'seven-objectives',
|
||||
'two-wonders-built',
|
||||
'captured-leader',
|
||||
],
|
||||
);
|
||||
assert.deepEqual(
|
||||
manifest.achievements.find((a) => a.id === 'score-50'),
|
||||
{
|
||||
id: 'score-50',
|
||||
name: '50 Points',
|
||||
description: 'Finish a game with at least 50 victory points in the final state.',
|
||||
icon: { type: 'asset', key: 'achievement-score-40' },
|
||||
},
|
||||
);
|
||||
assert.ok(!manifest.achievements.some((a) => a.id === 'four-cities'));
|
||||
assert.ok(manifest.achievements.some((a) => a.id === 'seven-cities'));
|
||||
assert.ok(manifest.achievements.some((a) => a.id === 'complete-builder'));
|
||||
|
|
@ -37,8 +63,8 @@ test('WASM achievement catalog follows official protocol 0.11.0', () => {
|
|||
const nonfactionArt = JSON.parse(
|
||||
readFileSync(new URL('../release/achievement-assets-nonfaction.json', import.meta.url), 'utf8'),
|
||||
);
|
||||
assert.equal(nonfactionArt.revision, 3, 'revision 5 reuses the existing objective artwork');
|
||||
assert.equal(art.revision, 2, 'revision 5 preserves the existing faction artwork');
|
||||
assert.equal(nonfactionArt.revision, 3, 'revision 6 reuses the existing objective artwork');
|
||||
assert.equal(art.revision, 2, 'revision 6 preserves the existing faction artwork');
|
||||
assert.deepEqual(
|
||||
[
|
||||
...new Set(
|
||||
|
|
@ -55,6 +81,44 @@ test('WASM achievement catalog follows official protocol 0.11.0', () => {
|
|||
}
|
||||
});
|
||||
|
||||
test('revision 6 preserves all 45 previous definitions with the explicit new catalog order', () => {
|
||||
// Captured from the generated ba8ee4e2 / engine 0.4.157 catalog before rebuilding.
|
||||
const previous: AchievementManifest = JSON.parse(
|
||||
readFileSync(new URL('./fixtures/achievements-revision-5.json', import.meta.url), 'utf8'),
|
||||
);
|
||||
const manifest = hooks.achievementDefinitions();
|
||||
const previousById = new Map(previous.achievements.map((a) => [a.id, a]));
|
||||
const expectedIds = [
|
||||
...previous.achievements.slice(0, 10).map((a) => a.id),
|
||||
'score-30',
|
||||
'score-40',
|
||||
'score-50',
|
||||
'score-60',
|
||||
'seven-cities',
|
||||
'twenty-advances',
|
||||
'thirty-advances',
|
||||
'three-objectives',
|
||||
'five-objectives',
|
||||
'seven-objectives',
|
||||
'two-wonders-built',
|
||||
'captured-leader',
|
||||
...previous.achievements.slice(21).map((a) => a.id),
|
||||
];
|
||||
assert.deepEqual(
|
||||
manifest.achievements,
|
||||
expectedIds.map((id) =>
|
||||
id === 'score-50'
|
||||
? {
|
||||
id,
|
||||
name: '50 Points',
|
||||
description: 'Finish a game with at least 50 victory points in the final state.',
|
||||
icon: { type: 'asset', key: 'achievement-score-40' },
|
||||
}
|
||||
: previousById.get(id),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('actual completed fixture produces valid, deterministic, immutable seat achievements', () => {
|
||||
assert.deepEqual(hooks.achievements(fixture), []);
|
||||
const finished = finish();
|
||||
|
|
@ -80,11 +144,14 @@ test('actual completed fixture produces valid, deterministic, immutable seat ach
|
|||
});
|
||||
|
||||
test('WASM preserves inclusive score boundaries and awards feats to losing seats', () => {
|
||||
for (const [score, thirty, forty] of [
|
||||
[29.5, false, false],
|
||||
[30, true, false],
|
||||
[39.5, true, false],
|
||||
[40, true, true],
|
||||
for (const [score, thirty, forty, fifty] of [
|
||||
[29.5, false, false, false],
|
||||
[30, true, false, false],
|
||||
[39.5, true, false, false],
|
||||
[40, true, true, false],
|
||||
[49, true, true, false],
|
||||
[50, true, true, true],
|
||||
[51, true, true, true],
|
||||
] as const) {
|
||||
const finished = finish();
|
||||
const data = JSON.parse(finished);
|
||||
|
|
@ -101,6 +168,14 @@ test('WASM preserves inclusive score boundaries and awards feats to losing seats
|
|||
assert.equal(result.outcome, 'loss');
|
||||
assert.equal(result.earned.includes('score-30'), thirty);
|
||||
assert.equal(result.earned.includes('score-40'), forty);
|
||||
assert.equal(result.earned.includes('score-50'), fifty);
|
||||
assert.equal((engine.scores(JSON.stringify(data)) as number[])[0], score);
|
||||
assert.deepEqual(hooks.achievements(engine.stripSecret(JSON.stringify(data), 0)), []);
|
||||
data.dropped_players = [0];
|
||||
assert.ok(hooks.achievements(JSON.stringify(data)).every((r) => r.seat !== 0));
|
||||
data.dropped_players = [];
|
||||
data.state = 'Playing';
|
||||
assert.deepEqual(hooks.achievements(JSON.stringify(data)), []);
|
||||
assert.ok(result.earned.includes('complete-standard'));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
410
web-client/src/fixtures/achievements-revision-5.json
Normal file
410
web-client/src/fixtures/achievements-revision-5.json
Normal file
|
|
@ -0,0 +1,410 @@
|
|||
{
|
||||
"revision": 5,
|
||||
"achievements": [
|
||||
{
|
||||
"id": "complete-shorter",
|
||||
"name": "Complete Shorter",
|
||||
"description": "Finish a Shorter game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-shorter"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-shorter",
|
||||
"name": "Win Shorter",
|
||||
"description": "Finish a Shorter game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-win-shorter"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "complete-standard",
|
||||
"name": "Complete Standard",
|
||||
"description": "Finish a Standard game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-standard"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-standard",
|
||||
"name": "Win Standard",
|
||||
"description": "Finish a Standard game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-win-standard"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "complete-roll-to-end",
|
||||
"name": "Complete Roll to End",
|
||||
"description": "Finish a Roll to End game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-roll-to-end"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-roll-to-end",
|
||||
"name": "Win Roll to End",
|
||||
"description": "Finish a Roll to End game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-win-roll-to-end"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "complete-wonderful-ending",
|
||||
"name": "Complete Wonderful Ending",
|
||||
"description": "Finish a Wonderful Ending game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-wonderful-ending"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-wonderful-ending",
|
||||
"name": "Win Wonderful Ending",
|
||||
"description": "Finish a Wonderful Ending game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-win-wonderful-ending"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "complete-epic",
|
||||
"name": "Complete Epic",
|
||||
"description": "Finish a Epic game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-epic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-epic",
|
||||
"name": "Win Epic",
|
||||
"description": "Finish a Epic game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-win-epic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "score-30",
|
||||
"name": "30 Points",
|
||||
"description": "Finish a game with at least 30 victory points in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-score-30"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "score-40",
|
||||
"name": "40 Points",
|
||||
"description": "Finish a game with at least 40 victory points in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-score-40"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "seven-cities",
|
||||
"name": "Seven Cities",
|
||||
"description": "Finish a game owning at least 7 cities in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-seven-cities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "twenty-advances",
|
||||
"name": "Twenty Advances",
|
||||
"description": "Finish a game with at least 20 regular advances in the final state; special advances do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-twenty-advances"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "three-objectives",
|
||||
"name": "Three Objectives",
|
||||
"description": "Finish a game with at least 3 completed objectives in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-three-objectives"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "five-objectives",
|
||||
"name": "Five Objectives",
|
||||
"description": "Complete 5 objectives in a single game.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-three-objectives"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "two-wonders-built",
|
||||
"name": "Two Wonders Built",
|
||||
"description": "Finish a game having built at least 2 wonders, as recorded in the final state; merely owning wonders does not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-two-wonders-built"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "captured-leader",
|
||||
"name": "Captured Leader",
|
||||
"description": "Finish a game with at least 1 captured leader in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-captured-leader"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "score-60",
|
||||
"name": "60 Points",
|
||||
"description": "Finish a game with at least 60 victory points in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-score-40"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "seven-objectives",
|
||||
"name": "Seven Objectives",
|
||||
"description": "Finish a game with at least 7 completed objectives in the final state.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-three-objectives"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "thirty-advances",
|
||||
"name": "Thirty Advances",
|
||||
"description": "Finish a game with at least 30 regular advances in the final state; special advances do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-twenty-advances"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-arena",
|
||||
"name": "Great Arena: Recorded as Built",
|
||||
"description": "Finish with Great Arena recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-arena"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-pyramids",
|
||||
"name": "Great Pyramids: Recorded as Built",
|
||||
"description": "Finish with Great Pyramids recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-pyramids"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-gardens",
|
||||
"name": "Great Gardens: Recorded as Built",
|
||||
"description": "Finish with Great Gardens recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-gardens"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-library",
|
||||
"name": "Great Library: Recorded as Built",
|
||||
"description": "Finish with Great Library recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-library"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-lighthouse",
|
||||
"name": "Great Lighthouse: Recorded as Built",
|
||||
"description": "Finish with Great Lighthouse recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-lighthouse"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-mausoleum",
|
||||
"name": "Great Mausoleum: Recorded as Built",
|
||||
"description": "Finish with Great Mausoleum recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-mausoleum"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-statue",
|
||||
"name": "Great Statue: Recorded as Built",
|
||||
"description": "Finish with Great Statue recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-statue"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "built-great-wall",
|
||||
"name": "Great Wall: Recorded as Built",
|
||||
"description": "Finish with Great Wall recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-built-great-wall"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "complete-builder",
|
||||
"name": "Complete Builder",
|
||||
"description": "Finish a Builder variant game without dropping out.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-complete-builder"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-rome",
|
||||
"name": "Win as Rome",
|
||||
"description": "Finish a game as Rome as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-rome"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-greece",
|
||||
"name": "Win as Greece",
|
||||
"description": "Finish a game as Greece as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-greece"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-china",
|
||||
"name": "Win as China",
|
||||
"description": "Finish a game as China as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-china"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-vikings",
|
||||
"name": "Win as Vikings",
|
||||
"description": "Finish a game as Vikings as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-vikings"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-babylonia",
|
||||
"name": "Win as Babylonia",
|
||||
"description": "Finish a game as Babylonia as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-babylonia"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-india",
|
||||
"name": "Win as India",
|
||||
"description": "Finish a game as India as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-india"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-egypt",
|
||||
"name": "Win as Egypt",
|
||||
"description": "Finish a game as Egypt as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-egypt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-phoenicia",
|
||||
"name": "Win as Phoenicia",
|
||||
"description": "Finish a game as Phoenicia as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-phoenicia"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-maya",
|
||||
"name": "Win as Maya",
|
||||
"description": "Finish a game as Maya as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-maya"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-persia",
|
||||
"name": "Win as Persia",
|
||||
"description": "Finish a game as Persia as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-persia"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-japan",
|
||||
"name": "Win as Japan",
|
||||
"description": "Finish a game as Japan as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-japan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-huns",
|
||||
"name": "Win as Huns",
|
||||
"description": "Finish a game as Huns as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-huns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-celts",
|
||||
"name": "Win as Celts",
|
||||
"description": "Finish a game as Celts as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-celts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-aztecs",
|
||||
"name": "Win as Aztecs",
|
||||
"description": "Finish a game as Aztecs as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-aztecs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "win-carthage",
|
||||
"name": "Win as Carthage",
|
||||
"description": "Finish a game as Carthage as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins.",
|
||||
"icon": {
|
||||
"type": "asset",
|
||||
"key": "achievement-faction-carthage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue