Release phase auto-pass engine 2.0.37 and viewer 2.3.32
This commit is contained in:
parent
0c2f9b977d
commit
c8bf10538f
36 changed files with 1285 additions and 54 deletions
|
|
@ -14,6 +14,35 @@ skipped. Automatic passes use normal move logs (hidden until resolution for seal
|
|||
bids), timestamps and time increments. Historical replay does not re-evaluate
|
||||
today's settings or insert new passes.
|
||||
|
||||
## Resources and Building
|
||||
|
||||
Resources and Building also auto-pass when Pass is the only legal action. With
|
||||
public money this is automatic. With hidden money, inability to act even with
|
||||
unlimited money is public information and needs no opt-in (for example, no usable
|
||||
fuel storage, empty supply, or nowhere legal to build). When only affordability
|
||||
prevents acting, the private `autoPassResources` or `autoPassBuilding` setting must
|
||||
be enabled. Both default to false and take effect after the next committed move.
|
||||
|
||||
The player-card checkbox follows the current phase. Existing settings are retained
|
||||
when toggling another phase's setting. Analysis stays manual; tentative purchases
|
||||
and builds remain undoable and are never automatically confirmed. Queued plans
|
||||
run before automatic passes. Ordinary Pass logs, clocks and replay are preserved.
|
||||
|
||||
Published on BGS v13 with engine **2.0.37** and viewer **2.3.32**. The two new
|
||||
checkbox declarations from `scripts/player-settings.json` were merged into the
|
||||
BGS game settings alongside `autoPassBids`, preserving unrelated settings and
|
||||
viewer preferences. All three labels name their current phase, are translated
|
||||
in all 17 languages and fit left-aligned within the existing reserved row.
|
||||
See [the release record](releases/phase-auto-pass-2.0.37-2.3.32.json) for public
|
||||
asset hashes and verification.
|
||||
|
||||
Use `/?mode=fuel-hidden` or `/?mode=city-hidden` to let Ada take the last affordable
|
||||
option. Reset and compare with the checkbox enabled or the public-money scenarios.
|
||||
`/?mode=fuel-hidden-impossible` demonstrates a publicly empty oil market being
|
||||
skipped even when the hidden-money checkbox is off.
|
||||
|
||||
## Preview and existing auction release
|
||||
|
||||
Preview: build the engine and viewer, then run
|
||||
`node viewer/scripts/auction-preview.mjs` (default port 5216). The scenario selector
|
||||
offers public/hidden money and normal/sealed bidding. In the hidden-money preview,
|
||||
|
|
|
|||
351
docs/releases/phase-auto-pass-2.0.37-2.3.32.json
Normal file
351
docs/releases/phase-auto-pass-2.0.37-2.3.32.json
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
{
|
||||
"game": "powergrid",
|
||||
"gameVersion": 13,
|
||||
"publishedAt": "2026-11-17T22:21:19.895Z",
|
||||
"sourceBase": "0c2f9b9",
|
||||
"engine": {
|
||||
"version": "2.0.37",
|
||||
"package": {
|
||||
"name": "powergrid-engine",
|
||||
"version": "2.0.37",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/engine/0505a49678106c83/powergrid-engine-2.0.37.tgz"
|
||||
},
|
||||
"entryPoint": "dist/wrapper.js",
|
||||
"sha256": "0505a49678106c8351bed5e89daa52762a8bf818478ff03bcaa6b2e14a95c223",
|
||||
"bytes": 448863
|
||||
},
|
||||
"viewer": {
|
||||
"version": "2.3.32",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.js",
|
||||
"stylesheets": [
|
||||
"https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.css"
|
||||
],
|
||||
"scriptBytes": 1276327,
|
||||
"bundle": "split-e8cf0a84135f735b13bd",
|
||||
"files": [
|
||||
{
|
||||
"name": "powergrid-viewer.css",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.css",
|
||||
"bytes": 12404,
|
||||
"storedBytes": 3341
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-america.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-america.js",
|
||||
"bytes": 85113,
|
||||
"storedBytes": 34477
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-australia.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-australia.js",
|
||||
"bytes": 38512,
|
||||
"storedBytes": 16689
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-badenwurttemberg.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-badenwurttemberg.js",
|
||||
"bytes": 8577,
|
||||
"storedBytes": 4136
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-benelux.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-benelux.js",
|
||||
"bytes": 16630,
|
||||
"storedBytes": 7505
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-brazil.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-brazil.js",
|
||||
"bytes": 86016,
|
||||
"storedBytes": 33420
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-bremen.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-bremen.js",
|
||||
"bytes": 2372,
|
||||
"storedBytes": 1333
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-centraleurope.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-centraleurope.js",
|
||||
"bytes": 55706,
|
||||
"storedBytes": 24066
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-chile.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-chile.js",
|
||||
"bytes": 45296,
|
||||
"storedBytes": 19728
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-china.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-china.js",
|
||||
"bytes": 106839,
|
||||
"storedBytes": 45313
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-europe.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-europe.js",
|
||||
"bytes": 102212,
|
||||
"storedBytes": 43493
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-france.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-france.js",
|
||||
"bytes": 45373,
|
||||
"storedBytes": 19313
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-germany.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-germany.js",
|
||||
"bytes": 44921,
|
||||
"storedBytes": 19464
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-hawaii.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-hawaii.js",
|
||||
"bytes": 2690,
|
||||
"storedBytes": 1443
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-indian.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-indian.js",
|
||||
"bytes": 78059,
|
||||
"storedBytes": 31059
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-italy.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-italy.js",
|
||||
"bytes": 48012,
|
||||
"storedBytes": 19877
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-japan.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-japan.js",
|
||||
"bytes": 36346,
|
||||
"storedBytes": 15348
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-korea.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-korea.js",
|
||||
"bytes": 22329,
|
||||
"storedBytes": 10151
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-manhattan.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-manhattan.js",
|
||||
"bytes": 22389,
|
||||
"storedBytes": 9353
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-middleeast.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-middleeast.js",
|
||||
"bytes": 69713,
|
||||
"storedBytes": 28367
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-northamerica.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-northamerica.js",
|
||||
"bytes": 71472,
|
||||
"storedBytes": 28257
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-northerneurope.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-northerneurope.js",
|
||||
"bytes": 57391,
|
||||
"storedBytes": 24075
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-quebec.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-quebec.js",
|
||||
"bytes": 96526,
|
||||
"storedBytes": 42220
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-russia.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-russia.js",
|
||||
"bytes": 91649,
|
||||
"storedBytes": 39307
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-southafrica.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-southafrica.js",
|
||||
"bytes": 10242,
|
||||
"storedBytes": 4599
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-spainportugal.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-spainportugal.js",
|
||||
"bytes": 40537,
|
||||
"storedBytes": 17762
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.geography-ukireland.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.geography-ukireland.js",
|
||||
"bytes": 29283,
|
||||
"storedBytes": 12489
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.js",
|
||||
"bytes": 1276327,
|
||||
"storedBytes": 329957
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-da.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-da.js",
|
||||
"bytes": 133192,
|
||||
"storedBytes": 42216
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-de.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-de.js",
|
||||
"bytes": 139411,
|
||||
"storedBytes": 45106
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-el.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-el.js",
|
||||
"bytes": 199636,
|
||||
"storedBytes": 56520
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-fa.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-fa.js",
|
||||
"bytes": 171388,
|
||||
"storedBytes": 47135
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-fr.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-fr.js",
|
||||
"bytes": 144749,
|
||||
"storedBytes": 44871
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-hi.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-hi.js",
|
||||
"bytes": 220529,
|
||||
"storedBytes": 53916
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-it.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-it.js",
|
||||
"bytes": 139926,
|
||||
"storedBytes": 43738
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-ko.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-ko.js",
|
||||
"bytes": 147290,
|
||||
"storedBytes": 49397
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-nl.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-nl.js",
|
||||
"bytes": 137209,
|
||||
"storedBytes": 43382
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-pl.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-pl.js",
|
||||
"bytes": 136720,
|
||||
"storedBytes": 45387
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-pt-BR.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-pt-BR.js",
|
||||
"bytes": 138441,
|
||||
"storedBytes": 43550
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-ro.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-ro.js",
|
||||
"bytes": 141689,
|
||||
"storedBytes": 44490
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-ru.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-ru.js",
|
||||
"bytes": 185194,
|
||||
"storedBytes": 54716
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-vi.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-vi.js",
|
||||
"bytes": 153192,
|
||||
"storedBytes": 45113
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-zh-CN.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-zh-CN.js",
|
||||
"bytes": 125903,
|
||||
"storedBytes": 44370
|
||||
},
|
||||
{
|
||||
"name": "powergrid-viewer.umd.min.locale-zh-TW.js",
|
||||
"url": "https://s3.fr-par.scw.cloud/bgs-assets/games/powergrid/13/viewer/split-e8cf0a84135f735b13bd/powergrid-viewer.umd.min.locale-zh-TW.js",
|
||||
"bytes": 130375,
|
||||
"storedBytes": 48976
|
||||
}
|
||||
],
|
||||
"sha256": "ddad6c0c4c928545c047f874fd25cafba98a6576b8dec7be7f56f3ca01899ec0"
|
||||
},
|
||||
"settings": {
|
||||
"added": [
|
||||
"autoPassResources",
|
||||
"autoPassBuilding"
|
||||
],
|
||||
"before": [
|
||||
{
|
||||
"name": "autoPassBids",
|
||||
"label": "Auto-pass auctions I cannot afford (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"after": [
|
||||
{
|
||||
"name": "autoPassBids",
|
||||
"label": "Auto-pass auctions I cannot afford (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "autoPassResources",
|
||||
"label": "Auto-pass resources I cannot afford (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "autoPassBuilding",
|
||||
"label": "Auto-pass building when I cannot afford a city (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"preferencesPreserved": true,
|
||||
"unrelatedSettingsPreserved": true,
|
||||
"unrelatedMetadataPreserved": true,
|
||||
"apiNote": "Settings are top-level in the merged admin gameinfo API response; only settings were PATCHed via PUT, not preferences or the full metadata document."
|
||||
},
|
||||
"verification": {
|
||||
"engineTests": 861,
|
||||
"viewerUnitTests": 106,
|
||||
"localizationTests": 8,
|
||||
"localeCatalogs": 17,
|
||||
"engineBuildAndPack": true,
|
||||
"viewerPackageAndBundleBudget": true,
|
||||
"protocolBrowser": "390px and 1400px, replay and undo checks passed",
|
||||
"stableLayout": "Six map/player/locale scenarios plus three short desktop viewports passed",
|
||||
"localPhaseScenarios": 8,
|
||||
"localLabelChecks": 136,
|
||||
"cdnPhaseScenarios": 8,
|
||||
"cdnLabelChecks": 136,
|
||||
"cdnLabelResult": "Auto-pass labels: 136 phase/locale/viewport checks passed (17 locales, 390/1400px, live phase and locale switching). Smallest: {\"font\":12.85,\"x\":37,\"y\":10.529212951660156,\"right\":339.92486572265625,\"bottom\":25.470787048339844,\"inside\":true,\"gap\":9.03519058227539,\"locale\":\"el\",\"width\":390,\"phase\":\"auction\"}",
|
||||
"publicAssetHashesVerified": true,
|
||||
"publicViewerAssets": 44,
|
||||
"activeMetadataVerified": true,
|
||||
"noLiveGameWrites": true
|
||||
},
|
||||
"verified": true
|
||||
}
|
||||
2
engine/package-lock.json
generated
2
engine/package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "powergrid-engine",
|
||||
"version": "2.0.35",
|
||||
"version": "2.0.37",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "powergrid-engine",
|
||||
"version": "2.0.36",
|
||||
"version": "2.0.37",
|
||||
"description": "An engine for Power Grid",
|
||||
"main": "dist/index.js",
|
||||
"types": "index.ts",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,11 @@ describe('authoritative auction auto-pass', () => {
|
|||
|
||||
it('leaves hidden money alone unless that player opted in; turning it off restores manual passing', async () => {
|
||||
const G = position(false);
|
||||
expect(wrapper.playerSettings(G, 1)).to.deep.equal({ autoPassBids: false });
|
||||
expect(wrapper.playerSettings(G, 1)).to.deep.equal({
|
||||
autoPassBids: false,
|
||||
autoPassResources: false,
|
||||
autoPassBuilding: false,
|
||||
});
|
||||
expect((await wrapper.move(cloneDeep(G), opening(G), 0)).currentPlayers).to.deep.equal([1]);
|
||||
wrapper.setPlayerSettings(G, 1, { autoPassBids: true });
|
||||
expect((await wrapper.move(cloneDeep(G), opening(G), 0)).currentPlayers).to.deep.equal([2]);
|
||||
|
|
@ -57,9 +61,17 @@ describe('authoritative auction auto-pass', () => {
|
|||
wrapper.setPlayerSettings(G, 1, { autoPassBids: true });
|
||||
expect(stripSecret(G, 0).players[1].settings).to.equal(undefined);
|
||||
expect(stripSecret(G).players[1].settings).to.equal(undefined);
|
||||
expect(stripSecret(G, 1).players[1].settings).to.deep.equal({ autoPassBids: true });
|
||||
expect(stripSecret(G, 1).players[1].settings).to.deep.equal({
|
||||
autoPassBids: true,
|
||||
autoPassResources: false,
|
||||
autoPassBuilding: false,
|
||||
});
|
||||
wrapper.setPlayerSettings(G, 1, { autoPassBids: 'true' });
|
||||
expect(wrapper.playerSettings(G, 1)).to.deep.equal({ autoPassBids: false });
|
||||
expect(wrapper.playerSettings(G, 1)).to.deep.equal({
|
||||
autoPassBids: false,
|
||||
autoPassResources: false,
|
||||
autoPassBuilding: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('never advances turns when the host saves settings', () => {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ export interface CityPosition {
|
|||
export interface PlayerSettings {
|
||||
/** Opt in to revealing inability to afford an auction when money is hidden. */
|
||||
autoPassBids?: boolean;
|
||||
/** Private opt-ins to reveal inability to afford actions in these phases. */
|
||||
autoPassResources?: boolean;
|
||||
autoPassBuilding?: boolean;
|
||||
}
|
||||
|
||||
export interface Player {
|
||||
|
|
|
|||
266
engine/src/phase-auto-pass.spec.ts
Normal file
266
engine/src/phase-auto-pass.spec.ts
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
import { expect } from 'chai';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import * as wrapper from '../wrapper';
|
||||
import { availableMoves } from './available-moves';
|
||||
import { move as atomicMove, setup, stripSecret } from './engine';
|
||||
import { GameOptions, GameState, Phase, ResourceType } from './gamestate';
|
||||
import { LogMove } from './log';
|
||||
import { Move, MoveName } from './move';
|
||||
import { autoPassResourcesAndBuilding } from './phase-auto-pass';
|
||||
import { automation } from './premoves';
|
||||
|
||||
const pass: Move = { name: MoveName.Pass, data: true };
|
||||
function position(phase = Phase.Resources, map: GameOptions['map'] = 'Germany'): GameState {
|
||||
const G = setup(3, { map, variant: 'original', showMoney: false }, 'phase-auto-pass');
|
||||
G.phase = phase;
|
||||
G.round = 2;
|
||||
G.playerOrder = [0, 1, 2];
|
||||
G.currentPlayers = [2];
|
||||
G.newTurn = true;
|
||||
for (const p of G.players) {
|
||||
p.money = 0;
|
||||
p.passed = false;
|
||||
p.availableMoves = null;
|
||||
}
|
||||
G.players[2].availableMoves = availableMoves(G, G.players[2]);
|
||||
return G;
|
||||
}
|
||||
function passed(G: GameState): boolean {
|
||||
const start = G.log.length;
|
||||
const result = autoPassResourcesAndBuilding(G, 1234);
|
||||
return result.log.slice(start).some((e) => e.type === 'move' && e.player === 2 && e.move.name === MoveName.Pass);
|
||||
}
|
||||
|
||||
describe('authoritative resource/building auto-pass', () => {
|
||||
for (const phase of [Phase.Resources, Phase.Building]) {
|
||||
const setting = phase === Phase.Resources ? 'autoPassResources' : 'autoPassBuilding';
|
||||
it(`${phase}: protects hidden affordability unless separately opted in`, () => {
|
||||
const G = position(phase);
|
||||
G.players[2].coalCapacity = 2;
|
||||
const before = cloneDeep(G);
|
||||
expect(passed(G)).to.equal(false);
|
||||
expect(G).to.deep.equal(before); // probe is read-only
|
||||
wrapper.setPlayerSettings(G, 2, {
|
||||
autoPassBids: true,
|
||||
[phase === Phase.Resources ? 'autoPassBuilding' : 'autoPassResources']: true,
|
||||
});
|
||||
expect(passed(G)).to.equal(false);
|
||||
wrapper.setPlayerSettings(G, 2, { [setting]: true });
|
||||
expect(passed(G)).to.equal(true);
|
||||
expect(wrapper.timeIncrements(G)).to.deep.equal([0, 0, 1]);
|
||||
expect(wrapper.isLiveUpdate(G)).to.equal(false);
|
||||
expect(G.players[2].money).to.equal(0);
|
||||
});
|
||||
it(`${phase}: public money auto-passes but affordable alternatives never do`, () => {
|
||||
const G = position(phase);
|
||||
G.options.showMoney = true;
|
||||
G.players[2].coalCapacity = 2;
|
||||
const affordable = cloneDeep(G);
|
||||
affordable.players[2].money = 100;
|
||||
wrapper.setPlayerSettings(affordable, 2, { [setting]: true });
|
||||
expect(passed(affordable)).to.equal(false);
|
||||
expect(passed(G)).to.equal(true);
|
||||
});
|
||||
it(`${phase}: refuses tentative, analysis and stripped states`, () => {
|
||||
for (const kind of ['tentative', 'analysis', 'stripped']) {
|
||||
const G = position(phase);
|
||||
G.options.showMoney = true;
|
||||
if (kind === 'tentative') G.newTurn = false;
|
||||
if (kind === 'analysis') G.achievementAnalysis = true;
|
||||
if (kind === 'stripped') G.players[2].money = -1;
|
||||
expect(passed(G)).to.equal(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
it('passes full storage, no fuel plants and empty supply without consent', () => {
|
||||
expect(passed(position())).to.equal(true);
|
||||
const full = position();
|
||||
full.players[2].hybridCapacity = 4;
|
||||
full.players[2].coalLeft = 2;
|
||||
full.players[2].oilLeft = 2;
|
||||
expect(passed(full)).to.equal(true);
|
||||
const empty = position();
|
||||
empty.players[2].coalCapacity = 4;
|
||||
empty.coalMarket = 0;
|
||||
expect(passed(empty)).to.equal(true);
|
||||
});
|
||||
it('uses a rich Dijkstra probe and excludes impossible-city sentinels with either stall option', () => {
|
||||
for (const stallEnds of [true, false]) {
|
||||
const G = position(Phase.Building);
|
||||
G.options.stallEnds = stallEnds;
|
||||
G.players[2].cities = [{ name: G.map.cities[0].name, position: 1 }];
|
||||
expect(passed(G)).to.equal(false);
|
||||
G.blockedCities = G.map.cities.map((c) => c.name);
|
||||
expect(passed(G)).to.equal(true);
|
||||
}
|
||||
});
|
||||
it('retains legacy sentinel builds if actually affordable', () => {
|
||||
const G = position(Phase.Building);
|
||||
G.options.stallEnds = false;
|
||||
G.options.showMoney = true;
|
||||
G.blockedCities = G.map.cities.map((c) => c.name);
|
||||
G.players[2].money = 10000;
|
||||
expect(passed(G)).to.equal(false);
|
||||
});
|
||||
it('honors Japan round-one jump limits and the 21-house cap', () => {
|
||||
const G = position(Phase.Building, 'Japan');
|
||||
G.round = 1;
|
||||
G.players[2].cities = [{ name: G.map.startingCities![0], position: 1 }];
|
||||
expect(passed(G)).to.equal(false);
|
||||
G.players[2].usedFreeJump = true;
|
||||
expect(passed(G)).to.equal(true);
|
||||
const capped = position(Phase.Building);
|
||||
capped.players[2].cities = capped.map.cities.slice(0, 21).map((c) => ({ name: c.name, position: 1 }));
|
||||
expect(passed(capped)).to.equal(true);
|
||||
});
|
||||
it('retains free Wien garbage even with zero money and opt-in', () => {
|
||||
const G = position(Phase.Resources, 'Central Europe');
|
||||
G.options.wienFreeGarbage = true;
|
||||
G.players[2].cities = [{ name: 'Wien', position: 1 }];
|
||||
G.players[2].garbageCapacity = 2;
|
||||
G.garbageMarket = 24;
|
||||
wrapper.setPlayerSettings(G, 2, { autoPassResources: true });
|
||||
expect(availableMoves(G, G.players[2]).BuyResource).not.to.equal(undefined);
|
||||
expect(passed(G)).to.equal(false);
|
||||
});
|
||||
for (const map of ['USA', 'South Africa'] as const) {
|
||||
it(`recognizes ${map} off-track coal as a hidden affordability choice`, () => {
|
||||
const G = position(Phase.Resources, map);
|
||||
G.options.variant = 'recharged';
|
||||
G.players[2].coalCapacity = 2;
|
||||
G.coalMarket = 0;
|
||||
G.coalSupply = 2;
|
||||
if (map === 'South Africa') G.coalStorage = 2;
|
||||
expect(passed(G)).to.equal(false);
|
||||
G.coalSupply = 0;
|
||||
if (map === 'South Africa') G.coalStorage = 0;
|
||||
expect(passed(G)).to.equal(true);
|
||||
});
|
||||
}
|
||||
it('respects Korea side locks and Chile network market restrictions', () => {
|
||||
for (const map of ['Korea', 'Chile'] as const) {
|
||||
const G = position(Phase.Resources, map);
|
||||
G.players[2].coalCapacity = 2;
|
||||
G.coalMarket = 0;
|
||||
G.coalMarketNorth = 2;
|
||||
G.chosenSide = 'south';
|
||||
expect(passed(cloneDeep(G))).to.equal(true);
|
||||
G.chosenSide = 'north';
|
||||
expect(passed(G)).to.equal(false);
|
||||
}
|
||||
});
|
||||
it('does not auto-confirm an India resource purchase while it can be undone', async () => {
|
||||
const G = position(Phase.Resources, 'India');
|
||||
G.players[2].coalCapacity = 2;
|
||||
G.players[2].money = 50;
|
||||
G.players[2].availableMoves = availableMoves(G, G.players[2]);
|
||||
const buy = G.players[2].availableMoves!.BuyResource![0];
|
||||
const result = await wrapper.move(G, { name: MoveName.BuyResource, data: buy }, 2);
|
||||
expect(result.chosenResource).to.equal(ResourceType.Coal);
|
||||
expect(result.newTurn).to.equal(false);
|
||||
expect(wrapper.toSave(result)).to.equal(undefined);
|
||||
expect(wrapper.timeIncrements(result)).to.deep.equal([0, 0, 0]);
|
||||
});
|
||||
it('keeps last affordable purchases/builds tentative until explicit Done', async () => {
|
||||
for (const phase of [Phase.Resources, Phase.Building]) {
|
||||
const G = position(phase);
|
||||
G.options.showMoney = true;
|
||||
G.players[2].money = 10;
|
||||
G.players[2].coalCapacity = 1;
|
||||
G.players[2].availableMoves = availableMoves(G, G.players[2]);
|
||||
const input: Move =
|
||||
phase === Phase.Resources
|
||||
? { name: MoveName.BuyResource, data: G.players[2].availableMoves!.BuyResource![0] }
|
||||
: { name: MoveName.Build, data: G.players[2].availableMoves!.Build![0] };
|
||||
const result = await wrapper.move(cloneDeep(G), input, 2);
|
||||
expect(result.newTurn).to.equal(false);
|
||||
expect(result.currentPlayers).to.deep.equal([2]);
|
||||
expect(wrapper.timeIncrements(result)).to.deep.equal([0, 0, 0]);
|
||||
const committed = await wrapper.move(cloneDeep(G), [input, pass], 2);
|
||||
expect(committed.newTurn).to.equal(true);
|
||||
expect(wrapper.timeIncrements(committed)[2]).to.be.greaterThan(0);
|
||||
}
|
||||
});
|
||||
it('interactive analysis never settles publicly impossible resource turns', async () => {
|
||||
const G = position();
|
||||
G.options.showMoney = true;
|
||||
const result = await wrapper.analysisMove(G, pass, 2);
|
||||
expect(result.phase).to.equal(Phase.Resources);
|
||||
expect(result.currentPlayers).to.deep.equal([1]);
|
||||
expect(result.players[1].passed).to.equal(false);
|
||||
});
|
||||
it('settings are strict, private, independent and never advance a turn', () => {
|
||||
const G = position();
|
||||
const before = cloneDeep(G);
|
||||
wrapper.setPlayerSettings(G, 2, { autoPassResources: true, autoPassBuilding: 'true' });
|
||||
expect(wrapper.playerSettings(G, 2)).to.deep.equal({
|
||||
autoPassBids: false,
|
||||
autoPassResources: true,
|
||||
autoPassBuilding: false,
|
||||
});
|
||||
expect(stripSecret(G, 1).players[2].settings).to.equal(undefined);
|
||||
expect(stripSecret(G).players[2].settings).to.equal(undefined);
|
||||
expect(stripSecret(G, 2).players[2].settings!.autoPassResources).to.equal(true);
|
||||
delete G.players[2].settings;
|
||||
expect(G).to.deep.equal(before);
|
||||
});
|
||||
it('settles resources into building and gives queued building/powering precedence', async () => {
|
||||
const G = position();
|
||||
G.options.showMoney = true;
|
||||
automation(G).plans[1] = {
|
||||
round: G.round,
|
||||
revision: 1,
|
||||
requestId: 'queued',
|
||||
phases: [
|
||||
{ phase: Phase.Building, moves: [pass] },
|
||||
{ phase: Phase.Bureaucracy, moves: [pass] },
|
||||
],
|
||||
};
|
||||
const result = await wrapper.move(G, pass, 2);
|
||||
expect(result.phase).to.equal(Phase.Bureaucracy);
|
||||
expect(result.currentPlayers).not.to.include(1);
|
||||
expect(automation(result).plans[1].phases).to.have.length(0);
|
||||
expect(automation(result).plans[1].notice).to.equal('Your queued plants powered cities.');
|
||||
expect(wrapper.timeIncrements(result)).to.deep.equal([2, 3, 2]);
|
||||
expect(wrapper.isLiveUpdate(result)).to.equal(false);
|
||||
const passes = result.log.filter((e) => e.type === 'move');
|
||||
expect(passes).to.have.length(7);
|
||||
for (const entry of passes)
|
||||
if (entry.type === 'move') expect(entry.move.serverTime).to.equal((passes[0] as LogMove).move.serverTime);
|
||||
});
|
||||
it('replays ordinary auto-passes after settings change without re-running policy', async () => {
|
||||
let G = setup(3, { map: 'Germany', variant: 'original', showMoney: true }, 'auto-pass-replay-phases');
|
||||
for (let guard = 0; guard < 20 && G.phase === Phase.Auction; guard++) {
|
||||
const seat = G.currentPlayers[0];
|
||||
const legal = availableMoves(G, G.players[seat]);
|
||||
if (legal.ChoosePowerPlant?.length) {
|
||||
const choose: Move = { name: MoveName.ChoosePowerPlant, data: legal.ChoosePowerPlant[0] };
|
||||
const probe = atomicMove(cloneDeep(G), choose, seat);
|
||||
G = await wrapper.move(
|
||||
G,
|
||||
probe.newTurn === false ? [choose, { name: MoveName.Bid, data: 50 }] : choose,
|
||||
seat
|
||||
);
|
||||
} else {
|
||||
G = await wrapper.move(G, pass, seat);
|
||||
}
|
||||
}
|
||||
for (let guard = 0; guard < 10 && G.phase !== Phase.Bureaucracy; guard++)
|
||||
G = await wrapper.move(G, pass, G.currentPlayers[0]);
|
||||
expect(G.phase).to.equal(Phase.Bureaucracy);
|
||||
expect(G.players.filter((p) => p.money === 0)).to.have.length(2);
|
||||
for (const p of G.players)
|
||||
wrapper.setPlayerSettings(G, p.id, { autoPassResources: true, autoPassBuilding: true });
|
||||
const replay = wrapper.replay(cloneDeep(G));
|
||||
expect(replay.phase).to.equal(G.phase);
|
||||
expect(replay.currentPlayers).to.deep.equal(G.currentPlayers);
|
||||
expect(replay.log).to.deep.equal(G.log);
|
||||
expect(JSON.parse(JSON.stringify(replay.players))).to.deep.equal(JSON.parse(JSON.stringify(G.players)));
|
||||
expect(wrapper.timeIncrements(replay)).to.deep.equal(wrapper.timeIncrements(G));
|
||||
});
|
||||
it('leaves mandatory auction choices and powering manual', () => {
|
||||
for (const phase of [Phase.Auction, Phase.Bureaucracy, Phase.ColorSelection, Phase.RegionSelection]) {
|
||||
expect(passed(position(phase))).to.equal(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
41
engine/src/phase-auto-pass.ts
Normal file
41
engine/src/phase-auto-pass.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { availableMoves, AvailableMoves } from './available-moves';
|
||||
import { move } from './engine';
|
||||
import { GameState, Phase } from './gamestate';
|
||||
import { MoveName } from './move';
|
||||
import { automation } from './premoves';
|
||||
|
||||
function onlyPass(legal: AvailableMoves): boolean {
|
||||
return (
|
||||
!!legal.Pass?.length &&
|
||||
Object.entries(legal).every(([name, values]) => name === MoveName.Pass || !values?.length)
|
||||
);
|
||||
}
|
||||
|
||||
/** Live server policy, never called by replay or interactive analysis. */
|
||||
export function autoPassResourcesAndBuilding(G: GameState, serverTime: number): GameState {
|
||||
// Never commit an undoable purchase/build on behalf of its owner.
|
||||
if (G.newTurn === false || G.achievementAnalysis) return G;
|
||||
if (G.phase !== Phase.Resources && G.phase !== Phase.Building) return G;
|
||||
const setting = G.phase === Phase.Resources ? 'autoPassResources' : 'autoPassBuilding';
|
||||
const seat = G.currentPlayers.find((id) => {
|
||||
const player = G.players[id];
|
||||
if (player.isDropped || !Number.isFinite(player.money) || player.money < 0) return false;
|
||||
if (!onlyPass(availableMoves(G, player))) return false;
|
||||
if (G.options.showMoney || player.settings?.[setting] === true) return true;
|
||||
// These phases enumerate resources/cities, never one bid per Elektro.
|
||||
// Read-only copies keep both money and options untouched. In the public
|
||||
// impossibility probe, exclude the historical 9999 "unbuildable" sentinel
|
||||
// even in legacy games without stallEnds. Actual legal moves above still
|
||||
// take precedence, including legacy builds bought for >=9999.
|
||||
const probe = { ...G, options: { ...G.options, stallEnds: true } };
|
||||
return onlyPass(availableMoves(probe, { ...player, money: Number.MAX_SAFE_INTEGER }));
|
||||
});
|
||||
if (seat === undefined) return G;
|
||||
G.players[seat].availableMoves = availableMoves(G, G.players[seat]);
|
||||
// Ordinary Pass only: neither the private setting nor the reason is logged.
|
||||
G = move(G, { name: MoveName.Pass, data: true, serverTime }, seat);
|
||||
automation(G).increments[seat]++;
|
||||
automation(G).liveUpdate = false;
|
||||
// Yield after each turn so a newly current player's queued phase runs first.
|
||||
return G;
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import { playersSortedByScore } from './src/engine';
|
|||
import { GameOptions, Phase } from './src/gamestate';
|
||||
import type { LogMove } from './src/log';
|
||||
import { Move, MoveName } from './src/move';
|
||||
import { autoPassResourcesAndBuilding } from './src/phase-auto-pass';
|
||||
import {
|
||||
automation,
|
||||
canManagePremoves,
|
||||
|
|
@ -42,24 +43,40 @@ export function setPlayerMetaData(G: GameState, player: number, metaData: { name
|
|||
}
|
||||
|
||||
export function setPlayerSettings(G: GameState, player: number, settings: Record<string, unknown>): GameState {
|
||||
if (G.players[player]) G.players[player].settings = { autoPassBids: settings.autoPassBids === true };
|
||||
if (G.players[player])
|
||||
G.players[player].settings = {
|
||||
autoPassBids: settings.autoPassBids === true,
|
||||
autoPassResources: settings.autoPassResources === true,
|
||||
autoPassBuilding: settings.autoPassBuilding === true,
|
||||
};
|
||||
// The host settings endpoint only persists preferences: it does not advance
|
||||
// turns or clocks. Apply automation after the next committed game move.
|
||||
return G;
|
||||
}
|
||||
|
||||
export function playerSettings(G: GameState, player: number): Record<string, unknown> {
|
||||
return { autoPassBids: G.players[player]?.settings?.autoPassBids === true };
|
||||
return {
|
||||
autoPassBids: G.players[player]?.settings?.autoPassBids === true,
|
||||
autoPassResources: G.players[player]?.settings?.autoPassResources === true,
|
||||
autoPassBuilding: G.players[player]?.settings?.autoPassBuilding === true,
|
||||
};
|
||||
}
|
||||
|
||||
function runAutomaticMoves(G: GameState, now: number): GameState {
|
||||
// Premoves can finish upkeep and enter a new auction round; passing can enter
|
||||
// Resources. Settle both in order without re-running them inside replay.
|
||||
G = advanceDroppedPlayers(G);
|
||||
G = autoPassAuctions(G, now);
|
||||
G = runPremoves(G, now);
|
||||
G = autoPassAuctions(G, now);
|
||||
return advanceDroppedPlayers(runPremoves(G, now));
|
||||
if (G.newTurn === false || G.achievementAnalysis) return G;
|
||||
// Settle to a fixed point: queued powering can enter auctions, whose passes
|
||||
// can enter resources, whose passes can unlock another queued building turn.
|
||||
// Run submitted plans first so an automatic Pass cannot supersede them.
|
||||
for (let guard = 0; guard < MAX_AUTO_MOVES; guard++) {
|
||||
const before = G.log.length + (G.hiddenLog?.length ?? 0);
|
||||
G = advanceDroppedPlayers(G);
|
||||
G = runPremoves(G, now);
|
||||
G = autoPassAuctions(G, now);
|
||||
G = autoPassResourcesAndBuilding(G, now);
|
||||
const after = G.log.length + (G.hiddenLog?.length ?? 0);
|
||||
if (after === before) return G;
|
||||
}
|
||||
throw new Error('Automatic moves did not settle');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,5 +4,17 @@
|
|||
"label": "Auto-pass auctions I cannot afford (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "autoPassResources",
|
||||
"label": "Auto-pass resources I cannot afford (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "autoPassBuilding",
|
||||
"label": "Auto-pass building when I cannot afford a city (always on with public money)",
|
||||
"type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -65,3 +65,36 @@ When the only human of a game plays against bots, BGS can take back their last s
|
|||
The viewer accepts BGS's `colorBlind` boolean preference (default `false`). The eye button on the board changes it through `update:preference`, so BGS saves the setting across games. It also works locally in tutorials.
|
||||
|
||||
When enabled, houses on the map, turn-order track and city-count track carry their owner's seat number. Player panels use the same number, regardless of turn order or selected color. City rims use contrasting dash and dot patterns to distinguish map regions without extra labels. Each region keeps its pattern after region selection. Resources already use different shapes.
|
||||
|
||||
### Local phase auto-pass preview (no BGS connection)
|
||||
|
||||
From the repository root, build the engine and viewer, then start the preview:
|
||||
|
||||
```sh
|
||||
pnpm --dir engine build
|
||||
NODE_OPTIONS=--openssl-legacy-provider pnpm --dir viewer exec vue-cli-service build --target lib --name powergrid-viewer src/wrapper.ts
|
||||
node viewer/scripts/auction-preview.mjs
|
||||
```
|
||||
|
||||
Open <http://127.0.0.1:5216/?mode=fuel-hidden> (or `?mode=city-hidden`).
|
||||
The scenario selector also offers public-money versions and an empty oil market.
|
||||
Toggle the checkbox in **your** player card, then click Ada's action in the top
|
||||
bar. Ada takes the last affordable oil/city and finishes via the real engine
|
||||
wrapper. Hidden money without opt-in retains your turn; opt-in or public money
|
||||
skips it. An empty oil market skips even with hidden money and opt-in disabled,
|
||||
because the impossibility is public. Reset before comparing scenarios.
|
||||
Preferences persist through the wrapper's private player-settings API; no
|
||||
client-side auto-pass simulation is used. Preview state is held in memory only.
|
||||
|
||||
Run the eight browser scenarios after building:
|
||||
|
||||
```sh
|
||||
node viewer/scripts/phase-auto-pass-smoke.mjs
|
||||
node viewer/scripts/auto-pass-label-smoke.mjs
|
||||
```
|
||||
|
||||
The label smoke checks all 17 languages at 390px and 1400px, switching phases
|
||||
and locales live and checking left alignment, checkbox clearance and row bounds.
|
||||
To verify a published viewer, set `POWERGRID_VIEWER_URL` to its public
|
||||
`powergrid-viewer.umd.min.js` URL when running either smoke. Only viewer assets
|
||||
are fetched from the CDN; game state, moves and settings remain local in memory.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "powergrid-viewer",
|
||||
"version": "2.3.31",
|
||||
"version": "2.3.32",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/boardgamers/powergrid.git",
|
||||
|
|
|
|||
|
|
@ -46,23 +46,55 @@ function position(mode) {
|
|||
);
|
||||
G.powerPlantsDeck = G.powerPlantsDeck.filter((p) => !visible.has(p.number));
|
||||
G.cardsLeft = G.powerPlantsDeck.length;
|
||||
if (mode.startsWith('fuel-') || mode.startsWith('city-')) {
|
||||
G.phase = mode.startsWith('fuel-') ? engine.Phase.Resources : engine.Phase.Building;
|
||||
G.playerOrder = [1, 0, 2]; // Reverse-order phases: Ada, you, Leo.
|
||||
G.currentPlayers = [2];
|
||||
if (G.phase === engine.Phase.Resources) {
|
||||
G.players[0].money = 1;
|
||||
G.players[0].oilCapacity = 4;
|
||||
G.oilMarket = mode.includes('impossible') ? 0 : 22; // One $1 oil, then $2.
|
||||
G.players[2].oilCapacity = 4;
|
||||
} else {
|
||||
// Find a starting network with one uniquely cheapest expansion.
|
||||
for (const city of G.map.cities) {
|
||||
G.players[0].cities = [{ name: city.name, position: 0 }];
|
||||
G.players[0].money = 1000;
|
||||
const choices = (engine.availableMoves(G, G.players[0]).Build || []).sort((a, b) => a.price - b.price);
|
||||
if (choices.length > 1 && choices[0].price < choices[1].price) {
|
||||
G.players[0].money = choices[0].price;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (engine.availableMoves(G, G.players[0]).Build?.length !== 1)
|
||||
throw Error('Preview needs a unique affordable city.');
|
||||
}
|
||||
}
|
||||
const activePlayer = G.players[G.currentPlayers[0]];
|
||||
activePlayer.availableMoves = engine.availableMoves(G, activePlayer);
|
||||
G.log.push({
|
||||
type: 'event',
|
||||
event: yourTurn ? 'Your turn to start an auction.' : 'Waiting for Ada to start an auction.',
|
||||
event: mode.startsWith('fuel-')
|
||||
? 'Waiting for Ada to finish buying resources.'
|
||||
: mode.startsWith('city-')
|
||||
? 'Waiting for Ada to finish building.'
|
||||
: yourTurn
|
||||
? 'Your turn to start an auction.'
|
||||
: 'Waiting for Ada to start an auction.',
|
||||
});
|
||||
G.newTurn = true;
|
||||
return G;
|
||||
}
|
||||
const states = new Map();
|
||||
const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Power Grid · Auction auto-pass preview</title><link rel="stylesheet" href="/bundle.css"><style>body{margin:0;background:#e8ebdf;font-family:system-ui}.preview{display:flex;gap:12px;align-items:center;flex-wrap:wrap;background:#173b32;color:#fff;padding:10px 16px;font-size:13px}.preview button,.preview select{font:inherit;padding:7px}.preview a{color:white}.hint{font-size:13px;padding:8px 16px;margin:0;background:#edf1e8;color:#253b2c}#error{color:#9e1515}#error:empty{display:none}</style></head><body><header class="preview"><strong>Local preview</strong><select id="mode" aria-label="Auction scenario"><option value="your-turn">Your turn · start an auction</option><option value="only-pass">Your turn · only passing is possible</option><option value="resources">Your turn · buy resources</option><option value="building">Your turn · build cities</option><option value="powering">Your turn · activate plants</option><option value="public">Public money · open auction</option><option value="hidden">Hidden money · open auction</option><option value="public-sealed">Public money · sealed auction</option><option value="hidden-sealed">Hidden money · sealed auction</option></select><button id="opponent">Ada bids 10</button><button id="reset">Reset</button><a href="/mobile">Mobile preview</a></header><p class="hint">You have 10. With hidden money, try the auto-pass checkbox in your player card before Ada bids.</p><p id="error" role="alert"></p><div id="app"></div><script src="/vue.js"></script><script src="/bundle.js"></script><script>
|
||||
const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Power Grid · Auction auto-pass preview</title><link rel="stylesheet" href="/bundle.css"><style>body{margin:0;background:#e8ebdf;font-family:system-ui}.preview{display:flex;gap:12px;align-items:center;flex-wrap:wrap;background:#173b32;color:#fff;padding:10px 16px;font-size:13px}.preview button,.preview select{font:inherit;padding:7px}.preview a{color:white}.hint{font-size:13px;padding:8px 16px;margin:0;background:#edf1e8;color:#253b2c}#error{color:#9e1515}#error:empty{display:none}</style></head><body><header class="preview"><strong>Local preview</strong><select id="mode" aria-label="Auction scenario"><option value="fuel-hidden">Hidden money · last affordable fuel</option><option value="fuel-public">Public money · last affordable fuel</option><option value="fuel-hidden-impossible">Hidden money · empty oil market</option><option value="fuel-public-impossible">Public money · empty oil market</option><option value="city-hidden">Hidden money · last affordable city</option><option value="city-public">Public money · last affordable city</option><option value="your-turn">Your turn · start an auction</option><option value="only-pass">Your turn · only passing is possible</option><option value="resources">Your turn · buy resources</option><option value="building">Your turn · build cities</option><option value="powering">Your turn · activate plants</option><option value="public">Public money · open auction</option><option value="hidden">Hidden money · open auction</option><option value="public-sealed">Public money · sealed auction</option><option value="hidden-sealed">Hidden money · sealed auction</option></select><button id="opponent">Ada bids 10</button><button id="reset">Reset</button><a href="/mobile">Mobile preview</a></header><p class="hint">You have 10. With hidden money, try the auto-pass checkbox in your player card before Ada bids.</p><p id="error" role="alert"></p><div id="app"></div><script src="/vue.js"></script><script src="/bundle.js"></script><script>
|
||||
const query=new URLSearchParams(location.search),mode=query.get('mode')||'public';
|
||||
const host=window.host=powergrid.launch('#app');
|
||||
document.querySelector('#mode').value=mode;
|
||||
document.querySelector('a[href="/mobile"]').href='/mobile?mode='+encodeURIComponent(mode);
|
||||
if(mode==='only-pass')document.querySelector('.hint').textContent='You have 1. No plant is affordable, so passing is the only legal action.';
|
||||
if(mode==='building')document.querySelector('.hint').textContent='Build a city to change skip to confirm. Undo all builds to restore skip.';
|
||||
if(mode==='powering')document.querySelector('.hint').textContent='Activate your oil plant to change skip to confirm. Hover its border to see the white highlight.';
|
||||
if(mode.startsWith('fuel-')||mode.startsWith('city-'))document.querySelector('.hint').textContent=mode.includes('impossible')?'No oil is left: you are skipped even with hidden money and auto-pass off. Click Ada passes.':'Ada will take your last affordable '+(mode.startsWith('fuel-')?'oil cube':'city')+'. Toggle auto-pass in your card first. Hidden money keeps your turn unless you opt in; public money always skips. Reset to compare.';
|
||||
document.querySelector('#mode').onchange=e=>{query.set('mode',e.target.value);location.search='?'+query;};
|
||||
async function send(path,body){const response=await fetch(path+'?mode='+mode,{method:body?'POST':'GET',headers:{'Content-Type':'application/json'},body:body?JSON.stringify(body):undefined});const data=await response.json();document.querySelector('#error').textContent=data.error||'';if(data.error)return;host.emit('settings',data.settings);host.emit('state',data.state);const button=document.querySelector('#opponent');button.textContent=data.next;button.disabled=!data.opponent;}
|
||||
host.on('fetchState',()=>send('/state'));host.on('move',move=>send('/move',{move}));host.on('update:setting',setting=>send('/setting',setting));
|
||||
|
|
@ -71,6 +103,13 @@ host.emit('player',{index:0});host.emit('preferences',{sound:false,textActions:q
|
|||
document.querySelector('#opponent').onclick=()=>send('/opponent',{});document.querySelector('#reset').onclick=()=>send('/reset',{});send('/state');
|
||||
</script></body></html>`;
|
||||
export function auctionPreviewServer() {
|
||||
// Optional public CDN assets; all state/settings/moves still stay local.
|
||||
const viewerUrl = process.env.POWERGRID_VIEWER_URL;
|
||||
const page = viewerUrl
|
||||
? html
|
||||
.replace('src="/bundle.js"', `src="${new URL(viewerUrl).href}"`)
|
||||
.replace('href="/bundle.css"', `href="${new URL('powergrid-viewer.css', viewerUrl).href}"`)
|
||||
: html;
|
||||
return createServer(async (req, res) => {
|
||||
const url = new URL(req.url, 'http://localhost');
|
||||
const mode = url.searchParams.get('mode') || 'public';
|
||||
|
|
@ -79,7 +118,9 @@ export function auctionPreviewServer() {
|
|||
if (url.pathname === '/mobile') {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
return res.end(
|
||||
'<!doctype html><meta name="viewport" content="width=device-width,initial-scale=1"><title>Power Grid · Mobile auction preview</title><style>body{margin:0;background:#202b24;display:grid;justify-content:center}iframe{width:390px;max-width:100vw;height:100dvh;border:0}</style><iframe title="Mobile auction preview" src="/?mode=hidden"></iframe>'
|
||||
'<!doctype html><meta name="viewport" content="width=device-width,initial-scale=1"><title>Power Grid · Mobile auction preview</title><style>body{margin:0;background:#202b24;display:grid;justify-content:center}iframe{width:390px;max-width:100vw;height:100dvh;border:0}</style><iframe title="Mobile auction preview" src="/?mode=' +
|
||||
encodeURIComponent(mode) +
|
||||
'"></iframe>'
|
||||
);
|
||||
}
|
||||
const files = {
|
||||
|
|
@ -98,7 +139,7 @@ export function auctionPreviewServer() {
|
|||
? 'text/css'
|
||||
: 'text/html'
|
||||
);
|
||||
return res.end(files[url.pathname] ? await readFile(files[url.pathname]) : html);
|
||||
return res.end(files[url.pathname] ? await readFile(files[url.pathname]) : page);
|
||||
}
|
||||
if (!states.has(mode)) states.set(mode, position(mode));
|
||||
let state = states.get(mode);
|
||||
|
|
@ -108,7 +149,10 @@ export function auctionPreviewServer() {
|
|||
const body = JSON.parse(raw || '{}');
|
||||
if (url.pathname === '/reset') state = position(mode);
|
||||
else if (url.pathname === '/setting')
|
||||
state = wrapper.setPlayerSettings(copy(state), 0, { [body.name]: body.value });
|
||||
state = wrapper.setPlayerSettings(copy(state), 0, {
|
||||
...wrapper.playerSettings(state, 0),
|
||||
[body.name]: body.value,
|
||||
});
|
||||
else if (url.pathname === '/move') {
|
||||
if (!state.currentPlayers.includes(0) && !wrapper.canMoveOutOfTurn(state, body.move, 0))
|
||||
throw Error('Not your turn.');
|
||||
|
|
@ -128,7 +172,32 @@ export function auctionPreviewServer() {
|
|||
} else if (url.pathname === '/opponent') {
|
||||
const seat = state.currentPlayers.find((p) => p !== 0);
|
||||
if (seat === undefined) throw Error('It is your turn.');
|
||||
if (state.phase === engine.Phase.Auction && !state.chosenPowerPlant && seat === 2) {
|
||||
if (seat === 2 && mode.startsWith('fuel-') && !mode.includes('impossible')) {
|
||||
const buy = engine
|
||||
.availableMoves(state, state.players[seat])
|
||||
.BuyResource.find((r) => r.resource === 'oil');
|
||||
state = await wrapper.move(
|
||||
copy(state),
|
||||
[
|
||||
{ name: 'BuyResource', data: buy },
|
||||
{ name: 'Pass', data: true },
|
||||
],
|
||||
seat
|
||||
);
|
||||
} else if (seat === 2 && mode.startsWith('city-')) {
|
||||
const target = engine.availableMoves(state, state.players[0]).Build[0];
|
||||
const build = engine
|
||||
.availableMoves(state, state.players[seat])
|
||||
.Build.find((c) => c.name === target.name);
|
||||
state = await wrapper.move(
|
||||
copy(state),
|
||||
[
|
||||
{ name: 'Build', data: build },
|
||||
{ name: 'Pass', data: true },
|
||||
],
|
||||
seat
|
||||
);
|
||||
} else if (state.phase === engine.Phase.Auction && !state.chosenPowerPlant && seat === 2) {
|
||||
state = await wrapper.move(
|
||||
copy(state),
|
||||
[
|
||||
|
|
@ -151,6 +220,10 @@ export function auctionPreviewServer() {
|
|||
next:
|
||||
opponent === undefined
|
||||
? 'Your turn'
|
||||
: opponent === 2 && mode.startsWith('fuel-') && !mode.includes('impossible')
|
||||
? 'Ada buys the last $1 oil and finishes'
|
||||
: opponent === 2 && mode.startsWith('city-')
|
||||
? 'Ada builds your last affordable city and finishes'
|
||||
: state.chosenPowerPlant || state.phase !== engine.Phase.Auction
|
||||
? state.players[opponent].name + ' passes'
|
||||
: 'Ada bids ' + (state.options.fastBid ? 17 : 10),
|
||||
|
|
|
|||
84
viewer/scripts/auto-pass-label-smoke.mjs
Normal file
84
viewer/scripts/auto-pass-label-smoke.mjs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
// Build the viewer library first. Exercise real DOM localization and glyph bounds.
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile, readdir } from 'node:fs/promises';
|
||||
import { chromium } from 'playwright';
|
||||
import { auctionPreviewServer } from './auction-preview.mjs';
|
||||
const server = auctionPreviewServer();
|
||||
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_EXECUTABLE });
|
||||
const directory = new URL('../src/localization/', import.meta.url);
|
||||
let smallest = { font: Infinity };
|
||||
let checks = 0;
|
||||
try {
|
||||
for (const width of [390, 1400]) {
|
||||
const page = await browser.newPage({ viewport: { width, height: 900 } });
|
||||
const errors = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
await page.goto(`${base}/?mode=fuel-hidden`);
|
||||
await page.locator('[data-auto-pass-setting]').waitFor();
|
||||
for (const file of (await readdir(directory)).filter((name) => name.endsWith('.json'))) {
|
||||
const locale = file.slice(0, -5);
|
||||
const catalog = JSON.parse(await readFile(new URL(file, directory), 'utf8'));
|
||||
await page.evaluate((locale) => host.emit('preferences', { locale, sound: false }), locale);
|
||||
for (const [mode, phase] of [
|
||||
['hidden', 'auction'],
|
||||
['fuel-hidden', 'resources'],
|
||||
['city-hidden', 'building'],
|
||||
['fuel-hidden', 'resources'],
|
||||
]) {
|
||||
const data = await (await fetch(`${base}/state?mode=${mode}`)).json();
|
||||
await page.evaluate((data) => {
|
||||
host.emit('settings', data.settings);
|
||||
host.emit('state', data.state);
|
||||
}, data);
|
||||
const expected = catalog[`Auto-pass if unaffordable (${phase})`];
|
||||
await page.waitForFunction((expected) => {
|
||||
const control = document.querySelector('[data-auto-pass-setting]');
|
||||
return (
|
||||
control?.getAttribute('aria-label') === expected &&
|
||||
control.querySelector('[data-action-label]')?.textContent === expected
|
||||
);
|
||||
}, expected);
|
||||
await page.waitForTimeout(100);
|
||||
const bounds = await page.locator('[data-auto-pass-setting]').evaluate((control) => {
|
||||
const label = control.querySelector('[data-action-label]');
|
||||
const box = label.getBBox();
|
||||
const hit = control.querySelector('.auto-pass-hit').getBoundingClientRect();
|
||||
const rendered = label.getBoundingClientRect();
|
||||
const checkbox = control.querySelector('rect[x="10"]').getBoundingClientRect();
|
||||
return {
|
||||
font: Number(label.getAttribute('font-size')),
|
||||
x: box.x + 29,
|
||||
y: box.y,
|
||||
right: box.x + box.width + 29,
|
||||
bottom: box.y + box.height,
|
||||
inside:
|
||||
rendered.left >= hit.left &&
|
||||
rendered.right <= hit.right + 0.1 &&
|
||||
rendered.top >= hit.top &&
|
||||
rendered.bottom <= hit.bottom + 0.1,
|
||||
gap: rendered.left - checkbox.right,
|
||||
};
|
||||
});
|
||||
assert.ok(bounds.inside && bounds.gap > 0, `${locale}/${width}/${phase}: ${JSON.stringify(bounds)}`);
|
||||
assert.ok(
|
||||
bounds.x >= 35.8 && bounds.right <= 342.2 && bounds.y >= 0 && bounds.bottom <= 36,
|
||||
`reserved 36px row; checkbox and right padding: ${locale}/${phase} ${JSON.stringify(bounds)}`
|
||||
);
|
||||
if (bounds.font < smallest.font) smallest = { ...bounds, locale, width, phase };
|
||||
checks++;
|
||||
}
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
await page.close();
|
||||
}
|
||||
console.log(
|
||||
`Auto-pass labels: ${checks} phase/locale/viewport checks passed (17 locales, 390/1400px, live phase and locale switching). Smallest: ${JSON.stringify(
|
||||
smallest
|
||||
)}`
|
||||
);
|
||||
} finally {
|
||||
await browser.close();
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
86
viewer/scripts/phase-auto-pass-smoke.mjs
Normal file
86
viewer/scripts/phase-auto-pass-smoke.mjs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
// Build engine and viewer first; exercises the same wrapper-backed interactive demo.
|
||||
import assert from 'node:assert/strict';
|
||||
import { chromium } from 'playwright';
|
||||
import { auctionPreviewServer } from './auction-preview.mjs';
|
||||
const server = auctionPreviewServer();
|
||||
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_EXECUTABLE });
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
const errors = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
for (const phase of ['fuel', 'city']) {
|
||||
const setting = phase === 'fuel' ? 'autoPassResources' : 'autoPassBuilding';
|
||||
for (const [money, optIn] of [
|
||||
['hidden', false],
|
||||
['hidden', true],
|
||||
['public', false],
|
||||
]) {
|
||||
const mode = `${phase}-${money}`;
|
||||
await fetch(`${base}/reset?mode=${mode}`, { method: 'POST', body: '{}' });
|
||||
await page.goto(`${base}/?mode=${mode}`);
|
||||
const control = page.locator(`[data-auto-pass-setting="${setting}"]`);
|
||||
await control.waitFor();
|
||||
assert.equal(await page.locator('[data-auto-pass-setting]').count(), 1, 'own-player only');
|
||||
assert.match(
|
||||
await control.locator('title').textContent(),
|
||||
money === 'public' ? /Always on/ : /reveal hidden money/
|
||||
);
|
||||
assert.equal(await control.getAttribute('role'), money === 'public' ? 'note' : 'checkbox');
|
||||
if (optIn) {
|
||||
const saved = page.waitForResponse((r) => r.url().includes('/setting'));
|
||||
await control.focus();
|
||||
await page.keyboard.press('Space');
|
||||
const data = await (await saved).json();
|
||||
assert.equal(data.settings[setting], true);
|
||||
await page.waitForFunction(
|
||||
(s) =>
|
||||
document.querySelector(`[data-auto-pass-setting="${s}"]`)?.getAttribute('aria-checked') ===
|
||||
'true',
|
||||
setting
|
||||
);
|
||||
}
|
||||
const moved = page.waitForResponse((r) => r.url().includes('/opponent'));
|
||||
await page.locator('#opponent').click();
|
||||
const data = await (await moved).json();
|
||||
assert.equal(data.error, undefined);
|
||||
assert.equal(
|
||||
data.state.currentPlayers.includes(0),
|
||||
money === 'hidden' && !optIn,
|
||||
`${mode} opt-in ${optIn}`
|
||||
);
|
||||
assert.equal(await page.locator('#error').textContent(), '');
|
||||
}
|
||||
}
|
||||
for (const money of ['hidden', 'public']) {
|
||||
const mode = `fuel-${money}-impossible`;
|
||||
await fetch(`${base}/reset?mode=${mode}`, { method: 'POST', body: '{}' });
|
||||
await page.goto(`${base}/?mode=${mode}`);
|
||||
await page.locator('[data-auto-pass-setting]').waitFor();
|
||||
const moved = page.waitForResponse((r) => r.url().includes('/opponent'));
|
||||
await page.locator('#opponent').click();
|
||||
const data = await (await moved).json();
|
||||
assert.equal(data.error, undefined);
|
||||
assert.equal(data.state.currentPlayers.includes(0), false, 'public impossibility skips without opt-in');
|
||||
assert.equal(data.settings.autoPassResources, false);
|
||||
}
|
||||
// The wrapper replaces the entire settings object. The preview, like the
|
||||
// host's serialized updateGameSetting helper, must merge individual edits.
|
||||
await fetch(`${base}/reset?mode=fuel-hidden`, { method: 'POST', body: '{}' });
|
||||
for (const name of ['autoPassBids', 'autoPassBuilding', 'autoPassResources']) {
|
||||
const response = await fetch(`${base}/setting?mode=fuel-hidden`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, value: true }),
|
||||
});
|
||||
const data = await response.json();
|
||||
assert.deepEqual(data.state.currentPlayers, [2], 'setting write must not advance turns');
|
||||
}
|
||||
const preserved = await (await fetch(`${base}/state?mode=fuel-hidden`)).json();
|
||||
assert.deepEqual(preserved.settings, { autoPassBids: true, autoPassResources: true, autoPassBuilding: true });
|
||||
assert.deepEqual(errors, []);
|
||||
console.log('Phase auto-pass browser smoke: 8 wrapper-backed scenarios passed.');
|
||||
} finally {
|
||||
await browser.close();
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
|
|
@ -620,8 +620,10 @@
|
|||
:phase="G.phase"
|
||||
:isAustralia="G.map.name === 'Australia'"
|
||||
:showAutoPass="player == playerIndex && showAutoPass"
|
||||
:autoPass="!!G.options.showMoney || !!(settings && settings.autoPassBids)"
|
||||
:reserveAutoPass="player == playerIndex && reserveAutoPass"
|
||||
:autoPass="!!G.options.showMoney || !!(settings && settings[autoPassSetting])"
|
||||
:autoPassPublic="!!G.options.showMoney"
|
||||
:autoPassSetting="autoPassSetting"
|
||||
:autoPassDisabled="!canEditAuctionSettings"
|
||||
@toggleAutoPass="toggleAutoPass()"
|
||||
@powerPlantClick="powerPlantClick($event)"
|
||||
|
|
@ -1334,8 +1336,21 @@ export default class Game extends Vue {
|
|||
this.analysisMoneyError = 'Analysis money update failed. Please try again.';
|
||||
}
|
||||
|
||||
get autoPassSetting(): string {
|
||||
if (this.G?.phase === Phase.Resources) return 'autoPassResources';
|
||||
if (this.G?.phase === Phase.Building) return 'autoPassBuilding';
|
||||
return 'autoPassBids';
|
||||
}
|
||||
|
||||
get showAutoPass(): boolean {
|
||||
return !!this.G && this.reserveAutoPass && [Phase.Auction, Phase.Resources, Phase.Building].includes(this.G.phase);
|
||||
}
|
||||
|
||||
// Reserve the own-player preference row across phases, even when no setting
|
||||
// applies. Hiding its control must not move the map or subsequent boards.
|
||||
get reserveAutoPass(): boolean {
|
||||
return (
|
||||
!!this.G &&
|
||||
!this.tutorialMove &&
|
||||
!this.preferences.analysis &&
|
||||
this.player != null &&
|
||||
|
|
@ -1356,7 +1371,7 @@ export default class Game extends Vue {
|
|||
}
|
||||
toggleAutoPass() {
|
||||
if (this.canEditAuctionSettings)
|
||||
this.emitter.emit('update:setting', { name: 'autoPassBids', value: !this.settings?.autoPassBids });
|
||||
this.emitter.emit('update:setting', { name: this.autoPassSetting, value: !this.settings?.[this.autoPassSetting] });
|
||||
}
|
||||
|
||||
@Prop()
|
||||
|
|
@ -3309,7 +3324,7 @@ export default class Game extends Vue {
|
|||
map: this.G?.map,
|
||||
players: this.G?.players.length,
|
||||
locale: this.preferences.locale,
|
||||
auctionSettings: this.showAutoPass,
|
||||
auctionSettings: this.reserveAutoPass,
|
||||
});
|
||||
if (!this.shouldStack() && !this.stacked && desktopKey === this.desktopLayoutKey) return;
|
||||
|
||||
|
|
@ -3542,7 +3557,7 @@ export default class Game extends Vue {
|
|||
@Watch('G')
|
||||
@Watch('layoutPreferencesKey')
|
||||
@Watch('hasPlanPanel')
|
||||
@Watch('showAutoPass')
|
||||
@Watch('reserveAutoPass')
|
||||
onSceneContentChanged() {
|
||||
this.scheduleRelayout();
|
||||
}
|
||||
|
|
@ -3553,7 +3568,7 @@ export default class Game extends Vue {
|
|||
|
||||
playerBoardOffset(index: number): number {
|
||||
const ownIndex = this.player == null ? -1 : this.adjustedPlayerOrder.indexOf(this.player);
|
||||
const extraHeight = this.showAutoPass && ownIndex >= 0 && ownIndex < index ? PLAYER_SETTING_ROW_HEIGHT : 0;
|
||||
const extraHeight = this.reserveAutoPass && ownIndex >= 0 && ownIndex < index ? PLAYER_SETTING_ROW_HEIGHT : 0;
|
||||
return 110 * index + extraHeight;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<g class="player-board">
|
||||
<rect
|
||||
width="350"
|
||||
:height="100 + (showAutoPass ? settingRowHeight : 0)"
|
||||
:height="100 + (reserveAutoPass || showAutoPass ? settingRowHeight : 0)"
|
||||
x="0"
|
||||
y="0"
|
||||
fill="gold"
|
||||
|
|
@ -76,12 +76,13 @@
|
|||
class="auction-auto-pass"
|
||||
:class="{ editable: !autoPassDisabled }"
|
||||
transform="translate(0, 100)"
|
||||
data-auction-auto-pass
|
||||
:data-auction-auto-pass="autoPassSetting === 'autoPassBids' ? '' : undefined"
|
||||
:data-auto-pass-setting="autoPassSetting"
|
||||
:role="autoPassPublic ? 'note' : 'checkbox'"
|
||||
:aria-checked="autoPassPublic ? undefined : String(autoPass)"
|
||||
:aria-disabled="autoPassDisabled ? 'true' : 'false'"
|
||||
:tabindex="autoPassPublic || autoPassDisabled ? -1 : 0"
|
||||
aria-label="Auto-pass if unaffordable"
|
||||
:aria-label="autoPassLabel"
|
||||
@click="!autoPassDisabled && $emit('toggleAutoPass')"
|
||||
@keydown.enter.prevent="!autoPassDisabled && $emit('toggleAutoPass')"
|
||||
@keydown.space.prevent="!autoPassDisabled && $emit('toggleAutoPass')"
|
||||
|
|
@ -98,12 +99,23 @@
|
|||
stroke="#304b3b"
|
||||
/>
|
||||
<path v-if="autoPass" d="M14 18L18 22L24 14" fill="none" stroke="white" stroke-width="2" />
|
||||
<text x="37" y="18" fill="#24382b" style="font: 16px Arial, sans-serif; dominant-baseline: central"
|
||||
>Auto-pass if unaffordable</text
|
||||
>
|
||||
<g transform="translate(29, 0)">
|
||||
<ActionLabel
|
||||
:text="autoPassLabel"
|
||||
align="left"
|
||||
:width="321"
|
||||
:height="settingRowHeight"
|
||||
:maxFontSize="16"
|
||||
style="font-family: Arial, sans-serif; fill: #24382b"
|
||||
/>
|
||||
</g>
|
||||
<title>
|
||||
{{
|
||||
autoPassPublic
|
||||
autoPassSetting !== 'autoPassBids'
|
||||
? autoPassPublic
|
||||
? 'Money is public: automatically pass when no resource or city can be bought. Always on.'
|
||||
: 'Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.'
|
||||
: autoPassPublic
|
||||
? 'Money is public: players automatically pass auctions they cannot afford.'
|
||||
: 'Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.'
|
||||
}}
|
||||
|
|
@ -240,9 +252,11 @@ import { Preferences } from '../types/ui-data';
|
|||
import { formatDuration } from '../util/time';
|
||||
import { PLAYER_SETTING_ROW_HEIGHT } from '../util/board-layout';
|
||||
import { Coal, Oil, Garbage, Uranium, Card } from './pieces';
|
||||
import ActionLabel from './buttons/ActionLabel.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
ActionLabel,
|
||||
Coal,
|
||||
Oil,
|
||||
Garbage,
|
||||
|
|
@ -267,6 +281,8 @@ export default class PlayerBoard extends Vue {
|
|||
@Prop() phase?: Phase;
|
||||
// Australia: uranium plants are "mines" — flag so the hand marks them distinctly.
|
||||
@Prop() isAustralia?: boolean;
|
||||
@Prop({ default: 'autoPassBids' }) autoPassSetting!: string;
|
||||
@Prop({ default: false }) reserveAutoPass!: boolean;
|
||||
@Prop({ default: false }) showAutoPass!: boolean;
|
||||
@Prop({ default: false }) autoPass!: boolean;
|
||||
@Prop({ default: false }) autoPassPublic!: boolean;
|
||||
|
|
@ -274,6 +290,12 @@ export default class PlayerBoard extends Vue {
|
|||
|
||||
settingRowHeight = PLAYER_SETTING_ROW_HEIGHT;
|
||||
|
||||
get autoPassLabel() {
|
||||
if (this.autoPassSetting === 'autoPassResources') return 'Auto-pass if unaffordable (resources)';
|
||||
if (this.autoPassSetting === 'autoPassBuilding') return 'Auto-pass if unaffordable (building)';
|
||||
return 'Auto-pass if unaffordable (auction)';
|
||||
}
|
||||
|
||||
@Inject() preferences!: Preferences;
|
||||
|
||||
get supporterBadge() {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
<text
|
||||
ref="label"
|
||||
data-action-label
|
||||
:x="width / 2"
|
||||
:x="align === 'left' ? 8 : width / 2"
|
||||
:y="height / 2"
|
||||
text-anchor="middle"
|
||||
:text-anchor="align === 'left' ? 'start' : 'middle'"
|
||||
:direction="align === 'left' ? 'ltr' : undefined"
|
||||
dominant-baseline="central"
|
||||
:font-size="fontSize"
|
||||
fill="black"
|
||||
|
|
@ -23,6 +24,8 @@ export default class ActionLabel extends Vue {
|
|||
@Prop() text!: string;
|
||||
@Prop() width!: number;
|
||||
@Prop() height!: number;
|
||||
@Prop({ default: 13 }) maxFontSize!: number;
|
||||
@Prop({ default: 'center' }) align!: 'left' | 'center';
|
||||
fontSize = 13;
|
||||
private textObserver: MutationObserver | null = null;
|
||||
private sizeObserver: ResizeObserver | null = null;
|
||||
|
|
@ -40,8 +43,12 @@ export default class ActionLabel extends Vue {
|
|||
if (!length || !height) return; // Hidden iframe: ResizeObserver retries on reveal.
|
||||
const current = Number(label.getAttribute('font-size'));
|
||||
this.fontSize =
|
||||
Math.round(
|
||||
Math.min(13, (current * (this.width - 16)) / length, (current * (this.height - 8)) / height) * 100
|
||||
Math.floor(
|
||||
Math.min(
|
||||
this.maxFontSize,
|
||||
(current * (this.width - (this.align === 'left' ? 18 : 16))) / length,
|
||||
(current * (this.height - 8)) / height
|
||||
) * 100
|
||||
) / 100;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Auto-pas, hvis pengene ikke rækker (auktion)",
|
||||
"Auto-pass if unaffordable (resources)": "Auto-pas, hvis pengene ikke rækker (ressourcer)",
|
||||
"Auto-pass if unaffordable (building)": "Auto-pas, hvis pengene ikke rækker (byggeri)",
|
||||
"Auto-pass if unaffordable": "Auto-pas, hvis pengene ikke rækker",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Pengene er offentlige: Spillere passer automatisk i auktioner, de ikke har råd til.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Passer automatisk i auktioner, du ikke har råd til. Med skjulte penge kan det afsløre, at du ikke har råd til buddet. Gælder efter næste træk.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Opdatering af analysepenge mislykkedes. Prøv igen.",
|
||||
"Save": "Gem",
|
||||
"Close and refresh": "Luk og opdater",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Når du lukker, opdateres brættet, men den indsendte ændring annulleres ikke."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Når du lukker, opdateres brættet, men den indsendte ændring annulleres ikke.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Offentlige penge: automatisk pas, når ingen ressource eller by kan købes. Altid slået til.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Automatisk pas, når intet kan betales i denne fase. Det kan afsløre skjulte penge. Offentligt umulige handlinger springes altid over. Efter næste træk."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Automatisch passen bei Geldmangel (Auktion)",
|
||||
"Auto-pass if unaffordable (resources)": "Automatisch passen bei Geldmangel (Ressourcen)",
|
||||
"Auto-pass if unaffordable (building)": "Automatisch passen bei Geldmangel (Bauen)",
|
||||
"Auto-pass if unaffordable": "Automatisch passen bei Geldmangel",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Das Geld ist öffentlich: Spieler passen automatisch bei Auktionen, die sie sich nicht leisten können.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Automatisch bei Auktionen passen, die du dir nicht leisten kannst. Bei verdecktem Geld kann dies verraten, dass du dir das Gebot nicht leisten kannst. Gilt nach dem nächsten Zug.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Geldaktualisierung fehlgeschlagen. Bitte erneut versuchen.",
|
||||
"Save": "Speichern",
|
||||
"Close and refresh": "Schließen und aktualisieren",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Beim Schließen wird das Spielbrett aktualisiert, die gesendete Änderung aber nicht abgebrochen."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Beim Schließen wird das Spielbrett aktualisiert, die gesendete Änderung aber nicht abgebrochen.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Geld ist öffentlich: automatisch passen, wenn keine Ressource oder Stadt gekauft werden kann. Immer aktiv.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Automatisch passen, wenn in dieser Phase nichts bezahlbar ist. Dies kann verborgenes Geld verraten. Öffentlich unmögliche Aktionen werden immer übersprungen. Gilt nach dem nächsten Zug."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Αυτόματο πάσο χωρίς αρκετά χρήματα (δημοπρασία)",
|
||||
"Auto-pass if unaffordable (resources)": "Αυτόματο πάσο χωρίς αρκετά χρήματα (πόροι)",
|
||||
"Auto-pass if unaffordable (building)": "Αυτόματο πάσο χωρίς αρκετά χρήματα (κατασκευή)",
|
||||
"Auto-pass if unaffordable": "Αυτόματο πάσο χωρίς αρκετά χρήματα",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Τα χρήματα είναι φανερά: Οι παίκτες κάνουν αυτόματα πάσο όταν δεν μπορούν να πληρώσουν την προσφορά.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Αυτόματο πάσο σε δημοπρασίες που δεν μπορείς να πληρώσεις. Με κρυφά χρήματα, αυτό μπορεί να αποκαλύψει ότι δεν έχεις αρκετά για την προσφορά. Ισχύει μετά την επόμενη κίνηση.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Η ενημέρωση χρημάτων απέτυχε. Δοκιμάστε ξανά.",
|
||||
"Save": "Αποθήκευση",
|
||||
"Close and refresh": "Κλείσιμο και ανανέωση",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Το κλείσιμο ανανεώνει το ταμπλό αλλά δεν ακυρώνει την υποβληθείσα αλλαγή."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Το κλείσιμο ανανεώνει το ταμπλό αλλά δεν ακυρώνει την υποβληθείσα αλλαγή.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Φανερά χρήματα: αυτόματο πάσο αν δεν μπορεί να αγοραστεί πόρος ή πόλη. Πάντα ενεργό.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Αυτόματο πάσο αν δεν αρκούν τα χρήματα σε αυτή τη φάση. Μπορεί να αποκαλύψει κρυφά χρήματα. Οι δημόσια αδύνατες ενέργειες παραλείπονται πάντα. Μετά την επόμενη κίνηση."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Auto-pass if unaffordable (auction)",
|
||||
"Auto-pass if unaffordable (resources)": "Auto-pass if unaffordable (resources)",
|
||||
"Auto-pass if unaffordable (building)": "Auto-pass if unaffordable (building)",
|
||||
"Auto-pass if unaffordable": "Auto-pass if unaffordable",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Money is public: players automatically pass auctions they cannot afford.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Analysis money update failed. Please try again.",
|
||||
"Save": "Save",
|
||||
"Close and refresh": "Close and refresh",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Closing refreshes the board but does not cancel the submitted edit."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Closing refreshes the board but does not cancel the submitted edit.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Money is public: automatically pass when no resource or city can be bought. Always on.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "پاس خودکار با پول ناکافی (مزایده)",
|
||||
"Auto-pass if unaffordable (resources)": "پاس خودکار با پول ناکافی (منابع)",
|
||||
"Auto-pass if unaffordable (building)": "پاس خودکار با پول ناکافی (ساختوساز)",
|
||||
"Auto-pass if unaffordable": "پاس خودکار با پول ناکافی",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "پولها آشکارند: بازیکنان در مزایدههایی که پول کافی ندارند، خودکار پاس میدهند.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "در مزایدههایی که پول کافی نداری، خودکار پاس بده. با پول مخفی، این کار ممکن است نشان دهد که توان پرداخت پیشنهاد را نداری. پس از حرکت بعدی اعمال میشود.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "بهروزرسانی پول تحلیل ناموفق بود. دوباره تلاش کنید.",
|
||||
"Save": "ذخیره",
|
||||
"Close and refresh": "بستن و تازهسازی",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "بستن، صفحهٔ بازی را تازهسازی میکند اما ویرایش ارسالشده را لغو نمیکند."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "بستن، صفحهٔ بازی را تازهسازی میکند اما ویرایش ارسالشده را لغو نمیکند.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "پول آشکار است: اگر خرید منبع یا شهر ممکن نباشد، خودکار پاس میدهد. همیشه فعال.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "اگر در این مرحله پول خرید هیچ چیز را ندارید، خودکار پاس میدهد. ممکن است پول پنهان را آشکار کند. کارهایی که طبق اطلاعات عمومی ناممکناند همیشه رد میشوند. پس از حرکت بعدی اعمال میشود."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Passer si l’argent ne suffit pas (enchères)",
|
||||
"Auto-pass if unaffordable (resources)": "Passer si l’argent ne suffit pas (ressources)",
|
||||
"Auto-pass if unaffordable (building)": "Passer si l’argent ne suffit pas (construction)",
|
||||
"Auto-pass if unaffordable": "Passer si l’argent ne suffit pas",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "L’argent est visible : les joueurs passent automatiquement les enchères qu’ils ne peuvent pas payer.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Passer automatiquement les enchères que vous ne pouvez pas payer. Avec l’argent caché, cela peut révéler que vos fonds sont insuffisants. S’applique après le prochain coup.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "La mise à jour de l’argent a échoué. Réessayez.",
|
||||
"Save": "Enregistrer",
|
||||
"Close and refresh": "Fermer et actualiser",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Fermer actualise le plateau mais n’annule pas la modification envoyée."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Fermer actualise le plateau mais n’annule pas la modification envoyée.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Argent public : passer automatiquement si aucune ressource ou ville ne peut être achetée. Toujours actif.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Passer automatiquement si rien n’est abordable dans cette phase. Cela peut révéler de l’argent caché. Les actions publiquement impossibles sont toujours sautées. Après le prochain coup."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "पैसे कम हों तो अपने-आप पास (नीलामी)",
|
||||
"Auto-pass if unaffordable (resources)": "पैसे कम हों तो अपने-आप पास (संसाधन)",
|
||||
"Auto-pass if unaffordable (building)": "पैसे कम हों तो अपने-आप पास (निर्माण)",
|
||||
"Auto-pass if unaffordable": "पैसे कम हों तो अपने-आप पास",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "पैसा खुला है: खिलाड़ी उन नीलामियों में अपने-आप पास करते हैं जिनकी बोली वे नहीं चुका सकते।",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "जिन नीलामियों की बोली आप नहीं चुका सकते, उनमें अपने-आप पास करें। पैसा छिपा होने पर इससे पता चल सकता है कि आपके पास बोली के लिए पर्याप्त पैसे नहीं हैं। अगली चाल के बाद लागू होगा।",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "विश्लेषण के पैसे अपडेट नहीं हो सके। फिर कोशिश करें।",
|
||||
"Save": "सहेजें",
|
||||
"Close and refresh": "बंद करें और रीफ़्रेश करें",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "बंद करने से बोर्ड रीफ़्रेश होता है, लेकिन भेजा गया बदलाव रद्द नहीं होता।"
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "बंद करने से बोर्ड रीफ़्रेश होता है, लेकिन भेजा गया बदलाव रद्द नहीं होता।",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "पैसा सार्वजनिक है: कोई संसाधन या शहर न खरीद पाने पर अपने-आप पास। हमेशा चालू।",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "इस चरण में कुछ भी खरीदने के पैसे न हों तो अपने-आप पास। इससे छिपे पैसे का पता चल सकता है। सार्वजनिक रूप से असंभव कार्य हमेशा छोड़ दिए जाते हैं। अगली चाल के बाद लागू।"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Passa se i soldi non bastano (asta)",
|
||||
"Auto-pass if unaffordable (resources)": "Passa se i soldi non bastano (risorse)",
|
||||
"Auto-pass if unaffordable (building)": "Passa se i soldi non bastano (costruzione)",
|
||||
"Auto-pass if unaffordable": "Passa se i soldi non bastano",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Il denaro è pubblico: i giocatori passano automaticamente nelle aste che non possono permettersi.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Passa automaticamente nelle aste che non puoi permetterti. Con denaro nascosto, questo può rivelare che non puoi permetterti l’offerta. Si applica dopo la prossima mossa.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Aggiornamento del denaro non riuscito. Riprova.",
|
||||
"Save": "Salva",
|
||||
"Close and refresh": "Chiudi e aggiorna",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "La chiusura aggiorna il tabellone ma non annulla la modifica inviata."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "La chiusura aggiorna il tabellone ma non annulla la modifica inviata.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Denaro pubblico: passa automaticamente se non puoi acquistare risorse o città. Sempre attivo.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Passa automaticamente se non puoi permetterti nulla in questa fase. Può rivelare denaro nascosto. Le azioni pubblicamente impossibili vengono sempre saltate. Dal prossimo turno."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "자금 부족 시 자동 패스 (경매)",
|
||||
"Auto-pass if unaffordable (resources)": "자금 부족 시 자동 패스 (자원)",
|
||||
"Auto-pass if unaffordable (building)": "자금 부족 시 자동 패스 (건설)",
|
||||
"Auto-pass if unaffordable": "자금 부족 시 자동 패스",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "자금이 공개되어 있습니다. 입찰할 돈이 부족한 플레이어는 자동으로 패스합니다.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "입찰할 돈이 부족하면 자동으로 패스합니다. 자금이 비공개일 때는 입찰 금액을 감당할 수 없다는 사실이 드러날 수 있습니다. 다음 행동 이후 적용됩니다.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "분석 자금 업데이트에 실패했습니다. 다시 시도하세요.",
|
||||
"Save": "저장",
|
||||
"Close and refresh": "닫고 새로고침",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "닫으면 보드가 새로고침되지만 제출한 수정은 취소되지 않습니다."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "닫으면 보드가 새로고침되지만 제출한 수정은 취소되지 않습니다.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "자금 공개: 자원이나 도시를 구매할 수 없으면 자동 패스합니다. 항상 켜짐.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "이 단계에서 아무것도 살 돈이 없으면 자동 패스합니다. 숨겨진 자금이 드러날 수 있습니다. 공개 정보상 불가능한 행동은 항상 건너뜁니다. 다음 행동 후 적용됩니다."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Automatisch passen bij geldtekort (veiling)",
|
||||
"Auto-pass if unaffordable (resources)": "Automatisch passen bij geldtekort (grondstoffen)",
|
||||
"Auto-pass if unaffordable (building)": "Automatisch passen bij geldtekort (bouwen)",
|
||||
"Auto-pass if unaffordable": "Automatisch passen bij geldtekort",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Geld is openbaar: spelers passen automatisch bij veilingen die ze niet kunnen betalen.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Pas automatisch bij veilingen die je niet kunt betalen. Bij verborgen geld kan dit onthullen dat je het bod niet kunt betalen. Geldt na de volgende zet.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Bijwerken van analysegeld mislukt. Probeer opnieuw.",
|
||||
"Save": "Opslaan",
|
||||
"Close and refresh": "Sluiten en vernieuwen",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Sluiten vernieuwt het bord maar annuleert de ingediende wijziging niet."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Sluiten vernieuwt het bord maar annuleert de ingediende wijziging niet.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Openbaar geld: automatisch passen als geen grondstof of stad gekocht kan worden. Altijd aan.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Automatisch passen als niets betaalbaar is in deze fase. Dit kan verborgen geld onthullen. Publiek onmogelijke acties worden altijd overgeslagen. Na de volgende zet."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Pasuj automatycznie bez środków (licytacja)",
|
||||
"Auto-pass if unaffordable (resources)": "Pasuj automatycznie bez środków (surowce)",
|
||||
"Auto-pass if unaffordable (building)": "Pasuj automatycznie bez środków (budowa)",
|
||||
"Auto-pass if unaffordable": "Pasuj automatycznie bez środków",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Pieniądze są jawne: gracze automatycznie pasują w aukcjach, na które ich nie stać.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Automatycznie pasuj w aukcjach, na które Cię nie stać. Przy ukrytych pieniądzach może to ujawnić, że nie stać Cię na ofertę. Działa po następnym ruchu.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Aktualizacja pieniędzy nie powiodła się. Spróbuj ponownie.",
|
||||
"Save": "Zapisz",
|
||||
"Close and refresh": "Zamknij i odśwież",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Zamknięcie odświeża planszę, ale nie anuluje wysłanej zmiany."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Zamknięcie odświeża planszę, ale nie anuluje wysłanej zmiany.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Jawne pieniądze: automatyczny pas, gdy nie można kupić zasobu ani miasta. Zawsze włączone.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Automatyczny pas, gdy w tej fazie na nic nie stać. Może ujawnić ukryte pieniądze. Publicznie niemożliwe akcje są zawsze pomijane. Po następnym ruchu."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Passar se o dinheiro não bastar (leilão)",
|
||||
"Auto-pass if unaffordable (resources)": "Passar se o dinheiro não bastar (recursos)",
|
||||
"Auto-pass if unaffordable (building)": "Passar se o dinheiro não bastar (construção)",
|
||||
"Auto-pass if unaffordable": "Passar se o dinheiro não bastar",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "O dinheiro é público: jogadores passam automaticamente em leilões que não podem pagar.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Passe automaticamente em leilões que você não pode pagar. Com dinheiro oculto, isso pode revelar que você não pode pagar o lance. Vale após a próxima jogada.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Falha ao atualizar o dinheiro da análise. Tente novamente.",
|
||||
"Save": "Salvar",
|
||||
"Close and refresh": "Fechar e atualizar",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Fechar atualiza o tabuleiro, mas não cancela a alteração enviada."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Fechar atualiza o tabuleiro, mas não cancela a alteração enviada.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Dinheiro público: passar automaticamente se nenhum recurso ou cidade puder ser comprado. Sempre ativo.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Passar automaticamente se não puder pagar nada nesta fase. Pode revelar dinheiro oculto. Ações publicamente impossíveis sempre são puladas. Após a próxima jogada."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Pas automat dacă nu ai bani (licitație)",
|
||||
"Auto-pass if unaffordable (resources)": "Pas automat dacă nu ai bani (resurse)",
|
||||
"Auto-pass if unaffordable (building)": "Pas automat dacă nu ai bani (construcție)",
|
||||
"Auto-pass if unaffordable": "Pas automat dacă nu ai bani",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Banii sunt publici: jucătorii spun automat pas la licitațiile pe care nu și le permit.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Spune automat pas la licitațiile pe care nu ți le permiți. Cu bani ascunși, asta poate dezvălui că nu îți permiți oferta. Se aplică după următoarea mutare.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Actualizarea banilor a eșuat. Încearcă din nou.",
|
||||
"Save": "Salvează",
|
||||
"Close and refresh": "Închide și reîmprospătează",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Închiderea reîmprospătează tabla, dar nu anulează modificarea trimisă."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Închiderea reîmprospătează tabla, dar nu anulează modificarea trimisă.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Bani publici: pas automat dacă nu se poate cumpăra nicio resursă sau niciun oraș. Mereu activ.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Pas automat dacă nimic nu este accesibil în această fază. Poate dezvălui banii ascunși. Acțiunile public imposibile sunt mereu omise. După următoarea mutare."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Автопас при нехватке денег (аукцион)",
|
||||
"Auto-pass if unaffordable (resources)": "Автопас при нехватке денег (ресурсы)",
|
||||
"Auto-pass if unaffordable (building)": "Автопас при нехватке денег (строительство)",
|
||||
"Auto-pass if unaffordable": "Автопас при нехватке денег",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Деньги открыты: игроки автоматически пасуют на аукционах, если не могут оплатить ставку.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Автоматически пасовать на аукционах, если не хватает денег. При скрытых деньгах это может показать, что вы не можете оплатить ставку. Применяется после следующего хода.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Не удалось обновить деньги в анализе. Попробуйте снова.",
|
||||
"Save": "Сохранить",
|
||||
"Close and refresh": "Закрыть и обновить",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Закрытие обновляет поле, но не отменяет отправленное изменение."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Закрытие обновляет поле, но не отменяет отправленное изменение.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Деньги открыты: автопас, если нельзя купить ресурс или город. Всегда включено.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Автопас, если в этой фазе ни на что не хватает денег. Это может раскрыть скрытые деньги. Публично невозможные действия всегда пропускаются. После следующего хода."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "Tự động bỏ lượt nếu thiếu tiền (đấu giá)",
|
||||
"Auto-pass if unaffordable (resources)": "Tự động bỏ lượt nếu thiếu tiền (tài nguyên)",
|
||||
"Auto-pass if unaffordable (building)": "Tự động bỏ lượt nếu thiếu tiền (xây dựng)",
|
||||
"Auto-pass if unaffordable": "Tự động bỏ lượt nếu thiếu tiền",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "Tiền được công khai: người chơi tự động bỏ lượt đấu giá nếu không đủ tiền.",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "Tự động bỏ lượt đấu giá nếu bạn không đủ tiền. Khi tiền được giữ kín, điều này có thể tiết lộ rằng bạn không đủ tiền trả giá. Áp dụng sau nước đi tiếp theo.",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "Cập nhật tiền phân tích thất bại. Hãy thử lại.",
|
||||
"Save": "Lưu",
|
||||
"Close and refresh": "Đóng và làm mới",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Đóng sẽ làm mới bàn chơi nhưng không hủy chỉnh sửa đã gửi."
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "Đóng sẽ làm mới bàn chơi nhưng không hủy chỉnh sửa đã gửi.",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "Tiền công khai: tự động bỏ lượt khi không thể mua tài nguyên hay thành phố. Luôn bật.",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "Tự động bỏ lượt khi không đủ tiền mua gì trong giai đoạn này. Có thể tiết lộ tiền ẩn. Hành động bất khả thi theo thông tin công khai luôn được bỏ qua. Áp dụng sau nước đi tiếp theo."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "资金不足时自动放弃竞价 (拍卖)",
|
||||
"Auto-pass if unaffordable (resources)": "资金不足时自动放弃竞价 (资源)",
|
||||
"Auto-pass if unaffordable (building)": "资金不足时自动放弃竞价 (建造)",
|
||||
"Auto-pass if unaffordable": "资金不足时自动放弃竞价",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "资金公开:玩家在无力支付出价时自动放弃竞价。",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "在无力支付出价时自动放弃竞价。资金隐藏时,这可能暴露你无力支付该出价。下次行动后生效。",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "分析资金更新失败。请重试。",
|
||||
"Save": "保存",
|
||||
"Close and refresh": "关闭并刷新",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "关闭会刷新棋盘,但不会取消已提交的修改。"
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "关闭会刷新棋盘,但不会取消已提交的修改。",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "资金公开:无法购买任何资源或城市时自动跳过。始终启用。",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "本阶段资金不足以购买任何东西时自动跳过。这可能透露隐藏的资金。根据公开信息不可能执行的行动一律跳过。下次行动后生效。"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Auto-pass if unaffordable (auction)": "資金不足時自動放棄競價 (拍賣)",
|
||||
"Auto-pass if unaffordable (resources)": "資金不足時自動放棄競價 (資源)",
|
||||
"Auto-pass if unaffordable (building)": "資金不足時自動放棄競價 (建造)",
|
||||
"Auto-pass if unaffordable": "資金不足時自動放棄競價",
|
||||
"Money is public: players automatically pass auctions they cannot afford.": "資金公開:玩家在無力支付出價時自動放棄競價。",
|
||||
"Automatically pass auctions you cannot afford. With hidden money, this can reveal that you cannot afford the bid. Applies after the next move.": "在無力支付出價時自動放棄競價。資金隱藏時,這可能暴露你無力支付該出價。下次行動後生效。",
|
||||
|
|
@ -2061,5 +2064,7 @@
|
|||
"Analysis money update failed. Please try again.": "分析資金更新失敗。請重試。",
|
||||
"Save": "儲存",
|
||||
"Close and refresh": "關閉並重新整理",
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "關閉會重新整理棋盤,但不會取消已提交的修改。"
|
||||
"Closing refreshes the board but does not cancel the submitted edit.": "關閉會重新整理棋盤,但不會取消已提交的修改。",
|
||||
"Money is public: automatically pass when no resource or city can be bought. Always on.": "資金公開:無法購買任何資源或城市時自動跳過。始終啟用。",
|
||||
"Automatically pass when nothing is affordable in this phase. This may reveal hidden money. Publicly impossible actions are always skipped. Applies after the next move.": "本階段資金不足以購買任何東西時自動跳過。這可能透露隱藏的資金。根據公開資訊不可能執行的行動一律跳過。下次行動後生效。"
|
||||
}
|
||||
|
|
|
|||
95
viewer/tests/unit/phase-auto-pass.spec.ts
Normal file
95
viewer/tests/unit/phase-auto-pass.spec.ts
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
import Game from '@/components/Game.vue';
|
||||
import PlayerBoard from '@/components/PlayerBoard.vue';
|
||||
import { expect } from 'chai';
|
||||
import { Phase, setup } from 'powergrid-engine';
|
||||
|
||||
const options = (Game as any).options;
|
||||
function context() {
|
||||
const sent: unknown[] = [];
|
||||
const ctx: any = {
|
||||
G: setup(3, { map: 'Germany', variant: 'original', showMoney: false }, 'phase-settings'),
|
||||
preferences: {},
|
||||
player: 0,
|
||||
settings: {},
|
||||
emitter: { emit: (...args: unknown[]) => sent.push(args) },
|
||||
sent,
|
||||
};
|
||||
for (const key of ['autoPassSetting', 'reserveAutoPass', 'showAutoPass', 'canEditAuctionSettings'])
|
||||
Object.defineProperty(ctx, key, { get: () => options.computed[key].get.call(ctx) });
|
||||
return ctx;
|
||||
}
|
||||
describe('phase-specific private auto-pass controls', () => {
|
||||
it('names the current phase in each complete localizable label', () => {
|
||||
const label = (PlayerBoard as any).options.computed.autoPassLabel.get;
|
||||
for (const [autoPassSetting, phase] of [
|
||||
['autoPassBids', 'auction'],
|
||||
['autoPassResources', 'resources'],
|
||||
['autoPassBuilding', 'building'],
|
||||
]) {
|
||||
expect(label.call({ autoPassSetting })).to.equal(`Auto-pass if unaffordable (${phase})`);
|
||||
}
|
||||
});
|
||||
it('offers only the current phase setting and emits no move', () => {
|
||||
const ctx = context();
|
||||
for (const [phase, setting] of [
|
||||
[Phase.Auction, 'autoPassBids'],
|
||||
[Phase.Resources, 'autoPassResources'],
|
||||
[Phase.Building, 'autoPassBuilding'],
|
||||
]) {
|
||||
ctx.G.phase = phase;
|
||||
expect(ctx.showAutoPass).to.equal(true);
|
||||
expect(ctx.autoPassSetting).to.equal(setting);
|
||||
options.methods.toggleAutoPass.call(ctx);
|
||||
expect(ctx.sent.pop()).to.deep.equal(['update:setting', { name: setting, value: true }]);
|
||||
ctx.settings[setting] = true;
|
||||
options.methods.toggleAutoPass.call(ctx);
|
||||
expect(ctx.sent.pop()).to.deep.equal(['update:setting', { name: setting, value: false }]);
|
||||
}
|
||||
ctx.G.phase = Phase.Bureaucracy;
|
||||
expect(ctx.showAutoPass).to.equal(false);
|
||||
expect(ctx.reserveAutoPass).to.equal(true);
|
||||
});
|
||||
it('reserves identical player-board offsets when the phase control disappears', () => {
|
||||
const ctx = context();
|
||||
ctx.adjustedPlayerOrder = [1, 0, 2];
|
||||
const offsets = () => [0, 1, 2].map((index) => options.methods.playerBoardOffset.call(ctx, index));
|
||||
ctx.G.phase = Phase.Auction;
|
||||
const initial = offsets();
|
||||
expect(initial).to.deep.equal([0, 110, 256]);
|
||||
for (const phase of [Phase.Resources, Phase.Building, Phase.Bureaucracy]) {
|
||||
ctx.G.phase = phase;
|
||||
expect(offsets()).to.deep.equal(initial);
|
||||
}
|
||||
expect(ctx.showAutoPass).to.equal(false);
|
||||
options.methods.toggleAutoPass.call(ctx);
|
||||
expect(ctx.sent).to.deep.equal([]);
|
||||
});
|
||||
it('hides settings from spectators, tutorials and analysis; locks public money', () => {
|
||||
for (const patch of [
|
||||
{ player: null },
|
||||
{ player: 99 },
|
||||
{ tutorialMove: () => {} },
|
||||
{ preferences: { analysis: true } },
|
||||
{ settings: null },
|
||||
]) {
|
||||
const ctx = Object.assign(context(), patch);
|
||||
expect(ctx.showAutoPass).to.equal(false);
|
||||
}
|
||||
for (const patch of [
|
||||
{ paused: true },
|
||||
{ roundPlan: {} },
|
||||
{ interactionDisabled: true },
|
||||
{ gameIsOver: true },
|
||||
]) {
|
||||
const ctx = Object.assign(context(), patch);
|
||||
options.methods.toggleAutoPass.call(ctx);
|
||||
expect(ctx.sent).to.deep.equal([]);
|
||||
}
|
||||
const ctx = context();
|
||||
ctx.G.options.showMoney = true;
|
||||
expect(ctx.showAutoPass).to.equal(true);
|
||||
expect(ctx.canEditAuctionSettings).to.equal(false);
|
||||
options.methods.toggleAutoPass.call(ctx);
|
||||
expect(ctx.sent).to.deep.equal([]);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue