diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 1adf1f33..28e739f7 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,7 +1,11 @@ { $schema: "https://docs.renovatebot.com/renovate-schema.json", extends: [ + "config:best-practices", "config:recommended" ], automerge: true, + labels: [ + "dependencies" + ], } diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index ee1dc5b9..0dcd25bf 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -1,15 +1,13 @@ name: Performance Benchmark -on: [pull_request] +on: [ pull_request ] jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: jdx/mise-action@v3 - with: - version: 2025.7.3 - - name: Random actions test - run: mise run random-actions + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: jdx/mise-action@94c60b39bc2d90ab2f9bab27f38d3cc4812c1834 # v5.1.0 + - name: Random actions test + run: mise run random-actions diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 51c9a443..f5faf6d6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,15 +1,16 @@ name: Check -on: [pull_request] +on: + pull_request: + push: + branches: [main] jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: jdx/mise-action@v3 - with: - version: 2025.7.3 - - name: Check all - run: mise run ci + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: jdx/mise-action@94c60b39bc2d90ab2f9bab27f38d3cc4812c1834 # v5.1.0 + - name: Check all + run: mise run ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48303515..a877d5c1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,12 +11,10 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: jdx/mise-action@v3 - with: - version: 2025.7.3 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: jdx/mise-action@94c60b39bc2d90ab2f9bab27f38d3cc4812c1834 # v5.1.0 - name: Use Node.js ${{ env.node_version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 with: node-version: ${{ env.node_version }} # setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml index 2fe70616..d39b6e28 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-release.yml @@ -1,17 +1,15 @@ name: Test Release -on: [pull_request] +on: [ pull_request ] jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: jdx/mise-action@v3 - with: - version: 2025.7.3 - - name: Test server release - run: mise run build-remote-server - - name: Test client release - run: mise run build-remote-client + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: jdx/mise-action@94c60b39bc2d90ab2f9bab27f38d3cc4812c1834 # v5.1.0 + - name: Test server release + run: mise run build-remote-server + - name: Test client release + run: mise run build-remote-client diff --git a/.github/workflows/web-viewer.yml b/.github/workflows/web-viewer.yml index bc5edec1..ad42cb72 100644 --- a/.github/workflows/web-viewer.yml +++ b/.github/workflows/web-viewer.yml @@ -3,7 +3,7 @@ on: pull_request: paths: ['web-client/**', 'server/**', 'Cargo.*', '.github/workflows/web-viewer.yml'] push: - branches: [feat/3d-web-viewer] + branches: [main, feat/3d-web-viewer] jobs: verify: runs-on: ubuntu-latest diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..107a71d3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,15 @@ +# Agent instructions + +## BGS publication and Git delivery + +Whenever changes are published to BGS, commit the corresponding source, tests, +dependency/lockfile changes and version bumps, then push them to this repository's +`main` or `master` release branch in the same task. A BGS upload or a push only to +a feature branch does not complete delivery. This is standing authorization to +commit and push published changes without asking for separate confirmation. + +Fetch and integrate the latest release-branch changes, run the relevant repository +checks, and push without force. Update any public mirrors required by this repo's +existing workflow too. Keep credentials, generated artifacts excluded by the repo, +and unrelated unfinished work out of the commit. Verify the remote branch contains +the delivered commit and report any blocker instead of claiming delivery. diff --git a/Cargo.lock b/Cargo.lock index 8d51035c..5052843a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,12 +29,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -176,6 +170,28 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "aws-lc-rs" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bffc006df10ac2a68c83692d734a465f8ee6c5b384d8545a636f81d858f4bf" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "backtrace" version = "0.3.75" @@ -205,9 +221,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "block-buffer" @@ -257,13 +273,22 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.27" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.1" @@ -278,16 +303,15 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-link", + "windows-link 0.2.0", ] [[package]] @@ -298,7 +322,7 @@ dependencies = [ "hex2d", "itertools 0.14.0", "macroquad", - "pyroscope", + "pyroscope 2.1.1", "pyroscope_pprofrs", "serde", "serde_json", @@ -308,12 +332,31 @@ dependencies = [ "web-sys", ] +[[package]] +name = "cmake" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" +dependencies = [ + "cc", +] + [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -333,12 +376,31 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpp_demangle" version = "0.4.4" @@ -384,9 +446,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08440b3dd222c3d0433e63e097463969485f112baff337dfdaca043a0d760570" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ "darling_core", "darling_macro", @@ -394,28 +456,34 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25b7912bc28a04ab1b7715a68ea03aaa15662b43a1a4b2c480531fd19f8bf7e" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] name = "darling_macro" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce154b9bea7fb0c8e8326e62d00354000c36e79770ff21b8c84e3aa267d9d531" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core", "quote", - "syn 2.0.104", + "syn 2.0.117", ] +[[package]] +name = "dary_heap" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d2e3287df1c007e74221c49ca10a95d557349e54b3a75dc2fb14712c751f04" + [[package]] name = "debugid" version = "0.8.0" @@ -427,14 +495,14 @@ dependencies = [ [[package]] name = "deprecate-until" -version = "0.1.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3767f826efbbe5a5ae093920b58b43b01734202be697e1354914e862e8e704" +checksum = "9d0795c0c5b2cab72b80d75b5cb08bde679e616c67e954669a2476668319ac3a" dependencies = [ "proc-macro2", "quote", "semver", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -455,9 +523,15 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.15.0" @@ -466,23 +540,23 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "enumset" -version = "1.1.10" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b07a8dfbbbfc0064c0a6bdf9edcf966de6b1c33ce344bdeca3b41615452634" +checksum = "ccc5801fd11762e24d1e420d01d2ac518f2a2ca4329d4fbb6639f2412b6204e0" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43e744e4ea338060faee68ed933e46e722fb7f3617e722a5772d7e856d8b3ce" +checksum = "4bd536557b58c682b217b8fb199afdff47cd3eff260623f19e77074eb073d63a" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -498,7 +572,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -543,6 +617,12 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "findshlibs" version = "0.10.2" @@ -577,13 +657,19 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "fontdue" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e57e16b3fe8ff4364c0661fdaac543fb38b29ea9bc9c2f45612d90adf931d2b" dependencies = [ - "hashbrown", + "hashbrown 0.15.4", "ttf-parser", ] @@ -596,6 +682,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-channel" version = "0.3.31" @@ -691,11 +783,24 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + [[package]] name = "gimli" version = "0.31.1" @@ -728,9 +833,26 @@ checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.5", ] +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.5.2" @@ -958,6 +1080,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -1000,12 +1128,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -1017,17 +1147,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "io-uring" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "libc", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -1069,10 +1188,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] -name = "js-sys" -version = "0.3.77" +name = "jni" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", @@ -1080,14 +1231,14 @@ dependencies = [ [[package]] name = "json-patch" -version = "4.0.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "159294d661a039f7644cea7e4d844e6b25aaf71c1ffe9d73a96d768c24b0faf4" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" dependencies = [ "jsonptr", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.18", ] [[package]] @@ -1116,10 +1267,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] -name = "libc" -version = "0.2.174" +name = "leb128fmt" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" [[package]] name = "libflate" @@ -1129,7 +1286,20 @@ checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18" dependencies = [ "adler32", "crc32fast", - "libflate_lz77", + "libflate_lz77 1.2.0", +] + +[[package]] +name = "libflate" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3248b8d211bd23a104a42d81b4fa8bb8ac4a3b75e7a43d85d2c9ccb6179cd74" +dependencies = [ + "adler32", + "core2", + "crc32fast", + "dary_heap", + "libflate_lz77 2.2.0", ] [[package]] @@ -1141,6 +1311,17 @@ dependencies = [ "rle-decode-fast", ] +[[package]] +name = "libflate_lz77" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a599cb10a9cd92b1300debcef28da8f70b935ec937f44fcd1b70a7c986a11c5c" +dependencies = [ + "core2", + "hashbrown 0.16.1", + "rle-decode-fast", +] + [[package]] name = "linux-raw-sys" version = "0.9.4" @@ -1180,9 +1361,9 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "macroquad" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2befbae373456143ef55aa93a73594d080adfb111dc32ec96a1123a3e4ff4ae" +checksum = "1cbd54d99d4d3ac59deed7ee4927bbbf4eb33a55635530af3be9395a55746090" dependencies = [ "fontdue", "glam", @@ -1224,9 +1405,9 @@ dependencies = [ [[package]] name = "miniquad" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fb3e758e46dbc45716a8a49ca9edc54b15bcca826277e80b1f690708f67f9e3" +checksum = "dcbaea978d741f3b60ced666b06a2a1e4a2bc81cb8b9dd29f4a40965e1f59e65" dependencies = [ "libc", "ndk-sys", @@ -1246,13 +1427,13 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "windows-sys 0.61.1", ] [[package]] @@ -1276,7 +1457,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.11.0", "cfg-if", "libc", ] @@ -1388,6 +1569,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + [[package]] name = "parking" version = "2.2.1" @@ -1419,16 +1606,16 @@ dependencies = [ [[package]] name = "pathfinding" -version = "4.14.0" +version = "4.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ac35caa284c08f3721fb33c2741b5f763decaf42d080c8a6a722154347017e" +checksum = "dbb041402cdb260d46c836e67bd1193d2258cac438d2638db97ada0ef712d6c7" dependencies = [ "deprecate-until", "indexmap", "integer-sqrt", "num-traits", "rustc-hash", - "thiserror 2.0.12", + "thiserror 2.0.18", ] [[package]] @@ -1514,7 +1701,7 @@ dependencies = [ "smallvec", "symbolic-demangle", "tempfile", - "thiserror 2.0.12", + "thiserror 2.0.18", ] [[package]] @@ -1526,6 +1713,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + [[package]] name = "proc-macro2" version = "1.0.95" @@ -1542,7 +1739,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" +dependencies = [ + "bytes", + "prost-derive 0.14.3", ] [[package]] @@ -1558,6 +1765,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prost-derive" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" +dependencies = [ + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "pyroscope" version = "0.5.8" @@ -1565,17 +1785,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a5f63b0d2727095db59045e6a0ef3259b28b90d481ae88f0e3d866d0234ce8" dependencies = [ "libc", - "libflate", + "libflate 1.4.0", "log", "names", - "prost", - "reqwest", + "prost 0.11.9", + "reqwest 0.12.20", "serde_json", "thiserror 1.0.69", "url", "winapi", ] +[[package]] +name = "pyroscope" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b1989a61e856eba4ef903eadad8313f8376e88e7c9cc5d5db8217d832a64d9" +dependencies = [ + "libc", + "libflate 2.2.1", + "log", + "prost 0.14.3", + "reqwest 0.13.2", + "serde_json", + "thiserror 2.0.18", + "url", + "uuid", +] + [[package]] name = "pyroscope_pprofrs" version = "0.2.10" @@ -1584,7 +1821,7 @@ checksum = "50da7a8950c542357de489aa9ee628f46322b1beaac1f4fa3313bcdebe85b4ea" dependencies = [ "log", "pprof2", - "pyroscope", + "pyroscope 0.5.8", ] [[package]] @@ -1607,7 +1844,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2 0.5.10", - "thiserror 2.0.12", + "thiserror 2.0.18", "tokio", "tracing", "web-time", @@ -1619,6 +1856,7 @@ version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" dependencies = [ + "aws-lc-rs", "bytes", "getrandom 0.3.3", "lru-slab", @@ -1628,7 +1866,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.12", + "thiserror 2.0.18", "tinyvec", "tracing", "web-time", @@ -1663,6 +1901,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.8.5" @@ -1728,7 +1972,7 @@ version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.11.0", ] [[package]] @@ -1771,6 +2015,45 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "reqwest" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "ring" version = "0.17.14" @@ -1799,9 +2082,9 @@ checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" [[package]] name = "rustc-hash" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustix" @@ -1809,7 +2092,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys", @@ -1822,6 +2105,7 @@ version = "0.23.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7160e3e10bf4535308537f3c4e1641468cd0e485175d6163087c0393c7d46643" dependencies = [ + "aws-lc-rs", "once_cell", "ring", "rustls-pki-types", @@ -1830,6 +2114,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pki-types" version = "1.12.0" @@ -1840,12 +2136,40 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-webpki" version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -1863,12 +2187,53 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.1", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.11.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.26" @@ -1877,10 +2242,11 @@ checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ + "serde_core", "serde_derive", ] @@ -1896,26 +2262,36 @@ dependencies = [ ] [[package]] -name = "serde_derive" -version = "1.0.219" +name = "serde_core" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 3.0.0", ] [[package]] name = "serde_json" -version = "1.0.143" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -1944,13 +2320,14 @@ dependencies = [ "num", "num_cpus", "pathfinding", - "pyroscope", + "pyroscope 2.1.1", "pyroscope_pprofrs", "rustc-hash", "serde", "serde-wasm-bindgen", "serde_json", "sha2", + "string-builder", "tokio", "wasm-bindgen", "wasm-bindgen-futures", @@ -2012,12 +2389,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.1", ] [[package]] @@ -2026,6 +2403,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "string-builder" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd10a070fb1f2796a288abec42695db4682a82b6f12ffacd60fb8d5ad3a4a12" + [[package]] name = "subtle" version = "2.6.1" @@ -2068,9 +2451,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fac314a64dc9a36e61a9eb4261a5e9bbfbc922b27e518af97bc32b926cf967" dependencies = [ "proc-macro2", "quote", @@ -2094,7 +2488,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2121,11 +2515,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.18", ] [[package]] @@ -2136,18 +2530,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2177,33 +2571,30 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.47.1" +version = "1.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", - "slab", - "socket2 0.6.0", + "socket2 0.6.3", "tokio-macros", - "windows-sys 0.59.0", + "windows-sys 0.61.1", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2233,11 +2624,11 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.11.0", "bytes", "futures-util", "http", @@ -2304,6 +2695,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "untrusted" version = "0.9.0" @@ -2329,10 +2726,11 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.17.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" dependencies = [ + "getrandom 0.4.2", "js-sys", "wasm-bindgen", ] @@ -2349,6 +2747,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -2374,36 +2782,41 @@ dependencies = [ ] [[package]] -name = "wasm-bindgen" -version = "0.2.100" +name = "wasip2" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.104", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" dependencies = [ "cfg-if", "js-sys", @@ -2414,9 +2827,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2424,31 +2837,65 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.104", - "wasm-bindgen-backend", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] [[package]] -name = "web-sys" -version = "0.3.77" +name = "wasm-encoder" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.4", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -2464,6 +2911,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-root-certs" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "1.0.1" @@ -2489,6 +2945,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2503,7 +2968,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2516,7 +2981,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2527,7 +2992,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2536,13 +3001,19 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-result" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2551,7 +3022,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", ] [[package]] @@ -2574,11 +3054,26 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.60.2" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" dependencies = [ - "windows-targets 0.53.2", + "windows-link 0.2.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -2590,7 +3085,7 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", + "windows_i686_gnullvm", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", @@ -2598,20 +3093,10 @@ dependencies = [ ] [[package]] -name = "windows-targets" -version = "0.53.2" +name = "windows_aarch64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" @@ -2620,10 +3105,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" +name = "windows_aarch64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" @@ -2632,10 +3117,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" +name = "windows_i686_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" @@ -2643,12 +3128,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" @@ -2656,10 +3135,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" +name = "windows_i686_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" @@ -2668,10 +3147,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "windows_i686_msvc" -version = "0.53.0" +name = "windows_x86_64_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" @@ -2680,10 +3159,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" +name = "windows_x86_64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" @@ -2692,10 +3171,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" +name = "windows_x86_64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" @@ -2704,10 +3183,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" +name = "wit-bindgen" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] [[package]] name = "wit-bindgen-rt" @@ -2715,7 +3208,75 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.11.0", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", ] [[package]] @@ -2744,7 +3305,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", "synstructure", ] @@ -2765,7 +3326,7 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] [[package]] @@ -2785,7 +3346,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", "synstructure", ] @@ -2825,5 +3386,11 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.117", ] + +[[package]] +name = "zmij" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" diff --git a/README.md b/README.md index d0824843..57d534ed 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ ![Lines of code](https://img.shields.io/tokei/lines/github/boardgamers/clash) +## Play online at + +[boardgamers.space](https://boardgamers.space) + ## Client ### Run native client diff --git a/client/Cargo.toml b/client/Cargo.toml index c4fef3ce..3e913763 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -18,7 +18,7 @@ wasm-bindgen = "0.2.100" wasm-bindgen-futures = "0.4.50" console_error_panic_hook = "0.1.7" web-sys = { version = "0.3.77", features = ["Window"] } -pyroscope = { version = "0.5.8", optional = true } +pyroscope = { version = "2.0.0", optional = true } pyroscope_pprofrs = { version = "0.2.10", optional = true } serde = { version = "1.0.219", features = ["derive"] } diff --git a/client/assets/hex-svgrepo-com.png b/client/assets/hex-svgrepo-com.png new file mode 100644 index 00000000..dcc4e866 Binary files /dev/null and b/client/assets/hex-svgrepo-com.png differ diff --git a/client/assets/lightning-svgrepo-com.png b/client/assets/lightning-svgrepo-com.png new file mode 100644 index 00000000..4ef850b7 Binary files /dev/null and b/client/assets/lightning-svgrepo-com.png differ diff --git a/client/js/package-lock.json b/client/js/package-lock.json index 98e88b3f..d5fa325e 100644 --- a/client/js/package-lock.json +++ b/client/js/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@discoveryjs/json-ext": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", - "integrity": "sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-1.1.0.tgz", + "integrity": "sha512-Xc3VhU02wqZ1HvHRJUwL09HkZSTvidqY5Ya0NXBSYOxAp+Ln9dcJr9fySI+CkONzP3PekQo9WdzCv0PGER/mOA==", "dev": true }, "@jridgewell/gen-mapping": { @@ -37,45 +37,25 @@ } }, "@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.30", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz", - "integrity": "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==", + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "@types/eslint": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", - "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dev": true, - "requires": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true }, "@types/json-schema": { @@ -85,12 +65,12 @@ "dev": true }, "@types/node": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz", - "integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.1.tgz", + "integrity": "sha512-VqGJBMCtdhqkBUCcBLvywI0NJ+KLuVzgNnlBUNFOQjqVxzo2lxLUNg1DSey8+u2u6ktswSAxg+s68QLzWHNOuA==", "dev": true, "requires": { - "undici-types": "~7.10.0" + "undici-types": "~8.9.0" } }, "@webassemblyjs/ast": { @@ -239,24 +219,6 @@ "@xtuc/long": "4.2.2" } }, - "@webpack-cli/configtest": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-3.0.1.tgz", - "integrity": "sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA==", - "dev": true - }, - "@webpack-cli/info": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-3.0.1.tgz", - "integrity": "sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ==", - "dev": true - }, - "@webpack-cli/serve": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-3.0.1.tgz", - "integrity": "sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg==", - "dev": true - }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -270,21 +232,15 @@ "dev": true }, "acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "dev": true - }, - "acorn-import-phases": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", - "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", + "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", "dev": true }, "ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", "dev": true, "requires": { "fast-deep-equal": "^3.1.3", @@ -294,9 +250,9 @@ } }, "ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", "dev": true, "requires": { "ajv": "^8.0.0" @@ -311,16 +267,23 @@ "fast-deep-equal": "^3.1.3" } }, + "baseline-browser-mapping": { + "version": "2.11.25", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz", + "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==", + "dev": true + }, "browserslist": { - "version": "4.25.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.2.tgz", - "integrity": "sha512-0si2SJK3ooGzIawRu61ZdPCO1IncZwS8IzuX73sPZsXW6EQ/w/DAfPyKI8l1ETTCr2MnvqWitmlCUxgdul45jA==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", + "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001733", - "electron-to-chromium": "^1.5.199", - "node-releases": "^2.0.19", - "update-browserslist-db": "^1.1.3" + "baseline-browser-mapping": "^2.11.23", + "caniuse-lite": "^1.0.30001810", + "electron-to-chromium": "^1.5.427", + "node-releases": "^2.0.55", + "update-browserslist-db": "^1.3.3" } }, "buffer-from": { @@ -330,9 +293,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001735", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001735.tgz", - "integrity": "sha512-EV/laoX7Wq2J9TQlyIXRxTJqIw4sxfXS4OYgudGxBYRuTv0q7AM6yMEpU/Vo1I94thg9U6EZ2NfZx9GJq83u7w==", + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", "dev": true }, "chrome-trace-event": { @@ -352,12 +315,6 @@ "shallow-clone": "^3.0.0" } }, - "colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true - }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -376,31 +333,37 @@ } }, "electron-to-chromium": { - "version": "1.5.203", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.203.tgz", - "integrity": "sha512-uz4i0vLhfm6dLZWbz/iH88KNDV+ivj5+2SA+utpgjKaj9Q0iDLuwk6Idhe9BTxciHudyx6IvTvijhkPvFGUQ0g==", + "version": "1.5.433", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.433.tgz", + "integrity": "sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA==", "dev": true }, "enhanced-resolve": { - "version": "5.18.3", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz", - "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==", + "version": "5.25.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.25.1.tgz", + "integrity": "sha512-nGXts5znJzmWPu+mIE9izCOzdg63oJca2mDzGWWTth7sr4aCToKcoyFVBQwN75Ij5Pf6p510EwkTqViTRzDV+w==", "dev": true, "requires": { "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" + "tapable": "^2.3.3" } }, "envinfo": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", - "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.21.0.tgz", + "integrity": "sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==", + "dev": true + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "dev": true }, "es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", "dev": true }, "escalade": { @@ -409,39 +372,6 @@ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, "events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -454,15 +384,9 @@ "dev": true }, "fast-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", - "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", - "dev": true - }, - "fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", + "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", "dev": true }, "find-up": { @@ -487,12 +411,6 @@ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, - "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -506,9 +424,9 @@ "dev": true }, "hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, "requires": { "function-bind": "^1.1.2" @@ -531,12 +449,12 @@ "dev": true }, "is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", "dev": true, "requires": { - "hasown": "^2.0.2" + "hasown": "^2.0.3" } }, "is-plain-object": { @@ -571,12 +489,6 @@ "supports-color": "^8.0.0" } }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -589,12 +501,6 @@ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, - "loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "dev": true - }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -611,30 +517,27 @@ "dev": true }, "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", "dev": true }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "minimizer-webpack-plugin": { + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.10.1.tgz", + "integrity": "sha512-+dsZEyTcy1lkq41lxdiOqvb26gXbYGgwY+30w37f9PqUVkuEBejBLDotsHOTjuga9xJyGLW2DqzKDUyJ4W/PMQ==", "dev": true, "requires": { - "mime-db": "1.52.0" + "@jridgewell/trace-mapping": "^0.3.31", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.3", + "terser": "^5.51.0" } }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, "node-releases": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", - "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "version": "2.0.56", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.56.tgz", + "integrity": "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==", "dev": true }, "p-limit": { @@ -694,15 +597,6 @@ "find-up": "^4.0.0" } }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, "rechoir": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", @@ -719,12 +613,13 @@ "dev": true }, "resolve": { - "version": "1.22.10", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "version": "1.22.12", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", + "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", "dev": true, "requires": { - "is-core-module": "^2.16.0", + "es-errors": "^1.3.0", + "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -744,33 +639,18 @@ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, "schema-utils": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", - "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.5.0.tgz", + "integrity": "sha512-zJlMCZ0cAR5p/Y4oVpRoqioDMJcGxaXRrQ/4rP4WyR84vc5z/DolXdbvXeDpTwbtocDFr2rhPqHPErDCUtz2kA==", "dev": true, "requires": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", + "@types/json-schema": "^7.0.15", + "ajv": "^8.20.0", + "ajv-formats": "^3.0.1", "ajv-keywords": "^5.1.0" } }, - "serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, "shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", @@ -827,46 +707,33 @@ "dev": true }, "tapable": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", - "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", "dev": true }, "terser": { - "version": "5.43.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", - "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", + "version": "5.51.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.51.2.tgz", + "integrity": "sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==", "dev": true, "requires": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.14.0", + "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" } }, - "terser-webpack-plugin": { - "version": "5.3.14", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", - "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.25", - "jest-worker": "^27.4.5", - "schema-utils": "^4.3.0", - "serialize-javascript": "^6.0.2", - "terser": "^5.31.1" - } - }, "undici-types": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", - "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", "dev": true }, "update-browserslist-db": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", - "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", + "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==", "dev": true, "requires": { "escalade": "^3.2.0", @@ -874,73 +741,59 @@ } }, "watchpack": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz", - "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.2.tgz", + "integrity": "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==", "dev": true, "requires": { - "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "webpack": { - "version": "5.101.3", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.3.tgz", - "integrity": "sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==", + "version": "5.111.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.111.1.tgz", + "integrity": "sha512-cNypaz0RP+S4cvQVi1M/3bRUkvNP0xZpL0TjFx+c6jg64VbxD+2weWDgY9UnjRI6dhZgtaj8DU76GGFcJ79xPQ==", "dev": true, "requires": { - "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", - "acorn": "^8.15.0", - "acorn-import-phases": "^1.0.3", - "browserslist": "^4.24.0", + "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.3", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", + "enhanced-resolve": "^5.25.0", + "es-module-lexer": "^2.1.0", "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^4.3.2", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.11", - "watchpack": "^2.4.1", - "webpack-sources": "^3.3.3" + "mime-db": "^1.54.0", + "minimizer-webpack-plugin": "^5.7.0", + "schema-utils": "^4.5.0", + "tapable": "^2.3.0", + "watchpack": "^2.5.2", + "webpack-sources": "^3.5.1" } }, "webpack-cli": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-6.0.1.tgz", - "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-7.2.3.tgz", + "integrity": "sha512-vDFU7jrfCctnN7jJQWPl+V26B51GLp11prVZXg50oeonsgeBzSTJEWmXkjHsOjTgMjlPOQM8GWLh33X9RN/0ow==", "dev": true, "requires": { - "@discoveryjs/json-ext": "^0.6.1", - "@webpack-cli/configtest": "^3.0.1", - "@webpack-cli/info": "^3.0.1", - "@webpack-cli/serve": "^3.0.1", - "colorette": "^2.0.14", - "commander": "^12.1.0", - "cross-spawn": "^7.0.3", - "envinfo": "^7.14.0", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", + "@discoveryjs/json-ext": "^1.1.0", + "commander": "^14.0.3", + "cross-spawn": "^7.0.6", + "envinfo": "^7.21.0", + "import-local": "^3.2.0", "interpret": "^3.1.1", "rechoir": "^0.8.0", "webpack-merge": "^6.0.1" }, "dependencies": { "commander": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", - "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", "dev": true } } @@ -957,9 +810,9 @@ } }, "webpack-sources": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", - "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.5.1.tgz", + "integrity": "sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw==", "dev": true }, "which": { diff --git a/client/js/package.json b/client/js/package.json index d236c9ae..3f31cf41 100644 --- a/client/js/package.json +++ b/client/js/package.json @@ -18,8 +18,8 @@ "build": "webpack" }, "devDependencies": { - "webpack": "^5.94.0", - "webpack-cli": "^6.0.0" + "webpack": "5.111.1", + "webpack-cli": "7.2.3" }, "dependencies": { "events": "^3.3.0" diff --git a/client/src/action_buttons.rs b/client/src/action_buttons.rs index 8c24f7dc..1ecd7461 100644 --- a/client/src/action_buttons.rs +++ b/client/src/action_buttons.rs @@ -5,13 +5,13 @@ use crate::event_ui::event_help_tooltip; use crate::happiness_ui::open_increase_happiness_dialog; use crate::influence_ui::new_cultural_influence_dialog; use crate::layout_ui::{bottom_left_texture, icon_pos}; -use crate::log_ui::MultilineText; use crate::move_ui::MoveIntent; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use itertools::Itertools; use server::action::Action; use server::city::City; -use server::content::custom_actions::{CustomAction, CustomActionInfo}; +use server::content::custom_actions::{CustomAction, SpecialActionInfo}; use server::cultural_influence::available_influence_actions; use server::happiness::available_happiness_actions; use server::playing_actions::{PlayingAction, PlayingActionType}; @@ -65,7 +65,7 @@ pub(crate) fn action_buttons(rc: &RenderContext) -> RenderResult { &MultilineText::of(rc, "Cultural Influence"), ) { - return base_or_custom_action(rc, &influence, "Influence culture", |d| { + return base_or_modified_action(rc, &influence, "Influence culture", |d| { new_cultural_influence_dialog(rc.game, rc.shown_player.index, d) }); } @@ -74,7 +74,7 @@ pub(crate) fn action_buttons(rc: &RenderContext) -> RenderResult { if let Some(action) = generic_custom_action(rc, &c, None) { if bottom_left_texture( rc, - &assets.custom_actions[&c.action], + &assets.custom_actions[&c.custom_action_type()], icon_pos(i as i8, -1), &event_help_tooltip(rc, &c.event_origin), ) { @@ -103,7 +103,7 @@ pub(crate) fn custom_action_buttons<'a>( .filter_map(|c| { generic_custom_action(rc, &c, city).map(|action| { IconAction::new( - &rc.assets().custom_actions[&c.action], + &rc.assets().custom_actions[&c.custom_action_type()], false, event_help_tooltip(rc, &c.event_origin), Box::new(move || action.clone()), @@ -128,10 +128,10 @@ fn global_move(rc: &RenderContext) -> RenderResult { fn generic_custom_action( rc: &RenderContext, - c: &CustomActionInfo, + c: &SpecialActionInfo, city: Option<&City>, ) -> Option { - let custom_action_type = c.action; + let custom_action_type = c.custom_action_type(); if let Some(city) = city { c.is_city_available(rc.game, city) @@ -147,7 +147,7 @@ fn generic_custom_action( } } -pub(crate) fn base_or_custom_action( +pub(crate) fn base_or_modified_action( rc: &RenderContext, action_types: &[PlayingActionType], title: &str, @@ -158,8 +158,8 @@ pub(crate) fn base_or_custom_action( action_types .iter() .map(|action_type| match action_type { - PlayingActionType::Custom(c) => { - let origin = &rc.shown_player.custom_action_info(*c).event_origin; + PlayingActionType::Special(s) => { + let origin = &rc.shown_player.special_action_info(s).event_origin; ( Some(origin.clone()), execute(BaseOrCustomDialog { diff --git a/client/src/advance_ui.rs b/client/src/advance_ui.rs index c1a95a82..1aad23ea 100644 --- a/client/src/advance_ui.rs +++ b/client/src/advance_ui.rs @@ -1,7 +1,7 @@ use crate::city_ui::add_building_description; use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::layout_ui::{button_pressed, top_centered_text}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::payment_ui::{Payment, payment_dialog}; use crate::render_context::RenderContext; use crate::unit_ui::add_unit_description; diff --git a/client/src/assets.rs b/client/src/assets.rs index d85278b6..a9c149c9 100644 --- a/client/src/assets.rs +++ b/client/src/assets.rs @@ -60,6 +60,10 @@ pub(crate) struct Assets { pub custom_actions: HashMap, pub civ: HashMap, pub default_civ: CivAssets, + + // Log + pub hex: Texture2D, + pub fast: Texture2D, } impl Assets { @@ -116,6 +120,10 @@ impl Assets { export: load_png(include_bytes!("../assets/export-2-svgrepo-com.png")), play: load_png(include_bytes!("../assets/play-1003-svgrepo-com.png")), pause: load_png(include_bytes!("../assets/pause-1006-svgrepo-com.png")), + + // Log + hex: load_png(include_bytes!("../assets/hex-svgrepo-com.png")), + fast: load_png(include_bytes!("../assets/lightning-svgrepo-com.png")), } } diff --git a/client/src/cards_ui.rs b/client/src/cards_ui.rs index 20c1a88f..1a1a8169 100644 --- a/client/src/cards_ui.rs +++ b/client/src/cards_ui.rs @@ -3,7 +3,7 @@ use crate::custom_phase_ui; use crate::custom_phase_ui::MultiSelection; use crate::dialog_ui::ok_button; use crate::layout_ui::{bottom_centered_text, button_pressed, rect_from}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::player_ui::get_combat; use crate::render_context::RenderContext; use crate::select_ui::HighlightType; @@ -58,7 +58,7 @@ impl SelectionInfo { pub(crate) fn show_cards(rc: &RenderContext) -> RenderResult { let p = rc.shown_player; - let cards = hand_cards(p, &HandCardType::get_all()); + let cards = hand_cards(p, &HandCardType::get_all_and_public(), rc.game); let size = vec2(180., 30.); let selection = match &rc.state.active_dialog { diff --git a/client/src/city_ui.rs b/client/src/city_ui.rs index a5842095..b5908fd5 100644 --- a/client/src/city_ui.rs +++ b/client/src/city_ui.rs @@ -1,4 +1,4 @@ -use crate::action_buttons::{base_or_custom_action, custom_action_buttons}; +use crate::action_buttons::{base_or_modified_action, custom_action_buttons}; use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::collect_ui::CollectResources; use crate::construct_ui::{ConstructionPayment, ConstructionProject}; @@ -11,8 +11,8 @@ use crate::hex_ui; use crate::layout_ui::{ draw_scaled_icon, draw_scaled_icon_with_tooltip, is_in_circle, is_mouse_pressed, }; -use crate::log_ui::MultilineText; use crate::map_ui::{move_units_buttons, show_map_action_buttons}; +use crate::multiline::MultilineText; use crate::recruit_unit_ui::RecruitAmount; use crate::render_context::RenderContext; use crate::select_ui::HighlightType; @@ -241,7 +241,7 @@ fn collect_resources_button<'a>(rc: &'a RenderContext, city: &'a City) -> Option false, MultilineText::of(rc, "Collect Resources"), Box::new(move || { - base_or_custom_action(rc, &actions, "Collect resources", |custom| { + base_or_modified_action(rc, &actions, "Collect resources", |custom| { let i = possible_resource_collections( rc.game, city.position, @@ -345,27 +345,27 @@ pub(crate) fn draw_city(rc: &RenderContext, city: &City) -> RenderResult { { draw_selected_state(rc, c, 15., h)?; } else { - draw_mood_state(rc, city, c); + let mood = match &rc.state.active_dialog { + ActiveDialog::IncreaseHappiness(increase) => { + let steps = increase + .steps + .iter() + .find(|(p, _)| p == &city.position) + .map_or(&0, |(_, s)| s); + &city.mood_state.clone().add(*steps) + } + _ => &city.mood_state, + }; + + draw_mood_state(rc, c, mood); } let i = draw_wonders(rc, city, c, owner, highlighted)?; draw_buildings(rc, city, c, highlighted, i) } -fn draw_mood_state(rc: &RenderContext, city: &City, c: Vec2) { - let state = &rc.state; - let mood = match &state.active_dialog { - ActiveDialog::IncreaseHappiness(increase) => { - let steps = increase - .steps - .iter() - .find(|(p, _)| p == &city.position) - .map_or(&0, |(_, s)| s); - &city.mood_state.clone().add(*steps) - } - _ => &city.mood_state, - }; - let t = match mood { +pub(crate) fn draw_mood_state(rc: &RenderContext, c: Vec2, mood_state: &MoodState) { + let t = match mood_state { MoodState::Happy => Some(&rc.assets().resources[&ResourceType::MoodTokens]), MoodState::Neutral => None, MoodState::Angry => Some(&rc.assets().angry), @@ -375,7 +375,7 @@ fn draw_mood_state(rc: &RenderContext, city: &City, c: Vec2) { draw_scaled_icon( rc, t, - &format!("Happiness: {}", city.mood_state), + &format!("Happiness: {mood_state}"), c + vec2(-size / 2., -size / 2.), size, ); diff --git a/client/src/client.rs b/client/src/client.rs index cd198f1e..702e59e9 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -21,8 +21,9 @@ use crate::layout_ui::{ ICON_SIZE, bottom_center_anchor, bottom_centered_text_with_offset, draw_scaled_icon_with_tooltip, icon_pos, is_mouse_pressed, top_right_texture, }; -use crate::log_ui::{LogDialog, MultilineText, show_log}; +use crate::log_ui::{LogDialog, show_log}; use crate::map_ui::{draw_map, explore_dialog, show_tile_menu}; +use crate::multiline::MultilineText; use crate::player_ui::{ ColumnLabelPainter, player_select, show_global_controls, show_top_center, show_top_left, }; @@ -52,10 +53,12 @@ fn set_zoom(state: &mut State) { let w = state.raw_screen_size.x; let h = state.raw_screen_size.y; state.world_camera.viewport = Some((0, 0, w as i32, h as i32)); + state.world_camera.zoom.x = state.world_zoom * state.world_zoom_factor; state.world_camera.zoom.y = state.world_camera.zoom.x * w / h; let scale = state.ui_scale; - state.screen_size = vec2(w / scale, h / scale); + let adjust = (1.0 - scale) * 250.0; // not sure why this is needed on mobile + state.screen_size = vec2((w / scale) - adjust, h / scale - adjust); state.ui_camera = Camera2D { zoom: vec2(2.0 / w * scale, 2.0 / h * scale), diff --git a/client/src/client_state.rs b/client/src/client_state.rs index 8339d19e..f74a84fd 100644 --- a/client/src/client_state.rs +++ b/client/src/client_state.rs @@ -17,6 +17,7 @@ use crate::recruit_unit_ui::{RecruitAmount, RecruitSelection}; use crate::render_context::{RenderContext, RenderStage}; use crate::status_phase_ui::ChooseAdditionalAdvances; use macroquad::prelude::*; +use serde::{Deserialize, Serialize}; use server::action::Action; use server::advance::Advance; use server::card::HandCard; @@ -112,11 +113,11 @@ impl ActiveDialog { ActiveDialog::StructuresRequest(d, r) => { if let Some(b) = d { let v = vec!["Click on a building to influence its culture".to_string()]; - if let PlayingActionType::Custom(c) = &b.action_type { + if let PlayingActionType::Special(c) = &b.action_type { let mut r = v.clone(); r.extend(event_help( rc, - &rc.shown_player.custom_action_info(*c).event_origin, + &rc.shown_player.special_action_info(c).event_origin, )); } v @@ -338,6 +339,12 @@ pub(crate) enum CameraMode { World, } +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum ColorProfile { + Standard, + HighContrast, +} + use crate::info_ui::InfoDialog; #[cfg(not(target_arch = "wasm32"))] use server::ai::AI; @@ -349,18 +356,21 @@ pub struct State { pub show_player: usize, pub(crate) active_dialog: ActiveDialog, pub(crate) pending_update: Option, - pub world_camera: Camera2D, - pub ui_camera: Camera2D, + pub(crate) world_camera: Camera2D, + pub(crate) world_zoom: f32, + pub world_zoom_factor: f32, + pub(crate) ui_camera: Camera2D, pub ui_scale: f32, pub raw_screen_size: Vec2, - pub screen_size: Vec2, // scaled by ui_scale + pub(crate) screen_size: Vec2, // scaled by ui_scale pub(crate) mouse_positions: Vec, - pub focused_tile: Option, - pub show_permanent_effects: bool, + pub(crate) focused_tile: Option, + pub(crate) show_permanent_effects: bool, pub ai_autoplay: bool, - pub pan_map: bool, + pub(crate) pan_map: bool, #[cfg(not(target_arch = "wasm32"))] pub ai_players: Vec, + pub color_profile: ColorProfile, } pub const ZOOM: f32 = 0.001; @@ -377,12 +387,13 @@ impl State { control_player: None, show_player: 0, world_camera: Camera2D { - zoom: vec2(ZOOM, ZOOM), offset: OFFSET, ..Default::default() }, ui_camera: Camera2D::default(), ui_scale: 1.0, + world_zoom_factor: 1.0, + world_zoom: ZOOM, raw_screen_size: vec2(0., 0.), screen_size: vec2(0., 0.), mouse_positions: vec![], @@ -392,6 +403,7 @@ impl State { ai_autoplay: false, #[cfg(not(target_arch = "wasm32"))] ai_players: vec![], + color_profile: ColorProfile::Standard, } } @@ -589,11 +601,11 @@ impl State { } pub(crate) fn draw_text(&self, text: &str, x: f32, y: f32) { - self.draw_text_with_color(text, x, y, BLACK); + self.draw_text_ex(text, x, y, BLACK, FONT_SIZE); } - pub(crate) fn draw_text_with_color(&self, text: &str, x: f32, y: f32, color: Color) { - if crate::localization::draw(text, FONT_SIZE, x, y, color) { + pub(crate) fn draw_text_ex(&self, text: &str, x: f32, y: f32, color: Color, font_size: u16) { + if crate::localization::draw(text, font_size, x, y, color) { return; } draw_text_ex( @@ -602,7 +614,7 @@ impl State { y, TextParams { font: Some(&self.assets.font), - font_size: FONT_SIZE, + font_size, color, ..Default::default() }, diff --git a/client/src/custom_phase_ui.rs b/client/src/custom_phase_ui.rs index 7c0b47ba..b23d2d78 100644 --- a/client/src/custom_phase_ui.rs +++ b/client/src/custom_phase_ui.rs @@ -2,7 +2,7 @@ use crate::advance_ui::{AdvanceState, show_advance_menu}; use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::dialog_ui::{BaseOrCustomDialog, OkTooltip, cancel_button_with_tooltip, ok_button}; use crate::layout_ui::{bottom_center_anchor, bottom_centered_text, icon_pos}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::payment_ui::{Payment, multi_payment_dialog, payment_dialog}; use crate::player_ui::choose_player_dialog; use crate::render_context::RenderContext; diff --git a/client/src/dialog_ui.rs b/client/src/dialog_ui.rs index 4838ac2c..bab65f85 100644 --- a/client/src/dialog_ui.rs +++ b/client/src/dialog_ui.rs @@ -1,6 +1,6 @@ use crate::client_state::{NO_UPDATE, PendingUpdate, RenderResult, StateUpdate}; use crate::layout_ui::{bottom_centered_text_with_offset, bottom_right_texture, icon_pos}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use macroquad::math::{Vec2, vec2}; use server::playing_actions::PlayingActionType; diff --git a/client/src/event_ui.rs b/client/src/event_ui.rs index 0c658a08..341a9289 100644 --- a/client/src/event_ui.rs +++ b/client/src/event_ui.rs @@ -1,4 +1,4 @@ -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::payment_ui::Payment; use crate::render_context::RenderContext; use server::content::effects; diff --git a/client/src/happiness_ui.rs b/client/src/happiness_ui.rs index 6d0179d2..5f2d307e 100644 --- a/client/src/happiness_ui.rs +++ b/client/src/happiness_ui.rs @@ -1,4 +1,4 @@ -use crate::action_buttons::base_or_custom_action; +use crate::action_buttons::base_or_modified_action; use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::dialog_ui::BaseOrCustomDialog; use crate::payment_ui::{Payment, payment_dialog}; @@ -66,7 +66,7 @@ pub(crate) fn open_increase_happiness_dialog( actions: &[PlayingActionType], init: impl Fn(IncreaseHappinessConfig) -> IncreaseHappinessConfig, ) -> RenderResult { - base_or_custom_action(rc, actions, "Increase happiness", |custom| { + base_or_modified_action(rc, actions, "Increase happiness", |custom| { ActiveDialog::IncreaseHappiness(init(IncreaseHappinessConfig::new(rc, custom))) }) } diff --git a/client/src/hex_ui.rs b/client/src/hex_ui.rs index 629cd4db..e281af47 100644 --- a/client/src/hex_ui.rs +++ b/client/src/hex_ui.rs @@ -1,6 +1,6 @@ use std::f32::consts::PI; -use crate::layout_ui::draw_scaled_icon; +use crate::layout_ui::{FONT_SIZE, draw_scaled_icon}; use crate::render_context::RenderContext; use hex2d::{Coordinate, Spacing}; use macroquad::color::Color; @@ -58,12 +58,13 @@ pub(crate) fn draw_hex( } draw_hexagon(c.x, c.y, SIZE, 2.0, false, DARKGRAY, overlay); let text_y = c.y - 35.0; - rc.draw_text_with_color(&p.to_string(), c.x - 30.0, text_y, text_color); - rc.draw_text_with_color( + rc.draw_text_ex(&p.to_string(), c.x - 30.0, text_y, text_color, FONT_SIZE); + rc.draw_text_ex( &block_for_position(rc.game, p).0.to_string(), c.x + 10.0, text_y, text_color, + FONT_SIZE, ); } diff --git a/client/src/info_ui.rs b/client/src/info_ui.rs index 2380b690..eb6774f6 100644 --- a/client/src/info_ui.rs +++ b/client/src/info_ui.rs @@ -4,7 +4,7 @@ use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::dialog_ui::{OkTooltip, ok_button}; use crate::event_ui::event_help_tooltip; use crate::layout_ui::button_pressed; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use itertools::Itertools; use macroquad::color::Color; diff --git a/client/src/layout_ui.rs b/client/src/layout_ui.rs index 2212cc72..316c9904 100644 --- a/client/src/layout_ui.rs +++ b/client/src/layout_ui.rs @@ -1,4 +1,4 @@ -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use crate::tooltip::show_tooltip_for_rect; use macroquad::color::WHITE; diff --git a/client/src/lib.rs b/client/src/lib.rs index 3d519fce..1c3f5e7c 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -27,14 +27,17 @@ mod influence_ui; mod info_ui; mod layout_ui; mod localization; +mod log_collector; mod log_ui; mod map_ui; mod move_ui; +mod multiline; mod payment_ui; mod player_ui; mod recruit_unit_ui; mod render_context; mod resource_ui; +mod richtext; mod select_ui; mod status_phase_ui; mod tooltip; diff --git a/client/src/local_client/bin/main.rs b/client/src/local_client/bin/main.rs index 6ad78899..fe0db1f3 100644 --- a/client/src/local_client/bin/main.rs +++ b/client/src/local_client/bin/main.rs @@ -26,7 +26,7 @@ enum Mode { async fn main() { start_profiling(); - set_window_size(1200, 600); + set_window_size(1800, 1600); let mut args: Vec = env::args().collect(); args.remove(0); // program name @@ -57,7 +57,8 @@ async fn main() { } else { CivSetupOption::Random }, - patch: PatchOption::BalancePatch, + patch: PatchOption::Standard, + ..GameOptions::default() }) .build(), ); diff --git a/client/src/log_collector.rs b/client/src/log_collector.rs new file mode 100644 index 00000000..8c8e1ddc --- /dev/null +++ b/client/src/log_collector.rs @@ -0,0 +1,450 @@ +use crate::log_ui::multiline_label; +use crate::render_context::RenderContext; +use server::action::Action; +use server::card::HandCardLocation; +use server::combat_roll::UnitCombatRoll; +use server::content::ability::combat_event_origin; +use server::cultural_influence::InfluenceCultureAttemptInfo; +use server::events::EventOrigin; +use server::game_setup::setup_event_origin; +use server::log::{ + ActionLogAction, ActionLogAge, ActionLogBalance, ActionLogEntry, ActionLogItem, ActionLogRound, + ActionLogTurn, SetupTurnType, TurnType, +}; +use server::playing_actions::PlayingAction; +use server::status_phase::StatusPhaseStateType; +use server::unit::Units; +use server::utils::remove_element_by; + +#[derive(Clone, Debug)] +pub(crate) struct ActionLogInfluence { + pub(crate) player: usize, + pub(crate) info: InfluenceCultureAttemptInfo, +} + +#[derive(Clone, Debug)] +pub(crate) struct ActionLogBody { + pub(crate) action: ActionLogAction, + pub(crate) action_cost: bool, + pub(crate) argument: Option, + pub(crate) payment: Option, +} + +impl ActionLogBody { + pub(crate) fn new(action: ActionLogAction) -> Self { + ActionLogBody { + action, + action_cost: false, + argument: None, + payment: None, + } + } +} + +#[derive(Clone, Debug)] +pub(crate) enum LogBody { + Message(String), + Item(ActionLogItem), + PlayerSetup(SetupTurnType), + PlayerTurn { + age: u32, + round: u32, + player: usize, + }, + Action(Box), + CombatUnits { + role: String, + player: usize, + units: Units, + }, + DieRoll(UnitCombatRoll), + InfluenceStartCity(ActionLogInfluence), + InfluenceRangeBoost(ActionLogInfluence), +} + +#[derive(Clone, Debug)] +pub(crate) struct LogEntry { + pub(crate) body: LogBody, + pub(crate) active_origin: Option, + pub(crate) indent: usize, + pub(crate) age: u32, + pub(crate) round: u32, +} + +impl LogEntry { + pub(crate) fn new( + body: LogBody, + active_origin: Option, + indent: usize, + age: u32, + round: u32, + ) -> Self { + LogEntry { + body, + active_origin, + indent, + age, + round, + } + } +} + +struct LogCollector { + age: u32, + round: u32, + log_entries: Vec, + active_origin: Option, +} + +impl LogCollector { + fn new() -> Self { + Self { + log_entries: Vec::new(), + active_origin: None, + age: 0, + round: 0, + } + } + + fn add_entry(&mut self, body: LogBody, indent: usize) { + self.log_entries.push(LogEntry::new( + body, + self.active_origin.clone(), + indent, + self.age, + self.round, + )); + } + + fn add_message(&mut self, message: &str, indent: usize) { + self.add_entry(LogBody::Message(message.to_string()), indent); + } +} + +pub(crate) fn collect_log_entries(rc: &RenderContext) -> Vec { + let mut c = LogCollector::new(); + + for age in &rc.game.log { + c.age = age.age; + if age.age == 0 { + c.add_message("Game Start", 0); + } + for round in &age.rounds { + c.round = round.round; + if round.round > 0 { + c.add_message(&format!("Age {}, Round {}", age.age, round.round), 0); + } + for turn in &round.turns { + c.active_origin = None; + let indent = add_title_items(&mut c, age, round, turn); + for action in &turn.actions { + collect_action(rc, &mut c, action, indent + action.active_events); + } + } + } + } + c.log_entries +} + +fn collect_action( + rc: &RenderContext, + c: &mut LogCollector, + action: &ActionLogAction, + indent: usize, +) { + let origin = &action.origin; + if origin.is_some() { + c.active_origin.clone_from(origin); + } + let mut items = action.items.clone(); + let indent = if matches!(action.action, Action::StartTurn) { + indent + } else { + let mut body = ActionLogBody::new(action.clone()); + inline_action_items(&mut items, &mut body); + c.add_entry(LogBody::Action(Box::new(body.clone())), indent); + add_additional_action_items(c, &mut body, action, indent + 1); + indent + 1 + }; + + for item in &items { + match &item.entry { + ActionLogEntry::Text(m) => { + add_text_item(rc, c, indent, item, m); + continue; + } + ActionLogEntry::HandCard { + to: HandCardLocation::PlayToKeep, + .. + } => { + // redundant + continue; + } + _ => {} + } + + set_item_origin(c, item); + c.add_entry(LogBody::Item(item.clone()), indent); + add_additional_items(c, item, indent); + } +} + +fn add_additional_action_items( + c: &mut LogCollector, + body: &mut ActionLogBody, + action: &ActionLogAction, + indent: usize, +) { + if let Some(ActionLogEntry::InfluenceCultureAttempt(i)) = &body.argument { + c.add_entry( + LogBody::InfluenceStartCity(ActionLogInfluence { + player: action.player, + info: i.clone(), + }), + indent, + ); + if !i.range_boost_cost.is_free() { + c.add_entry( + LogBody::InfluenceRangeBoost(ActionLogInfluence { + player: action.player, + info: i.clone(), + }), + indent, + ); + } + } +} + +fn add_text_item( + rc: &RenderContext, + c: &mut LogCollector, + indent: usize, + item: &ActionLogItem, + m: &str, +) { + // Simulate multiline labels to get accurate line count + multiline_label(rc.state, m, max_width(rc), |i, label: &str| { + if i == 0 { + c.add_entry(LogBody::Item(item.clone()), indent); + } else { + c.add_message(label, indent); + } + }); +} + +fn set_item_origin(c: &mut LogCollector, item: &ActionLogItem) { + if matches!( + item.entry, + ActionLogEntry::CombatRound(_) | ActionLogEntry::CombatRoll(_) + ) { + c.active_origin = Some(combat_event_origin()); + } +} + +fn add_title_items( + c: &mut LogCollector, + age: &ActionLogAge, + round: &ActionLogRound, + turn: &ActionLogTurn, +) -> usize { + match &turn.turn_type { + TurnType::Player(p) => { + c.add_entry( + LogBody::PlayerTurn { + age: age.age, + round: round.round, + player: *p, + }, + 1, + ); + 2 + } + TurnType::Setup(t) => { + c.active_origin = Some(setup_event_origin()); + c.add_entry(LogBody::PlayerSetup(t.clone()), 1); + 2 + } + TurnType::StatusPhase(t) => status_phase_title(age, *t, c), + } +} + +fn add_additional_items(c: &mut LogCollector, item: &ActionLogItem, indent: usize) { + match &item.entry { + ActionLogEntry::CombatRound(r) => { + c.add_entry( + LogBody::CombatUnits { + role: "Attacking:".to_string(), + player: item.player, + units: r.attackers.clone(), + }, + indent + 1, + ); + c.add_entry( + LogBody::CombatUnits { + role: "Defending:".to_string(), + player: r.defending_player, + units: r.defenders.clone(), + }, + indent + 1, + ); + } + ActionLogEntry::CombatRoll(r) => { + for m in &r.combat_modifiers { + c.add_message(m, indent + 1); + } + for r in &r.rolls { + c.add_entry(LogBody::DieRoll(r.clone()), indent + 1); + } + } + _ => {} + } +} + +fn inline_action_items(items: &mut Vec, action: &mut ActionLogBody) { + if remove_element_by(items, |item| { + matches!( + item, + ActionLogItem { + player, + entry: ActionLogEntry::Action { + balance: ActionLogBalance::Pay, + .. + }, + .. + } if *player == action.action.player + ) + }) + .is_some() + { + action.action_cost = true; + } + action.argument = pull_action_arg(items, action); + action.payment = remove_element_by(items, |item| { + matches!( + item, + ActionLogItem { + player, + entry: ActionLogEntry::Resources { + balance: ActionLogBalance::Pay, + .. + }, + .. + } if *player == action.action.player + ) + }) + .map(|i| i.entry); +} + +pub fn find_action_arg( + list: &mut Vec, + body: &ActionLogBody, + f: impl Fn(&ActionLogItem) -> bool, +) -> Option { + let arg = remove_element_by(list, |i| f(i) && i.player == body.action.player).map(|i| i.entry); + assert!(arg.is_some(), "Could not find action argument in log items"); + arg +} + +fn pull_action_arg(items: &mut Vec, body: &ActionLogBody) -> Option { + match &body.action.action { + Action::Playing(a) => match a { + PlayingAction::Advance(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::Advance(_), + .. + } + ) + }), + PlayingAction::Collect(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::Resources { + balance: ActionLogBalance::Gain, + .. + }, + .. + } + ) + }), + PlayingAction::FoundCity { .. } | PlayingAction::Construct(_) => { + find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::Structure(_), + .. + } + ) + }) + } + PlayingAction::Recruit(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::Units { .. }, + .. + } + ) + }), + PlayingAction::InfluenceCultureAttempt(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::InfluenceCultureAttempt(_), + .. + } + ) + }), + PlayingAction::ActionCard(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::HandCard { .. }, + .. + } + ) + }), + _ => None, + }, + Action::Movement(_) => find_action_arg(items, body, |item| { + matches!( + item, + ActionLogItem { + entry: ActionLogEntry::Move(_), + .. + } + ) + }), + _ => None, + } +} + +fn status_phase_title(age: &ActionLogAge, t: StatusPhaseStateType, c: &mut LogCollector) -> usize { + if matches!(t, StatusPhaseStateType::CompleteObjectives) { + c.add_message(&format!("Status Phase (Age {})", age.age), 2); + } + + c.add_message( + match t { + StatusPhaseStateType::CompleteObjectives => "Complete Objectives", + StatusPhaseStateType::FreeAdvance => "Free Advance", + StatusPhaseStateType::DrawCards => "Draw Cards", + StatusPhaseStateType::RazeSize1City => "Raze Size 1 City", + StatusPhaseStateType::ChangeGovernmentType => "Change Government Type", + StatusPhaseStateType::DetermineFirstPlayer => "Determine First Player", + }, + 3, + ); + if matches!(t, StatusPhaseStateType::DrawCards) { + 4 + } else { + 3 // response adds another indent + } +} + +fn max_width(rc: &RenderContext) -> f32 { + rc.state.screen_size.x - 300. +} diff --git a/client/src/log_ui.rs b/client/src/log_ui.rs index f21fcaa8..9c79a278 100644 --- a/client/src/log_ui.rs +++ b/client/src/log_ui.rs @@ -1,27 +1,22 @@ use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, State, StateUpdate}; use crate::layout_ui::bottom_center_texture; +use crate::log_collector::{ActionLogBody, LogBody, LogEntry, collect_log_entries}; use crate::render_context::RenderContext; +use crate::richtext::RichTextDrawer; use macroquad::math::vec2; -use server::log::TurnType; - -#[derive(Clone, Debug)] -pub(crate) struct LogEntry { - pub age: Option, - pub round: Option, - pub name: String, - pub message: String, -} - -impl LogEntry { - pub(crate) fn new(age: Option, round: Option, name: &str, message: String) -> Self { - LogEntry { - age: age.map(|a| a.to_string()), - round: round.map(|r| r.to_string()), - name: name.to_string(), - message, - } - } -} +use server::action::Action; +use server::card::hand_card_message; +use server::combat_roll::UnitCombatRoll; +use server::content::custom_actions::SpecialAction; +use server::content::persistent_events::EventResponse; +use server::events::EventOrigin; +use server::log::{ + ActionLogBalance, ActionLogEntry, ActionLogEntryAdvance, ActionLogEntryMove, + ActionLogIncidentToken, ActionLogItem, +}; +use server::movement::MovementAction; +use server::playing_actions::{PlayingAction, PlayingActionType}; +use server::unit::UnitType; #[derive(Clone, Debug)] pub(crate) struct LogDialog { @@ -35,47 +30,7 @@ impl LogDialog { pub(crate) fn new(rc: &RenderContext) -> Self { let lines_per_page = (rc.state.screen_size.y - 150.) as usize / 25; - // Build structured log entries with age, round, player, and message - let mut log_entries = Vec::new(); - - for age in &rc.game.log { - for round in &age.rounds { - for turn in &round.turns { - for action in &turn.actions { - for message in &action.log { - // Simulate multiline labels to get accurate line count - multiline_label( - rc.state, - message, - Self::max_width(rc), - |label: &str| { - log_entries.push(match turn.turn_type { - TurnType::Player(p) => LogEntry::new( - Some(age.age), - Some(round.round), - &rc.game.player_name(p), - label.to_string(), - ), - TurnType::Setup => LogEntry::new( - None, - None, - "Game Started", - label.to_string(), - ), - TurnType::StatusPhase => LogEntry::new( - None, - Some(round.round), - "Status Phase", - label.to_string(), - ), - }); - }, - ); - } - } - } - } - } + let log_entries = collect_log_entries(rc); let total_lines = log_entries.len(); let pages = if total_lines == 0 { @@ -91,68 +46,28 @@ impl LogDialog { log_entries, } } - - fn max_width(rc: &RenderContext) -> f32 { - rc.state.screen_size.x - 300. - } } pub(crate) fn show_log(rc: &RenderContext, d: &LogDialog) -> RenderResult { - let state = &rc.state; + let state = rc.state; // Use the pre-calculated log entries let start = d.current_page * d.lines_per_page; let end = usize::min(start + d.lines_per_page, d.log_entries.len()); - let mut y = 0.; - // Draw column headers - let age_pos = vec2(30., 20.); - let round_pos = vec2(80., 20.); - let player_pos = vec2(140., 20.); - let message_pos = vec2(280., 20.); + // Header: turn and round, unless age is 0 + if let Some(first_entry) = d.log_entries.get(start) + && first_entry.age > 0 + { + let header = format!("Age {}, Round {}", first_entry.age, first_entry.round); + let header_width = state.measure_text(&header).width; + rc.draw_text(&header, state.screen_size.x / 2. - header_width / 2., 30.); + } - rc.draw_text("Age", age_pos.x, age_pos.y); - rc.draw_text("Round", round_pos.x, round_pos.y); - rc.draw_text("Player", player_pos.x, player_pos.y); - rc.draw_text("Message", message_pos.x, message_pos.y); - - y += 1.5; // Add some space after headers - - // Track previous values to only show when they change - let mut prev_age: Option = None; - let mut prev_round: Option = None; - let mut prev_name: Option = None; + let mut y = 1.5; for entry in &d.log_entries[start..end] { - let message_text = &entry.message; - - // Calculate positions for each column - let age_pos = vec2(30., y * 25. + 20.); - let round_pos = vec2(80., y * 25. + 20.); - let player_pos = vec2(140., y * 25. + 20.); - let message_pos = vec2(280., y * 25. + 20.); - - // Draw each column - if let Some(age) = &entry.age - && entry.age != prev_age - { - rc.draw_text(age, age_pos.x, age_pos.y); - } - if let Some(round) = &entry.round - && entry.round != prev_round - { - rc.draw_text(round, round_pos.x, round_pos.y); - } - if Some(&entry.name) != prev_name.as_ref() { - rc.draw_text(&entry.name, player_pos.x, player_pos.y); - } - rc.draw_text(message_text, message_pos.x, message_pos.y); - - // Update previous values - prev_age.clone_from(&entry.age); - prev_round.clone_from(&entry.round); - prev_name = Some(entry.name.clone()); - + draw_line(rc, y, entry); y += 1.; } // Bottom center navigation @@ -199,20 +114,235 @@ pub(crate) fn show_log(rc: &RenderContext, d: &LogDialog) -> RenderResult { NO_UPDATE } -pub(crate) fn multiline_label(state: &State, label: &str, len: f32, mut print: impl FnMut(&str)) { +fn draw_line(rc: &RenderContext, y: f32, entry: &LogEntry) { + let message_pos = vec2(20. + entry.indent as f32 * 45.0, y * 25. + 20.); + + let mut drawer = RichTextDrawer::new(rc, message_pos); + + match &entry.body { + LogBody::Message(m) => rc.draw_text(m, message_pos.x, message_pos.y), + LogBody::Item(item) => { + draw_item(entry, &mut drawer, item); + } + LogBody::PlayerSetup(t) => { + drawer.player(t.player); + if let Some(civilization) = &t.civilization { + drawer.text("plays as"); + drawer.text(civilization); + } else { + drawer.text("starts without a civilization"); + } + } + LogBody::PlayerTurn { age, round, player } => { + drawer.player(*player); + drawer.text(&format!("starts their turn (Age {age}, Round {round})")); + } + LogBody::Action(a) => { + draw_action(&mut drawer, a); + } + LogBody::CombatUnits { + role, + player, + units, + } => { + drawer.text(role); + drawer.player(*player); + drawer.text("with"); + drawer.units(units, None); + } + LogBody::DieRoll(r) => { + draw_die_roll(&mut drawer, r); + } + LogBody::InfluenceStartCity(i) => { + drawer.player(i.player); + drawer.text("uses start city"); + drawer.at_location(i.info.starting_city_position); + } + LogBody::InfluenceRangeBoost(i) => { + drawer.player(i.player); + drawer.text("may pay"); + drawer.resources(&i.info.range_boost_cost.default, &ActionLogBalance::Pay); + drawer.text("to boost the range"); + } + } +} + +fn draw_item(entry: &LogEntry, drawer: &mut RichTextDrawer, item: &ActionLogItem) { + drawer.player(item.player); + let balance = item.entry.balance(); + if let Some(b) = &balance { + drawer.text(match b { + ActionLogBalance::Gain => "gains", + ActionLogBalance::Loss => "loses", + ActionLogBalance::Pay => "pays", + }); + } + + draw_entry(drawer, &item.entry, item.player); + + if entry + .active_origin + .as_ref() + .is_none_or(|o| o != &item.origin) + { + drawer.modifier(&item.origin.name(drawer.rc.game), balance); + } + item.modifiers.iter().for_each(|m| { + drawer.modifier(&m.name(drawer.rc.game), balance); + }); +} + +fn draw_die_roll(drawer: &mut RichTextDrawer, r: &UnitCombatRoll) { + let (bonus_str, add_value) = if r.bonus { + match r.unit_type { + UnitType::Settler | UnitType::Ship => panic!("unit does not have bonus"), + UnitType::Infantry => (Some("+1 combat value"), true), + UnitType::Cavalry if r.combat_bonus == Some(3) => { + (Some("+3 combat value (Horsemanship)"), true) + } + UnitType::Cavalry => (Some("+2 combat value"), true), + UnitType::Elephant => (Some("-1 hits, no combat value"), false), + UnitType::Leader(_) => (Some("re-roll"), false), + } + } else { + (None, true) + }; + + if add_value { + drawer.text(&format!("rolls a {}", r.value)); + } else { + drawer.text(&format!("rolls a ({})", r.value)); + } + drawer.unit_icon(r.unit_type); + if let Some(bonus_str) = bonus_str { + drawer.text(bonus_str); + } +} + +fn draw_entry(drawer: &mut RichTextDrawer, entry: &ActionLogEntry, player: usize) { + match entry { + ActionLogEntry::Action { balance, amount } => { + if let Some(a) = amount { + drawer.amount(*a, balance); + } + drawer.action_icon(); + } + ActionLogEntry::Resources { resources, balance } => { + drawer.resources(resources, balance); + } + ActionLogEntry::Advance(a) => { + draw_advance(drawer, a); + } + ActionLogEntry::Units { + units, + balance, + position, + } => { + drawer.units(units, Some(balance)); + drawer.at_location(*position); + } + ActionLogEntry::Structure(s) => { + drawer.structure(&s.structure, s.position, s.port_position, player); + } + ActionLogEntry::HandCard { card, from, to } => { + let (_, message) = hand_card_message(drawer.rc.game, card, from, to); + drawer.text(&message); + } + ActionLogEntry::MoodChange { city, mood } => { + drawer.text("'s city"); + drawer.at_location(*city); + drawer.text(&format!("becomes {mood}")); + drawer.mood(player, mood); + } + ActionLogEntry::Move(m) => draw_move(drawer, m), + ActionLogEntry::Explore { tiles } => { + drawer.text("explores:"); + for (p, t) in tiles { + drawer.location(*p); + drawer.text(&format!("is {t}")); + } + } + ActionLogEntry::CombatRound(r) => { + drawer.text(&format!("Combat Round {}", r.round)); + } + ActionLogEntry::CombatRoll(r) => { + drawer.text(&format!( + "rolls for combined combat value of {} and gets {} hits", + r.combat_value, r.hits, + )); + } + ActionLogEntry::Text(m) => { + drawer.text(m); + } + ActionLogEntry::InfluenceCultureAttempt(i) => { + drawer.structure(&i.structure, i.position, None, i.target_player); + } + } +} + +fn draw_advance(drawer: &mut RichTextDrawer, advance: &ActionLogEntryAdvance) { + drawer.icon(&drawer.rc.assets().advances); + drawer.text(advance.advance.name(drawer.rc.game)); + if let ActionLogIncidentToken::Take(t) = advance.incident_token { + if t > 0 { + drawer.text(&format!("and takes an event token ({t} left)")); + } else { + drawer.text("and takes the last event token - triggering an event!"); + } + } +} + +fn draw_move(drawer: &mut RichTextDrawer, m: &ActionLogEntryMove) { + let game = drawer.rc.game; + let t = game + .map + .get(m.destination) + .expect("the destination position should be on the map"); + let (verb, suffix) = if game.map.is_sea(m.start) { + if t.is_unexplored() || t.is_water() { + ("sails", "") + } else { + ("disembarks", "") + } + } else if m.embark_carrier_id.is_some() { + ("embarks", "") + } else if m.start.is_neighbor(m.destination) { + ("marches", "") + } else { + ("marches", " on roads") + }; + drawer.text(verb); + drawer.units(&m.units, None); + drawer.text("from"); + drawer.location(m.start); + drawer.text("to"); + drawer.location(m.destination); + if !suffix.is_empty() { + drawer.text(suffix); + } +} + +pub(crate) fn multiline_label( + state: &State, + label: &str, + len: f32, + mut print: impl FnMut(usize, &str), +) { if let Some(lines) = crate::localization::wrap(label, len, crate::layout_ui::FONT_SIZE) { - for line in lines { - print(&line); + for (i, line) in lines.iter().enumerate() { + print(i, line); } return; } let label = crate::localization::translate(label); let mut line = String::new(); + let mut i = 0; label.split(' ').for_each(|s| { let next = format!("{line} {s}"); let dimensions = state.measure_text(&next); if dimensions.width > len { - print(&line); + print(i, &line); + i += 1; line = " ".to_string(); } if !line.is_empty() { @@ -221,40 +351,160 @@ pub(crate) fn multiline_label(state: &State, label: &str, len: f32, mut print: i line.push_str(s); }); if !line.is_empty() { - print(&line); + print(i, &line); } } -pub(crate) struct MultilineText { - pub width: f32, - pub text: Vec, -} +fn draw_action(drawer: &mut RichTextDrawer, body: &ActionLogBody) { + if body.action_cost { + drawer.action_icon(); + } else { + drawer.icon(&drawer.rc.assets().fast); + } + let a = &body.action; + drawer.player(a.player); -impl MultilineText { - pub(crate) fn default() -> Self { - MultilineText { - width: 500., - text: vec![], + match &a.action { + Action::Playing(p) => draw_playing_action(drawer, p, body), + Action::Movement(m) => match m { + MovementAction::Move(_) => { + draw_argument(drawer, body); + } + MovementAction::Stop => { + drawer.text("stops movement"); + } + }, + Action::Response(r) => draw_response_action(drawer, r), + Action::Undo => panic!("Unexpected undo in log"), + Action::Redo => panic!("Unexpected redo in log"), + Action::StartTurn => panic!("Unexpected start turn in log"), + Action::ChooseCivilization(c) => { + drawer.text(&format!("Choose Civilization: {c}")); } } - pub(crate) fn of(rc: &RenderContext, text: &str) -> Self { - let mut t = Self::default(); - t.add(rc, text); - t - } - - pub(crate) fn from(rc: &RenderContext, text: &[String]) -> Self { - let mut t = Self::default(); - for label in text { - t.add(rc, label); - } - t - } - - pub(crate) fn add(&mut self, rc: &RenderContext, label: &str) { - multiline_label(rc.state, label, self.width, |line: &str| { - self.text.push(line.to_string()); - }); + if let Some(payment) = &body.payment { + drawer.text("paying"); + draw_entry(drawer, payment, body.action.player); + } +} + +fn draw_response_action(drawer: &mut RichTextDrawer, r: &EventResponse) { + match r { + EventResponse::SelectAdvance(_) => drawer.text("selects advance"), + EventResponse::Payment(_) => drawer.text("selects payment"), + EventResponse::ResourceReward(_) => drawer.text("receives"), + EventResponse::SelectPlayer(_p) => drawer.text("selects a player"), + EventResponse::SelectPositions(p) => { + drawer.text("selects positions"); + for pos in p { + drawer.location(*pos); + } + } + EventResponse::SelectUnitType(u) => { + drawer.text(&format!("select unit type: {}", u.name(drawer.rc.game))); + } + EventResponse::SelectUnits(_u) => drawer.text("selects units"), + EventResponse::SelectCaptives(_) => drawer.text("selects captives"), + EventResponse::SelectHandCards(_h) => drawer.text("selects hand cards"), + EventResponse::SelectStructures(_s) => drawer.text("select structures"), + EventResponse::Bool(b) => { + if *b { + drawer.text("accepts"); + } else { + drawer.text("declines"); + } + } + EventResponse::ChangeGovernmentType(c) => { + drawer.text(&format!("changes government to {}", c.new_government)); + } + EventResponse::ExploreResolution(_) => drawer.text("chooses rotation"), + } +} + +fn draw_playing_action(drawer: &mut RichTextDrawer, p: &PlayingAction, body: &ActionLogBody) { + let a = &body.action; + let origin = body.action.origin.as_ref(); + match p { + PlayingAction::Advance(_) => { + drawer.text("advances"); + draw_argument(drawer, body); + } + PlayingAction::FoundCity { .. } => { + drawer.text("founds a"); + draw_argument(drawer, body); + } + PlayingAction::Construct(_) => { + drawer.text("builds a"); + draw_argument(drawer, body); + } + PlayingAction::Collect(c) => { + drawer.text("collects"); + draw_argument(drawer, body); + drawer.at_location(c.city_position); + draw_modifier_suffix(drawer, &c.action_type, origin); + } + PlayingAction::Recruit(_) => { + drawer.text("recruits"); + draw_argument(drawer, body); + } + PlayingAction::IncreaseHappiness(i) => { + drawer.text("increases happiness"); + draw_modifier_suffix(drawer, &i.action_type, origin); + } + PlayingAction::InfluenceCultureAttempt(a) => { + drawer.text("attempts to influence"); + draw_argument(drawer, body); + draw_modifier_suffix(drawer, &a.action_type, origin); + } + PlayingAction::Custom(c) => { + drawer.text(&format!( + "starts {}", + a.origin + .as_ref() + .expect("origin should be set for custom actions") + .name(drawer.rc.game) + )); + if let Some(pos) = c.city { + drawer.at_location(pos); + } + } + PlayingAction::ActionCard(a) => { + drawer.text(&format!( + "plays action card: {}", + drawer.rc.game.cache.get_action_card(*a).name() + )); + } + PlayingAction::WonderCard(w) => { + drawer.text("plays wonder card"); + drawer.wonder(*w); + } + PlayingAction::EndTurn => { + drawer.text("ends their turn"); + } + } +} + +fn draw_modifier_suffix( + drawer: &mut RichTextDrawer, + action_type: &PlayingActionType, + origin: Option<&EventOrigin>, +) { + if let PlayingActionType::Special(SpecialAction::Modifier(_)) = action_type { + drawer.text(&format!( + "using {}", + origin + .as_ref() + .expect("origin not found") + .name(drawer.rc.game) + )); + } +} + +fn draw_argument(drawer: &mut RichTextDrawer, body: &ActionLogBody) { + if let Some(a) = &body.argument { + draw_entry(drawer, a, body.action.player); + } else { + panic!("subject missing argument"); } } diff --git a/client/src/map_ui.rs b/client/src/map_ui.rs index ca2ee5cb..5f2ae8cc 100644 --- a/client/src/map_ui.rs +++ b/client/src/map_ui.rs @@ -8,8 +8,8 @@ use crate::hex_ui::HexFeature; use crate::layout_ui::{ bottom_center_anchor, bottom_center_texture, bottom_right_texture, icon_pos, }; -use crate::log_ui::MultilineText; use crate::move_ui::{MoveIntent, movable_units}; +use crate::multiline::MultilineText; use crate::player_ui::get_combat; use crate::render_context::RenderContext; use crate::select_ui::HighlightType; @@ -120,12 +120,12 @@ fn get_overlay(rc: &RenderContext) -> HashMap { } pub(crate) fn pan_and_zoom(state: &mut State) { - let new_zoom = state.world_camera.zoom + mouse_wheel_speed() * 0.0006; + let new_zoom = state.world_zoom + mouse_wheel_speed() * 0.0006; let max = 0.005; let min = 0.0005; - let x = new_zoom.x.min(max).max(min); - if x < max && x > min { - state.world_camera.zoom = new_zoom; + let zoom = new_zoom.min(max).max(min); + if zoom < max && zoom > min { + state.world_zoom = new_zoom; } let pan_map = is_mouse_button_down(MouseButton::Left); diff --git a/client/src/multiline.rs b/client/src/multiline.rs new file mode 100644 index 00000000..d1fb8ebc --- /dev/null +++ b/client/src/multiline.rs @@ -0,0 +1,36 @@ +use crate::log_ui; +use crate::render_context::RenderContext; + +pub(crate) struct MultilineText { + pub width: f32, + pub text: Vec, +} + +impl MultilineText { + pub(crate) fn default() -> Self { + MultilineText { + width: 500., + text: vec![], + } + } + + pub(crate) fn of(rc: &RenderContext, text: &str) -> Self { + let mut t = Self::default(); + t.add(rc, text); + t + } + + pub(crate) fn from(rc: &RenderContext, text: &[String]) -> Self { + let mut t = Self::default(); + for label in text { + t.add(rc, label); + } + t + } + + pub(crate) fn add(&mut self, rc: &RenderContext, label: &str) { + log_ui::multiline_label(rc.state, label, self.width, |_, line: &str| { + self.text.push(line.to_string()); + }); + } +} diff --git a/client/src/payment_ui.rs b/client/src/payment_ui.rs index 566ab18c..bbd717c3 100644 --- a/client/src/payment_ui.rs +++ b/client/src/payment_ui.rs @@ -4,7 +4,7 @@ use crate::event_ui::event_help; use crate::layout_ui::{ ICON_SIZE, bottom_centered_text_with_offset, draw_scaled_icon_with_tooltip, }; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use crate::resource_ui::{new_resource_map, resource_name}; use crate::select_ui; diff --git a/client/src/player_ui.rs b/client/src/player_ui.rs index 1a2fb4ab..74c63837 100644 --- a/client/src/player_ui.rs +++ b/client/src/player_ui.rs @@ -7,8 +7,9 @@ use crate::layout_ui::{ bottom_centered_text_with_offset, bottom_right_texture, button_pressed, draw_scaled_icon_with_tooltip, icon_pos, top_center_anchor, top_center_texture, }; -use crate::log_ui::{MultilineText, multiline_label}; +use crate::log_ui::multiline_label; use crate::map_ui::terrain_name; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use crate::resource_ui::{new_resource_map, resource_name}; use crate::tooltip::show_tooltip_for_circle; @@ -27,7 +28,7 @@ use server::player::Player; use server::playing_actions::PlayingAction; use server::position::Position; use server::resource::ResourceType; -use server::status_phase::get_status_phase; +use server::status_phase::{get_status_phase, status_phase_type}; use server::victory_points::victory_points_parts; pub(crate) fn player_select(rc: &RenderContext) -> RenderResult { @@ -68,7 +69,7 @@ pub(crate) fn player_select(rc: &RenderContext) -> RenderResult { } let tooltip = if rc.state.control_player.is_some_and(|p| p == pl.index) { - format!("{pl} (You)") + format!("{} (You)", pl.get_name()) } else { pl.get_name() }; @@ -185,7 +186,7 @@ pub(crate) fn show_top_left(rc: &RenderContext, painter: &mut ColumnLabelPainter _ => painter.label(&format!("Age {}", game.age)), } if let Some(s) = get_status_phase(game) { - painter.label(&format!("Status Phase: {s}")); + painter.label(&format!("Status Phase: {}", status_phase_type(s))); } else { painter.label(&format!("Round {}", game.round)); } @@ -281,7 +282,7 @@ impl<'a> ColumnLabelPainter<'a> { pub fn label(&mut self, text: &str) { let rc = self.rc; - multiline_label(rc.state, text, self.max_column_width, |label| { + multiline_label(rc.state, text, self.max_column_width, |_, label| { self.used_column_width = self .used_column_width .max(rc.state.measure_text(label).width); diff --git a/client/src/recruit_unit_ui.rs b/client/src/recruit_unit_ui.rs index 0bba7526..c4bd91de 100644 --- a/client/src/recruit_unit_ui.rs +++ b/client/src/recruit_unit_ui.rs @@ -1,7 +1,7 @@ use crate::client_state::{ActiveDialog, NO_UPDATE, RenderResult, StateUpdate}; use crate::construct_ui::{ConstructionPayment, ConstructionProject}; use crate::dialog_ui::{OkTooltip, cancel_button, ok_button}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use crate::select_ui; use crate::select_ui::{CountSelector, HasCountSelectableObject, HighlightType, SELECT_RADIUS}; diff --git a/client/src/remote_client/bin/main.rs b/client/src/remote_client/bin/main.rs index e5dd3ed9..5fd990e6 100644 --- a/client/src/remote_client/bin/main.rs +++ b/client/src/remote_client/bin/main.rs @@ -4,7 +4,7 @@ use macroquad::prelude::next_frame; extern crate console_error_panic_hook; use client::client::{Features, GameSyncRequest, GameSyncResult, init, render_and_update}; -use client::client_state::State; +use client::client_state::{ColorProfile, State}; use macroquad::math::vec2; use serde::{Deserialize, Serialize}; use server::action::Action; @@ -74,7 +74,9 @@ struct RemoteClient { #[derive(Serialize, Deserialize, Debug)] struct Preferences { - ui_scale: Option, + ui_scale: String, + world_zoom_factor: String, + color_profile: ColorProfile, } #[macroquad::main("Clash")] @@ -120,15 +122,7 @@ impl RemoteClient { let prefs = self.control.receive_preferences(); if !prefs.is_empty() { - log("received preferences: {prefs}"); - let p: Preferences = - serde_json::from_str(&prefs).expect("preferences can't be deserialized"); - - if let Some(scale) = p.ui_scale { - self.state.ui_scale = - f32::from_str(&scale).expect("ui scale should be a float"); - log(&format!("set ui scale to {scale}")); - } + self.apply_preferences(&prefs); } let s = self.control.canvas_size(); @@ -150,6 +144,25 @@ impl RemoteClient { } } + fn apply_preferences(&mut self, prefs: &String) { + log(&format!("received preferences: {prefs}")); + let p: Preferences = + serde_json::from_str(prefs).expect("preferences can't be deserialized"); + + let scale = p.ui_scale; + self.state.ui_scale = f32::from_str(&scale).expect("ui scale should be a float"); + log(&format!("set ui scale to {scale}")); + + let zoom = p.world_zoom_factor; + self.state.world_zoom_factor = + f32::from_str(&zoom).expect("world zoom factor should be a float"); + log(&format!("set world zoom factor to {zoom}")); + + let profile = p.color_profile; + log(&format!("set color profile to {profile:?}",)); + self.state.color_profile = profile; + } + fn update_state(&mut self) -> GameSyncResult { let s = self.control.receive_state(); if !s.is_null() { diff --git a/client/src/render_context.rs b/client/src/render_context.rs index f6fe96f6..577cac70 100644 --- a/client/src/render_context.rs +++ b/client/src/render_context.rs @@ -2,10 +2,10 @@ use crate::assets::Assets; use crate::client_state::{CameraMode, RenderResult, State}; use crate::layout_ui::{IconBackground, limit_str}; use crate::payment_ui::Payment; -use macroquad::color::{Color, PINK, YELLOW}; +use macroquad::color::{Color, PINK}; use macroquad::input::mouse_position; use macroquad::math::{Vec2, bool}; -use macroquad::prelude::{BLACK, LIME, Rect, SKYBLUE, WHITE, set_camera}; +use macroquad::prelude::{BLACK, LIME, ORANGE, Rect, SKYBLUE, WHITE, set_camera}; use server::game::Game; use server::payment::PaymentOptions; use server::player::Player; @@ -159,7 +159,7 @@ impl RenderContext<'_> { return BLACK; } match player_index { - 0 => YELLOW, + 0 => ORANGE, 1 => PINK, 2 => SKYBLUE, 3 => LIME, @@ -187,9 +187,9 @@ impl RenderContext<'_> { } } - pub(crate) fn draw_text_with_color(&self, text: &str, x: f32, y: f32, color: Color) { + pub(crate) fn draw_text_ex(&self, text: &str, x: f32, y: f32, color: Color, font_size: u16) { if self.stage.is_main() { - self.state.draw_text_with_color(text, x, y, color); + self.state.draw_text_ex(text, x, y, color, font_size); } } diff --git a/client/src/richtext.rs b/client/src/richtext.rs new file mode 100644 index 00000000..73e9077e --- /dev/null +++ b/client/src/richtext.rs @@ -0,0 +1,214 @@ +use crate::city_ui::draw_mood_state; +use crate::client_state::ColorProfile; +use crate::layout_ui::{FONT_SIZE, draw_scaled_icon}; +use crate::render_context::RenderContext; +use macroquad::color::{BLACK, BLUE, Color, RED}; +use macroquad::math::{Vec2, vec2}; +use macroquad::prelude::{GREEN, Texture2D}; +use server::city::MoodState; +use server::log::ActionLogBalance; +use server::position::Position; +use server::resource_pile::ResourcePile; +use server::structure::Structure; +use server::unit::{UnitPrintArg, UnitType, Units}; +use server::wonder::Wonder; + +pub struct RichTextDrawer<'a> { + pub(crate) rc: &'a RenderContext<'a>, + pub(crate) current_pos: Vec2, + space: f32, +} + +impl RichTextDrawer<'_> { + pub(crate) fn new<'a>(rc: &'a RenderContext<'_>, start_pos: Vec2) -> RichTextDrawer<'a> { + RichTextDrawer { + rc, + current_pos: start_pos, + space: rc.state.measure_text(" ").width, + } + } + + pub(crate) fn text(&mut self, text: &str) { + self.text_ex(text, BLACK, FONT_SIZE); + } + + fn text_ex(&mut self, text: &str, color: Color, font_size: u16) { + self.rc.draw_text_ex( + text, + self.current_pos.x, + self.current_pos.y, + color, + font_size, + ); + self.current_pos.x += self.rc.state.measure_text(text).width + self.space; + } + + pub(crate) fn modifier(&mut self, modifier: &str, balance: Option<&ActionLogBalance>) { + let verb = match balance { + None | Some(ActionLogBalance::Gain) => "using", + Some(ActionLogBalance::Loss) => "to", + Some(ActionLogBalance::Pay) => "for", + }; + self.text(&format!("{verb} {modifier}")); + } + + pub(crate) fn icon(&mut self, texture: &Texture2D) { + self.icon_with_size(texture, 20.0); + } + + fn icon_with_size(&mut self, texture: &Texture2D, size: f32) { + draw_scaled_icon( + &self.rc.no_icon_background(), + texture, + "", + vec2(self.current_pos.x, self.current_pos.y - size / 2.0 - 5.0), + size, + ); + self.current_pos.x += size + self.space; + } + + pub(crate) fn player(&mut self, player: usize) { + self.text_ex( + &self.rc.game.player_name(player), + self.rc.player_color(player), + FONT_SIZE, + ); + self.current_pos.x += self.space; + } + + pub(crate) fn at_location(&mut self, position: Position) { + self.text("at"); + self.location(position); + } + + pub(crate) fn location(&mut self, position: Position) { + self.icon_with_size(&self.rc.assets().hex, 35.0); + self.current_pos.x -= 31.0; + self.text_ex(&format!("{position}"), BLACK, 17); + } + + pub(crate) fn resources(&mut self, resources: &ResourcePile, balance: &ActionLogBalance) { + for (resource, amount) in resources.clone() { + if amount > 0 { + self.icon(&self.rc.assets().resources[&resource]); + self.amount(u32::from(amount), balance); + } + } + } + + pub(crate) fn amount(&mut self, amount: u32, balance: &ActionLogBalance) { + self.text_ex( + &amount.to_string(), + if *balance == ActionLogBalance::Gain { + if self.rc.state.color_profile == ColorProfile::HighContrast { + BLUE + } else { + GREEN + } + } else { + RED + }, + FONT_SIZE, + ); + } + + pub(crate) fn unit_icon(&mut self, unit_type: UnitType) { + self.icon(self.rc.assets().unit(unit_type, self.rc.shown_player)); + } + + pub(crate) fn units(&mut self, units: &Units, balance: Option<&ActionLogBalance>) { + for (unit, amount) in units.clone() { + if amount > 0 { + self.unit_icon(unit); + let mut u = Units::empty(); + for _ in 0..amount { + u += &unit; + } + u.print(Some(self.rc.game), &mut |a| match a { + UnitPrintArg::Text(t) => self.text(t), + UnitPrintArg::Amount(a) => { + if let Some(b) = balance { + self.amount(u32::from(*a), b); + } else { + self.text(&a.to_string()); + } + } + }); + } + } + } + + pub(crate) fn action_icon(&mut self) { + self.icon(&self.rc.assets().end_turn); + } + + pub(crate) fn structure( + &mut self, + structure: &Structure, + position: Position, + port_position: Option, + player: usize, + ) { + // Draw structure icon or circle + match structure { + Structure::CityCenter => { + self.rc.draw_circle( + center(self.current_pos), + RADIUS, + self.rc.player_color(player), + ); + self.current_pos.x += 35.0; + self.text("City"); + } + Structure::Building(b) => { + draw_scaled_icon( + self.rc, + &self.rc.assets().buildings[b], + "", + self.building_pos(), + ICON_SIZE, + ); + self.current_pos.x += 35.0; + self.text(b.name()); + } + Structure::Wonder(w) => { + self.wonder(*w); + } + } + self.at_location(position); + if let Some(port_pos) = port_position { + self.text(" at the water tile"); + self.at_location(port_pos); + } + } + + fn building_pos(&mut self) -> Vec2 { + self.current_pos + vec2(0.0, -20.0) + } + + pub(crate) fn wonder(&mut self, w: Wonder) { + draw_scaled_icon( + self.rc, + &self.rc.assets().wonders[&w], + "", + self.building_pos(), + ICON_SIZE, + ); + self.current_pos.x += 35.0; + self.text(&w.name()); + } + + pub(crate) fn mood(&mut self, player: usize, mood: &MoodState) { + let c = center(self.current_pos); + self.rc.draw_circle(c, RADIUS, self.rc.player_color(player)); + draw_mood_state(self.rc, c, mood); + self.current_pos.x += 35.0; + } +} + +const RADIUS: f32 = 15.0; +const ICON_SIZE: f32 = 15.0 * 2.0; + +fn center(message_pos: Vec2) -> Vec2 { + vec2(message_pos.x + 15.0, message_pos.y - RADIUS / 2.0) +} diff --git a/client/src/select_ui.rs b/client/src/select_ui.rs index ee276d1a..174cb8c8 100644 --- a/client/src/select_ui.rs +++ b/client/src/select_ui.rs @@ -1,6 +1,8 @@ use crate::client_state::{NO_UPDATE, RenderResult, StateUpdate}; use crate::dialog_ui::{OkTooltip, cancel_button, ok_button}; -use crate::layout_ui::{ICON_SIZE, UI_BACKGROUND, bottom_center_anchor, bottom_center_texture}; +use crate::layout_ui::{ + FONT_SIZE, ICON_SIZE, UI_BACKGROUND, bottom_center_anchor, bottom_center_texture, +}; use crate::render_context::RenderContext; use macroquad::color::{BLACK, BLUE, Color, WHITE}; use macroquad::math::{Vec2, bool, vec2}; @@ -48,11 +50,12 @@ pub(crate) fn count_dialog( rc.draw_circle(point, SELECT_RADIUS, UI_BACKGROUND); draw(&rc.no_icon_background(), o, point); let current_pos = vec2(x + 13., -40.) + anchor + offset; - rc.draw_text_with_color( + rc.draw_text_ex( &format!("{}", c.current), current_pos.x, current_pos.y, BLACK, + FONT_SIZE, ); let small = &rc.small_background(); if c.current > c.min diff --git a/client/src/tooltip.rs b/client/src/tooltip.rs index 1eb0788b..33be405b 100644 --- a/client/src/tooltip.rs +++ b/client/src/tooltip.rs @@ -1,6 +1,6 @@ use crate::client_state::{CameraMode, MousePosition, NO_UPDATE, State}; use crate::layout_ui::rect_from; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use macroquad::color::Color; use macroquad::input::mouse_position; diff --git a/client/src/unit_ui.rs b/client/src/unit_ui.rs index e58d2810..1d2307d9 100644 --- a/client/src/unit_ui.rs +++ b/client/src/unit_ui.rs @@ -9,7 +9,7 @@ use crate::hex_ui; use crate::select_ui::HighlightType; use crate::layout_ui::{draw_scaled_icon_with_tooltip, is_in_circle}; -use crate::log_ui::MultilineText; +use crate::multiline::MultilineText; use crate::render_context::RenderContext; use crate::tooltip::show_tooltip_for_circle; use itertools::Itertools; diff --git a/mise.toml b/mise.toml index 52f8cbb5..8f178959 100644 --- a/mise.toml +++ b/mise.toml @@ -21,7 +21,7 @@ dir = "server" [tasks.update-tests] description = "Run server tests and update JSON files" -run = 'cargo test --jobs 2 {{arg(name="test", default="")}}' +run = 'cargo nextest run {{arg(name="test", default="")}}' env = { UPDATE_EXPECTED = "true", RUSTFLAGS = '' } dir = "server" @@ -67,8 +67,8 @@ description = "Test publish client (the real one is done in GitHub Actions)" run = "./scripts/publish-client.sh test" [tools] -"cargo:cargo-nextest" = "0.9.98" -"cargo:wasm-bindgen-cli" = "0.2.100" -"cargo:wasm-pack" = "0.13.1" -rust = { version = "1.89.0", targets = "wasm32-unknown-unknown", components = "clippy,rustfmt" } +"cargo:cargo-nextest" = "0.9.146" +"cargo:wasm-bindgen-cli" = "0.2.105" +"cargo:wasm-pack" = "0.15.0" +rust = { version = "1.94.1", targets = "wasm32-unknown-unknown", components = "clippy,rustfmt" } diff --git a/server/Cargo.toml b/server/Cargo.toml index 35c53bb3..30a7de6b 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -32,9 +32,10 @@ pathfinding = "4.14.0" num_cpus = "1.16.0" enumset = { version = "1.1.6" } rustc-hash = "2.1.1" -pyroscope = { version = "0.5.8", optional = true } +pyroscope = { version = "2.0.0", optional = true } pyroscope_pprofrs = { version = "0.2.10", optional = true } chrono = "0.4.41" +string-builder = "0.2.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tokio = { version = "1.45.0", features = ["full"]} diff --git a/server/src/ability_initializer.rs b/server/src/ability_initializer.rs index 5b99bf92..16f4eb99 100644 --- a/server/src/ability_initializer.rs +++ b/server/src/ability_initializer.rs @@ -6,7 +6,8 @@ use crate::combat::{Combat, update_combat_strength}; use crate::combat_listeners::CombatStrength; use crate::content::ability::{Ability, AbilityBuilder}; use crate::content::custom_actions::{ - CustomActionActionExecution, CustomActionExecution, CustomActionInfo, + CustomActionActionExecution, PlayingActionModifier, SpecialAction, SpecialActionExecution, + SpecialActionInfo, }; use crate::content::persistent_events::{ AdvanceRequest, EventResponse, HandCardsRequest, MultiRequest, PaymentRequest, @@ -35,7 +36,6 @@ pub(crate) type AbilityInitializerWithPrioDelta = Arc { pub player_index: usize, - pub player_name: String, pub origin: EventOrigin, pub actively_selected: bool, pub choices: A, @@ -46,7 +46,6 @@ impl SelectedChoice { pub fn new(p: &EventPlayer, actively_selected: bool, choices: A, choice: C) -> Self { Self { player_index: p.index, - player_name: p.name.clone(), origin: p.origin.clone(), actively_selected, choices, @@ -55,15 +54,11 @@ impl SelectedChoice { } pub fn player(&self) -> EventPlayer { - EventPlayer::new( - self.player_index, - self.player_name.clone(), - self.origin.clone(), - ) + EventPlayer::new(self.player_index, self.origin.clone()) } - pub fn other_player(&self, player_index: usize, game: &Game) -> EventPlayer { - EventPlayer::from_player(player_index, game, self.origin.clone()) + pub fn other_player(&self, player_index: usize) -> EventPlayer { + EventPlayer::new(player_index, self.origin.clone()) } pub fn log(&self, game: &mut Game, message: &str) { @@ -181,7 +176,7 @@ pub(crate) trait AbilityInitializerSetup: Sized { .add_initializer(move |game, player_index, prio_delta| { initializer( game, - &EventPlayer::from_player(player_index, game, key.clone()), + &EventPlayer::new(player_index, key.clone()), prio_delta, ); }); @@ -194,10 +189,7 @@ pub(crate) trait AbilityInitializerSetup: Sized { { let key = self.get_key().clone(); self.builder().add_deinitializer(move |game, player_index| { - deinitializer( - game, - &EventPlayer::from_player(player_index, game, key.clone()), - ); + deinitializer(game, &EventPlayer::new(player_index, key.clone())); }); self } @@ -209,10 +201,7 @@ pub(crate) trait AbilityInitializerSetup: Sized { let key = self.get_key().clone(); self.builder() .add_once_initializer(move |game, player_index| { - initializer( - game, - &EventPlayer::from_player(player_index, game, key.clone()), - ); + initializer(game, &EventPlayer::new(player_index, key.clone())); }); self } @@ -224,10 +213,7 @@ pub(crate) trait AbilityInitializerSetup: Sized { let key = self.get_key().clone(); self.builder() .add_once_deinitializer(move |game, player_index| { - deinitializer( - game, - &EventPlayer::from_player(player_index, game, key.clone()), - ); + deinitializer(game, &EventPlayer::new(player_index, key.clone())); }); self } @@ -972,10 +958,10 @@ pub(crate) trait AbilityInitializerSetup: Sized { ) -> Self { let name = self.name(); let desc = self.description(); - self.add_custom_action_execution( - action, + self.add_special_action_execution( + SpecialAction::Custom(action), cost, - CustomActionExecution::Action(CustomActionActionExecution::new( + SpecialActionExecution::Action(CustomActionActionExecution::new( ability(Ability::builder(&name, &desc)).build(), Arc::new(can_play), None, @@ -993,10 +979,10 @@ pub(crate) trait AbilityInitializerSetup: Sized { ) -> Self { let name = self.name(); let desc = self.description(); - self.add_custom_action_execution( - action, + self.add_special_action_execution( + SpecialAction::Custom(action), cost, - CustomActionExecution::Action(CustomActionActionExecution::new( + SpecialActionExecution::Action(CustomActionActionExecution::new( ability(Ability::builder(&name, &desc)).build(), Arc::new(can_play), Some(Arc::new(city_checker)), @@ -1006,25 +992,29 @@ pub(crate) trait AbilityInitializerSetup: Sized { fn add_action_modifier( self, - action: CustomActionType, + modifier: PlayingActionModifier, info: impl Fn(ActionCostOncePerTurnBuilder) -> ActionCostOncePerTurn + Send + Sync + 'static, base_action: PlayingActionType, ) -> Self { - self.add_custom_action_execution(action, info, CustomActionExecution::Modifier(base_action)) + self.add_special_action_execution( + SpecialAction::Modifier(modifier), + info, + SpecialActionExecution::Modifier(base_action), + ) } - fn add_custom_action_execution( + fn add_special_action_execution( self, - action: CustomActionType, + action: SpecialAction, cost: impl Fn(ActionCostOncePerTurnBuilder) -> ActionCostOncePerTurn + Send + Sync + 'static, - execution: CustomActionExecution, + execution: SpecialActionExecution, ) -> Self { let deinitializer_action = action; let exec = execution.clone(); self.add_initializer(move |game, player, _prio_delta| { - player.get_mut(game).custom_actions.insert( + player.get_mut(game).special_actions.insert( action, - CustomActionInfo::new( + SpecialActionInfo::new( action, exec.clone(), player.origin.clone(), @@ -1035,7 +1025,7 @@ pub(crate) trait AbilityInitializerSetup: Sized { .add_deinitializer(move |game, player| { player .get_mut(game) - .custom_actions + .special_actions .remove(&deinitializer_action); }) } @@ -1077,18 +1067,11 @@ where let deinitialize_event = event.clone(); let initializer = move |game: &mut Game, p: &EventPlayer, prio_delta: i32| { let e = event(&mut p.get_mut(game).events); - e.inner - .as_mut() - .unwrap_or_else(|| panic!("event {} should be set: {:?}", e.name, p.origin)) - .add_listener_mut(listener.clone(), priority + prio_delta, p.clone()); + e.add_listener_mut(listener.clone(), priority + prio_delta, p.clone()); }; let deinitializer = move |game: &mut Game, p: &EventPlayer| { let e = deinitialize_event(&mut p.get_mut(game).events); - if let Some(inner) = &mut e.inner { - inner.remove_listener_mut_by_key(&p.origin); - } else { - e.deleted = Some(p.origin.clone()); - } + e.remove_listener_mut_by_key(&p.origin); }; setup .add_initializer(initializer) diff --git a/server/src/action.rs b/server/src/action.rs index 2ff1fd51..c07bcc05 100644 --- a/server/src/action.rs +++ b/server/src/action.rs @@ -9,22 +9,23 @@ use crate::construct::on_construct; use crate::content::custom_actions::on_custom_action; use crate::content::persistent_events::{EventResponse, PersistentEventType}; use crate::cultural_influence::on_cultural_influence; -use crate::events::EventPlayer; +use crate::events::{EventOrigin, EventPlayer}; use crate::explore::ask_explore_resolution; use crate::game::GameState; use crate::game::{Game, GameContext}; use crate::game_setup::execute_choose_civ; use crate::incident::{on_choose_incident, on_trigger_incident}; use crate::log::{ - ActionLogBalance, ActionLogEntry, add_action_log_item, add_log_action, current_turn_log_mut, + ActionLogBalance, ActionLogEntry, ActionLogItem, add_action_log_item, add_log_action, + current_turn_log_mut, }; use crate::movement::{MovementAction, execute_movement_action, on_ship_construction_conversion}; -use crate::objective_card::{complete_objective_card, gain_objective_card, on_objective_cards}; +use crate::objective_card::{complete_objective_card, on_objective_cards}; use crate::playing_actions::{PlayingAction, PlayingActionType}; use crate::position::Position; use crate::recruit::on_recruit; use crate::resource::check_for_waste; -use crate::status_phase::play_status_phase; +use crate::status_phase::status_phase_response; use crate::undo::{clean_patch, redo, to_serde_value, undo}; use crate::unit::units_killed; use crate::victory_points::add_dynamic_victory_points; @@ -38,8 +39,7 @@ pub enum Action { Response(EventResponse), Undo, Redo, - StartTurn, // created for trade routes - Setup, // Game setup + StartTurn, // created for trade routes and status phase ChooseCivilization(String), } @@ -131,9 +131,14 @@ pub fn execute_without_undo( && !matches!(action, Action::Response(_)) { // ignore missing response in replay - game.add_info_log_item(&format!( - "interrupted {} events in replay due to a missing response", - game.events.len() + game.add_log_item(ActionLogItem::new( + player_index, + ActionLogEntry::message(format!( + "interrupted {} events in replay due to a missing response", + game.events.len() + )), + EventOrigin::Ability("replay".to_string()), + vec![], )); game.events.clear(); } @@ -160,10 +165,6 @@ pub fn execute_without_undo( pub(crate) fn after_action(game: &mut Game, player_index: usize) { check_for_waste(game); - if let Some(o) = game.player_mut(player_index).gained_objective.take() { - gain_objective_card(game, player_index, o); - } - if game .player(player_index) .cities @@ -249,7 +250,7 @@ pub(crate) fn execute_custom_phase_action( ExploreResolution(r) => { ask_explore_resolution(game, player, r); } - InfluenceCulture(r) => { + InfluenceCultureBoost(r) => { on_cultural_influence(game, player, r); } UnitsKilled(k) => units_killed(game, player, k), @@ -269,7 +270,7 @@ pub(crate) fn execute_custom_phase_action( CombatEnd(s) => { on_end_combat(game, s); } - StatusPhase(s) => play_status_phase(game, s), + StatusPhase(s) => status_phase_response(game, s), TurnStart => game.on_start_turn(), PayAction(a) => { a.on_pay_action(game, player, game.current_event().origin_override.clone())?; @@ -360,24 +361,21 @@ pub(crate) fn gain_action(game: &mut Game, player: &EventPlayer) { add_action_log_item( game, player.index, - ActionLogEntry::action(ActionLogBalance::Gain), + ActionLogEntry::action(ActionLogBalance::Gain, 1), player.origin.clone(), vec![], ); - player.log(game, "Gain 1 action"); } pub(crate) fn lose_action(game: &mut Game, player: &EventPlayer) { - subtract_action(game, player); - player.log(game, "Lose 1 action"); + subtract_action(game, player, ActionLogBalance::Loss); } pub(crate) fn pay_action(game: &mut Game, player: &EventPlayer) { - subtract_action(game, player); - player.log(game, "Pay 1 action"); + subtract_action(game, player, ActionLogBalance::Pay); } -fn subtract_action(game: &mut Game, player: &EventPlayer) { +fn subtract_action(game: &mut Game, player: &EventPlayer, balance: ActionLogBalance) { if game.actions_left == 0 && game.context == GameContext::Replay { return; } @@ -386,7 +384,7 @@ fn subtract_action(game: &mut Game, player: &EventPlayer) { add_action_log_item( game, player.index, - ActionLogEntry::action(ActionLogBalance::Loss), + ActionLogEntry::action(balance, 1), player.origin.clone(), vec![], ); diff --git a/server/src/action_card.rs b/server/src/action_card.rs index 7569adca..3acc2260 100644 --- a/server/src/action_card.rs +++ b/server/src/action_card.rs @@ -54,15 +54,17 @@ pub struct ActionCard { pub id: u8, pub civil_card: CivilCard, pub tactics_card: Option, + pub public: bool, } impl ActionCard { #[must_use] - fn new(id: u8, civil_card: CivilCard, tactics_card: Option) -> Self { + fn new(id: u8, civil_card: CivilCard, tactics_card: Option, public: bool) -> Self { Self { id, civil_card, tactics_card, + public, } } @@ -88,6 +90,7 @@ impl ActionCard { action_cost: cost(ActionCostBuilder::new(None)).cost, target: CivilCardTarget::ActivePlayer, target_choices: None, + public: false, } } @@ -108,6 +111,7 @@ pub struct ActionCardBuilder { action_cost: ActionCost, can_play: CanPlayCard, combat_requirement: Option, + public: bool, tactics_card: Option, builder: AbilityInitializerBuilder, target: CivilCardTarget, @@ -148,7 +152,7 @@ impl ActionCardBuilder { let target = self.target; self.target_choices = Some(Arc::new(move |game, player| { let mut game = game.clone(); - let p = EventPlayer::from_player(player, &game, EventOrigin::CivilCard(id)); + let p = EventPlayer::new(player, EventOrigin::CivilCard(id)); let mut info = ActionCardInfo::new( id, None, @@ -173,6 +177,12 @@ impl ActionCardBuilder { ) } + #[must_use] + pub fn public(mut self, public: bool) -> Self { + self.public = public; + self + } + #[must_use] pub fn tactics_card(mut self, tactics_card: TacticsCardFactory) -> Self { self.tactics_card = Some(tactics_card(self.id)); @@ -206,6 +216,7 @@ impl ActionCardBuilder { target_choices: self.target_choices, }, self.tactics_card, + self.public, ) } } @@ -275,7 +286,7 @@ pub(crate) fn on_play_action_card(game: &mut Game, player_index: usize, i: Actio pub(crate) fn gain_action_card_from_pile(game: &mut Game, player: &EventPlayer) { let controller = crate::content::civilizations::celts::delegated_player(game, player.index); if controller != player.index { - let p = EventPlayer::from_player(controller, game, player.origin.clone()); + let p = EventPlayer::new(controller, player.origin.clone()); return gain_action_card_from_pile(game, &p); } if player @@ -290,14 +301,15 @@ pub(crate) fn gain_action_card_from_pile(game: &mut Game, player: &EventPlayer) } pub(crate) fn do_gain_action_card_from_pile(game: &mut Game, player: &EventPlayer) { - if let Some(c) = draw_action_card_from_pile(game) { + if let Some(c) = draw_action_card_from_pile(game, player) { gain_action_card(game, player, c, HandCardLocation::DrawPile); } } -fn draw_action_card_from_pile(game: &mut Game) -> Option { +fn draw_action_card_from_pile(game: &mut Game, player: &EventPlayer) -> Option { draw_card_from_pile( game, + player, "Action Card", |g| &mut g.action_cards_left, |g| g.cache.get_action_cards().iter().map(|c| c.id).collect(), @@ -313,7 +325,7 @@ pub(crate) fn gain_action_card( ) { let controller = crate::content::civilizations::celts::delegated_player(game, player.index); if controller != player.index { - let p = EventPlayer::from_player(controller, game, player.origin.clone()); + let p = EventPlayer::new(controller, player.origin.clone()); return gain_action_card(game, &p, action_card, from); } player.get_mut(game).action_cards.push(action_card); @@ -394,7 +406,7 @@ pub fn combat_requirement_met( action_card_id: u8, requirement: &CombatRequirement, ) -> Option { - let sister_card = if action_card_id % 2 == 0 { + let sister_card = if action_card_id.is_multiple_of(2) { action_card_id - 1 } else { action_card_id + 1 diff --git a/server/src/action_cost.rs b/server/src/action_cost.rs index 984a0429..bc83957f 100644 --- a/server/src/action_cost.rs +++ b/server/src/action_cost.rs @@ -1,5 +1,5 @@ use crate::advance::base_advance_cost; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::SpecialAction; use crate::events::{EventOrigin, check_event_origin}; use crate::game::{Game, GameContext}; use crate::payment::PaymentOptions; @@ -81,12 +81,12 @@ impl ActionCost { } pub(crate) struct ActionCostOncePerTurnBuilder { - action: CustomActionType, + action: SpecialAction, } impl ActionCostOncePerTurnBuilder { #[must_use] - pub fn new(action: CustomActionType) -> Self { + pub fn new(action: SpecialAction) -> Self { Self { action } } @@ -105,19 +105,19 @@ impl ActionCostOncePerTurnBuilder { #[must_use] pub fn once_per_turn_mutually_exclusive( self, - mutually_exclusive: CustomActionType, + mutually_exclusive: SpecialAction, ) -> ActionCostBuilder { ActionCostBuilder::new(Some(mutually_exclusive)) } } pub(crate) struct ActionCostBuilder { - once_per_turn: Option, + once_per_turn: Option, } impl ActionCostBuilder { #[must_use] - pub(crate) fn new(once_per_turn: Option) -> Self { + pub(crate) fn new(once_per_turn: Option) -> Self { Self { once_per_turn } } @@ -133,13 +133,13 @@ impl ActionCostBuilder { } pub(crate) struct ActionResourceCostBuilder { - once_per_turn: Option, + once_per_turn: Option, free: bool, } impl ActionResourceCostBuilder { #[must_use] - fn new(once_per_turn: Option, free: bool) -> ActionResourceCostBuilder { + fn new(once_per_turn: Option, free: bool) -> ActionResourceCostBuilder { ActionResourceCostBuilder { once_per_turn, free, @@ -187,14 +187,14 @@ impl ActionResourceCostBuilder { #[derive(Clone, Debug, PartialEq)] pub struct ActionCostOncePerTurn { pub cost: ActionCost, - pub once_per_turn: Option, + pub once_per_turn: Option, } impl ActionCostOncePerTurn { #[must_use] pub(crate) fn new( free: bool, - once_per_turn: Option, + once_per_turn: Option, cost: ActionResourceCost, ) -> ActionCostOncePerTurn { ActionCostOncePerTurn { diff --git a/server/src/advance.rs b/server/src/advance.rs index 8c4210a6..c5462a1f 100644 --- a/server/src/advance.rs +++ b/server/src/advance.rs @@ -6,7 +6,7 @@ use crate::content::persistent_events::PersistentEventType; use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; use crate::incident::trigger_incident; -use crate::log::{ActionLogBalance, ActionLogEntry, add_action_log_item}; +use crate::log::{ActionLogBalance, ActionLogEntry, ActionLogIncidentToken, add_action_log_item}; use crate::payment::PaymentOptions; use crate::player::Player; use crate::player_events::OnAdvanceInfo; @@ -291,27 +291,18 @@ pub(crate) fn do_advance( true, ); - player.log( - game, - &format!( - "Gain {} {}", - advance.name(game), - if take_incident_token { - (if t > 1 { - format!("and take an event token ({} left)", t - 1) - } else { - "and take an event token (triggering an incident)".to_string() - }) - .to_string() - } else { - "without taking an event token".to_string() - } - ), - ); add_action_log_item( game, player_index, - ActionLogEntry::advance(advance, ActionLogBalance::Gain, take_incident_token), + ActionLogEntry::advance( + advance, + ActionLogBalance::Gain, + if take_incident_token { + ActionLogIncidentToken::Take(t - 1) + } else { + ActionLogIncidentToken::NoChange + }, + ), player.origin.clone(), vec![], ); @@ -398,7 +389,7 @@ pub(crate) fn execute_advance_action( gain_advance_without_payment( game, advance, - &EventPlayer::from_player(player_index, game, advance_event_origin()), + &EventPlayer::new(player_index, advance_event_origin()), a.payment.clone(), true, ); @@ -439,7 +430,7 @@ pub(crate) fn on_advance(game: &mut Game, player_index: usize, info: OnAdvanceIn player.incident_tokens -= 1; if player.incident_tokens == 0 { player.incident_tokens = 3; - trigger_incident(game, player_index); + trigger_incident(game, player_index, EventOrigin::Advance(info.advance)); } } } @@ -470,20 +461,28 @@ pub(crate) fn remove_advance(game: &mut Game, advance: Advance, player: &EventPl advance_bonus.resources(), EventOrigin::Advance(advance), vec![], + ActionLogBalance::Loss, ); } game.player_mut(player_index).advances.remove(advance); add_action_log_item( game, player_index, - ActionLogEntry::advance(advance, ActionLogBalance::Loss, false), + ActionLogEntry::advance( + advance, + ActionLogBalance::Loss, + ActionLogIncidentToken::NoChange, + ), player.origin.clone(), vec![], ); } fn unlock_special_advance(game: &mut Game, special_advance: SpecialAdvance, player: &EventPlayer) { - player.log(game, &format!("Unlock {}", special_advance.info(game).name)); + player.log( + game, + &format!("unlocks {}", special_advance.info(game).name), + ); special_advance .info(game) .listeners diff --git a/server/src/ai_actions.rs b/server/src/ai_actions.rs index d8f87db0..6380f3b8 100644 --- a/server/src/ai_actions.rs +++ b/server/src/ai_actions.rs @@ -5,7 +5,7 @@ use crate::card::validate_card_selection; use crate::city::{City, MoodState}; use crate::collect::{Collect, available_collect_actions, possible_resource_collections}; use crate::construct::{Construct, available_buildings, new_building_positions}; -use crate::content::custom_actions::{CustomAction, CustomActionType}; +use crate::content::custom_actions::{CustomAction, CustomActionType, SpecialAction}; use crate::content::persistent_events::{ EventResponse, HandCardsRequest, MultiRequest, PersistentEventRequest, PersistentEventState, PositionRequest, SelectedStructure, is_selected_structures_valid, @@ -195,7 +195,13 @@ fn base_actions(ai: &mut AiActions, game: &Game) -> Vec<(ActionType, Vec } for info in game.available_custom_actions(p.index) { - if info.action == CustomActionType::ImperialArmy { + let t = info.custom_action_type(); + // Calendar only reveals information. Until the AI has a policy for using + // that knowledge, repeatedly peeking for free would block EndTurn. + if t == CustomActionType::Calendar { + continue; + } + if t == CustomActionType::ImperialArmy { // buggy continue; } @@ -212,12 +218,11 @@ fn base_actions(ai: &mut AiActions, game: &Game) -> Vec<(ActionType, Vec vec![None] }; - let a = info.action; for c in cities { actions.push(( - ActionType::Playing(PlayingActionType::Custom(a)), + ActionType::Playing(PlayingActionType::Special(info.action)), vec![Action::Playing(PlayingAction::Custom(CustomAction::new( - a, c, + t, c, )))], )); } @@ -497,11 +502,11 @@ fn calculate_increase_happiness( fn prefer_custom_action(actions: &[PlayingActionType]) -> PlayingActionType { actions .iter() - .find(|a| matches!(a, PlayingActionType::Custom(_))) + .find(|a| matches!(a, PlayingActionType::Special(SpecialAction::Modifier(_)))) .or_else(|| { actions .iter() - .find(|a| !matches!(a, PlayingActionType::Custom(_))) + .find(|a| !matches!(a, PlayingActionType::Special(SpecialAction::Modifier(_)))) }) .cloned() .expect("expected at least one action type, either custom or base") diff --git a/server/src/ai_collect.rs b/server/src/ai_collect.rs index e062066f..3387ec21 100644 --- a/server/src/ai_collect.rs +++ b/server/src/ai_collect.rs @@ -8,7 +8,7 @@ use std::mem; pub(crate) fn possible_collections(info: &CollectInfo) -> Vec> { let choices = info.choices.clone(); - let mut list = choices.iter().collect_vec(); + let mut list = choices.iter().filter(|(_, v)| !v.is_empty()).collect_vec(); let tiles = list.len(); // production focus is not considered let mut max_tiles = tiles; @@ -69,7 +69,12 @@ fn add_combination( } } } else { - let n = pile.iter().next().expect("pile empty"); + let n = pile.iter().next().unwrap_or_else(|| { + panic!( + "Pile should have at least one element for position {pos:?}, \ + got choices {choices:?} and combo {combo:?}" + ) + }); for r in &mut *result { r.push(PositionCollection::new(*pos, n.clone())); } diff --git a/server/src/analysis.rs b/server/src/analysis.rs index 3b9ef032..680a000b 100644 --- a/server/src/analysis.rs +++ b/server/src/analysis.rs @@ -21,8 +21,8 @@ pub fn can_create(game: &Game) -> bool { // These discard arrays are lifetime archives, not current-cycle piles. // Once a pile has refilled, their exclusions are no longer sufficient. && !game.log.iter().flat_map(|a| &a.rounds).flat_map(|r| &r.turns) - .flat_map(|t| &t.actions).flat_map(|a| &a.log).any(|text| { - text == "Reshuffling Action Card pile" || text == "Reshuffling Events pile" + .flat_map(|t| &t.actions).flat_map(|a| &a.items).any(|item| { + matches!(&item.entry, crate::log::ActionLogEntry::Text(text) if text == "Reshuffling Action Card pile" || text == "Reshuffling Events pile") }) } @@ -42,7 +42,7 @@ fn public_continuation(event: &crate::content::persistent_events::PersistentEven | E::ShipConstructionConversion(_) | E::StopBarbarianMovement(_) | E::UnitsKilled(_) - | E::InfluenceCulture(_) + | E::InfluenceCultureBoost(_) | E::StatusPhase(_) => true, E::PayAction(payment) => !matches!( payment.action, @@ -330,7 +330,7 @@ fn retain_rule_facts(game: &mut Game) { source_turn.actions.len() }; for a in source_turn.actions.iter().take(limit) { - let mut fact = ActionLogAction::new(Action::StartTurn); + let mut fact = ActionLogAction::new(Action::StartTurn, a.player, None, 0); fact.combat_stats = a.combat_stats.clone().map(|mut s| { s.claimed_action_cards.clear(); s.selected_card = None; @@ -426,7 +426,12 @@ mod tests { vec![HandCard::ActionCard(37)], ), ); - a.log.push("source secret".into()); + a.items.push(ActionLogItem::new( + a.player, + crate::log::ActionLogEntry::Text("source secret".into()), + EventOrigin::Ability("test".into()), + vec![], + )); a.undo = serde_json::from_value(serde_json::json!([{"op":"replace","path":"/seed","value":"undo secret"}])).unwrap(); } } @@ -459,9 +464,9 @@ mod tests { game = game_api::execute(game, Action::Playing(PlayingAction::EndTurn), p); } let p = game.active_player(); - crate::log::add_start_turn_action_if_needed(&mut game); - let player = - crate::events::EventPlayer::from_player(p, &game, EventOrigin::Ability("test".into())); + let active = game.active_player(); + crate::log::add_start_turn_action_if_needed(&mut game, active); + let player = crate::events::EventPlayer::new(p, EventOrigin::Ability("test".into())); let before = game.players[p].action_cards.len(); crate::action_card::gain_action_card_from_pile(&mut game, &player); assert_eq!(game.players[p].action_cards.len(), before + 1); @@ -522,7 +527,8 @@ mod tests { fn publicly_revealed_opponent_card_stays_in_their_hand() { let mut source = game_api::init(2, "source".into(), GameOptions::default()); let id = source.players[1].action_cards[0]; - crate::log::add_start_turn_action_if_needed(&mut source); + let active = source.active_player(); + crate::log::add_start_turn_action_if_needed(&mut source, active); crate::log::add_action_log_item( &mut source, 1, @@ -575,12 +581,12 @@ mod tests { #[test] fn fails_closed_after_action_pile_refill() { let mut game = game_api::init(2, "source".into(), GameOptions::default()); - crate::log::add_start_turn_action_if_needed(&mut game); + let active = game.active_player(); + crate::log::add_start_turn_action_if_needed(&mut game, active); game.action_cards_left.clear(); game.action_cards_discarded = game.cache.get_action_cards().iter().map(|c| c.id).collect(); let p = game.active_player(); - let player = - crate::events::EventPlayer::from_player(p, &game, EventOrigin::Ability("test".into())); + let player = crate::events::EventPlayer::new(p, EventOrigin::Ability("test".into())); crate::action_card::gain_action_card_from_pile(&mut game, &player); assert!(!game.action_cards_left.is_empty()); assert!(!can_create(&game)); diff --git a/server/src/barbarians.rs b/server/src/barbarians.rs index 39c7ff28..313b8c27 100644 --- a/server/src/barbarians.rs +++ b/server/src/barbarians.rs @@ -599,7 +599,7 @@ fn cities_in_land_range( #[must_use] pub(crate) fn get_barbarians_event_player(game: &Game, origin: &EventOrigin) -> EventPlayer { let player = get_barbarians_player(game); - EventPlayer::new(player.index, player.get_name(), origin.clone()) + EventPlayer::new(player.index, origin.clone()) } /// diff --git a/server/src/board_history.rs b/server/src/board_history.rs index 5d4f77fc..52315bf2 100644 --- a/server/src/board_history.rs +++ b/server/src/board_history.rs @@ -137,8 +137,10 @@ pub fn execute(mut game: Game, action: Action, player: usize) -> Result Vec { return None; }; let kind = match card.card_type() { - HandCardType::Action => "action", + HandCardType::Action | HandCardType::Public => "action", HandCardType::Objective => "objective", HandCardType::Wonder => "wonder", }; diff --git a/server/src/cache.rs b/server/src/cache.rs index 5c3a1ca7..817b53a2 100644 --- a/server/src/cache.rs +++ b/server/src/cache.rs @@ -4,7 +4,7 @@ use crate::city_pieces::Building; use crate::civilization::Civilization; use crate::content::ability::Ability; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo}; -use crate::content::custom_actions::CustomActionExecution; +use crate::content::custom_actions::SpecialActionExecution; use crate::content::{ ability, action_cards, advances, civilizations, incidents, objective_cards, objectives, wonders, }; @@ -13,10 +13,9 @@ use crate::incident::Incident; use crate::leader::{Leader, LeaderInfo}; use crate::objective_card::{Objective, ObjectiveCard}; use crate::special_advance::{SpecialAdvance, SpecialAdvanceInfo}; -use crate::status_phase::StatusPhaseState::{ChangeGovernmentType, DetermineFirstPlayer}; use crate::status_phase::{ - StatusPhaseState, complete_objectives, determine_first_player, draw_cards, free_advance, - get_status_phase, may_change_government, use_raze_city, + StatusPhaseStateType, complete_objectives, determine_first_player, draw_cards, free_advance, + get_status_phase, may_change_government, status_phase_type, use_raze_city, }; use crate::tactics_card::TacticsCard; use crate::wonder::{Wonder, WonderInfo}; @@ -27,7 +26,7 @@ use std::collections::HashMap; pub struct Cache { all_abilities: Vec, abilities_by_name: HashMap, - status_phase_handlers: HashMap, + status_phase_handlers: HashMap, all_advance_groups: Vec, advance_groups_by_name: HashMap, @@ -129,7 +128,7 @@ impl Cache { all_civilizations: civilizations::get_all_uncached() .into_iter() - .filter(super::civilization::Civilization::can_choose) + .filter(Civilization::can_choose) .sorted_by_key(|c| c.name.clone()) .collect_vec(), civilizations_by_name: civilizations::get_all_uncached() @@ -220,8 +219,8 @@ impl Cache { .get(name) .map_or_else( || { - for c in game.player(game.active_player()).custom_actions.values() { - if let CustomActionExecution::Action(e) = &c.execution + for c in game.player(game.active_player()).special_actions.values() { + if let SpecialActionExecution::Action(e) = &c.execution && e.ability.name == name { return Some(t(&e.ability)); @@ -229,7 +228,7 @@ impl Cache { } if let Some(p) = get_status_phase(game) { - return Some(t(self.status_phase_handler(p))); + return Some(t(self.status_phase_handler(&status_phase_type(p)))); } None }, @@ -244,12 +243,8 @@ impl Cache { } #[must_use] - pub fn status_phase_handler(&self, p: &StatusPhaseState) -> &Ability { - match p { - DetermineFirstPlayer(_) => &self.status_phase_handlers[&DetermineFirstPlayer(0)], - ChangeGovernmentType(_) => &self.status_phase_handlers[&ChangeGovernmentType(false)], - _ => &self.status_phase_handlers[p], - } + pub fn status_phase_handler(&self, p: &StatusPhaseStateType) -> &Ability { + &self.status_phase_handlers[p] } #[must_use] @@ -371,15 +366,15 @@ impl Cache { } } -fn status_phase_handlers() -> HashMap { - use StatusPhaseState::*; +fn status_phase_handlers() -> HashMap { + use StatusPhaseStateType::*; HashMap::from([ (CompleteObjectives, complete_objectives()), (FreeAdvance, free_advance()), (DrawCards, draw_cards()), (RazeSize1City, use_raze_city()), - (ChangeGovernmentType(false), may_change_government()), - (DetermineFirstPlayer(0), determine_first_player()), + (ChangeGovernmentType, may_change_government()), + (DetermineFirstPlayer, determine_first_player()), ]) } diff --git a/server/src/card.rs b/server/src/card.rs index 4e60e16c..0e1529f9 100644 --- a/server/src/card.rs +++ b/server/src/card.rs @@ -1,7 +1,7 @@ use crate::content::action_cards::spy::validate_spy_cards; use crate::content::action_cards::synergies::validate_new_plans; use crate::content::civilizations::rome::validate_princeps_cards; -use crate::events::EventOrigin; +use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; use crate::log::{ActionLogEntry, add_action_log_item}; use crate::player::Player; @@ -14,6 +14,7 @@ use std::fmt::Display; #[derive(Clone, Copy, Eq, PartialEq)] pub enum HandCardType { Action, + Public, // is modeled as an action card with public=true Objective, Wonder, } @@ -21,10 +22,19 @@ pub enum HandCardType { impl HandCardType { #[must_use] pub fn get_all() -> Vec { + vec![ + HandCardType::Action, // Public is not a real type of card + HandCardType::Objective, + HandCardType::Wonder, + ] + } + #[must_use] + pub fn get_all_and_public() -> Vec { vec![ HandCardType::Action, HandCardType::Objective, HandCardType::Wonder, + HandCardType::Public, ] } } @@ -35,6 +45,7 @@ impl Display for HandCardType { HandCardType::Action => write!(f, "an action card"), HandCardType::Objective => write!(f, "an objective card"), HandCardType::Wonder => write!(f, "a wonder card"), + HandCardType::Public => write!(f, "a public action card"), } } } @@ -59,9 +70,27 @@ impl HandCard { #[must_use] pub fn name(&self, game: &Game) -> String { match self { - HandCard::ActionCard(id) => game.cache.get_action_card(*id).name(), - HandCard::ObjectiveCard(id) => game.cache.get_objective_card(*id).name(), - HandCard::Wonder(wonder) => wonder.name(), + HandCard::ActionCard(id) => { + if *id == 0 { + "an action card".to_string() + } else { + game.cache.get_action_card(*id).name() + } + } + HandCard::ObjectiveCard(id) => { + if *id == 0 { + "an objective card".to_string() + } else { + game.cache.get_objective_card(*id).name() + } + } + HandCard::Wonder(wonder) => { + if wonder == &Wonder::Hidden { + "a wonder card".to_string() + } else { + wonder.name() + } + } } } } @@ -108,6 +137,7 @@ impl HandCardLocation { pub(crate) fn draw_card_from_pile( game: &mut Game, + player: &EventPlayer, name: &str, get_pile: impl Fn(&mut Game) -> &mut Vec, reshuffle_pile: impl Fn(&Game) -> Vec, @@ -124,13 +154,13 @@ where } if !new_pile.is_empty() { - game.add_info_log_item(&format!("Reshuffling {name} pile")); + player.log(game, &format!("Reshuffling {name} pile")); *get_pile(game) = new_pile.shuffled(&mut game.rng); } } if get_pile(game).is_empty() { - game.add_info_log_item(&format!("No {name} left to draw")); + player.log(game, &format!("No {name} left to draw")); return None; } @@ -159,13 +189,20 @@ pub(crate) fn discard_card( } #[must_use] -pub fn hand_cards(player: &Player, types: &[HandCardType]) -> Vec { +pub fn hand_cards(player: &Player, types: &[HandCardType], game: &Game) -> Vec { types .iter() .flat_map(|t| match t { HandCardType::Action => player .action_cards .iter() + .filter(|id| **id == 0 || !game.cache.get_action_card(**id).public) + .map(|&id| HandCard::ActionCard(id)) + .collect_vec(), + HandCardType::Public => player + .action_cards + .iter() + .filter(|id| **id != 0 && game.cache.get_action_card(**id).public) .map(|&id| HandCard::ActionCard(id)) .collect_vec(), HandCardType::Objective => player @@ -243,58 +280,7 @@ pub(crate) fn log_card_transfer( to: HandCardLocation, origin: &EventOrigin, ) { - let (player_index, message): (usize, &str) = if let HandCardLocation::Hand(p) = to { - let name = card_name(card, &from, game); - ( - p, - match from { - HandCardLocation::DrawPile => &format!("Draw {name}"), - HandCardLocation::Hand(from) | HandCardLocation::RevealedHand(from) => { - &format!("Gain {name} from {}", game.player_name(from)) - } - HandCardLocation::DiscardPile => &format!("Gain {name} from discard pile"), - HandCardLocation::Public => &format!("Gain {name} from the public area"), - HandCardLocation::GreatSeer(_) => &format!("Gain {name} from Great Seer"), - HandCardLocation::Incident => &format!("Gain {name} from the current event"), - _ => { - panic!( - "Cannot transfer card from played to hand: {card:?} from {from:?} to {to:?}" - ) - } - }, - ) - } else if let HandCardLocation::Hand(p) = from { - let name = card_name(card, &to, game); - ( - p, - match to { - HandCardLocation::DiscardPile => &format!("Discard {name}"), - HandCardLocation::DrawPile => &format!("Shuffle {name} back into the draw pile"), - HandCardLocation::PlayToDiscard | HandCardLocation::PlayToKeep => { - &format!("Play {name}") - } - HandCardLocation::CompleteObjective(ref o) => &format!("Complete {o} using {name}"), - HandCardLocation::PlayToDiscardFaceDown => &format!("Play {name} face down"), - HandCardLocation::Public => &format!("Place {name} in public area"), - _ => panic!( - "Cannot transfer card from hand to draw pile: {card:?} from {from:?} to {to:?}" - ), - }, - ) - } else if let HandCardLocation::GreatSeer(p) = to { - assert_eq!(from, HandCardLocation::DrawPile); - (p, "Placed a card from the draw pile in the Great Seer") - } else if let HandCardLocation::DrawPilePeeked(p) = from { - assert_eq!(to, HandCardLocation::DrawPile); - ( - p, - "Reshuffled a card from the draw pile back into the draw pile", - ) - } else { - panic!("Invalid card transfer from {from:?} to {to:?}"); - }; - - game.log(player_index, origin, message); + let (player_index, _message) = hand_card_message(game, card, &from, &to); add_action_log_item( game, player_index, @@ -304,10 +290,65 @@ pub(crate) fn log_card_transfer( ); } -fn card_name(card: &HandCard, l: &HandCardLocation, game: &mut Game) -> String { - if l.is_public() { - card.name(game) +/// +/// # Panics +/// Panics if the transfer is invalid +#[must_use] +pub fn hand_card_message( + game: &Game, + card: &HandCard, + from: &HandCardLocation, + to: &HandCardLocation, +) -> (usize, String) { + let (player_index, message): (usize, &str) = if let HandCardLocation::Hand(p) = to { + let name = card.name(game); + ( + *p, + match from { + HandCardLocation::DrawPile => &format!("draws {name}"), + HandCardLocation::Hand(from) | HandCardLocation::RevealedHand(from) => { + &format!("gains {name} from {}", game.player_name(*from)) + } + HandCardLocation::DiscardPile => &format!("gains {name} from discard pile"), + HandCardLocation::Public => &format!("gains {name} from the public area"), + HandCardLocation::GreatSeer(_) => &format!("gains {name} from Great Seer"), + HandCardLocation::Incident => &format!("gains {name} from the current event"), + _ => { + panic!( + "Cannot transfer card from played to hand: {card:?} from {from:?} to {to:?}" + ) + } + }, + ) + } else if let HandCardLocation::Hand(p) = from { + let name = card.name(game); + ( + *p, + match to { + HandCardLocation::DiscardPile => &format!("Discard {name}"), + HandCardLocation::DrawPile => &format!("Shuffle {name} back into the draw pile"), + HandCardLocation::PlayToDiscard | HandCardLocation::PlayToKeep => { + &format!("Play {name}") + } + HandCardLocation::CompleteObjective(o) => &format!("Complete {o} using {name}"), + HandCardLocation::PlayToDiscardFaceDown => &format!("Play {name} face down"), + HandCardLocation::Public => &format!("Place {name} in public area"), + _ => panic!( + "Cannot transfer card from hand to draw pile: {card:?} from {from:?} to {to:?}" + ), + }, + ) + } else if let HandCardLocation::GreatSeer(p) = to { + assert_eq!(*from, HandCardLocation::DrawPile); + (*p, "Placed a card from the draw pile in the Great Seer") + } else if let HandCardLocation::DrawPilePeeked(p) = from { + assert_eq!(*to, HandCardLocation::DrawPile); + ( + *p, + "Reshuffled a card from the draw pile back into the draw pile", + ) } else { - card.card_type().to_string() - } + panic!("Invalid card transfer from {from:?} to {to:?}"); + }; + (player_index, message.to_string()) } diff --git a/server/src/city.rs b/server/src/city.rs index cd3c1bc1..2dd8eb70 100644 --- a/server/src/city.rs +++ b/server/src/city.rs @@ -4,6 +4,7 @@ use std::ops::{Add, Sub}; use crate::city_pieces::lose_building; use crate::content::custom_actions::CustomActionType::ForcedLabor; +use crate::content::custom_actions::SpecialAction; use crate::content::persistent_events::PersistentEventType; use crate::events::{EventOrigin, EventPlayer}; use crate::log::{ActionLogBalance, ActionLogEntry, add_action_log_item}; @@ -149,7 +150,10 @@ impl City { Happy => size + 1, Neutral => size, Angry => { - if player.played_once_per_turn_actions.contains(&ForcedLabor) { + if player + .played_once_per_turn_actions + .contains(&SpecialAction::Custom(ForcedLabor)) + { self.size() } else { 1 @@ -280,7 +284,7 @@ pub(crate) fn execute_found_city_action( add_action_log_item( game, player_index, - ActionLogEntry::units(u, ActionLogBalance::Loss), + ActionLogEntry::units(u, ActionLogBalance::Pay, settler.position), origin.clone(), vec![], ); @@ -289,7 +293,7 @@ pub(crate) fn execute_found_city_action( } found_city( game, - &EventPlayer::from_player(player_index, game, origin), + &EventPlayer::new(player_index, origin), settler.position, ); Ok(()) @@ -386,12 +390,6 @@ pub(crate) fn set_city_mood( return; } city.mood_state = new_state.clone(); - - game.log( - player, - origin, - &format!("City {position} became {new_state}"), - ); add_action_log_item( game, player, diff --git a/server/src/city_pieces.rs b/server/src/city_pieces.rs index 7e9fbec3..edb68e41 100644 --- a/server/src/city_pieces.rs +++ b/server/src/city_pieces.rs @@ -357,7 +357,7 @@ pub(crate) fn gain_building( position: Position, ) { if let Some(old) = game.get_any_city(position).pieces.building_owner(building) { - let old = EventPlayer::from_player(old, game, player.origin.clone()); + let old = EventPlayer::new(old, player.origin.clone()); lose_building(game, &old, building, position); } game.get_any_city_mut(position) @@ -372,27 +372,13 @@ pub(crate) fn log_gain_building( building: Building, position: Position, ) { - let port_pos = if building == Port { - format!( - " at the water tile {}", - game.get_any_city(position) - .port_position - .expect("Port must have a port position",) - ) - } else { - String::new() - }; - - player.log( - game, - &format!("Gain {} at {position}{port_pos}", building.name()), - ); log_structure( game, player, Structure::Building(building), ActionLogBalance::Gain, position, + log_port_position(game, building, position), ); } @@ -402,12 +388,18 @@ pub(crate) fn log_lose_building( building: Building, position: Position, ) { - player.log(game, &format!("Lose {} at {}", building.name(), position)); log_structure( game, player, Structure::Building(building), ActionLogBalance::Loss, position, + log_port_position(game, building, position), ); } + +fn log_port_position(game: &Game, building: Building, position: Position) -> Option { + (building == Port) + .then_some(game.get_any_city(position).port_position) + .flatten() +} diff --git a/server/src/collect.rs b/server/src/collect.rs index f0ca45c3..a4d4ffcc 100644 --- a/server/src/collect.rs +++ b/server/src/collect.rs @@ -8,7 +8,7 @@ use crate::map::Terrain; use crate::map::Terrain::{Fertile, Forest, Mountain}; use crate::player::{CostTrigger, Player}; use crate::player_events::ActionInfo; -use crate::playing_actions::{PlayingActionType, base_or_custom_available}; +use crate::playing_actions::{PlayingActionType, base_or_modified_available}; use crate::position::Position; use crate::resource::gain_resources_with_modifiers; use crate::resource_pile::ResourcePile; @@ -216,11 +216,6 @@ pub(crate) fn execute_collect( c: &Collect, ) -> Result<(), String> { let origin = collect_event_origin(&c.action_type, game.player(player_index)); - game.log( - player_index, - &origin, - &format!("Use city {}", c.city_position), - ); let mut i = get_total_collection_with_ballcourts( game, @@ -238,6 +233,7 @@ pub(crate) fn execute_collect( ResourcePile::mood_tokens(1), EventOrigin::SpecialAdvance(crate::special_advance::SpecialAdvance::Ballcourts), vec![], + crate::log::ActionLogBalance::Pay, ); } let city = game.players[player_index].get_city_mut(c.city_position); @@ -354,10 +350,7 @@ pub fn possible_resource_collections( .events .transient .terrain_collect_options; - let modifiers = - event - .get() - .trigger_with_modifiers(&mut terrain_options, &(), &(), &mut (), trigger); + let modifiers = event.trigger_with_modifiers(&mut terrain_options, &(), &(), &mut (), trigger); let collect_options = city_pos .neighbors() @@ -444,9 +437,8 @@ pub fn available_collect_actions_for_city( .into_iter() .filter(|action| { *action - != PlayingActionType::Custom( - crate::content::custom_actions::CustomActionType::Tributes, - ) + != crate::content::custom_actions::PlayingActionModifier::Tributes + .playing_action_type() || crate::content::civilizations::aztecs::tributes_city( game.player(player), position, @@ -460,7 +452,7 @@ pub fn available_collect_actions_for_city( #[must_use] pub fn available_collect_actions(game: &Game, player: usize) -> Vec { - base_or_custom_available(game, player, &PlayingActionType::Collect) + base_or_modified_available(game, player, &PlayingActionType::Collect) } pub(crate) fn collect_event_origin( diff --git a/server/src/combat.rs b/server/src/combat.rs index 610e6ca5..d98ddc09 100644 --- a/server/src/combat.rs +++ b/server/src/combat.rs @@ -13,6 +13,7 @@ use crate::content::ability::combat_event_origin; use crate::content::persistent_events::PersistentEventType; use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; +use crate::log::{ActionLogEntry, ActionLogEntryCombatRound}; use crate::movement::{MoveUnits, MovementRestriction, move_units, stop_current_move}; use crate::position::Position; use crate::resource_pile::ResourcePile; @@ -223,43 +224,37 @@ pub fn initiate_combat( } pub(crate) fn log_round(game: &mut Game, c: &Combat) { - game.add_info_log_item(&format!("Combat round {}", c.stats.round)); - let origin = &combat_event_origin(); - game.log( - c.attacker(), - origin, - &format!( - "Attacking with {}", - c.attackers - .iter() - .flat_map(|u| { - let p = game.player(c.attacker()); - let u = p.get_unit(*u); - vec![u.unit_type] - .into_iter() - .chain( - carried_units(u.id, p) - .iter() - .map(|u| p.get_unit(*u).unit_type), - ) - .collect_vec() - }) - .collect::() - .to_string(Some(game)) - ), - ); - game.log( - c.defender(), - origin, - &format!( - "Defending with {}", - game.player(c.defender()) - .get_units(c.defender_position()) - .iter() - .map(|u| u.unit_type) - .collect::() - .to_string(Some(game)) - ), + let attackers = c + .attackers + .iter() + .flat_map(|u| { + let p = game.player(c.attacker()); + let u = p.get_unit(*u); + vec![u.unit_type] + .into_iter() + .chain( + carried_units(u.id, p) + .iter() + .map(|u| p.get_unit(*u).unit_type), + ) + .collect_vec() + }) + .collect::(); + let defending_player = c.defender(); + let defenders = game + .player(defending_player) + .get_units(c.defender_position()) + .iter() + .map(|u| u.unit_type) + .collect::(); + EventPlayer::new(c.attacker(), combat_event_origin()).add_log_entry( + game, + ActionLogEntry::CombatRound(ActionLogEntryCombatRound { + round: c.stats.round, + attackers, + defending_player, + defenders, + }), ); } @@ -448,7 +443,7 @@ fn take_over_city( } pub(crate) fn capture_position(game: &mut Game, stats: &mut CombatStats) { - let p = &EventPlayer::from_player(stats.attacker.player, game, combat_event_origin()); + let p = &EventPlayer::new(stats.attacker.player, combat_event_origin()); let old_player = stats.defender.player; let position = stats.defender.position; let captured_settlers = game.players[old_player] @@ -468,7 +463,7 @@ pub(crate) fn capture_position(game: &mut Game, stats: &mut CombatStats) { } kill_units_with_stats(stats, game, old_player, &captured_settlers); if game.player(old_player).try_get_city(position).is_some() { - let d = &EventPlayer::from_player(old_player, game, combat_event_origin()); + let d = &EventPlayer::new(old_player, combat_event_origin()); conquer_city(game, position, p, d); } } @@ -563,9 +558,8 @@ fn apply_battle_movement_restriction(game: &mut Game, player_index: usize, unit_ } if used_longships { - EventPlayer::from_player( + EventPlayer::new( player_index, - game, EventOrigin::SpecialAdvance(SpecialAdvance::Longships), ) .log(game, "Ignore battle movement restrictions"); diff --git a/server/src/combat_listeners.rs b/server/src/combat_listeners.rs index b1f5fcfc..7990cb75 100644 --- a/server/src/combat_listeners.rs +++ b/server/src/combat_listeners.rs @@ -5,7 +5,7 @@ use crate::combat_roll::CombatHits; use crate::combat_stats::CombatStats; use crate::content::ability::{Ability, combat_event_origin}; use crate::content::persistent_events::{PersistentEventType, PositionRequest, UnitsRequest}; -use crate::events::EventOrigin; +use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; use crate::log::current_action_log_mut; use crate::movement::move_units; @@ -334,7 +334,7 @@ pub(crate) fn combat_round_end(game: &mut Game, r: CombatRoundEnd) -> Option) { + EventPlayer::new(player_index, origin.unwrap_or(combat_event_origin())) + .log(game, "wins the battle"); +} + fn defender_wins(game: &mut Game, c: Combat) { - game.add_info_log_item("Defender wins"); + log_winner(game, c.defender(), None); end_combat_and_store_stats(game, CombatEnd::new(CombatResult::DefenderWins, c)); } pub(crate) fn draw(game: &mut Game, c: Combat) { if c.defender_fortress(game) && c.first_round() { - game.add_info_log_item(&format!( - "{} wins the battle because he has a defending fortress", - game.player_name(c.defender()) - )); + log_winner( + game, + c.defender(), + Some(EventOrigin::Ability("fortress".to_string())), + ); return end_combat_and_store_stats(game, CombatEnd::new(CombatResult::DefenderWins, c)); } - game.add_info_log_item("Battle ends in a draw"); + EventPlayer::new(c.attacker(), combat_event_origin()).log(game, "ends the battle in a draw"); end_combat_and_store_stats(game, CombatEnd::new(CombatResult::Draw, c)); } diff --git a/server/src/combat_roll.rs b/server/src/combat_roll.rs index 87731065..f3478503 100644 --- a/server/src/combat_roll.rs +++ b/server/src/combat_roll.rs @@ -3,6 +3,7 @@ use crate::combat_listeners::CombatStrength; use crate::content::ability::combat_event_origin; use crate::events::EventPlayer; use crate::game::Game; +use crate::log::{ActionLogEntry, ActionLogEntryCombatRoll}; use crate::unit::UnitType::{Cavalry, Elephant, Infantry}; use crate::unit::{LEADER_UNIT, UnitType, Units}; use num::Zero; @@ -59,12 +60,20 @@ impl CombatHits { } } +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct UnitCombatRoll { + pub value: u8, + pub unit_type: UnitType, + pub bonus: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub combat_bonus: Option, +} + pub(crate) struct CombatRoundStats { horse_master_value: Option, player: usize, - opponent_str: String, pub(crate) fighters: u8, - log_str: String, + rolls: Vec, combat_value: u8, hit_cancels: u8, strength: CombatStrength, @@ -78,7 +87,7 @@ impl CombatRoundStats { strength: CombatStrength, ) -> CombatRoundStats { let fighting = c.fighting_units(game, player); - let mut log = vec![]; + let mut unit_rolls = vec![]; let rolls = roll( game, player, @@ -93,29 +102,20 @@ impl CombatRoundStats { && game .player(player) .has_special_advance(crate::special_advance::SpecialAdvance::Horsemanship), - &mut log, + &mut unit_rolls, ); - let log_str = roll_log_str(&log); let combat_value = rolls.combat_value as u8; let hit_cancels = rolls.hit_cancels + strength.hit_cancels; - let opponent_str = if c.defender() == player { - "attacking" - } else { - "defending" - } - .to_string(); - CombatRoundStats { horse_master_value: (c.first_round() && game.player(player).active_leader() == Some(crate::leader::Leader::Attila) && c.has_leader(c.role(player), game)) .then_some(rolls.horse_master_value) .flatten(), - opponent_str, strength, player, - log_str, + rolls: unit_rolls, combat_value, hit_cancels, fighters: fighting.len() as u8, @@ -135,37 +135,20 @@ impl CombatRoundStats { self.combat_value, ); combat_hits.horse_master_value = self.horse_master_value; - let hits = combat_hits.hits(); - let p = EventPlayer::from_player(self.player, game, combat_event_origin()); - p.log( + EventPlayer::new(self.player, combat_event_origin()).add_log_entry( game, - &format!( - "Roll {} for combined combat value of {} and gets {} hits against {} units", - self.log_str, self.combat_value, hits, self.opponent_str, - ), + ActionLogEntry::CombatRoll(ActionLogEntryCombatRoll { + rolls: self.rolls.clone(), + combat_value: self.combat_value, + hits: combat_hits.hits(), + combat_modifiers: self.strength.roll_log.clone(), + }), ); - - if !self.strength.roll_log.is_empty() { - p.log( - game, - &format!( - "Combat modifiers: {}", - roll_log_str(&self.strength.roll_log) - ), - ); - } combat_hits } } -fn roll_log_str(log: &[String]) -> String { - if log.is_empty() { - return String::from("no dice"); - } - log.join(", ") -} - struct CombatRolls { horse_master_value: Option, pub combat_value: i8, @@ -209,7 +192,7 @@ fn roll( deny_combat_abilities: bool, cap_bonus: bool, mut horsemanship: bool, - roll_log: &mut Vec, + roll_log: &mut Vec, ) -> CombatRolls { let mut dice_rolls = extra_dies; let mut unit_types = Units::empty(); @@ -237,20 +220,16 @@ fn roll( Infantry => { rolls.combat_value += 1; bonus += 1; - add_roll_log_effect(roll_log, "+1 combat value"); + add_bonus(roll_log); } Cavalry => { let extra = if horsemanship { 3 } else { 2 }; rolls.combat_value += extra; bonus += extra; - add_roll_log_effect( - roll_log, - if horsemanship { - "+3 combat value (Horsemanship)" - } else { - "+2 combat value" - }, - ); + add_bonus(roll_log); + if horsemanship { + roll_log.last_mut().expect("cavalry roll").combat_bonus = Some(3); + } horsemanship = false; if rolls.horse_master_value.is_none() { rolls.horse_master_value = Some(value); @@ -259,12 +238,10 @@ fn roll( Elephant => { rolls.hit_cancels += 1; rolls.combat_value -= value as i8; - add_roll_log_effect(roll_log, "-1 hits, no combat value"); + add_bonus(roll_log); } _ => (), } - } else { - add_roll_log_effect(roll_log, "no bonus"); } } rolls.horse_master_value = rolls.horse_master_value.map(|v| { @@ -276,7 +253,11 @@ fn roll( }); if cap_bonus && bonus > 2 { rolls.combat_value -= bonus - 2; - roll_log.push(format!("opponent limits combat bonus from +{bonus} to +2")); + game.log( + player_index, + &combat_event_origin(), + &format!("opponent limits combat bonus from +{bonus} to +2"), + ); } if rolls.combat_value < 0 { rolls.combat_value = 0; @@ -288,7 +269,7 @@ fn dice_roll_with_leader_reroll( game: &mut Game, unit_types: &mut Units, deny_combat_abilities: bool, - roll_log: &mut Vec, + roll_log: &mut Vec, ) -> CombatDieRoll { let side = roll_die(game, roll_log); @@ -303,7 +284,7 @@ fn dice_roll_with_leader_reroll( // if used, the leader grants unlimited rerolls of 1s loop { - add_roll_log_effect(roll_log, "re-roll"); + add_bonus(roll_log); let side = roll_die(game, roll_log); if side.bonus != LEADER_UNIT { @@ -312,13 +293,17 @@ fn dice_roll_with_leader_reroll( } } -fn add_roll_log_effect(roll_log: &mut [String], effect: &str) { - use std::fmt::Write as _; - let _ = write!(roll_log[roll_log.len() - 1], "{effect})"); +fn add_bonus(roll_log: &mut [UnitCombatRoll]) { + roll_log.last_mut().expect("entry not found").bonus = true; } -fn roll_die(game: &mut Game, roll_log: &mut Vec) -> CombatDieRoll { +fn roll_die(game: &mut Game, roll_log: &mut Vec) -> CombatDieRoll { let roll = game.next_dice_roll(); - roll_log.push(format!("{} ({}, ", roll.value, roll.bonus.generic_name())); - roll.clone() + roll_log.push(UnitCombatRoll { + value: roll.value, + unit_type: roll.bonus, + bonus: false, + combat_bonus: None, + }); + roll } diff --git a/server/src/construct.rs b/server/src/construct.rs index 35f908b9..aebd5baa 100644 --- a/server/src/construct.rs +++ b/server/src/construct.rs @@ -181,7 +181,7 @@ pub(crate) fn construct( } gain_building( game, - &EventPlayer::from_player(player, game, origin.clone()), + &EventPlayer::new(player, origin.clone()), building, city_position, ); @@ -232,7 +232,7 @@ pub(crate) fn on_construct(game: &mut Game, player_index: usize, info: Construct gain_advance_without_payment( game, b.advance, - &EventPlayer::from_player(player_index, game, b.origin), + &EventPlayer::new(player_index, b.origin), ResourcePile::empty(), true, ); diff --git a/server/src/content/ability.rs b/server/src/content/ability.rs index a1d2070d..3b1bce57 100644 --- a/server/src/content/ability.rs +++ b/server/src/content/ability.rs @@ -154,7 +154,8 @@ pub(crate) fn recruit_event_origin() -> EventOrigin { EventOrigin::Ability("Recruit".to_string()) } -pub(crate) fn combat_event_origin() -> EventOrigin { +#[must_use] +pub fn combat_event_origin() -> EventOrigin { EventOrigin::Ability("Combat".to_string()) } diff --git a/server/src/content/action_cards/cultural_takeover.rs b/server/src/content/action_cards/cultural_takeover.rs index 07c4d0e8..aa4fb483 100644 --- a/server/src/content/action_cards/cultural_takeover.rs +++ b/server/src/content/action_cards/cultural_takeover.rs @@ -7,7 +7,7 @@ use crate::content::effects::PermanentEffect; use crate::content::persistent_events::{SelectedStructure, UnitTypeRequest}; use crate::content::tactics_cards::TacticsCardFactory; use crate::cultural_influence::{ - InfluenceCultureInfo, available_influence_actions, influence_culture_boost_cost, + InfluenceCultureAttemptInfo, available_influence_actions, influence_culture_boost_cost, }; use crate::game::Game; use crate::player::{Player, gain_unit, remove_unit}; @@ -104,6 +104,7 @@ fn any_barbarian_city_can_be_influenced(game: &Game, p: &Player) -> bool { i, true, true, + c.player_index, ) .is_ok() }) @@ -138,7 +139,7 @@ pub(crate) fn use_cultural_takeover() -> Ability { && i.target_unit.is_none() && matches!(i.structure, Structure::CityCenter) && !(is_barbarian_takeover(game, i) - || i.barbarian_takeover_check + || i.barbarian_takeover || crate::content::civilizations::celts::can_mark_city( game, i.info.player, @@ -168,7 +169,7 @@ pub(crate) fn use_cultural_takeover() -> Ability { .build() } -fn is_barbarian_takeover(game: &Game, c: &InfluenceCultureInfo) -> bool { +fn is_barbarian_takeover(game: &Game, c: &InfluenceCultureAttemptInfo) -> bool { let city = game.get_any_city(c.position); city.player_index == get_barbarians_player(game).index && city.size() == 1 diff --git a/server/src/content/action_cards/mercenaries.rs b/server/src/content/action_cards/mercenaries.rs index 130c768c..69df5a3a 100644 --- a/server/src/content/action_cards/mercenaries.rs +++ b/server/src/content/action_cards/mercenaries.rs @@ -8,7 +8,8 @@ use crate::content::civilizations::rome::owner_of_sulla_in_range; use crate::content::persistent_events::{PaymentRequest, PositionRequest}; use crate::content::tactics_cards::TacticsCardFactory; use crate::game::Game; -use crate::movement::{MoveUnits, move_action_log}; +use crate::log::ActionLogEntry; +use crate::movement::MoveUnits; use crate::player::Player; use crate::position::Position; use crate::resource::ResourceType; @@ -153,7 +154,8 @@ fn move_army(b: ActionCardBuilder, i: i32) -> ActionCardBuilder { let units = b.get_units(from).iter().map(|u| u.id).collect_vec(); let m = MoveUnits::new(units, to, None, ResourcePile::empty()); - s.log(game, &move_action_log(game, b, &m)); + s.player() + .add_log_entry(game, ActionLogEntry::move_units(b, &m)); move_with_possible_combat(game, barbarian, &m); }, @@ -192,7 +194,8 @@ fn barbarian_army_positions_in_range2( .is_some_and(|sulla_owner| player.index != sulla_owner) { log.push(format!( - "{player} cannot move Barbarian army at {p} because Sulla is in range", + "{} cannot move Barbarian army at {p} because Sulla is in range", + player.get_name() )); return false; } diff --git a/server/src/content/action_cards/negotiation.rs b/server/src/content/action_cards/negotiation.rs index fe1a9bed..d36d138a 100644 --- a/server/src/content/action_cards/negotiation.rs +++ b/server/src/content/action_cards/negotiation.rs @@ -94,7 +94,7 @@ pub(crate) fn use_negotiations() -> Ability { } } } - add_start_turn_action_if_needed(game); + add_start_turn_action_if_needed(game, p.index); // must be in reverse order to not mess up the indices during deletion for i in delete.iter().rev() { p.log(game, &format!("May attack {partner_name} again.",)); @@ -193,7 +193,7 @@ pub(crate) fn use_assassination() -> Ability { if remove_element_by(&mut game.permanent_effects, |e| is_assassinated(e, p.index)) .is_some() { - add_start_turn_action_if_needed(game); + add_start_turn_action_if_needed(game, p.index); lose_action(game, p); } }, diff --git a/server/src/content/action_cards/spy.rs b/server/src/content/action_cards/spy.rs index aa73217c..6e06d219 100644 --- a/server/src/content/action_cards/spy.rs +++ b/server/src/content/action_cards/spy.rs @@ -51,10 +51,10 @@ pub(crate) fn spy(id: u8, tactics_card: TacticsCardFactory) -> ActionCard { let other = game.player(a.selected_player.expect("player not found")); let all = HandCardType::get_all(); - let mut cards = hand_cards(other, &all); + let mut cards = hand_cards(other, &all, game); for t in all { - if !hand_cards(other, &[t]).is_empty() { - cards.extend(hand_cards(p, &[t])); + if !hand_cards(other, &[t], game).is_empty() { + cards.extend(hand_cards(p, &[t], game)); } } @@ -88,7 +88,7 @@ pub(crate) fn spy(id: u8, tactics_card: TacticsCardFactory) -> ActionCard { fn players_with_cards(game: &Game, player: usize) -> Vec { game.players .iter() - .filter(|p| p.index != player && has_any_card(p)) + .filter(|p| p.index != player && has_any_card(p, game)) .map(|p| p.index) .collect_vec() } @@ -110,8 +110,8 @@ fn swap_spy_cards( let p = player.get(game); let o = game.player(other); - let our_card = get_swap_card(swap, p)?; - let other_card = get_swap_card(swap, o)?; + let our_card = get_swap_card(swap, p, game)?; + let other_card = get_swap_card(swap, o, game)?; let t = match our_card { HandCard::ActionCard(id) => { @@ -221,22 +221,23 @@ fn swap_card( ); } -fn get_swap_card(swap: &[HandCard], p: &Player) -> Result { - hand_cards(p, &HandCardType::get_all()) +fn get_swap_card(swap: &[HandCard], p: &Player, game: &Game) -> Result { + hand_cards(p, &HandCardType::get_all(), game) .iter() .find(|c| swap.contains(c)) .ok_or("card not found".to_string()) .cloned() } -fn has_any_card(p: &Player) -> bool { - !hand_cards(p, &HandCardType::get_all()).is_empty() +fn has_any_card(p: &Player, game: &Game) -> bool { + !hand_cards(p, &HandCardType::get_all(), game).is_empty() } fn get_swap_secrets(other: &Player, game: &Game) -> Vec { vec![ format!( - "{other} has the following action cards: {}", + "{} has the following action cards: {}", + other.get_name(), other .action_cards .iter() @@ -244,7 +245,8 @@ fn get_swap_secrets(other: &Player, game: &Game) -> Vec { .join(", ") ), format!( - "{other} has the following objective cards: {}", + "{} has the following objective cards: {}", + other.get_name(), other .objective_cards .iter() @@ -252,7 +254,8 @@ fn get_swap_secrets(other: &Player, game: &Game) -> Vec { .join(", ") ), format!( - "{other} has the following wonder cards: {}", + "{} has the following wonder cards: {}", + other.get_name(), other.wonder_cards.iter().map(Wonder::name).join(", ") ), ] @@ -270,6 +273,7 @@ pub(crate) fn validate_spy_cards(cards: &[HandCard], game: &Game) -> Result<(), let our = hand_cards( game.player(game.current_event().player.index), &HandCardType::get_all(), + game, ) .into_iter() .filter(|c| cards.contains(c)) diff --git a/server/src/content/advances/autocracy.rs b/server/src/content/advances/autocracy.rs index 96730d6b..dc4244e6 100644 --- a/server/src/content/advances/autocracy.rs +++ b/server/src/content/advances/autocracy.rs @@ -56,9 +56,9 @@ fn totalitarianism() -> AdvanceBuilder { .add_transient_event_listener( |event| &mut event.on_influence_culture_attempt, 0, - |r, city, game, _| { + |r, city, game, p| { if let Ok(info) = r - && info.is_defender + && info.is_defender(p.index) && game .player(city.player_index) .get_units(city.position) diff --git a/server/src/content/advances/construction.rs b/server/src/content/advances/construction.rs index 85f52990..6fde5254 100644 --- a/server/src/content/advances/construction.rs +++ b/server/src/content/advances/construction.rs @@ -2,7 +2,7 @@ use crate::ability_initializer::AbilityInitializerSetup; use crate::advance::Bonus::{CultureToken, MoodToken}; use crate::advance::{Advance, AdvanceBuilder, AdvanceInfo}; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo, advance_group_builder}; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::PlayingActionModifier; use crate::game::GameOptions; use crate::payment::PaymentConversion; use crate::playing_actions::PlayingActionType; @@ -87,5 +87,5 @@ fn city_planning() -> AdvanceBuilder { "Once per turn, as a free action, you may pay 1 idea and 1 wood to get a free Construct action.", ) .replaces(Advance::Sanitation) - .add_action_modifier(CustomActionType::CityPlanning, |cost| cost.once_per_turn().free_action().resources(ResourcePile::ideas(1) + ResourcePile::wood(1)), PlayingActionType::Construct) + .add_action_modifier(PlayingActionModifier::CityPlanning, |cost| cost.once_per_turn().free_action().resources(ResourcePile::ideas(1) + ResourcePile::wood(1)), PlayingActionType::Construct) } diff --git a/server/src/content/advances/culture.rs b/server/src/content/advances/culture.rs index 39aab2f2..d51bc530 100644 --- a/server/src/content/advances/culture.rs +++ b/server/src/content/advances/culture.rs @@ -5,7 +5,7 @@ use crate::city::{City, MoodState}; use crate::city_pieces::Building::Obelisk; use crate::content::ability::AbilityBuilder; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo, advance_group_builder}; -use crate::content::custom_actions::{CustomActionType, any_non_happy}; +use crate::content::custom_actions::{CustomActionType, PlayingActionModifier, any_non_happy}; use crate::content::persistent_events::PaymentRequest; use crate::events::{EventOrigin, check_event_origin}; use crate::game::GameOptions; @@ -37,7 +37,7 @@ fn arts() -> AdvanceBuilder { .with_advance_bonus(CultureToken) .with_unlocked_building(Obelisk) .add_action_modifier( - CustomActionType::ArtsInfluenceCultureAttempt, + PlayingActionModifier::ArtsInfluenceCultureAttempt, |c| { c.once_per_turn() .free_action() @@ -79,9 +79,9 @@ fn monuments() -> AdvanceBuilder { .add_transient_event_listener( |event| &mut event.on_influence_culture_attempt, 1, - |r, city, _, _| { + |r, city, _, p| { if let Ok(info) = r - && info.is_defender + && info.is_defender(p.index) && !city.pieces.wonders.is_empty() { *r = Err( diff --git a/server/src/content/advances/democracy.rs b/server/src/content/advances/democracy.rs index a2ca2d8a..840ec903 100644 --- a/server/src/content/advances/democracy.rs +++ b/server/src/content/advances/democracy.rs @@ -3,9 +3,8 @@ use crate::action::Action; use crate::advance::{Advance, AdvanceBuilder, AdvanceInfo}; use crate::city::{self, MoodState}; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo, advance_group_builder}; -use crate::content::custom_actions::CustomActionType::{ - self, CivilLiberties, FreeEconomyCollect, VotingIncreaseHappiness, -}; +use crate::content::custom_actions::CustomActionType::{self, CivilLiberties}; +use crate::content::custom_actions::{PlayingActionModifier, SpecialAction}; use crate::content::persistent_events::PositionRequest; use crate::game::GameOptions; use crate::log::current_turn_log_without_redo; @@ -34,7 +33,7 @@ fn voting() -> AdvanceBuilder { "Take an Increase Happiness action without spending an action. Pay the normal mood cost plus 1 extra mood token in total, regardless of how many of your cities you improve.", ) .add_action_modifier( - VotingIncreaseHappiness, + PlayingActionModifier::VotingIncreaseHappiness, |c| { c.any_times() .free_action() @@ -92,7 +91,7 @@ fn free_economy() -> AdvanceBuilder { "Pay 1 mood token to activate one of your cities and collect resources without spending an action. This must be your only Collect action that turn.", ) .add_action_modifier( - FreeEconomyCollect, + PlayingActionModifier::FreeEconomyCollect, |c| { c.once_per_turn() .free_action() @@ -107,12 +106,14 @@ fn free_economy() -> AdvanceBuilder { PlayingActionType::Collect if p.get(game) .played_once_per_turn_actions - .contains(&FreeEconomyCollect) => + .contains(&SpecialAction::Modifier( + PlayingActionModifier::FreeEconomyCollect, + )) => { *available = Err("Cannot collect when Free Economy Collect was used".to_string()); } - PlayingActionType::Custom(i) - if *i == FreeEconomyCollect + PlayingActionType::Special(SpecialAction::Modifier(m)) + if *m == PlayingActionModifier::FreeEconomyCollect && current_turn_log_without_redo(game) .actions .iter() diff --git a/server/src/content/advances/economy.rs b/server/src/content/advances/economy.rs index 4347762c..daeaa721 100644 --- a/server/src/content/advances/economy.rs +++ b/server/src/content/advances/economy.rs @@ -156,7 +156,7 @@ where if !p.get(game).can_use_advance(Advance::TradeRoutes) { return None; } - add_start_turn_action_if_needed(game); + add_start_turn_action_if_needed(game, p.index); trade_route_reward(game, p).map(|(reward, routes)| { gain_market_bonus(game, &routes); ResourceRewardRequest::new(reward, "Collect trade routes reward".to_string()) diff --git a/server/src/content/advances/education.rs b/server/src/content/advances/education.rs index c12c329c..ef620ff3 100644 --- a/server/src/content/advances/education.rs +++ b/server/src/content/advances/education.rs @@ -6,11 +6,11 @@ use crate::card::HandCardLocation; use crate::city_pieces::Building; use crate::content::ability::Ability; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo, advance_group_builder}; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::PlayingActionModifier; use crate::content::persistent_events::PaymentRequest; use crate::game::GameOptions; -use crate::log::{self, ActionLogEntry}; -use crate::objective_card::draw_objective_card_from_pile; +use crate::log::{ActionLogEntry, current_turn_log_mut}; +use crate::objective_card::gain_objective_card_from_pile; use crate::playing_actions::PlayingActionType; use crate::resource::gain_resources; use crate::resource_pile::ResourcePile; @@ -42,16 +42,16 @@ fn writing() -> AdvanceBuilder { if !game.is_update_patch() { gain_action_card_from_pile(game, player); } - // can't gain objective card directly, because the "combat_end" listener might - // currently being processed ("teach us now") - player.get_mut(game).gained_objective = draw_objective_card_from_pile(game, player); + gain_objective_card_from_pile(game, player); }) .add_transient_event_listener( |event| &mut event.after_action, 1, |game, (), (), p| { - if game.is_update_patch() { - let count = log::current_action_log_mut(game) + if game.is_update_patch() + && let Some(a) = current_turn_log_mut(game).actions.last() + { + let count = a .items .iter() .filter(|item| { @@ -64,7 +64,9 @@ fn writing() -> AdvanceBuilder { ) }) .count(); - p.gain_resources(game, ResourcePile::ideas(count as u8)); + if count > 0 { + p.gain_resources(game, ResourcePile::ideas(count as u8)); + } } }, ) @@ -189,7 +191,7 @@ fn philosophy_patched() -> AdvanceBuilder { ) .replaces(Advance::Philosophy) .add_action_modifier( - CustomActionType::Philosophy, + PlayingActionModifier::Philosophy, |cost| { cost.any_times() .free_action() diff --git a/server/src/content/advances/science.rs b/server/src/content/advances/science.rs index 38213e94..9745fcec 100644 --- a/server/src/content/advances/science.rs +++ b/server/src/content/advances/science.rs @@ -7,7 +7,9 @@ use crate::content::ability::Ability; use crate::content::advances::{AdvanceGroup, AdvanceGroupInfo, advance_group_builder}; use crate::content::persistent_events::ResourceRewardRequest; use crate::game::GameOptions; +use crate::log::ActionLogBalance; use crate::resource::ResourceType; +use crate::resource_pile::ResourcePile; pub(crate) fn science(options: &GameOptions) -> AdvanceGroupInfo { advance_group_builder( @@ -104,17 +106,22 @@ fn metallurgy() -> AdvanceBuilder { "Metallurgy", "If you have the Steel Weapons Advance, \ you no longer have to pay 1 ore to activate it against enemies without Steel Weapons. \ - If you collect at least 2 ore, replace 1 ore with 1 gold", + If you collect at least 2 ore, you may replace 1 ore with 1 gold", ) .with_advance_bonus(CultureToken) - .add_transient_event_listener( - |event| &mut event.collect_total, + .add_bool_request( + |event| &mut event.collect, 0, - |i, _, _, p| { - if i.total.ore >= 2 { - i.total.ore -= 1; - i.total.gold += 1; - i.info.add_log(p, "Convert 1 ore to 1 gold"); + |_game, _p, i| { + (i.total.ore >= 2).then_some("Do you want to convert 1 ore to 1 gold?".to_string()) + }, + move |game, s, _| { + if s.choice { + s.player() + .lose_resources(game, ResourcePile::ore(1), ActionLogBalance::Pay); + s.player().gain_resources(game, ResourcePile::gold(1)); + } else { + s.log(game, "Did not convert ore to gold"); } }, ) diff --git a/server/src/content/advances/theocracy.rs b/server/src/content/advances/theocracy.rs index 37e99a74..c9557cd2 100644 --- a/server/src/content/advances/theocracy.rs +++ b/server/src/content/advances/theocracy.rs @@ -83,9 +83,9 @@ fn devotion() -> AdvanceBuilder { .add_transient_event_listener( |event| &mut event.on_influence_culture_attempt, 4, - |r, city, _, _| { + |r, city, _, p| { if let Ok(info) = r - && info.is_defender + && info.is_defender(p.index) && city.pieces.temple.is_some() { info.set_no_boost(); @@ -106,13 +106,10 @@ fn conversion() -> AdvanceBuilder { 3, |r, _, _, p| { if let Ok(info) = r - && !info.is_defender + && !info.is_defender(p.index) { info.roll_boost += 1; - info.info.add_log( - p, - "Gain +1 to Influence Culture roll for Conversion Advance", - ); + info.info.add_log(p, "gains +1 to Influence Culture roll"); } }, ) diff --git a/server/src/content/advances/warfare.rs b/server/src/content/advances/warfare.rs index 8dd7df32..6606029b 100644 --- a/server/src/content/advances/warfare.rs +++ b/server/src/content/advances/warfare.rs @@ -225,9 +225,17 @@ fn use_steel_weapons(game: &Game, c: &Combat, s: &mut CombatStrength, role: Comb let add_combat_value = |s: &mut CombatStrength, value: u8| { s.extra_combat_value += value as i8; - let free = value == 2 && game.player(c.player(role)).can_use_advance(Advance::Metallurgy); - let benefit = if free { " (Metallurgy: no ore cost)" } else { "" }; - s.roll_log.push(format!("steel weapons added {value} combat value{benefit}")); + let free = value == 2 + && game + .player(c.player(role)) + .can_use_advance(Advance::Metallurgy); + let benefit = if free { + " (Metallurgy: no ore cost)" + } else { + "" + }; + s.roll_log + .push(format!("steel weapons added {value} combat value{benefit}")); }; if role.is_attacker() { diff --git a/server/src/content/civilizations/aztecs.rs b/server/src/content/civilizations/aztecs.rs index b93ef72c..2f1691e8 100644 --- a/server/src/content/civilizations/aztecs.rs +++ b/server/src/content/civilizations/aztecs.rs @@ -102,14 +102,14 @@ fn human_sacrifice() -> SpecialAdvanceInfo { let p=s.player(); // Put the chosen pieces first so the shared payment path returns exactly these pieces. let held=&mut p.get_mut(game).captives;held.sort_by_key(|c|!s.choice.contains(c)); - let amount=s.choice.len() as u8;lose_resources(game,p.index,ResourcePile::captives(amount),s.origin.clone(),vec![]); + let amount=s.choice.len() as u8;lose_resources(game,p.index,ResourcePile::captives(amount),s.origin.clone(),vec![],crate::log::ActionLogBalance::Pay); a.payment=ResourcePile::captives(amount); }) .add_resource_request(|e|&mut e.custom_action,1,|_,p,a|Some(crate::content::persistent_events::ResourceRewardRequest::new(p.reward_options().tokens(a.payment.captives),"Human Sacrifice · Gain mood or culture tokens".into()))), |_,p|!p.captives.is_empty()) .add_transient_event_listener(|e|&mut e.general_payment_conversions,15,|conversions,(),(),_|conversions.push(PaymentConversion::resource_options(vec![ResourcePile::mood_tokens(1),ResourcePile::culture_tokens(1)],ResourcePile::captives(1),PaymentConversionType::Unlimited))) .add_bool_request(|e|&mut e.incident,10000,|game,p,i|(i.active_player==p.index&&!i.consumed&&i.passed.is_none()&&p.get(game).resources.captives>0).then(||format!("Human Sacrifice · Sacrifice 1 captive to cancel {} and draw another event?",game.cache.get_incident(i.incident_id).name)),|game,s,i|{ - if s.choice {lose_resources(game,s.player_index,ResourcePile::captives(1),s.origin.clone(),vec![]);i.consumed=true;i.replaced_by_sacrifice=true;s.log(game,"Sacrificed a captive: the entire event and its icon are cancelled");} + if s.choice {lose_resources(game,s.player_index,ResourcePile::captives(1),s.origin.clone(),vec![],crate::log::ActionLogBalance::Pay);i.consumed=true;i.replaced_by_sacrifice=true;s.log(game,"Sacrificed a captive: the entire event and its icon are cancelled");} }).build() } fn aztec_gold() -> SpecialAdvanceInfo { @@ -227,7 +227,7 @@ fn acamapichtli() -> LeaderInfo { .add_transient_event_listener(|e|&mut e.building_cost,14,|i,_,game,p|growth(i,game,p)) .add_transient_event_listener(|e|&mut e.wonder_cost,14,|i,_,game,p|growth(i,game,p)).build(), LeaderAbility::builder("Tributes","Once per turn, pay 2 mood tokens to Collect from Acamapichtli's city as a free action, if its size is 3 or less.") - .add_action_modifier(CustomActionType::Tributes,|c|c.once_per_turn().free_action().resources(ResourcePile::mood_tokens(2)),crate::playing_actions::PlayingActionType::Collect).build()) + .add_action_modifier(crate::content::custom_actions::PlayingActionModifier::Tributes,|c|c.once_per_turn().free_action().resources(ResourcePile::mood_tokens(2)),crate::playing_actions::PlayingActionType::Collect).build()) } fn ahuitzotl() -> LeaderInfo { LeaderInfo::new(Leader::Ahuitzotl,"Ahuitzotl", diff --git a/server/src/content/civilizations/egypt.rs b/server/src/content/civilizations/egypt.rs index 84a77985..0673c8fe 100644 --- a/server/src/content/civilizations/egypt.rs +++ b/server/src/content/civilizations/egypt.rs @@ -216,12 +216,8 @@ pub(crate) fn innovator(game: &mut Game, position: Position) { let player = game.get_any_city(position).player_index; let p = game.player(player); if p.active_leader() == Some(Leader::Imhotep) && leader_position(p) == position { - EventPlayer::from_player( - player, - game, - EventOrigin::LeaderAbility("Innovator".to_string()), - ) - .gain_resources(game, ResourcePile::ideas(1)); + EventPlayer::new(player, EventOrigin::LeaderAbility("Innovator".to_string())) + .gain_resources(game, ResourcePile::ideas(1)); } } diff --git a/server/src/content/civilizations/greece.rs b/server/src/content/civilizations/greece.rs index 6b726396..adad1928 100644 --- a/server/src/content/civilizations/greece.rs +++ b/server/src/content/civilizations/greece.rs @@ -9,7 +9,7 @@ use crate::combat_listeners::CombatStrength; use crate::content::ability::AbilityBuilder; use crate::content::advances::AdvanceGroup; use crate::content::advances::warfare::draft_cost; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::{CustomActionType, PlayingActionModifier, SpecialAction}; use crate::content::persistent_events::{HandCardsRequest, PositionRequest}; use crate::events::check_event_origin; use crate::game::Game; @@ -108,11 +108,13 @@ fn hellenistic_culture() -> SpecialAdvanceInfo { "You may start Influence Culture attempts from cities containing a building in your color, including cities owned by other players. You may pay 2 mood tokens instead of the 1 culture token for Arts.", ) .add_action_modifier( - CustomActionType::HellenisticInfluenceCultureAttempt, + PlayingActionModifier::HellenisticInfluenceCultureAttempt, |c| { - c.once_per_turn_mutually_exclusive(CustomActionType::ArtsInfluenceCultureAttempt) - .free_action() - .resources(ResourcePile::mood_tokens(2)) + c.once_per_turn_mutually_exclusive(SpecialAction::Modifier( + PlayingActionModifier::ArtsInfluenceCultureAttempt, + )) + .free_action() + .resources(ResourcePile::mood_tokens(2)) }, PlayingActionType::InfluenceCultureAttempt, ) diff --git a/server/src/content/civilizations/huns.rs b/server/src/content/civilizations/huns.rs index 948309db..271944e8 100644 --- a/server/src/content/civilizations/huns.rs +++ b/server/src/content/civilizations/huns.rs @@ -184,7 +184,7 @@ pub(crate) fn finish_city_move(game: &mut Game, player: usize, from: Position, t Some(Terrain::Mountain) => ResourcePile::ore(1), _ => ResourcePile::empty(), }; - let p = EventPlayer::from_player(player, game, origin); + let p = EventPlayer::new(player, origin); p.log(game, &format!("Moved city {from} to {to}")); if !pile.is_empty() { p.gain_resources(game, pile); diff --git a/server/src/content/civilizations/india.rs b/server/src/content/civilizations/india.rs index 0d2e8a47..b76792b4 100644 --- a/server/src/content/civilizations/india.rs +++ b/server/src/content/civilizations/india.rs @@ -10,7 +10,7 @@ use crate::combat::CombatModifier; use crate::content::ability::{Ability, AbilityBuilder}; use crate::content::custom_actions::CustomActionType; use crate::content::persistent_events::{AdvanceRequest, PaymentRequest}; -use crate::cultural_influence::{InfluenceCultureInfo, resolve_influence_roll}; +use crate::cultural_influence::{InfluenceCultureAttemptInfo, resolve_influence_roll}; use crate::game::Game; use crate::leader::{Leader, LeaderInfo}; use crate::leader_ability::{LeaderAbility, activate_leader_city, can_activate_leader_city}; @@ -171,7 +171,11 @@ fn sri_gupta() -> LeaderInfo { ) } -pub(crate) fn buddhism_available(game: &Game, player: usize, info: &InfluenceCultureInfo) -> bool { +pub(crate) fn buddhism_available( + game: &Game, + player: usize, + info: &InfluenceCultureAttemptInfo, +) -> bool { let p = game.player(player); !p.event_info.contains_key(BUDDHISM) && p.units.iter().any(|u| { @@ -190,15 +194,15 @@ fn ashoka() -> LeaderInfo { LeaderAbility::builder(BUDDHISM, "Once per turn, reroll Cultural Influence from Ashoka's city if it has a Temple or the target is a Temple.") .add_bool_request( - |e| &mut e.influence_culture, 1, + |e| &mut e.influence_culture_boost, 1, |game, p, info| (info.roll < crate::consts::INFLUENCE_MIN_ROLL - && buddhism_available(game, p.index, info)) + && buddhism_available(game, p.index, &info.attempt)) .then(|| format!("Buddhism · Rolled {}. Reroll?", info.roll)), |game, s, info| { if s.choice { let previous = info.roll; - info.roll = game.next_dice_roll().value + info.roll_boost; - info.info.info.insert(BUDDHISM.into(), "used".into()); + info.roll = game.next_dice_roll().value + info.attempt.roll_boost; + info.attempt.info.info.insert(BUDDHISM.into(), "used".into()); game.player_mut(s.player_index).event_info.insert(BUDDHISM.into(), "used".into()); s.log(game, &format!("Rerolled Cultural Influence: {previous} → {}", info.roll)); } diff --git a/server/src/content/civilizations/japan.rs b/server/src/content/civilizations/japan.rs index 1f89d479..3d909ff1 100644 --- a/server/src/content/civilizations/japan.rs +++ b/server/src/content/civilizations/japan.rs @@ -82,7 +82,7 @@ pub(crate) fn on_declare_card(game: &mut Game, a: CardAnnouncement) -> Result<() if !a.shogunate && !game.cache.get_civil_card(a.card).action_type.free { pay_action( game, - &EventPlayer::from_player(a.player, game, EventOrigin::CivilCard(a.card)), + &EventPlayer::new(a.player, EventOrigin::CivilCard(a.card)), ); } PlayingAction::ActionCard(a.card).execute_without_action_cost(game, a.player) diff --git a/server/src/content/civilizations/maya.rs b/server/src/content/civilizations/maya.rs index 992d7ee0..3edaf5fe 100644 --- a/server/src/content/civilizations/maya.rs +++ b/server/src/content/civilizations/maya.rs @@ -84,7 +84,7 @@ fn calendar() -> SpecialAdvanceInfo { "As a free action, look at the next event. You may pay 1 culture token to put it at the bottom of the deck, then use Calendar again.") .add_custom_action(CustomActionType::Calendar, |c| c.any_times().free_action().no_resources(), |b| b .add_persistent_event_listener(|e| &mut e.custom_action, 0, |game, p, _| { - let id = crate::card::draw_card_from_pile(game, "Events", |g| &mut g.incidents_left, + let id = crate::card::draw_card_from_pile(game, p, "Events", |g| &mut g.incidents_left, |g| g.cache.get_incidents().iter().map(|i| i.id).collect(), |p| p.action_cards.iter().filter_map(|id| id.checked_sub(crate::content::incidents::great_persons::GREAT_PERSON_OFFSET)).collect()).expect("event deck"); game.incidents_left.insert(0, id); @@ -152,6 +152,7 @@ fn influence_targets(game: &Game, p: &Player) -> Vec { &crate::playing_actions::PlayingActionType::InfluenceCultureAttempt, false, false, + game.get_any_city(target.position).player_index, Some(pos), ) .is_ok() diff --git a/server/src/content/civilizations/rome.rs b/server/src/content/civilizations/rome.rs index 80810477..6f53a6de 100644 --- a/server/src/content/civilizations/rome.rs +++ b/server/src/content/civilizations/rome.rs @@ -5,7 +5,7 @@ use crate::card::{HandCard, HandCardLocation, all_action_hand_cards, all_objecti use crate::city::{MoodState, set_city_mood}; use crate::civilization::Civilization; use crate::content::ability::AbilityBuilder; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::{CustomActionType, PlayingActionModifier}; use crate::content::persistent_events::{HandCardsRequest, PaymentRequest, PositionRequest}; use crate::game::Game; use crate::leader::{Leader, LeaderInfo, leader_position}; @@ -265,7 +265,7 @@ fn caesar() -> LeaderInfo { to increase happiness in the leader city.", ) .add_action_modifier( - CustomActionType::StatesmanIncreaseHappiness, + PlayingActionModifier::StatesmanIncreaseHappiness, |c| c.any_times().free_action().no_resources(), PlayingActionType::IncreaseHappiness, ) @@ -326,9 +326,9 @@ fn sulla() -> LeaderInfo { .add_transient_event_listener( |event| &mut event.on_influence_culture_attempt, 6, - |r, city, game, _| { + |r, city, game, p| { if let Ok(info) = r - && info.is_defender + && info.is_defender(p.index) && leader_position(game.player(city.player_index)) == city.position { *r = diff --git a/server/src/content/civilizations/vikings.rs b/server/src/content/civilizations/vikings.rs index ef6e34a1..e12bc6d9 100644 --- a/server/src/content/civilizations/vikings.rs +++ b/server/src/content/civilizations/vikings.rs @@ -8,15 +8,15 @@ use crate::consts::STACK_LIMIT; use crate::content::ability::{Ability, AbilityBuilder}; use crate::content::advances::economy::use_taxes; use crate::content::advances::trade_routes::TradeRoute; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::{CustomActionType, SpecialAction}; use crate::content::persistent_events::{PaymentRequest, PositionRequest, UnitsRequest}; use crate::events::EventOrigin; use crate::game::Game; use crate::leader::{Leader, LeaderInfo, leader_position}; use crate::leader_ability::{LeaderAbility, activate_leader_city, can_activate_leader_city}; -use crate::log::add_start_turn_action_if_needed; +use crate::log::{ActionLogEntry, add_start_turn_action_if_needed}; use crate::map::{Block, Terrain, block_for_position, capital_city_position}; -use crate::movement::{MoveUnits, move_action_log}; +use crate::movement::MoveUnits; use crate::player::{Data, Player}; use crate::position::Position; use crate::resource::ResourceType; @@ -223,7 +223,7 @@ pub(crate) fn lose_raid_resource() -> Ability { .then_some(vec![PaymentRequest::mandatory(c, "Pay 1 resource")]) }, |game, s, ()| { - add_start_turn_action_if_needed(game); + add_start_turn_action_if_needed(game, s.player_index); s.log(game, &format!("Lose {}", s.choice[0])); }, ) @@ -306,7 +306,7 @@ fn danegeld() -> LeaderAbility { .add_custom_action( CustomActionType::Danegeld, |c| { - c.once_per_turn_mutually_exclusive(CustomActionType::Taxes) + c.once_per_turn_mutually_exclusive(SpecialAction::Custom(CustomActionType::Taxes)) .action() .no_resources() }, @@ -384,7 +384,8 @@ fn new_colonies() -> LeaderAbility { .collect_vec(); let m = MoveUnits::new(units, to, None, ResourcePile::empty()); - s.log(game, &move_action_log(game, p, &m)); + s.player() + .add_log_entry(game, ActionLogEntry::move_units(p, &m)); move_with_possible_combat(game, s.player_index, &m); }, diff --git a/server/src/content/custom_actions.rs b/server/src/content/custom_actions.rs index 9a302094..9b802372 100644 --- a/server/src/content/custom_actions.rs +++ b/server/src/content/custom_actions.rs @@ -4,7 +4,7 @@ use crate::content::ability::Ability; use crate::content::persistent_events::{ PersistentEventType, TriggerPersistentEventParams, trigger_persistent_event_with_listener, }; -use crate::events::{EventOrigin, EventPlayer}; +use crate::events::EventOrigin; use crate::player::Player; use crate::playing_actions::PlayingActionType; use crate::position::Position; @@ -60,22 +60,22 @@ impl CustomActionActivation { } #[derive(Clone)] -pub struct CustomActionInfo { - pub action: CustomActionType, - pub execution: CustomActionExecution, +pub struct SpecialActionInfo { + pub action: SpecialAction, + pub execution: SpecialActionExecution, pub event_origin: EventOrigin, pub cost: ActionCostOncePerTurn, } -impl CustomActionInfo { +impl SpecialActionInfo { #[must_use] pub fn new( - action: CustomActionType, - execution: CustomActionExecution, + action: SpecialAction, + execution: SpecialActionExecution, event_origin: EventOrigin, cost: ActionCostOncePerTurn, - ) -> CustomActionInfo { - CustomActionInfo { + ) -> SpecialActionInfo { + SpecialActionInfo { action, execution, event_origin, @@ -90,12 +90,36 @@ impl CustomActionInfo { #[must_use] pub fn city_bound(&self) -> Option<&CustomActionCityChecker> { - if let CustomActionExecution::Action(a) = &self.execution { + if let SpecialActionExecution::Action(a) = &self.execution { a.city_checker.as_ref() } else { None } } + + /// + /// # Panics + /// Panics if not a modifier action + #[must_use] + pub fn custom_action_type(&self) -> CustomActionType { + if let SpecialAction::Custom(c) = self.action { + c + } else { + panic!("Not a custom action") + } + } + + /// + /// # Panics + /// Panics if not a modifier action + #[must_use] + pub fn modifier_action_type(&self) -> PlayingActionType { + if let SpecialAction::Modifier(m) = self.action { + m.playing_action_type() + } else { + panic!("Not a modifier action") + } + } } type CustomActionChecker = Arc bool + Sync + Send>; @@ -124,11 +148,54 @@ impl CustomActionActionExecution { } #[derive(Clone)] -pub enum CustomActionExecution { +pub enum SpecialActionExecution { Modifier(PlayingActionType), Action(CustomActionActionExecution), } +#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Copy, Hash, Debug)] +pub enum SpecialAction { + Modifier(PlayingActionModifier), + Custom(CustomActionType), +} + +impl SpecialAction { + #[must_use] + pub fn playing_action_type(&self) -> PlayingActionType { + match self { + SpecialAction::Modifier(m) => m.playing_action_type(), + SpecialAction::Custom(c) => c.playing_action_type(), + } + } +} + +#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Copy, Hash, Debug)] +pub enum PlayingActionModifier { + Tributes, + // Advances + ArtsInfluenceCultureAttempt, + FreeEconomyCollect, + VotingIncreaseHappiness, + + // Update patch Advances + CityPlanning, + Philosophy, + + // Civilizations, + // Rome + StatesmanIncreaseHappiness, + + // Greece + HellenisticInfluenceCultureAttempt, +} + +impl PlayingActionModifier { + #[must_use] + pub fn playing_action_type(&self) -> PlayingActionType { + PlayingActionType::Special(SpecialAction::Modifier(*self)) + } +} + #[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Copy, Hash, Debug)] pub enum CustomActionType { // Advances @@ -136,16 +203,11 @@ pub enum CustomActionType { ForcedLabor, CivilLiberties, Bartering, - ArtsInfluenceCultureAttempt, - VotingIncreaseHappiness, - FreeEconomyCollect, Sports, Taxes, Theaters, // Update patch Advances - CityPlanning, - Philosophy, WelfareState, ForcedMarch, MilitaryState, @@ -160,10 +222,8 @@ pub enum CustomActionType { // Rome Aqueduct, Princeps, - StatesmanIncreaseHappiness, // Greece - HellenisticInfluenceCultureAttempt, Idol, Master, @@ -198,7 +258,6 @@ pub enum CustomActionType { TribalAllies, SpreadOfFear, MassSacrifice, - Tributes, Hegemony, HegemonyFounder, Founder, @@ -209,21 +268,7 @@ pub enum CustomActionType { impl CustomActionType { #[must_use] pub fn playing_action_type(&self) -> PlayingActionType { - PlayingActionType::Custom(*self) - } -} - -pub(crate) fn log_start_custom_action(game: &mut Game, player_index: usize, action: &CustomAction) { - let p = game.player(player_index); - let player = EventPlayer::from_player( - player_index, - game, - action.action.playing_action_type().origin(p), - ); - if let Some(city) = action.city { - player.log(game, &format!("Start action in city {city}")); - } else { - player.log(game, "Start action"); + PlayingActionType::Special(SpecialAction::Custom(*self)) } } @@ -250,8 +295,11 @@ pub(crate) fn custom_action_execution( player: &Player, action_type: CustomActionType, ) -> Option { - if let CustomActionExecution::Action(e) = - player.custom_actions.get(&action_type)?.execution.clone() + if let SpecialActionExecution::Action(e) = player + .special_actions + .get(&SpecialAction::Custom(action_type))? + .execution + .clone() { Some(e) } else { @@ -259,23 +307,23 @@ pub(crate) fn custom_action_execution( } } -pub(crate) fn can_play_custom_action( +pub(crate) fn can_play_special_action( game: &Game, p: &Player, - c: CustomActionType, + c: SpecialAction, ) -> Result<(), String> { - if !p.custom_actions.contains_key(&c) { + if !p.special_actions.contains_key(&c) { return Err("Custom action not available".to_string()); } - let info = p.custom_action_info(c); + let info = p.special_action_info(&c); if let Some(key) = info.cost.once_per_turn && p.played_once_per_turn_actions.contains(&key) { return Err("Custom action already played this turn".to_string()); } - if let CustomActionExecution::Action(e) = &info.execution + if let SpecialActionExecution::Action(e) = &info.execution && !(e.checker)(game, p) { return Err("Custom action cannot be played".to_string()); @@ -296,8 +344,11 @@ pub(crate) fn is_base_or_modifier( base_type: &PlayingActionType, ) -> bool { match base_type { - PlayingActionType::Custom(c) => { - if let CustomActionExecution::Modifier(t) = &p.custom_action_info(*c).execution { + PlayingActionType::Special(SpecialAction::Modifier(c)) => { + if let SpecialActionExecution::Modifier(t) = &p + .special_action_info(&SpecialAction::Modifier(*c)) + .execution + { t == action_type } else { false @@ -312,7 +363,7 @@ pub(crate) fn custom_action_modifier_event_origin( action_type: &PlayingActionType, player: &Player, ) -> EventOrigin { - if let PlayingActionType::Custom(c) = action_type { + if let PlayingActionType::Special(SpecialAction::Modifier(c)) = action_type { c.playing_action_type().origin(player) } else { base_action_origin diff --git a/server/src/content/incidents/civil_war.rs b/server/src/content/incidents/civil_war.rs index 58c461f5..cd8143eb 100644 --- a/server/src/content/incidents/civil_war.rs +++ b/server/src/content/incidents/civil_war.rs @@ -275,7 +275,7 @@ fn envoy() -> Incident { |_p, _, _| true, 0, |game, s, _| { - s.other_player(s.choice, game) + s.other_player(s.choice) .gain_resources(game, ResourcePile::culture_tokens(1)); }, ) diff --git a/server/src/content/incidents/earthquake.rs b/server/src/content/incidents/earthquake.rs index 6d202568..1b628d3d 100644 --- a/server/src/content/incidents/earthquake.rs +++ b/server/src/content/incidents/earthquake.rs @@ -204,7 +204,7 @@ fn destroy_building(game: &mut Game, b: Building, position: Position, origin: &E let o = game.player_mut(owner); o.gain_event_victory_points(2.0, origin); o.destroyed_structures.add_building(b); - let player = EventPlayer::from_player(city_owner, game, origin.clone()); + let player = EventPlayer::new(city_owner, origin.clone()); lose_building(game, &player, b, position); game.log( owner, @@ -219,11 +219,7 @@ fn destroy_wonder_for_points( wonder: Wonder, origin: &EventOrigin, ) { - let p = &EventPlayer::from_player( - game.get_any_city(position).player_index, - game, - origin.clone(), - ); + let p = &EventPlayer::new(game.get_any_city(position).player_index, origin.clone()); destroy_wonder(game, p, wonder, position); let a = wonder.info(game).owned_victory_points; diff --git a/server/src/content/incidents/famine.rs b/server/src/content/incidents/famine.rs index 3ff2a982..4175fa2a 100644 --- a/server/src/content/incidents/famine.rs +++ b/server/src/content/incidents/famine.rs @@ -7,6 +7,7 @@ use crate::content::effects::PermanentEffect; use crate::content::persistent_events::UnitsRequest; use crate::game::Game; use crate::incident::{DecreaseMood, Incident, IncidentBaseEffect, MoodModifier}; +use crate::log::ActionLogBalance; use crate::player::Player; use crate::player_events::IncidentTarget; use crate::playing_actions::PlayingActionType; @@ -219,7 +220,7 @@ pub(crate) fn famine( // only avoid anger if full amount is paid i.player.payment = ResourcePile::food(lost); } - player.lose_resources(game, ResourcePile::food(lost)); + player.lose_resources(game, ResourcePile::food(lost), ActionLogBalance::Loss); player.log(game, &format!("Lost {lost} food",)); }) diff --git a/server/src/content/incidents/good_year.rs b/server/src/content/incidents/good_year.rs index c3c404db..7c941dc1 100644 --- a/server/src/content/incidents/good_year.rs +++ b/server/src/content/incidents/good_year.rs @@ -147,7 +147,7 @@ fn good_year(mut builder: IncidentBuilder, amount: u8, good_year_type: &GoodYear |p, _, _| p.resources.food < p.resource_limit.food, i as i32, move |game, s, _| { - s.other_player(s.choice, game) + s.other_player(s.choice) .gain_resources(game, ResourcePile::food(1)); }, ); diff --git a/server/src/content/incidents/great_builders.rs b/server/src/content/incidents/great_builders.rs index e4c4da37..3111205e 100644 --- a/server/src/content/incidents/great_builders.rs +++ b/server/src/content/incidents/great_builders.rs @@ -7,9 +7,8 @@ use crate::content::ability::Ability; use crate::content::advances::AdvanceGroup; use crate::content::effects::ConstructEffect; use crate::content::effects::PermanentEffect::Construct; -use crate::content::incidents::great_persons::{ - GREAT_PERSON_DESCRIPTION, great_person_action_card, great_person_description, -}; +use crate::content::incidents::great_persons::GreatPersonType; +use crate::content::incidents::great_persons::{great_person_card, tech_great_person_description}; use crate::content::persistent_events::HandCardsRequest; use crate::game::Game; use crate::player::Player; @@ -21,13 +20,14 @@ use crate::wonder::{Wonder, WonderCardInfo, cities_for_wonder, on_play_wonder_ca pub(crate) fn great_engineer() -> ActionCard { let groups = vec![AdvanceGroup::Construction]; - great_person_action_card( + great_person_card( 26, + GreatPersonType::ActionCard, "Great Engineer", &format!( "{} Then, you may construct a building in one of your cities. \ Pay its normal resource cost, without spending an additional action or activating the city.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -118,14 +118,13 @@ pub(crate) fn construct_only() -> Ability { } pub(crate) fn great_architect() -> ActionCard { - great_person_action_card::<_>( + great_person_card::<_>( 55, + GreatPersonType::Public, "Great Architect", - &format!( - "{GREAT_PERSON_DESCRIPTION} When constructing a wonder, you may ignore \ - the requirement advances (but not Engineering). \ - In addition, the cost of constructing the wonder is reduced by 3 culture tokens.", - ), + "When constructing a wonder, you may ignore \ + the requirement advances (but not Engineering). \ + In addition, the cost of constructing the wonder is reduced by 3 culture tokens.", |c| c.free_action().no_resources(), vec![], |game, player| !playable_wonders(game, player).is_empty(), diff --git a/server/src/content/incidents/great_diplomat.rs b/server/src/content/incidents/great_diplomat.rs index 08d77229..c8936edf 100644 --- a/server/src/content/incidents/great_diplomat.rs +++ b/server/src/content/incidents/great_diplomat.rs @@ -2,9 +2,7 @@ use crate::ability_initializer::AbilityInitializerSetup; use crate::action_card::ActionCard; use crate::content::ability::Ability; use crate::content::effects::PermanentEffect; -use crate::content::incidents::great_persons::{ - GREAT_PERSON_DESCRIPTION, great_person_action_card, -}; +use crate::content::incidents::great_persons::{GreatPersonType, great_person_card}; use crate::game::Game; use crate::incident::IncidentBuilder; use crate::player_events::IncidentTarget; @@ -14,15 +12,14 @@ use serde::{Deserialize, Serialize}; pub(crate) const DIPLOMAT_ID: u8 = 57; pub(crate) fn great_diplomat() -> ActionCard { - great_person_action_card::<_>( + great_person_card::<_>( DIPLOMAT_ID, + GreatPersonType::Public, "Great Diplomat", - &format!( - "{GREAT_PERSON_DESCRIPTION} Choose another player. \ - You cannot attack each other, unless you pay 2 culture tokens. \ - Discard this card if either player attacks the other. \ - You may discard the card as a regular action.", - ), + "Choose another player. \ + You cannot attack each other, unless you pay 2 culture tokens. \ + Discard this card if either player attacks the other. \ + You may discard the card as a regular action.", // action for ending diplomatic relations |c| c.action().no_resources(), vec![], diff --git a/server/src/content/incidents/great_explorer.rs b/server/src/content/incidents/great_explorer.rs index b2b0ff70..066f33f0 100644 --- a/server/src/content/incidents/great_explorer.rs +++ b/server/src/content/incidents/great_explorer.rs @@ -3,7 +3,7 @@ use crate::action_card::{ActionCard, ActionCardBuilder}; use crate::city::{found_city, is_valid_city_terrain}; use crate::content::advances::AdvanceGroup; use crate::content::incidents::great_persons::{ - great_person_action_card, great_person_description, + GreatPersonType, great_person_card, tech_great_person_description, }; use crate::content::persistent_events::{PaymentRequest, PositionRequest}; use crate::events::{EventOrigin, EventPlayer, check_event_origin}; @@ -18,14 +18,15 @@ use itertools::Itertools; pub(crate) fn great_explorer() -> ActionCard { let groups = vec![AdvanceGroup::Seafaring]; - let mut builder = great_person_action_card( + let mut builder = great_person_card( 18, + GreatPersonType::ActionCard, "Great Explorer", &format!( "{} Then, you may explore a region adjacent to a region \ where you have a city. If you do, you may found a city in the explored region,\ without using a Settler.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, diff --git a/server/src/content/incidents/great_persons.rs b/server/src/content/incidents/great_persons.rs index 3a282a37..e759cd24 100644 --- a/server/src/content/incidents/great_persons.rs +++ b/server/src/content/incidents/great_persons.rs @@ -33,6 +33,25 @@ pub(crate) const GREAT_PERSON_DESCRIPTION: &str = "You may take the Event Card t hand for 1 culture token. If you pass, any other player (in player order) may take it \ for 2 culture tokens: Action card: "; +pub(crate) const PUBLIC_GREAT_PERSON_DESCRIPTION: &str = "You make place the Event Card in front \ + of you 1 culture token. If you pass, any other player (in player order) may do so \ + for 2 culture tokens: "; + +#[derive(Clone, Copy, PartialEq, Eq)] +pub(crate) enum GreatPersonType { + ActionCard, + Public, +} + +impl GreatPersonType { + pub fn description(&self) -> &str { + match self { + GreatPersonType::ActionCard => GREAT_PERSON_DESCRIPTION, + GreatPersonType::Public => PUBLIC_GREAT_PERSON_DESCRIPTION, + } + } +} + pub(crate) fn great_person_incidents() -> Vec { vec![ incident(IncidentBaseEffect::ExhaustedLand, great_explorer(), |b| b), @@ -130,8 +149,9 @@ fn incident( on_gain(b).build() } -pub(crate) fn great_person_action_card( +pub(crate) fn great_person_card( incident_id: u8, + great_person_type: GreatPersonType, name: &str, description: &str, cost: impl Fn(ActionCostBuilder) -> ActionCostOncePerTurn + Send + Sync + 'static, @@ -144,10 +164,11 @@ where ActionCard::builder( incident_id + GREAT_PERSON_OFFSET, name, - description, + &format!("{}{}", great_person_type.description(), description), cost, move |game, player, _| can_play(game, player), ) + .public(great_person_type == GreatPersonType::Public) .add_advance_request( |e| &mut e.play_action_card, 10, @@ -169,12 +190,13 @@ where fn great_artist() -> ActionCard { let groups = vec![AdvanceGroup::Culture]; - great_person_action_card( + great_person_card( 19, + GreatPersonType::ActionCard, "Great Artist", &format!( "{} Then, you make one of your cities Happy.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -206,12 +228,13 @@ fn great_artist() -> ActionCard { fn great_prophet() -> ActionCard { let groups = vec![AdvanceGroup::Spirituality]; - great_person_action_card( + great_person_card( 20, + GreatPersonType::ActionCard, "Great Prophet", &format!( "{} Then, you build a Temple without activating the city.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -293,9 +316,9 @@ fn temple_cost(game: &Game, player: &Player) -> PaymentOptions { .cost } -pub(crate) fn great_person_description(free_advance_groups: &[AdvanceGroup]) -> String { +pub(crate) fn tech_great_person_description(free_advance_groups: &[AdvanceGroup]) -> String { format!( - "{GREAT_PERSON_DESCRIPTION} You may advance \ + "You may advance \ in any {} technology for free and without changing the Game Event counter.", format_list( &free_advance_groups @@ -310,10 +333,14 @@ pub(crate) fn great_person_description(free_advance_groups: &[AdvanceGroup]) -> fn great_philosopher() -> ActionCard { let groups = vec![AdvanceGroup::Education]; - great_person_action_card( + great_person_card( 21, + GreatPersonType::ActionCard, "Great Philosopher", - &format!("{} Then, gain 2 ideas.", great_person_description(&groups)), + &format!( + "{} Then, gain 2 ideas.", + tech_great_person_description(&groups) + ), |c| c.action().no_resources(), groups, |_game, _player| true, @@ -330,12 +357,13 @@ fn great_philosopher() -> ActionCard { fn great_scientist() -> ActionCard { let groups = vec![AdvanceGroup::Science]; - great_person_action_card( + great_person_card( 22, + GreatPersonType::ActionCard, "Great Scientist", &format!( "{} Then, gain 1 idea and 1 Action Card.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -357,12 +385,13 @@ fn elder_statesman() -> ActionCard { .into_iter() .map(|a| a.advance_group) .collect_vec(); - great_person_action_card( + great_person_card( 23, + GreatPersonType::ActionCard, "Elder Statesman", &format!( "{} Then, draw 2 Action Cards.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -382,12 +411,13 @@ fn elder_statesman() -> ActionCard { fn great_merchant() -> ActionCard { let groups = vec![AdvanceGroup::Economy]; economy::add_trade_routes( - great_person_action_card( + great_person_card( 25, + GreatPersonType::ActionCard, "Great Merchant", &format!( "{} Then, if you have the Trade Routes advance, gain the Trade Routes income.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -400,12 +430,13 @@ fn great_merchant() -> ActionCard { fn great_athlete() -> ActionCard { let groups = vec![AdvanceGroup::Culture]; - great_person_action_card( + great_person_card( 56, + GreatPersonType::ActionCard, "Great Athlete", &format!( "{} Then, you may convert any amount of culture tokens to mood tokens or vice versa.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, @@ -475,15 +506,14 @@ fn great_athlete() -> ActionCard { } fn great_seer() -> ActionCard { - let mut b = great_person_action_card::<_>( + let mut b = great_person_card::<_>( 58, + GreatPersonType::ActionCard, "Great Seer", - &format!( - "{GREAT_PERSON_DESCRIPTION} Draw 1 objective card per player. \ - Choose one for each player, including yourself. \ - The next time the player draws an objective card from the pile, \ - they draw the designated card instead.", - ), + "Draw 1 objective card per player. \ + Choose one for each player, including yourself. \ + The next time the player draws an objective card from the pile, \ + they draw the designated card instead.", |c| c.action().no_resources(), vec![], |_game, _player| true, diff --git a/server/src/content/incidents/great_warlord.rs b/server/src/content/incidents/great_warlord.rs index a6c1a9a5..c185072b 100644 --- a/server/src/content/incidents/great_warlord.rs +++ b/server/src/content/incidents/great_warlord.rs @@ -4,7 +4,7 @@ use crate::combat::CombatModifier; use crate::content::ability::Ability; use crate::content::advances::AdvanceGroup; use crate::content::incidents::great_persons::{ - great_person_action_card, great_person_description, + GreatPersonType, great_person_card, tech_great_person_description, }; use crate::game::GameState; use crate::game::GameState::Movement; @@ -13,13 +13,14 @@ use std::mem; pub(crate) fn great_warlord() -> ActionCard { let groups = vec![AdvanceGroup::Warfare]; - great_person_action_card( + great_person_card( 24, + GreatPersonType::ActionCard, "Great Warlord", &format!( "{} Then, gain a Move action. On the first battle you fight, \ gain 2 combat value in every round.", - great_person_description(&groups) + tech_great_person_description(&groups) ), |c| c.action().no_resources(), groups, diff --git a/server/src/content/incidents/pandemics.rs b/server/src/content/incidents/pandemics.rs index 76c6735a..9be3aa88 100644 --- a/server/src/content/incidents/pandemics.rs +++ b/server/src/content/incidents/pandemics.rs @@ -63,7 +63,11 @@ fn pandemics() -> Incident { |game, p, i| { let player = p.get(game); Some(HandCardsRequest::new( - hand_cards(player, &[HandCardType::Action, HandCardType::Objective]), + hand_cards( + player, + &[HandCardType::Action, HandCardType::Objective], + game, + ), PandemicsContributions::range(player, i, 1), "Select cards to lose (or select resources instead later)", )) diff --git a/server/src/content/objectives/resource_objectives.rs b/server/src/content/objectives/resource_objectives.rs index 6d00029a..526f4e89 100644 --- a/server/src/content/objectives/resource_objectives.rs +++ b/server/src/content/objectives/resource_objectives.rs @@ -1,3 +1,4 @@ +use crate::log::ActionLogBalance; use crate::objective_card::{Objective, ObjectiveProgress}; use crate::resource::ResourceType; use crate::resource_pile::ResourcePile; @@ -66,7 +67,7 @@ pub(crate) fn pay_resources( .collect() }) .status_phase_update(move |game, player| { - player.lose_resources(game, pay.clone()); + player.lose_resources(game, pay.clone(), ActionLogBalance::Pay); player.log(game, &format!("Pay {pay} for {objective}",)); }) .build() diff --git a/server/src/content/persistent_events.rs b/server/src/content/persistent_events.rs index 3525a9bf..34fe0cfb 100644 --- a/server/src/content/persistent_events.rs +++ b/server/src/content/persistent_events.rs @@ -10,10 +10,11 @@ use crate::combat_stats::CombatStats; use crate::construct::ConstructInfo; pub use crate::content::civilizations::aztecs::Captive; use crate::content::custom_actions::CustomActionActivation; -use crate::cultural_influence::InfluenceCultureInfo; +use crate::cultural_influence::InfluenceCultureBoostInfo; use crate::events::EventOrigin; use crate::explore::ExploreResolutionState; use crate::game::Game; +use crate::log::ActionLogItem; use crate::map::Rotation; use crate::objective_card::{SelectObjectivesInfo, present_instant_objective_cards}; use crate::payment::{PaymentOptions, ResourceReward}; @@ -104,7 +105,7 @@ impl PersistentEventPlayer { pub enum PersistentEventType { Collect(CollectInfo), ExploreResolution(ExploreResolutionState), - InfluenceCulture(InfluenceCultureInfo), + InfluenceCultureBoost(InfluenceCultureBoostInfo), UnitsKilled(KilledUnits), CombatStart(Combat), CombatRoundStart(CombatRoundStart), @@ -371,7 +372,7 @@ impl EventResponse { #[derive(Debug, Clone)] pub struct TriggerPersistentEventParams { - pub log: Option, + pub log: Option, pub next_player: fn(&mut V) -> (), pub origin_override: Option, } @@ -416,7 +417,7 @@ where .is_none_or(|s| s.event_type != current_event_type) { if let Some(log) = params.log { - game.add_info_log_item(&log); + game.add_log_item(log); } game.events.push(PersistentEventState::new( players[0], diff --git a/server/src/content/tactics_cards.rs b/server/src/content/tactics_cards.rs index 72a48036..2dbe45e8 100644 --- a/server/src/content/tactics_cards.rs +++ b/server/src/content/tactics_cards.rs @@ -30,12 +30,12 @@ pub(crate) fn peltasts(id: u8) -> TacticsCard { let roll = game.next_dice_roll().value; if roll >= 5 { s.roll_log - .push(format!("Peltasts rolled a {roll} and ignored a hit",)); + .push(format!("Peltasts rolls a {roll} and ignored a hit",)); s.hit_cancels += 1; return; } } - s.roll_log.push("Pelts rolled no 5 or 6".to_string()); + s.roll_log.push("Pelts rolls no 5 or 6".to_string()); }) .build() } @@ -66,11 +66,11 @@ pub(crate) fn encircled(id: u8) -> TacticsCard { if roll >= 5 { p.log( game, - "Rolled a 5 or 6 and added a hit that cannot be ignored", + "rolls a 5 or 6 and added a hit that cannot be ignored", ); e.update_hits(role, true, |h| h.extra_hits += 1); } else { - p.log(game, "Rolled no 5 or 6"); + p.log(game, "rolls no 5 or 6"); } } else { p.log(game, "Cannot do damage - opponent has fewer losses"); @@ -405,9 +405,9 @@ pub(crate) fn archers(id: u8) -> TacticsCard { let roll = game.next_dice_roll().value; if roll >= 5 { - p.log(game, &format!("Rolled a {roll} and scored a hit")); + p.log(game, &format!("rolls a {roll} and scored a hit")); } else { - p.log(game, &format!("Rolled a {roll} and did not score a hit")); + p.log(game, &format!("rolls a {roll} and did not score a hit")); return None; } diff --git a/server/src/content/wonders.rs b/server/src/content/wonders.rs index 6684f192..8df5fbce 100644 --- a/server/src/content/wonders.rs +++ b/server/src/content/wonders.rs @@ -182,7 +182,7 @@ pub(crate) fn use_great_mausoleum() -> Ability { game.cache.get_incident(*card).name )) } else { - i.incident_id = draw_and_discard_incident_card_from_pile(game, p.index); + i.incident_id = draw_and_discard_incident_card_from_pile(game, p); None } }, @@ -201,7 +201,7 @@ pub(crate) fn use_great_mausoleum() -> Ability { ); i.incident_id = card; } else { - i.incident_id = draw_and_discard_incident_card_from_pile(game, s.player_index); + i.incident_id = draw_and_discard_incident_card_from_pile(game, &s.player()); } }, ) @@ -383,7 +383,8 @@ fn colosseum() -> WonderInfo { p.log( game, &format!( - "Combat value is already at maximum, cannot increase combat value for {p}", + "Combat value is already at maximum, cannot increase combat value for {}", + p.name(game) ), ); return None; diff --git a/server/src/cultural_influence.rs b/server/src/cultural_influence.rs index c51d0855..b231b873 100644 --- a/server/src/cultural_influence.rs +++ b/server/src/cultural_influence.rs @@ -7,10 +7,11 @@ use crate::content::custom_actions::custom_action_modifier_event_origin; use crate::content::persistent_events::{PaymentRequest, PersistentEventType, SelectedStructure}; use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; +use crate::log::ActionLogEntry; use crate::payment::PaymentOptions; use crate::player::Player; use crate::player_events::ActionInfo; -use crate::playing_actions::{PlayingActionType, base_or_custom_available}; +use crate::playing_actions::{PlayingActionType, base_or_modified_available}; use crate::position::Position; use crate::resource_pile::ResourcePile; use crate::special_advance::SpecialAdvance; @@ -50,23 +51,21 @@ impl InfluenceCultureAttempt { } #[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] -pub struct InfluenceCultureInfo { +pub struct InfluenceCultureAttemptInfo { + pub target_player: usize, #[serde(default, skip_serializing_if = "Option::is_none")] pub target_unit: Option, - pub is_defender: bool, pub structure: Structure, pub prevent_boost: bool, pub range_boost_cost: PaymentOptions, - pub roll: u8, - pub roll_boost_cost: PaymentOptions, pub(crate) info: ActionInfo, pub roll_boost: u8, pub position: Position, pub starting_city_position: Position, - pub barbarian_takeover_check: bool, + pub barbarian_takeover: bool, } -impl InfluenceCultureInfo { +impl InfluenceCultureAttemptInfo { #[must_use] pub(crate) fn new( range_boost_cost: PaymentOptions, @@ -74,21 +73,20 @@ impl InfluenceCultureInfo { position: Position, structure: Structure, starting_city_position: Position, - barbarian_takeover_check: bool, - ) -> InfluenceCultureInfo { - InfluenceCultureInfo { + barbarian_takeover: bool, + target_player: usize, + ) -> InfluenceCultureAttemptInfo { + InfluenceCultureAttemptInfo { target_unit: None, prevent_boost: false, structure, range_boost_cost, info, roll_boost: 0, - roll: 0, - roll_boost_cost: PaymentOptions::free(), - is_defender: false, position, starting_city_position, - barbarian_takeover_check, + barbarian_takeover, + target_player, } } @@ -97,8 +95,31 @@ impl InfluenceCultureInfo { } #[must_use] - pub(crate) fn player(&self, player: usize, game: &Game) -> EventPlayer { - EventPlayer::from_player(player, game, self.info.origin.clone()) + pub(crate) fn player(&self, player: usize) -> EventPlayer { + EventPlayer::new(player, self.info.origin.clone()) + } + + #[must_use] + pub(crate) fn is_defender(&self, player: usize) -> bool { + self.target_player == player + } +} + +#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)] +pub struct InfluenceCultureBoostInfo { + pub attempt: InfluenceCultureAttemptInfo, + pub roll: u8, + pub roll_boost_cost: PaymentOptions, +} + +impl InfluenceCultureBoostInfo { + #[must_use] + pub(crate) fn new(attempt: InfluenceCultureAttemptInfo) -> InfluenceCultureBoostInfo { + InfluenceCultureBoostInfo { + attempt, + roll: 0, + roll_boost_cost: PaymentOptions::free(), + } } } @@ -127,20 +148,17 @@ pub(crate) fn execute_influence_culture_attempt( ) -> Result<(), String> { if i.target_unit.is_some() { let info = unit_influence_cost(game, player_index, i, false)?; - info.player(player_index, game).log( + info.player(player_index).log( game, &format!( "Attempt to influence an army unit at {} from {}", info.position, info.starting_city_position ), ); - on_cultural_influence(game, player_index, info); + on_cultural_influence(game, player_index, InfluenceCultureBoostInfo::new(info)); return Ok(()); } let s = &i.selected_structure; - let target_city_position = s.position; - let target_city = game.get_any_city(target_city_position); - let target_player_index = target_city.player_index; let info = influence_culture_boost_cost_from( game, player_index, @@ -148,70 +166,36 @@ pub(crate) fn execute_influence_culture_attempt( &i.action_type, false, false, + game.get_any_city(s.position).player_index, i.starting_position, )?; - let player = if target_player_index == player_index { - String::from("themselves") - } else { - game.player_name(target_player_index) - }; - let start = info.starting_city_position; - let city = if start == target_city_position { - String::new() - } else if game.try_get_any_city(start).is_some() { - format!(" with the city {start}") - } else { - format!(" from {start}") - }; - let range_boost_cost = &info.range_boost_cost; - // this cost can't be changed by the player - let cost = if range_boost_cost.is_free() { - String::new() - } else { - format!( - " and may pay {} to boost the range", - range_boost_cost.default - ) - }; - let city_piece = match s.structure { - Structure::CityCenter => "City Center", - Structure::Building(b) => b.name(), - Structure::Wonder(_) => panic!("Wonder is not allowed here"), - }; - - info.player(player_index, game).log( - game, - &format!( - "Tried to influence the {city_piece} in the city \ - at {target_city_position} by {player}{city}{cost}", - ), - ); - - on_cultural_influence(game, player_index, info); + info.player(player_index) + .add_log_entry(game, ActionLogEntry::InfluenceCultureAttempt(info.clone())); + on_cultural_influence(game, player_index, InfluenceCultureBoostInfo::new(info)); Ok(()) } pub(crate) fn on_cultural_influence( game: &mut Game, player_index: usize, - info: InfluenceCultureInfo, + info: InfluenceCultureBoostInfo, ) { let _ = game.trigger_persistent_event( &[player_index], - |e| &mut e.influence_culture, + |e| &mut e.influence_culture_boost, info, - PersistentEventType::InfluenceCulture, + PersistentEventType::InfluenceCultureBoost, ); } pub(crate) fn use_cultural_influence() -> Ability { Ability::builder("Influence Culture", "") .add_payment_request_listener( - |e| &mut e.influence_culture, + |e| &mut e.influence_culture_boost, 2, |game, p, info| { - let cost = &info.range_boost_cost; + let cost = &info.attempt.range_boost_cost; if cost.is_free() { info.roll_boost_cost = range_boost_cost(game, info, p.index); return None; @@ -227,7 +211,7 @@ pub(crate) fn use_cultural_influence() -> Ability { }, ) .add_payment_request_listener( - |e| &mut e.influence_culture, + |e| &mut e.influence_culture_boost, 0, roll_boost_payment, |game, s, info| roll_boost_paid(game, s.player_index, &s.choice[0], info), @@ -239,23 +223,24 @@ fn roll_boost_paid( game: &mut Game, player_index: usize, payment: &ResourcePile, - info: &mut InfluenceCultureInfo, + boost: &mut InfluenceCultureBoostInfo, ) { - let player = info.player(player_index, game); + let info = &mut boost.attempt; + let player = info.player(player_index); if payment.is_empty() { player.log(game, "Declined to pay to increase the dice roll"); attempt_failed(game, player_index, info.position); return; } - player.log(game, "Paying to increase the dice roll"); + player.log(game, "pays to increase the dice roll"); influence_culture(game, player_index, info); } fn roll_boost_payment( game: &mut Game, p: &EventPlayer, - info: &mut InfluenceCultureInfo, + info: &mut InfluenceCultureBoostInfo, ) -> Option> { let cost = &info.roll_boost_cost; if cost.is_free() { @@ -266,18 +251,18 @@ fn roll_boost_payment( if !p.get(game).can_afford(cost) { p.log( game, - &format!("Rolled a {roll} and does not have enough resources to increase the roll"), + &format!("rolls a {roll} and does not have enough resources to increase the roll"), ); - info.info.execute(game); - attempt_failed(game, p.index, info.position); + info.attempt.info.execute(game); + attempt_failed(game, p.index, info.attempt.position); return None; } - info.info.execute(game); + info.attempt.info.execute(game); p.log( game, &format!( - "Rolled a {roll} and now has the option to pay {cost} to \ + "rolls a {roll} and now has the option to pay {cost} to \ increase the dice roll and proceed with the cultural influence", ), ); @@ -290,12 +275,16 @@ fn roll_boost_payment( fn range_boost_cost( game: &mut Game, - info: &mut InfluenceCultureInfo, + info: &mut InfluenceCultureBoostInfo, player_index: usize, ) -> PaymentOptions { - info.roll = game.next_dice_roll().value + info.roll_boost; + info.roll = game.next_dice_roll().value + info.attempt.roll_boost; if info.roll < INFLUENCE_MIN_ROLL - && crate::content::civilizations::india::buddhism_available(game, player_index, info) + && crate::content::civilizations::india::buddhism_available( + game, + player_index, + &info.attempt, + ) { // Buddhism resolves the reroll choice before success, failure or a boost. return PaymentOptions::free(); @@ -305,26 +294,27 @@ fn range_boost_cost( pub(crate) fn resolve_influence_roll( game: &mut Game, - info: &mut InfluenceCultureInfo, + info: &mut InfluenceCultureBoostInfo, player_index: usize, ) -> PaymentOptions { - let p = info.player(player_index, game); + let a = &info.attempt; + let p = a.player(player_index); let roll = info.roll; let success = roll >= INFLUENCE_MIN_ROLL; if success { p.log( game, - &format!("Cultural influence succeeded (rolled {roll})"), + &format!("Cultural influence succeeded (rolls {roll})"), ); - info.info.execute(game); - influence_culture(game, player_index, info); + a.info.execute(game); + influence_culture(game, player_index, a); return PaymentOptions::free(); } - if (info.starting_city_position == info.position) || info.prevent_boost { - p.log(game, &format!("Cultural influence failed (rolled {roll})")); - info.info.execute(game); - attempt_failed(game, player_index, info.position); + if (a.starting_city_position == a.position) || a.prevent_boost { + p.log(game, &format!("Cultural influence failed (rolls {roll})")); + a.info.execute(game); + attempt_failed(game, player_index, a.position); return PaymentOptions::free(); } @@ -364,15 +354,17 @@ pub fn influence_culture_boost_cost( selected: &SelectedStructure, action_type: &PlayingActionType, add_action_cost: bool, - barbarian_takeover_check: bool, -) -> Result { + barbarian_takeover: bool, + target_player: usize, +) -> Result { influence_culture_boost_cost_from( game, player_index, selected, action_type, add_action_cost, - barbarian_takeover_check, + barbarian_takeover, + target_player, None, ) } @@ -383,9 +375,10 @@ pub fn influence_culture_boost_cost_from( selected: &SelectedStructure, action_type: &PlayingActionType, add_action_cost: bool, - barbarian_takeover_check: bool, + barbarian_takeover: bool, + target_player: usize, starting_position: Option, -) -> Result { +) -> Result { let target_city_position = selected.position; let structure = &selected.structure; let target_city = game.get_any_city(target_city_position); @@ -436,7 +429,7 @@ pub fn influence_culture_boost_cost_from( )?; let origin = influence_event_origin(action_type, attacker); - let mut info = Ok(InfluenceCultureInfo::new( + let mut info = Ok(InfluenceCultureAttemptInfo::new( PaymentOptions::resources( attacker, origin.clone(), @@ -446,7 +439,8 @@ pub fn influence_culture_boost_cost_from( target_city_position, structure.clone(), start, - barbarian_takeover_check, + barbarian_takeover, + target_player, )); attacker.trigger_event( |e| &e.on_influence_culture_attempt, @@ -455,9 +449,7 @@ pub fn influence_culture_boost_cost_from( game, ); - let mut i = info?; - i.is_defender = true; - info = Ok(i); + info = Ok(info?); game.player(target_player_index).trigger_event( |e| &e.on_influence_culture_attempt, @@ -479,7 +471,10 @@ pub fn available_influence_culture( game: &Game, player: usize, action_type: &PlayingActionType, -) -> Vec<(SelectedStructure, Result)> { +) -> Vec<( + SelectedStructure, + Result, +)> { game.players .iter() .flat_map(|p| { @@ -496,6 +491,7 @@ pub fn available_influence_culture( action_type, true, false, + city.player_index, ); (s, result) }) @@ -518,9 +514,9 @@ fn structures(city: &City) -> Vec { structures } -fn influence_culture(game: &mut Game, influencer_index: usize, info: &InfluenceCultureInfo) { +fn influence_culture(game: &mut Game, influencer_index: usize, info: &InfluenceCultureAttemptInfo) { let city_position = info.position; - let new = &info.player(influencer_index, game); + let new = &info.player(influencer_index); if let Some(target) = &info.target_unit { let unit = crate::player::remove_unit(target.player, target.unit, game); game.log( @@ -570,7 +566,7 @@ fn influence_culture(game: &mut Game, influencer_index: usize, info: &InfluenceC ); } Structure::CityCenter => { - let city = lose_city(game, &info.player(city_owner, game), city_position); + let city = lose_city(game, &info.player(city_owner), city_position); gain_city(game, new, city); } Structure::Building(b) => gain_building(game, new, b, city_position), @@ -580,13 +576,13 @@ fn influence_culture(game: &mut Game, influencer_index: usize, info: &InfluenceC influence_success(game, influencer_index, info); } -fn influence_success(game: &mut Game, influencer_index: usize, info: &InfluenceCultureInfo) { +fn influence_success(game: &mut Game, influencer_index: usize, info: &InfluenceCultureAttemptInfo) { if crate::content::civilizations::phoenicia::leader_at( game.player(influencer_index), crate::leader::Leader::Darius, info.starting_city_position, ) { - info.player(influencer_index, game) + info.player(influencer_index) .with_origin(EventOrigin::LeaderAbility("Cultural Unity".into())) .gain_resources(game, ResourcePile::mood_tokens(1)); } @@ -745,7 +741,7 @@ pub(crate) fn influence_start_positions(game: &Game, player: &Player) -> Vec<(Po #[must_use] pub fn available_influence_actions(game: &Game, player: usize) -> Vec { - base_or_custom_available(game, player, &PlayingActionType::InfluenceCultureAttempt) + base_or_modified_available(game, player, &PlayingActionType::InfluenceCultureAttempt) } pub(crate) fn influence_event_origin( @@ -764,7 +760,7 @@ pub(crate) fn unit_influence_cost( player: usize, attempt: &InfluenceCultureAttempt, add_action_cost: bool, -) -> Result { +) -> Result { let p = game.player(player); if !p.has_special_advance(SpecialAdvance::Zoroastrianism) { return Err("Requires Zoroastrianism".into()); @@ -805,13 +801,14 @@ pub(crate) fn unit_influence_cost( attempt.starting_position, )?; let origin = influence_event_origin(&attempt.action_type, p); - let mut info = InfluenceCultureInfo::new( + let mut info = InfluenceCultureAttemptInfo::new( PaymentOptions::resources(p, origin.clone(), ResourcePile::culture_tokens(boost)), ActionInfo::new(p, origin), unit.position, Structure::CityCenter, start, false, + owner.index, ); info.target_unit = Some(target.clone()); let mut result = Ok(info); diff --git a/server/src/events.rs b/server/src/events.rs index 5e656fcc..d4333b51 100644 --- a/server/src/events.rs +++ b/server/src/events.rs @@ -1,5 +1,6 @@ use crate::advance::Advance; use crate::game::Game; +use crate::log::{ActionLogBalance, ActionLogEntry, add_action_log_item}; use crate::payment::{PaymentOptionsBuilder, RewardBuilder}; use crate::player::{CostTrigger, Player}; use crate::resource::{gain_resources, lose_resources}; @@ -7,7 +8,6 @@ use crate::resource_pile::ResourcePile; use crate::special_advance::SpecialAdvance; use crate::wonder::Wonder; use serde::{Deserialize, Serialize}; -use std::fmt::Display; use std::sync::Arc; #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, Hash)] @@ -66,25 +66,14 @@ pub fn check_event_origin() -> EventOrigin { #[derive(Clone, PartialEq, Eq, Debug)] pub(crate) struct EventPlayer { pub index: usize, - pub name: String, pub origin: EventOrigin, } impl EventPlayer { #[must_use] - pub fn new(player_index: usize, player_name: String, origin: EventOrigin) -> Self { + pub fn new(player_index: usize, origin: EventOrigin) -> Self { Self { index: player_index, - name: player_name, - origin, - } - } - - #[must_use] - pub fn from_player(player: usize, game: &Game, origin: EventOrigin) -> Self { - Self { - index: player, - name: game.player_name(player), origin, } } @@ -103,15 +92,26 @@ impl EventPlayer { gain_resources(game, self.index, resources, self.origin.clone()); } - pub fn lose_resources(&self, game: &mut Game, resources: ResourcePile) { - lose_resources(game, self.index, resources, self.origin.clone(), vec![]); + pub fn lose_resources( + &self, + game: &mut Game, + resources: ResourcePile, + balance: ActionLogBalance, + ) { + lose_resources( + game, + self.index, + resources, + self.origin.clone(), + vec![], + balance, + ); } #[must_use] pub fn with_origin(&self, origin: EventOrigin) -> Self { Self { index: self.index, - name: self.name.clone(), origin, } } @@ -129,14 +129,18 @@ impl EventPlayer { pub fn log(&self, game: &mut Game, message: &str) { game.log(self.index, &self.origin, message); } -} -impl Display for EventPlayer { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.name) + #[must_use] + pub fn name(&self, game: &Game) -> String { + self.get(game).get_name() + } + + pub fn add_log_entry(&self, game: &mut Game, entry: ActionLogEntry) { + add_action_log_item(game, self.index, entry, self.origin.clone(), vec![]); } } +#[derive(Clone)] struct Listener { #[allow(clippy::type_complexity)] callback: Arc, @@ -157,17 +161,18 @@ impl Listener { } } -pub struct EventMut { - name: String, // for debugging +#[derive(Clone)] +pub struct Event { + pub(crate) name: String, // for debugging listeners: Vec>, } -impl EventMut +impl Event where T: Clone + PartialEq, W: Clone + PartialEq, { - fn new(name: &str) -> Self { + pub(crate) fn new(name: &str) -> Self { Self { name: name.to_string(), listeners: Vec::new(), @@ -244,67 +249,26 @@ where } } -pub struct Event { - pub name: String, - pub inner: Option>, - pub deleted: Option, -} - -impl Event { - #[must_use] - pub fn new(name: &str) -> Self - where - T: Clone + PartialEq, - W: Clone + PartialEq, - { - Self { - name: name.to_string(), - inner: Some(EventMut::new(name)), - deleted: None, - } - } - - pub(crate) fn get(&self) -> &EventMut { - self.inner.as_ref().expect("Event should be initialized") - } - - pub(crate) fn take(&mut self) -> EventMut { - self.inner.take().expect("Event should be initialized") - } - - pub(crate) fn set(&mut self, mut event: EventMut) - where - T: Clone + PartialEq, - W: Clone + PartialEq, - { - if let Some(o) = &self.deleted.take() { - event.remove_listener_mut_by_key(o); - } else { - self.inner = Some(event); - } - } -} - #[cfg(test)] mod tests { - use super::{EventMut, EventOrigin, EventPlayer}; + use super::{Event, EventOrigin, EventPlayer}; use crate::advance::Advance; use crate::player::CostTrigger; #[test] fn mutable_event() { - let mut event = EventMut::new("test"); + let mut event = Event::new("test"); let add_constant = Advance::Arts; event.add_listener_mut( |item, constant, _, (), _| *item += constant, 0, - EventPlayer::new(0, String::new(), EventOrigin::Advance(add_constant)), + EventPlayer::new(0, EventOrigin::Advance(add_constant)), ); let multiply_value = Advance::Sanitation; event.add_listener_mut( |item, _, multiplier, (), _| *item *= multiplier, -1, - EventPlayer::new(0, String::new(), EventOrigin::Advance(multiply_value)), + EventPlayer::new(0, EventOrigin::Advance(multiply_value)), ); let no_change = Advance::Bartering; event.add_listener_mut( @@ -313,7 +277,7 @@ mod tests { *item -= 1; }, 1, - EventPlayer::new(0, String::new(), EventOrigin::Advance(no_change)), + EventPlayer::new(0, EventOrigin::Advance(no_change)), ); let mut item = 0; diff --git a/server/src/explore.rs b/server/src/explore.rs index 7e6420c9..635cd376 100644 --- a/server/src/explore.rs +++ b/server/src/explore.rs @@ -6,10 +6,10 @@ use crate::content::persistent_events::{ }; use crate::events::EventPlayer; use crate::game::Game; +use crate::log::ActionLogEntry; use crate::map::{Block, BlockPosition, Map, Rotation, UnexploredBlock}; use crate::movement::{move_units, stop_current_move}; use crate::position::Position; -use itertools::Itertools; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] @@ -259,14 +259,7 @@ fn add_block_tiles_with_log( .retain(|b| b.position.top_tile != pos.top_tile); let tiles = block.tiles(pos, rotation); - - let s = tiles - .into_iter() - .map(|(position, tile)| format!("{position}={tile}")) - .sorted() - .join(", "); - - p.log(game, &format!("Explored tiles {s}")); + p.add_log_entry(game, ActionLogEntry::explore_tiles(tiles)); game.map.add_block_tiles(pos, block, rotation); } diff --git a/server/src/game.rs b/server/src/game.rs index ce783a82..b9da80f9 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -2,7 +2,7 @@ use crate::action::lose_action; use crate::cache::Cache; use crate::combat_roll::{COMBAT_DIE_SIDES, CombatDieRoll}; use crate::consts::ACTIONS; -use crate::content::custom_actions::{CustomActionExecution, CustomActionInfo}; +use crate::content::custom_actions::{SpecialActionExecution, SpecialActionInfo}; use crate::content::effects::PermanentEffect; use crate::content::persistent_events::{ PersistentEventHandler, PersistentEventState, PersistentEventType, @@ -11,8 +11,9 @@ use crate::content::persistent_events::{ use crate::events::{Event, EventOrigin, EventPlayer}; use crate::game_data::GameData; use crate::log::{ - ActionLogAge, TurnType, add_round_log, add_start_turn_action_if_needed, add_turn_log, - current_action_log_mut, current_turn_log, current_turn_log_mut, + ActionLogAge, ActionLogEntry, ActionLogItem, TurnType, add_round_log, + add_start_turn_action_if_needed, add_turn_log, current_action_log_mut, current_turn_log, + current_turn_log_mut, }; use crate::movement::MoveState; use crate::player::{CostTrigger, end_turn}; @@ -301,7 +302,7 @@ impl Game { ) } - pub(crate) fn trigger_transient_event_with_game_value( + pub(crate) fn trigger_transient_event_with_game_value( &mut self, player_index: usize, event: fn(&mut TransientEvents) -> &mut Event, @@ -377,21 +378,17 @@ impl Game { || !self.player(defender).is_human() } - pub fn add_info_log_item(&mut self, info: &str) { - current_action_log_mut(self).log.push(info.to_string()); + pub fn add_log_item(&mut self, item: ActionLogItem) { + current_action_log_mut(self).items.push(item); } pub fn log(&mut self, player: usize, origin: &EventOrigin, message: &str) { - let prefix = format!("{}: {}: ", self.player_name(player), origin.name(self)); - let log = &mut current_action_log_mut(self).log; - for c in log.iter_mut() { - if c.starts_with(&prefix) { - use std::fmt::Write as _; - let _ = write!(c, ", {message}"); - return; - } - } - log.push(format!("{prefix}{message}")); + self.add_log_item(ActionLogItem::new( + player, + ActionLogEntry::message(message.to_string()), + origin.clone(), + vec![], + )); } pub(crate) fn start_turn(&mut self) { @@ -405,14 +402,10 @@ impl Game { .position(|e| matches!(e, PermanentEffect::RevolutionLoseAction(p) if *p == player)) .map(|i| self.permanent_effects.remove(i)); if lost_action.is_some() { - add_start_turn_action_if_needed(self); + add_start_turn_action_if_needed(self, player); lose_action( self, - &EventPlayer::from_player( - player, - self, - EventOrigin::Ability("Revolution".to_string()), - ), + &EventPlayer::new(player, EventOrigin::Ability("Revolution".to_string())), ); } self.successful_cultural_influence = false; @@ -552,10 +545,13 @@ impl Game { .expect("there should be at least one player in the game") .0; let winner_name = self.player_name(winner_player_index); - let m = format!("The game has ended. {winner_name} has won"); - self.add_message(&m); - add_start_turn_action_if_needed(self); - self.add_info_log_item(&m); + self.add_message(&format!("The game has ended. {winner_name} has won")); + add_start_turn_action_if_needed(self, 0); + EventPlayer::new( + winner_player_index, + EventOrigin::Ability("having the most points".to_string()), + ) + .log(self, "wins the game"); self.state = GameState::Finished; } @@ -597,13 +593,13 @@ impl Game { } #[must_use] - pub fn available_custom_actions(&self, player_index: usize) -> Vec { + pub fn available_custom_actions(&self, player_index: usize) -> Vec { self.player(player_index) - .custom_actions + .special_actions .values() .filter(|&c| { - if matches!(c.execution, CustomActionExecution::Modifier(_)) { - // returned as part of "base_or_custom_available" + if matches!(c.execution, SpecialActionExecution::Modifier(_)) { + // returned as part of "base_or_modified_available" return false; } diff --git a/server/src/game_api.rs b/server/src/game_api.rs index bc946cc4..13fe3caa 100644 --- a/server/src/game_api.rs +++ b/server/src/game_api.rs @@ -18,6 +18,7 @@ use crate::{ utils::Rng, }; use std::cmp::Ordering::*; +use std::mem; // Game API methods, see https://docs.boardgamers.space/guide/engine-api.html#required-methods #[must_use] @@ -135,11 +136,13 @@ pub fn strip_secret(mut game: Game, player_index: Option) -> Game { game.objective_cards_left.shuffle(&mut game.rng); game.seed = String::new(); game.rng = Rng::default(); - for (i, player) in game.players.iter_mut().enumerate() { + let mut players = mem::take(&mut game.players); + for (i, player) in players.iter_mut().enumerate() { if player_index != Some(i) { - player.strip_secret(); + player.strip_secret(&game); } } + game.players = players; game.map.strip_secret(); strip_events(&mut game, player_index); strip_log(&mut game, player_index); diff --git a/server/src/game_data.rs b/server/src/game_data.rs index 148cd1d6..3c9208e6 100644 --- a/server/src/game_data.rs +++ b/server/src/game_data.rs @@ -5,7 +5,7 @@ use crate::city::{City, CityData}; use crate::city_pieces::{DestroyedStructures, DestroyedStructuresData}; use crate::content::ability; use crate::content::ability::Ability; -use crate::content::custom_actions::CustomActionType; +use crate::content::custom_actions::SpecialAction; use crate::content::effects::PermanentEffect; use crate::content::persistent_events::PersistentEventState; use crate::game::{Game, GameContext, GameOptions, GameState, UIElement}; @@ -309,7 +309,7 @@ pub struct PlayerData { next_unit_id: u32, #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] - played_once_per_turn_actions: Vec, + played_once_per_turn_actions: Vec, #[serde(default)] #[serde(skip_serializing_if = "HashMap::is_empty")] #[serde(serialize_with = "sorted_map")] @@ -411,7 +411,7 @@ fn player_from_data(data: PlayerData, game: &Game) -> Player { captives: data.captives, held_units: data.held_units, special_victory_points: data.special_victory_points, - custom_actions: HashMap::new(), + special_actions: HashMap::new(), wonder_cards: data.wonder_cards, action_cards: data.action_cards, objective_cards: data.objective_cards, @@ -421,7 +421,6 @@ fn player_from_data(data: PlayerData, game: &Game) -> Player { secrets: data.secrets, custom_data: data.custom_data, objective_opportunities: data.objective_opportunities, - gained_objective: None, great_mausoleum_action_cards: 0, } } diff --git a/server/src/game_setup.rs b/server/src/game_setup.rs index d7f9d18b..29bd1265 100644 --- a/server/src/game_setup.rs +++ b/server/src/game_setup.rs @@ -11,7 +11,10 @@ use crate::content::civilizations::{BARBARIANS, CHOOSE_CIV, PIRATES}; use crate::events::{EventOrigin, EventPlayer}; use crate::game::{CivSetupOption, Game, GameContext, GameOptions, GameState}; use crate::leader::Leader; -use crate::log::{ActionLogAge, ActionLogRound, ActionLogTurn, TurnType, add_log_action}; +use crate::log::{ + ActionLogAge, ActionLogRound, SetupTurnType, TurnType, add_start_turn_action_if_needed, + add_turn_log, +}; use crate::map::{Map, MapSetup, get_map_setup}; use crate::objective_card::gain_objective_card_from_pile; use crate::player::{Player, gain_unit}; @@ -228,7 +231,19 @@ pub fn setup_game_with_cache(setup: &GameSetup, cache: Cache) -> Game { initialize_setup_log(&mut game); if game.civilization_draft.is_none() { execute_setup_round(setup.player_amount, &mut game, map_setup.as_ref()); + if setup.options.civilization == CivSetupOption::Random { + game.next_age(); + } } else { + // Draft choices precede the per-player setup grants, but undo locking + // still needs a turn to anchor its cursor before any choice is made. + add_turn_log( + &mut game, + TurnType::Setup(SetupTurnType { + player: starting_player, + civilization: None, + }), + ); game.information_revealed(); } game @@ -236,23 +251,27 @@ pub fn setup_game_with_cache(setup: &GameSetup, cache: Cache) -> Game { fn initialize_setup_log(game: &mut Game) { let mut age = ActionLogAge::new(0); - let mut round = ActionLogRound::new(0); - let turn = ActionLogTurn::new(TurnType::Setup); - round.turns.push(turn); - age.rounds.push(round); + age.rounds.push(ActionLogRound::new(0)); game.log.push(age); - add_log_action(game, Action::Setup); } fn execute_setup_round(player_amount: usize, game: &mut Game, map_setup: Option<&MapSetup>) { + let choose_civ = game.options.civilization == CivSetupOption::ChooseCivilization; for player_index in 0..player_amount { - let origin = setup_event_origin(); - let player = &EventPlayer::from_player(player_index, game, origin.clone()); - player.log( + add_turn_log( game, - &format!("Play as {}", player.get(game).civilization.name), + TurnType::Setup(SetupTurnType { + player: player_index, + civilization: if choose_civ { + None + } else { + Some(game.player(player_index).civilization.name.clone()) + }, + }), ); - + add_start_turn_action_if_needed(game, player_index); + let origin = setup_event_origin(); + let player = &EventPlayer::new(player_index, origin.clone()); player.gain_resources(game, ResourcePile::food(2)); do_advance(game, Advance::Farming, player, false); do_advance(game, Advance::Mining, player, false); @@ -268,7 +287,6 @@ fn execute_setup_round(player_amount: usize, game: &mut Game, map_setup: Option< gain_unit(game, player, position, UnitType::Settler); } } - game.next_age(); } pub(crate) fn place_home_tiles(game: &mut Game, player: &EventPlayer) { @@ -285,7 +303,8 @@ pub(crate) fn place_home_tiles(game: &mut Game, player: &EventPlayer) { .add_block_tiles(&h.position, &home, h.position.rotation); } -fn setup_event_origin() -> EventOrigin { +#[must_use] +pub fn setup_event_origin() -> EventOrigin { EventOrigin::Ability("Setup".to_string()) } @@ -347,7 +366,7 @@ pub(crate) fn execute_choose_civ( player_index: usize, action: &Action, ) -> Result<(), String> { - let player = EventPlayer::from_player(player_index, game, setup_event_origin()); + let player = EventPlayer::new(player_index, setup_event_origin()); if let Action::ChooseCivilization(civ) = action { let civilization = game .cache @@ -370,11 +389,8 @@ pub(crate) fn execute_choose_civ( game.increment_player_index(); if game.players.iter().all(|p| !p.civilization.is_choose_civ()) { game.state = GameState::Playing; + game.next_age(); } - player.log( - game, - &format!("Play as {}", game.player(player_index).civilization.name), - ); Ok(()) } @@ -439,6 +455,7 @@ fn finish_civilization_draft(game: &mut Game) { .unwrap_or(0); } execute_setup_round(player_amount, game, map_setup.as_ref()); + game.next_age(); game.information_revealed(); } diff --git a/server/src/happiness.rs b/server/src/happiness.rs index 4f5bb1aa..280a45d5 100644 --- a/server/src/happiness.rs +++ b/server/src/happiness.rs @@ -1,12 +1,14 @@ use crate::city::{MoodState, increase_mood_state}; -use crate::content::custom_actions::{CustomActionType, custom_action_modifier_event_origin}; +use crate::content::custom_actions::{ + PlayingActionModifier, SpecialAction, custom_action_modifier_event_origin, +}; use crate::events::EventOrigin; use crate::game::Game; use crate::leader::{Leader, leader_position}; use crate::payment::PaymentOptions; use crate::player::{CostTrigger, Player}; use crate::player_events::CostInfo; -use crate::playing_actions::{PlayingActionType, base_or_custom_available}; +use crate::playing_actions::{PlayingActionType, base_or_modified_available}; use crate::position::Position; use crate::resource::ResourceType; use crate::resource_pile::ResourcePile; @@ -39,14 +41,14 @@ impl IncreaseHappiness { #[must_use] pub fn available_happiness_actions(game: &Game, player: usize) -> Vec { - base_or_custom_available(game, player, &PlayingActionType::IncreaseHappiness) + base_or_modified_available(game, player, &PlayingActionType::IncreaseHappiness) } #[must_use] pub fn happiness_city_restriction(player: &Player, action: &PlayingActionType) -> Option { match action { - PlayingActionType::Custom(custom) - if custom == &CustomActionType::StatesmanIncreaseHappiness => + PlayingActionType::Special(SpecialAction::Modifier(m)) + if m == &PlayingActionModifier::StatesmanIncreaseHappiness => { Some(leader_position(player)) } @@ -169,11 +171,7 @@ pub(crate) fn happiness_cost_for_cities( if lawgiver { cost.cost.default += ResourcePile::culture_tokens(1); cost.info.add_log( - &crate::events::EventPlayer::from_player( - player, - game, - EventOrigin::LeaderAbility("Lawgiver".into()), - ), + &crate::events::EventPlayer::new(player, EventOrigin::LeaderAbility("Lawgiver".into())), "Make Hammurabi's city happy for 1 culture token", ); } diff --git a/server/src/incident.rs b/server/src/incident.rs index 23549d9b..02a839a3 100644 --- a/server/src/incident.rs +++ b/server/src/incident.rs @@ -16,6 +16,7 @@ use crate::content::persistent_events::{ }; use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; +use crate::log::{ActionLogEntry, ActionLogItem}; use crate::map::Terrain; use crate::payment::{PaymentConversion, PaymentConversionType}; use crate::pirates::pirates_spawn_and_raid; @@ -626,7 +627,7 @@ impl AbilityInitializerSetup for IncidentBuilder { } } -pub(crate) fn trigger_incident(game: &mut Game, player_index: usize) { +pub(crate) fn trigger_incident(game: &mut Game, player_index: usize, origin: EventOrigin) { if game .player(player_index) .wonders_owned @@ -636,11 +637,19 @@ pub(crate) fn trigger_incident(game: &mut Game, player_index: usize) { .special_advances .contains(crate::special_advance::SpecialAdvance::StarCatalogues) { - on_choose_incident(game, player_index, IncidentInfo::new(0, player_index)); + on_choose_incident( + game, + player_index, + IncidentInfo::new(0, player_index, origin), + ); } else { let info = IncidentInfo::new( - draw_and_discard_incident_card_from_pile(game, player_index), + draw_and_discard_incident_card_from_pile( + game, + &EventPlayer::new(player_index, origin.clone()), + ), player_index, + origin, ); on_trigger_incident(game, info); } @@ -654,7 +663,10 @@ pub(crate) fn on_choose_incident(game: &mut Game, player_index: usize, info: Inc PersistentEventType::ChooseIncident, ) { if info.incident_id == 0 { - info.incident_id = draw_and_discard_incident_card_from_pile(game, player_index); + info.incident_id = draw_and_discard_incident_card_from_pile( + game, + &EventPlayer::new(player_index, info.cause.clone()), + ); } on_trigger_incident(game, info); } @@ -662,9 +674,14 @@ pub(crate) fn on_choose_incident(game: &mut Game, player_index: usize, info: Inc pub(crate) fn on_trigger_incident(game: &mut Game, mut info: IncidentInfo) { loop { - let log: Option = play_base_effect(&info).then_some(format!( - "A new game event has been triggered: {}", - game.cache.get_incident(info.incident_id).name + let log: Option = play_base_effect(&info).then_some(ActionLogItem::new( + info.active_player, + ActionLogEntry::message(format!( + "triggers the event {}", + game.cache.get_incident(info.incident_id).name + )), + info.cause.clone(), + vec![], )); info = match trigger_persistent_event_with_listener( game, @@ -689,8 +706,11 @@ pub(crate) fn on_trigger_incident(game: &mut Game, mut info: IncidentInfo) { .any(|e| matches!(e.event_type, PersistentEventType::Incident(_))) { if info.replaced_by_sacrifice { - let id = draw_and_discard_incident_card_from_pile(game, info.active_player); - info = IncidentInfo::new(id, info.active_player); + let id = draw_and_discard_incident_card_from_pile( + game, + &EventPlayer::new(info.active_player, info.cause.clone()), + ); + info = IncidentInfo::new(id, info.active_player, info.cause.clone()); continue; } if passed_to_player(game, &mut info) { @@ -701,9 +721,13 @@ pub(crate) fn on_trigger_incident(game: &mut Game, mut info: IncidentInfo) { } } -pub(crate) fn draw_and_discard_incident_card_from_pile(game: &mut Game, player: usize) -> u8 { +pub(crate) fn draw_and_discard_incident_card_from_pile( + game: &mut Game, + player: &EventPlayer, +) -> u8 { let id = draw_card_from_pile( game, + player, "Events", |g| &mut g.incidents_left, |g| g.cache.get_incidents().iter().map(|i| i.id).collect_vec(), @@ -722,7 +746,7 @@ pub(crate) fn draw_and_discard_incident_card_from_pile(game: &mut Game, player: ) .expect("incident should exist"); - discard_card(|g| &mut g.incidents_discarded, id, player, game); + discard_card(|g| &mut g.incidents_discarded, id, player.index, game); id } diff --git a/server/src/lib.rs b/server/src/lib.rs index d15144f8..fd16c45d 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -35,7 +35,7 @@ pub mod civilization; pub mod collect; pub mod combat; mod combat_listeners; -mod combat_roll; +pub mod combat_roll; pub mod combat_stats; pub mod construct; pub mod consts; diff --git a/server/src/log.rs b/server/src/log.rs index 6cf35de3..77e3502c 100644 --- a/server/src/log.rs +++ b/server/src/log.rs @@ -1,14 +1,21 @@ use crate::advance::Advance; use crate::card::{HandCard, HandCardLocation}; use crate::city::MoodState; +use crate::combat_roll::UnitCombatRoll; use crate::combat_stats::CombatStats; +use crate::cultural_influence::InfluenceCultureAttemptInfo; use crate::events::EventOrigin; +use crate::map::Terrain; +use crate::movement::{MoveUnits, move_event_origin}; +use crate::player::Player; use crate::position::Position; use crate::resource_pile::ResourcePile; +use crate::status_phase::StatusPhaseStateType; use crate::structure::Structure; use crate::unit::Units; use crate::{action::Action, game::Game}; use json_patch::PatchOperation; +use num::Zero; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, PartialEq)] @@ -43,11 +50,19 @@ impl ActionLogRound { } } +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct SetupTurnType { + pub player: usize, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub civilization: Option, +} + #[derive(Serialize, Deserialize, Clone, PartialEq)] pub enum TurnType { Player(usize), - Setup, - StatusPhase, + Setup(SetupTurnType), + StatusPhase(StatusPhaseStateType), } #[derive(Serialize, Deserialize, Clone, PartialEq)] @@ -78,9 +93,13 @@ impl ActionLogTurn { } } -#[derive(Serialize, Deserialize, Clone, PartialEq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct ActionLogAction { pub action: Action, + pub player: usize, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub origin: Option, #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] pub undo: Vec, @@ -91,52 +110,106 @@ pub struct ActionLogAction { #[serde(skip_serializing_if = "Vec::is_empty")] pub items: Vec, #[serde(default)] - #[serde(skip_serializing_if = "Vec::is_empty")] - pub log: Vec, + #[serde(skip_serializing_if = "usize::is_zero")] + pub active_events: usize, } impl ActionLogAction { #[must_use] - pub fn new(action: Action) -> Self { + pub fn new( + action: Action, + player: usize, + origin: Option, + active_events: usize, + ) -> Self { Self { action, + player, + origin, undo: Vec::new(), combat_stats: None, items: Vec::new(), - log: Vec::new(), + active_events, } } } -#[derive(Serialize, Deserialize, Clone, PartialEq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub enum ActionLogIncidentToken { + Take(u8), + NoChange, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub enum ActionLogBalance { Gain, Loss, + Pay, // Like loss, but for payment } -#[derive(Serialize, Deserialize, Clone, PartialEq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct ActionLogEntryStructure { + pub structure: Structure, + pub balance: ActionLogBalance, + pub position: Position, + pub port_position: Option, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct ActionLogEntryMove { + pub units: Units, + pub start: Position, + pub destination: Position, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub embark_carrier_id: Option, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct ActionLogEntryCombatRound { + pub attackers: Units, + pub defending_player: usize, + pub defenders: Units, + pub round: u32, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct ActionLogEntryCombatRoll { + pub rolls: Vec, + pub combat_value: u8, + pub hits: u8, + #[serde(default)] + #[serde(skip_serializing_if = "Vec::is_empty")] + pub combat_modifiers: Vec, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] +pub struct ActionLogEntryAdvance { + pub advance: Advance, + pub incident_token: ActionLogIncidentToken, + balance: ActionLogBalance, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub enum ActionLogEntry { + Text(String), Action { balance: ActionLogBalance, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + amount: Option, }, Resources { resources: ResourcePile, balance: ActionLogBalance, }, - Advance { - advance: Advance, - take_incident_token: bool, - balance: ActionLogBalance, - }, + Advance(ActionLogEntryAdvance), Units { units: Units, balance: ActionLogBalance, - }, - Structure { - structure: Structure, - balance: ActionLogBalance, position: Position, }, + Structure(ActionLogEntryStructure), HandCard { card: HandCard, from: HandCardLocation, @@ -146,37 +219,75 @@ pub enum ActionLogEntry { city: Position, mood: MoodState, }, + Move(ActionLogEntryMove), + Explore { + tiles: Vec<(Position, Terrain)>, + }, + CombatRound(ActionLogEntryCombatRound), + CombatRoll(ActionLogEntryCombatRoll), + InfluenceCultureAttempt(InfluenceCultureAttemptInfo), } impl ActionLogEntry { + #[must_use] + pub fn balance(&self) -> Option<&ActionLogBalance> { + match self { + ActionLogEntry::Action { balance, .. } + | ActionLogEntry::Resources { balance, .. } + | ActionLogEntry::Units { balance, .. } => Some(balance), + ActionLogEntry::Structure(s) => Some(&s.balance), + ActionLogEntry::Advance(a) => Some(&a.balance), + _ => None, + } + } + + #[must_use] + pub fn message(text: String) -> Self { + Self::Text(text) + } + #[must_use] pub fn resources(resources: ResourcePile, balance: ActionLogBalance) -> Self { Self::Resources { resources, balance } } #[must_use] - pub fn units(units: Units, balance: ActionLogBalance) -> Self { - Self::Units { units, balance } - } - - #[must_use] - pub fn advance(advance: Advance, balance: ActionLogBalance, take_incident_token: bool) -> Self { - Self::Advance { - advance, - take_incident_token, - balance, - } - } - - #[must_use] - pub fn structure(structure: Structure, balance: ActionLogBalance, position: Position) -> Self { - Self::Structure { - structure, + pub fn units(units: Units, balance: ActionLogBalance, position: Position) -> Self { + Self::Units { + units, balance, position, } } + #[must_use] + pub fn advance( + advance: Advance, + balance: ActionLogBalance, + incident_token: ActionLogIncidentToken, + ) -> Self { + Self::Advance(ActionLogEntryAdvance { + advance, + incident_token, + balance, + }) + } + + #[must_use] + pub fn structure( + structure: Structure, + balance: ActionLogBalance, + position: Position, + port_position: Option, + ) -> Self { + Self::Structure(ActionLogEntryStructure { + structure, + balance, + position, + port_position, + }) + } + #[must_use] pub fn hand_card(card: HandCard, from: HandCardLocation, to: HandCardLocation) -> Self { Self::HandCard { card, from, to } @@ -188,20 +299,42 @@ impl ActionLogEntry { } #[must_use] - pub fn action(balance: ActionLogBalance) -> Self { - Self::Action { balance } + pub fn action(balance: ActionLogBalance, amount: u32) -> Self { + Self::Action { + balance, + amount: if amount == 1 { None } else { Some(amount) }, + } + } + + #[must_use] + pub fn move_units(player: &Player, m: &MoveUnits) -> Self { + Self::Move(ActionLogEntryMove { + units: m + .units + .iter() + .map(|unit| player.get_unit(*unit).unit_type) + .collect::(), + start: player.get_unit(m.units[0]).position, + destination: m.destination, + embark_carrier_id: m.embark_carrier_id, + }) + } + + #[must_use] + pub(crate) fn explore_tiles(tiles: Vec<(Position, Terrain)>) -> ActionLogEntry { + Self::Explore { tiles } } } -#[derive(Serialize, Deserialize, Clone, PartialEq)] +#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct ActionLogItem { pub player: usize, #[serde(flatten)] pub entry: ActionLogEntry, - origin: EventOrigin, + pub origin: EventOrigin, #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] - modifiers: Vec, + pub modifiers: Vec, } impl ActionLogItem { @@ -252,13 +385,26 @@ pub(crate) fn linear_action_log(game: &Game) -> Vec { } pub(crate) fn add_log_action(game: &mut Game, item: Action) { + let active_events = game.events.len(); + let player = game.active_player(); + let origin = action_origin(&item, game.player(player)).clone(); let i = game.log_index; let l = &mut current_turn_log_mut(game).actions; remove_redo_actions(l, i); - l.push(ActionLogAction::new(item)); + l.push(ActionLogAction::new(item, player, origin, active_events)); game.log_index += 1; } +fn action_origin(a: &Action, player: &Player) -> Option { + match a { + Action::Playing(p) => Some(p.playing_action_type(player).origin(player).clone()), + Action::Movement(_) => Some(move_event_origin()), + Action::Undo => panic!("Unexpected undo in log"), + Action::Redo => panic!("Unexpected redo in log"), + Action::StartTurn | Action::Response(_) | Action::ChooseCivilization(_) => None, + } +} + fn remove_redo_actions(l: &mut Vec, action_log_index: usize) { l.truncate(action_log_index); } @@ -275,10 +421,11 @@ pub(crate) fn add_action_log_item( .push(ActionLogItem::new(player, entry, origin, modifiers)); } -pub(crate) fn add_start_turn_action_if_needed(game: &mut Game) { +pub(crate) fn add_start_turn_action_if_needed(game: &mut Game, player: usize) { let p = current_turn_log_mut(game); if p.actions.is_empty() { - p.actions.push(ActionLogAction::new(Action::StartTurn)); + p.actions + .push(ActionLogAction::new(Action::StartTurn, player, None, 0)); game.log_index += 1; } } diff --git a/server/src/movement.rs b/server/src/movement.rs index 584e5de4..82ce1c8d 100644 --- a/server/src/movement.rs +++ b/server/src/movement.rs @@ -13,6 +13,7 @@ use crate::events::{EventOrigin, EventPlayer}; use crate::explore::move_to_unexplored_tile; use crate::game::GameState::Movement; use crate::game::{Game, GameContext, GameState}; +use crate::log::ActionLogEntry; use crate::move_routes::{MoveRoute, move_routes}; use crate::movement::MovementAction::{Move, Stop}; use crate::payment::PaymentOptions; @@ -328,7 +329,7 @@ pub(crate) fn execute_movement_action( action: MovementAction, player_index: usize, ) -> Result<(), String> { - let player = EventPlayer::from_player(player_index, game, move_event_origin()); + let player = EventPlayer::new(player_index, move_event_origin()); match &action { Move(m) if m.city.is_some() => player.log( game, @@ -337,11 +338,13 @@ pub(crate) fn execute_movement_action( Move(m) if m.units.is_empty() => { player.log(game, "Used a movement actions but moved no units"); } - Move(m) => player.log(game, &move_action_log(game, player.get(game), m)), + Move(m) => { + player.add_log_entry(game, ActionLogEntry::move_units(player.get(game), m)); + } Stop => player.log(game, "End the movement action"), } - let p = &EventPlayer::from_player(player_index, game, move_event_origin()); + let p = &EventPlayer::new(player_index, move_event_origin()); if let GameState::Playing = game.state { if game.actions_left == 0 && game.context != GameContext::Replay { return Err("No actions left".to_string()); @@ -383,10 +386,11 @@ fn has_any_moves_left(game: &mut Game) -> bool { return true; } - crate::content::civilizations::huns::has_city_moves_left(game, p) || p.units.iter().any(|unit| { - let result = possible_move_routes(p, game, &[unit.id], unit.position, None); - result.is_ok_and(|r| !r.is_empty()) || can_embark(game, p, unit) - }) + crate::content::civilizations::huns::has_city_moves_left(game, p) + || p.units.iter().any(|unit| { + let result = possible_move_routes(p, game, &[unit.id], unit.position, None); + result.is_ok_and(|r| !r.is_empty()) || can_embark(game, p, unit) + }) } else { false } @@ -458,7 +462,7 @@ fn execute_move_action(game: &mut Game, player: &EventPlayer, m: &MoveUnits) -> move_state.current_move = current_move; } if !starting_position.is_neighbor(m.destination) { - // roads move ends the current move + // roads move and navigation end the current move move_state.current_move = CurrentMove::None; } @@ -837,42 +841,7 @@ fn can_embark(game: &Game, player: &Player, unit: &Unit) -> bool { false } -pub(crate) fn move_action_log(game: &Game, player: &Player, m: &MoveUnits) -> String { - let units_str = m - .units - .iter() - .map(|unit| player.get_unit(*unit).unit_type) - .collect::() - .to_string(Some(game)); - let start = player.get_unit(m.units[0]).position; - let start_is_water = game.map.is_sea(start); - let dest = m.destination; - let t = game - .map - .get(dest) - .expect("the destination position should be on the map"); - let (verb, suffix) = if start_is_water { - if t.is_unexplored() || t.is_water() { - ("sailed", "") - } else { - ("disembarked", "") - } - } else if m.embark_carrier_id.is_some() { - ("embarked", "") - } else if start.is_neighbor(dest) { - ("marched", "") - } else { - ("marched", " on roads") - }; - let payment = &m.payment; - let cost = if payment.is_empty() { - String::new() - } else { - format!(" for {payment}") - }; - format!("{verb} {units_str} from {start} to {dest}{suffix}{cost}",) -} - -pub(crate) fn move_event_origin() -> EventOrigin { +#[must_use] +pub fn move_event_origin() -> EventOrigin { EventOrigin::Ability("Move".to_string()) } diff --git a/server/src/objective_card.rs b/server/src/objective_card.rs index 60e86616..26875600 100644 --- a/server/src/objective_card.rs +++ b/server/src/objective_card.rs @@ -391,7 +391,7 @@ pub(crate) fn complete_objective_card(game: &mut Game, player: usize, id: u8, ob { s( game, - &EventPlayer::from_player(player, game, EventOrigin::Objective(objective.to_string())), + &EventPlayer::new(player, EventOrigin::Objective(objective.to_string())), ); } @@ -436,6 +436,7 @@ pub(crate) fn draw_objective_card_from_pile(game: &mut Game, player: &EventPlaye draw_great_seer_card(game, player).or_else(|| { let card = draw_card_from_pile( game, + player, "Objective Card", |g| &mut g.objective_cards_left, |g| g.cache.get_objective_cards().iter().map(|c| c.id).collect(), diff --git a/server/src/payment.rs b/server/src/payment.rs index 10d4ec85..5740d472 100644 --- a/server/src/payment.rs +++ b/server/src/payment.rs @@ -283,10 +283,7 @@ impl Display for PaymentOptions { } match conversion.payment_conversion_type { PaymentConversionType::Unlimited => {} - PaymentConversionType::MayOverpay(i) => { - write!(f, " (up to: {i})")?; - } - PaymentConversionType::MayNotOverpay(i) => { + PaymentConversionType::MayOverpay(i) | PaymentConversionType::MayNotOverpay(i) => { write!(f, " (up to: {i})")?; } } diff --git a/server/src/pirates.rs b/server/src/pirates.rs index d914679f..72e4be78 100644 --- a/server/src/pirates.rs +++ b/server/src/pirates.rs @@ -248,7 +248,7 @@ fn cities_with_adjacent_pirates(player: &Player, game: &Game) -> Vec { #[must_use] pub(crate) fn get_pirates_event_player(game: &Game, origin: &EventOrigin) -> EventPlayer { let player = get_pirates_player(game); - EventPlayer::new(player.index, player.get_name(), origin.clone()) + EventPlayer::new(player.index, origin.clone()) } /// diff --git a/server/src/player.rs b/server/src/player.rs index 325dd8e5..81c86018 100644 --- a/server/src/player.rs +++ b/server/src/player.rs @@ -2,7 +2,9 @@ use crate::advance::{Advance, base_advance_cost, player_government}; use crate::city_pieces::DestroyedStructures; use crate::consts::{UNIT_LIMIT_BARBARIANS, UNIT_LIMIT_PIRATES}; use crate::content::ability::construct_event_origin; -use crate::content::custom_actions::{CustomActionExecution, CustomActionInfo}; +use crate::content::custom_actions::{ + PlayingActionModifier, SpecialAction, SpecialActionExecution, SpecialActionInfo, +}; use crate::events::{Event, EventOrigin, EventPlayer}; use crate::game_setup::all_leaders; use crate::leader::Leader; @@ -23,7 +25,6 @@ use crate::{ city_pieces::Building::{self}, civilization::Civilization, consts::{BUILDING_COST, CITY_LIMIT, CITY_PIECE_LIMIT, UNIT_LIMIT}, - content::custom_actions::CustomActionType, game::Game, leader::LeaderInfo, player_events::PlayerEvents, @@ -35,7 +36,6 @@ use enumset::EnumSet; use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use std::fmt::Display; #[derive(Serialize, Deserialize, PartialEq, Eq)] pub enum PlayerType { @@ -68,26 +68,19 @@ pub struct Player { pub completed_objectives: Vec, pub captured_leaders: Vec, pub special_victory_points: Vec, - pub custom_actions: HashMap, // transient + pub special_actions: HashMap, // transient pub wonder_cards: Vec, pub action_cards: Vec, pub objective_cards: Vec, pub next_unit_id: u32, - pub played_once_per_turn_actions: Vec, + pub played_once_per_turn_actions: Vec, pub event_info: HashMap, pub secrets: Vec, pub custom_data: HashMap, pub(crate) objective_opportunities: Vec, // private; survives pending choices - pub(crate) gained_objective: Option, // transient pub(crate) great_mausoleum_action_cards: u8, // transient } -impl Display for Player { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.get_name()) - } -} - #[derive(PartialEq, Eq, Copy, Clone)] pub enum CostTrigger { WithModifiers, @@ -123,7 +116,7 @@ impl Player { completed_objectives: Vec::new(), captured_leaders: Vec::new(), special_victory_points: Vec::new(), - custom_actions: HashMap::new(), + special_actions: HashMap::new(), wonder_cards: Vec::new(), action_cards: Vec::new(), objective_cards: Vec::new(), @@ -135,7 +128,6 @@ impl Player { secrets: Vec::new(), custom_data: HashMap::new(), objective_opportunities: Vec::new(), - gained_objective: None, great_mausoleum_action_cards: 0, } } @@ -340,9 +332,19 @@ impl Player { } } - pub fn strip_secret(&mut self) { + pub fn strip_secret(&mut self, game: &Game) { self.wonder_cards = self.wonder_cards.iter().map(|_| Wonder::Hidden).collect(); - self.action_cards = self.action_cards.iter().map(|_| 0).collect(); + self.action_cards = self + .action_cards + .iter() + .map(|id| { + if *id != 0 && game.cache.get_action_card(*id).public { + *id + } else { + 0 + } + }) + .collect(); self.objective_cards = self.objective_cards.iter().map(|_| 0).collect(); self.objective_opportunities.clear(); self.secrets = Vec::new(); @@ -498,7 +500,7 @@ impl Player { T: Clone + PartialEq, { let e = event(&self.events.transient); - e.get().trigger(value, info, details, &mut ()); + e.trigger(value, info, details, &mut ()); } pub(crate) fn trigger_cost_event( @@ -509,7 +511,7 @@ impl Player { details: &V, trigger: CostTrigger, ) -> CostInfo { - let event = get_event(&self.events.transient).get(); + let event = get_event(&self.events.transient); match trigger { CostTrigger::WithModifiers => { let m = @@ -527,28 +529,27 @@ impl Player { /// # Panics /// Panics if the custom action type does not exist for this player #[must_use] - pub fn custom_action_info(&self, custom_action_type: CustomActionType) -> CustomActionInfo { - self.custom_actions - .get(&custom_action_type) + pub fn special_action_info(&self, a: &SpecialAction) -> SpecialActionInfo { + self.special_actions + .get(a) .cloned() - .unwrap_or_else(|| { - panic!( - "Custom action {custom_action_type:?} not found for player {}", - self.index - ) - }) + .unwrap_or_else(|| panic!("Custom action {a:?} not found for player {}", self.index)) } #[must_use] pub(crate) fn custom_action_modifiers( &self, base: &PlayingActionType, - ) -> Vec { - self.custom_actions + ) -> Vec { + self.special_actions .iter() .filter_map(move |(t, c)| { - if let CustomActionExecution::Modifier(b) = &c.execution { - (b == base).then_some(*t) + if let SpecialActionExecution::Modifier(b) = &c.execution { + (b == base).then_some(if let SpecialAction::Modifier(m) = t { + *m + } else { + unreachable!() + }) } else { None } @@ -604,15 +605,10 @@ pub fn gain_units( } } - game.log( - player, - origin, - &format!("Gain {} at {}", units.to_string(Some(game)), position), - ); add_action_log_item( game, player, - ActionLogEntry::units(units, ActionLogBalance::Gain), + ActionLogEntry::units(units, ActionLogBalance::Gain, position), origin.clone(), vec![], ); diff --git a/server/src/player_events.rs b/server/src/player_events.rs index 1936439d..967bc664 100644 --- a/server/src/player_events.rs +++ b/server/src/player_events.rs @@ -8,7 +8,9 @@ use crate::combat_stats::CombatStats; use crate::construct::ConstructInfo; use crate::content::custom_actions::CustomActionActivation; use crate::content::persistent_events::{KilledUnits, PaymentRequest}; -use crate::cultural_influence::{InfluenceCultureInfo, InfluenceCultureOutcome}; +use crate::cultural_influence::{ + InfluenceCultureAttemptInfo, InfluenceCultureBoostInfo, InfluenceCultureOutcome, +}; use crate::events::{Event, EventOrigin, EventPlayer}; use crate::explore::ExploreResolutionState; use crate::game::Game; @@ -49,7 +51,8 @@ impl PlayerEvents { } pub(crate) struct TransientEvents { - pub on_influence_culture_attempt: Event, City, Game>, + pub on_influence_culture_attempt: + Event, City, Game>, pub on_influence_culture_resolve: Event, pub before_move: Event, @@ -103,7 +106,7 @@ pub(crate) struct PersistentEvents { pub advance: PersistentEvent, pub recruit: PersistentEvent, pub found_city: PersistentEvent, - pub influence_culture: PersistentEvent, + pub influence_culture_boost: PersistentEvent, pub explore_resolution: PersistentEvent, pub pay_action: PersistentEvent, pub play_action_card: PersistentEvent, @@ -143,7 +146,7 @@ impl PersistentEvents { advance: Event::new("advance"), recruit: Event::new("recruit"), found_city: Event::new("found_city"), - influence_culture: Event::new("influence_culture"), + influence_culture_boost: Event::new("influence_culture"), explore_resolution: Event::new("explore_resolution"), pay_action: Event::new("pay_action"), play_action_card: Event::new("play_action_card"), @@ -252,6 +255,7 @@ impl IncidentPlayerInfo { #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] pub struct IncidentInfo { pub incident_id: u8, + pub cause: EventOrigin, pub active_player: usize, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] @@ -278,7 +282,7 @@ pub struct IncidentInfo { impl IncidentInfo { #[must_use] - pub fn new(incident_id: u8, active_player: usize) -> IncidentInfo { + pub fn new(incident_id: u8, active_player: usize, cause: EventOrigin) -> IncidentInfo { IncidentInfo { incident_id, active_player, @@ -289,6 +293,7 @@ impl IncidentInfo { selected_player: None, selected_position: None, player: IncidentPlayerInfo::new(), + cause, } } @@ -366,6 +371,7 @@ pub struct OnAdvanceInfo { pub take_incident_token: bool, } +#[derive(Clone)] pub struct MoveInfo { pub units: Vec, pub from: Position, @@ -379,32 +385,28 @@ impl MoveInfo { } } -pub(crate) fn trigger_event_with_game_value( +pub(crate) fn trigger_event_with_game_value( game: &mut Game, player_index: usize, event: impl Fn(&mut PlayerEvents) -> &mut Event, info: &U, details: &V, extra_value: &mut W, -) where - W: Clone + PartialEq, -{ - let e = event(&mut game.players[player_index].events).take(); - e.trigger(game, info, details, extra_value); - event(&mut game.players[player_index].events).set(e); +) { + event(&mut game.players[player_index].events) + .clone() + .trigger(game, info, details, extra_value); } -pub(crate) fn trigger_event_with_game_info( +pub(crate) fn trigger_event_with_game_info( game: &mut Game, player_index: usize, event: impl Fn(&mut PlayerEvents) -> &mut Event, info: &mut U, details: &V, extra_value: &mut W, -) where - W: Clone + PartialEq, -{ - let e = event(&mut game.players[player_index].events).take(); - e.trigger(info, game, details, extra_value); - event(&mut game.players[player_index].events).set(e); +) { + event(&mut game.players[player_index].events) + .clone() + .trigger(info, game, details, extra_value); } diff --git a/server/src/playing_actions.rs b/server/src/playing_actions.rs index 7cd44789..6bc74f1b 100644 --- a/server/src/playing_actions.rs +++ b/server/src/playing_actions.rs @@ -14,8 +14,8 @@ use crate::content::ability::{ Ability, advance_event_origin, construct_event_origin, recruit_event_origin, }; use crate::content::custom_actions::{ - CustomAction, CustomActionActivation, CustomActionType, can_play_custom_action, - log_start_custom_action, on_custom_action, + CustomAction, CustomActionActivation, PlayingActionModifier, SpecialAction, + can_play_special_action, on_custom_action, }; use crate::content::persistent_events::{ PaymentRequest, PersistentEventType, TriggerPersistentEventParams, trigger_persistent_event_ext, @@ -29,6 +29,7 @@ use crate::happiness::{ IncreaseHappiness, execute_increase_happiness, happiness_base_event_origin, happiness_event_origin, }; +use crate::log::{ActionLogBalance, ActionLogEntry}; use crate::movement::move_event_origin; use crate::payment::PaymentOptions; use crate::player::Player; @@ -48,7 +49,7 @@ pub enum PlayingActionType { InfluenceCultureAttempt, ActionCard(u8), WonderCard(Wonder), - Custom(CustomActionType), + Special(SpecialAction), EndTurn, } @@ -67,8 +68,8 @@ impl PlayingActionType { let p = game.player(player_index); match self { - PlayingActionType::Custom(c) => { - can_play_custom_action(game, p, *c)?; + PlayingActionType::Special(c) => { + can_play_special_action(game, p, *c)?; } PlayingActionType::ActionCard(id) => { can_play_civil_card(game, p, *id)?; @@ -98,19 +99,20 @@ impl PlayingActionType { #[must_use] pub fn cost(&self, game: &Game, player: usize) -> ActionCost { match self { - PlayingActionType::Custom(CustomActionType::JapaneseBuddhism) - if game - .player(player) - .can_use_advance(crate::advance::Advance::StateReligion) => + PlayingActionType::Special(crate::content::custom_actions::SpecialAction::Custom( + crate::content::custom_actions::CustomActionType::JapaneseBuddhism, + )) if game + .player(player) + .can_use_advance(crate::advance::Advance::StateReligion) => { ActionCost::new( true, ActionResourceCost::resources(ResourcePile::culture_tokens(1)), ) } - PlayingActionType::Custom(custom_action) => game + PlayingActionType::Special(custom_action) => game .player(player) - .custom_action_info(*custom_action) + .special_action_info(custom_action) .cost .cost .clone(), @@ -150,12 +152,10 @@ impl PlayingActionType { PlayingActionType::IncreaseHappiness => happiness_base_event_origin(), PlayingActionType::InfluenceCultureAttempt => influence_base_origin(), PlayingActionType::ActionCard(a) => EventOrigin::CivilCard(*a), - PlayingActionType::WonderCard(w) => EventOrigin::Wonder(*w), - PlayingActionType::Custom(c) => player.custom_action_info(*c).event_origin, + PlayingActionType::WonderCard(_) => wonder_origin(), + PlayingActionType::Special(c) => player.special_action_info(c).event_origin, PlayingActionType::MoveUnits => move_event_origin(), - PlayingActionType::EndTurn => panic!( - "PlayingAction::origin called on an action that does not have an origin: EndTurn", - ), + PlayingActionType::EndTurn => end_turn_origin(), } } } @@ -197,7 +197,7 @@ impl PlayingAction { if !action_cost.free { pay_action( game, - &EventPlayer::from_player(player_index, game, playing_action_type.origin(p)), + &EventPlayer::new(player_index, playing_action_type.origin(p)), ); } @@ -210,51 +210,19 @@ impl PlayingAction { player_index: usize, ) -> Result<(), String> { // log these before the payment for clarity - match &self { - PlayingAction::Custom(a) => { - log_start_custom_action(game, player_index, a); - } - PlayingAction::ActionCard(id) => { - discard_action_card( - game, - player_index, - *id, - &EventOrigin::Ability("Action Card".to_string()), - HandCardLocation::PlayToDiscard, - ); - } - _ => {} - } - - let action_type = self.playing_action_type(game.player(player_index)); - let origin_override = match action_type { - PlayingActionType::Custom(c) => { - if let Some(key) = &game - .player(player_index) - .custom_action_info(c) - .cost - .once_per_turn - { - game.players[player_index] - .played_once_per_turn_actions - .push(*key); - } - Some(game.player(player_index).custom_action_info(c).event_origin) - } - PlayingActionType::ActionCard(c) => Some(EventOrigin::CivilCard(c)), - _ => None, - }; - - let payment_options = action_type.payment_options(game, player_index); - if !payment_options.is_free() { - game.log( + if let PlayingAction::ActionCard(id) = &self { + discard_action_card( + game, player_index, - &payment_options.origin, - &format!("Pay {}", payment_options.default,), + *id, + &EventOrigin::Ability("Action Card".to_string()), + HandCardLocation::PlayToDiscard, ); } - ActionPayment::new(self).on_pay_action(game, player_index, origin_override) + let action_type = self.playing_action_type(game.player(player_index)); + let override_origin = add_override_origin(game, player_index, &action_type); + ActionPayment::new(self).on_pay_action(game, player_index, override_origin) } pub(crate) fn execute_without_cost( @@ -292,7 +260,7 @@ impl PlayingAction { WonderCardInfo::new( w, wonder_cost(game, game.player(player_index), w), - EventOrigin::Ability("Build Wonder".to_string()), + wonder_origin(), ), ); } @@ -332,7 +300,7 @@ impl PlayingAction { ), PlayingAction::ActionCard(a) => PlayingActionType::ActionCard(*a), PlayingAction::WonderCard(name) => PlayingActionType::WonderCard(*name), - PlayingAction::Custom(c) => PlayingActionType::Custom(c.action), + PlayingAction::Custom(c) => PlayingActionType::Special(SpecialAction::Custom(c.action)), PlayingAction::EndTurn => PlayingActionType::EndTurn, } } @@ -344,7 +312,7 @@ fn assert_allowed_action_type( player: &Player, ) -> PlayingActionType { match playing_action_type { - PlayingActionType::Custom(c) => { + PlayingActionType::Special(SpecialAction::Modifier(c)) => { assert!(player.custom_action_modifiers(base_type).contains(c)); } _ => { @@ -355,7 +323,7 @@ fn assert_allowed_action_type( } #[must_use] -pub(crate) fn base_or_custom_available( +pub(crate) fn base_or_modified_available( game: &Game, player: usize, base: &PlayingActionType, @@ -366,7 +334,7 @@ pub(crate) fn base_or_custom_available( game.player(player) .custom_action_modifiers(base) .iter() - .map(CustomActionType::playing_action_type), + .map(PlayingActionModifier::playing_action_type), ) .filter_map(|a| a.is_available(game, player).map(|()| a).ok()) .collect() @@ -446,10 +414,47 @@ pub(crate) fn pay_for_action() -> Ability { } fn end_turn(game: &mut Game, player: usize) { - game.log( - player, - &EventOrigin::Ability("End Turn".to_string()), - &format!("{} actions left", game.actions_left), - ); + if game.actions_left > 0 { + EventPlayer::new(player, end_turn_origin()).add_log_entry( + game, + ActionLogEntry::action(ActionLogBalance::Loss, game.actions_left), + ); + } game.next_turn(); } + +pub(crate) fn end_turn_origin() -> EventOrigin { + EventOrigin::Ability("End Turn".to_string()) +} + +pub(crate) fn wonder_origin() -> EventOrigin { + EventOrigin::Ability("Build Wonder".to_string()) +} + +fn add_override_origin( + game: &mut Game, + player_index: usize, + action_type: &PlayingActionType, +) -> Option { + match action_type { + PlayingActionType::Special(c) => { + if let Some(key) = &game + .player(player_index) + .special_action_info(c) + .cost + .once_per_turn + { + game.players[player_index] + .played_once_per_turn_actions + .push(*key); + } + Some( + game.player(player_index) + .special_action_info(c) + .event_origin, + ) + } + PlayingActionType::ActionCard(c) => Some(EventOrigin::CivilCard(*c)), + _ => None, + } +} diff --git a/server/src/recruit.rs b/server/src/recruit.rs index fae0312f..59f69adb 100644 --- a/server/src/recruit.rs +++ b/server/src/recruit.rs @@ -125,9 +125,8 @@ pub(crate) fn execute_recruit( .insert("Shogunate Draft".into(), "used".into()); crate::action_card::gain_action_card_from_pile( game, - &crate::events::EventPlayer::from_player( + &crate::events::EventPlayer::new( player_index, - game, crate::events::EventOrigin::SpecialAdvance(SpecialAdvance::Shogunate), ), ); diff --git a/server/src/resource.rs b/server/src/resource.rs index c5b98059..ef9a2d99 100644 --- a/server/src/resource.rs +++ b/server/src/resource.rs @@ -1,11 +1,10 @@ use crate::content::persistent_events::PaymentRequest; -use crate::events::EventOrigin; +use crate::events::{EventOrigin, EventPlayer}; use crate::game::Game; use crate::log::{ActionLogBalance, ActionLogEntry, add_action_log_item}; use crate::payment::PaymentOptions; use crate::player::Player; use crate::resource_pile::ResourcePile; -use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::{fmt, mem}; @@ -93,22 +92,7 @@ pub(crate) fn gain_resources_with_modifiers( origin: EventOrigin, modifiers: Vec, ) { - if modifiers.is_empty() { - game.log(player, &origin, &format!("Gain {resources}")); - } else { - let modifier_names = modifiers - .iter() - .map(|m| m.name(game)) - .collect_vec() - .join(", "); - game.log( - player, - &origin, - &format!("Gain {resources} with {modifier_names}"), - ); - } let p = game.player_mut(player); - p.resources += resources.clone(); apply_resource_limit(p); add_action_log_item( @@ -131,10 +115,9 @@ pub(crate) fn check_for_waste(game: &mut Game) { let wasted_resources = mem::replace(&mut game.players[p].wasted_resources, ResourcePile::empty()); if !wasted_resources.is_empty() { - game.log( - p, - &EventOrigin::Ability("Waste".to_string()), - &format!("Could not store {wasted_resources}",), + EventPlayer::new(p, EventOrigin::Ability("Waste".to_string())).add_log_entry( + game, + ActionLogEntry::resources(wasted_resources, ActionLogBalance::Loss), ); } } @@ -146,6 +129,7 @@ pub(crate) fn lose_resources( resources: ResourcePile, origin: EventOrigin, modifiers: Vec, + balance: ActionLogBalance, ) { let p = game.player_mut(player); assert!( @@ -158,7 +142,7 @@ pub(crate) fn lose_resources( add_action_log_item( game, player, - ActionLogEntry::resources(resources, ActionLogBalance::Loss), + ActionLogEntry::resources(resources, balance), origin, modifiers, ); @@ -194,20 +178,6 @@ fn log_payment(game: &mut Game, player: usize, payment: &ResourcePile, cost: &Pa payment.clone(), cost.origin.clone(), cost.modifiers.clone(), + ActionLogBalance::Pay, ); - if cost.modifiers.is_empty() { - game.log(player, &cost.origin, &format!("Pay {payment}")); - } else { - let modifiers = cost - .modifiers - .iter() - .map(|m| m.name(game)) - .collect_vec() - .join(", "); - game.log( - player, - &cost.origin, - &format!("Pay {payment} with {modifiers}"), - ); - } } diff --git a/server/src/status_phase.rs b/server/src/status_phase.rs index 53c46ce3..6b0114eb 100644 --- a/server/src/status_phase.rs +++ b/server/src/status_phase.rs @@ -9,7 +9,7 @@ use crate::content::persistent_events::{ trigger_persistent_event_with_listener, }; use crate::events::{EventOrigin, EventPlayer}; -use crate::log::{TurnType, add_turn_log}; +use crate::log::{TurnType, add_start_turn_action_if_needed, add_turn_log}; use crate::objective_card::{ gain_objective_card_from_pile, present_objective_cards, status_phase_completable, }; @@ -21,6 +21,16 @@ use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::fmt::Display; +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, Hash, Copy)] +pub enum StatusPhaseStateType { + CompleteObjectives, + FreeAdvance, + DrawCards, + RazeSize1City, + ChangeGovernmentType, + DetermineFirstPlayer, +} + #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, Hash)] pub enum StatusPhaseState { CompleteObjectives, @@ -31,15 +41,15 @@ pub enum StatusPhaseState { DetermineFirstPlayer(usize), } -impl Display for StatusPhaseState { +impl Display for StatusPhaseStateType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - StatusPhaseState::CompleteObjectives => write!(f, "Complete Objectives"), - StatusPhaseState::FreeAdvance => write!(f, "Free Advance"), - StatusPhaseState::DrawCards => write!(f, "Draw Cards"), - StatusPhaseState::RazeSize1City => write!(f, "Raze Size 1 City"), - StatusPhaseState::ChangeGovernmentType(_) => write!(f, "Change Government"), - StatusPhaseState::DetermineFirstPlayer(_) => write!(f, "Determine First Player"), + StatusPhaseStateType::CompleteObjectives => write!(f, "Complete Objectives"), + StatusPhaseStateType::FreeAdvance => write!(f, "Free Advance"), + StatusPhaseStateType::DrawCards => write!(f, "Draw Cards"), + StatusPhaseStateType::RazeSize1City => write!(f, "Raze Size 1 City"), + StatusPhaseStateType::ChangeGovernmentType => write!(f, "Change Government"), + StatusPhaseStateType::DetermineFirstPlayer => write!(f, "Determine First Player"), } } } @@ -71,19 +81,31 @@ pub fn get_status_phase(game: &Game) -> Option<&StatusPhaseState> { } pub(crate) fn enter_status_phase(game: &mut Game) { - add_turn_log(game, TurnType::StatusPhase); - play_status_phase(game, StatusPhaseState::CompleteObjectives); + play_status_phase(game, StatusPhaseState::CompleteObjectives, false); } -pub(crate) fn play_status_phase(game: &mut Game, mut phase: StatusPhaseState) { +pub(crate) fn status_phase_response(game: &mut Game, phase: StatusPhaseState) { + play_status_phase(game, phase, true); +} + +fn play_status_phase(game: &mut Game, mut phase: StatusPhaseState, response: bool) { use StatusPhaseState::*; loop { + let t = status_phase_type(&phase); + if game.events.is_empty() { + add_turn_log(game, TurnType::StatusPhase(t)); + // needed for draw cards + if response { + add_start_turn_action_if_needed(game, game.active_player()); + } + game.player_changed(); + } phase = match trigger_persistent_event_with_listener( game, &game.human_players_sorted(game.starting_player_index), |events| &mut events.status_phase, - &game.cache.status_phase_handler(&phase).listeners.clone(), + &game.cache.status_phase_handler(&t).listeners.clone(), phase, PersistentEventType::StatusPhase, TriggerPersistentEventParams::default(), @@ -322,10 +344,11 @@ where p.log( game, &format!( - "{p} changed their government from {} to {}", + "{} changed their government from {} to {}", p.get(game) .government(game) .expect("player should have a government before changing it"), + p.name(game), c.new_government ), ); @@ -496,6 +519,18 @@ fn player_that_chooses_next_first_player(players: &[&Player]) -> usize { .index } +#[must_use] +pub fn status_phase_type(p: &StatusPhaseState) -> StatusPhaseStateType { + match p { + StatusPhaseState::CompleteObjectives => StatusPhaseStateType::CompleteObjectives, + StatusPhaseState::FreeAdvance => StatusPhaseStateType::FreeAdvance, + StatusPhaseState::DrawCards => StatusPhaseStateType::DrawCards, + StatusPhaseState::RazeSize1City => StatusPhaseStateType::RazeSize1City, + StatusPhaseState::ChangeGovernmentType(_) => StatusPhaseStateType::ChangeGovernmentType, + StatusPhaseState::DetermineFirstPlayer(_) => StatusPhaseStateType::DetermineFirstPlayer, + } +} + #[cfg(test)] mod tests { use crate::civilization::Civilization; diff --git a/server/src/structure.rs b/server/src/structure.rs index ee911c1d..26e562b7 100644 --- a/server/src/structure.rs +++ b/server/src/structure.rs @@ -31,8 +31,14 @@ pub(crate) fn log_gain_city( structure: Structure, position: Position, ) { - player.log(game, &format!("Gain city {position}")); - log_structure(game, player, structure, ActionLogBalance::Gain, position); + log_structure( + game, + player, + structure, + ActionLogBalance::Gain, + position, + None, + ); } pub(crate) fn log_lose_city( @@ -41,8 +47,14 @@ pub(crate) fn log_lose_city( structure: Structure, position: Position, ) { - player.log(game, &format!("Lose city {position}")); - log_structure(game, player, structure, ActionLogBalance::Loss, position); + log_structure( + game, + player, + structure, + ActionLogBalance::Loss, + position, + None, + ); } pub(crate) fn log_structure( @@ -51,11 +63,12 @@ pub(crate) fn log_structure( structure: Structure, balance: ActionLogBalance, position: Position, + port_position: Option, ) { add_action_log_item( game, player.index, - ActionLogEntry::structure(structure, balance, position), + ActionLogEntry::structure(structure, balance, position, port_position), player.origin.clone(), vec![], ); diff --git a/server/src/tactics_card.rs b/server/src/tactics_card.rs index ceb010ae..53b364c7 100644 --- a/server/src/tactics_card.rs +++ b/server/src/tactics_card.rs @@ -267,7 +267,11 @@ impl TacticsCardBuilder { if !self.fighter_requirement.is_empty() { requirements.push(format!( "Requires your {} in the battle", - self.fighter_requirement.iter().map(ToString::to_string).collect::>().join(" or ") + self.fighter_requirement + .iter() + .map(ToString::to_string) + .collect::>() + .join(" or ") )); } let description = if requirements.is_empty() { diff --git a/server/src/undo.rs b/server/src/undo.rs index e0a37911..51ce3d70 100644 --- a/server/src/undo.rs +++ b/server/src/undo.rs @@ -24,7 +24,6 @@ pub(crate) fn undo(mut game: Game) -> Result { }; let item = l.get_mut(i).expect("should have undoable action"); - item.log.clear(); item.items.clear(); item.combat_stats = None; let p = std::mem::take(&mut item.undo); diff --git a/server/src/unit.rs b/server/src/unit.rs index 2699d6c6..7c15f473 100644 --- a/server/src/unit.rs +++ b/server/src/unit.rs @@ -18,7 +18,8 @@ use crate::log::{ActionLogBalance, ActionLogEntry, add_action_log_item}; use crate::movement::{CurrentMove, MovementRestriction}; use crate::player::{Player, remove_unit}; use crate::special_advance::SpecialAdvance; -use crate::{game::Game, leader, position::Position, resource_pile::ResourcePile, unit, utils}; +use crate::{game::Game, leader, position::Position, resource_pile::ResourcePile, unit}; +use string_builder::Builder; #[derive(Clone)] pub struct Unit { @@ -56,6 +57,11 @@ pub struct UnitData { pub carried_units: Vec, } +pub enum UnitPrintArg { + Text(String), + Amount(u8), +} + impl Unit { #[must_use] pub fn new(player_index: usize, position: Position, unit_type: UnitType, id: u32) -> Self { @@ -430,50 +436,97 @@ impl Units { /// Panics if `game` is `None` and the units contain a leader. #[must_use] pub fn to_string(&self, game: Option<&Game>) -> String { - let mut unit_types = Vec::new(); + let mut builder = Builder::default(); + self.print(game, &mut |a| { + if builder.len() > 0 { + builder.append(" ".to_string()); + } + match a { + UnitPrintArg::Amount(a) => builder.append(a.to_string()), + UnitPrintArg::Text(t) => builder.append(t.to_string()), + } + }); + builder.string().unwrap_or_default() + } + + /// + /// # Panics + /// + /// Panics if `game` is `None` and the units contain a leader. + pub fn print(&self, game: Option<&Game>, print: &mut F) + where + F: FnMut(&UnitPrintArg), + { + fn amount(print: &mut F, a: u8) { + print(&UnitPrintArg::Amount(a)); + } + fn text(print: &mut F, t: &str) { + print(&UnitPrintArg::Text(t.to_string())); + } + let mut and = false; + let mut add_and = |print: &mut F| { + if and { + text(print, "and"); + and = false; + } else { + and = true; + } + }; + if self.settlers > 0 { - unit_types.push(format!( - "{} {}", - self.settlers, + amount(print, self.settlers); + text( + print, if self.settlers == 1 { "settler" } else { "settlers" - } - )); + }, + ); + add_and(print); } if self.infantry > 0 { - unit_types.push(format!("{} infantry", self.infantry,)); + add_and(print); + amount(print, self.infantry); + text(print, "infantry"); + add_and(print); } if self.ships > 0 { - unit_types.push(format!( - "{} {}", - self.ships, - if self.ships == 1 { "ship" } else { "ships" } - )); + add_and(print); + amount(print, self.ships); + text(print, if self.ships == 1 { "ship" } else { "ships" }); + add_and(print); } if self.cavalry > 0 { - unit_types.push(format!("{} cavalry", self.cavalry,)); + add_and(print); + amount(print, self.cavalry); + text(print, "cavalry"); + add_and(print); } if self.elephants > 0 { - unit_types.push(format!( - "{} {}", - self.elephants, + add_and(print); + amount(print, self.elephants); + text( + print, if self.elephants == 1 { "elephant" } else { "elephants" - } - )); + }, + ); + add_and(print); } if let Some(l) = self.leader { + add_and(print); if let Some(game) = game { - unit_types.push(l.name(game)); + text(print, &l.name(game)); } else { panic!("game missing for leader") } } - utils::format_and(&unit_types, "no units") + if self.is_empty() { + text(print, "no units"); + } } } @@ -620,19 +673,10 @@ pub(crate) fn kill_units_without_event( .iter() .map(|id| p.get_unit(*id).unit_type) .collect::(); - game.log( - player, - origin, - &format!( - "Lost {} at {}", - units.to_string(Some(game)), - killed_units.position - ), - ); add_action_log_item( game, player, - ActionLogEntry::units(units, ActionLogBalance::Loss), + ActionLogEntry::units(units, ActionLogBalance::Loss, killed_units.position), origin.clone(), vec![], ); @@ -907,4 +951,13 @@ mod tests { Units::new(0, 1, 0, 0, 0, None) ); } + + #[test] + fn test_to_string() { + let units = Units::new(1, 2, 0, 1, 0, None); + assert_eq!( + units.to_string(None), + "1 settler and 2 infantry and 1 cavalry" + ); + } } diff --git a/server/src/utils.rs b/server/src/utils.rs index faacbceb..d4102073 100644 --- a/server/src/utils.rs +++ b/server/src/utils.rs @@ -92,7 +92,7 @@ pub fn median(list: &[f64]) -> f64 { let mut sorted_list = list.to_vec(); sorted_list.sort_by(f64::total_cmp); let len = sorted_list.len(); - if len % 2 == 0 { + if len.is_multiple_of(2) { f64::midpoint(sorted_list[len / 2 - 1], sorted_list[len / 2]) } else { sorted_list[len / 2] diff --git a/server/src/web_view.rs b/server/src/web_view.rs index e2679e6c..290b7af7 100644 --- a/server/src/web_view.rs +++ b/server/src/web_view.rs @@ -107,6 +107,20 @@ pub fn view(game: &Game, seat: Option) -> Value { "builtPoints":info.built_victory_points,"ownedPoints":info.owned_victory_points}) }) .collect::>(); + let log_origin_names: std::collections::BTreeMap = game + .log + .iter() + .flat_map(|age| &age.rounds) + .flat_map(|round| &round.turns) + .flat_map(|turn| &turn.actions) + .flat_map(|action| &action.items) + .map(|item| { + ( + serde_json::to_string(&item.origin).expect("serializable origin"), + item.origin.name(game), + ) + }) + .collect(); let pending_event = game.events.iter().rev().find_map(|event| { if let PersistentEventType::Incident(info) = &event.event_type { Some(json!({"id":info.incident_id,"player":active})) @@ -162,7 +176,7 @@ pub fn view(game: &Game, seat: Option) -> Value { "cities": p.cities.iter().map(|c| json!({"position": c.position, "size": c.size(), "capacity": c.mood_modified_size(p), "mood": c.mood_state, "activations": c.activations,"protection":crate::content::civilizations::egypt::protection(p,c.position),"independentPort":crate::content::civilizations::phoenicia::independent_port(game,c.pieces.port),"influenceMarker":c.influence_marker})).collect::>() })).collect::>(); let Some(seat) = seat else { - return json!({"builtWonders":built_wonders,"eventCatalog":event_catalog,"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"activePlayers":active_players,"activePlayer": active, "canPlay": false, "supportedPhase": supported_phase, "players": players, "cities": [], "advances": [], "objectiveCards": [], "wonderCards": [], "objectiveDecision": null, "cityActions": [], "settlers": [], "stopMovement": null, "canUndo": false, "canEndTurn": false, "seaRoutes":sea_routes}); + return json!({"logOriginNames":log_origin_names,"builtWonders":built_wonders,"eventCatalog":event_catalog,"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"activePlayers":active_players,"activePlayer": active, "canPlay": false, "supportedPhase": supported_phase, "players": players, "cities": [], "advances": [], "objectiveCards": [], "wonderCards": [], "objectiveDecision": null, "cityActions": [], "settlers": [], "stopMovement": null, "canUndo": false, "canEndTurn": false, "seaRoutes":sea_routes}); }; let p = game.player(seat); let wonder_cards = p.wonder_cards.iter().filter(|wonder| **wonder != Wonder::Hidden).map(|wonder| { @@ -291,7 +305,7 @@ pub fn view(game: &Game, seat: Option) -> Value { item }).collect::>(); advances.sort_by_key(|a| a["name"].as_str().unwrap_or_default().to_string()); - json!({"eventCatalog":event_catalog,"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"activePlayers":active_players,"activePlayer":active,"canPlay":can_play,"supportedPhase":supported_phase,"players":players,"cities":cities,"advances":advances,"objectiveCards":objective_cards,"objectiveDecision":objective_decision(game, seat), + json!({"logOriginNames":log_origin_names,"eventCatalog":event_catalog,"pendingEvent":pending_event,"civilizationDraft":civilization_draft,"activePlayers":active_players,"activePlayer":active,"canPlay":can_play,"supportedPhase":supported_phase,"players":players,"cities":cities,"advances":advances,"objectiveCards":objective_cards,"objectiveDecision":objective_decision(game, seat), "choiceDecision":choice, "explorationDecision":exploration, "wonderCards":wonder_cards, "builtWonders":built_wonders, "decision":decision, "civilizations":crate::game_setup::civilization_choices(game, seat).iter().map(|c|json!({"name":c.name, "advances":c.special_advances.iter().map(|a|json!({"name":a.name,"description":a.description,"requirement":a.requirement.name(game)})).collect::>(), diff --git a/server/src/web_view/actions.rs b/server/src/web_view/actions.rs index fa6fa79b..11894f82 100644 --- a/server/src/web_view/actions.rs +++ b/server/src/web_view/actions.rs @@ -89,12 +89,10 @@ pub fn recruit_extended(game: &Game, seat: usize, input: &Value) -> Result(), "costOptions":recruit_cost_options(game, &cost), - "moodWillDecrease":city.is_activated(),"action":Action::Playing(PlayingAction::Recruit(recruit))}), - ) + "moodWillDecrease":city.is_activated(),"action":Action::Playing(PlayingAction::Recruit(recruit))})) } pub fn happiness_preview(game: &Game, seat: usize, input: &Value) -> Result { @@ -320,21 +318,21 @@ pub fn cards(game: &Game, seat: usize, can_play: bool) -> Vec { } pub fn special(game: &Game, seat: usize, can_play: bool) -> Vec { - use crate::content::custom_actions::{CustomAction, CustomActionExecution}; + use crate::content::custom_actions::{CustomAction, SpecialActionExecution}; if !can_play { return vec![]; } game.available_custom_actions(seat).iter().flat_map(|info| { - let CustomActionExecution::Action(execution) = &info.execution else { return vec![]; }; + let SpecialActionExecution::Action(execution) = &info.execution else { return vec![]; }; let cities = if info.city_bound().is_some() { game.player(seat).cities.iter().filter(|c|info.is_city_available(game,c)).map(|c|Some(c.position)).collect() } else { vec![None] }; cities.into_iter().map(|city|json!({"name":info.event_origin.name(game),"description":execution.ability.description,"position":city, "cost":info.cost.cost.payment_options(game.player(seat),info.event_origin.clone()).default_payment(), "free":info.cost.cost.free, - "activatesCity":(info.action == crate::content::custom_actions::CustomActionType::GoldenAge) + "activatesCity":(info.custom_action_type() == crate::content::custom_actions::CustomActionType::GoldenAge) .then(|| crate::leader::leader_position(game.player(seat))), - "action":Action::Playing(PlayingAction::Custom(CustomAction::new(info.action,city)))})).collect::>() + "action":Action::Playing(PlayingAction::Custom(CustomAction::new(info.custom_action_type(),city)))})).collect::>() }).collect() } @@ -352,7 +350,7 @@ pub fn influence(game: &Game, seat: usize, can_play: bool) -> Vec { let origins = influence_start_positions(game,game.player(seat)).into_iter().map(|(p,_)|p) .chain(std::iter::once(s.position)) .collect::>().into_iter().filter_map(|origin| { - let from = influence_culture_boost_cost_from(game,seat,&s,&kind,true,false,Some(origin)).ok()?; + let from = influence_culture_boost_cost_from(game,seat,&s,&kind,true,false,game.get_any_city(s.position).player_index,Some(origin)).ok()?; let mut attempt = InfluenceCultureAttempt::new(s.clone(),kind.clone()); attempt.starting_position = Some(origin); Some(json!({"position":origin,"settlers":game.try_get_any_city(origin).is_none(), @@ -418,14 +416,23 @@ pub fn cities(game: &Game, seat: usize, can_play: bool) -> Vec { let p = game.player(seat); // These cards grant an action to offset the following Construct command. // Present the extra build's net cost, not that internal action debit. - let construction_source = (seat == game.active_player()).then(|| { - game.permanent_effects.iter().find_map(|effect| match effect { - PermanentEffect::Construct(ConstructEffect::GreatEngineer) => Some("Great Engineer"), - PermanentEffect::Construct(ConstructEffect::CityDevelopment) => Some("City Development"), - _ => None, + let construction_source = (seat == game.active_player()) + .then(|| { + game.permanent_effects + .iter() + .find_map(|effect| match effect { + PermanentEffect::Construct(ConstructEffect::GreatEngineer) => { + Some("Great Engineer") + } + PermanentEffect::Construct(ConstructEffect::CityDevelopment) => { + Some("City Development") + } + _ => None, + }) }) - }).flatten(); - let free_construction = construction_source.is_some() || PlayingActionType::Construct.cost(game, seat).free; + .flatten(); + let free_construction = + construction_source.is_some() || PlayingActionType::Construct.cost(game, seat).free; p.cities.iter().map(|city| { let buildings = BUILDINGS.into_iter().map(|building| { let cost = p.building_cost_in_city(game, building, city.position, CostTrigger::NoModifiers); @@ -519,7 +526,7 @@ pub fn settlers(game: &Game, seat: usize, can_move: bool) -> Vec { "action":Action::Movement(MovementAction::Move(MoveUnits::new(vec![unit.id],route.destination,None,payment.clone())))}))).collect::>() } else {vec![]}; destinations.sort_by_key(|d|d["position"].as_str().unwrap_or_default().to_string()); let founder = p.active_leader()==Some(crate::leader::Leader::QueenDido) && crate::leader::leader_position(p)==unit.position; - let found_kind=if founder {PlayingActionType::Custom(crate::content::custom_actions::CustomActionType::Founder)} else {PlayingActionType::FoundCity}; + let found_kind=if founder {crate::content::custom_actions::CustomActionType::Founder.playing_action_type()} else {PlayingActionType::FoundCity}; let found_reason = action_reason(game,seat,game.state==GameState::Playing && seat==game.active_player(),found_kind) .or_else(||(!unit.can_found_city(game)).then(||"Move to an empty land tile to found a city".into())); json!({"id":unit.id,"position":unit.position,"destinations":destinations,"foundReason":found_reason, diff --git a/server/src/wonder.rs b/server/src/wonder.rs index 013cd7c0..3abe33ae 100644 --- a/server/src/wonder.rs +++ b/server/src/wonder.rs @@ -208,9 +208,10 @@ pub(crate) fn on_draw_wonder_card(game: &mut Game, player_index: usize, draw: Dr ); } -pub(crate) fn draw_wonder_from_pile(game: &mut Game) -> Option { +pub(crate) fn draw_wonder_from_pile(game: &mut Game, player: &EventPlayer) -> Option { draw_card_from_pile( game, + player, "Wonders", |game| &mut game.wonders_left, |_| Vec::new(), @@ -322,7 +323,7 @@ fn player_with_wonder_card(game: &Game, wonder: Wonder) -> Option { } fn gain_wonder_from_pile(game: &mut Game, player: &EventPlayer) { - if let Some(w) = draw_wonder_from_pile(game) { + if let Some(w) = draw_wonder_from_pile(game, player) { gain_wonder_card(game, player, w, HandCardLocation::DrawPile); } } @@ -433,21 +434,14 @@ pub(crate) fn build_wonder_handler() -> Ability { |e| &mut e.play_wonder_card, 11, move |game, p, i| { - p.log(game, &format!("Play the wonder card {}", i.wonder.name())); - Some(PositionRequest::new( cities_for_wonder(i.wonder, game, p.get(game), i.cost.clone()), 1..=1, "Select city to build wonder", )) }, - |game, s, i| { - let position = s.choice[0]; - i.selected_position = Some(position); - s.log( - game, - &format!("Decided to build {} in city {position}", i.wonder.name(),), - ); + |_game, s, i| { + i.selected_position = Some(s.choice[0]); }, ) .add_payment_request_listener( @@ -534,13 +528,13 @@ pub(crate) fn gain_wonder( wonder: Wonder, city_position: Position, ) { - player.log(game, &format!("Gain {} at {city_position}", wonder.name())); log_structure( game, player, Structure::Wonder(wonder), ActionLogBalance::Gain, city_position, + None, ); let p = player.get_mut(game); p.get_city_mut(city_position).pieces.wonders.push(wonder); @@ -570,13 +564,13 @@ pub(crate) fn lose_wonder( "Player does not own the wonder to lose it" ); - player.log(game, &format!("Lose {} at {city_position}", wonder.name())); log_structure( game, player, Structure::Wonder(wonder), ActionLogBalance::Loss, city_position, + None, ); game.player_mut(player.index).wonders_owned.remove(wonder); @@ -625,7 +619,7 @@ fn remove_public_wonder(game: &mut Game) { } pub(crate) fn draw_public_wonder(game: &mut Game, player: &EventPlayer) { - if let Some(wonder) = draw_wonder_from_pile(game) { + if let Some(wonder) = draw_wonder_from_pile(game, player) { player.log( game, &format!("{} is now available to be taken by anyone", wonder.name()), @@ -656,7 +650,7 @@ pub(crate) fn use_draw_replacement_wonder() -> Ability { |game, p, ()| { let player = p.get_mut(game); if player.event_info.remove(DRAW_REPLACEMENT_WONDER).is_some() { - add_start_turn_action_if_needed(game); + add_start_turn_action_if_needed(game, game.active_player()); p.log(game, "Draw a replacement wonder card"); draw_wonder_card(game, p); } diff --git a/server/tests/advances_tests.rs b/server/tests/advances_tests.rs index bb56f76a..b145a720 100644 --- a/server/tests/advances_tests.rs +++ b/server/tests/advances_tests.rs @@ -8,7 +8,9 @@ use server::city_pieces::Building::{Academy, Fortress, Temple}; use server::collect::{PositionCollection, possible_resource_collections}; use server::consts::BUILDING_COST; use server::content::advances::trade_routes::find_trade_routes; -use server::content::custom_actions::{CustomAction, CustomActionType}; +use server::content::custom_actions::{ + CustomAction, CustomActionType, PlayingActionModifier, SpecialAction, +}; use server::content::persistent_events::{EventResponse, SelectedStructure}; use server::cultural_influence::InfluenceCultureAttempt; use server::events::{EventOrigin, check_event_origin}; @@ -227,7 +229,9 @@ fn test_increase_happiness_voting() { (Position::from_offset("B3"), 2), ], ResourcePile::mood_tokens(6), - PlayingActionType::Custom(CustomActionType::VotingIncreaseHappiness), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::VotingIncreaseHappiness, + )), ), )), )], @@ -247,7 +251,9 @@ fn test_increase_happiness_voting_rituals() { (Position::from_offset("B3"), 2), ], ResourcePile::new(1, 0, 1, 3, 1, 0, 0), - PlayingActionType::Custom(CustomActionType::VotingIncreaseHappiness), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::VotingIncreaseHappiness, + )), ), )), )], @@ -611,17 +617,21 @@ fn test_collect_free_economy() { PositionCollection::new(Position::from_offset("B1"), ResourcePile::ore(1)), PositionCollection::new(Position::from_offset("B2"), ResourcePile::ore(1)), ], - PlayingActionType::Custom(CustomActionType::FreeEconomyCollect), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::FreeEconomyCollect, + )), ))), ) .skip_json(), TestAction::undoable(0, payment_response(ResourcePile::mood_tokens(1))) + .skip_json() .with_post_assert(|game| { // no production focus let result = PlayingActionType::ActionCard(19).is_available(&game, game.active_player()); assert!(result.is_err()); }), + TestAction::undoable(0, Action::Response(EventResponse::Bool(true))), ], ); } @@ -639,7 +649,9 @@ fn test_cultural_influence_instant_with_arts() { Position::from_offset("C2"), Structure::Building(Fortress), ), - PlayingActionType::Custom(CustomActionType::ArtsInfluenceCultureAttempt), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::ArtsInfluenceCultureAttempt, + )), ), )), ) diff --git a/server/tests/civ_greece_tests.rs b/server/tests/civ_greece_tests.rs index 85844baa..746e955c 100644 --- a/server/tests/civ_greece_tests.rs +++ b/server/tests/civ_greece_tests.rs @@ -1,7 +1,7 @@ use crate::common::{JsonTest, TestAction, custom_action, move_action, payment_response}; use server::action::Action; use server::city_pieces::Building; -use server::content::custom_actions::CustomActionType; +use server::content::custom_actions::{CustomActionType, PlayingActionModifier, SpecialAction}; use server::content::persistent_events::{EventResponse, SelectedStructure}; use server::cultural_influence::{InfluenceCultureAttempt, affordable_start_city}; use server::playing_actions::{PlayingAction, PlayingActionType}; @@ -45,8 +45,9 @@ fn sparta_battle() { fn hellenistic_culture_staring_point() { let game = &JSON.load_game("hellenistic_culture"); - let action_type = - &PlayingActionType::Custom(CustomActionType::HellenisticInfluenceCultureAttempt); + let action_type = &PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::HellenisticInfluenceCultureAttempt, + )); assert_eq!( affordable_start_city( game, @@ -84,9 +85,9 @@ fn hellenistic_culture_cost() { Position::from_offset("C2"), Structure::Building(Building::Port), ), - PlayingActionType::Custom( - CustomActionType::HellenisticInfluenceCultureAttempt, - ), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::HellenisticInfluenceCultureAttempt, + )), ), )), ) diff --git a/server/tests/civ_rome_tests.rs b/server/tests/civ_rome_tests.rs index 561b306a..f46d3881 100644 --- a/server/tests/civ_rome_tests.rs +++ b/server/tests/civ_rome_tests.rs @@ -5,7 +5,7 @@ use server::action::Action; use server::advance::Advance; use server::city_pieces::Building; use server::construct::Construct; -use server::content::custom_actions::CustomActionType; +use server::content::custom_actions::{CustomActionType, PlayingActionModifier, SpecialAction}; use server::happiness::IncreaseHappiness; use server::movement::{MoveUnits, MovementAction}; use server::playing_actions::{PlayingAction, PlayingActionType}; @@ -113,7 +113,9 @@ fn statesman() { Action::Playing(PlayingAction::IncreaseHappiness(IncreaseHappiness::new( vec![(Position::from_offset("A1"), 1)], ResourcePile::mood_tokens(2), - PlayingActionType::Custom(CustomActionType::StatesmanIncreaseHappiness), + PlayingActionType::Special(SpecialAction::Modifier( + PlayingActionModifier::StatesmanIncreaseHappiness, + )), ))), )], ); diff --git a/server/tests/movement_tests.rs b/server/tests/movement_tests.rs index 81660fdf..ee90f2db 100644 --- a/server/tests/movement_tests.rs +++ b/server/tests/movement_tests.rs @@ -211,18 +211,22 @@ fn test_ship_navigate_coordinates() { let mut game = JSON.load_game("ship_navigation_unit_test"); let pairs = [ - ("B3", "B5"), - ("B5", "A7"), - ("A7", "F7"), - ("G7", "G3"), - ("G3", "B3"), + ("B3", "B5", true), + ("B5", "A7", true), + ("A7", "F7", true), + ("F7", "G3", false), + ("G7", "A7", false), + ("G7", "G3", true), + ("G3", "B3", true), ]; - for pair in pairs { - let from = Position::from_offset(pair.0); - let to = Position::from_offset(pair.1); + for (from, to, back) in pairs { + let from = Position::from_offset(from); + let to = Position::from_offset(to); assert_navigate(&mut game, from, to); - assert_navigate(&mut game, to, from); + if back { + assert_navigate(&mut game, to, from); + } } } diff --git a/server/tests/objective_card_status_phase_tests.rs b/server/tests/objective_card_status_phase_tests.rs index b1ebfcd1..b5190d9f 100644 --- a/server/tests/objective_card_status_phase_tests.rs +++ b/server/tests/objective_card_status_phase_tests.rs @@ -63,7 +63,7 @@ fn test_large_civ() { ])), ) .skip_json(), - TestAction::undoable( + TestAction::not_undoable( 0, Action::Response(EventResponse::SelectHandCards(vec![ HandCard::ObjectiveCard(7), @@ -103,7 +103,7 @@ fn test_standing_army() { "standing_army", vec![ TestAction::not_undoable(1, Action::Playing(PlayingAction::EndTurn)).skip_json(), - TestAction::undoable( + TestAction::not_undoable( 0, Action::Response(EventResponse::SelectHandCards(vec![ HandCard::ObjectiveCard(14), diff --git a/server/tests/random_actions.rs b/server/tests/random_actions.rs index 4dd3266b..1bdece57 100644 --- a/server/tests/random_actions.rs +++ b/server/tests/random_actions.rs @@ -65,7 +65,14 @@ fn random_actions_iteration(mut rng: Rng, cache: Cache) { game_setup::setup_game_with_cache(&GameSetupBuilder::new(2).seed(seed).build(), cache); game.context = GameContext::AI; let mut ai_actions = AiActions::new(); + let mut moves = 0; loop { + moves += 1; + if moves > 10_000 { + let file = format!("random-stalled-{}", game.seed); + write_result(&to_json(&game), &GamePath::new(".", &file)); + panic!("random game exceeded 10000 actions; state stored in {file}.json"); + } if matches!(game.state, GameState::Finished) { break; } diff --git a/server/tests/status_phase_tests.rs b/server/tests/status_phase_tests.rs index 93edbfbf..410dec74 100644 --- a/server/tests/status_phase_tests.rs +++ b/server/tests/status_phase_tests.rs @@ -28,11 +28,12 @@ fn test_free_advance() { JSON.test( "free_advance", vec![ - TestAction::not_undoable(0, Action::Playing(PlayingAction::EndTurn)), + TestAction::not_undoable(0, Action::Playing(PlayingAction::EndTurn)).skip_json(), TestAction::not_undoable( 1, Action::Response(EventResponse::SelectAdvance(advance::Advance::Storage)), - ), + ) + .skip_json(), TestAction::not_undoable( 0, Action::Response(EventResponse::SelectAdvance(advance::Advance::Philosophy)), @@ -117,7 +118,7 @@ fn test_keep_government() { vec![ TestAction::not_undoable(1, Action::Response(EventResponse::SelectPositions(vec![]))) .skip_json(), - TestAction::undoable(0, payment_response(ResourcePile::empty())), + TestAction::not_undoable(0, payment_response(ResourcePile::empty())), ], ); } diff --git a/server/tests/tactics_card_tests.rs b/server/tests/tactics_card_tests.rs index 0c5543cd..bdc3e0d8 100644 --- a/server/tests/tactics_card_tests.rs +++ b/server/tests/tactics_card_tests.rs @@ -131,8 +131,12 @@ fn heavy_resistance_can_resolve_a_battle_at_a_wonder_city() { CustomActionType::GreatLibrary, CustomActionType::GreatLighthouse, ] { - assert!(game.player(0).custom_actions.contains_key(&ability)); - assert!(!game.player(1).custom_actions.contains_key(&ability)); + assert!(game.player(0).special_actions.contains_key( + &server::content::custom_actions::SpecialAction::Custom(ability) + )); + assert!(!game.player(1).special_actions.contains_key( + &server::content::custom_actions::SpecialAction::Custom(ability) + )); } let restored = game.clone(); assert_eq!( diff --git a/server/tests/test_games/action_cards/advance.outcome2.json b/server/tests/test_games/action_cards/advance.outcome2.json index 089a788d..b15a9060 100644 --- a/server/tests/test_games/action_cards/advance.outcome2.json +++ b/server/tests/test_games/action_cards/advance.outcome2.json @@ -198,6 +198,10 @@ "ActionCard": 2 } }, + "player": 0, + "origin": { + "CivilCard": 2 + }, "items": [ { "player": 0, @@ -214,10 +218,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Quick Advance/Encircled", - "Player1: Quick Advance: Pay 1 culture token" ] }, { @@ -230,6 +230,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -237,16 +238,14 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 2 } } ], - "log": [ - "Player1: Quick Advance: Pay 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -254,6 +253,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -271,7 +271,7 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -279,10 +279,7 @@ } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Quick Advance: Gain Storage without taking an event token" - ] + "active_events": 1 } ] } @@ -316,4 +313,4 @@ "action_cards_discarded": [ 2 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/action_cards/assassination.outcome3.json b/server/tests/test_games/action_cards/assassination.outcome3.json index 8f3d0aca..70ef721f 100644 --- a/server/tests/test_games/action_cards/assassination.outcome3.json +++ b/server/tests/test_games/action_cards/assassination.outcome3.json @@ -226,6 +226,10 @@ "ActionCard": 27 } }, + "player": 0, + "origin": { + "CivilCard": 27 + }, "items": [ { "player": 0, @@ -242,10 +246,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Assassination/High Ground", - "Player1: Assassination: Pay 1 culture token" ] }, { @@ -258,6 +258,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -265,23 +266,41 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 27 } + }, + { + "player": 0, + "Text": "Assassinated Player2", + "origin": { + "CivilCard": 27 + } } ], - "log": [ - "Player1: Assassination: Pay 1 culture token, Assassinated Player2" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -293,6 +312,7 @@ "actions": [ { "action": "StartTurn", + "player": 1, "items": [ { "player": 1, @@ -303,17 +323,27 @@ "Ability": "Assassination" } } - ], - "log": [ - "Player2: Assassination: Lose 1 action" ] }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 2 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss", + "amount": 2 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] diff --git a/server/tests/test_games/action_cards/city_development.outcome2.json b/server/tests/test_games/action_cards/city_development.outcome2.json index 62f368aa..72cdfe6f 100644 --- a/server/tests/test_games/action_cards/city_development.outcome2.json +++ b/server/tests/test_games/action_cards/city_development.outcome2.json @@ -217,11 +217,15 @@ "ActionCard": 17 } }, + "player": 0, + "origin": { + "CivilCard": 17 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 17 @@ -242,10 +246,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: City Development: Pay 1 action, Pay 1 culture token", - "Player1: Action Card: Play City Development/Tactical Retreat" ] }, { @@ -258,6 +258,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -265,7 +266,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 17 @@ -279,11 +280,16 @@ "origin": { "CivilCard": 17 } + }, + { + "player": 0, + "Text": "You may build a building in a city without spending an action and without paying resources.", + "origin": { + "CivilCard": 17 + } } ], - "log": [ - "Player1: City Development: Pay 1 culture token, Gain 1 action, You may build a building in a city without spending an action and without paying resources." - ] + "active_events": 1 }, { "action": { @@ -296,11 +302,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -310,7 +320,7 @@ "player": 0, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -324,6 +334,13 @@ } ] }, + { + "player": 0, + "Text": "May replace resources with mood tokens", + "origin": { + "SpecialAdvance": "Captivi" + } + }, { "player": 0, "Structure": { @@ -331,16 +348,13 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Construct Building" } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay nothing with Captivi, Construct Only, Gain Fortress at C2", - "Player1: Captivi: May replace resources with mood tokens" ] } ] diff --git a/server/tests/test_games/action_cards/cultural_takeover.outcome2.json b/server/tests/test_games/action_cards/cultural_takeover.outcome2.json index f3119bd4..f35f0615 100644 --- a/server/tests/test_games/action_cards/cultural_takeover.outcome2.json +++ b/server/tests/test_games/action_cards/cultural_takeover.outcome2.json @@ -235,6 +235,10 @@ "ActionCard": 15 } }, + "player": 0, + "origin": { + "CivilCard": 15 + }, "items": [ { "player": 0, @@ -250,11 +254,14 @@ "origin": { "Ability": "Action Card" } + }, + { + "player": 0, + "Text": "You may influence Barbarian cities of size 1.", + "origin": { + "CivilCard": 15 + } } - ], - "log": [ - "Player1: Action Card: Play Cultural Takeover/Heavy Resistance", - "Player1: Cultural Takeover: You may influence Barbarian cities of size 1." ] }, { @@ -269,19 +276,51 @@ } } }, + "player": 0, + "origin": { + "Ability": "Influence Culture" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" + }, + "origin": { + "Ability": "Influence Culture" + } + }, + { + "player": 0, + "InfluenceCultureAttempt": { + "target_player": 2, + "structure": "CityCenter", + "prevent_boost": false, + "range_boost_cost": { + "default": { + "culture_tokens": 2 + }, + "origin": { + "Ability": "Influence Culture" + } + }, + "info": { + "player": 0, + "origin": { + "Ability": "Influence Culture" + }, + "info": {}, + "log": [] + }, + "roll_boost": 0, + "position": "B3", + "starting_city_position": "A1", + "barbarian_takeover": false }, "origin": { "Ability": "Influence Culture" } } - ], - "log": [ - "Player1: Influence Culture: Pay 1 action, Tried to influence the City Center in the city at B3 by Barbarians with the city A1 and may pay 2 culture tokens to boost the range" ] }, { @@ -294,6 +333,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -301,18 +341,26 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } }, + { + "player": 0, + "Text": "Cultural influence succeeded (rolls 6)", + "origin": { + "Ability": "Influence Culture" + } + }, { "player": 2, "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "B3" + "position": "B3", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -323,7 +371,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "B3" + "position": "B3", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -335,18 +384,15 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "CivilCard": 15 } } ], - "log": [ - "Player1: Influence Culture: Pay 2 culture tokens, Cultural influence succeeded (rolled 6), Gain city B3", - "Barbarians: Influence Culture: Lose city B3", - "Player1: Cultural Takeover: Gain 1 infantry at B3" - ] + "active_events": 1 } ] } @@ -387,4 +433,4 @@ "incidents_left": [ 28 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/action_cards/explorer.outcome4.json b/server/tests/test_games/action_cards/explorer.outcome4.json index 7e0e202c..3cee0c33 100644 --- a/server/tests/test_games/action_cards/explorer.outcome4.json +++ b/server/tests/test_games/action_cards/explorer.outcome4.json @@ -358,11 +358,15 @@ "ActionCard": 21 } }, + "player": 1, + "origin": { + "CivilCard": 21 + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 21 @@ -383,10 +387,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player2: Explorer: Pay 1 action, Pay 1 culture token", - "Player2: Action Card: Play Explorer/Encircled" ] }, { @@ -399,6 +399,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -406,16 +407,14 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 21 } } ], - "log": [ - "Player2: Explorer: Pay 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -425,9 +424,17 @@ ] } }, - "log": [ - "Player2: Explorer: Explored B6" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Explored B6", + "origin": { + "CivilCard": 21 + } + } + ], + "active_events": 1 }, { "action": { @@ -435,9 +442,43 @@ "ExploreResolution": 0 } }, - "log": [ - "Player2: Explore Resolution: Chose rotation 0, Explored tiles A7=Fertile, B6=Fertile, B7=Barren, C7=Fertile" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Chose rotation 0", + "origin": { + "Ability": "Explore Resolution" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "B6", + "Fertile" + ], + [ + "A7", + "Fertile" + ], + [ + "C7", + "Fertile" + ], + [ + "B7", + "Barren" + ] + ] + }, + "origin": { + "Ability": "Explore Resolution" + } + } + ], + "active_events": 2 }, { "action": { @@ -447,6 +488,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -454,16 +496,15 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D8" }, "origin": { "CivilCard": 21 } } ], - "log": [ - "Player2: Explorer: Gain 1 settler at D8" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/great_ideas.outcome1.json b/server/tests/test_games/action_cards/great_ideas.outcome1.json index 40802b8f..7492b2ea 100644 --- a/server/tests/test_games/action_cards/great_ideas.outcome1.json +++ b/server/tests/test_games/action_cards/great_ideas.outcome1.json @@ -209,6 +209,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -233,6 +237,22 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Resources": { @@ -250,7 +270,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -261,18 +282,25 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Player1: Combat: Gain 1 gold, Gain city C1", - "Player2: Combat: Lose city C1", - "Player1: Waste: Could not store 1 gold" ] }, { @@ -281,6 +309,10 @@ "ActionCard": 11 } }, + "player": 0, + "origin": { + "CivilCard": 11 + }, "items": [ { "player": 0, @@ -309,10 +341,6 @@ "CivilCard": 11 } } - ], - "log": [ - "Player1: Action Card: Play Great Ideas/Siege", - "Player1: Great Ideas: Gain 2 ideas" ] } ] diff --git a/server/tests/test_games/action_cards/hero_general.outcome1.json b/server/tests/test_games/action_cards/hero_general.outcome1.json index 128b8e7a..41b70d77 100644 --- a/server/tests/test_games/action_cards/hero_general.outcome1.json +++ b/server/tests/test_games/action_cards/hero_general.outcome1.json @@ -209,11 +209,46 @@ } } }, - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 2 infantry" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + } ] }, { @@ -222,6 +257,7 @@ "SelectHandCards": [] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -249,18 +285,98 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Text": "Did not play a Tactics Card", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -278,7 +394,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -289,21 +406,27 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Tactics: Did not play a Tactics Card", - "Player1: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1", - "Player2: Combat: Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 2 infantry at C1, Lose city C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/hero_general.outcome5.json b/server/tests/test_games/action_cards/hero_general.outcome5.json index e96a3885..10a80722 100644 --- a/server/tests/test_games/action_cards/hero_general.outcome5.json +++ b/server/tests/test_games/action_cards/hero_general.outcome5.json @@ -206,11 +206,46 @@ } } }, - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 2 infantry" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + } ] }, { @@ -219,6 +254,7 @@ "SelectHandCards": [] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -249,18 +285,98 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Text": "Did not play a Tactics Card", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -278,7 +394,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -289,21 +406,27 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Tactics: Did not play a Tactics Card", - "Player1: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1", - "Player2: Combat: Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 2 infantry at C1, Lose city C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 }, { "action": { @@ -311,6 +434,10 @@ "ActionCard": 5 } }, + "player": 0, + "origin": { + "CivilCard": 5 + }, "items": [ { "player": 0, @@ -327,9 +454,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Hero General/Wedge Formation" ] }, { @@ -340,6 +464,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -352,9 +477,7 @@ } } ], - "log": [ - "Player1: Hero General: City C1 became Neutral" - ] + "active_events": 1 }, { "action": { @@ -366,6 +489,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -373,16 +497,14 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 5 } } ], - "log": [ - "Player1: Hero General: Pay 1 mood token" - ] + "active_events": 1 }, { "action": { @@ -392,6 +514,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -404,9 +527,7 @@ } } ], - "log": [ - "Player1: Hero General: City C2 became Happy" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/ideas.outcome.json b/server/tests/test_games/action_cards/ideas.outcome.json index 87cd0b3c..ccf5e004 100644 --- a/server/tests/test_games/action_cards/ideas.outcome.json +++ b/server/tests/test_games/action_cards/ideas.outcome.json @@ -201,6 +201,10 @@ "ActionCard": 9 } }, + "player": 0, + "origin": { + "CivilCard": 9 + }, "items": [ { "player": 0, @@ -229,10 +233,6 @@ "CivilCard": 9 } } - ], - "log": [ - "Player1: Action Card: Play Ideas/High Ground", - "Player1: Ideas: Gain 1 idea" ] } ] diff --git a/server/tests/test_games/action_cards/inspiration.outcome.json b/server/tests/test_games/action_cards/inspiration.outcome.json index ee3a931c..65447e07 100644 --- a/server/tests/test_games/action_cards/inspiration.outcome.json +++ b/server/tests/test_games/action_cards/inspiration.outcome.json @@ -199,6 +199,10 @@ "ActionCard": 3 } }, + "player": 0, + "origin": { + "CivilCard": 3 + }, "items": [ { "player": 0, @@ -231,18 +235,13 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 3 } } - ], - "log": [ - "Player1: Action Card: Play Inspiration/Encircled", - "Player1: Storage: Gain 1 mood token", - "Player1: Inspiration: Gain Storage without taking an event token" ] } ] diff --git a/server/tests/test_games/action_cards/mass_production.outcome1.json b/server/tests/test_games/action_cards/mass_production.outcome1.json index 8e3d2554..6a2985b9 100644 --- a/server/tests/test_games/action_cards/mass_production.outcome1.json +++ b/server/tests/test_games/action_cards/mass_production.outcome1.json @@ -220,6 +220,10 @@ "ActionCard": 29 } }, + "player": 0, + "origin": { + "CivilCard": 29 + }, "items": [ { "player": 0, @@ -235,11 +239,14 @@ "origin": { "Ability": "Action Card" } + }, + { + "player": 0, + "Text": "Can use Mass Production to collect from 2 additional tiles.", + "origin": { + "CivilCard": 29 + } } - ], - "log": [ - "Player1: Action Card: Play Mass Production/Defensive Formation", - "Player1: Mass Production: Can use Mass Production to collect from 2 additional tiles." ] }, { @@ -274,11 +281,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -298,9 +309,6 @@ "Ability": "Collect" } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city C2, Gain 1 wood, 1 ore and 1 mood token" ] } ] diff --git a/server/tests/test_games/action_cards/mercenaries.outcome2.json b/server/tests/test_games/action_cards/mercenaries.outcome2.json index 94161501..613295ba 100644 --- a/server/tests/test_games/action_cards/mercenaries.outcome2.json +++ b/server/tests/test_games/action_cards/mercenaries.outcome2.json @@ -242,11 +242,15 @@ "ActionCard": 13 } }, + "player": 0, + "origin": { + "CivilCard": 13 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 13 @@ -266,11 +270,14 @@ "origin": { "Ability": "Action Card" } + }, + { + "player": 0, + "Text": "Player1 cannot move Barbarian army at A3 because Sulla is in range", + "origin": { + "CivilCard": 13 + } } - ], - "log": [ - "Player1: Mercenaries: Pay 1 action, Player1 cannot move Barbarian army at A3 because Sulla is in range", - "Player1: Action Card: Play Mercenaries/For the People" ] }, { @@ -281,9 +288,17 @@ ] } }, - "log": [ - "Player1: Mercenaries: Selected Barbarian armies to move: B3" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Selected Barbarian armies to move: B3", + "origin": { + "CivilCard": 13 + } + } + ], + "active_events": 1 }, { "action": { @@ -295,6 +310,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "Land", @@ -327,59 +343,156 @@ "resources": { "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 13 } }, + { + "player": 0, + "Text": "Selected Barbarian army to move: B3", + "origin": { + "CivilCard": 13 + } + }, + { + "player": 0, + "Text": "Selected destination for Barbarian army: B2", + "origin": { + "CivilCard": 13 + } + }, + { + "player": 0, + "Move": { + "units": { + "infantry": 2 + }, + "start": "B3", + "destination": "B2" + }, + "origin": { + "CivilCard": 13 + } + }, + { + "player": 2, + "CombatRound": { + "attackers": { + "infantry": 2 + }, + "defending_player": 0, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B3" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B2" }, "origin": { "Ability": "Combat" } }, + { + "player": 2, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 2, "Units": { "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "CivilCard": 13 } } ], - "log": [ - "Player1: Mercenaries: Pay 1 ore, Selected Barbarian army to move: B3, Selected destination for Barbarian army: B2, marched 2 infantry from B3 to B2", - "Combat round 1", - "Barbarians: Combat: Attacking with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against defending units, Lost 1 infantry at B3", - "Player1: Combat: Defending with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units, Lost 1 infantry at B2", - "Barbarians: Choose Casualties: Remove 1 of their attacking units", - "Player1: Choose Casualties: Remove all defending units", - "Attacker wins", - "Barbarians: Mercenaries: Gain 1 infantry at B3" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/militia.outcome1.json b/server/tests/test_games/action_cards/militia.outcome1.json index 4380eed9..e7a3dbca 100644 --- a/server/tests/test_games/action_cards/militia.outcome1.json +++ b/server/tests/test_games/action_cards/militia.outcome1.json @@ -199,6 +199,10 @@ "ActionCard": 37 } }, + "player": 0, + "origin": { + "CivilCard": 37 + }, "items": [ { "player": 0, @@ -215,10 +219,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Militia/Wedge Formation", - "Player1: Militia: Pay 1 culture token" ] }, { @@ -231,6 +231,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -238,7 +239,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 37 @@ -250,16 +251,15 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "CivilCard": 37 } } ], - "log": [ - "Player1: Militia: Pay 1 culture token, Gain 1 infantry at A1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/negotiations.outcome4.json b/server/tests/test_games/action_cards/negotiations.outcome4.json index 4a6f43b8..76dcf203 100644 --- a/server/tests/test_games/action_cards/negotiations.outcome4.json +++ b/server/tests/test_games/action_cards/negotiations.outcome4.json @@ -221,6 +221,10 @@ "ActionCard": 23 } }, + "player": 0, + "origin": { + "CivilCard": 23 + }, "items": [ { "player": 0, @@ -237,10 +241,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Negotiations/Scout", - "Player1: Negotiations: Pay 1 culture token" ] }, { @@ -253,6 +253,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -260,23 +261,41 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 23 } + }, + { + "player": 0, + "Text": "Started negotiations with Player2", + "origin": { + "CivilCard": 23 + } } ], - "log": [ - "Player1: Negotiations: Pay 1 culture token, Started negotiations with Player2" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -288,16 +307,36 @@ "actions": [ { "action": "StartTurn", - "log": [ - "Player2: Negotiations: May not attack Player1 this turn." + "player": 1, + "items": [ + { + "player": 1, + "Text": "May not attack Player1 this turn.", + "origin": { + "Ability": "Negotiations" + } + } ] }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 3 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -314,8 +353,15 @@ "actions": [ { "action": "StartTurn", - "log": [ - "Player1: Negotiations: May attack Player2 again." + "player": 0, + "items": [ + { + "player": 0, + "Text": "May attack Player2 again.", + "origin": { + "Ability": "Negotiations" + } + } ] }, { @@ -329,6 +375,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Land", @@ -357,46 +407,123 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "B1" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to B1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Defending with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units, Lost 1 infantry at B1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Battle ends in a draw" ] } ] diff --git a/server/tests/test_games/action_cards/new_ideas.outcome2.json b/server/tests/test_games/action_cards/new_ideas.outcome2.json index fbfb9c66..db330180 100644 --- a/server/tests/test_games/action_cards/new_ideas.outcome2.json +++ b/server/tests/test_games/action_cards/new_ideas.outcome2.json @@ -200,11 +200,15 @@ "ActionCard": 41 } }, + "player": 0, + "origin": { + "CivilCard": 41 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 41 @@ -225,10 +229,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: New Ideas: Pay 1 action", - "Player1: Action Card: Play New Ideas/High Morale" ] }, { @@ -237,9 +237,17 @@ "SelectAdvance": "Storage" } }, - "log": [ - "Player1: New Ideas: Selected Storage as advance for New Ideas." - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Selected Storage as advance for New Ideas.", + "origin": { + "CivilCard": 41 + } + } + ], + "active_events": 1 }, { "action": { @@ -251,6 +259,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -258,7 +267,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -280,7 +289,7 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -300,11 +309,7 @@ } } ], - "log": [ - "Player1: Advance: Pay 2 food", - "Player1: Storage: Gain 1 mood token", - "Player1: New Ideas: Gain Storage without taking an event token, Gain 2 ideas" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/new_plans.outcome2.json b/server/tests/test_games/action_cards/new_plans.outcome2.json index dd85eee0..6d631cad 100644 --- a/server/tests/test_games/action_cards/new_plans.outcome2.json +++ b/server/tests/test_games/action_cards/new_plans.outcome2.json @@ -210,11 +210,15 @@ "ActionCard": 31 } }, + "player": 0, + "origin": { + "CivilCard": 31 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 31 @@ -235,10 +239,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: New Plans: Pay 1 action, Pay 1 culture token", - "Player1: Action Card: Play New Plans/Flanking" ] }, { @@ -251,6 +251,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -258,7 +259,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 31 @@ -295,9 +296,7 @@ } } ], - "log": [ - "Player1: New Plans: Pay 1 culture token, Draw an objective card, Draw an objective card" - ] + "active_events": 1 }, { "action": { @@ -312,6 +311,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -344,9 +344,7 @@ } } ], - "log": [ - "Player1: New Plans: Shuffle an objective card back into the draw pile, Reshuffled a card from the draw pile back into the draw pile" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/production_focus.outcome1.json b/server/tests/test_games/action_cards/production_focus.outcome1.json index 8e2b00cb..956e8b41 100644 --- a/server/tests/test_games/action_cards/production_focus.outcome1.json +++ b/server/tests/test_games/action_cards/production_focus.outcome1.json @@ -221,6 +221,10 @@ "ActionCard": 19 } }, + "player": 0, + "origin": { + "CivilCard": 19 + }, "items": [ { "player": 0, @@ -236,11 +240,14 @@ "origin": { "Ability": "Action Card" } + }, + { + "player": 0, + "Text": "Production Focus: You may collect multiple times from the same tile.", + "origin": { + "CivilCard": 19 + } } - ], - "log": [ - "Player1: Action Card: Play Production Focus/Tactical Retreat", - "Player1: Production Focus: Production Focus: You may collect multiple times from the same tile." ] }, { @@ -275,11 +282,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -298,11 +309,19 @@ "origin": { "Ability": "Collect" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city C2, Gain 2 ore, 1 gold and 2 mood tokens", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/action_cards/spy.outcome2.json b/server/tests/test_games/action_cards/spy.outcome2.json index 808951ae..dbe5782d 100644 --- a/server/tests/test_games/action_cards/spy.outcome2.json +++ b/server/tests/test_games/action_cards/spy.outcome2.json @@ -214,11 +214,15 @@ "ActionCard": 7 } }, + "player": 0, + "origin": { + "CivilCard": 7 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 7 @@ -239,10 +243,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Spy: Pay 1 action, Pay 1 culture token", - "Player1: Action Card: Play Spy/Heavy Resistance" ] }, { @@ -255,6 +255,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -262,16 +263,21 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 7 } + }, + { + "player": 0, + "Text": "Looked at the Wonder, Action, and Objective cards in the hand of Player2", + "origin": { + "CivilCard": 7 + } } ], - "log": [ - "Player1: Spy: Pay 1 culture token, Looked at the Wonder, Action, and Objective cards in the hand of Player2" - ] + "active_events": 1 }, { "action": { @@ -286,6 +292,7 @@ ] } }, + "player": 0, "items": [ { "player": 1, @@ -320,12 +327,16 @@ "origin": { "CivilCard": 7 } + }, + { + "player": 0, + "Text": "Decided to swap an action card with Player2", + "origin": { + "CivilCard": 7 + } } ], - "log": [ - "Player2: Spy: Gain an action card from Player1", - "Player1: Spy: Gain an action card from Player2, Decided to swap an action card with Player2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/synergies.outcome4.json b/server/tests/test_games/action_cards/synergies.outcome4.json index 2e0a9b69..a3bb0e31 100644 --- a/server/tests/test_games/action_cards/synergies.outcome4.json +++ b/server/tests/test_games/action_cards/synergies.outcome4.json @@ -219,11 +219,15 @@ "ActionCard": 34 } }, + "player": 0, + "origin": { + "CivilCard": 34 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 34 @@ -244,10 +248,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Synergies: Pay 1 action", - "Player1: Action Card: Play Synergies/Archers" ] }, { @@ -256,9 +256,17 @@ "SelectAdvance": "Fishing" } }, - "log": [ - "Player1: Synergies: Selected Fishing as first advance" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Selected Fishing as first advance", + "origin": { + "CivilCard": 34 + } + } + ], + "active_events": 1 }, { "action": { @@ -270,6 +278,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -277,7 +286,7 @@ "resources": { "ideas": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -299,7 +308,7 @@ "player": 0, "Advance": { "advance": "Fishing", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -307,11 +316,7 @@ } } ], - "log": [ - "Player1: Advance: Pay 2 ideas", - "Player1: Fishing: Gain 1 mood token", - "Player1: Synergies: Gain Fishing without taking an event token" - ] + "active_events": 1 }, { "action": { @@ -319,9 +324,17 @@ "SelectAdvance": "WarShips" } }, - "log": [ - "Player1: Synergies: Selected WarShips as second advance" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Selected WarShips as second advance", + "origin": { + "CivilCard": 34 + } + } + ], + "active_events": 1 }, { "action": { @@ -333,6 +346,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -340,7 +354,7 @@ "resources": { "ideas": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -350,7 +364,7 @@ "player": 0, "Advance": { "advance": "WarShips", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -358,10 +372,7 @@ } } ], - "log": [ - "Player1: Advance: Pay 2 ideas", - "Player1: Synergies: Gain WarShips without taking an event token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/teach_us.outcome1.json b/server/tests/test_games/action_cards/teach_us.outcome1.json index 5ebe587c..851c1522 100644 --- a/server/tests/test_games/action_cards/teach_us.outcome1.json +++ b/server/tests/test_games/action_cards/teach_us.outcome1.json @@ -213,6 +213,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -240,18 +244,126 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -269,7 +381,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -280,21 +393,25 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 2 infantry at C1, Lose city C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] }, { @@ -307,6 +424,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -369,7 +487,7 @@ "player": 0, "Advance": { "advance": "Writing", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -377,10 +495,7 @@ } } ], - "log": [ - "Player1: Teach us: Play Teach Us/Defensive Formation, Gain Writing without taking an event token", - "Player1: Writing: Draw an action card, Draw an objective card, Gain 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/action_cards/tech_trade.outcome.json b/server/tests/test_games/action_cards/tech_trade.outcome.json index 7fb2b3f5..a08afa3a 100644 --- a/server/tests/test_games/action_cards/tech_trade.outcome.json +++ b/server/tests/test_games/action_cards/tech_trade.outcome.json @@ -211,6 +211,10 @@ "ActionCard": 39 } }, + "player": 0, + "origin": { + "CivilCard": 39 + }, "items": [ { "player": 0, @@ -227,6 +231,13 @@ "Ability": "Action Card" } }, + { + "player": 0, + "Text": "Selected Player2 as trade partner", + "origin": { + "CivilCard": 39 + } + }, { "player": 0, "Resources": { @@ -243,7 +254,7 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -266,20 +277,13 @@ "player": 1, "Advance": { "advance": "Fishing", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 39 } } - ], - "log": [ - "Player1: Action Card: Play Technology Trade/Surprise", - "Player1: Technology Trade: Selected Player2 as trade partner, Gain Storage without taking an event token", - "Player1: Storage: Gain 1 mood token", - "Player2: Fishing: Gain 1 mood token", - "Player2: Technology Trade: Gain Fishing without taking an event token" ] } ] diff --git a/server/tests/test_games/advances/absolute_power.outcome1.json b/server/tests/test_games/advances/absolute_power.outcome1.json index 16223758..2fb05902 100644 --- a/server/tests/test_games/advances/absolute_power.outcome1.json +++ b/server/tests/test_games/advances/absolute_power.outcome1.json @@ -102,7 +102,9 @@ ], "next_unit_id": 7, "played_once_per_turn_actions": [ - "AbsolutePower" + { + "Custom": "AbsolutePower" + } ] }, { @@ -240,9 +242,10 @@ } } }, - "log": [ - "Player1: Absolute Power: Start action, Pay 2 mood tokens" - ] + "player": 0, + "origin": { + "Advance": "AbsolutePower" + } }, { "action": { @@ -254,6 +257,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -261,7 +265,7 @@ "resources": { "mood_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "AbsolutePower" @@ -277,9 +281,7 @@ } } ], - "log": [ - "Player1: Absolute Power: Pay 2 mood tokens, Gain 1 action" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/bartering.outcome1.json b/server/tests/test_games/advances/bartering.outcome1.json index e1ebe0ca..d84e3f5e 100644 --- a/server/tests/test_games/advances/bartering.outcome1.json +++ b/server/tests/test_games/advances/bartering.outcome1.json @@ -88,7 +88,9 @@ "incident_tokens": 2, "next_unit_id": 8, "played_once_per_turn_actions": [ - "Bartering" + { + "Custom": "Bartering" + } ] }, { @@ -206,6 +208,10 @@ } } }, + "player": 0, + "origin": { + "Advance": "Bartering" + }, "items": [ { "player": 0, @@ -222,9 +228,6 @@ "Ability": "Bartering" } } - ], - "log": [ - "Player1: Bartering: Start action, Discard Quick Advance/Peltasts" ] }, { @@ -235,6 +238,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -247,12 +251,21 @@ "origin": { "Ability": "Bartering" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Bartering: Gain 1 gold", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/civil_liberties.outcome.json b/server/tests/test_games/advances/civil_liberties.outcome.json index 36d90420..8b6bb516 100644 --- a/server/tests/test_games/advances/civil_liberties.outcome.json +++ b/server/tests/test_games/advances/civil_liberties.outcome.json @@ -203,11 +203,15 @@ } } }, + "player": 0, + "origin": { + "Advance": "CivilLiberties" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "CivilLiberties" @@ -225,9 +229,6 @@ "Ability": "Civil Liberties" } } - ], - "log": [ - "Player1: Civil Liberties: Pay 1 action, Start action, Gain 3 mood tokens" ] } ] diff --git a/server/tests/test_games/advances/civil_liberties.outcome1.json b/server/tests/test_games/advances/civil_liberties.outcome1.json index dcde4a7b..6fa626ed 100644 --- a/server/tests/test_games/advances/civil_liberties.outcome1.json +++ b/server/tests/test_games/advances/civil_liberties.outcome1.json @@ -209,11 +209,15 @@ } } }, + "player": 0, + "origin": { + "Advance": "CivilLiberties" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "CivilLiberties" @@ -231,9 +235,6 @@ "Ability": "Civil Liberties" } } - ], - "log": [ - "Player1: Civil Liberties: Pay 1 action, Start action, Gain 3 mood tokens" ] }, { @@ -250,11 +251,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -266,7 +271,7 @@ "resources": { "mood_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -277,22 +282,26 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 2 mood tokens with Draft, Gain 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token" ] } ] diff --git a/server/tests/test_games/advances/collect_fishing.outcome.json b/server/tests/test_games/advances/collect_fishing.outcome.json index ef0d8628..8b74cfad 100644 --- a/server/tests/test_games/advances/collect_fishing.outcome.json +++ b/server/tests/test_games/advances/collect_fishing.outcome.json @@ -296,11 +296,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -317,11 +321,19 @@ "origin": { "Ability": "Collect" } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city C2, Gain 1 food", - "Player1: Waste: Could not store 1 food" ] } ] diff --git a/server/tests/test_games/advances/collect_free_economy.json b/server/tests/test_games/advances/collect_free_economy.json index 747c08a1..9b7eab27 100644 --- a/server/tests/test_games/advances/collect_free_economy.json +++ b/server/tests/test_games/advances/collect_free_economy.json @@ -6,9 +6,7 @@ "resources": { "food": 1, "wood": 6, - "ore": 7, "ideas": 5, - "gold": 7, "mood_tokens": 6, "culture_tokens": 7 }, diff --git a/server/tests/test_games/advances/collect_free_economy.outcome1.json b/server/tests/test_games/advances/collect_free_economy.outcome2.json similarity index 78% rename from server/tests/test_games/advances/collect_free_economy.outcome1.json rename to server/tests/test_games/advances/collect_free_economy.outcome2.json index e1ccfb40..8c71dc55 100644 --- a/server/tests/test_games/advances/collect_free_economy.outcome1.json +++ b/server/tests/test_games/advances/collect_free_economy.outcome2.json @@ -6,9 +6,9 @@ "resources": { "food": 1, "wood": 6, - "ore": 7, + "ore": 1, "ideas": 5, - "gold": 7, + "gold": 1, "mood_tokens": 5, "culture_tokens": 7 }, @@ -91,7 +91,9 @@ ], "next_unit_id": 8, "played_once_per_turn_actions": [ - "FreeEconomyCollect" + { + "Modifier": "FreeEconomyCollect" + } ] }, { @@ -223,14 +225,17 @@ } ], "action_type": { - "Custom": "FreeEconomyCollect" + "Special": { + "Modifier": "FreeEconomyCollect" + } } } } }, - "log": [ - "Player1: Free Economy: Pay 1 mood token" - ] + "player": 0, + "origin": { + "Advance": "FreeEconomy" + } }, { "action": { @@ -242,6 +247,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -249,7 +255,7 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "FreeEconomy" @@ -259,8 +265,7 @@ "player": 0, "Resources": { "resources": { - "ore": 1, - "gold": 1 + "ore": 2 }, "balance": "Gain" }, @@ -269,11 +274,42 @@ } } ], - "log": [ - "Player1: Free Economy: Pay 1 mood token, Use city C2, Gain 1 ore and 1 gold", - "Player1: Metallurgy: Convert 1 ore to 1 gold", - "Player1: Waste: Could not store 1 ore and 1 gold" - ] + "active_events": 1 + }, + { + "action": { + "Response": { + "Bool": true + } + }, + "player": 0, + "items": [ + { + "player": 0, + "Resources": { + "resources": { + "ore": 1 + }, + "balance": "Pay" + }, + "origin": { + "Advance": "Metallurgy" + } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Gain" + }, + "origin": { + "Advance": "Metallurgy" + } + } + ], + "active_events": 1 } ] } @@ -282,7 +318,7 @@ ] } ], - "log_index": 2, + "log_index": 3, "undo_limit": 0, "actions_left": 3, "round": 2, diff --git a/server/tests/test_games/advances/collect_husbandry.outcome.json b/server/tests/test_games/advances/collect_husbandry.outcome.json index 9f9bb36d..f0a5f50d 100644 --- a/server/tests/test_games/advances/collect_husbandry.outcome.json +++ b/server/tests/test_games/advances/collect_husbandry.outcome.json @@ -291,11 +291,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -322,12 +326,26 @@ "origin": { "Ability": "Collect" } + }, + { + "player": 0, + "Text": "Can collect 1 resources from 2 land spaces away", + "origin": { + "Advance": "Husbandry" + } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city B3, City B3 became Neutral, Gain 1 food", - "Player1: Husbandry: Can collect 1 resources from 2 land spaces away", - "Player1: Waste: Could not store 1 food" ] } ] diff --git a/server/tests/test_games/advances/collect_port.outcome.json b/server/tests/test_games/advances/collect_port.outcome.json index 5bc176c3..dd5180fc 100644 --- a/server/tests/test_games/advances/collect_port.outcome.json +++ b/server/tests/test_games/advances/collect_port.outcome.json @@ -295,11 +295,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -317,9 +321,6 @@ "Ability": "Collect" } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city C2, Gain 1 mood token" ] } ] diff --git a/server/tests/test_games/advances/cultural_influence_instant_with_arts.outcome1.json b/server/tests/test_games/advances/cultural_influence_instant_with_arts.outcome1.json index c738f37c..74fb1165 100644 --- a/server/tests/test_games/advances/cultural_influence_instant_with_arts.outcome1.json +++ b/server/tests/test_games/advances/cultural_influence_instant_with_arts.outcome1.json @@ -133,7 +133,9 @@ "incident_tokens": 3, "next_unit_id": 2, "played_once_per_turn_actions": [ - "ArtsInfluenceCultureAttempt" + { + "Modifier": "ArtsInfluenceCultureAttempt" + } ] } ], @@ -206,14 +208,17 @@ } }, "action_type": { - "Custom": "ArtsInfluenceCultureAttempt" + "Special": { + "Modifier": "ArtsInfluenceCultureAttempt" + } } } } }, - "log": [ - "Player2: Arts: Pay 1 culture token" - ] + "player": 1, + "origin": { + "Advance": "Arts" + } }, { "action": { @@ -225,6 +230,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -232,12 +238,50 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Arts" } }, + { + "player": 1, + "InfluenceCultureAttempt": { + "target_player": 0, + "structure": { + "Building": "Fortress" + }, + "prevent_boost": false, + "range_boost_cost": { + "default": {}, + "origin": { + "Advance": "Arts" + } + }, + "info": { + "player": 1, + "origin": { + "Advance": "Arts" + }, + "info": {}, + "log": [] + }, + "roll_boost": 0, + "position": "C2", + "starting_city_position": "C1", + "barbarian_takeover": false + }, + "origin": { + "Advance": "Arts" + } + }, + { + "player": 1, + "Text": "Cultural influence succeeded (rolls 6)", + "origin": { + "Advance": "Arts" + } + }, { "player": 0, "Structure": { @@ -245,7 +289,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Advance": "Arts" @@ -258,17 +303,15 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Advance": "Arts" } } ], - "log": [ - "Player2: Arts: Pay 1 culture token, Tried to influence the Fortress in the city at C2 by Player1 with the city C1, Cultural influence succeeded (rolled 6), Gain Fortress at C2", - "Player1: Arts: Lose Fortress at C2" - ] + "active_events": 1 } ] } @@ -303,4 +346,4 @@ "wonders_left": [ "Pyramids" ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json b/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json index 5756ef6e..edd82ea7 100644 --- a/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json +++ b/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json @@ -219,19 +219,60 @@ } } }, + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" + }, + "origin": { + "Ability": "Influence Culture" + } + }, + { + "player": 1, + "InfluenceCultureAttempt": { + "target_player": 0, + "structure": { + "Building": "Temple" + }, + "prevent_boost": false, + "range_boost_cost": { + "default": { + "culture_tokens": 1 + }, + "origin": { + "Ability": "Influence Culture" + } + }, + "info": { + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, + "info": {}, + "log": [ + [ + { + "Advance": "Conversion" + }, + "gains +1 to Influence Culture roll" + ] + ] + }, + "roll_boost": 1, + "position": "C2", + "starting_city_position": "B3", + "barbarian_takeover": false }, "origin": { "Ability": "Influence Culture" } } - ], - "log": [ - "Player2: Influence Culture: Pay 1 action, Tried to influence the Temple in the city at C2 by Player1 with the city B3 and may pay 1 culture token to boost the range" ] }, { @@ -244,6 +285,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -251,17 +293,28 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } + }, + { + "player": 1, + "Text": "gains +1 to Influence Culture roll", + "origin": { + "Advance": "Conversion" + } + }, + { + "player": 1, + "Text": "rolls a 2 and now has the option to pay 3 culture tokens to increase the dice roll and proceed with the cultural influence", + "origin": { + "Ability": "Influence Culture" + } } ], - "log": [ - "Player2: Influence Culture: Pay 1 culture token, Rolled a 2 and now has the option to pay 3 culture tokens to increase the dice roll and proceed with the cultural influence", - "Player2: Conversion: Gain +1 to Influence Culture roll for Conversion Advance" - ] + "active_events": 1 }, { "action": { @@ -273,6 +326,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -280,12 +334,19 @@ "resources": { "culture_tokens": 3 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } }, + { + "player": 1, + "Text": "pays to increase the dice roll", + "origin": { + "Ability": "Influence Culture" + } + }, { "player": 0, "Structure": { @@ -293,7 +354,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -306,7 +368,8 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -325,11 +388,7 @@ } } ], - "log": [ - "Player2: Influence Culture: Pay 3 culture tokens, Paying to increase the dice roll, Gain Temple at C2", - "Player1: Influence Culture: Lose Temple at C2", - "Player2: Conversion: Gain 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/dogma.outcome3.json b/server/tests/test_games/advances/dogma.outcome3.json index 9c41ad09..e52be4fe 100644 --- a/server/tests/test_games/advances/dogma.outcome3.json +++ b/server/tests/test_games/advances/dogma.outcome3.json @@ -305,11 +305,54 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" + }, + "origin": { + "Ability": "Advance" + } + }, + { + "player": 1, + "Resources": { + "resources": { + "ideas": 2 + }, + "balance": "Pay" + }, + "origin": { + "Ability": "Advance" + } + }, + { + "player": 1, + "Text": "Ideas limit reduced to 2", + "origin": { + "Advance": "Dogma" + } + }, + { + "player": 1, + "Text": "unlocks Provinces", + "origin": { + "Ability": "Advance" + } + }, + { + "player": 1, + "Advance": { + "advance": "Dogma", + "incident_token": { + "Take": 1 + }, + "balance": "Gain" }, "origin": { "Ability": "Advance" @@ -324,25 +367,9 @@ "balance": "Loss" }, "origin": { - "Ability": "Advance" - } - }, - { - "player": 1, - "Advance": { - "advance": "Dogma", - "take_incident_token": true, - "balance": "Gain" - }, - "origin": { - "Ability": "Advance" + "Ability": "Waste" } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay 2 ideas, Unlock Provinces, Gain Dogma and take an event token (1 left)", - "Player2: Dogma: Ideas limit reduced to 2", - "Player2: Waste: Could not store 2 ideas" ] }, { @@ -359,11 +386,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -376,7 +407,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -387,6 +418,13 @@ } ] }, + { + "player": 1, + "Text": "Reduce the food cost to 0", + "origin": { + "Advance": "StateReligion" + } + }, { "player": 1, "Structure": { @@ -394,16 +432,13 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Construct Building" } } - ], - "log": [ - "Player2: Construct Building: Pay 1 action, Pay 1 wood and 1 ore with State Religion, Gain Temple at C1", - "Player2: State Religion: Reduce the food cost to 0" ] }, { @@ -414,6 +449,7 @@ } } }, + "player": 1, "items": [ { "player": 1, @@ -428,9 +464,7 @@ } } ], - "log": [ - "Player2: Temple: Gain 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -438,23 +472,33 @@ "SelectAdvance": "Fanaticism" } }, + "player": 1, "items": [ { "player": 1, "Advance": { "advance": "Fanaticism", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Advance": "Dogma" } }, + { + "player": 1, + "Text": "triggers the event Anarchy", + "origin": { + "Advance": "Fanaticism" + } + }, { "player": 1, "Advance": { "advance": "Dogma", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { @@ -465,19 +509,22 @@ "player": 1, "Advance": { "advance": "Fanaticism", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { "Incident": 44 } + }, + { + "player": 1, + "Text": "Lose 2 government advances due to Anarchy - adding 2 victory points", + "origin": { + "Incident": 44 + } } ], - "log": [ - "Player2: Dogma: Gain Fanaticism and take an event token (triggering an incident)", - "A new game event has been triggered: Anarchy", - "Player2: Anarchy: Lose 2 government advances due to Anarchy - adding 2 victory points" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/forced_labor.outcome2.json b/server/tests/test_games/advances/forced_labor.outcome2.json index d54f72ff..006d099f 100644 --- a/server/tests/test_games/advances/forced_labor.outcome2.json +++ b/server/tests/test_games/advances/forced_labor.outcome2.json @@ -104,7 +104,9 @@ ], "next_unit_id": 7, "played_once_per_turn_actions": [ - "ForcedLabor" + { + "Custom": "ForcedLabor" + } ] }, { @@ -242,9 +244,10 @@ } } }, - "log": [ - "Player1: Forced Labor: Start action, Pay 1 mood token" - ] + "player": 0, + "origin": { + "Advance": "ForcedLabor" + } }, { "action": { @@ -256,6 +259,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -263,16 +267,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "ForcedLabor" } + }, + { + "player": 0, + "Text": "Treating Angry cities as neutral", + "origin": { + "Ability": "Forced Labor" + } } ], - "log": [ - "Player1: Forced Labor: Pay 1 mood token, Treating Angry cities as neutral" - ] + "active_events": 1 }, { "action": { @@ -299,11 +308,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -321,11 +334,20 @@ "origin": { "Ability": "Collect" } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 1, + "wood": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city A1, Gain 1 food and 1 wood", - "Player1: Waste: Could not store 1 food and 1 wood" ] } ] diff --git a/server/tests/test_games/advances/free_education.outcome.json b/server/tests/test_games/advances/free_education.outcome.json index 51b9a3cd..49e09888 100644 --- a/server/tests/test_games/advances/free_education.outcome.json +++ b/server/tests/test_games/advances/free_education.outcome.json @@ -343,11 +343,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -360,7 +364,7 @@ "food": 1, "gold": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -382,17 +386,15 @@ "player": 0, "Advance": { "advance": "Draft", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 1 food and 1 gold, Gain Draft and take an event token (1 left)", - "Player1: Draft: Gain 1 culture token" ] } ] diff --git a/server/tests/test_games/advances/free_education.outcome1.json b/server/tests/test_games/advances/free_education.outcome1.json index 707b344c..485c63f2 100644 --- a/server/tests/test_games/advances/free_education.outcome1.json +++ b/server/tests/test_games/advances/free_education.outcome1.json @@ -282,11 +282,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -299,7 +303,7 @@ "food": 1, "gold": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -321,17 +325,15 @@ "player": 0, "Advance": { "advance": "Draft", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 1 food and 1 gold, Gain Draft and take an event token (1 left)", - "Player1: Draft: Gain 1 culture token" ] }, { @@ -344,6 +346,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -351,7 +354,7 @@ "resources": { "ideas": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "FreeEducation" @@ -370,9 +373,7 @@ } } ], - "log": [ - "Player1: Free Education: Pay 1 idea, Gain 1 mood token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/increase_happiness_sports.outcome1.json b/server/tests/test_games/advances/increase_happiness_sports.outcome1.json index 8d267352..3f8f00fc 100644 --- a/server/tests/test_games/advances/increase_happiness_sports.outcome1.json +++ b/server/tests/test_games/advances/increase_happiness_sports.outcome1.json @@ -263,19 +263,20 @@ } } }, + "player": 0, + "origin": { + "Advance": "Sports" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Sports" } } - ], - "log": [ - "Player1: Sports: Pay 1 action, Start action in city C2" ] }, { @@ -288,6 +289,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -295,7 +297,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Sports" @@ -312,9 +314,7 @@ } } ], - "log": [ - "Player1: Sports: Pay 1 culture token, City C2 became Neutral" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/increase_happiness_sports2.outcome1.json b/server/tests/test_games/advances/increase_happiness_sports2.outcome1.json index 6d7bab3b..67e053b9 100644 --- a/server/tests/test_games/advances/increase_happiness_sports2.outcome1.json +++ b/server/tests/test_games/advances/increase_happiness_sports2.outcome1.json @@ -263,19 +263,20 @@ } } }, + "player": 0, + "origin": { + "Advance": "Sports" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Sports" } } - ], - "log": [ - "Player1: Sports: Pay 1 action, Start action in city C2" ] }, { @@ -288,6 +289,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -295,7 +297,7 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Sports" @@ -312,9 +314,7 @@ } } ], - "log": [ - "Player1: Sports: Pay 2 culture tokens, City C2 became Happy" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/increase_happiness_voting.outcome.json b/server/tests/test_games/advances/increase_happiness_voting.outcome.json index d23a56db..786791f7 100644 --- a/server/tests/test_games/advances/increase_happiness_voting.outcome.json +++ b/server/tests/test_games/advances/increase_happiness_voting.outcome.json @@ -270,11 +270,17 @@ "mood_tokens": 6 }, "action_type": { - "Custom": "VotingIncreaseHappiness" + "Special": { + "Modifier": "VotingIncreaseHappiness" + } } } } }, + "player": 0, + "origin": { + "Advance": "Voting" + }, "items": [ { "player": 0, @@ -302,15 +308,12 @@ "resources": { "mood_tokens": 6 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Voting" } } - ], - "log": [ - "Player1: Voting: Pay 1 mood token, City C2 became Neutral, City B3 became Happy, Pay 6 mood tokens" ] } ] diff --git a/server/tests/test_games/advances/increase_happiness_voting_rituals.outcome.json b/server/tests/test_games/advances/increase_happiness_voting_rituals.outcome.json index 2b60a2c5..8e42122d 100644 --- a/server/tests/test_games/advances/increase_happiness_voting_rituals.outcome.json +++ b/server/tests/test_games/advances/increase_happiness_voting_rituals.outcome.json @@ -274,11 +274,17 @@ "gold": 1 }, "action_type": { - "Custom": "VotingIncreaseHappiness" + "Special": { + "Modifier": "VotingIncreaseHappiness" + } } } } }, + "player": 0, + "origin": { + "Advance": "Voting" + }, "items": [ { "player": 0, @@ -309,7 +315,7 @@ "ideas": 3, "gold": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Voting" @@ -319,11 +325,14 @@ "Advance": "Rituals" } ] + }, + { + "player": 0, + "Text": "Can pay with any resource", + "origin": { + "Advance": "Rituals" + } } - ], - "log": [ - "Player1: Voting: Pay 1 mood token, City C2 became Neutral, City B3 became Happy, Pay 1 food, 1 ore, 3 ideas and 1 gold with Rituals", - "Player1: Rituals: Can pay with any resource" ] } ] diff --git a/server/tests/test_games/advances/movement_on_roads_from_city.outcome.json b/server/tests/test_games/advances/movement_on_roads_from_city.outcome.json index 2737e4ce..13718ab1 100644 --- a/server/tests/test_games/advances/movement_on_roads_from_city.outcome.json +++ b/server/tests/test_games/advances/movement_on_roads_from_city.outcome.json @@ -359,7 +359,24 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "D8", + "destination": "F7" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 1, "Resources": { @@ -367,7 +384,7 @@ "food": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -378,9 +395,6 @@ } ] } - ], - "log": [ - "Player2: Move: marched 1 settler from D8 to F7 on roads for 1 food and 1 ore, Pay 1 food and 1 ore with Roads" ] } ] diff --git a/server/tests/test_games/advances/movement_on_roads_to_city.outcome.json b/server/tests/test_games/advances/movement_on_roads_to_city.outcome.json index 7164f258..0c626316 100644 --- a/server/tests/test_games/advances/movement_on_roads_to_city.outcome.json +++ b/server/tests/test_games/advances/movement_on_roads_to_city.outcome.json @@ -350,7 +350,24 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "F7", + "destination": "D8" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 1, "Resources": { @@ -358,7 +375,7 @@ "food": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -369,9 +386,6 @@ } ] } - ], - "log": [ - "Player2: Move: marched 1 settler from F7 to D8 on roads for 1 food and 1 ore, Pay 1 food and 1 ore with Roads" ] } ] diff --git a/server/tests/test_games/advances/priesthood.outcome.json b/server/tests/test_games/advances/priesthood.outcome.json index 774faca8..12f2ddc5 100644 --- a/server/tests/test_games/advances/priesthood.outcome.json +++ b/server/tests/test_games/advances/priesthood.outcome.json @@ -293,11 +293,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -307,7 +311,7 @@ "player": 1, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -318,6 +322,13 @@ } ] }, + { + "player": 1, + "Text": "Reduce the cost to 0", + "origin": { + "Advance": "Priesthood" + } + }, { "player": 1, "Resources": { @@ -334,7 +345,9 @@ "player": 1, "Advance": { "advance": "Math", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { @@ -353,12 +366,6 @@ "Advance": "Philosophy" } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay nothing with Priesthood, Gain Math and take an event token (2 left)", - "Player2: Priesthood: Reduce the cost to 0", - "Player2: Math: Gain 1 culture token", - "Player2: Philosophy: Gain 1 idea" ] } ] diff --git a/server/tests/test_games/advances/priesthood.outcome1.json b/server/tests/test_games/advances/priesthood.outcome1.json index 531c612e..24f3e65a 100644 --- a/server/tests/test_games/advances/priesthood.outcome1.json +++ b/server/tests/test_games/advances/priesthood.outcome1.json @@ -294,11 +294,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -308,7 +312,7 @@ "player": 1, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -319,6 +323,13 @@ } ] }, + { + "player": 1, + "Text": "Reduce the cost to 0", + "origin": { + "Advance": "Priesthood" + } + }, { "player": 1, "Resources": { @@ -335,7 +346,9 @@ "player": 1, "Advance": { "advance": "Math", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { @@ -354,12 +367,6 @@ "Advance": "Philosophy" } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay nothing with Priesthood, Gain Math and take an event token (2 left)", - "Player2: Priesthood: Reduce the cost to 0", - "Player2: Math: Gain 1 culture token", - "Player2: Philosophy: Gain 1 idea" ] }, { @@ -373,11 +380,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -389,7 +400,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -411,7 +422,9 @@ "player": 1, "Advance": { "advance": "Astronomy", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { @@ -430,11 +443,6 @@ "Advance": "Philosophy" } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay 2 gold, Gain Astronomy and take an event token (1 left)", - "Player2: Astronomy: Gain 1 culture token", - "Player2: Philosophy: Gain 1 idea" ] } ] diff --git a/server/tests/test_games/advances/sanitation_and_draft.outcome.json b/server/tests/test_games/advances/sanitation_and_draft.outcome.json index 4b2dffe7..9cdc59d4 100644 --- a/server/tests/test_games/advances/sanitation_and_draft.outcome.json +++ b/server/tests/test_games/advances/sanitation_and_draft.outcome.json @@ -288,11 +288,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -305,7 +309,7 @@ "gold": 2, "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -319,6 +323,20 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, + { + "player": 0, + "Text": "Reduce the cost of 1 Settler to 1 mood token", + "origin": { + "Advance": "Sanitation" + } + }, { "player": 0, "Units": { @@ -326,17 +344,13 @@ "settlers": 1, "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 2 gold and 1 mood token with Draft, Sanitation, Gain 1 settler and 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token", - "Player1: Sanitation: Reduce the cost of 1 Settler to 1 mood token" ] } ] diff --git a/server/tests/test_games/advances/taxes.outcome2.json b/server/tests/test_games/advances/taxes.outcome2.json index dc516fe3..4046023f 100644 --- a/server/tests/test_games/advances/taxes.outcome2.json +++ b/server/tests/test_games/advances/taxes.outcome2.json @@ -127,7 +127,9 @@ ], "next_unit_id": 10, "played_once_per_turn_actions": [ - "Taxes" + { + "Custom": "Taxes" + } ] }, { @@ -284,19 +286,20 @@ } } }, + "player": 0, + "origin": { + "Advance": "Taxes" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Taxes" } } - ], - "log": [ - "Player1: Taxes: Pay 1 action, Start action, Pay 1 mood token" ] }, { @@ -309,6 +312,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -316,16 +320,14 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Taxes" } } ], - "log": [ - "Player1: Taxes: Pay 1 mood token" - ] + "active_events": 1 }, { "action": { @@ -338,6 +340,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -353,12 +356,21 @@ "origin": { "Ability": "Taxes" } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Taxes: Gain 1 food, 1 wood, 1 ore and 1 gold", - "Player1: Waste: Could not store 1 food" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/theaters.outcome1.json b/server/tests/test_games/advances/theaters.outcome1.json index 9751ecf5..ad6b5ea3 100644 --- a/server/tests/test_games/advances/theaters.outcome1.json +++ b/server/tests/test_games/advances/theaters.outcome1.json @@ -127,7 +127,9 @@ ], "next_unit_id": 10, "played_once_per_turn_actions": [ - "Theaters" + { + "Custom": "Theaters" + } ] }, { @@ -284,9 +286,10 @@ } } }, - "log": [ - "Player1: Theaters: Start action" - ] + "player": 0, + "origin": { + "Advance": "Theaters" + } }, { "action": { @@ -298,6 +301,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -305,7 +309,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Theaters" @@ -324,9 +328,7 @@ } } ], - "log": [ - "Player1: Theaters: Pay 1 culture token, Gain 1 mood token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/trade_routes.outcome.json b/server/tests/test_games/advances/trade_routes.outcome.json index fe642dc7..896dfad1 100644 --- a/server/tests/test_games/advances/trade_routes.outcome.json +++ b/server/tests/test_games/advances/trade_routes.outcome.json @@ -393,8 +393,21 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -411,6 +424,7 @@ "actions": [ { "action": "StartTurn", + "player": 1, "items": [ { "player": 0, @@ -424,6 +438,20 @@ "Ability": "Market" } }, + { + "player": 1, + "Text": "ship at E7 traded with city D6", + "origin": { + "Advance": "TradeRoutes" + } + }, + { + "player": 1, + "Text": "settler at E7 traded with city E6", + "origin": { + "Advance": "TradeRoutes" + } + }, { "player": 1, "Resources": { @@ -435,12 +463,19 @@ "origin": { "Advance": "TradeRoutes" } + }, + { + "player": 1, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Market: Gain 1 gold", - "Player2: Trade Routes: ship at E7 traded with city D6, settler at E7 traded with city E6, Gain 2 food", - "Player2: Waste: Could not store 1 food" ] } ] diff --git a/server/tests/test_games/advances/trade_routes_with_currency.outcome.json b/server/tests/test_games/advances/trade_routes_with_currency.outcome.json index 80c9aacb..5648ae11 100644 --- a/server/tests/test_games/advances/trade_routes_with_currency.outcome.json +++ b/server/tests/test_games/advances/trade_routes_with_currency.outcome.json @@ -430,8 +430,21 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -447,7 +460,8 @@ }, "actions": [ { - "action": "StartTurn" + "action": "StartTurn", + "player": 1 } ] } diff --git a/server/tests/test_games/advances/trade_routes_with_currency.outcome1.json b/server/tests/test_games/advances/trade_routes_with_currency.outcome1.json index d2ad8c47..50bf87d7 100644 --- a/server/tests/test_games/advances/trade_routes_with_currency.outcome1.json +++ b/server/tests/test_games/advances/trade_routes_with_currency.outcome1.json @@ -392,8 +392,21 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -409,7 +422,8 @@ }, "actions": [ { - "action": "StartTurn" + "action": "StartTurn", + "player": 1 }, { "action": { @@ -420,7 +434,29 @@ } } }, + "player": 1, "items": [ + { + "player": 1, + "Text": "Player2 selected trade routes", + "origin": { + "Advance": "TradeRoutes" + } + }, + { + "player": 1, + "Text": "ship at E7 traded with city C6", + "origin": { + "Advance": "TradeRoutes" + } + }, + { + "player": 1, + "Text": "settler at E7 traded with city E6", + "origin": { + "Advance": "TradeRoutes" + } + }, { "player": 1, "Resources": { @@ -435,9 +471,7 @@ } } ], - "log": [ - "Player2: Trade Routes: Player2 selected trade routes, ship at E7 traded with city C6, settler at E7 traded with city E6, Gain 1 food and 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/advances/writing.outcome1.json b/server/tests/test_games/advances/writing.outcome1.json index 6346ecb0..bdbe82e4 100644 --- a/server/tests/test_games/advances/writing.outcome1.json +++ b/server/tests/test_games/advances/writing.outcome1.json @@ -282,11 +282,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -299,7 +303,7 @@ "food": 1, "gold": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -351,17 +355,15 @@ "player": 0, "Advance": { "advance": "Writing", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 1 food and 1 gold, Gain Writing and take an event token (1 left)", - "Player1: Writing: Draw an action card, Draw an objective card, Gain 1 culture token" ] }, { @@ -379,11 +381,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -397,7 +403,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -410,7 +416,8 @@ "Building": "Academy" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Construct Building" @@ -428,10 +435,6 @@ "Ability": "Academy" } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 ore, Gain Academy at A1", - "Player1: Academy: Gain 2 ideas" ] } ] diff --git a/server/tests/test_games/base/collect.outcome.json b/server/tests/test_games/base/collect.outcome.json index 671e6cf2..88233d0f 100644 --- a/server/tests/test_games/base/collect.outcome.json +++ b/server/tests/test_games/base/collect.outcome.json @@ -222,11 +222,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -245,12 +249,26 @@ "origin": { "Ability": "Collect" } + }, + { + "player": 0, + "Text": "Gain 1 idea", + "origin": { + "Advance": "PublicEducation" + } + }, + { + "player": 0, + "Resources": { + "resources": { + "ore": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city C2, Gain 1 wood, 1 ore and 1 idea", - "Player1: Public Education: Gain 1 idea", - "Player1: Waste: Could not store 1 ore" ] } ] diff --git a/server/tests/test_games/base/construct.outcome.json b/server/tests/test_games/base/construct.outcome.json index 245d1ab5..fcd3ea07 100644 --- a/server/tests/test_games/base/construct.outcome.json +++ b/server/tests/test_games/base/construct.outcome.json @@ -212,11 +212,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -230,7 +234,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -253,7 +257,8 @@ "Building": "Observatory" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Construct Building" @@ -273,11 +278,14 @@ "origin": { "Ability": "Observatory" } + }, + { + "player": 0, + "Text": "Observatory gained 1 action card", + "origin": { + "Ability": "Observatory" + } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 ore, City C2 became Neutral, Gain Observatory at C2", - "Player1: Observatory: Draw an action card, Observatory gained 1 action card" ] } ] diff --git a/server/tests/test_games/base/construct_port.outcome.json b/server/tests/test_games/base/construct_port.outcome.json index ec0bb7fb..fad48d59 100644 --- a/server/tests/test_games/base/construct_port.outcome.json +++ b/server/tests/test_games/base/construct_port.outcome.json @@ -220,11 +220,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -238,7 +242,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -251,15 +255,13 @@ "Building": "Port" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": "A2" }, "origin": { "Ability": "Construct Building" } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 ore, Gain Port at A1 at the water tile A2" ] } ] diff --git a/server/tests/test_games/base/cultural_influence.outcome2.json b/server/tests/test_games/base/cultural_influence.outcome2.json index 086d56f0..0fc0b6da 100644 --- a/server/tests/test_games/base/cultural_influence.outcome2.json +++ b/server/tests/test_games/base/cultural_influence.outcome2.json @@ -219,19 +219,53 @@ } } }, + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" + }, + "origin": { + "Ability": "Influence Culture" + } + }, + { + "player": 1, + "InfluenceCultureAttempt": { + "target_player": 0, + "structure": { + "Building": "Temple" + }, + "prevent_boost": false, + "range_boost_cost": { + "default": { + "culture_tokens": 1 + }, + "origin": { + "Ability": "Influence Culture" + } + }, + "info": { + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, + "info": {}, + "log": [] + }, + "roll_boost": 0, + "position": "C2", + "starting_city_position": "B3", + "barbarian_takeover": false }, "origin": { "Ability": "Influence Culture" } } - ], - "log": [ - "Player2: Influence Culture: Pay 1 action, Tried to influence the Temple in the city at C2 by Player1 with the city B3 and may pay 1 culture token to boost the range" ] }, { @@ -244,6 +278,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -251,16 +286,21 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } + }, + { + "player": 1, + "Text": "rolls a 1 and now has the option to pay 4 culture tokens to increase the dice roll and proceed with the cultural influence", + "origin": { + "Ability": "Influence Culture" + } } ], - "log": [ - "Player2: Influence Culture: Pay 1 culture token, Rolled a 1 and now has the option to pay 4 culture tokens to increase the dice roll and proceed with the cultural influence" - ] + "active_events": 1 }, { "action": { @@ -272,6 +312,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -279,12 +320,19 @@ "resources": { "culture_tokens": 4 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } }, + { + "player": 1, + "Text": "pays to increase the dice roll", + "origin": { + "Ability": "Influence Culture" + } + }, { "player": 0, "Structure": { @@ -292,7 +340,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -305,17 +354,15 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" } } ], - "log": [ - "Player2: Influence Culture: Pay 4 culture tokens, Paying to increase the dice roll, Gain Temple at C2", - "Player1: Influence Culture: Lose Temple at C2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/base/cultural_influence_instant.outcome.json b/server/tests/test_games/base/cultural_influence_instant.outcome.json index 3ad0e260..3634c0d0 100644 --- a/server/tests/test_games/base/cultural_influence_instant.outcome.json +++ b/server/tests/test_games/base/cultural_influence_instant.outcome.json @@ -205,16 +205,58 @@ } } }, + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Influence Culture" } }, + { + "player": 1, + "InfluenceCultureAttempt": { + "target_player": 0, + "structure": { + "Building": "Fortress" + }, + "prevent_boost": false, + "range_boost_cost": { + "default": {}, + "origin": { + "Ability": "Influence Culture" + } + }, + "info": { + "player": 1, + "origin": { + "Ability": "Influence Culture" + }, + "info": {}, + "log": [] + }, + "roll_boost": 0, + "position": "C2", + "starting_city_position": "C1", + "barbarian_takeover": false + }, + "origin": { + "Ability": "Influence Culture" + } + }, + { + "player": 1, + "Text": "Cultural influence succeeded (rolls 6)", + "origin": { + "Ability": "Influence Culture" + } + }, { "player": 0, "Structure": { @@ -222,7 +264,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" @@ -235,16 +278,13 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Influence Culture" } } - ], - "log": [ - "Player2: Influence Culture: Pay 1 action, Tried to influence the Fortress in the city at C2 by Player1 with the city C1, Cultural influence succeeded (rolled 6), Gain Fortress at C2", - "Player1: Influence Culture: Lose Fortress at C2" ] } ] @@ -280,4 +320,4 @@ "wonders_left": [ "Pyramids" ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/base/found_city.outcome1.json b/server/tests/test_games/base/found_city.outcome1.json index 0369f7f3..05d316c8 100644 --- a/server/tests/test_games/base/found_city.outcome1.json +++ b/server/tests/test_games/base/found_city.outcome1.json @@ -215,11 +215,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Found City" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Found City" @@ -231,7 +235,8 @@ "units": { "settlers": 1 }, - "balance": "Loss" + "balance": "Pay", + "position": "B6" }, "origin": { "Ability": "Found city" @@ -242,16 +247,13 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "B6" + "position": "B6", + "port_position": null }, "origin": { "Ability": "Found city" } } - ], - "log": [ - "Player1: Found City: Pay 1 action", - "Player1: Found city: Gain city B6" ] }, { @@ -264,6 +266,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -283,9 +286,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete City Founder using City Founder/Resistance" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/base/increase_happiness.outcome.json b/server/tests/test_games/base/increase_happiness.outcome.json index c27f3d28..ffe89e45 100644 --- a/server/tests/test_games/base/increase_happiness.outcome.json +++ b/server/tests/test_games/base/increase_happiness.outcome.json @@ -273,11 +273,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Increase Happiness" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Increase Happiness" @@ -309,15 +313,12 @@ "resources": { "mood_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Increase Happiness" } } - ], - "log": [ - "Player1: Increase Happiness: Pay 1 action, City C2 became Neutral, City B3 became Happy, Pay 5 mood tokens" ] } ] diff --git a/server/tests/test_games/base/new_game.json b/server/tests/test_games/base/new_game.json index 59aa116c..3bcb1eeb 100644 --- a/server/tests/test_games/base/new_game.json +++ b/server/tests/test_games/base/new_game.json @@ -387,10 +387,15 @@ "round": 0, "turns": [ { - "turn_type": "Setup", + "turn_type": { + "Setup": { + "player": 0 + } + }, "actions": [ { - "action": "Setup", + "action": "StartTurn", + "player": 0, "items": [ { "player": 0, @@ -408,7 +413,7 @@ "player": 0, "Advance": { "advance": "Farming", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -419,7 +424,7 @@ "player": 0, "Advance": { "advance": "Mining", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -461,7 +466,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D2" + "position": "D2", + "port_position": null }, "origin": { "Ability": "Setup" @@ -483,12 +489,28 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D2" }, "origin": { "Ability": "Setup" } - }, + } + ] + } + ] + }, + { + "turn_type": { + "Setup": { + "player": 1 + } + }, + "actions": [ + { + "action": "StartTurn", + "player": 1, + "items": [ { "player": 1, "Resources": { @@ -505,7 +527,7 @@ "player": 1, "Advance": { "advance": "Farming", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -516,7 +538,7 @@ "player": 1, "Advance": { "advance": "Mining", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -558,7 +580,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D7" + "position": "D7", + "port_position": null }, "origin": { "Ability": "Setup" @@ -580,42 +603,20 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D7" }, "origin": { "Ability": "Setup" } } - ], - "log": [ - "Player1: Setup: Play as Choose Civilization, Gain 2 food, Gain Farming without taking an event token, Gain Mining without taking an event token, Draw an action card, Draw an objective card, Gain city D2, City D2 became Happy, Gain 1 settler at D2", - "Player2: Setup: Play as Choose Civilization, Gain 2 food, Gain Farming without taking an event token, Gain Mining without taking an event token, Draw an action card, Draw an objective card, Gain city D7, City D7 became Happy, Gain 1 settler at D7" ] - } - ] - } - ] - } - ] - }, - { - "age": 1, - "rounds": [ - { - "round": 1, - "turns": [ - { - "turn_type": { - "Player": 0 - }, - "actions": [ + }, { "action": { "ChooseCivilization": "Vikings" }, - "log": [ - "Player1: Setup: Play as Vikings" - ] + "player": 0 } ] } @@ -624,14 +625,12 @@ ] } ], - "log_index": 1, - "undo_limit": 1, + "log_index": 2, + "undo_limit": 2, "actions_left": 3, "round": 1, - "age": 1, - "messages": [ - "Age 1 has started" - ], + "age": 0, + "messages": [], "rng": "187713005158128829250871947649707797698", "wonders_left": [ "GreatGardens", diff --git a/server/tests/test_games/base/recruit.outcome.json b/server/tests/test_games/base/recruit.outcome.json index ca0fafe4..a48db820 100644 --- a/server/tests/test_games/base/recruit.outcome.json +++ b/server/tests/test_games/base/recruit.outcome.json @@ -248,11 +248,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -266,7 +270,7 @@ "ore": 1, "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -278,7 +282,8 @@ "units": { "settlers": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Recruit" @@ -301,7 +306,8 @@ "settlers": 1, "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" @@ -324,10 +330,6 @@ "Ability": "Complete Objectives" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 food, 1 ore and 2 gold, Lost 1 settler at C2, City A1 became Angry, Gain 1 settler and 1 infantry at A1", - "Player1: Complete Objectives: Complete Terror Regime using Shipping Routes/Terror Regime" ] } ] diff --git a/server/tests/test_games/base/recruit_leader.outcome.json b/server/tests/test_games/base/recruit_leader.outcome.json index 5a514cfb..fd482844 100644 --- a/server/tests/test_games/base/recruit_leader.outcome.json +++ b/server/tests/test_games/base/recruit_leader.outcome.json @@ -283,11 +283,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -300,7 +304,7 @@ "mood_tokens": 1, "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -312,15 +316,13 @@ "units": { "leader": "Augustus" }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 mood token and 1 culture token, Gain Augustus at A1" ] } ] diff --git a/server/tests/test_games/base/replace_leader.outcome.json b/server/tests/test_games/base/replace_leader.outcome.json index 9f95ec6f..6290a96c 100644 --- a/server/tests/test_games/base/replace_leader.outcome.json +++ b/server/tests/test_games/base/replace_leader.outcome.json @@ -283,11 +283,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -300,7 +304,7 @@ "mood_tokens": 1, "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -312,7 +316,8 @@ "units": { "leader": "Sulla" }, - "balance": "Loss" + "balance": "Loss", + "position": "A1" }, "origin": { "Ability": "Recruit" @@ -334,15 +339,13 @@ "units": { "leader": "Augustus" }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 mood token and 1 culture token, Lost Sulla at A1, City A1 became Neutral, Gain Augustus at A1" ] } ] diff --git a/server/tests/test_games/base/same_player_undo.json b/server/tests/test_games/base/same_player_undo.json index f3a49a83..344aa7e7 100644 --- a/server/tests/test_games/base/same_player_undo.json +++ b/server/tests/test_games/base/same_player_undo.json @@ -1,7 +1,4 @@ { - "options": { - "undo": "SamePlayer" - }, "state": "Playing", "players": [ { diff --git a/server/tests/test_games/base/same_player_undo.outcome.json b/server/tests/test_games/base/same_player_undo.outcome.json index 245d1ab5..fcd3ea07 100644 --- a/server/tests/test_games/base/same_player_undo.outcome.json +++ b/server/tests/test_games/base/same_player_undo.outcome.json @@ -212,11 +212,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -230,7 +234,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -253,7 +257,8 @@ "Building": "Observatory" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Construct Building" @@ -273,11 +278,14 @@ "origin": { "Ability": "Observatory" } + }, + { + "player": 0, + "Text": "Observatory gained 1 action card", + "origin": { + "Ability": "Observatory" + } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 ore, City C2 became Neutral, Gain Observatory at C2", - "Player1: Observatory: Draw an action card, Observatory gained 1 action card" ] } ] diff --git a/server/tests/test_games/civilizations/china/expansion.outcome.json b/server/tests/test_games/civilizations/china/expansion.outcome.json index e4644f73..daf1e6c9 100644 --- a/server/tests/test_games/civilizations/china/expansion.outcome.json +++ b/server/tests/test_games/civilizations/china/expansion.outcome.json @@ -264,11 +264,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -280,7 +284,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -292,16 +296,20 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } + }, + { + "player": 0, + "Text": "Expansion allows to move the settlers at B3, B3, A1", + "origin": { + "SpecialAdvance": "Expansion" + } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 2 gold, Gain 1 settler at A1", - "Player1: Expansion: Expansion allows to move the settlers at B3, B3, A1" ] } ] diff --git a/server/tests/test_games/civilizations/china/fast_war.outcome.json b/server/tests/test_games/civilizations/china/fast_war.outcome.json index 4245bf5a..6ceea50e 100644 --- a/server/tests/test_games/civilizations/china/fast_war.outcome.json +++ b/server/tests/test_games/civilizations/china/fast_war.outcome.json @@ -372,6 +372,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -398,25 +402,103 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "leader": "SunTzu" + }, + "start": "E8", + "destination": "D8" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "leader": "SunTzu" + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 5, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D8" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -434,7 +516,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -445,7 +528,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -474,15 +558,6 @@ "LeaderAbility": "Fast War" } } - ], - "log": [ - "Player1: Move: marched Sun Tzu from E8 to D8, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with Sun Tzu, Roll 5 (cavalry, no bonus) for combined combat value of 5 and gets 1 hits against defending units, Gain 2 gold, Gain city D8, City D8 became Angry", - "Player2: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at D8, Lose city D8", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Fast War: Gain 1 mood token and 1 culture token" ] } ] diff --git a/server/tests/test_games/civilizations/china/fireworks.outcome1.json b/server/tests/test_games/civilizations/china/fireworks.outcome1.json index 923358cb..4d364028 100644 --- a/server/tests/test_games/civilizations/china/fireworks.outcome1.json +++ b/server/tests/test_games/civilizations/china/fireworks.outcome1.json @@ -265,22 +265,83 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "cavalry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units", - "Player2: Combat: Defending with 1 cavalry, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units" ] }, { @@ -293,6 +354,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -323,24 +385,46 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "SpecialAdvance": "Fireworks" } }, + { + "player": 0, + "Text": "Ignore the first hit", + "origin": { + "SpecialAdvance": "Fireworks" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "cavalry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -358,7 +442,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -369,7 +454,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -381,21 +467,15 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B2" }, "origin": { "Ability": "Place Settler" } } ], - "log": [ - "Player1: Fireworks: Pay 2 gold, Ignore the first hit", - "Player2: Choose Casualties: Remove all defending units", - "Player2: Combat: Lost 1 cavalry at C1, Lose city C1", - "Attacker wins", - "Player1: Combat: Gain 1 gold, Gain city C1", - "Player2: Place Settler: Gain 1 settler at B2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/china/great_wall.outcome4.json b/server/tests/test_games/civilizations/china/great_wall.outcome4.json index b5958331..9c1c56bf 100644 --- a/server/tests/test_games/civilizations/china/great_wall.outcome4.json +++ b/server/tests/test_games/civilizations/china/great_wall.outcome4.json @@ -389,11 +389,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -405,7 +409,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -432,17 +436,15 @@ "player": 0, "Advance": { "advance": "Engineering", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Engineering and take an event token (1 left)", - "Player1: Great Wall: Gain Great Wall from Player2" ] }, { @@ -451,9 +453,10 @@ "WonderCard": "GreatWall" } }, - "log": [ - "Player1: Build Wonder: Play the wonder card Great Wall, Decided to build Great Wall in city D1" - ] + "player": 0, + "origin": { + "Ability": "Build Wonder" + } }, { "action": { @@ -468,6 +471,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -478,7 +482,7 @@ "ore": 7, "culture_tokens": 3 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "GreatWall" @@ -489,6 +493,20 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of Great Wall by 2 culture tokens", + "origin": { + "LeaderAbility": "Great Wall" + } + }, + { + "player": 0, + "Text": "Great Wall can be built in the leader city as a free action", + "origin": { + "LeaderAbility": "Great Wall" + } + }, { "player": 0, "HandCard": { @@ -511,25 +529,24 @@ "Wonder": "GreatWall" }, "balance": "Gain", - "position": "D1" + "position": "D1", + "port_position": null }, "origin": { "Ability": "Build Wonder" } } ], - "log": [ - "Player1: Great Wall: Pay 3 food, 2 wood, 7 ore and 3 culture tokens with Great Wall, Reduce the cost of Great Wall by 2 culture tokens, Great Wall can be built in the leader city as a free action", - "Player1: Build Wonder: Play Great Wall, Gain Great Wall at D1" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 0 actions left" - ] + "player": 0, + "origin": { + "Ability": "End Turn" + } } ] } @@ -545,8 +562,15 @@ "actions": [ { "action": "StartTurn", - "log": [ - "Player2: Wonder replacement: Draw a replacement wonder card" + "player": 1, + "items": [ + { + "player": 1, + "Text": "Draw a replacement wonder card", + "origin": { + "Ability": "Wonder replacement" + } + } ] }, { @@ -555,6 +579,7 @@ "Bool": true } }, + "player": 1, "items": [ { "player": 1, @@ -572,9 +597,7 @@ } } ], - "log": [ - "Player2: Draw Wonder Card: Gain Pyramids from the public area" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/civilizations/china/imperial_army.outcome1.json b/server/tests/test_games/civilizations/china/imperial_army.outcome1.json index ae7af5a1..c57a9f70 100644 --- a/server/tests/test_games/civilizations/china/imperial_army.outcome1.json +++ b/server/tests/test_games/civilizations/china/imperial_army.outcome1.json @@ -89,7 +89,9 @@ ], "next_unit_id": 10, "played_once_per_turn_actions": [ - "ImperialArmy" + { + "Custom": "ImperialArmy" + } ] }, { @@ -247,19 +249,20 @@ } } }, + "player": 0, + "origin": { + "SpecialAdvance": "ImperialArmy" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "SpecialAdvance": "ImperialArmy" } } - ], - "log": [ - "Player1: Imperial Army: Pay 1 action, Start action" ] }, { @@ -271,9 +274,17 @@ ] } }, - "log": [ - "Player1: Imperial Army: Convert infantry at C2, settler at B4" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Convert infantry at C2, settler at B4", + "origin": { + "Ability": "Imperial Army" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/china/rice.outcome.json b/server/tests/test_games/civilizations/china/rice.outcome.json index 1ca178ca..80ec0678 100644 --- a/server/tests/test_games/civilizations/china/rice.outcome.json +++ b/server/tests/test_games/civilizations/china/rice.outcome.json @@ -257,11 +257,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Collect" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Collect" @@ -283,11 +287,14 @@ "Advance": "Irrigation" } ] + }, + { + "player": 0, + "Text": "Added 1 food", + "origin": { + "SpecialAdvance": "RiceCultivation" + } } - ], - "log": [ - "Player1: Collect: Pay 1 action, Use city B3, Gain 2 food with Irrigation", - "Player1: Rice Cultivation: Added 1 food" ] } ] diff --git a/server/tests/test_games/civilizations/greece/city_states.outcome1.json b/server/tests/test_games/civilizations/greece/city_states.outcome1.json index 4f81688a..d4c982d2 100644 --- a/server/tests/test_games/civilizations/greece/city_states.outcome1.json +++ b/server/tests/test_games/civilizations/greece/city_states.outcome1.json @@ -263,11 +263,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -279,7 +283,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -293,6 +297,20 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, + { + "player": 0, + "Text": "Can pay the Draft cost as culture tokens", + "origin": { + "SpecialAdvance": "Sparta" + } + }, { "player": 0, "MoodChange": { @@ -309,17 +327,13 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 culture token with Draft, Sparta, City A1 became Neutral, Gain 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token", - "Player1: Sparta: Can pay the Draft cost as culture tokens" ] }, { @@ -330,6 +344,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -352,9 +367,7 @@ } } ], - "log": [ - "Player1: City States: City B3 became Neutral, City A1 became Happy" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/greece/hellenistic_culture.outcome1.json b/server/tests/test_games/civilizations/greece/hellenistic_culture.outcome1.json index 69108298..3de5b634 100644 --- a/server/tests/test_games/civilizations/greece/hellenistic_culture.outcome1.json +++ b/server/tests/test_games/civilizations/greece/hellenistic_culture.outcome1.json @@ -63,7 +63,9 @@ ], "next_unit_id": 10, "played_once_per_turn_actions": [ - "ArtsInfluenceCultureAttempt" + { + "Modifier": "ArtsInfluenceCultureAttempt" + } ] }, { @@ -246,14 +248,17 @@ } }, "action_type": { - "Custom": "HellenisticInfluenceCultureAttempt" + "Special": { + "Modifier": "HellenisticInfluenceCultureAttempt" + } } } } }, - "log": [ - "Player1: Hellenistic Culture: Pay 2 mood tokens" - ] + "player": 0, + "origin": { + "SpecialAdvance": "HellenisticCulture" + } }, { "action": { @@ -265,6 +270,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -272,12 +278,50 @@ "resources": { "mood_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "SpecialAdvance": "HellenisticCulture" } }, + { + "player": 0, + "InfluenceCultureAttempt": { + "target_player": 1, + "structure": { + "Building": "Port" + }, + "prevent_boost": false, + "range_boost_cost": { + "default": {}, + "origin": { + "SpecialAdvance": "HellenisticCulture" + } + }, + "info": { + "player": 0, + "origin": { + "SpecialAdvance": "HellenisticCulture" + }, + "info": {}, + "log": [] + }, + "roll_boost": 0, + "position": "C2", + "starting_city_position": "C2", + "barbarian_takeover": false + }, + "origin": { + "SpecialAdvance": "HellenisticCulture" + } + }, + { + "player": 0, + "Text": "Cultural influence succeeded (rolls 6)", + "origin": { + "SpecialAdvance": "HellenisticCulture" + } + }, { "player": 1, "Structure": { @@ -285,7 +329,8 @@ "Building": "Port" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": "C3" }, "origin": { "SpecialAdvance": "HellenisticCulture" @@ -298,17 +343,15 @@ "Building": "Port" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": "C3" }, "origin": { "SpecialAdvance": "HellenisticCulture" } } ], - "log": [ - "Player1: Hellenistic Culture: Pay 2 mood tokens, Tried to influence the Port in the city at C2 by Player2, Cultural influence succeeded (rolled 6), Gain Port at C2 at the water tile C3", - "Player2: Hellenistic Culture: Lose Port at C2" - ] + "active_events": 1 } ] } @@ -341,4 +384,4 @@ "dice_roll_log": [ 10 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/civilizations/greece/idol.outcome2.json b/server/tests/test_games/civilizations/greece/idol.outcome2.json index 35ef92f7..ce325634 100644 --- a/server/tests/test_games/civilizations/greece/idol.outcome2.json +++ b/server/tests/test_games/civilizations/greece/idol.outcome2.json @@ -431,9 +431,10 @@ } } }, - "log": [ - "Player1: Idol: Start action, Pay 1 culture token" - ] + "player": 0, + "origin": { + "LeaderAbility": "Idol" + } }, { "action": { @@ -445,6 +446,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -452,12 +454,19 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Idol" } }, + { + "player": 0, + "Text": "Decided to play Spy as a free action", + "origin": { + "Ability": "Idol" + } + }, { "player": 0, "HandCard": { @@ -474,11 +483,7 @@ } } ], - "log": [ - "Player1: Idol: Pay 1 culture token, Decided to play Spy as a free action", - "Player1: Action Card: Play Spy/Heavy Resistance", - "Player1: Spy: Pay 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -490,6 +495,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -497,16 +503,21 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 7 } + }, + { + "player": 0, + "Text": "Looked at the Wonder, Action, and Objective cards in the hand of Player2", + "origin": { + "CivilCard": 7 + } } ], - "log": [ - "Player1: Spy: Pay 1 culture token, Decided to looked at all Wonder, Action, and Objective cards of Player2" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/civilizations/greece/master.outcome1.json b/server/tests/test_games/civilizations/greece/master.outcome1.json index 9be3c121..031fa2b4 100644 --- a/server/tests/test_games/civilizations/greece/master.outcome1.json +++ b/server/tests/test_games/civilizations/greece/master.outcome1.json @@ -385,19 +385,20 @@ } } }, + "player": 0, + "origin": { + "LeaderAbility": "Master" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Master" } } - ], - "log": [ - "Player1: Master: Pay 1 action, Start action, Pay 1 mood token" ] }, { @@ -410,6 +411,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -417,7 +419,7 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Master" @@ -469,7 +471,9 @@ "player": 0, "Advance": { "advance": "Writing", - "take_incident_token": true, + "incident_token": { + "Take": 1 + }, "balance": "Gain" }, "origin": { @@ -477,10 +481,7 @@ } } ], - "log": [ - "Player1: Master: Pay 1 mood token, Gain Writing and take an event token (1 left)", - "Player1: Writing: Draw an action card, Draw an objective card, Gain 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/greece/ruler_of_the_world.outcome.json b/server/tests/test_games/civilizations/greece/ruler_of_the_world.outcome.json index 9429b144..47245148 100644 --- a/server/tests/test_games/civilizations/greece/ruler_of_the_world.outcome.json +++ b/server/tests/test_games/civilizations/greece/ruler_of_the_world.outcome.json @@ -374,6 +374,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -400,25 +404,106 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "leader": "Alexander" + }, + "start": "E8", + "destination": "D8" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "leader": "Alexander" + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1, + "combat_modifiers": [ + "Ruler of the World adds 1 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D8" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -436,7 +521,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -447,7 +533,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -463,14 +550,6 @@ "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: marched Alexander the Great from E8 to D8, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with Alexander the Great, Roll 5 (cavalry, no bonus) for combined combat value of 6 and gets 1 hits against defending units, Combat modifiers: Ruler of the World adds 1 combat value, Gain 2 gold, Gain city D8, City D8 became Angry", - "Player2: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at D8, Lose city D8", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] } ] diff --git a/server/tests/test_games/civilizations/greece/sparta_battle.outcome.json b/server/tests/test_games/civilizations/greece/sparta_battle.outcome.json index 6f8e2691..5a69e37f 100644 --- a/server/tests/test_games/civilizations/greece/sparta_battle.outcome.json +++ b/server/tests/test_games/civilizations/greece/sparta_battle.outcome.json @@ -236,6 +236,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -265,46 +269,131 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1, + "combat_modifiers": [ + "Sparta denies playing tactics cards" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Combat modifiers: Sparta denies playing tactics cards, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" ] } ] diff --git a/server/tests/test_games/civilizations/greece/sparta_draft.outcome.json b/server/tests/test_games/civilizations/greece/sparta_draft.outcome.json index 14aa8306..9d8f3ce0 100644 --- a/server/tests/test_games/civilizations/greece/sparta_draft.outcome.json +++ b/server/tests/test_games/civilizations/greece/sparta_draft.outcome.json @@ -235,11 +235,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -251,7 +255,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -265,23 +269,33 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, + { + "player": 0, + "Text": "Can pay the Draft cost as culture tokens", + "origin": { + "SpecialAdvance": "Sparta" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 culture token with Draft, Sparta, Gain 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token", - "Player1: Sparta: Can pay the Draft cost as culture tokens" ] } ] diff --git a/server/tests/test_games/civilizations/rome/aqueduct_discount.outcome.json b/server/tests/test_games/civilizations/rome/aqueduct_discount.outcome.json index efb0984d..230fcdc9 100644 --- a/server/tests/test_games/civilizations/rome/aqueduct_discount.outcome.json +++ b/server/tests/test_games/civilizations/rome/aqueduct_discount.outcome.json @@ -223,11 +223,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -237,7 +241,7 @@ "player": 0, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -248,6 +252,13 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost to 0", + "origin": { + "SpecialAdvance": "Aqueduct" + } + }, { "player": 0, "Resources": { @@ -264,18 +275,15 @@ "player": 0, "Advance": { "advance": "Sanitation", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay nothing with Aqueduct, Gain Sanitation and take an event token (2 left)", - "Player1: Aqueduct: Reduce the cost to 0", - "Player1: Sanitation: Gain 1 mood token" ] } ] diff --git a/server/tests/test_games/civilizations/rome/aqueduct_free_action.outcome1.json b/server/tests/test_games/civilizations/rome/aqueduct_free_action.outcome1.json index 50fcd3b0..7ce8eb57 100644 --- a/server/tests/test_games/civilizations/rome/aqueduct_free_action.outcome1.json +++ b/server/tests/test_games/civilizations/rome/aqueduct_free_action.outcome1.json @@ -221,10 +221,10 @@ } } }, - "log": [ - "Player1: Aqueduct: Start action", - "Player1: Advance: Pay 2 ideas" - ] + "player": 0, + "origin": { + "SpecialAdvance": "Aqueduct" + } }, { "action": { @@ -236,6 +236,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -243,7 +244,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -265,7 +266,9 @@ "player": 0, "Advance": { "advance": "Sanitation", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { @@ -273,11 +276,7 @@ } } ], - "log": [ - "Player1: Advance: Pay 2 food", - "Player1: Sanitation: Gain 1 mood token", - "Player1: Aqueduct: Gain Sanitation and take an event token (2 left)" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/rome/captivi.outcome.json b/server/tests/test_games/civilizations/rome/captivi.outcome.json index e711f137..9118aacd 100644 --- a/server/tests/test_games/civilizations/rome/captivi.outcome.json +++ b/server/tests/test_games/civilizations/rome/captivi.outcome.json @@ -229,11 +229,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -247,7 +251,7 @@ "wood": 1, "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -258,6 +262,13 @@ } ] }, + { + "player": 0, + "Text": "May replace resources with mood tokens", + "origin": { + "SpecialAdvance": "Captivi" + } + }, { "player": 0, "Structure": { @@ -265,16 +276,13 @@ "Building": "Market" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Construct Building" } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 mood token with Captivi, Gain Market at A1", - "Player1: Captivi: May replace resources with mood tokens" ] } ] diff --git a/server/tests/test_games/civilizations/rome/civilizer.outcome.json b/server/tests/test_games/civilizations/rome/civilizer.outcome.json index 632e1678..2bd045f6 100644 --- a/server/tests/test_games/civilizations/rome/civilizer.outcome.json +++ b/server/tests/test_games/civilizations/rome/civilizer.outcome.json @@ -371,6 +371,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Land", @@ -396,25 +400,106 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "leader": "Sulla" + }, + "start": "E8", + "destination": "D8" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "leader": "Sulla" + }, + "defending_player": 2, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 7, + "hits": 1, + "combat_modifiers": [ + "Sulla adds 2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D8" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -427,15 +512,6 @@ "Ability": "Barbarian battle" } } - ], - "log": [ - "Player1: Move: marched Sulla from E8 to D8, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with Sulla, Roll 5 (cavalry, no bonus) for combined combat value of 7 and gets 1 hits against defending units, Combat modifiers: Sulla adds 2 combat value", - "Barbarians: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at D8", - "Barbarians: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Barbarian battle: Gain 1 gold" ] } ] diff --git a/server/tests/test_games/civilizations/rome/emperor.outcome.json b/server/tests/test_games/civilizations/rome/emperor.outcome.json index 1fdd29b3..e878de47 100644 --- a/server/tests/test_games/civilizations/rome/emperor.outcome.json +++ b/server/tests/test_games/civilizations/rome/emperor.outcome.json @@ -370,6 +370,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -396,25 +400,106 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "leader": "Augustus" + }, + "start": "E8", + "destination": "D8" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "leader": "Augustus" + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 7, + "hits": 1, + "combat_modifiers": [ + "Emperor adds 2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D8" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -432,7 +517,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -443,7 +529,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -459,14 +546,6 @@ "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: marched Augustus from E8 to D8, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with Augustus, Roll 5 (cavalry, no bonus) for combined combat value of 7 and gets 1 hits against defending units, Combat modifiers: Emperor adds 2 combat value, Gain 2 gold, Gain city D8, City D8 became Angry", - "Player2: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at D8, Lose city D8", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] } ] diff --git a/server/tests/test_games/civilizations/rome/princeps.outcome1.json b/server/tests/test_games/civilizations/rome/princeps.outcome1.json index ee45b9ae..1a785dde 100644 --- a/server/tests/test_games/civilizations/rome/princeps.outcome1.json +++ b/server/tests/test_games/civilizations/rome/princeps.outcome1.json @@ -257,19 +257,20 @@ } } }, + "player": 0, + "origin": { + "LeaderAbility": "Princeps" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Princeps" } } - ], - "log": [ - "Player1: Princeps: Pay 1 action, Start action, Pay 1 culture token" ] }, { @@ -282,6 +283,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -289,7 +291,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Princeps" @@ -356,9 +358,7 @@ } } ], - "log": [ - "Player1: Princeps: Pay 1 culture token, Draw an action card, Draw an objective card, Discard Quick Advance/Peltasts, Discard Large Civilization/Draft" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/rome/proconsul.outcome1.json b/server/tests/test_games/civilizations/rome/proconsul.outcome1.json index da28f607..c5dfe79e 100644 --- a/server/tests/test_games/civilizations/rome/proconsul.outcome1.json +++ b/server/tests/test_games/civilizations/rome/proconsul.outcome1.json @@ -375,6 +375,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -401,25 +405,103 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "leader": "Caesar" + }, + "start": "E8", + "destination": "D8" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "leader": "Caesar" + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 5, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D8" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -437,7 +519,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -448,7 +531,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D8" + "position": "D8", + "port_position": null }, "origin": { "Ability": "Combat" @@ -464,14 +548,6 @@ "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: marched Gaius Julius Caesar from E8 to D8, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with Gaius Julius Caesar, Roll 5 (cavalry, no bonus) for combined combat value of 5 and gets 1 hits against defending units, Gain 2 gold, Gain city D8, City D8 became Angry", - "Player2: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at D8, Lose city D8", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] }, { @@ -484,6 +560,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -491,7 +568,7 @@ "resources": { "gold": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Proconsul" @@ -503,16 +580,15 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D8" }, "origin": { "LeaderAbility": "Proconsul" } } ], - "log": [ - "Player1: Proconsul: Pay 1 gold, Gain 1 infantry at D8" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/rome/provinces.outcome2.json b/server/tests/test_games/civilizations/rome/provinces.outcome2.json index e0ecfce7..ab84376a 100644 --- a/server/tests/test_games/civilizations/rome/provinces.outcome2.json +++ b/server/tests/test_games/civilizations/rome/provinces.outcome2.json @@ -275,11 +275,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -291,26 +295,32 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "unlocks Provinces", + "origin": { + "Ability": "Advance" + } + }, { "player": 0, "Advance": { "advance": "Voting", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Unlock Provinces, Gain Voting and take an event token (2 left)" ] }, { @@ -324,6 +334,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -342,10 +356,23 @@ "city_mood": "Neutral" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "B2" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -368,7 +395,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "B2" + "position": "B2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -379,7 +407,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "B2" + "position": "B2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -392,7 +421,8 @@ "Building": "Port" }, "balance": "Loss", - "position": "B2" + "position": "B2", + "port_position": "C3" }, "origin": { "Ability": "Combat" @@ -405,7 +435,8 @@ "Building": "Port" }, "balance": "Gain", - "position": "B2" + "position": "B2", + "port_position": "C3" }, "origin": { "Ability": "Combat" @@ -421,11 +452,6 @@ "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to B2, Pay 1 action", - "Player1: Combat: Gain 2 gold, Gain city B2, Gain Port at B2 at the water tile C3, City B2 became Angry", - "Player2: Combat: Lose city B2, Lose Port at B2" ] }, { @@ -438,6 +464,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -445,7 +472,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "SpecialAdvance": "Provinces" @@ -467,17 +494,15 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C1" }, "origin": { "Ability": "Place Settler" } } ], - "log": [ - "Player1: Provinces: Pay 1 culture token, City B2 became Happy", - "Player2: Place Settler: Gain 1 settler at C1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/rome/roman_roads.outcome.json b/server/tests/test_games/civilizations/rome/roman_roads.outcome.json index fe1a0c82..4a54942c 100644 --- a/server/tests/test_games/civilizations/rome/roman_roads.outcome.json +++ b/server/tests/test_games/civilizations/rome/roman_roads.outcome.json @@ -284,11 +284,31 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 3, + "infantry": 1, + "cavalry": 1, + "elephants": 1 + }, + "start": "E2", + "destination": "A1" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -301,7 +321,7 @@ "food": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -312,9 +332,6 @@ } ] } - ], - "log": [ - "Player1: Move: marched 3 settlers, 1 infantry, 1 cavalry and 1 elephant from E2 to A1 on roads for 1 food and 1 ore, Pay 1 action, Pay 1 food and 1 ore with Roman Roads" ] } ] diff --git a/server/tests/test_games/civilizations/rome/statesman.outcome.json b/server/tests/test_games/civilizations/rome/statesman.outcome.json index 41c77ff7..0b58128e 100644 --- a/server/tests/test_games/civilizations/rome/statesman.outcome.json +++ b/server/tests/test_games/civilizations/rome/statesman.outcome.json @@ -262,11 +262,17 @@ "mood_tokens": 2 }, "action_type": { - "Custom": "StatesmanIncreaseHappiness" + "Special": { + "Modifier": "StatesmanIncreaseHappiness" + } } } } }, + "player": 0, + "origin": { + "LeaderAbility": "Statesman" + }, "items": [ { "player": 0, @@ -284,15 +290,12 @@ "resources": { "mood_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Statesman" } } - ], - "log": [ - "Player1: Statesman: City A1 became Neutral, Pay 2 mood tokens" ] } ] diff --git a/server/tests/test_games/civilizations/vikings/danegeld.outcome1.json b/server/tests/test_games/civilizations/vikings/danegeld.outcome1.json index 3affa713..24e88776 100644 --- a/server/tests/test_games/civilizations/vikings/danegeld.outcome1.json +++ b/server/tests/test_games/civilizations/vikings/danegeld.outcome1.json @@ -99,7 +99,9 @@ ], "next_unit_id": 10, "played_once_per_turn_actions": [ - "Taxes" + { + "Custom": "Taxes" + } ] }, { @@ -270,19 +272,20 @@ } } }, + "player": 0, + "origin": { + "LeaderAbility": "Danegeld" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Danegeld" } } - ], - "log": [ - "Player1: Danegeld: Pay 1 action, Start action" ] }, { @@ -293,6 +296,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -315,12 +319,21 @@ "origin": { "Ability": "Danegeld" } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 4 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Danegeld: Gain 4 food, City E2 became Neutral", - "Player1: Waste: Could not store 4 food" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/vikings/explorer.outcome1.json b/server/tests/test_games/civilizations/vikings/explorer.outcome1.json index a9fc7095..7da8ec25 100644 --- a/server/tests/test_games/civilizations/vikings/explorer.outcome1.json +++ b/server/tests/test_games/civilizations/vikings/explorer.outcome1.json @@ -275,19 +275,20 @@ } } }, + "player": 0, + "origin": { + "LeaderAbility": "Legendary Explorer" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Legendary Explorer" } } - ], - "log": [ - "Player1: Legendary Explorer: Pay 1 action, Start action, Pay 1 culture token" ] }, { @@ -300,6 +301,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -307,16 +309,21 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "LeaderAbility": "Legendary Explorer" } + }, + { + "player": 0, + "Text": "Place an explorer token at D2", + "origin": { + "Ability": "Legendary Explorer" + } } ], - "log": [ - "Player1: Legendary Explorer: Pay 1 culture token, Place an explorer token at D2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/vikings/longships.outcome1.json b/server/tests/test_games/civilizations/vikings/longships.outcome1.json index f165904d..38f11527 100644 --- a/server/tests/test_games/civilizations/vikings/longships.outcome1.json +++ b/server/tests/test_games/civilizations/vikings/longships.outcome1.json @@ -268,6 +268,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Sea", @@ -293,34 +297,123 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "ships": 3 + }, + "start": "D2", + "destination": "C3" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "Text": "Ignore battle movement restrictions", + "origin": { + "SpecialAdvance": "Longships" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 3 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 18, + "hits": 1, + "combat_modifiers": [ + "WarShips ignore the first hit in the first round of combat" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: sailed 3 ships from D2 to C3, Pay 1 action", - "Player1: Longships: Ignore battle movement restrictions", - "Combat round 1", - "Player1: Combat: Attacking with 3 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 18 and gets 1 hits against defending units, Combat modifiers: WarShips ignore the first hit in the first round of combat", - "Player2: Combat: Defending with 1 ship, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 0 hits against attacking units, Lost 1 ship at C3", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] }, { @@ -335,6 +428,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Sea", @@ -360,34 +457,118 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "C4" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "Text": "Ignore battle movement restrictions", + "origin": { + "SpecialAdvance": "Longships" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 2 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1, + "combat_modifiers": [ + "WarShips ignore the first hit in the first round of combat" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C4" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: sailed 2 ships from C3 to C4, Pay 1 action", - "Player1: Longships: Ignore battle movement restrictions", - "Combat round 1", - "Player1: Combat: Attacking with 2 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units, Combat modifiers: WarShips ignore the first hit in the first round of combat", - "Player2: Combat: Defending with 1 ship, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 0 hits against attacking units, Lost 1 ship at C4", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] } ] diff --git a/server/tests/test_games/civilizations/vikings/new_colonies.outcome2.json b/server/tests/test_games/civilizations/vikings/new_colonies.outcome2.json index cac6c5eb..5f7ec75b 100644 --- a/server/tests/test_games/civilizations/vikings/new_colonies.outcome2.json +++ b/server/tests/test_games/civilizations/vikings/new_colonies.outcome2.json @@ -259,9 +259,10 @@ } } }, - "log": [ - "Player1: New Colonies: Start action" - ] + "player": 0, + "origin": { + "LeaderAbility": "New Colonies" + } }, { "action": { @@ -271,13 +272,89 @@ ] } }, - "log": [ - "Player1: New Colonies: disembarked 1 settler, 1 infantry and Erik the Red from D2 to D1", - "Combat round 1", - "Player1: Combat: Attacking with 1 settler, 1 infantry and Erik the Red, Roll 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 13 and gets 1 hits against defending units", - "Player2: Combat: Defending with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units", - "Player1: Choose Casualties: Remove 1 of their attacking units" - ] + "player": 0, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 1, + "infantry": 1, + "leader": "Erik" + }, + "start": "D2", + "destination": "D1" + }, + "origin": { + "Ability": "New Colonies" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 1, + "infantry": 1, + "leader": "Erik" + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 13, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + } + ], + "active_events": 1 }, { "action": { @@ -287,6 +364,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "Land", @@ -322,31 +400,42 @@ "units": { "leader": "Erik" }, - "balance": "Loss" + "balance": "Loss", + "position": "D2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Combat: Lost Erik the Red at D2", - "Player2: Choose Casualties: Remove all defending units", - "Player2: Combat: Lost 1 infantry at D1", - "Attacker wins" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/civilizations/vikings/prey.outcome.json b/server/tests/test_games/civilizations/vikings/prey.outcome.json index fb7f55a2..ecad5645 100644 --- a/server/tests/test_games/civilizations/vikings/prey.outcome.json +++ b/server/tests/test_games/civilizations/vikings/prey.outcome.json @@ -286,6 +286,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -304,10 +308,23 @@ "city_mood": "Neutral" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "leader": "Ragnar" + }, + "start": "E2", + "destination": "D1" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -330,7 +347,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "D1" + "position": "D1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -341,7 +359,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "D1" + "position": "D1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -375,20 +394,25 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B2" }, "origin": { "Ability": "Place Settler" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched Ragnar Lodbrok from E2 to D1, Pay 1 action", - "Player1: Combat: Gain 1 gold, Gain city D1, City D1 became Angry", - "Player2: Combat: Lose city D1", - "Player1: Prey: Gain 2 gold", - "Player2: Place Settler: Gain 1 settler at B2", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/civilizations/vikings/raids.outcome2.json b/server/tests/test_games/civilizations/vikings/raids.outcome2.json index 81b660f7..e34db27b 100644 --- a/server/tests/test_games/civilizations/vikings/raids.outcome2.json +++ b/server/tests/test_games/civilizations/vikings/raids.outcome2.json @@ -393,8 +393,21 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -411,6 +424,7 @@ "actions": [ { "action": "StartTurn", + "player": 1, "items": [ { "player": 0, @@ -424,6 +438,27 @@ "Ability": "Market" } }, + { + "player": 1, + "Text": "ship at E7 traded with city D6", + "origin": { + "Advance": "TradeRoutes" + } + }, + { + "player": 1, + "Text": "settler at E7 traded with city E6", + "origin": { + "Advance": "TradeRoutes" + } + }, + { + "player": 1, + "Text": "Raided Player1 at D6", + "origin": { + "SpecialAdvance": "Raiding" + } + }, { "player": 1, "Resources": { @@ -435,21 +470,40 @@ "origin": { "Advance": "TradeRoutes" } + }, + { + "player": 1, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Market: Gain 1 gold", - "Player2: Trade Routes: ship at E7 traded with city D6, settler at E7 traded with city E6, Gain 2 food", - "Player2: Raiding: Raided Player1 at D6", - "Player2: Waste: Could not store 1 food" ] }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 3 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -469,6 +523,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -476,16 +531,21 @@ "resources": { "food": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Viking Raids" } + }, + { + "player": 0, + "Text": "Lose 1 food", + "origin": { + "Ability": "Viking Raids" + } } ], - "log": [ - "Player1: Viking Raids: Pay 1 food, Lose 1 food" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/civilizations/vikings/ship_construction.outcome3.json b/server/tests/test_games/civilizations/vikings/ship_construction.outcome3.json index 330b9d6a..46eb34bf 100644 --- a/server/tests/test_games/civilizations/vikings/ship_construction.outcome3.json +++ b/server/tests/test_games/civilizations/vikings/ship_construction.outcome3.json @@ -264,20 +264,40 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "settlers": 1 + }, + "start": "E2", + "destination": "D2" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "Text": "Convert 1 settler to ships", + "origin": { + "SpecialAdvance": "ShipConstruction" + } } - ], - "log": [ - "Player1: Move: marched 1 settler from E2 to D2, Pay 1 action", - "Player1: Ship Construction: Convert 1 settler to ships" ] }, { @@ -293,8 +313,26 @@ } } }, - "log": [ - "Player1: Move: embarked 1 settler and 1 infantry from E2 to D2" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 1, + "infantry": 1 + }, + "start": "E2", + "destination": "D2", + "embark_carrier_id": 3 + }, + "origin": { + "Ability": "Move" + } + } ] }, { @@ -308,19 +346,33 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 1 + }, + "start": "D2", + "destination": "C2" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" } } - ], - "log": [ - "Player1: Move: disembarked 1 ship from D2 to C2, Pay 1 action" ] }, { @@ -331,9 +383,24 @@ ] } }, - "log": [ - "Player1: Ship Construction: Unloaded 1 settler and 1 infantry from ships, Converted 1 ship to 1 settler" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Unloaded 1 settler and 1 infantry from ships", + "origin": { + "SpecialAdvance": "ShipConstruction" + } + }, + { + "player": 0, + "Text": "Converted 1 ship and to 1 settler", + "origin": { + "SpecialAdvance": "ShipConstruction" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/combat/capture_and_raze_city.outcome.json b/server/tests/test_games/combat/capture_and_raze_city.outcome.json index afa7b4be..d32c56b8 100644 --- a/server/tests/test_games/combat/capture_and_raze_city.outcome.json +++ b/server/tests/test_games/combat/capture_and_raze_city.outcome.json @@ -226,6 +226,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -252,18 +256,135 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 3, + "hits": 0, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -295,7 +416,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -308,7 +430,8 @@ "Wonder": "GreatWall" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -319,7 +442,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -331,23 +455,25 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A2" }, "origin": { "Ability": "Place Settler" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 4 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 3 and gets 0 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lost 2 infantry at C1, Lose Fortress at C1, Lose Great Wall at C1, Lose city C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Raze captured city: Gain 3 gold", - "Player2: Place Settler: Gain 1 settler at A2", - "Player1: Waste: Could not store 4 gold" ] } ] diff --git a/server/tests/test_games/combat/combat_all_modifiers.outcome5.json b/server/tests/test_games/combat/combat_all_modifiers.outcome5.json index c280c9e3..af6efebb 100644 --- a/server/tests/test_games/combat/combat_all_modifiers.outcome5.json +++ b/server/tests/test_games/combat/combat_all_modifiers.outcome5.json @@ -223,22 +223,55 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -251,6 +284,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -258,16 +292,14 @@ "resources": { "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "SteelWeapons" } } ], - "log": [ - "Player1: Steel Weapons: Pay 1 ore" - ] + "active_events": 1 }, { "action": { @@ -280,12 +312,13 @@ ] } }, + "player": 0, "items": [ { "player": 0, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Siegecraft" @@ -297,16 +330,21 @@ "resources": { "ore": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Siegecraft" } + }, + { + "player": 0, + "Text": "Cancel Fortress Ignore Hit", + "origin": { + "Advance": "Siegecraft" + } } ], - "log": [ - "Player1: Siegecraft: Pay nothing, Pay 2 ore, Cancel Fortress Ignore Hit" - ] + "active_events": 1 }, { "action": { @@ -318,6 +356,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -325,16 +364,14 @@ "resources": { "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "SteelWeapons" } } ], - "log": [ - "Player2: Steel Weapons: Pay 1 ore" - ] + "active_events": 1 }, { "action": { @@ -346,6 +383,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -363,9 +401,7 @@ } } ], - "log": [ - "Player1: Tactics: Play an action card face down" - ] + "active_events": 1 }, { "action": { @@ -377,6 +413,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -419,18 +456,129 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Peltasts", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Reveal Tactics Card Encircled", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 22, + "hits": 2, + "combat_modifiers": [ + "steel weapons added 1 combat value", + "Peltasts rolls a 6 and ignored a hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 4, + "hits": 0, + "combat_modifiers": [ + "fortress added one extra die", + "steel weapons added 1 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Cannot do damage - opponent has fewer losses", + "origin": { + "TacticsCard": 2 + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -448,7 +596,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -459,7 +608,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -472,7 +622,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -485,23 +636,27 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Encircled", - "Player1: Tactics: Reveal Tactics Card Peltasts", - "Player1: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 1 (leader, no bonus) for combined combat value of 22 and gets 2 hits against defending units, Combat modifiers: steel weapons added 1 combat value, Peltasts rolled a 6 and ignored a hit, Gain 1 gold, Gain city C1, Gain Fortress at C1", - "Player2: Combat: Roll 1 (leader, no bonus), 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 4 and gets 0 hits against attacking units, Combat modifiers: fortress added one extra die, steel weapons added 1 combat value, Lost 2 infantry at C1, Lose city C1, Lose Fortress at C1", - "Player2: Encircled: Cannot do damage - opponent has fewer losses", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } @@ -538,4 +693,4 @@ 1, 2 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/combat/combat_fanaticism.outcome.json b/server/tests/test_games/combat/combat_fanaticism.outcome.json index 258d0127..8ac537d7 100644 --- a/server/tests/test_games/combat/combat_fanaticism.outcome.json +++ b/server/tests/test_games/combat/combat_fanaticism.outcome.json @@ -234,6 +234,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -263,25 +267,136 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 4, + "hits": 0, + "combat_modifiers": [ + "Player gets +2 combat value for Fanaticism Advance" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -299,7 +414,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -310,7 +426,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -323,7 +440,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -336,7 +454,8 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -348,7 +467,8 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C2" }, "origin": { "Advance": "Fanaticism" @@ -360,23 +480,25 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C2" }, "origin": { "Ability": "Place Settler" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1, Gain Temple at C1", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 4 and gets 0 hits against attacking units, Combat modifiers: Player gets +2 combat value for Fanaticism Advance, Lost 2 infantry at C1, Lose city C1, Lose Temple at C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player2: Fanaticism: Gain 1 infantry at C2", - "Player2: Place Settler: Gain 1 settler at C2", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/combat/direct_capture_city_fortress.outcome.json b/server/tests/test_games/combat/direct_capture_city_fortress.outcome.json index 9cefd86f..de9d2210 100644 --- a/server/tests/test_games/combat/direct_capture_city_fortress.outcome.json +++ b/server/tests/test_games/combat/direct_capture_city_fortress.outcome.json @@ -217,6 +217,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -243,18 +247,135 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 3, + "hits": 0, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -272,7 +393,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -283,7 +405,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -296,7 +419,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -309,21 +433,25 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1, Gain Fortress at C1", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 3 and gets 0 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lost 2 infantry at C1, Lose city C1, Lose Fortress at C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/combat/direct_capture_city_metallurgy.outcome.json b/server/tests/test_games/combat/direct_capture_city_metallurgy.outcome.json index c9b17ee3..2ea45c0c 100644 --- a/server/tests/test_games/combat/direct_capture_city_metallurgy.outcome.json +++ b/server/tests/test_games/combat/direct_capture_city_metallurgy.outcome.json @@ -218,6 +218,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -244,18 +248,127 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "leader": "Caesar" + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Elephant", + "bonus": true + }, + { + "value": 2, + "unit_type": "Elephant", + "bonus": false + }, + { + "value": 2, + "unit_type": "Elephant", + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 7, + "hits": 1, + "combat_modifiers": [ + "steel weapons added 2 combat value (Metallurgy: no ore cost)" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "leader": "Caesar" }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -273,7 +386,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -284,21 +398,25 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 2 (elephant, -1 hits, no combat value), 2 (elephant, no bonus), 2 (elephant, no bonus), 1 (leader, no bonus) for combined combat value of 7 and gets 1 hits against defending units, Combat modifiers: steel weapons added 2 combat value (Metallurgy: no ore cost), Gain 1 gold, Gain city C1", - "Player2: Combat: Defending with Gaius Julius Caesar, Roll 1 (leader, re-roll), 6 (infantry, no bonus) for combined combat value of 6 and gets 0 hits against attacking units, Lost Gaius Julius Caesar at C1, Lose city C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/combat/direct_capture_city_only_fortress.outcome.json b/server/tests/test_games/combat/direct_capture_city_only_fortress.outcome.json index 41858c05..39df7060 100644 --- a/server/tests/test_games/combat/direct_capture_city_only_fortress.outcome.json +++ b/server/tests/test_games/combat/direct_capture_city_only_fortress.outcome.json @@ -217,6 +217,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -237,6 +241,99 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": {}, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -254,7 +351,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -265,7 +363,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -278,7 +377,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -291,20 +391,25 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 0 hits against defending units, Gain 1 gold, Gain city C1, Gain Fortress at C1", - "Player2: Combat: Defending with no units, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lose city C1, Lose Fortress at C1", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/combat/recruit_combat.outcome6.json b/server/tests/test_games/combat/recruit_combat.outcome6.json index 6c34e0dd..e1305c01 100644 --- a/server/tests/test_games/combat/recruit_combat.outcome6.json +++ b/server/tests/test_games/combat/recruit_combat.outcome6.json @@ -271,11 +271,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -288,7 +292,7 @@ "wood": 5, "gold": 3 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -310,15 +314,13 @@ "units": { "ships": 4 }, - "balance": "Gain" + "balance": "Gain", + "position": "C3" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 5 wood and 3 gold, City C2 became Neutral, Gain 4 ships at C3" ] }, { @@ -329,6 +331,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -341,12 +344,21 @@ "origin": { "Advance": "Nationalism" } + }, + { + "player": 0, + "Resources": { + "resources": { + "food": 4 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Nationalism: Gain 1 mood token", - "Player1: Waste: Could not store 4 food" - ] + "active_events": 1 }, { "action": { @@ -356,6 +368,7 @@ } } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "Sea", @@ -394,6 +407,76 @@ "Advance": "Medicine" } }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 4 + }, + "defending_player": 2, + "defenders": { + "ships": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 24, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -406,41 +489,55 @@ "Ability": "Pirate ship destroyed" } }, + { + "player": 0, + "Text": "Remove 2 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "ships": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 2, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "ships": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Medicine: Gain 1 gold", - "Combat round 1", - "Player1: Combat: Attacking with 4 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 24 and gets 2 hits against defending units, Lost 2 ships at C2", - "Pirates: Combat: Defending with 2 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 2 hits against attacking units, Lost 2 ships at C3", - "Player1: Pirate ship destroyed: Gain 2 gold", - "Player1: Choose Casualties: Remove 2 of their attacking units", - "Pirates: Choose Casualties: Remove all defending units", - "Attacker wins" - ] + "active_events": 1 }, { "action": { @@ -450,6 +547,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -464,9 +562,7 @@ } } ], - "log": [ - "Player1: Pirates battle: Gain 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -480,6 +576,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Sea", @@ -505,13 +605,83 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "C4" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 2 + }, + "defending_player": 2, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -524,28 +694,45 @@ "Ability": "Pirate ship destroyed" } }, + { + "player": 2, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C4" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: sailed 2 ships from C3 to C4, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units", - "Pirates: Combat: Defending with 1 ship, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against attacking units, Lost 1 ship at C4", - "Player1: Pirate ship destroyed: Gain 1 gold", - "Pirates: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] }, { @@ -556,6 +743,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -570,9 +758,7 @@ } } ], - "log": [ - "Player1: Pirates battle: Gain 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -584,6 +770,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -603,9 +790,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Sea Cleansing using High Culture/Sea Cleansing" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/combat/remove_casualties_attacker.outcome.json b/server/tests/test_games/combat/remove_casualties_attacker.outcome.json index db3e3688..31fbdef8 100644 --- a/server/tests/test_games/combat/remove_casualties_attacker.outcome.json +++ b/server/tests/test_games/combat/remove_casualties_attacker.outcome.json @@ -298,12 +298,105 @@ } } }, - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 2 hits against attacking units", - "Player1: Choose Casualties: Remove 2 of their attacking units" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 2 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + } ] } ] diff --git a/server/tests/test_games/combat/remove_casualties_attacker.outcome1.json b/server/tests/test_games/combat/remove_casualties_attacker.outcome1.json index a19e5382..3ac5ebe6 100644 --- a/server/tests/test_games/combat/remove_casualties_attacker.outcome1.json +++ b/server/tests/test_games/combat/remove_casualties_attacker.outcome1.json @@ -197,12 +197,105 @@ } } }, - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 2 hits against attacking units", - "Player1: Choose Casualties: Remove 2 of their attacking units" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 2 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + } ] }, { @@ -214,6 +307,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -251,24 +345,40 @@ "infantry": 1, "cavalry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -286,7 +396,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -297,20 +408,27 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Combat: Lost 1 infantry and 1 cavalry at C2, Gain 1 gold, Gain city C1", - "Player2: Choose Casualties: Remove all defending units", - "Player2: Combat: Lost 2 infantry at C1, Lose city C1", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/combat/remove_casualties_defender.outcome.json b/server/tests/test_games/combat/remove_casualties_defender.outcome.json index 1a8581d3..425c48da 100644 --- a/server/tests/test_games/combat/remove_casualties_defender.outcome.json +++ b/server/tests/test_games/combat/remove_casualties_defender.outcome.json @@ -199,6 +199,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -226,39 +230,121 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" ] } ] diff --git a/server/tests/test_games/combat/retreat.outcome.json b/server/tests/test_games/combat/retreat.outcome.json index a90efd7e..71222ba9 100644 --- a/server/tests/test_games/combat/retreat.outcome.json +++ b/server/tests/test_games/combat/retreat.outcome.json @@ -264,12 +264,92 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] } ] diff --git a/server/tests/test_games/combat/retreat.outcome1.json b/server/tests/test_games/combat/retreat.outcome1.json index 5c60f11c..5b0c7388 100644 --- a/server/tests/test_games/combat/retreat.outcome1.json +++ b/server/tests/test_games/combat/retreat.outcome1.json @@ -212,12 +212,92 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] }, { @@ -226,9 +306,17 @@ "Bool": true } }, - "log": [ - "Player1: Retreat: Retreat" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Retreat", + "origin": { + "Ability": "Retreat" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/combat/retreat_no.outcome.json b/server/tests/test_games/combat/retreat_no.outcome.json index a90efd7e..71222ba9 100644 --- a/server/tests/test_games/combat/retreat_no.outcome.json +++ b/server/tests/test_games/combat/retreat_no.outcome.json @@ -264,12 +264,92 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] } ] diff --git a/server/tests/test_games/combat/retreat_no.outcome1.json b/server/tests/test_games/combat/retreat_no.outcome1.json index c176b747..735ed7a1 100644 --- a/server/tests/test_games/combat/retreat_no.outcome1.json +++ b/server/tests/test_games/combat/retreat_no.outcome1.json @@ -199,12 +199,92 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] }, { @@ -213,6 +293,7 @@ "Bool": false } }, + "player": 0, "combat_stats": { "round": 2, "battleground": "City", @@ -240,40 +321,117 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Text": "Do not retreat", + "origin": { + "Ability": "Retreat" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Retreat: Do not retreat", - "Combat round 2", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/combat/ship_combat.outcome.json b/server/tests/test_games/combat/ship_combat.outcome.json index 435b6ad8..f0d694d6 100644 --- a/server/tests/test_games/combat/ship_combat.outcome.json +++ b/server/tests/test_games/combat/ship_combat.outcome.json @@ -360,26 +360,102 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "D2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 1, + "ships": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: sailed 2 ships from C3 to D2", - "Combat round 1", - "Player1: Combat: Attacking with 1 settler, 2 ships, 1 cavalry and 1 elephant, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units, Lost 1 ship at C3", - "Player2: Combat: Defending with 1 ship, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units", - "Player1: Choose Casualties: Remove 1 of their attacking units" ] } ] diff --git a/server/tests/test_games/combat/ship_combat.outcome1.json b/server/tests/test_games/combat/ship_combat.outcome1.json index 8a60df6d..cb016ab3 100644 --- a/server/tests/test_games/combat/ship_combat.outcome1.json +++ b/server/tests/test_games/combat/ship_combat.outcome1.json @@ -268,26 +268,102 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "D2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 1, + "ships": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } } - ], - "log": [ - "Player1: Move: sailed 2 ships from C3 to D2", - "Combat round 1", - "Player1: Combat: Attacking with 1 settler, 2 ships, 1 cavalry and 1 elephant, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units, Lost 1 ship at C3", - "Player2: Combat: Defending with 1 ship, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units", - "Player1: Choose Casualties: Remove 1 of their attacking units" ] }, { @@ -298,6 +374,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "Sea", @@ -325,37 +402,55 @@ "result": "AttackerWins" }, "items": [ + { + "player": 0, + "Text": "Killed carried units: 1 cavalry and", + "origin": { + "Ability": "Choose Casualties (carried units)" + } + }, { "player": 0, "Units": { "units": { "cavalry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Choose Casualties (carried units)" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D2" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Choose Casualties (carried units): Killed carried units: 1 cavalry, Lost 1 cavalry at C3", - "Player2: Choose Casualties: Remove all defending units", - "Player2: Combat: Lost 1 ship at D2", - "Attacker wins" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/combat/ship_combat_war_ships.outcome.json b/server/tests/test_games/combat/ship_combat_war_ships.outcome.json index 8068056a..86b91e0f 100644 --- a/server/tests/test_games/combat/ship_combat_war_ships.outcome.json +++ b/server/tests/test_games/combat/ship_combat_war_ships.outcome.json @@ -338,27 +338,119 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "D2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "ships": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1, + "combat_modifiers": [ + "WarShips ignore the first hit in the first round of combat" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1, + "combat_modifiers": [ + "WarShips ignore the first hit in the first round of combat" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } } - ], - "log": [ - "Player1: Move: sailed 2 ships from C3 to D2", - "Combat round 1", - "Player1: Combat: Attacking with 2 ships, 1 cavalry and 1 elephant, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units, Combat modifiers: WarShips ignore the first hit in the first round of combat, Lost 1 ship at C3", - "Player2: Combat: Defending with 2 ships, Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against attacking units, Combat modifiers: WarShips ignore the first hit in the first round of combat", - "Player1: Choose Casualties: Remove 1 of their attacking units", - "Player1: Retreat: Player1 can retreat" ] } ] diff --git a/server/tests/test_games/incidents/barbarians_attack.outcome.json b/server/tests/test_games/incidents/barbarians_attack.outcome.json index 0f63d422..81d64bb8 100644 --- a/server/tests/test_games/incidents/barbarians_attack.outcome.json +++ b/server/tests/test_games/incidents/barbarians_attack.outcome.json @@ -255,6 +255,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -299,32 +300,143 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } }, + { + "player": 0, + "Text": "triggers the event Population Boom", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 28 + } + }, + { + "player": 0, + "Text": "Barbarians move from B2 to C2: 2 infantry and 1 elephant and", + "origin": { + "Incident": 28 + } + }, + { + "player": 2, + "CombatRound": { + "attackers": { + "infantry": 2, + "elephants": 1 + }, + "defending_player": 0, + "defenders": { + "settlers": 4 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 20, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "elephants": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B2" }, "origin": { "Ability": "Combat" } }, + { + "player": 2, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "Text": "Kill 4 settlers of Player1", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Units": { "units": { "settlers": 4 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" @@ -335,7 +447,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -346,7 +459,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -358,7 +472,8 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Place Settler" @@ -370,7 +485,8 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C2" }, "origin": { "Incident": 28 @@ -382,39 +498,35 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Incident": 28 } }, + { + "player": 0, + "Text": "Player2 was selected to gain 1 settler.", + "origin": { + "Incident": 28 + } + }, { "player": 1, "Units": { "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C1" }, "origin": { "Incident": 28 } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: Population Boom", - "Player1: Population Boom: Base effect: Barbarians move, Barbarians move from B2 to C2: 2 infantry and 1 elephant, Gain 1 settler at A1, Player2 was selected to gain 1 settler.", - "Combat round 1", - "Barbarians: Combat: Attacking with 2 infantry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 20 and gets 0 hits against defending units, Lost 1 elephant at B2, Kill 4 settlers of Player1, Gain city C2", - "Player1: Combat: Defending with 4 settlers, Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lost 4 settlers at C2, Lose city C2", - "Barbarians: Choose Casualties: Remove 1 of their attacking units", - "Attacker wins", - "Player1: Place Settler: Gain 1 settler at A1", - "Barbarians: Population Boom: Gain 1 infantry at C2", - "Player2: Population Boom: Gain 1 settler at C1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/barbarians_move.outcome1.json b/server/tests/test_games/incidents/barbarians_move.outcome1.json index 779c4737..a2721740 100644 --- a/server/tests/test_games/incidents/barbarians_move.outcome1.json +++ b/server/tests/test_games/incidents/barbarians_move.outcome1.json @@ -287,6 +287,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -304,20 +305,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event Population Boom", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 28 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: Population Boom", - "Player1: Population Boom: Base effect: Barbarians move" - ] + "active_events": 1 }, { "action": { @@ -327,38 +339,57 @@ ] } }, + "player": 1, "items": [ + { + "player": 1, + "Text": "Selected Barbarian Armies that may NOT move: A3", + "origin": { + "LeaderAbility": "Dictator" + } + }, + { + "player": 0, + "Text": "Barbarians move from B3 to B2: 2 infantry and", + "origin": { + "Incident": 28 + } + }, { "player": 2, "Units": { "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "Incident": 28 } }, + { + "player": 0, + "Text": "Player2 was selected to gain 1 settler.", + "origin": { + "Incident": 28 + } + }, { "player": 1, "Units": { "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C1" }, "origin": { "Incident": 28 } } ], - "log": [ - "Player2: Dictator: Selected Barbarian Armies that may NOT move: A3", - "Player1: Population Boom: Barbarians move from B3 to B2: 2 infantry, Player2 was selected to gain 1 settler.", - "Barbarians: Population Boom: Gain 1 infantry at B3", - "Player2: Population Boom: Gain 1 settler at C1" - ] + "active_events": 3 } ] } diff --git a/server/tests/test_games/incidents/barbarians_recapture_city.outcome.json b/server/tests/test_games/incidents/barbarians_recapture_city.outcome.json index ec746498..f79288cf 100644 --- a/server/tests/test_games/incidents/barbarians_recapture_city.outcome.json +++ b/server/tests/test_games/incidents/barbarians_recapture_city.outcome.json @@ -214,6 +214,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -243,43 +247,159 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "elephants": 4 + }, + "start": "B1", + "destination": "C2" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "elephants": 4 + }, + "defending_player": 2, + "defenders": { + "infantry": 3 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 19, + "hits": 3 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 2, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 10, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 2 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "elephants": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "B1" }, "origin": { "Ability": "Combat" } }, + { + "player": 2, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 2, "Units": { "units": { "infantry": 3 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 2, "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -290,7 +410,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -307,18 +428,19 @@ "origin": { "Ability": "Barbarian battle" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 2 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 4 elephants from B1 to C2, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 4 elephants, Roll 6 (infantry, no bonus), 6 (infantry, no bonus), 6 (infantry, no bonus), 1 (leader, no bonus) for combined combat value of 19 and gets 3 hits against defending units, Lost 2 elephants at B1, Gain city C2", - "Barbarians: Combat: Defending with 3 infantry, Roll 1 (leader, no bonus), 2 (cavalry, no bonus), 6 (infantry, +1 combat value) for combined combat value of 10 and gets 2 hits against attacking units, Lost 3 infantry at C2, Lose city C2", - "Player1: Choose Casualties: Remove 2 of their attacking units", - "Barbarians: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Barbarian battle: Gain 2 gold", - "Player1: Waste: Could not store 2 gold" ] } ] diff --git a/server/tests/test_games/incidents/barbarians_spawn.outcome1.json b/server/tests/test_games/incidents/barbarians_spawn.outcome1.json index 8f804bec..0250919e 100644 --- a/server/tests/test_games/incidents/barbarians_spawn.outcome1.json +++ b/server/tests/test_games/incidents/barbarians_spawn.outcome1.json @@ -265,6 +265,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -282,19 +283,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } }, + { + "player": 0, + "Text": "triggers the event A good year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 9 + } + }, { "player": 2, "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "A3" + "position": "A3", + "port_position": null }, "origin": { "Incident": 9 @@ -306,20 +324,15 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A3" }, "origin": { "Incident": 9 } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A good year", - "Player1: A good year: Base effect: Barbarians spawn", - "Barbarians: A good year: Gain city A3, Gain 1 infantry at A3" - ] + "active_events": 1 }, { "action": { @@ -327,6 +340,7 @@ "SelectUnitType": "Elephant" } }, + "player": 0, "items": [ { "player": 2, @@ -334,7 +348,8 @@ "units": { "elephants": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A3" }, "origin": { "Incident": 9 @@ -363,14 +378,21 @@ "origin": { "Incident": 9 } + }, + { + "player": 1, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Barbarians: A good year: Gain 1 elephant at A3", - "Player1: A good year: Gain 1 food", - "Player2: A good year: Gain 1 food", - "Player2: Waste: Could not store 1 food" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/civil_war/civil_war.outcome.json b/server/tests/test_games/incidents/civil_war/civil_war.outcome.json index 4e6e0ad1..80183fd0 100644 --- a/server/tests/test_games/incidents/civil_war/civil_war.outcome.json +++ b/server/tests/test_games/incidents/civil_war/civil_war.outcome.json @@ -231,11 +231,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -247,7 +251,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -269,13 +273,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Civil War", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "MoodChange": { @@ -292,18 +305,13 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 36 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Civil War", - "Player1: Civil War: City C2 became Angry, Lost 1 infantry at C2" ] } ] diff --git a/server/tests/test_games/incidents/civil_war/envoy.outcome.json b/server/tests/test_games/incidents/civil_war/envoy.outcome.json index 97ecf8fa..75e8ee5e 100644 --- a/server/tests/test_games/incidents/civil_war/envoy.outcome.json +++ b/server/tests/test_games/incidents/civil_war/envoy.outcome.json @@ -231,11 +231,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -247,7 +251,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -269,13 +273,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Envoy", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 40 + } + }, { "player": 0, "Resources": { @@ -289,6 +323,13 @@ "Incident": 40 } }, + { + "player": 0, + "Text": "Pyramids is now available to be taken by anyone", + "origin": { + "Incident": 40 + } + }, { "player": 1, "Resources": { @@ -301,13 +342,6 @@ "Incident": 40 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Envoy", - "Player1: Envoy: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Gain 1 idea and 1 culture token, Pyramids is now available to be taken by anyone", - "Player2: Envoy: Gain 1 culture token" ] } ] diff --git a/server/tests/test_games/incidents/civil_war/envoy.outcome1.json b/server/tests/test_games/incidents/civil_war/envoy.outcome1.json index 298e7323..13806d05 100644 --- a/server/tests/test_games/incidents/civil_war/envoy.outcome1.json +++ b/server/tests/test_games/incidents/civil_war/envoy.outcome1.json @@ -255,11 +255,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -271,7 +275,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -293,13 +297,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Envoy", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 40 + } + }, { "player": 0, "Resources": { @@ -313,6 +347,13 @@ "Incident": 40 } }, + { + "player": 0, + "Text": "Pyramids is now available to be taken by anyone", + "origin": { + "Incident": 40 + } + }, { "player": 1, "Resources": { @@ -325,13 +366,6 @@ "Incident": 40 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Envoy", - "Player1: Envoy: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Gain 1 idea and 1 culture token, Pyramids is now available to be taken by anyone", - "Player2: Envoy: Gain 1 culture token" ] }, { @@ -345,11 +379,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -361,7 +399,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -383,17 +421,15 @@ "player": 0, "Advance": { "advance": "Monuments", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Monuments and take an event token (2 left)", - "Player1: Monuments: Gain 1 culture token" ] } ] diff --git a/server/tests/test_games/incidents/civil_war/envoy.outcome2.json b/server/tests/test_games/incidents/civil_war/envoy.outcome2.json index b261efa3..5e9b4a76 100644 --- a/server/tests/test_games/incidents/civil_war/envoy.outcome2.json +++ b/server/tests/test_games/incidents/civil_war/envoy.outcome2.json @@ -235,11 +235,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -251,7 +255,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -273,13 +277,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Envoy", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 40 + } + }, { "player": 0, "Resources": { @@ -293,6 +327,13 @@ "Incident": 40 } }, + { + "player": 0, + "Text": "Pyramids is now available to be taken by anyone", + "origin": { + "Incident": 40 + } + }, { "player": 1, "Resources": { @@ -305,13 +346,6 @@ "Incident": 40 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Envoy", - "Player1: Envoy: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Gain 1 idea and 1 culture token, Pyramids is now available to be taken by anyone", - "Player2: Envoy: Gain 1 culture token" ] }, { @@ -325,11 +359,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -341,7 +379,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -363,17 +401,15 @@ "player": 0, "Advance": { "advance": "Monuments", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Monuments and take an event token (2 left)", - "Player1: Monuments: Gain 1 culture token" ] }, { @@ -382,6 +418,7 @@ "Bool": true } }, + "player": 0, "items": [ { "player": 0, @@ -399,9 +436,7 @@ } } ], - "log": [ - "Player1: Draw Wonder Card: Gain Pyramids from the public area" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/civil_war/migration.outcome.json b/server/tests/test_games/incidents/civil_war/migration.outcome.json index 7740769a..0004d122 100644 --- a/server/tests/test_games/incidents/civil_war/migration.outcome.json +++ b/server/tests/test_games/incidents/civil_war/migration.outcome.json @@ -220,11 +220,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -236,7 +240,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -258,13 +262,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Migration", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -277,6 +290,13 @@ "Ability": "Gold deposits" } }, + { + "player": 0, + "Text": "Player2 was selected to gain 1 settler.", + "origin": { + "Incident": 34 + } + }, { "player": 0, "MoodChange": { @@ -293,20 +313,13 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A4" }, "origin": { "Incident": 34 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Migration", - "Player1: Gold deposits: Gain 2 gold", - "Player1: Migration: Player2 was selected to gain 1 settler., City C2 became Neutral", - "Player2: Migration: Gain 1 settler at A4" ] } ] diff --git a/server/tests/test_games/incidents/civil_war/revolution.outcome3.json b/server/tests/test_games/incidents/civil_war/revolution.outcome3.json index 4e306fba..6d93c669 100644 --- a/server/tests/test_games/incidents/civil_war/revolution.outcome3.json +++ b/server/tests/test_games/incidents/civil_war/revolution.outcome3.json @@ -231,11 +231,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -247,7 +251,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -269,13 +273,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Revolution", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -288,12 +301,6 @@ "Ability": "Gold deposits" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Revolution", - "Player1: Gold deposits: Gain 2 gold" ] }, { @@ -304,6 +311,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -311,16 +319,15 @@ "units": { "elephants": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 38 } } ], - "log": [ - "Player1: Revolution: Lost 1 elephant at C2" - ] + "active_events": 1 }, { "action": { @@ -328,7 +335,15 @@ "SelectUnits": [] } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Declined to kill units", + "origin": { + "Incident": 38 + } + }, { "player": 0, "Action": { @@ -339,9 +354,7 @@ } } ], - "log": [ - "Player1: Revolution: Declined to kill units, Lose 1 action" - ] + "active_events": 1 }, { "action": { @@ -352,35 +365,72 @@ } } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Democracy changed their government from Player1 to Theocracy", + "origin": { + "Incident": 38 + } + }, + { + "player": 0, + "Text": "Additional advances: none", + "origin": { + "Incident": 38 + } + }, { "player": 0, "Advance": { "advance": "Voting", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { "Incident": 38 } }, + { + "player": 0, + "Text": "Ideas limit reduced to 2", + "origin": { + "Advance": "Dogma" + } + }, + { + "player": 0, + "Text": "unlocks Provinces", + "origin": { + "Incident": 38 + } + }, { "player": 0, "Advance": { "advance": "Dogma", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "Incident": 38 } + }, + { + "player": 0, + "Resources": { + "resources": { + "ideas": 3 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Revolution: Player1 changed their government from Democracy to Theocracy, Additional advances: none, Unlock Provinces, Gain Dogma without taking an event token", - "Player1: Dogma: Ideas limit reduced to 2", - "Player1: Waste: Could not store 3 ideas" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/civil_war/uprising.outcome.json b/server/tests/test_games/incidents/civil_war/uprising.outcome.json index bc220bcd..eb217e6a 100644 --- a/server/tests/test_games/incidents/civil_war/uprising.outcome.json +++ b/server/tests/test_games/incidents/civil_war/uprising.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 39, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -297,11 +300,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -313,7 +320,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -335,18 +342,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Uprising", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Uprising" ] } ] diff --git a/server/tests/test_games/incidents/civil_war/uprising.outcome1.json b/server/tests/test_games/incidents/civil_war/uprising.outcome1.json index e76cc9fe..e30a210c 100644 --- a/server/tests/test_games/incidents/civil_war/uprising.outcome1.json +++ b/server/tests/test_games/incidents/civil_war/uprising.outcome1.json @@ -245,11 +245,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -261,7 +265,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -283,18 +287,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Uprising", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Uprising" ] }, { @@ -308,6 +316,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -316,16 +325,21 @@ "mood_tokens": 1, "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 39 } + }, + { + "player": 0, + "Text": "Gain 1 victory point", + "origin": { + "Incident": 39 + } } ], - "log": [ - "Player1: Uprising: Pay 1 mood token and 1 culture token, Gain 1 victory point" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/earthquake/earthquake.outcome3.json b/server/tests/test_games/incidents/earthquake/earthquake.outcome3.json index ccbbd6ee..09005f11 100644 --- a/server/tests/test_games/incidents/earthquake/earthquake.outcome3.json +++ b/server/tests/test_games/incidents/earthquake/earthquake.outcome3.json @@ -244,11 +244,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -260,7 +264,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -282,18 +286,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Heavy Earthquake", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Heavy Earthquake" ] }, { @@ -319,6 +327,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -327,12 +336,20 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Incident": 31 } }, + { + "player": 0, + "Text": "Gain 2 points for the Fortress at C2", + "origin": { + "Incident": 31 + } + }, { "player": 0, "Structure": { @@ -340,16 +357,29 @@ "Wonder": "GreatGardens" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Incident": 31 } + }, + { + "player": 0, + "Text": "Gain 2 points for the Great Gardens at C2", + "origin": { + "Incident": 31 + } + }, + { + "player": 0, + "Text": "Gain 2 points for the city center at B2", + "origin": { + "Incident": 31 + } } ], - "log": [ - "Player1: Heavy Earthquake: Lose Fortress at C2, Gain 2 points for the Fortress at C2, Lose Great Gardens at C2, Gain 2 points for the Great Gardens at C2, Gain 2 points for the city center at B2" - ] + "active_events": 1 }, { "action": { @@ -361,6 +391,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -368,16 +399,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Myths" } + }, + { + "player": 0, + "Text": "Avoid mood change", + "origin": { + "Advance": "Myths" + } } ], - "log": [ - "Player1: Myths: Pay 1 mood token, Avoid mood change" - ] + "active_events": 1 }, { "action": { @@ -400,6 +436,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -408,17 +445,36 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Incident": 31 } + }, + { + "player": 0, + "Text": "Gain 2 points for the Fortress at A1", + "origin": { + "Incident": 31 + } + }, + { + "player": 1, + "Text": "Gain 2 points for the city center at A1", + "origin": { + "Incident": 31 + } + }, + { + "player": 1, + "Text": "Gain 2 points for the city center at A3", + "origin": { + "Incident": 31 + } } ], - "log": [ - "Player2: Heavy Earthquake: Lose Fortress at A1, Gain 2 points for the city center at A1, Gain 2 points for the city center at A3", - "Player1: Heavy Earthquake: Gain 2 points for the Fortress at A1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/earthquake/flood.outcome.json b/server/tests/test_games/incidents/earthquake/flood.outcome.json index ef0c6d82..9c8adee0 100644 --- a/server/tests/test_games/incidents/earthquake/flood.outcome.json +++ b/server/tests/test_games/incidents/earthquake/flood.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 33, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -268,11 +271,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -284,7 +291,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -306,18 +313,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Heavy Flood", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Heavy Flood" ] } ] diff --git a/server/tests/test_games/incidents/earthquake/flood.outcome1.json b/server/tests/test_games/incidents/earthquake/flood.outcome1.json index 8378ab93..7fba7b29 100644 --- a/server/tests/test_games/incidents/earthquake/flood.outcome1.json +++ b/server/tests/test_games/incidents/earthquake/flood.outcome1.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 33, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -270,11 +273,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -286,7 +293,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -308,18 +315,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Heavy Flood", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Heavy Flood" ] }, { @@ -330,6 +341,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -342,9 +354,7 @@ } } ], - "log": [ - "Player1: Heavy Flood: City C2 became Neutral" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/earthquake/flood.outcome2.json b/server/tests/test_games/incidents/earthquake/flood.outcome2.json index 31c39345..a03a11d3 100644 --- a/server/tests/test_games/incidents/earthquake/flood.outcome2.json +++ b/server/tests/test_games/incidents/earthquake/flood.outcome2.json @@ -236,11 +236,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -252,7 +256,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -274,18 +278,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Heavy Flood", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Heavy Flood" ] }, { @@ -296,6 +304,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -308,9 +317,7 @@ } } ], - "log": [ - "Player1: Heavy Flood: City C2 became Neutral" - ] + "active_events": 1 }, { "action": { @@ -320,6 +327,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -332,9 +340,7 @@ } } ], - "log": [ - "Player2: Heavy Flood: City A1 became Neutral" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/earthquake/volcano.outcome.json b/server/tests/test_games/incidents/earthquake/volcano.outcome.json index 5e78ca7b..e5d05480 100644 --- a/server/tests/test_games/incidents/earthquake/volcano.outcome.json +++ b/server/tests/test_games/incidents/earthquake/volcano.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 29, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -246,11 +249,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -262,7 +269,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -284,18 +291,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Vulcan", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Vulcan" ] } ] diff --git a/server/tests/test_games/incidents/earthquake/volcano.outcome1.json b/server/tests/test_games/incidents/earthquake/volcano.outcome1.json index 7e0d96c2..5bae9ab2 100644 --- a/server/tests/test_games/incidents/earthquake/volcano.outcome1.json +++ b/server/tests/test_games/incidents/earthquake/volcano.outcome1.json @@ -182,11 +182,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -198,7 +202,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -220,18 +224,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Vulcan", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Vulcan" ] }, { @@ -242,7 +250,15 @@ ] } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Selected city C2 to be destroyed", + "origin": { + "Incident": 29 + } + }, { "player": 0, "Structure": { @@ -250,12 +266,20 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Incident": 29 } }, + { + "player": 0, + "Text": "Gain 2 points for the Fortress at C2", + "origin": { + "Incident": 29 + } + }, { "player": 0, "Structure": { @@ -263,12 +287,20 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Incident": 29 } }, + { + "player": 1, + "Text": "Gain 2 points for the Temple at C2", + "origin": { + "Incident": 29 + } + }, { "player": 0, "Structure": { @@ -276,12 +308,27 @@ "Wonder": "Pyramids" }, "balance": "Loss", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Incident": 29 } }, + { + "player": 0, + "Text": "Gain 0 points for the Pyramids at C2", + "origin": { + "Incident": 29 + } + }, + { + "player": 0, + "Text": "Gain 2 points for the city center at C2", + "origin": { + "Incident": 29 + } + }, { "player": 0, "Units": { @@ -291,17 +338,15 @@ "cavalry": 1, "elephants": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 29 } } ], - "log": [ - "Player1: Vulcan: Selected city C2 to be destroyed, Lose Fortress at C2, Gain 2 points for the Fortress at C2, Lose Temple at C2, Lose Pyramids at C2, Gain 0 points for the Pyramids at C2, Gain 2 points for the city center at C2, Lost 4 settlers, 2 infantry, 1 cavalry and 1 elephant at C2", - "Player2: Vulcan: Gain 2 points for the Temple at C2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/exhausted_land.outcome.json b/server/tests/test_games/incidents/exhausted_land.outcome.json index 8caf9874..20ac2e37 100644 --- a/server/tests/test_games/incidents/exhausted_land.outcome.json +++ b/server/tests/test_games/incidents/exhausted_land.outcome.json @@ -12,6 +12,9 @@ "event_type": { "Incident": { "incident_id": 13, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -248,6 +251,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -265,19 +269,24 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event An awesome year", + "origin": { + "Advance": "Storage" + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: An awesome year" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/exhausted_land.outcome1.json b/server/tests/test_games/incidents/exhausted_land.outcome1.json index c04c3848..642dcfe0 100644 --- a/server/tests/test_games/incidents/exhausted_land.outcome1.json +++ b/server/tests/test_games/incidents/exhausted_land.outcome1.json @@ -249,6 +249,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -266,19 +267,24 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event An awesome year", + "origin": { + "Advance": "Storage" + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: An awesome year" - ] + "active_events": 1 }, { "action": { @@ -288,7 +294,15 @@ ] } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Exhausted the land in position B2", + "origin": { + "Incident": 13 + } + }, { "player": 0, "Resources": { @@ -312,13 +326,21 @@ "origin": { "Incident": 13 } + }, + { + "player": 1, + "Resources": { + "resources": { + "food": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: An awesome year: Exhausted the land in position B2, Gain 2 food", - "Player2: An awesome year: Gain 2 food", - "Player2: Waste: Could not store 1 food" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/famine/epidemics.outcome.json b/server/tests/test_games/incidents/famine/epidemics.outcome.json index ebcdec7a..08404fc6 100644 --- a/server/tests/test_games/incidents/famine/epidemics.outcome.json +++ b/server/tests/test_games/incidents/famine/epidemics.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 2, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -250,11 +253,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -266,7 +273,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -288,18 +295,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Epidemics", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Epidemics" ] } ] diff --git a/server/tests/test_games/incidents/famine/epidemics.outcome1.json b/server/tests/test_games/incidents/famine/epidemics.outcome1.json index c325d3ea..666bde93 100644 --- a/server/tests/test_games/incidents/famine/epidemics.outcome1.json +++ b/server/tests/test_games/incidents/famine/epidemics.outcome1.json @@ -207,11 +207,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -223,7 +227,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -245,18 +249,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Epidemics", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Epidemics" ] }, { @@ -267,6 +275,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -274,16 +283,15 @@ "units": { "settlers": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 2 } } ], - "log": [ - "Player1: Epidemics: Lost 1 settler at C2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/famine/famine.outcome.json b/server/tests/test_games/incidents/famine/famine.outcome.json index 56bc311d..2d987f47 100644 --- a/server/tests/test_games/incidents/famine/famine.outcome.json +++ b/server/tests/test_games/incidents/famine/famine.outcome.json @@ -216,11 +216,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -232,7 +236,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -254,13 +258,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Severe famine", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 7 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 7 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 7 + } + }, { "player": 0, "Resources": { @@ -273,6 +307,13 @@ "Incident": 7 } }, + { + "player": 0, + "Text": "Lost 1 food", + "origin": { + "Incident": 7 + } + }, { "player": 0, "MoodChange": { @@ -283,12 +324,6 @@ "Incident": 7 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Severe famine", - "Player1: Severe famine: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Lost 1 food, City A1 became Angry" ] } ] diff --git a/server/tests/test_games/incidents/famine/famine_protected.outcome.json b/server/tests/test_games/incidents/famine/famine_protected.outcome.json index 46f84477..202d838d 100644 --- a/server/tests/test_games/incidents/famine/famine_protected.outcome.json +++ b/server/tests/test_games/incidents/famine/famine_protected.outcome.json @@ -218,11 +218,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -234,7 +238,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -256,19 +260,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Severe famine", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 7 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 7 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 7 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Severe famine", - "Player1: Severe famine: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city" ] } ] diff --git a/server/tests/test_games/incidents/famine/pestilence.outcome.json b/server/tests/test_games/incidents/famine/pestilence.outcome.json index d7a00898..69d478d1 100644 --- a/server/tests/test_games/incidents/famine/pestilence.outcome.json +++ b/server/tests/test_games/incidents/famine/pestilence.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 1, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -270,11 +273,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -286,7 +293,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -308,18 +315,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pestilence", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pestilence" ] } ] diff --git a/server/tests/test_games/incidents/famine/pestilence.outcome1.json b/server/tests/test_games/incidents/famine/pestilence.outcome1.json index 516d53a7..c45de321 100644 --- a/server/tests/test_games/incidents/famine/pestilence.outcome1.json +++ b/server/tests/test_games/incidents/famine/pestilence.outcome1.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 1, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "myths_payment": 1 } @@ -256,11 +259,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -272,7 +279,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -294,18 +301,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pestilence", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pestilence" ] }, { @@ -318,6 +329,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -325,16 +337,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Myths" } + }, + { + "player": 0, + "Text": "Avoid mood change", + "origin": { + "Advance": "Myths" + } } ], - "log": [ - "Player1: Myths: Pay 1 mood token, Avoid mood change" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/famine/pestilence.outcome2.json b/server/tests/test_games/incidents/famine/pestilence.outcome2.json index fde21cac..d02df715 100644 --- a/server/tests/test_games/incidents/famine/pestilence.outcome2.json +++ b/server/tests/test_games/incidents/famine/pestilence.outcome2.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 1, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -273,11 +276,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -289,7 +296,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -311,18 +318,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pestilence", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pestilence" ] }, { @@ -335,6 +346,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -342,16 +354,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Myths" } + }, + { + "player": 0, + "Text": "Avoid mood change", + "origin": { + "Advance": "Myths" + } } ], - "log": [ - "Player1: Myths: Pay 1 mood token, Avoid mood change" - ] + "active_events": 1 }, { "action": { @@ -361,6 +378,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -373,9 +391,7 @@ } } ], - "log": [ - "Player1: Pestilence: City A1 became Neutral" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/famine/pestilence.outcome3.json b/server/tests/test_games/incidents/famine/pestilence.outcome3.json index f02fe85d..d1e4df53 100644 --- a/server/tests/test_games/incidents/famine/pestilence.outcome3.json +++ b/server/tests/test_games/incidents/famine/pestilence.outcome3.json @@ -223,11 +223,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -239,7 +243,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -261,18 +265,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pestilence", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pestilence" ] }, { @@ -285,6 +293,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -292,16 +301,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Myths" } + }, + { + "player": 0, + "Text": "Avoid mood change", + "origin": { + "Advance": "Myths" + } } ], - "log": [ - "Player1: Myths: Pay 1 mood token, Avoid mood change" - ] + "active_events": 1 }, { "action": { @@ -311,6 +325,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -323,9 +338,7 @@ } } ], - "log": [ - "Player1: Pestilence: City A1 became Neutral" - ] + "active_events": 1 }, { "action": { @@ -337,6 +350,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -344,16 +358,21 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Myths" } + }, + { + "player": 1, + "Text": "Avoid mood change", + "origin": { + "Advance": "Myths" + } } ], - "log": [ - "Player2: Myths: Pay 1 mood token, Avoid mood change" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/good_year/good_year.outcome1.json b/server/tests/test_games/incidents/good_year/good_year.outcome1.json index f0b3890c..42c94393 100644 --- a/server/tests/test_games/incidents/good_year/good_year.outcome1.json +++ b/server/tests/test_games/incidents/good_year/good_year.outcome1.json @@ -265,6 +265,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -282,19 +283,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } }, + { + "player": 0, + "Text": "triggers the event A good year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 11 + } + }, { "player": 2, "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "B3" + "position": "B3", + "port_position": null }, "origin": { "Incident": 11 @@ -306,20 +324,15 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "Incident": 11 } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A good year", - "Player1: A good year: Base effect: Barbarians spawn", - "Barbarians: A good year: Gain city B3, Gain 1 infantry at B3" - ] + "active_events": 1 }, { "action": { @@ -327,6 +340,7 @@ "SelectUnitType": "Elephant" } }, + "player": 0, "items": [ { "player": 2, @@ -334,7 +348,8 @@ "units": { "elephants": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "Incident": 11 @@ -365,11 +380,7 @@ } } ], - "log": [ - "Barbarians: A good year: Gain 1 elephant at B3", - "Player1: A good year: Gain 1 food", - "Player2: A good year: Gain 1 food" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/good_year/successful_year.outcome.json b/server/tests/test_games/incidents/good_year/successful_year.outcome.json index 9c902d39..5f6aa57a 100644 --- a/server/tests/test_games/incidents/good_year/successful_year.outcome.json +++ b/server/tests/test_games/incidents/good_year/successful_year.outcome.json @@ -252,6 +252,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -269,13 +270,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 54 + } + }, { "player": 1, "Resources": { @@ -289,13 +313,7 @@ } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn, No valid positions for Pirate Ship", - "Player2: A successful year: Gain 1 food" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_architect.outcome4.json b/server/tests/test_games/incidents/great_persons/great_architect.outcome4.json index faa3312d..3c7a41ae 100644 --- a/server/tests/test_games/incidents/great_persons/great_architect.outcome4.json +++ b/server/tests/test_games/incidents/great_persons/great_architect.outcome4.json @@ -220,11 +220,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -236,7 +240,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -258,19 +262,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Architect", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 55 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 55 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Architect", - "Player1: Great Architect: Base effect: Pirates spawn, No valid positions for Pirate Ship" ] }, { @@ -283,6 +304,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -290,7 +312,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 55 @@ -312,9 +334,7 @@ } } ], - "log": [ - "Player1: Great Architect: Pay 1 culture token, Gain Great Architect from the current event" - ] + "active_events": 1 }, { "action": { @@ -322,6 +342,10 @@ "ActionCard": 155 } }, + "player": 0, + "origin": { + "CivilCard": 155 + }, "items": [ { "player": 0, @@ -338,10 +362,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Action Card: Play Great Architect", - "Player1: Build Wonder: Play the wonder card Pyramids" ] }, { @@ -352,9 +372,8 @@ ] } }, - "log": [ - "Player1: Build Wonder: Decided to build Pyramids in city A1" - ] + "player": 0, + "active_events": 2 }, { "action": { @@ -370,6 +389,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -381,7 +401,7 @@ "gold": 1, "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "Pyramids" @@ -409,17 +429,15 @@ "Wonder": "Pyramids" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "CivilCard": 155 } } ], - "log": [ - "Player1: Pyramids: Pay 2 food, 3 wood, 6 ore, 1 gold and 2 culture tokens", - "Player1: Great Architect: Play Pyramids, Gain Pyramids at A1" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_artist.outcome.json b/server/tests/test_games/incidents/great_persons/great_artist.outcome.json index 0e5e27e2..7b9e1076 100644 --- a/server/tests/test_games/incidents/great_persons/great_artist.outcome.json +++ b/server/tests/test_games/incidents/great_persons/great_artist.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 19, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -265,11 +268,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -281,7 +288,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -303,19 +310,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Artist", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Cannot afford to buy Great Artist", + "origin": { + "Incident": 19 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Artist", - "Player1: Great Artist: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Cannot afford to buy Great Artist" ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_artist.outcome1.json b/server/tests/test_games/incidents/great_persons/great_artist.outcome1.json index 25187222..f83e829e 100644 --- a/server/tests/test_games/incidents/great_persons/great_artist.outcome1.json +++ b/server/tests/test_games/incidents/great_persons/great_artist.outcome1.json @@ -230,11 +230,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -246,7 +250,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -268,19 +272,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Artist", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Cannot afford to buy Great Artist", + "origin": { + "Incident": 19 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Artist", - "Player1: Great Artist: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Cannot afford to buy Great Artist" ] }, { @@ -293,6 +328,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -300,7 +336,7 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 19 @@ -322,9 +358,7 @@ } } ], - "log": [ - "Player2: Great Artist: Pay 2 culture tokens, Gain Great Artist from the current event" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_artist.outcome2.json b/server/tests/test_games/incidents/great_persons/great_artist.outcome2.json index 2035bc3d..cd2f0d69 100644 --- a/server/tests/test_games/incidents/great_persons/great_artist.outcome2.json +++ b/server/tests/test_games/incidents/great_persons/great_artist.outcome2.json @@ -227,11 +227,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -243,7 +247,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -265,19 +269,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Artist", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Cannot afford to buy Great Artist", + "origin": { + "Incident": 19 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Artist", - "Player1: Great Artist: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Cannot afford to buy Great Artist" ] }, { @@ -290,6 +325,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -297,7 +333,7 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 19 @@ -319,16 +355,27 @@ } } ], - "log": [ - "Player2: Great Artist: Pay 2 culture tokens, Gain Great Artist from the current event" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 2 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 2 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_artist.outcome3.json b/server/tests/test_games/incidents/great_persons/great_artist.outcome3.json index a9e529b6..2abd6abd 100644 --- a/server/tests/test_games/incidents/great_persons/great_artist.outcome3.json +++ b/server/tests/test_games/incidents/great_persons/great_artist.outcome3.json @@ -225,11 +225,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -241,7 +245,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -263,19 +267,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Artist", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 19 + } + }, + { + "player": 0, + "Text": "Cannot afford to buy Great Artist", + "origin": { + "Incident": 19 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Artist", - "Player1: Great Artist: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Cannot afford to buy Great Artist" ] }, { @@ -288,6 +323,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -295,7 +331,7 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 19 @@ -317,16 +353,27 @@ } } ], - "log": [ - "Player2: Great Artist: Pay 2 culture tokens, Gain Great Artist from the current event" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 2 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 2 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -342,11 +389,15 @@ "ActionCard": 119 } }, + "player": 1, + "origin": { + "CivilCard": 119 + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 119 @@ -367,6 +418,13 @@ "Ability": "Action Card" } }, + { + "player": 1, + "Text": "unlocks Hellenistic Culture", + "origin": { + "CivilCard": 119 + } + }, { "player": 1, "Resources": { @@ -383,7 +441,7 @@ "player": 1, "Advance": { "advance": "Arts", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -400,11 +458,6 @@ "CivilCard": 119 } } - ], - "log": [ - "Player2: Great Artist: Pay 1 action, Unlock Hellenistic Culture, Gain Arts without taking an event token, City A1 became Happy", - "Player2: Action Card: Play Great Artist", - "Player2: Arts: Gain 1 culture token" ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_athlete.outcome4.json b/server/tests/test_games/incidents/great_persons/great_athlete.outcome4.json index 90a4b012..23122c5e 100644 --- a/server/tests/test_games/incidents/great_persons/great_athlete.outcome4.json +++ b/server/tests/test_games/incidents/great_persons/great_athlete.outcome4.json @@ -212,11 +212,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -228,7 +232,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -250,19 +254,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Athlete", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 56 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 56 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Athlete", - "Player1: Great Athlete: Base effect: Pirates spawn, No valid positions for Pirate Ship" ] }, { @@ -275,6 +296,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -282,7 +304,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 56 @@ -304,9 +326,7 @@ } } ], - "log": [ - "Player1: Great Athlete: Pay 1 culture token, Gain Great Athlete from the current event" - ] + "active_events": 1 }, { "action": { @@ -314,11 +334,15 @@ "ActionCard": 156 } }, + "player": 0, + "origin": { + "CivilCard": 156 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 156 @@ -355,18 +379,13 @@ "player": 0, "Advance": { "advance": "Arts", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 156 } } - ], - "log": [ - "Player1: Great Athlete: Pay 1 action, Gain Arts without taking an event token", - "Player1: Action Card: Play Great Athlete", - "Player1: Arts: Gain 1 culture token" ] }, { @@ -375,9 +394,17 @@ "Bool": true } }, - "log": [ - "Player1: Great Athlete: Decided to convert culture to mood tokens" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Decided to convert culture to mood tokens", + "origin": { + "CivilCard": 156 + } + } + ], + "active_events": 1 }, { "action": { @@ -389,6 +416,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -396,7 +424,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 156 @@ -415,9 +443,7 @@ } } ], - "log": [ - "Player1: Great Athlete: Pay 1 culture token, Gain 1 mood token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_diplomat.outcome2.json b/server/tests/test_games/incidents/great_persons/great_diplomat.outcome2.json index ad6fc03f..523fd20a 100644 --- a/server/tests/test_games/incidents/great_persons/great_diplomat.outcome2.json +++ b/server/tests/test_games/incidents/great_persons/great_diplomat.outcome2.json @@ -234,11 +234,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -250,7 +254,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -272,19 +276,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Diplomat", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 57 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 57 + } + }, + { + "player": 0, + "Text": "Barbarians cannot reinforce", + "origin": { + "Incident": 57 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Diplomat", - "Player1: Great Diplomat: Base effect: Barbarians spawn, Barbarians cannot spawn a new city, Barbarians cannot reinforce" ] }, { @@ -297,6 +325,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -304,7 +333,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 57 @@ -324,11 +353,16 @@ "origin": { "Incident": 57 } + }, + { + "player": 0, + "Text": "Initiated diplomatic relations with Player2", + "origin": { + "Incident": 57 + } } ], - "log": [ - "Player1: Great Diplomat: Pay 1 culture token, Gain Great Diplomat from the current event, Initiated diplomatic relations with Player2" - ] + "active_events": 1 }, { "action": { @@ -344,6 +378,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Land", @@ -370,10 +408,23 @@ "result": "Draw" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "B1" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -385,7 +436,7 @@ "resources": { "culture_tokens": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" @@ -396,40 +447,110 @@ } ] }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Diplomatic relations with Player2 ended with a surprise attack.", + "origin": { + "Ability": "Diplomatic Relations" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to B1 for 2 culture tokens, Pay 1 action, Pay 2 culture tokens with Great Diplomat", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Defending with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units, Lost 1 infantry at B1", - "Player1: Diplomatic Relations: Diplomatic relations with Player2 ended with a surprise attack.", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Battle ends in a draw" ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_engineer.outcome5.json b/server/tests/test_games/incidents/great_persons/great_engineer.outcome5.json index 09a3abbd..350739e4 100644 --- a/server/tests/test_games/incidents/great_persons/great_engineer.outcome5.json +++ b/server/tests/test_games/incidents/great_persons/great_engineer.outcome5.json @@ -234,11 +234,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -250,7 +254,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -272,19 +276,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Engineer", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 26 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 26 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 26 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Engineer", - "Player1: Great Engineer: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city" ] }, { @@ -297,6 +325,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -304,7 +333,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 26 @@ -326,9 +355,7 @@ } } ], - "log": [ - "Player1: Great Engineer: Pay 1 culture token, Gain Great Engineer from the current event" - ] + "active_events": 1 }, { "action": { @@ -336,11 +363,15 @@ "ActionCard": 126 } }, + "player": 0, + "origin": { + "CivilCard": 126 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 126 @@ -361,10 +392,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Great Engineer: Pay 1 action", - "Player1: Action Card: Play Great Engineer" ] }, { @@ -373,6 +400,7 @@ "SelectAdvance": "Engineering" } }, + "player": 0, "items": [ { "player": 0, @@ -389,11 +417,18 @@ "Advance": "Engineering" } }, + { + "player": 0, + "Text": "unlocks Aqueduct", + "origin": { + "CivilCard": 126 + } + }, { "player": 0, "Advance": { "advance": "Engineering", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -401,10 +436,7 @@ } } ], - "log": [ - "Player1: Engineering: Draw a wonder card", - "Player1: Great Engineer: Unlock Aqueduct, Gain Engineering without taking an event token" - ] + "active_events": 1 }, { "action": { @@ -412,7 +444,15 @@ "Bool": true } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Great Engineer: You may build a building in a city without spending an action and without activating it.", + "origin": { + "CivilCard": 126 + } + }, { "player": 0, "Action": { @@ -423,9 +463,7 @@ } } ], - "log": [ - "Player1: Great Engineer: Great Engineer: You may build a building in a city without spending an action and without activating it., Gain 1 action" - ] + "active_events": 1 }, { "action": { @@ -442,11 +480,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Construct Building" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -460,7 +502,7 @@ "wood": 1, "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -474,6 +516,13 @@ } ] }, + { + "player": 0, + "Text": "May replace resources with mood tokens", + "origin": { + "SpecialAdvance": "Captivi" + } + }, { "player": 0, "Structure": { @@ -481,16 +530,13 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C2" + "position": "C2", + "port_position": null }, "origin": { "Ability": "Construct Building" } } - ], - "log": [ - "Player1: Construct Building: Pay 1 action, Pay 1 food, 1 wood and 1 ore with Captivi, Construct Only, Gain Fortress at C2", - "Player1: Captivi: May replace resources with mood tokens" ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_explorer.outcome6.json b/server/tests/test_games/incidents/great_persons/great_explorer.outcome6.json index 529acff5..0f95ffb4 100644 --- a/server/tests/test_games/incidents/great_persons/great_explorer.outcome6.json +++ b/server/tests/test_games/incidents/great_persons/great_explorer.outcome6.json @@ -366,11 +366,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -382,7 +386,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -404,19 +408,29 @@ "player": 1, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 1, + "Text": "triggers the event Great Explorer", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 1, + "Text": "Exhausted the land in position E8", + "origin": { + "Incident": 18 + } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player2: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Explorer", - "Player2: Great Explorer: Exhausted the land in position E8" ] }, { @@ -429,6 +443,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -436,7 +451,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 18 @@ -458,9 +473,7 @@ } } ], - "log": [ - "Player2: Great Explorer: Pay 1 culture token, Gain Great Explorer from the current event" - ] + "active_events": 1 }, { "action": { @@ -468,11 +481,15 @@ "ActionCard": 118 } }, + "player": 1, + "origin": { + "CivilCard": 118 + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 118 @@ -509,18 +526,13 @@ "player": 1, "Advance": { "advance": "Fishing", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 118 } } - ], - "log": [ - "Player2: Great Explorer: Pay 1 action, Gain Fishing without taking an event token", - "Player2: Action Card: Play Great Explorer", - "Player2: Fishing: Gain 1 mood token" ] }, { @@ -531,9 +543,17 @@ ] } }, - "log": [ - "Player2: Great Explorer: Explored B6" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Explored B6", + "origin": { + "CivilCard": 118 + } + } + ], + "active_events": 1 }, { "action": { @@ -541,9 +561,43 @@ "ExploreResolution": 0 } }, - "log": [ - "Player2: Explore Resolution: Chose rotation 0, Explored tiles A7=Fertile, B6=Fertile, B7=Barren, C7=Fertile" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Chose rotation 0", + "origin": { + "Ability": "Explore Resolution" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "B6", + "Fertile" + ], + [ + "A7", + "Fertile" + ], + [ + "C7", + "Fertile" + ], + [ + "B7", + "Barren" + ] + ] + }, + "origin": { + "Ability": "Explore Resolution" + } + } + ], + "active_events": 2 }, { "action": { @@ -553,9 +607,17 @@ ] } }, - "log": [ - "Player2: Great Explorer: Decided to build a city A7" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Decided to build a city A7", + "origin": { + "CivilCard": 118 + } + } + ], + "active_events": 1 }, { "action": { @@ -567,6 +629,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -574,7 +637,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 118 @@ -585,16 +648,15 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "A7" + "position": "A7", + "port_position": null }, "origin": { "CivilCard": 118 } } ], - "log": [ - "Player2: Great Explorer: Pay 2 food, Gain city A7" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_merchant.outcome3.json b/server/tests/test_games/incidents/great_persons/great_merchant.outcome3.json index f68843ce..3ed274cb 100644 --- a/server/tests/test_games/incidents/great_persons/great_merchant.outcome3.json +++ b/server/tests/test_games/incidents/great_persons/great_merchant.outcome3.json @@ -230,11 +230,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -246,7 +250,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -268,19 +272,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Merchant", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 25 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 25 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 25 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Merchant", - "Player1: Great Merchant: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city" ] }, { @@ -293,6 +321,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -300,7 +329,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 25 @@ -322,9 +351,7 @@ } } ], - "log": [ - "Player1: Great Merchant: Pay 1 culture token, Gain Great Merchant from the current event" - ] + "active_events": 1 }, { "action": { @@ -332,11 +359,15 @@ "ActionCard": 125 } }, + "player": 0, + "origin": { + "CivilCard": 125 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 125 @@ -361,17 +392,13 @@ "player": 0, "Advance": { "advance": "TradeRoutes", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 125 } } - ], - "log": [ - "Player1: Great Merchant: Pay 1 action, Gain Trade Routes without taking an event token", - "Player1: Action Card: Play Great Merchant" ] }, { @@ -382,7 +409,22 @@ } } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Player1 selected trade routes", + "origin": { + "CivilCard": 125 + } + }, + { + "player": 0, + "Text": "settler at C2 traded with city A3", + "origin": { + "CivilCard": 125 + } + }, { "player": 0, "Resources": { @@ -394,12 +436,21 @@ "origin": { "CivilCard": 125 } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Great Merchant: Player1 selected trade routes, settler at C2 traded with city A3, Gain 1 gold", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_prophet.outcome4.json b/server/tests/test_games/incidents/great_persons/great_prophet.outcome4.json index 3658d116..8f44bacb 100644 --- a/server/tests/test_games/incidents/great_persons/great_prophet.outcome4.json +++ b/server/tests/test_games/incidents/great_persons/great_prophet.outcome4.json @@ -287,11 +287,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -303,7 +307,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -325,19 +329,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Prophet", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 20 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 20 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 20 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Prophet", - "Player1: Great Prophet: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city" ] }, { @@ -350,6 +378,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -357,7 +386,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 20 @@ -379,9 +408,7 @@ } } ], - "log": [ - "Player1: Great Prophet: Pay 1 culture token, Gain Great Prophet from the current event" - ] + "active_events": 1 }, { "action": { @@ -389,11 +416,15 @@ "ActionCard": 120 } }, + "player": 0, + "origin": { + "CivilCard": 120 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 120 @@ -430,18 +461,13 @@ "player": 0, "Advance": { "advance": "Myths", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 120 } } - ], - "log": [ - "Player1: Great Prophet: Pay 1 action, Gain Myths without taking an event token", - "Player1: Action Card: Play Great Prophet", - "Player1: Myths: Gain 1 mood token" ] }, { @@ -452,9 +478,17 @@ ] } }, - "log": [ - "Player1: Great Prophet: Decided to build a Temple at C1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Decided to build a Temple at C1", + "origin": { + "CivilCard": 120 + } + } + ], + "active_events": 1 }, { "action": { @@ -466,6 +500,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -473,7 +508,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Construct Building" @@ -491,17 +526,15 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "CivilCard": 120 } } ], - "log": [ - "Player1: Construct Building: Pay 2 gold with State Religion", - "Player1: Great Prophet: Gain Temple at C1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/great_persons/great_seer.outcome4.json b/server/tests/test_games/incidents/great_persons/great_seer.outcome4.json index ee2afa36..86fc7b8d 100644 --- a/server/tests/test_games/incidents/great_persons/great_seer.outcome4.json +++ b/server/tests/test_games/incidents/great_persons/great_seer.outcome4.json @@ -217,11 +217,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -233,7 +237,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -255,19 +259,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Great Seer", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 58 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 58 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Seer", - "Player1: Great Seer: Base effect: Pirates spawn, No valid positions for Pirate Ship" ] }, { @@ -280,6 +301,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -287,7 +309,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 58 @@ -309,9 +331,7 @@ } } ], - "log": [ - "Player1: Great Seer: Pay 1 culture token, Gain Great Seer from the current event" - ] + "active_events": 1 }, { "action": { @@ -319,11 +339,15 @@ "ActionCard": 158 } }, + "player": 0, + "origin": { + "CivilCard": 158 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 158 @@ -344,10 +368,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Great Seer: Pay 1 action", - "Player1: Action Card: Play Great Seer" ] }, { @@ -360,6 +380,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -392,10 +413,7 @@ } } ], - "log": [ - "Player1: Great Seer: Placed a card from the draw pile in the Great Seer", - "Player2: Great Seer: Placed a card from the draw pile in the Great Seer" - ] + "active_events": 1 }, { "action": { @@ -408,11 +426,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -424,7 +446,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -478,17 +500,15 @@ "player": 0, "Advance": { "advance": "Writing", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 food, Gain Writing and take an event token (2 left)", - "Player1: Writing: Draw an action card, Gain an objective card from Great Seer, Gain 1 culture token" ] } ] diff --git a/server/tests/test_games/incidents/great_persons/great_warlord.outcome3.json b/server/tests/test_games/incidents/great_persons/great_warlord.outcome3.json index 2a6e27b5..343aa024 100644 --- a/server/tests/test_games/incidents/great_persons/great_warlord.outcome3.json +++ b/server/tests/test_games/incidents/great_persons/great_warlord.outcome3.json @@ -373,11 +373,15 @@ } } }, + "player": 1, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -389,7 +393,7 @@ "resources": { "food": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -411,19 +415,29 @@ "player": 1, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 1, + "Text": "triggers the event Great Warlord", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 1, + "Text": "Exhausted the land in position E8", + "origin": { + "Incident": 24 + } } - ], - "log": [ - "Player2: Advance: Pay 1 action, Pay 2 food, Gain Storage and take an event token (triggering an incident)", - "Player2: Storage: Gain 1 mood token", - "A new game event has been triggered: Great Warlord", - "Player2: Great Warlord: Exhausted the land in position E8" ] }, { @@ -436,6 +450,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -443,7 +458,7 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 24 @@ -465,9 +480,7 @@ } } ], - "log": [ - "Player2: Great Warlord: Pay 1 culture token, Gain Great Warlord from the current event" - ] + "active_events": 1 }, { "action": { @@ -475,11 +488,15 @@ "ActionCard": 124 } }, + "player": 1, + "origin": { + "CivilCard": 124 + }, "items": [ { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 124 @@ -516,18 +533,13 @@ "player": 1, "Advance": { "advance": "Tactics", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { "CivilCard": 124 } } - ], - "log": [ - "Player2: Great Warlord: Pay 1 action, Gain Tactics without taking an event token", - "Player2: Action Card: Play Great Warlord", - "Player2: Tactics: Gain 1 culture token" ] }, { @@ -541,6 +553,10 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Land", @@ -564,26 +580,99 @@ "result": "AttackerWins" }, "items": [ + { + "player": 1, + "Move": { + "units": { + "infantry": 1 + }, + "start": "D7", + "destination": "C8" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 0, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 7, + "hits": 1, + "combat_modifiers": [ + "Player gets +2 combat value for Great Warlord" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C8" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player2: Move: marched 1 infantry from D7 to C8", - "Combat round 1", - "Player2: Combat: Attacking with 1 infantry, Roll 5 (cavalry, no bonus) for combined combat value of 7 and gets 1 hits against defending units, Combat modifiers: Player gets +2 combat value for Great Warlord", - "Player1: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units, Lost 1 infantry at C8", - "Player1: Choose Casualties: Remove all defending units", - "Attacker wins" ] } ] diff --git a/server/tests/test_games/incidents/pandemics/black_death.outcome.json b/server/tests/test_games/incidents/pandemics/black_death.outcome.json index d7f6a43d..f12075ef 100644 --- a/server/tests/test_games/incidents/pandemics/black_death.outcome.json +++ b/server/tests/test_games/incidents/pandemics/black_death.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 50, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -268,11 +271,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -284,7 +291,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -306,18 +313,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Black Death", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Black Death" ] } ] diff --git a/server/tests/test_games/incidents/pandemics/black_death.outcome1.json b/server/tests/test_games/incidents/pandemics/black_death.outcome1.json index 9c08f259..8f58d536 100644 --- a/server/tests/test_games/incidents/pandemics/black_death.outcome1.json +++ b/server/tests/test_games/incidents/pandemics/black_death.outcome1.json @@ -235,11 +235,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -251,7 +255,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -273,18 +277,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Black Death", + "origin": { + "Advance": "Storage" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Black Death" ] }, { @@ -295,6 +303,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -302,16 +311,22 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 50 } + }, + { + "player": 0, + "Text": "Gain 1 victory points", + "origin": { + "Incident": 50 + } } ], - "log": [ - "Player1: Black Death: Lost 1 infantry at C2, Gain 1 victory points" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/pandemics/drought.outcome.json b/server/tests/test_games/incidents/pandemics/drought.outcome.json index dda1e1ba..10327855 100644 --- a/server/tests/test_games/incidents/pandemics/drought.outcome.json +++ b/server/tests/test_games/incidents/pandemics/drought.outcome.json @@ -220,11 +220,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -236,7 +240,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -258,13 +262,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Famine: Draught", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -276,13 +289,14 @@ "origin": { "Incident": 52 } + }, + { + "player": 0, + "Text": "Lost 2 food", + "origin": { + "Incident": 52 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Famine: Draught", - "Player1: Famine: Draught: Lost 2 food" ] } ] diff --git a/server/tests/test_games/incidents/pandemics/fire.outcome.json b/server/tests/test_games/incidents/pandemics/fire.outcome.json index 3837771f..6943193c 100644 --- a/server/tests/test_games/incidents/pandemics/fire.outcome.json +++ b/server/tests/test_games/incidents/pandemics/fire.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 53, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -254,11 +257,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -270,7 +277,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -292,13 +299,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Fire", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -311,12 +327,6 @@ "Ability": "Gold deposits" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Fire", - "Player1: Gold deposits: Gain 2 gold" ] } ] diff --git a/server/tests/test_games/incidents/pandemics/fire.outcome1.json b/server/tests/test_games/incidents/pandemics/fire.outcome1.json index 0c7676f7..b1c6598e 100644 --- a/server/tests/test_games/incidents/pandemics/fire.outcome1.json +++ b/server/tests/test_games/incidents/pandemics/fire.outcome1.json @@ -226,11 +226,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -242,7 +246,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -264,13 +268,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Fire", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -283,12 +296,6 @@ "Ability": "Gold deposits" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Fire", - "Player1: Gold deposits: Gain 2 gold" ] }, { @@ -299,6 +306,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -338,11 +346,7 @@ } } ], - "log": [ - "Player1: Fire: City C2 became Angry", - "Player2: Fire: City A1 became Neutral", - "Player1: Complete Objectives: Complete Terror Regime using Shipping Routes/Terror Regime" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/pandemics/pandemics.outcome.json b/server/tests/test_games/incidents/pandemics/pandemics.outcome.json index 444cff7e..04d8d98f 100644 --- a/server/tests/test_games/incidents/pandemics/pandemics.outcome.json +++ b/server/tests/test_games/incidents/pandemics/pandemics.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 49, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -272,11 +275,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -288,7 +295,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -310,19 +317,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pandemics", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Lose a total of 2 units, cards, and resources", + "origin": { + "Incident": 49 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pandemics", - "Player1: Pandemics: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Lose a total of 2 units, cards, and resources" ] } ] diff --git a/server/tests/test_games/incidents/pandemics/pandemics.outcome1.json b/server/tests/test_games/incidents/pandemics/pandemics.outcome1.json index ff317577..4665ff86 100644 --- a/server/tests/test_games/incidents/pandemics/pandemics.outcome1.json +++ b/server/tests/test_games/incidents/pandemics/pandemics.outcome1.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 49, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {}, "sacrifice": 1 @@ -263,11 +266,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -279,7 +286,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -301,19 +308,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pandemics", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Lose a total of 2 units, cards, and resources", + "origin": { + "Incident": 49 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pandemics", - "Player1: Pandemics: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Lose a total of 2 units, cards, and resources" ] }, { @@ -324,6 +362,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -331,16 +370,15 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 49 } } ], - "log": [ - "Player1: Pandemics: Lost 1 infantry at C2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/pandemics/pandemics.outcome2.json b/server/tests/test_games/incidents/pandemics/pandemics.outcome2.json index 1ba483a1..7e99de41 100644 --- a/server/tests/test_games/incidents/pandemics/pandemics.outcome2.json +++ b/server/tests/test_games/incidents/pandemics/pandemics.outcome2.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 49, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -332,11 +335,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -348,7 +355,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -370,19 +377,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pandemics", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Lose a total of 2 units, cards, and resources", + "origin": { + "Incident": 49 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pandemics", - "Player1: Pandemics: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Lose a total of 2 units, cards, and resources" ] }, { @@ -393,6 +431,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -400,16 +439,15 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 49 } } ], - "log": [ - "Player1: Pandemics: Lost 1 infantry at C2" - ] + "active_events": 1 }, { "action": { @@ -421,6 +459,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -436,12 +475,16 @@ "origin": { "Incident": 49 } + }, + { + "player": 1, + "Text": "Lose a total of 1 units, cards, and resources", + "origin": { + "Incident": 49 + } } ], - "log": [ - "Player1: Pandemics: Discard Quick Advance/Peltasts", - "Player2: Pandemics: Lose a total of 1 units, cards, and resources" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/pandemics/pandemics.outcome3.json b/server/tests/test_games/incidents/pandemics/pandemics.outcome3.json index c548063c..131338ff 100644 --- a/server/tests/test_games/incidents/pandemics/pandemics.outcome3.json +++ b/server/tests/test_games/incidents/pandemics/pandemics.outcome3.json @@ -226,11 +226,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -242,7 +246,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -264,19 +268,50 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Pandemics", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 49 + } + }, + { + "player": 0, + "Text": "Lose a total of 2 units, cards, and resources", + "origin": { + "Incident": 49 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Pandemics", - "Player1: Pandemics: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city, Lose a total of 2 units, cards, and resources" ] }, { @@ -287,6 +322,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -294,16 +330,15 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Incident": 49 } } ], - "log": [ - "Player1: Pandemics: Lost 1 infantry at C2" - ] + "active_events": 1 }, { "action": { @@ -315,6 +350,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -330,12 +366,16 @@ "origin": { "Incident": 49 } + }, + { + "player": 1, + "Text": "Lose a total of 1 units, cards, and resources", + "origin": { + "Incident": 49 + } } ], - "log": [ - "Player1: Pandemics: Discard Quick Advance/Peltasts", - "Player2: Pandemics: Lose a total of 1 units, cards, and resources" - ] + "active_events": 1 }, { "action": { @@ -347,6 +387,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -354,16 +395,21 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 49 } + }, + { + "player": 1, + "Text": "Lose 1 culture token", + "origin": { + "Incident": 49 + } } ], - "log": [ - "Player2: Pandemics: Pay 1 culture token, Lose 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/pandemics/vermin.outcome.json b/server/tests/test_games/incidents/pandemics/vermin.outcome.json index cd2c9d25..99ace0de 100644 --- a/server/tests/test_games/incidents/pandemics/vermin.outcome.json +++ b/server/tests/test_games/incidents/pandemics/vermin.outcome.json @@ -219,11 +219,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -235,7 +239,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -257,13 +261,22 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Famine: Vermin", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Resources": { @@ -276,6 +289,13 @@ "Incident": 51 } }, + { + "player": 0, + "Text": "Lost 1 food", + "origin": { + "Incident": 51 + } + }, { "player": 1, "Resources": { @@ -286,6 +306,13 @@ "Incident": 51 } }, + { + "player": 1, + "Text": "Lost 0 food", + "origin": { + "Incident": 51 + } + }, { "player": 1, "MoodChange": { @@ -296,13 +323,6 @@ "Incident": 51 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Famine: Vermin", - "Player1: Famine: Vermin: Lost 1 food", - "Player2: Famine: Vermin: Lost 0 food, City A1 became Angry" ] } ] diff --git a/server/tests/test_games/incidents/pirates_spawn.outcome.json b/server/tests/test_games/incidents/pirates_spawn.outcome.json index 9eb6834b..7d17a11d 100644 --- a/server/tests/test_games/incidents/pirates_spawn.outcome.json +++ b/server/tests/test_games/incidents/pirates_spawn.outcome.json @@ -12,6 +12,9 @@ "event_type": { "Incident": { "incident_id": 54, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -249,6 +252,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -266,20 +270,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn" - ] + "active_events": 1 } ] } @@ -316,4 +331,4 @@ "incidents_discarded": [ 54 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/incidents/pirates_spawn.outcome1.json b/server/tests/test_games/incidents/pirates_spawn.outcome1.json index a4bec239..ea7fb2c7 100644 --- a/server/tests/test_games/incidents/pirates_spawn.outcome1.json +++ b/server/tests/test_games/incidents/pirates_spawn.outcome1.json @@ -12,6 +12,9 @@ "event_type": { "Incident": { "incident_id": 54, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -244,6 +247,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -261,20 +265,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn" - ] + "active_events": 1 }, { "action": { @@ -284,9 +299,17 @@ ] } }, - "log": [ - "Player1: A successful year: Removed a Pirate Ships at D1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Removed a Pirate Ships at D1", + "origin": { + "Incident": 54 + } + } + ], + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/pirates_spawn.outcome2.json b/server/tests/test_games/incidents/pirates_spawn.outcome2.json index 026d4f9f..9caf0321 100644 --- a/server/tests/test_games/incidents/pirates_spawn.outcome2.json +++ b/server/tests/test_games/incidents/pirates_spawn.outcome2.json @@ -12,6 +12,9 @@ "event_type": { "Incident": { "incident_id": 54, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -249,6 +252,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -266,20 +270,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn" - ] + "active_events": 1 }, { "action": { @@ -289,9 +304,17 @@ ] } }, - "log": [ - "Player1: A successful year: Removed a Pirate Ships at D1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Removed a Pirate Ships at D1", + "origin": { + "Incident": 54 + } + } + ], + "active_events": 2 }, { "action": { @@ -301,6 +324,7 @@ ] } }, + "player": 0, "items": [ { "player": 2, @@ -308,16 +332,15 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A2" }, "origin": { "Incident": 54 } } ], - "log": [ - "Pirates: A successful year: Gain 1 ship at A2" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/pirates_spawn.outcome3.json b/server/tests/test_games/incidents/pirates_spawn.outcome3.json index af5e02f6..b861b259 100644 --- a/server/tests/test_games/incidents/pirates_spawn.outcome3.json +++ b/server/tests/test_games/incidents/pirates_spawn.outcome3.json @@ -12,6 +12,9 @@ "event_type": { "Incident": { "incident_id": 54, + "cause": { + "Advance": "Storage" + }, "active_player": 0, "barbarians": {} } @@ -323,6 +326,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -340,20 +344,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn" - ] + "active_events": 1 }, { "action": { @@ -363,9 +378,17 @@ ] } }, - "log": [ - "Player1: A successful year: Removed a Pirate Ships at D1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Removed a Pirate Ships at D1", + "origin": { + "Incident": 54 + } + } + ], + "active_events": 2 }, { "action": { @@ -375,6 +398,7 @@ ] } }, + "player": 0, "items": [ { "player": 2, @@ -382,16 +406,15 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A2" }, "origin": { "Incident": 54 } } ], - "log": [ - "Pirates: A successful year: Gain 1 ship at A2" - ] + "active_events": 2 }, { "action": { @@ -401,6 +424,7 @@ ] } }, + "player": 0, "items": [ { "player": 2, @@ -408,17 +432,22 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D2" }, "origin": { "Incident": 54 } + }, + { + "player": 0, + "Text": "Must pay 1 resource or token to bribe the pirates", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Pirates: A successful year: Gain 1 ship at D2", - "Player1: A successful year: Must pay 1 resource or token to bribe the pirates" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/pirates_spawn.outcome4.json b/server/tests/test_games/incidents/pirates_spawn.outcome4.json index 701b1c22..a6e6da52 100644 --- a/server/tests/test_games/incidents/pirates_spawn.outcome4.json +++ b/server/tests/test_games/incidents/pirates_spawn.outcome4.json @@ -253,6 +253,7 @@ "SelectAdvance": "Storage" } }, + "player": 0, "items": [ { "player": 0, @@ -270,20 +271,31 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } + }, + { + "player": 0, + "Text": "triggers the event A successful year", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Player1: Storage: Gain 1 mood token", - "Player1: Free Advance: Gain Storage and take an event token (triggering an incident)", - "A new game event has been triggered: A successful year", - "Player1: A successful year: Base effect: Pirates spawn" - ] + "active_events": 1 }, { "action": { @@ -293,9 +305,17 @@ ] } }, - "log": [ - "Player1: A successful year: Removed a Pirate Ships at D1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Removed a Pirate Ships at D1", + "origin": { + "Incident": 54 + } + } + ], + "active_events": 2 }, { "action": { @@ -305,6 +325,7 @@ ] } }, + "player": 0, "items": [ { "player": 2, @@ -312,16 +333,15 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A2" }, "origin": { "Incident": 54 } } ], - "log": [ - "Pirates: A successful year: Gain 1 ship at A2" - ] + "active_events": 2 }, { "action": { @@ -331,6 +351,7 @@ ] } }, + "player": 0, "items": [ { "player": 2, @@ -338,17 +359,22 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "D2" }, "origin": { "Incident": 54 } + }, + { + "player": 0, + "Text": "Must pay 1 resource or token to bribe the pirates", + "origin": { + "Incident": 54 + } } ], - "log": [ - "Pirates: A successful year: Gain 1 ship at D2", - "Player1: A successful year: Must pay 1 resource or token to bribe the pirates" - ] + "active_events": 2 }, { "action": { @@ -360,6 +386,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -367,12 +394,26 @@ "resources": { "ore": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Incident": 54 } }, + { + "player": 0, + "Text": "Pirates took 1 ore", + "origin": { + "Incident": 54 + } + }, + { + "player": 1, + "Text": "Must reduce Mood in a city adjacent to pirates", + "origin": { + "Incident": 54 + } + }, { "player": 1, "MoodChange": { @@ -396,10 +437,7 @@ } } ], - "log": [ - "Player1: A successful year: Pay 1 ore, Pirates took 1 ore", - "Player2: A successful year: Must reduce Mood in a city adjacent to pirates, City C1 became Angry, Gain 1 food" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/incidents/trade/era_of_stability.outcome.json b/server/tests/test_games/incidents/trade/era_of_stability.outcome.json index 80dccc68..8c84f529 100644 --- a/server/tests/test_games/incidents/trade/era_of_stability.outcome.json +++ b/server/tests/test_games/incidents/trade/era_of_stability.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 47, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -253,11 +256,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -269,7 +276,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -291,19 +298,29 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Era of Stability", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Exhausted the land in position B1", + "origin": { + "Incident": 47 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Era of Stability", - "Player1: Era of Stability: Exhausted the land in position B1" ] } ] diff --git a/server/tests/test_games/incidents/trade/era_of_stability.outcome1.json b/server/tests/test_games/incidents/trade/era_of_stability.outcome1.json index 99160dab..292d6392 100644 --- a/server/tests/test_games/incidents/trade/era_of_stability.outcome1.json +++ b/server/tests/test_games/incidents/trade/era_of_stability.outcome1.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 47, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -256,11 +259,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -272,7 +279,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -294,19 +301,29 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Era of Stability", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Exhausted the land in position B1", + "origin": { + "Incident": 47 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Era of Stability", - "Player1: Era of Stability: Exhausted the land in position B1" ] }, { @@ -317,6 +334,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -331,9 +349,7 @@ } } ], - "log": [ - "Player1: Era of Stability: Gain 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/trade/era_of_stability.outcome2.json b/server/tests/test_games/incidents/trade/era_of_stability.outcome2.json index 54f6ad73..84e21111 100644 --- a/server/tests/test_games/incidents/trade/era_of_stability.outcome2.json +++ b/server/tests/test_games/incidents/trade/era_of_stability.outcome2.json @@ -209,11 +209,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -225,7 +229,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -247,19 +251,29 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Era of Stability", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Exhausted the land in position B1", + "origin": { + "Incident": 47 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Era of Stability", - "Player1: Era of Stability: Exhausted the land in position B1" ] }, { @@ -270,6 +284,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -284,9 +299,7 @@ } } ], - "log": [ - "Player1: Era of Stability: Gain 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -296,6 +309,7 @@ } } }, + "player": 1, "items": [ { "player": 1, @@ -310,9 +324,7 @@ } } ], - "log": [ - "Player2: Era of Stability: Gain 1 culture token" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/trade/flourishing_trade.outcome.json b/server/tests/test_games/incidents/trade/flourishing_trade.outcome.json index 12021178..39f9ef68 100644 --- a/server/tests/test_games/incidents/trade/flourishing_trade.outcome.json +++ b/server/tests/test_games/incidents/trade/flourishing_trade.outcome.json @@ -207,11 +207,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -223,7 +227,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -245,13 +249,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Flourishing Trade", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 46 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 46 + } + }, { "player": 0, "Resources": { @@ -275,15 +302,19 @@ "origin": { "Incident": 46 } + }, + { + "player": 1, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Flourishing Trade", - "Player1: Flourishing Trade: Base effect: Pirates spawn, No valid positions for Pirate Ship, Gain 1 gold", - "Player2: Flourishing Trade: Gain 1 gold", - "Player2: Waste: Could not store 1 gold" ] } ] diff --git a/server/tests/test_games/incidents/trade/reformation.outcome.json b/server/tests/test_games/incidents/trade/reformation.outcome.json index 1d386fc5..cb3876b8 100644 --- a/server/tests/test_games/incidents/trade/reformation.outcome.json +++ b/server/tests/test_games/incidents/trade/reformation.outcome.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 48, + "cause": { + "Advance": "Storage" + }, "active_player": 2, "passed": "AlreadyPassed", "barbarians": {}, @@ -290,11 +293,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -306,7 +313,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -328,19 +335,57 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Reformation", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Barbarians cannot reinforce", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Selected Player3 to execute the event", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Pass the event to Player3", + "origin": { + "Incident": 48 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Reformation", - "Player1: Reformation: Base effect: Barbarians spawn, Barbarians cannot spawn a new city, Barbarians cannot reinforce, Selected Player3 to execute the event, Pass the event to Player3" ] } ] diff --git a/server/tests/test_games/incidents/trade/reformation.outcome1.json b/server/tests/test_games/incidents/trade/reformation.outcome1.json index 8ba32f42..d9793178 100644 --- a/server/tests/test_games/incidents/trade/reformation.outcome1.json +++ b/server/tests/test_games/incidents/trade/reformation.outcome1.json @@ -260,11 +260,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -276,7 +280,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -298,19 +302,57 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Reformation", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Barbarians cannot reinforce", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Selected Player3 to execute the event", + "origin": { + "Incident": 48 + } + }, + { + "player": 0, + "Text": "Pass the event to Player3", + "origin": { + "Incident": 48 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Reformation", - "Player1: Reformation: Base effect: Barbarians spawn, Barbarians cannot spawn a new city, Barbarians cannot reinforce, Selected Player3 to execute the event, Pass the event to Player3" ] }, { @@ -319,6 +361,7 @@ "SelectPlayer": 1 } }, + "player": 2, "items": [ { "player": 2, @@ -327,7 +370,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Incident": 48 @@ -340,17 +384,15 @@ "Building": "Temple" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Incident": 48 } } ], - "log": [ - "Player3: Reformation: Lose Temple at A1", - "Player2: Reformation: Gain Temple at A1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/trade/scientific_trade.outcome.json b/server/tests/test_games/incidents/trade/scientific_trade.outcome.json index 338dbe40..0fc6cb38 100644 --- a/server/tests/test_games/incidents/trade/scientific_trade.outcome.json +++ b/server/tests/test_games/incidents/trade/scientific_trade.outcome.json @@ -207,11 +207,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -223,7 +227,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -245,13 +249,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Scientific Trade", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 45 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 45 + } + }, { "player": 0, "Resources": { @@ -275,15 +302,19 @@ "origin": { "Incident": 45 } + }, + { + "player": 1, + "Resources": { + "resources": { + "ideas": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Scientific Trade", - "Player1: Scientific Trade: Base effect: Pirates spawn, No valid positions for Pirate Ship, Gain 2 ideas", - "Player2: Scientific Trade: Gain 1 idea", - "Player2: Waste: Could not store 1 idea" ] } ] diff --git a/server/tests/test_games/incidents/trojan/anarchy.outcome.json b/server/tests/test_games/incidents/trojan/anarchy.outcome.json index 5036ebb4..34316c83 100644 --- a/server/tests/test_games/incidents/trojan/anarchy.outcome.json +++ b/server/tests/test_games/incidents/trojan/anarchy.outcome.json @@ -217,11 +217,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -233,7 +237,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -255,30 +259,40 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Anarchy", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Advance": { "advance": "Voting", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { "Incident": 44 } + }, + { + "player": 0, + "Text": "Lose 1 government advances due to Anarchy - adding 1 victory points", + "origin": { + "Incident": 44 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Anarchy", - "Player1: Anarchy: Lose 1 government advances due to Anarchy - adding 1 victory points" ] } ] diff --git a/server/tests/test_games/incidents/trojan/anarchy.outcome1.json b/server/tests/test_games/incidents/trojan/anarchy.outcome1.json index 95123262..7025a39a 100644 --- a/server/tests/test_games/incidents/trojan/anarchy.outcome1.json +++ b/server/tests/test_games/incidents/trojan/anarchy.outcome1.json @@ -209,11 +209,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -225,7 +229,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -247,30 +251,40 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Anarchy", + "origin": { + "Advance": "Storage" + } + }, { "player": 0, "Advance": { "advance": "Voting", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { "Incident": 44 } + }, + { + "player": 0, + "Text": "Lose 1 government advances due to Anarchy - adding 1 victory points", + "origin": { + "Incident": 44 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Anarchy", - "Player1: Anarchy: Lose 1 government advances due to Anarchy - adding 1 victory points" ] }, { @@ -284,11 +298,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -300,29 +318,58 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "Ideas limit reduced to 2", + "origin": { + "Advance": "Dogma" + } + }, + { + "player": 0, + "Text": "unlocks Provinces", + "origin": { + "Ability": "Advance" + } + }, { "player": 0, "Advance": { "advance": "Dogma", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "Gain a government advance, taking a game event token instead of triggering a game event (and losing 1 victory point)", + "origin": { + "Ability": "Anarchy" + } + }, + { + "player": 0, + "Resources": { + "resources": { + "ideas": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Unlock Provinces, Gain Dogma and take an event token (2 left)", - "Player1: Dogma: Ideas limit reduced to 2", - "Player1: Anarchy: Gain a government advance, taking a game event token instead of triggering a game event (and losing 1 victory point)", - "Player1: Waste: Could not store 1 idea" ] } ] diff --git a/server/tests/test_games/incidents/trojan/guillotine.outcome2.json b/server/tests/test_games/incidents/trojan/guillotine.outcome2.json index d461c4fa..599a5f5b 100644 --- a/server/tests/test_games/incidents/trojan/guillotine.outcome2.json +++ b/server/tests/test_games/incidents/trojan/guillotine.outcome2.json @@ -238,11 +238,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -254,7 +258,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -276,31 +280,56 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Guillotine", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians spawn", + "origin": { + "Incident": 43 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 43 + } + }, + { + "player": 0, + "Text": "Barbarians cannot reinforce", + "origin": { + "Incident": 43 + } + }, { "player": 0, "Units": { "units": { "leader": "Caesar" }, - "balance": "Loss" + "balance": "Loss", + "position": "A1" }, "origin": { "Incident": 43 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Guillotine", - "Player1: Guillotine: Base effect: Barbarians spawn, Barbarians cannot spawn a new city, Barbarians cannot reinforce, Lost Gaius Julius Caesar at A1" ] }, { @@ -309,9 +338,24 @@ "Bool": true } }, - "log": [ - "Player1: Guillotine: Chose to select a new leader, Chose a new leader in A1" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Chose to select a new leader", + "origin": { + "Incident": 43 + } + }, + { + "player": 0, + "Text": "Chose a new leader in A1", + "origin": { + "Incident": 43 + } + } + ], + "active_events": 1 }, { "action": { @@ -321,6 +365,7 @@ } } }, + "player": 0, "items": [ { "player": 0, @@ -328,16 +373,22 @@ "units": { "leader": "Augustus" }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Incident": 43 } + }, + { + "player": 0, + "Text": "Lose leaders due to the Guillotine: Sulla", + "origin": { + "Incident": 43 + } } ], - "log": [ - "Player1: Guillotine: Gain Augustus at A1, Lose leaders due to the Guillotine: Sulla" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/trojan/solar_eclipse.outcome2.json b/server/tests/test_games/incidents/trojan/solar_eclipse.outcome2.json index e8f571ed..87a11b26 100644 --- a/server/tests/test_games/incidents/trojan/solar_eclipse.outcome2.json +++ b/server/tests/test_games/incidents/trojan/solar_eclipse.outcome2.json @@ -238,11 +238,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -254,7 +258,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -276,19 +280,36 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Solar Eclipse", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Pirates spawn", + "origin": { + "Incident": 41 + } + }, + { + "player": 0, + "Text": "No valid positions for Pirate Ship", + "origin": { + "Incident": 41 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Solar Eclipse", - "Player1: Solar Eclipse: Base effect: Pirates spawn, No valid positions for Pirate Ship" ] }, { @@ -307,22 +328,55 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -335,6 +389,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -374,6 +429,34 @@ "Advance": "Tactics" } }, + { + "player": 1, + "Text": "Reveal Tactics Card Tactical Retreat", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Player2 withdraws to B1", + "origin": { + "TacticsCard": 17 + } + }, + { + "player": 0, + "Text": "Gain 1 victory point for the Solar Eclipse", + "origin": { + "Ability": "Solar Eclipse" + } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -391,7 +474,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -402,7 +486,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -415,7 +500,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -428,21 +514,15 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Tactical Retreat", - "Player2: Tactical Retreat: Player2 withdraws to B1", - "Player1: Solar Eclipse: Gain 1 victory point for the Solar Eclipse", - "Attacker wins", - "Player1: Combat: Gain 1 gold, Gain city C1, Gain Temple at C1", - "Player2: Combat: Lose city C1, Lose Temple at C1" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/incidents/trojan/trojan_horse.outcome2.json b/server/tests/test_games/incidents/trojan/trojan_horse.outcome2.json index f57f13d4..56ead5b5 100644 --- a/server/tests/test_games/incidents/trojan/trojan_horse.outcome2.json +++ b/server/tests/test_games/incidents/trojan/trojan_horse.outcome2.json @@ -255,11 +255,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -271,7 +275,7 @@ "resources": { "gold": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -293,19 +297,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } + }, + { + "player": 0, + "Text": "triggers the event Trojan Horse", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 42 + } + }, + { + "player": 0, + "Text": "Barbarians cannot move - will try to spawn a new city instead", + "origin": { + "Incident": 42 + } + }, + { + "player": 0, + "Text": "Barbarians cannot spawn a new city", + "origin": { + "Incident": 42 + } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 gold, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Trojan Horse", - "Player1: Trojan Horse: Base effect: Barbarians move, Barbarians cannot move - will try to spawn a new city instead, Barbarians cannot spawn a new city" ] }, { @@ -324,22 +352,55 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 2, + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 2 settlers, 2 infantry, 1 cavalry and 1 elephant from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 settlers, 2 infantry, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -353,6 +414,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -387,24 +449,108 @@ "gold": 1, "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Trojan Horse" } }, + { + "player": 0, + "Text": "Activated the Trojan Horse and gained 1 victory point", + "origin": { + "Ability": "Trojan Horse" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 4, + "hits": 0, + "combat_modifiers": [ + "Player gets +2 combat value for Fanaticism Advance", + "Trojan Horse denied playing Tactics Cards" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -422,7 +568,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -433,7 +580,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -446,7 +594,8 @@ "Building": "Temple" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -459,7 +608,8 @@ "Building": "Temple" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -471,7 +621,8 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C2" }, "origin": { "Advance": "Fanaticism" @@ -483,22 +634,15 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C2" }, "origin": { "Ability": "Place Settler" } } ], - "log": [ - "Player1: Trojan Horse: Pay 1 gold and 1 culture token, Activated the Trojan Horse and gained 1 victory point", - "Player1: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 2 hits against defending units, Gain 1 gold, Gain city C1, Gain Temple at C1", - "Player2: Combat: Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 4 and gets 0 hits against attacking units, Combat modifiers: Player gets +2 combat value for Fanaticism Advance, Trojan Horse denied playing Tactics Cards, Lost 2 infantry at C1, Lose city C1, Lose Temple at C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player2: Fanaticism: Gain 1 infantry at C2", - "Player2: Place Settler: Gain 1 settler at C2" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/movement/explore_auto_adjacent_water.outcome.json b/server/tests/test_games/movement/explore_auto_adjacent_water.outcome.json index 5b311f5d..cc491fa9 100644 --- a/server/tests/test_games/movement/explore_auto_adjacent_water.outcome.json +++ b/server/tests/test_games/movement/explore_auto_adjacent_water.outcome.json @@ -333,8 +333,50 @@ } } }, - "log": [ - "Player1: Move: marched 1 settler from C6 to C7, Explored tiles A7=Barren, B6=Water, B7=Fertile, C7=Forest" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 1 + }, + "start": "C6", + "destination": "C7" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "Explore": { + "tiles": [ + [ + "B6", + "Water" + ], + [ + "A7", + "Barren" + ], + [ + "C7", + "Forest" + ], + [ + "B7", + "Fertile" + ] + ] + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/explore_auto_no_walk_on_water.outcome.json b/server/tests/test_games/movement/explore_auto_no_walk_on_water.outcome.json index e19b8a5e..11d360c4 100644 --- a/server/tests/test_games/movement/explore_auto_no_walk_on_water.outcome.json +++ b/server/tests/test_games/movement/explore_auto_no_walk_on_water.outcome.json @@ -360,8 +360,50 @@ } } }, - "log": [ - "Player1: Move: marched 1 settler from C2 to B2, Explored tiles A3=Forest, B2=Mountain, B3=Water, C3=Fertile" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 1 + }, + "start": "C2", + "destination": "B2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "Explore": { + "tiles": [ + [ + "B3", + "Water" + ], + [ + "C3", + "Fertile" + ], + [ + "A3", + "Forest" + ], + [ + "B2", + "Mountain" + ] + ] + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/explore_auto_water_outside.outcome.json b/server/tests/test_games/movement/explore_auto_water_outside.outcome.json index 6d4e17f0..96fab5ed 100644 --- a/server/tests/test_games/movement/explore_auto_water_outside.outcome.json +++ b/server/tests/test_games/movement/explore_auto_water_outside.outcome.json @@ -340,8 +340,50 @@ } } }, - "log": [ - "Player2: Move: marched 1 settler from E6 to F5, Explored tiles E5=Mountain, F4=Barren, F5=Mountain, G5=Water" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "E6", + "destination": "F5" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "F5", + "Mountain" + ], + [ + "G5", + "Water" + ], + [ + "E5", + "Mountain" + ], + [ + "F4", + "Barren" + ] + ] + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/explore_choose.outcome.json b/server/tests/test_games/movement/explore_choose.outcome.json index f8335d25..fadfd25f 100644 --- a/server/tests/test_games/movement/explore_choose.outcome.json +++ b/server/tests/test_games/movement/explore_choose.outcome.json @@ -408,8 +408,24 @@ } } }, - "log": [ - "Player2: Move: marched 1 settler from D7 to C7" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "D7", + "destination": "C7" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/explore_resolution.outcome.json b/server/tests/test_games/movement/explore_resolution.outcome.json index 9aa865d1..f393b629 100644 --- a/server/tests/test_games/movement/explore_resolution.outcome.json +++ b/server/tests/test_games/movement/explore_resolution.outcome.json @@ -448,8 +448,24 @@ } } }, - "log": [ - "Player2: Move: marched 1 settler from D7 to D6" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "D7", + "destination": "D6" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/explore_resolution.outcome1.json b/server/tests/test_games/movement/explore_resolution.outcome1.json index 5d5bc1d6..a1d9f55b 100644 --- a/server/tests/test_games/movement/explore_resolution.outcome1.json +++ b/server/tests/test_games/movement/explore_resolution.outcome1.json @@ -400,8 +400,24 @@ } } }, - "log": [ - "Player2: Move: marched 1 settler from D7 to D6" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "settlers": 1 + }, + "start": "D7", + "destination": "D6" + }, + "origin": { + "Ability": "Move" + } + } ] }, { @@ -410,9 +426,43 @@ "ExploreResolution": 3 } }, - "log": [ - "Player2: Explore Resolution: Chose rotation 3, Explored tiles C6=Fertile, D5=Forest, D6=Fertile, E6=Fertile" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Chose rotation 3", + "origin": { + "Ability": "Explore Resolution" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "D6", + "Fertile" + ], + [ + "E6", + "Fertile" + ], + [ + "C6", + "Fertile" + ], + [ + "D5", + "Forest" + ] + ] + }, + "origin": { + "Ability": "Explore Resolution" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/movement/movement.outcome.json b/server/tests/test_games/movement/movement.outcome.json index ae448e16..a67e36d9 100644 --- a/server/tests/test_games/movement/movement.outcome.json +++ b/server/tests/test_games/movement/movement.outcome.json @@ -209,8 +209,24 @@ } } }, - "log": [ - "Player1: Move: marched 1 settler from B2 to B3" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 1 + }, + "start": "B2", + "destination": "B3" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_disembark.outcome.json b/server/tests/test_games/movement/ship_disembark.outcome.json index de99f62b..f578a134 100644 --- a/server/tests/test_games/movement/ship_disembark.outcome.json +++ b/server/tests/test_games/movement/ship_disembark.outcome.json @@ -270,8 +270,25 @@ } } }, - "log": [ - "Player1: Move: disembarked 1 cavalry and 1 elephant from C3 to B3" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "cavalry": 1, + "elephants": 1 + }, + "start": "C3", + "destination": "B3" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_disembark_capture_empty_city.outcome1.json b/server/tests/test_games/movement/ship_disembark_capture_empty_city.outcome1.json index 4f74862c..2b81a275 100644 --- a/server/tests/test_games/movement/ship_disembark_capture_empty_city.outcome1.json +++ b/server/tests/test_games/movement/ship_disembark_capture_empty_city.outcome1.json @@ -288,6 +288,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -308,6 +312,20 @@ "city_mood": "Neutral" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "cavalry": 1, + "elephants": 1 + }, + "start": "C3", + "destination": "B2" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 0, "Resources": { @@ -325,7 +343,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "B2" + "position": "B2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -336,7 +355,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "B2" + "position": "B2", + "port_position": null }, "origin": { "Ability": "Combat" @@ -349,7 +369,8 @@ "Building": "Port" }, "balance": "Loss", - "position": "B2" + "position": "B2", + "port_position": "C3" }, "origin": { "Ability": "Combat" @@ -362,7 +383,8 @@ "Building": "Port" }, "balance": "Gain", - "position": "B2" + "position": "B2", + "port_position": "C3" }, "origin": { "Ability": "Combat" @@ -384,19 +406,25 @@ "units": { "settlers": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C1" }, "origin": { "Ability": "Place Settler" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 2 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: disembarked 1 cavalry and 1 elephant from C3 to B2", - "Player1: Combat: Gain 2 gold, Gain city B2, Gain Port at B2 at the water tile C3, City B2 became Angry", - "Player2: Combat: Lose city B2, Lose Port at B2", - "Player2: Place Settler: Gain 1 settler at C1", - "Player1: Waste: Could not store 2 gold" ] }, { @@ -409,6 +437,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -428,9 +457,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Naval Assault using Optimized Storage/Naval Assault" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/movement/ship_embark.outcome.json b/server/tests/test_games/movement/ship_embark.outcome.json index 3dccb100..f490bf64 100644 --- a/server/tests/test_games/movement/ship_embark.outcome.json +++ b/server/tests/test_games/movement/ship_embark.outcome.json @@ -281,8 +281,25 @@ } } }, - "log": [ - "Player1: Move: embarked 2 settlers from B3 to C3" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2 + }, + "start": "B3", + "destination": "C3", + "embark_carrier_id": 8 + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_embark_continue.outcome.json b/server/tests/test_games/movement/ship_embark_continue.outcome.json index 6509edb3..439fa420 100644 --- a/server/tests/test_games/movement/ship_embark_continue.outcome.json +++ b/server/tests/test_games/movement/ship_embark_continue.outcome.json @@ -283,8 +283,25 @@ } } }, - "log": [ - "Player1: Move: embarked 2 settlers from B3 to C3" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "settlers": 2 + }, + "start": "B3", + "destination": "C3", + "embark_carrier_id": 9 + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_explore.outcome.json b/server/tests/test_games/movement/ship_explore.outcome.json index a587f8e1..9828110a 100644 --- a/server/tests/test_games/movement/ship_explore.outcome.json +++ b/server/tests/test_games/movement/ship_explore.outcome.json @@ -343,8 +343,50 @@ } } }, - "log": [ - "Player2: Move: sailed 1 ship from D5 to C5, Explored tiles A5=Forest, B4=Forest, B5=Water, C5=Water" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "ships": 1 + }, + "start": "D5", + "destination": "C5" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "B5", + "Water" + ], + [ + "C5", + "Water" + ], + [ + "A5", + "Forest" + ], + [ + "B4", + "Forest" + ] + ] + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_explore_move_not_possible.outcome.json b/server/tests/test_games/movement/ship_explore_move_not_possible.outcome.json index e4e21051..29e41895 100644 --- a/server/tests/test_games/movement/ship_explore_move_not_possible.outcome.json +++ b/server/tests/test_games/movement/ship_explore_move_not_possible.outcome.json @@ -345,9 +345,50 @@ "ExploreResolution": 3 } }, - "log": [ - "Player2: Explore Resolution: Chose rotation 3, Explored tiles E5=Forest, F4=Fertile, F5=Fertile, G5=Mountain, Ship can't move to the explored tile" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Chose rotation 3", + "origin": { + "Ability": "Explore Resolution" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "F5", + "Fertile" + ], + [ + "G5", + "Mountain" + ], + [ + "E5", + "Forest" + ], + [ + "F4", + "Fertile" + ] + ] + }, + "origin": { + "Ability": "Explore Resolution" + } + }, + { + "player": 1, + "Text": "Ship can't move to the explored tile", + "origin": { + "Ability": "Explore Resolution" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/movement/ship_explore_teleport.outcome.json b/server/tests/test_games/movement/ship_explore_teleport.outcome.json index b576d5e8..b8da01a7 100644 --- a/server/tests/test_games/movement/ship_explore_teleport.outcome.json +++ b/server/tests/test_games/movement/ship_explore_teleport.outcome.json @@ -329,8 +329,57 @@ } } }, - "log": [ - "Player2: Move: sailed 1 ship from C5 to C4, Explored tiles C4=Forest, D3=Fertile, D4=Water, E4=Barren, Teleported ship from C4 to D4" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "ships": 1 + }, + "start": "C5", + "destination": "C4" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "D4", + "Water" + ], + [ + "E4", + "Barren" + ], + [ + "C4", + "Forest" + ], + [ + "D3", + "Fertile" + ] + ] + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Text": "Teleported ship from C4 to D4", + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_navigate.outcome.json b/server/tests/test_games/movement/ship_navigate.outcome.json index 2d87c4f7..515f2f08 100644 --- a/server/tests/test_games/movement/ship_navigate.outcome.json +++ b/server/tests/test_games/movement/ship_navigate.outcome.json @@ -323,7 +323,24 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 1, + "Move": { + "units": { + "ships": 1 + }, + "start": "B5", + "destination": "A7" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 1, "Resources": { @@ -348,10 +365,6 @@ "Advance": "Cartography" } } - ], - "log": [ - "Player2: Move: sailed 1 ship from B5 to A7", - "Player2: Cartography: Gain 1 culture token, Gain 1 idea" ] } ] diff --git a/server/tests/test_games/movement/ship_navigate_explore_move.json b/server/tests/test_games/movement/ship_navigate_explore_move.json index 911800d8..5669f5bf 100644 --- a/server/tests/test_games/movement/ship_navigate_explore_move.json +++ b/server/tests/test_games/movement/ship_navigate_explore_move.json @@ -1,17 +1,7 @@ { "state": { "Movement": { - "movement_actions_left": 0, - "moved_units": [ - 1 - ], - "current_move": { - "Fleet": { - "units": [ - 1 - ] - } - } + "movement_actions_left": 1 } }, "players": [ diff --git a/server/tests/test_games/movement/ship_navigate_explore_move.outcome.json b/server/tests/test_games/movement/ship_navigate_explore_move.outcome.json index 2426577d..269b1f5a 100644 --- a/server/tests/test_games/movement/ship_navigate_explore_move.outcome.json +++ b/server/tests/test_games/movement/ship_navigate_explore_move.outcome.json @@ -302,8 +302,57 @@ } } }, - "log": [ - "Player2: Move: sailed 1 ship from B3 to F2, Explored tiles E3=Fertile, F2=Forest, F3=Forest, G3=Water, Teleported ship from F2 to G3" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "ships": 1 + }, + "start": "B3", + "destination": "F2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Explore": { + "tiles": [ + [ + "F3", + "Forest" + ], + [ + "G3", + "Water" + ], + [ + "E3", + "Fertile" + ], + [ + "F2", + "Forest" + ] + ] + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "Text": "Teleported ship from F2 to G3", + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_navigate_explore_not_move.json b/server/tests/test_games/movement/ship_navigate_explore_not_move.json index 2c813ea4..5c55fd70 100644 --- a/server/tests/test_games/movement/ship_navigate_explore_not_move.json +++ b/server/tests/test_games/movement/ship_navigate_explore_not_move.json @@ -1,17 +1,7 @@ { "state": { "Movement": { - "movement_actions_left": 2, - "moved_units": [ - 1 - ], - "current_move": { - "Fleet": { - "units": [ - 1 - ] - } - } + "movement_actions_left": 2 } }, "players": [ diff --git a/server/tests/test_games/movement/ship_navigate_explore_not_move.outcome.json b/server/tests/test_games/movement/ship_navigate_explore_not_move.outcome.json index f8e97342..77f4365d 100644 --- a/server/tests/test_games/movement/ship_navigate_explore_not_move.outcome.json +++ b/server/tests/test_games/movement/ship_navigate_explore_not_move.outcome.json @@ -353,8 +353,24 @@ } } }, - "log": [ - "Player2: Move: sailed 1 ship from B3 to F2" + "player": 1, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 1, + "Move": { + "units": { + "ships": 1 + }, + "start": "B3", + "destination": "F2" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_navigation_unit_test.json b/server/tests/test_games/movement/ship_navigation_unit_test.json index 9c3d4583..f78c8d79 100644 --- a/server/tests/test_games/movement/ship_navigation_unit_test.json +++ b/server/tests/test_games/movement/ship_navigation_unit_test.json @@ -1,17 +1,7 @@ { "state": { "Movement": { - "movement_actions_left": 2, - "moved_units": [ - 1 - ], - "current_move": { - "Fleet": { - "units": [ - 1 - ] - } - } + "movement_actions_left": 2 } }, "players": [ diff --git a/server/tests/test_games/movement/ship_transport.outcome.json b/server/tests/test_games/movement/ship_transport.outcome.json index 045c113b..48f06080 100644 --- a/server/tests/test_games/movement/ship_transport.outcome.json +++ b/server/tests/test_games/movement/ship_transport.outcome.json @@ -269,8 +269,24 @@ } } }, - "log": [ - "Player1: Move: sailed 1 ship from C3 to D2" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 1 + }, + "start": "C3", + "destination": "D2" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/movement/ship_transport_same_sea.outcome.json b/server/tests/test_games/movement/ship_transport_same_sea.outcome.json index 3c4691c9..cd4a5666 100644 --- a/server/tests/test_games/movement/ship_transport_same_sea.outcome.json +++ b/server/tests/test_games/movement/ship_transport_same_sea.outcome.json @@ -269,8 +269,24 @@ } } }, - "log": [ - "Player1: Move: sailed 1 ship from D2 to C3" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 1 + }, + "start": "D2", + "destination": "C3" + }, + "origin": { + "Ability": "Move" + } + } ] } ] diff --git a/server/tests/test_games/objective_cards/instant/conqueror.outcome3.json b/server/tests/test_games/objective_cards/instant/conqueror.outcome3.json index 72b8a5cd..91551cb7 100644 --- a/server/tests/test_games/objective_cards/instant/conqueror.outcome3.json +++ b/server/tests/test_games/objective_cards/instant/conqueror.outcome3.json @@ -231,6 +231,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -257,18 +261,142 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 3 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 26, + "hits": 3 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 4, + "hits": 0, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 3 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -286,7 +414,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -297,7 +426,8 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -310,7 +440,8 @@ "Building": "Fortress" }, "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -323,21 +454,25 @@ "Building": "Fortress" }, "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 26 and gets 3 hits against defending units, Gain 1 gold, Gain city C1, Gain Fortress at C1", - "Player2: Combat: Defending with 3 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus), 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 4 and gets 0 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lost 3 infantry at C1, Lose city C1, Lose Fortress at C1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" ] }, { @@ -350,6 +485,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -369,9 +505,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Conqueror using Scientific Lead/Conqueror" - ] + "active_events": 1 }, { "action": { @@ -383,6 +517,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -402,9 +537,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete General using Religious Fervor/General" - ] + "active_events": 1 }, { "action": { @@ -416,6 +549,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -435,9 +569,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Great Battle using City Planner/Great Battle" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/objective_cards/instant/defiance.outcome3.json b/server/tests/test_games/objective_cards/instant/defiance.outcome3.json index 69594906..5f7d73e7 100644 --- a/server/tests/test_games/objective_cards/instant/defiance.outcome3.json +++ b/server/tests/test_games/objective_cards/instant/defiance.outcome3.json @@ -210,12 +210,90 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] }, { @@ -224,6 +302,7 @@ "Bool": false } }, + "player": 0, "combat_stats": { "round": 2, "battleground": "City", @@ -249,15 +328,17 @@ }, "items": [ { - "player": 1, - "Units": { - "units": { - "infantry": 1 - }, - "balance": "Loss" - }, + "player": 0, + "Text": "Do not retreat", "origin": { - "Ability": "Combat" + "Ability": "Retreat" + } + }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" } }, { @@ -266,12 +347,92 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, + { + "player": 1, + "Units": { + "units": { + "infantry": 1 + }, + "balance": "Loss", + "position": "C1" + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -289,7 +450,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -300,22 +462,27 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Retreat: Do not retreat", - "Player2: Choose Casualties: Remove 1 of their defending units, Remove all defending units", - "Player2: Combat: Lost 1 infantry at C1, Defending with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against attacking units, Lost 1 infantry at C1, Lose city C1", - "Combat round 2", - "Player1: Combat: Attacking with 1 infantry, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Gain 1 gold, Gain city C1", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 }, { "action": { @@ -323,9 +490,17 @@ "SelectHandCards": [] } }, - "log": [ - "Player1: Select Objective Cards to Complete: No card selected" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "No card selected", + "origin": { + "Ability": "Select Objective Cards to Complete" + } + } + ], + "active_events": 1 }, { "action": { @@ -337,6 +512,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -356,9 +532,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Defiance using Eureka!/Defiance" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/objective_cards/instant/draft.outcome2.json b/server/tests/test_games/objective_cards/instant/draft.outcome2.json index 197d2a91..c1f27c17 100644 --- a/server/tests/test_games/objective_cards/instant/draft.outcome2.json +++ b/server/tests/test_games/objective_cards/instant/draft.outcome2.json @@ -233,11 +233,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -249,7 +253,7 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -260,22 +264,26 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 mood token with Draft, Gain 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token" ] }, { @@ -292,11 +300,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Recruit" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -308,7 +320,7 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Recruit" @@ -319,6 +331,13 @@ } ] }, + { + "player": 0, + "Text": "Reduce the cost of 1 Infantry to 1 mood token", + "origin": { + "Advance": "Draft" + } + }, { "player": 0, "MoodChange": { @@ -335,16 +354,13 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "A1" }, "origin": { "Ability": "Recruit" } } - ], - "log": [ - "Player1: Recruit: Pay 1 action, Pay 1 mood token with Draft, City A1 became Neutral, Gain 1 infantry at A1", - "Player1: Draft: Reduce the cost of 1 Infantry to 1 mood token" ] }, { @@ -357,6 +373,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -376,9 +393,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Draft using Large Civilization/Draft" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/objective_cards/instant/scavenger.outcome1.json b/server/tests/test_games/objective_cards/instant/scavenger.outcome1.json index 4cf5598f..62e8a08a 100644 --- a/server/tests/test_games/objective_cards/instant/scavenger.outcome1.json +++ b/server/tests/test_games/objective_cards/instant/scavenger.outcome1.json @@ -399,6 +399,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "Sea", @@ -427,46 +431,128 @@ "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "ships": 2 + }, + "start": "F6", + "destination": "E7" }, "origin": { "Ability": "Move" } }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "ships": 2 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + }, + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 5, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 5, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "F6" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "E7" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: sailed 2 ships from F6 to E7, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 ships, Roll 2 (cavalry, no bonus), 5 (cavalry, no bonus) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 ship at F6", - "Player2: Combat: Defending with 1 ship, Roll 5 (cavalry, no bonus) for combined combat value of 5 and gets 1 hits against attacking units, Lost 1 ship at E7", - "Player1: Choose Casualties: Remove 1 of their attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" ] }, { @@ -479,6 +565,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -498,9 +585,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Scavenger using Trade Focus/Scavenger" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/objective_cards/instant/warmonger.outcome4.json b/server/tests/test_games/objective_cards/instant/warmonger.outcome4.json index d417da48..7cecd18b 100644 --- a/server/tests/test_games/objective_cards/instant/warmonger.outcome4.json +++ b/server/tests/test_games/objective_cards/instant/warmonger.outcome4.json @@ -202,6 +202,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "CityWithFortress", @@ -231,6 +235,92 @@ "city_mood": "Angry" }, "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1, + "cavalry": 1 + }, + "start": "C2", + "destination": "C1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1, + "cavalry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 13, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 13, + "hits": 2, + "combat_modifiers": [ + "fortress added one extra die", + "fortress cancelled one hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { @@ -238,33 +328,40 @@ "infantry": 1, "cavalry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "fortress" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry and 1 cavalry from C2 to C1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry and 1 cavalry, Roll 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 13 and gets 1 hits against defending units, Lost 1 infantry and 1 cavalry at C2", - "Player2: Combat: Defending with 1 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 13 and gets 2 hits against attacking units, Combat modifiers: fortress added one extra die, fortress cancelled one hit, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Player2 wins the battle because he has a defending fortress" ] }, { @@ -279,12 +376,94 @@ } } }, - "log": [ - "Player1: Move: marched 1 infantry and 1 elephant from C2 to B1", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry and 1 elephant, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against defending units", - "Player2: Combat: Defending with 1 infantry, Roll 1 (leader, no bonus) for combined combat value of 1 and gets 0 hits against attacking units", - "Player1: Retreat: Player1 can retreat" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "infantry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "B1" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 1, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } ] }, { @@ -293,12 +472,84 @@ "Bool": false } }, - "log": [ - "Player1: Retreat: Do not retreat, Player1 can retreat", - "Combat round 2", - "Player1: Combat: Attacking with 1 infantry and 1 elephant, Roll 1 (leader, no bonus), 1 (leader, no bonus) for combined combat value of 2 and gets 0 hits against defending units", - "Player2: Combat: Defending with 1 infantry, Roll 2 (cavalry, no bonus) for combined combat value of 2 and gets 0 hits against attacking units" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Do not retreat", + "origin": { + "Ability": "Retreat" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Cavalry", + "bonus": false + } + ], + "combat_value": 2, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Player1 can retreat", + "origin": { + "Ability": "Retreat" + } + } + ], + "active_events": 1 }, { "action": { @@ -306,6 +557,7 @@ "Bool": false } }, + "player": 0, "combat_stats": { "round": 3, "battleground": "Land", @@ -330,27 +582,100 @@ "result": "AttackerWins" }, "items": [ + { + "player": 0, + "Text": "Do not retreat", + "origin": { + "Ability": "Retreat" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 1 + }, + "round": 3 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 1, + "unit_type": { + "Leader": "Alexander" + }, + "bonus": false + } + ], + "combat_value": 8, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 3, + "unit_type": "Elephant", + "bonus": false + } + ], + "combat_value": 3, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "B1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Retreat: Do not retreat", - "Combat round 3", - "Player1: Combat: Attacking with 1 infantry and 1 elephant, Roll 6 (infantry, +1 combat value), 1 (leader, no bonus) for combined combat value of 8 and gets 1 hits against defending units", - "Player2: Combat: Defending with 1 infantry, Roll 3 (elephant, no bonus) for combined combat value of 3 and gets 0 hits against attacking units, Lost 1 infantry at B1", - "Player2: Choose Casualties: Remove all defending units", - "Attacker wins" - ] + "active_events": 1 }, { "action": { @@ -362,6 +687,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -381,9 +707,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Warmonger using Coastal Culture/Warmonger" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/objective_cards/status_phase/colony.outcome2.json b/server/tests/test_games/objective_cards/status_phase/colony.outcome2.json index f3a4566b..dfac2811 100644 --- a/server/tests/test_games/objective_cards/status_phase/colony.outcome2.json +++ b/server/tests/test_games/objective_cards/status_phase/colony.outcome2.json @@ -412,14 +412,29 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 3 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss", + "amount": 3 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] }, { - "turn_type": "StatusPhase", + "turn_type": { + "StatusPhase": "CompleteObjectives" + }, "actions": [ { "action": { @@ -431,6 +446,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -450,9 +466,7 @@ } } ], - "log": [ - "Player2: Complete Objectives: Complete Colony using Colony/Threat" - ] + "active_events": 2 }, { "action": { @@ -464,6 +478,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -481,12 +496,16 @@ "origin": { "Ability": "Complete Objectives" } + }, + { + "player": 1, + "Text": "wins the game", + "origin": { + "Ability": "having the most points" + } } ], - "log": [ - "Player2: Complete Objectives: Complete Outpost using Magnificent Culture/Outpost", - "The game has ended. Player2 has won" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/objective_cards/status_phase/large_civ.outcome8.json b/server/tests/test_games/objective_cards/status_phase/large_civ.outcome8.json index 8a7cb85b..d62406c9 100644 --- a/server/tests/test_games/objective_cards/status_phase/large_civ.outcome8.json +++ b/server/tests/test_games/objective_cards/status_phase/large_civ.outcome8.json @@ -320,14 +320,29 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 2 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss", + "amount": 2 + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] }, { - "turn_type": "StatusPhase", + "turn_type": { + "StatusPhase": "CompleteObjectives" + }, "actions": [ { "action": { @@ -339,6 +354,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -358,9 +374,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Advanced Culture using Advanced Culture/Warmonger" - ] + "active_events": 2 }, { "action": { @@ -372,6 +386,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -391,9 +406,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete City Planner using City Planner/Great Battle" - ] + "active_events": 2 }, { "action": { @@ -405,6 +418,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -424,9 +438,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Government using Government/Barbarian Conquest" - ] + "active_events": 2 }, { "action": { @@ -438,6 +450,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -457,9 +470,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Large Civilization using Large Civilization/Draft" - ] + "active_events": 2 }, { "action": { @@ -471,6 +482,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -490,9 +502,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Large Fleet using Wealth/Large Fleet" - ] + "active_events": 2 }, { "action": { @@ -504,6 +514,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -523,9 +534,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Religious Fervor using Religious Fervor/General" - ] + "active_events": 2 }, { "action": { @@ -537,6 +546,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -556,9 +566,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Sea Blockade using Education Lead/Sea Blockade" - ] + "active_events": 2 }, { "action": { @@ -570,6 +578,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -577,12 +586,19 @@ "resources": { "ideas": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Objective": "Eureka!" } }, + { + "player": 0, + "Text": "Pay 2 ideas for Eureka!", + "origin": { + "Objective": "Eureka!" + } + }, { "player": 0, "HandCard": { @@ -601,10 +617,18 @@ } } ], - "log": [ - "Player1: Eureka!: Pay 2 ideas for Eureka!", - "Player1: Complete Objectives: Complete Eureka! using Eureka!/Defiance" - ] + "active_events": 2 + } + ] + }, + { + "turn_type": { + "StatusPhase": "FreeAdvance" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 } ] } @@ -613,8 +637,8 @@ ] } ], - "log_index": 8, - "undo_limit": 0, + "log_index": 1, + "undo_limit": 1, "actions_left": 2, "round": 4, "age": 1, diff --git a/server/tests/test_games/objective_cards/status_phase/standing_army.outcome1.json b/server/tests/test_games/objective_cards/status_phase/standing_army.outcome1.json index c1c2c3a1..f940f85d 100644 --- a/server/tests/test_games/objective_cards/status_phase/standing_army.outcome1.json +++ b/server/tests/test_games/objective_cards/status_phase/standing_army.outcome1.json @@ -273,14 +273,28 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 1 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss" + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] }, { - "turn_type": "StatusPhase", + "turn_type": { + "StatusPhase": "CompleteObjectives" + }, "actions": [ { "action": { @@ -292,6 +306,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -311,9 +326,18 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Standing Army using Food Supplies/Standing Army" - ] + "active_events": 2 + } + ] + }, + { + "turn_type": { + "StatusPhase": "FreeAdvance" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 } ] } @@ -323,7 +347,7 @@ } ], "log_index": 1, - "undo_limit": 0, + "undo_limit": 1, "actions_left": 1, "round": 4, "age": 1, diff --git a/server/tests/test_games/status_phase/change_government.outcome2.json b/server/tests/test_games/status_phase/change_government.outcome2.json index e8179d49..ab60775d 100644 --- a/server/tests/test_games/status_phase/change_government.outcome2.json +++ b/server/tests/test_games/status_phase/change_government.outcome2.json @@ -241,9 +241,28 @@ "SelectPositions": [] } }, - "log": [ - "Player2: Raze city: Did not raze a city" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Did not raze a city", + "origin": { + "Ability": "Raze city" + } + } + ], + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "ChangeGovernmentType" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 }, { "action": { @@ -256,6 +275,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -264,16 +284,14 @@ "mood_tokens": 1, "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Change Government" } } ], - "log": [ - "Player1: Change Government: Pay 1 mood token and 1 culture token" - ] + "active_events": 1 }, { "action": { @@ -286,12 +304,27 @@ } } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Democracy changed their government from Player1 to Theocracy", + "origin": { + "Ability": "Change Government" + } + }, + { + "player": 0, + "Text": "Additional advances: Devotion", + "origin": { + "Ability": "Change Government" + } + }, { "player": 0, "Advance": { "advance": "Voting", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { @@ -302,18 +335,32 @@ "player": 0, "Advance": { "advance": "FreeEconomy", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Loss" }, "origin": { "Ability": "Change Government" } }, + { + "player": 0, + "Text": "Ideas limit reduced to 2", + "origin": { + "Advance": "Dogma" + } + }, + { + "player": 0, + "Text": "unlocks Provinces", + "origin": { + "Ability": "Change Government" + } + }, { "player": 0, "Advance": { "advance": "Dogma", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -324,7 +371,7 @@ "player": 0, "Advance": { "advance": "Devotion", - "take_incident_token": false, + "incident_token": "NoChange", "balance": "Gain" }, "origin": { @@ -332,10 +379,31 @@ } } ], - "log": [ - "Player1: Change Government: Player1 changed their government from Democracy to Theocracy, Additional advances: Devotion, Unlock Provinces, Gain Dogma without taking an event token, Gain Devotion without taking an event token", - "Player1: Dogma: Ideas limit reduced to 2", - "Player1: Waste: Could not store 1 idea" + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "DetermineFirstPlayer" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0, + "items": [ + { + "player": 0, + "Resources": { + "resources": { + "ideas": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } + } ] } ] @@ -345,8 +413,8 @@ ] } ], - "log_index": 3, - "undo_limit": 3, + "log_index": 1, + "undo_limit": 1, "actions_left": 3, "round": 1, "age": 1, diff --git a/server/tests/test_games/status_phase/determine_first_player.outcome.json b/server/tests/test_games/status_phase/determine_first_player.outcome.json index b141e79c..98611f3d 100644 --- a/server/tests/test_games/status_phase/determine_first_player.outcome.json +++ b/server/tests/test_games/status_phase/determine_first_player.outcome.json @@ -204,9 +204,17 @@ "SelectPlayer": 1 } }, - "log": [ - "Player1: Determine First Player: Player1 choose Player2 as the new starting player" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Player1 choose Player2 as the new starting player", + "origin": { + "Ability": "Determine First Player" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/status_phase/end_game.outcome.json b/server/tests/test_games/status_phase/end_game.outcome.json index 9c0498bc..0069c478 100644 --- a/server/tests/test_games/status_phase/end_game.outcome.json +++ b/server/tests/test_games/status_phase/end_game.outcome.json @@ -282,19 +282,29 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 0 actions left" - ] + "player": 0, + "origin": { + "Ability": "End Turn" + } } ] }, { - "turn_type": "StatusPhase", + "turn_type": { + "StatusPhase": "CompleteObjectives" + }, "actions": [ { "action": "StartTurn", - "log": [ - "The game has ended. Player2 has won" + "player": 0, + "items": [ + { + "player": 1, + "Text": "wins the game", + "origin": { + "Ability": "having the most points" + } + } ] } ] diff --git a/server/tests/test_games/status_phase/free_advance.outcome.json b/server/tests/test_games/status_phase/free_advance.outcome.json deleted file mode 100644 index 28fd3e8d..00000000 --- a/server/tests/test_games/status_phase/free_advance.outcome.json +++ /dev/null @@ -1,365 +0,0 @@ -{ - "state": "Playing", - "events": [ - { - "event_type": { - "StatusPhase": "FreeAdvance" - }, - "player": 1, - "last_priority_used": 0, - "handler": { - "priority": 0, - "request": { - "SelectAdvance": { - "choices": [ - "Storage", - "Irrigation", - "Husbandry", - "Engineering", - "Sanitation", - "Roads", - "Navigation", - "WarShips", - "Cartography", - "Writing", - "Tactics", - "Rituals", - "Priesthood", - "Bartering", - "Arts", - "Math", - "Dogma" - ] - } - }, - "origin": { - "Ability": "Free Advance" - } - } - } - ], - "players": [ - { - "id": 0, - "resources": { - "food": 7, - "wood": 5, - "ore": 5, - "ideas": 1, - "gold": 5, - "mood_tokens": 12, - "culture_tokens": 10 - }, - "resource_limit": { - "food": 7, - "wood": 7, - "ore": 7, - "ideas": 7, - "gold": 7 - }, - "cities": [ - { - "city_pieces": { - "market": 1 - }, - "mood_state": "Happy", - "position": "A1" - }, - { - "city_pieces": { - "academy": 1, - "port": 1 - }, - "mood_state": "Angry", - "position": "C2", - "port_position": "C3" - }, - { - "city_pieces": { - "obelisk": 1, - "observatory": 1, - "fortress": 1, - "temple": 1 - }, - "mood_state": "Neutral", - "position": "B1" - }, - { - "mood_state": "Angry", - "position": "B3" - } - ], - "units": [ - { - "position": "C2", - "unit_type": "Infantry", - "id": 0 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 3 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 4 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 5 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 6 - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 7, - "carried_units": [ - { - "unit_type": "Cavalry", - "id": 1 - }, - { - "unit_type": "Elephant", - "id": 2 - } - ] - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 8 - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 9 - } - ], - "civilization": "China", - "advances": [ - "Farming", - "Fishing", - "FreeEconomy", - "FreeEducation", - "Mining", - "Storage", - "Voting", - "Writing" - ], - "incident_tokens": 3, - "wonder_cards": [ - "GreatGardens" - ], - "next_unit_id": 10 - }, - { - "id": 1, - "resources": { - "food": 2, - "wood": 5, - "ore": 5, - "ideas": 6, - "gold": 5, - "mood_tokens": 9, - "culture_tokens": 9 - }, - "resource_limit": { - "food": 2, - "wood": 7, - "ore": 7, - "ideas": 7, - "gold": 7 - }, - "cities": [ - { - "mood_state": "Happy", - "position": "C1" - }, - { - "city_pieces": { - "port": 1 - }, - "mood_state": "Neutral", - "position": "B2", - "port_position": "C3" - } - ], - "units": [ - { - "position": "C1", - "unit_type": "Infantry", - "id": 0 - }, - { - "position": "C1", - "unit_type": "Infantry", - "id": 1 - } - ], - "civilization": "Rome", - "advances": [ - "Farming", - "Fishing", - "Mining", - "Myths", - "StateReligion" - ], - "incident_tokens": 3, - "next_unit_id": 2 - }, - { - "id": 2, - "civilization": "Barbarians", - "next_unit_id": 0 - }, - { - "id": 3, - "civilization": "Pirates", - "next_unit_id": 0 - } - ], - "map": { - "tiles": [ - [ - "A1", - "Fertile" - ], - [ - "A2", - "Water" - ], - [ - "A3", - { - "Exhausted": "Forest" - } - ], - [ - "A4", - "Mountain" - ], - [ - "B1", - "Mountain" - ], - [ - "B2", - "Forest" - ], - [ - "B3", - "Fertile" - ], - [ - "B4", - "Fertile" - ], - [ - "B5", - "Fertile" - ], - [ - "B6", - "Fertile" - ], - [ - "C1", - "Barren" - ], - [ - "C2", - "Forest" - ], - [ - "C3", - "Water" - ], - [ - "C4", - "Water" - ], - [ - "C5", - "Water" - ], - [ - "D1", - "Fertile" - ], - [ - "D2", - "Water" - ], - [ - "E2", - "Fertile" - ] - ] - }, - "starting_player_index": 1, - "current_player_index": 1, - "log": [ - { - "age": 1, - "rounds": [ - { - "round": 1, - "turns": [ - { - "turn_type": { - "Player": 0 - }, - "actions": [ - { - "action": { - "Playing": "EndTurn" - }, - "log": [ - "Player1: End Turn: 0 actions left" - ] - } - ] - }, - { - "turn_type": "StatusPhase" - } - ] - } - ] - } - ], - "log_index": 0, - "undo_limit": 0, - "actions_left": 0, - "round": 4, - "age": 2, - "messages": [ - "The game has started" - ], - "dice_roll_outcomes": [ - 1, - 1, - 10, - 10, - 10, - 10, - 10, - 10, - 10, - 10 - ], - "rng": "46312381643103681595563341886777350953", - "wonders_left": [ - "Pyramids" - ], - "action_cards_left": [ - 1, - 2 - ] -} \ No newline at end of file diff --git a/server/tests/test_games/status_phase/free_advance.outcome1.json b/server/tests/test_games/status_phase/free_advance.outcome1.json deleted file mode 100644 index 0f546ecb..00000000 --- a/server/tests/test_games/status_phase/free_advance.outcome1.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "state": "Playing", - "events": [ - { - "event_type": { - "StatusPhase": "FreeAdvance" - }, - "players_used": [ - 1 - ], - "player": 0, - "last_priority_used": 0, - "handler": { - "priority": 0, - "request": { - "SelectAdvance": { - "choices": [ - "Irrigation", - "Husbandry", - "Engineering", - "Sanitation", - "Roads", - "Navigation", - "WarShips", - "Cartography", - "PublicEducation", - "Philosophy", - "Tactics", - "Myths", - "Bartering", - "Arts", - "Math", - "SeparationOfPower", - "CivilLiberties" - ] - } - }, - "origin": { - "Ability": "Free Advance" - } - } - } - ], - "players": [ - { - "id": 0, - "resources": { - "food": 7, - "wood": 5, - "ore": 5, - "ideas": 1, - "gold": 5, - "mood_tokens": 12, - "culture_tokens": 10 - }, - "resource_limit": { - "food": 7, - "wood": 7, - "ore": 7, - "ideas": 7, - "gold": 7 - }, - "cities": [ - { - "city_pieces": { - "market": 1 - }, - "mood_state": "Happy", - "position": "A1" - }, - { - "city_pieces": { - "academy": 1, - "port": 1 - }, - "mood_state": "Angry", - "position": "C2", - "port_position": "C3" - }, - { - "city_pieces": { - "obelisk": 1, - "observatory": 1, - "fortress": 1, - "temple": 1 - }, - "mood_state": "Neutral", - "position": "B1" - }, - { - "mood_state": "Angry", - "position": "B3" - } - ], - "units": [ - { - "position": "C2", - "unit_type": "Infantry", - "id": 0 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 3 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 4 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 5 - }, - { - "position": "B3", - "unit_type": "Settler", - "id": 6 - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 7, - "carried_units": [ - { - "unit_type": "Cavalry", - "id": 1 - }, - { - "unit_type": "Elephant", - "id": 2 - } - ] - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 8 - }, - { - "position": "C3", - "unit_type": "Ship", - "id": 9 - } - ], - "civilization": "China", - "advances": [ - "Farming", - "Fishing", - "FreeEconomy", - "FreeEducation", - "Mining", - "Storage", - "Voting", - "Writing" - ], - "incident_tokens": 3, - "wonder_cards": [ - "GreatGardens" - ], - "next_unit_id": 10 - }, - { - "id": 1, - "resources": { - "food": 2, - "wood": 5, - "ore": 5, - "ideas": 6, - "gold": 5, - "mood_tokens": 10, - "culture_tokens": 9 - }, - "resource_limit": { - "food": 7, - "wood": 7, - "ore": 7, - "ideas": 7, - "gold": 7 - }, - "cities": [ - { - "mood_state": "Happy", - "position": "C1" - }, - { - "city_pieces": { - "port": 1 - }, - "mood_state": "Neutral", - "position": "B2", - "port_position": "C3" - } - ], - "units": [ - { - "position": "C1", - "unit_type": "Infantry", - "id": 0 - }, - { - "position": "C1", - "unit_type": "Infantry", - "id": 1 - } - ], - "civilization": "Rome", - "advances": [ - "Farming", - "Fishing", - "Mining", - "Myths", - "StateReligion", - "Storage" - ], - "incident_tokens": 2, - "next_unit_id": 2 - }, - { - "id": 2, - "civilization": "Barbarians", - "next_unit_id": 0 - }, - { - "id": 3, - "civilization": "Pirates", - "next_unit_id": 0 - } - ], - "map": { - "tiles": [ - [ - "A1", - "Fertile" - ], - [ - "A2", - "Water" - ], - [ - "A3", - { - "Exhausted": "Forest" - } - ], - [ - "A4", - "Mountain" - ], - [ - "B1", - "Mountain" - ], - [ - "B2", - "Forest" - ], - [ - "B3", - "Fertile" - ], - [ - "B4", - "Fertile" - ], - [ - "B5", - "Fertile" - ], - [ - "B6", - "Fertile" - ], - [ - "C1", - "Barren" - ], - [ - "C2", - "Forest" - ], - [ - "C3", - "Water" - ], - [ - "C4", - "Water" - ], - [ - "C5", - "Water" - ], - [ - "D1", - "Fertile" - ], - [ - "D2", - "Water" - ], - [ - "E2", - "Fertile" - ] - ] - }, - "starting_player_index": 1, - "current_player_index": 1, - "log": [ - { - "age": 1, - "rounds": [ - { - "round": 1, - "turns": [ - { - "turn_type": { - "Player": 0 - }, - "actions": [ - { - "action": { - "Playing": "EndTurn" - }, - "log": [ - "Player1: End Turn: 0 actions left" - ] - } - ] - }, - { - "turn_type": "StatusPhase", - "actions": [ - { - "action": { - "Response": { - "SelectAdvance": "Storage" - } - }, - "items": [ - { - "player": 1, - "Resources": { - "resources": { - "mood_tokens": 1 - }, - "balance": "Gain" - }, - "origin": { - "Advance": "Storage" - } - }, - { - "player": 1, - "Advance": { - "advance": "Storage", - "take_incident_token": true, - "balance": "Gain" - }, - "origin": { - "Ability": "Free Advance" - } - } - ], - "log": [ - "Player2: Storage: Gain 1 mood token", - "Player2: Free Advance: Gain Storage and take an event token (2 left)" - ] - } - ] - } - ] - } - ] - } - ], - "log_index": 1, - "undo_limit": 1, - "actions_left": 0, - "round": 4, - "age": 2, - "messages": [ - "The game has started" - ], - "dice_roll_outcomes": [ - 1, - 1, - 10, - 10, - 10, - 10, - 10, - 10, - 10, - 10 - ], - "rng": "46312381643103681595563341886777350953", - "wonders_left": [ - "Pyramids" - ], - "action_cards_left": [ - 1, - 2 - ] -} \ No newline at end of file diff --git a/server/tests/test_games/status_phase/free_advance.outcome2.json b/server/tests/test_games/status_phase/free_advance.outcome2.json index 7eca5804..af2d1acd 100644 --- a/server/tests/test_games/status_phase/free_advance.outcome2.json +++ b/server/tests/test_games/status_phase/free_advance.outcome2.json @@ -323,14 +323,22 @@ "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 0 actions left" - ] + "player": 0, + "origin": { + "Ability": "End Turn" + } } ] }, { - "turn_type": "StatusPhase", + "turn_type": { + "StatusPhase": "CompleteObjectives" + } + }, + { + "turn_type": { + "StatusPhase": "FreeAdvance" + }, "actions": [ { "action": { @@ -338,6 +346,7 @@ "SelectAdvance": "Storage" } }, + "player": 1, "items": [ { "player": 1, @@ -355,7 +364,9 @@ "player": 1, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { @@ -363,10 +374,7 @@ } } ], - "log": [ - "Player2: Storage: Gain 1 mood token", - "Player2: Free Advance: Gain Storage and take an event token (2 left)" - ] + "active_events": 1 }, { "action": { @@ -374,6 +382,7 @@ "SelectAdvance": "Philosophy" } }, + "player": 0, "items": [ { "player": 0, @@ -403,13 +412,29 @@ "player": 0, "Advance": { "advance": "Philosophy", - "take_incident_token": true, + "incident_token": { + "Take": 2 + }, "balance": "Gain" }, "origin": { "Ability": "Free Advance" } - }, + } + ], + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "DrawCards" + }, + "actions": [ + { + "action": "StartTurn", + "player": 1, + "items": [ { "player": 1, "HandCard": { @@ -425,6 +450,13 @@ "Ability": "Draw Cards" } }, + { + "player": 1, + "Text": "Reshuffling Objective Card pile", + "origin": { + "Ability": "Draw Cards" + } + }, { "player": 1, "HandCard": { @@ -470,24 +502,28 @@ "Ability": "Draw Cards" } } - ], - "log": [ - "Player1: Philosophy: Gain 1 idea, Gain 1 mood token", - "Player1: Free Advance: Gain Philosophy and take an event token (2 left)", - "Player2: Draw Cards: Draw an action card, Draw an objective card", - "Reshuffling Objective Card pile", - "Player1: Draw Cards: Draw an action card, Draw an objective card" ] } ] + }, + { + "turn_type": { + "StatusPhase": "RazeSize1City" + }, + "actions": [ + { + "action": "StartTurn", + "player": 1 + } + ] } ] } ] } ], - "log_index": 2, - "undo_limit": 2, + "log_index": 1, + "undo_limit": 1, "actions_left": 0, "round": 4, "age": 2, diff --git a/server/tests/test_games/status_phase/keep_government.outcome1.json b/server/tests/test_games/status_phase/keep_government.outcome1.json index d708e49b..7f1dc6b2 100644 --- a/server/tests/test_games/status_phase/keep_government.outcome1.json +++ b/server/tests/test_games/status_phase/keep_government.outcome1.json @@ -238,9 +238,28 @@ "SelectPositions": [] } }, - "log": [ - "Player2: Raze city: Did not raze a city" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Did not raze a city", + "origin": { + "Ability": "Raze city" + } + } + ], + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "ChangeGovernmentType" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 }, { "action": { @@ -250,21 +269,38 @@ ] } }, + "player": 0, "items": [ { "player": 0, "Resources": { "resources": {}, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Change Government" } + }, + { + "player": 0, + "Text": "Keep current government", + "origin": { + "Ability": "Change Government" + } } ], - "log": [ - "Player1: Change Government: Pay nothing, Keep current government" - ] + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "DetermineFirstPlayer" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 } ] } @@ -273,7 +309,7 @@ ] } ], - "log_index": 2, + "log_index": 1, "undo_limit": 1, "actions_left": 3, "round": 1, diff --git a/server/tests/test_games/status_phase/raze_city.outcome.json b/server/tests/test_games/status_phase/raze_city.outcome.json index b3c424ae..23727270 100644 --- a/server/tests/test_games/status_phase/raze_city.outcome.json +++ b/server/tests/test_games/status_phase/raze_city.outcome.json @@ -236,13 +236,15 @@ ] } }, + "player": 0, "items": [ { "player": 0, "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Raze city" @@ -261,9 +263,7 @@ } } ], - "log": [ - "Player1: Raze city: Lose city A1, Gain 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/status_phase/raze_city_decline.outcome.json b/server/tests/test_games/status_phase/raze_city_decline.outcome.json index e0c98242..89ee5000 100644 --- a/server/tests/test_games/status_phase/raze_city_decline.outcome.json +++ b/server/tests/test_games/status_phase/raze_city_decline.outcome.json @@ -238,9 +238,17 @@ "SelectPositions": [] } }, - "log": [ - "Player1: Raze city: Did not raze a city" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Did not raze a city", + "origin": { + "Ability": "Raze city" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/status_phase/raze_city_decline.outcome1.json b/server/tests/test_games/status_phase/raze_city_decline.outcome1.json index 4929b6ea..8528b1ea 100644 --- a/server/tests/test_games/status_phase/raze_city_decline.outcome1.json +++ b/server/tests/test_games/status_phase/raze_city_decline.outcome1.json @@ -234,9 +234,17 @@ "SelectPositions": [] } }, - "log": [ - "Player1: Raze city: Did not raze a city" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Did not raze a city", + "origin": { + "Ability": "Raze city" + } + } + ], + "active_events": 1 }, { "action": { @@ -244,9 +252,39 @@ "SelectPositions": [] } }, - "log": [ - "Player2: Raze city: Did not raze a city" - ] + "player": 1, + "items": [ + { + "player": 1, + "Text": "Did not raze a city", + "origin": { + "Ability": "Raze city" + } + } + ], + "active_events": 1 + } + ] + }, + { + "turn_type": { + "StatusPhase": "ChangeGovernmentType" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 + } + ] + }, + { + "turn_type": { + "StatusPhase": "DetermineFirstPlayer" + }, + "actions": [ + { + "action": "StartTurn", + "player": 0 } ] } @@ -255,8 +293,8 @@ ] } ], - "log_index": 2, - "undo_limit": 2, + "log_index": 1, + "undo_limit": 1, "actions_left": 3, "round": 1, "age": 1, diff --git a/server/tests/test_games/tactics_cards/archers.outcome2.json b/server/tests/test_games/tactics_cards/archers.outcome2.json index 9c8b1f32..0dc6b3ee 100644 --- a/server/tests/test_games/tactics_cards/archers.outcome2.json +++ b/server/tests/test_games/tactics_cards/archers.outcome2.json @@ -192,22 +192,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -220,6 +247,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -235,12 +263,23 @@ "origin": { "Advance": "Tactics" } + }, + { + "player": 0, + "Text": "Reveal Tactics Card Archers", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "rolls a 6 and scored a hit", + "origin": { + "TacticsCard": 26 + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Archers", - "Player2: Archers: Rolled a 6 and scored a hit" - ] + "active_events": 1 }, { "action": { @@ -250,6 +289,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -279,26 +319,9 @@ "items": [ { "player": 1, - "Units": { - "units": { - "infantry": 1 - }, - "balance": "Loss" - }, + "Text": "Player2 sacrifices an infantry for Archers", "origin": { - "Ability": "Combat" - } - }, - { - "player": 0, - "Units": { - "units": { - "infantry": 1 - }, - "balance": "Loss" - }, - "origin": { - "Ability": "Combat" + "TacticsCard": 26 } }, { @@ -307,21 +330,96 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, + { + "player": 0, + "Units": { + "units": { + "infantry": 1 + }, + "balance": "Loss", + "position": "C2" + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, + { + "player": 1, + "Units": { + "units": { + "infantry": 1 + }, + "balance": "Loss", + "position": "C1" + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player2: Archers: Player2 sacrifices an infantry for Archers", - "Player2: Combat: Lost 1 infantry at C1, Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Battle ends in a draw" - ] + "active_events": 1 } ] } @@ -357,4 +455,4 @@ "action_cards_discarded": [ 26 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/tactics_cards/encircled.outcome.json b/server/tests/test_games/tactics_cards/encircled.outcome.json index 4987d405..4d1c9646 100644 --- a/server/tests/test_games/tactics_cards/encircled.outcome.json +++ b/server/tests/test_games/tactics_cards/encircled.outcome.json @@ -272,22 +272,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] } ] diff --git a/server/tests/test_games/tactics_cards/encircled.outcome1.json b/server/tests/test_games/tactics_cards/encircled.outcome1.json index e21e2cb9..2640b38b 100644 --- a/server/tests/test_games/tactics_cards/encircled.outcome1.json +++ b/server/tests/test_games/tactics_cards/encircled.outcome1.json @@ -192,22 +192,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -220,6 +247,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -262,40 +290,108 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Encircled", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "rolls a 5 or 6 and added a hit that cannot be ignored", + "origin": { + "TacticsCard": 2 + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Encircled", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 2 infantry at C1", - "Player1: Encircled: Rolled a 5 or 6 and added a hit that cannot be ignored", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Battle ends in a draw" - ] + "active_events": 1 } ] } @@ -331,4 +427,4 @@ "action_cards_discarded": [ 2 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/tactics_cards/flanking.outcome1.json b/server/tests/test_games/tactics_cards/flanking.outcome1.json index a62939d9..25398dd1 100644 --- a/server/tests/test_games/tactics_cards/flanking.outcome1.json +++ b/server/tests/test_games/tactics_cards/flanking.outcome1.json @@ -190,22 +190,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -218,6 +245,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -260,39 +288,109 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Flanking", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 13, + "hits": 2, + "combat_modifiers": [ + "Flanking added 1 extra die" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Flanking", - "Player1: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 13 and gets 2 hits against defending units, Combat modifiers: Flanking added 1 extra die, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 2 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove all defending units", - "Battle ends in a draw" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/heavy_resistance.outcome1.json b/server/tests/test_games/tactics_cards/heavy_resistance.outcome1.json index e4314915..9ee13754 100644 --- a/server/tests/test_games/tactics_cards/heavy_resistance.outcome1.json +++ b/server/tests/test_games/tactics_cards/heavy_resistance.outcome1.json @@ -199,22 +199,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -227,6 +254,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -269,39 +297,104 @@ "Advance": "Tactics" } }, + { + "player": 1, + "Text": "Reveal Tactics Card Heavy Resistance", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 6, + "hits": 1, + "combat_modifiers": [ + "Heavy resistance added -1 to combat value for each unit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Heavy Resistance", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 6 and gets 1 hits against defending units, Combat modifiers: Heavy resistance added -1 to combat value for each unit, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/high_ground.outcome2.json b/server/tests/test_games/tactics_cards/high_ground.outcome2.json index 8006e1f9..1adfd479 100644 --- a/server/tests/test_games/tactics_cards/high_ground.outcome2.json +++ b/server/tests/test_games/tactics_cards/high_ground.outcome2.json @@ -199,22 +199,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -227,6 +254,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -244,9 +272,7 @@ } } ], - "log": [ - "Player1: Tactics: Play an action card face down" - ] + "active_events": 1 }, { "action": { @@ -258,6 +284,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -300,40 +327,112 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Peltasts", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Reveal Tactics Card High Ground", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 1, + "combat_modifiers": [ + "Peltasts rolls a 6 and ignored a hit", + "High Ground prevents opponent from using combat abilities" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card High Ground", - "Player1: Tactics: Reveal Tactics Card Peltasts", - "Player1: Combat: Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 1 hits against defending units, Combat modifiers: Peltasts rolled a 6 and ignored a hit, High Ground prevents opponent from using combat abilities, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } @@ -370,4 +469,4 @@ 1, 9 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/tactics_cards/high_morale.outcome1.json b/server/tests/test_games/tactics_cards/high_morale.outcome1.json index 7cd1fcf6..3e5ab9d8 100644 --- a/server/tests/test_games/tactics_cards/high_morale.outcome1.json +++ b/server/tests/test_games/tactics_cards/high_morale.outcome1.json @@ -199,22 +199,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -227,6 +254,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -269,39 +297,104 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card High Morale", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 9, + "hits": 1, + "combat_modifiers": [ + "High Morale added 2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card High Morale", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 9 and gets 1 hits against defending units, Combat modifiers: High Morale added 2 combat value, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/martyr.outcome4.json b/server/tests/test_games/tactics_cards/martyr.outcome4.json index fd7e478f..45a3ddac 100644 --- a/server/tests/test_games/tactics_cards/martyr.outcome4.json +++ b/server/tests/test_games/tactics_cards/martyr.outcome4.json @@ -265,11 +265,43 @@ } } }, - "log": [ - "Player1: Move: sailed 2 ships from C3 to D2", - "Combat round 1", - "Player1: Combat: Attacking with 1 settler, 2 ships, 1 cavalry and 1 elephant", - "Player2: Combat: Defending with 1 ship" + "player": 0, + "origin": { + "Ability": "Move" + }, + "items": [ + { + "player": 0, + "Move": { + "units": { + "ships": 2 + }, + "start": "C3", + "destination": "D2" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "settlers": 1, + "ships": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "ships": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + } ] }, { @@ -282,6 +314,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -299,9 +332,7 @@ } } ], - "log": [ - "Player1: Tactics: Play an action card face down" - ] + "active_events": 1 }, { "action": { @@ -313,6 +344,7 @@ ] } }, + "player": 1, "items": [ { "player": 1, @@ -328,13 +360,30 @@ "origin": { "Advance": "Tactics" } + }, + { + "player": 0, + "Text": "Reveal Tactics Card High Morale", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Reveal Tactics Card Martyr", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "Text": "Cannot use tactics card (but it is still discarded)", + "origin": { + "TacticsCard": 24 + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Martyr", - "Player1: Tactics: Reveal Tactics Card High Morale", - "Player1: Martyr: Cannot use tactics card (but it is still discarded)" - ] + "active_events": 1 }, { "action": { @@ -344,24 +393,30 @@ ] } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Player1 sacrifices a ship", + "origin": { + "TacticsCard": 24 + } + }, { "player": 0, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Combat" } } ], - "log": [ - "Player1: Martyr: Player1 sacrifices a ship", - "Player1: Combat: Lost 1 ship at C3" - ] + "active_events": 1 }, { "action": { @@ -371,6 +426,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "Sea", @@ -397,38 +453,83 @@ "result": "AttackerWins" }, "items": [ + { + "player": 0, + "Text": "Killed carried units: 1 elephant and", + "origin": { + "Ability": "Choose Casualties (carried units)" + } + }, { "player": 0, "Units": { "units": { "elephants": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C3" }, "origin": { "Ability": "Choose Casualties (carried units)" } }, + { + "player": 1, + "Text": "Player2 sacrifices a ship", + "origin": { + "TacticsCard": 24 + } + }, { "player": 1, "Units": { "units": { "ships": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "D2" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 6, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [], + "combat_value": 0, + "hits": 0 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Choose Casualties (carried units): Killed carried units: 1 elephant, Lost 1 elephant at C3", - "Player2: Martyr: Player2 sacrifices a ship", - "Player2: Combat: Lost 1 ship at D2, Roll no dice for combined combat value of 0 and gets 0 hits against attacking units", - "Player1: Combat: Roll 6 (infantry, no bonus) for combined combat value of 6 and gets 0 hits against defending units", - "Attacker wins" - ] + "active_events": 2 } ] } diff --git a/server/tests/test_games/tactics_cards/martyr2.json b/server/tests/test_games/tactics_cards/martyr2.json index 3ae13ac7..9bf47590 100644 --- a/server/tests/test_games/tactics_cards/martyr2.json +++ b/server/tests/test_games/tactics_cards/martyr2.json @@ -1,7 +1,4 @@ { - "options": { - "undo": "SamePlayer" - }, "version": 2, "seed": "ZT1bXMKUoxGJ8aJU7ZEtVl8o9A4LCqJl1Fey1yRMGwM=", "state": { @@ -612,7 +609,8 @@ } } } - } + }, + "player": 0 }, { "action": { @@ -626,7 +624,8 @@ "embark_carrier_id": 8 } } - } + }, + "player": 0 }, { "action": { @@ -639,7 +638,8 @@ "embark_carrier_id": 9 } } - } + }, + "player": 0 }, { "action": { @@ -652,12 +652,14 @@ "embark_carrier_id": 9 } } - } + }, + "player": 0 }, { "action": { "Movement": "Stop" - } + }, + "player": 0 }, { "action": { @@ -672,7 +674,8 @@ "destination": "D5" } } - } + }, + "player": 0 }, { "action": { @@ -683,7 +686,8 @@ } ] } - } + }, + "player": 0 }, { "action": { @@ -694,7 +698,8 @@ } ] } - } + }, + "player": 0 } ] } diff --git a/server/tests/test_games/tactics_cards/martyr2.outcome1.json b/server/tests/test_games/tactics_cards/martyr2.outcome1.json index 3e9d283e..a6cfb213 100644 --- a/server/tests/test_games/tactics_cards/martyr2.outcome1.json +++ b/server/tests/test_games/tactics_cards/martyr2.outcome1.json @@ -517,7 +517,8 @@ } } } - } + }, + "player": 0 }, { "action": { @@ -531,7 +532,8 @@ "embark_carrier_id": 8 } } - } + }, + "player": 0 }, { "action": { @@ -544,7 +546,8 @@ "embark_carrier_id": 9 } } - } + }, + "player": 0 }, { "action": { @@ -557,12 +560,14 @@ "embark_carrier_id": 9 } } - } + }, + "player": 0 }, { "action": { "Movement": "Stop" - } + }, + "player": 0 }, { "action": { @@ -577,7 +582,8 @@ "destination": "D5" } } - } + }, + "player": 0 }, { "action": { @@ -588,7 +594,8 @@ } ] } - } + }, + "player": 0 }, { "action": { @@ -599,7 +606,8 @@ } ] } - } + }, + "player": 0 }, { "action": { @@ -609,24 +617,30 @@ ] } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Spock sacrifices an Alexander the Great", + "origin": { + "TacticsCard": 24 + } + }, { "player": 0, "Units": { "units": { "leader": "Alexander" }, - "balance": "Loss" + "balance": "Loss", + "position": "D4" }, "origin": { "Ability": "Combat" } } ], - "log": [ - "Spock: Martyr: Spock sacrifices an Alexander the Great", - "Spock: Combat: Lost Alexander the Great at D4" - ] + "active_events": 1 }, { "action": { @@ -636,6 +650,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -668,52 +683,142 @@ "city_mood": "Happy" }, "items": [ + { + "player": 1, + "Text": "AlphaZero sacrifices a Wu Zetian", + "origin": { + "TacticsCard": 24 + } + }, { "player": 1, "Units": { "units": { "leader": "Wu" }, - "balance": "Loss" + "balance": "Loss", + "position": "D5" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 2, + "unit_type": "Elephant", + "bonus": false + }, + { + "value": 5, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 5, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 16, + "hits": 3, + "combat_modifiers": [ + "Ruler of the World adds 2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 2, + "unit_type": "Elephant", + "bonus": false + } + ], + "combat_value": 18, + "hits": 3, + "combat_modifiers": [ + "Wu Zetian adds +2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 3 }, - "balance": "Loss" + "balance": "Loss", + "position": "D4" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Not enough resources, no payment made.", + "origin": { + "SpecialAdvance": "Fireworks" + } + }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 3 }, - "balance": "Loss" + "balance": "Loss", + "position": "D5" }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "AlphaZero: Martyr: AlphaZero sacrifices a Wu Zetian", - "AlphaZero: Combat: Lost Wu Zetian at D5, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value), 2 (elephant, no bonus) for combined combat value of 18 and gets 3 hits against attacking units, Combat modifiers: Wu Zetian adds +2 combat value, Lost 3 infantry at D5", - "Spock: Combat: Roll 2 (elephant, no bonus), 5 (infantry, +1 combat value), 5 (infantry, +1 combat value) for combined combat value of 16 and gets 3 hits against defending units, Combat modifiers: Ruler of the World adds 2 combat value, Lost 3 infantry at D4", - "Spock: Choose Casualties: Remove all attacking units", - "AlphaZero: Fireworks: Not enough resources, no payment made.", - "AlphaZero: Choose Casualties: Remove all defending units", - "Battle ends in a draw" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/peltasts.outcome.json b/server/tests/test_games/tactics_cards/peltasts.outcome.json index 90d9d7f3..78e04215 100644 --- a/server/tests/test_games/tactics_cards/peltasts.outcome.json +++ b/server/tests/test_games/tactics_cards/peltasts.outcome.json @@ -272,22 +272,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] } ] diff --git a/server/tests/test_games/tactics_cards/peltasts.outcome1.json b/server/tests/test_games/tactics_cards/peltasts.outcome1.json index 0ee28c98..e5757c7f 100644 --- a/server/tests/test_games/tactics_cards/peltasts.outcome1.json +++ b/server/tests/test_games/tactics_cards/peltasts.outcome1.json @@ -199,22 +199,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -227,6 +254,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -269,39 +297,104 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Peltasts", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1, + "combat_modifiers": [ + "Peltasts rolls a 6 and ignored a hit" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Peltasts", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Combat modifiers: Peltasts rolled a 6 and ignored a hit, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } @@ -337,4 +430,4 @@ "action_cards_discarded": [ 1 ] -} \ No newline at end of file +} diff --git a/server/tests/test_games/tactics_cards/scout.outcome2.json b/server/tests/test_games/tactics_cards/scout.outcome2.json index 9515a1ae..32d250e2 100644 --- a/server/tests/test_games/tactics_cards/scout.outcome2.json +++ b/server/tests/test_games/tactics_cards/scout.outcome2.json @@ -202,22 +202,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -230,6 +257,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -247,9 +275,7 @@ } } ], - "log": [ - "Player1: Tactics: Play an action card face down" - ] + "active_events": 1 }, { "action": { @@ -261,6 +287,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -303,6 +330,27 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Peltasts", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Reveal Tactics Card Scout", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 1, + "Text": "Ignore the enemy tactics", + "origin": { + "TacticsCard": 23 + } + }, { "player": 1, "HandCard": { @@ -318,41 +366,94 @@ "TacticsCard": 23 } }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Scout", - "Player1: Tactics: Reveal Tactics Card Peltasts", - "Player2: Scout: Ignore the enemy tactics, Gain Quick Advance/Peltasts from discard pile", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/siege.outcome1.json b/server/tests/test_games/tactics_cards/siege.outcome1.json index d362f785..122d0e1d 100644 --- a/server/tests/test_games/tactics_cards/siege.outcome1.json +++ b/server/tests/test_games/tactics_cards/siege.outcome1.json @@ -197,22 +197,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -225,6 +252,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -267,39 +295,107 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Siege", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 8, + "hits": 1, + "combat_modifiers": [ + "Siege added 1 to combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 12, + "hits": 1, + "combat_modifiers": [ + "Siege prevents opponent from using combat abilities" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Siege", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 8 and gets 1 hits against defending units, Combat modifiers: Siege added 1 to combat value, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, no bonus), 6 (infantry, no bonus) for combined combat value of 12 and gets 1 hits against attacking units, Combat modifiers: Siege prevents opponent from using combat abilities, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/surprise.outcome1.json b/server/tests/test_games/tactics_cards/surprise.outcome1.json index 0b581fc7..dbcdea63 100644 --- a/server/tests/test_games/tactics_cards/surprise.outcome1.json +++ b/server/tests/test_games/tactics_cards/surprise.outcome1.json @@ -202,22 +202,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -230,6 +257,7 @@ ] } }, + "player": 1, "combat_stats": { "round": 1, "battleground": "City", @@ -272,6 +300,62 @@ "Advance": "Tactics" } }, + { + "player": 1, + "Text": "Reveal Tactics Card Surprise", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 7, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 15, + "hits": 1, + "combat_modifiers": [ + "Surprise added 1 to combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Draw 1 action card for Surprise tactics", + "origin": { + "TacticsCard": 10 + } + }, { "player": 1, "HandCard": { @@ -287,40 +371,55 @@ "TacticsCard": 10 } }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player2: Tactics: Play an action card face down, Reveal Tactics Card Surprise", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 15 and gets 1 hits against attacking units, Combat modifiers: Surprise added 1 to combat value, Lost 1 infantry at C1", - "Player2: Surprise: Draw 1 action card for Surprise tactics, Draw an action card", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/tactics_cards/wedge_formation.outcome1.json b/server/tests/test_games/tactics_cards/wedge_formation.outcome1.json index b53063ab..a1587f9d 100644 --- a/server/tests/test_games/tactics_cards/wedge_formation.outcome1.json +++ b/server/tests/test_games/tactics_cards/wedge_formation.outcome1.json @@ -199,22 +199,49 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 1 infantry from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 1 infantry", - "Player2: Combat: Defending with 2 infantry" ] }, { @@ -227,6 +254,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -269,39 +297,104 @@ "Advance": "Tactics" } }, + { + "player": 0, + "Text": "Reveal Tactics Card Wedge Formation", + "origin": { + "Advance": "Tactics" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 9, + "hits": 1, + "combat_modifiers": [ + "Wedge Formation added 2 combat value" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove 1 of their defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } } ], - "log": [ - "Player1: Tactics: Play an action card face down, Reveal Tactics Card Wedge Formation", - "Player1: Combat: Roll 6 (infantry, +1 combat value) for combined combat value of 9 and gets 1 hits against defending units, Combat modifiers: Wedge Formation added 2 combat value, Lost 1 infantry at C2", - "Player2: Combat: Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units, Lost 1 infantry at C1", - "Player1: Choose Casualties: Remove all attacking units", - "Player2: Choose Casualties: Remove 1 of their defending units", - "Defender wins" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/wonders/colosseum.outcome6.json b/server/tests/test_games/wonders/colosseum.outcome6.json index 6df35566..a2329b78 100644 --- a/server/tests/test_games/wonders/colosseum.outcome6.json +++ b/server/tests/test_games/wonders/colosseum.outcome6.json @@ -208,19 +208,20 @@ "WonderCard": "Colosseum" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Colosseum, Decided to build Colosseum in city A1, Pay 1 action" ] }, { @@ -236,6 +237,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -246,7 +248,7 @@ "ore": 5, "culture_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "Colosseum" @@ -274,17 +276,15 @@ "Wonder": "Colosseum" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Build Wonder" } } ], - "log": [ - "Player1: Colosseum: Pay 3 food, 4 wood, 5 ore and 5 culture tokens", - "Player1: Build Wonder: Play Colosseum, Gain Colosseum at A1" - ] + "active_events": 1 }, { "action": { @@ -295,19 +295,20 @@ } } }, + "player": 0, + "origin": { + "Advance": "Sports" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Advance": "Sports" } } - ], - "log": [ - "Player1: Sports: Pay 1 action, Start action in city C2" ] }, { @@ -320,6 +321,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -327,7 +329,7 @@ "resources": { "mood_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Sports" @@ -344,9 +346,7 @@ } } ], - "log": [ - "Player1: Sports: Pay 1 mood token, City C2 became Happy" - ] + "active_events": 1 }, { "action": { @@ -362,22 +362,107 @@ } } }, + "player": 0, + "origin": { + "Ability": "Move" + }, "items": [ { "player": 0, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "start": "C2", + "destination": "C1" }, "origin": { "Ability": "Move" } + }, + { + "player": 0, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 0, + "CombatRound": { + "attackers": { + "infantry": 2, + "cavalry": 1, + "elephants": 1 + }, + "defending_player": 1, + "defenders": { + "infantry": 2 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 4, + "unit_type": "Elephant", + "bonus": true + }, + { + "value": 4, + "unit_type": "Elephant", + "bonus": false + }, + { + "value": 3, + "unit_type": "Elephant", + "bonus": false + }, + { + "value": 2, + "unit_type": "Elephant", + "bonus": false + } + ], + "combat_value": 9, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 1 + }, + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player1: Move: marched 2 infantry, 1 cavalry and 1 elephant from C2 to C1, Pay 1 action", - "Combat round 1", - "Player1: Combat: Attacking with 2 infantry, 1 cavalry and 1 elephant, Roll 4 (elephant, -1 hits, no combat value), 4 (elephant, no bonus), 3 (elephant, no bonus), 2 (elephant, no bonus) for combined combat value of 9 and gets 1 hits against defending units", - "Player2: Combat: Defending with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units" ] }, { @@ -390,6 +475,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -397,17 +483,28 @@ "resources": { "culture_tokens": 1 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "Colosseum" } + }, + { + "player": 0, + "Text": "Increase combat value by 1, scoring an extra hit", + "origin": { + "Wonder": "Colosseum" + } + }, + { + "player": 0, + "Text": "Remove 1 of their attacking units", + "origin": { + "Ability": "Choose Casualties" + } } ], - "log": [ - "Player1: Colosseum: Pay 1 culture token, Increase combat value by 1, scoring an extra hit", - "Player1: Choose Casualties: Remove 1 of their attacking units" - ] + "active_events": 1 }, { "action": { @@ -417,6 +514,7 @@ ] } }, + "player": 0, "combat_stats": { "round": 1, "battleground": "City", @@ -452,24 +550,40 @@ "units": { "infantry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "C2" }, "origin": { "Ability": "Combat" } }, + { + "player": 1, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "C1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "wins the battle", + "origin": { + "Ability": "Combat" + } + }, { "player": 0, "Resources": { @@ -487,7 +601,8 @@ "Structure": { "structure": "CityCenter", "balance": "Loss", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" @@ -498,20 +613,27 @@ "Structure": { "structure": "CityCenter", "balance": "Gain", - "position": "C1" + "position": "C1", + "port_position": null }, "origin": { "Ability": "Combat" } + }, + { + "player": 0, + "Resources": { + "resources": { + "gold": 1 + }, + "balance": "Loss" + }, + "origin": { + "Ability": "Waste" + } } ], - "log": [ - "Player1: Combat: Lost 1 infantry at C2, Gain 1 gold, Gain city C1", - "Player2: Choose Casualties: Remove all defending units", - "Player2: Combat: Lost 2 infantry at C1, Lose city C1", - "Attacker wins", - "Player1: Waste: Could not store 1 gold" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/wonders/great_gardens.outcome3.json b/server/tests/test_games/wonders/great_gardens.outcome3.json index 68bcb956..c3dd0b9f 100644 --- a/server/tests/test_games/wonders/great_gardens.outcome3.json +++ b/server/tests/test_games/wonders/great_gardens.outcome3.json @@ -212,19 +212,20 @@ "WonderCard": "GreatGardens" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Great Gardens, Decided to build Great Gardens in city A1, Pay 1 action" ] }, { @@ -240,6 +241,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -250,7 +252,7 @@ "ore": 2, "culture_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "GreatGardens" @@ -278,24 +280,34 @@ "Wonder": "GreatGardens" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Build Wonder" } } ], - "log": [ - "Player1: Great Gardens: Pay 5 food, 5 wood, 2 ore and 5 culture tokens", - "Player1: Build Wonder: Play Great Gardens, Gain Great Gardens at A1" - ] + "active_events": 1 }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player1: End Turn: 1 actions left" + "player": 0, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 0, + "Action": { + "balance": "Loss" + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -317,19 +329,33 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "items": [ + { + "player": 1, + "Move": { + "units": { + "infantry": 2 + }, + "start": "C1", + "destination": "B1" + }, + "origin": { + "Ability": "Move" + } + }, { "player": 1, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Move" } } - ], - "log": [ - "Player2: Move: marched 2 infantry from C1 to B1, Pay 1 action" ] } ] diff --git a/server/tests/test_games/wonders/great_mausoleum.outcome4.json b/server/tests/test_games/wonders/great_mausoleum.outcome4.json index d422ddc3..dc7ed457 100644 --- a/server/tests/test_games/wonders/great_mausoleum.outcome4.json +++ b/server/tests/test_games/wonders/great_mausoleum.outcome4.json @@ -5,6 +5,9 @@ "event_type": { "Incident": { "incident_id": 1, + "cause": { + "Advance": "Storage" + }, "active_player": 0 } }, @@ -243,11 +246,15 @@ "ActionCard": 123 } }, + "player": 0, + "origin": { + "CivilCard": 123 + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "CivilCard": 123 @@ -268,10 +275,6 @@ "Ability": "Action Card" } } - ], - "log": [ - "Player1: Elder Statesman: Pay 1 action", - "Player1: Action Card: Play Elder Statesman" ] }, { @@ -280,7 +283,15 @@ "Bool": true } }, + "player": 0, "items": [ + { + "player": 0, + "Text": "Draw Inspiration/Peltasts from the discard pile", + "origin": { + "Ability": "Great Mausoleum" + } + }, { "player": 0, "HandCard": { @@ -297,9 +308,7 @@ } } ], - "log": [ - "Player1: Great Mausoleum: Draw Inspiration/Peltasts from the discard pile, Gain Inspiration/Peltasts from discard pile" - ] + "active_events": 1 }, { "action": { @@ -307,6 +316,7 @@ "Bool": false } }, + "player": 0, "items": [ { "player": 0, @@ -324,9 +334,7 @@ } } ], - "log": [ - "Player1: Great Mausoleum: Draw an action card" - ] + "active_events": 1 }, { "action": { @@ -339,11 +347,15 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -355,7 +367,7 @@ "resources": { "ideas": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -377,17 +389,15 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 ideas, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token" ] }, { @@ -396,10 +406,24 @@ "Bool": true } }, - "log": [ - "Player1: Great Mausoleum: Drew Pestilence from the discard pile", - "A new game event has been triggered: Pestilence" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Drew Pestilence from the discard pile", + "origin": { + "Ability": "Great Mausoleum" + } + }, + { + "player": 0, + "Text": "triggers the event Pestilence", + "origin": { + "Advance": "Storage" + } + } + ], + "active_events": 1 } ] } diff --git a/server/tests/test_games/wonders/great_statue.outcome2.json b/server/tests/test_games/wonders/great_statue.outcome2.json index daaeaf01..0160e6a2 100644 --- a/server/tests/test_games/wonders/great_statue.outcome2.json +++ b/server/tests/test_games/wonders/great_statue.outcome2.json @@ -93,7 +93,9 @@ "incident_tokens": 2, "next_unit_id": 8, "played_once_per_turn_actions": [ - "GreatStatue" + { + "Custom": "GreatStatue" + } ] }, { @@ -211,19 +213,20 @@ "WonderCard": "GreatStatue" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Great Statue, Decided to build Great Statue in city A1, Pay 1 action" ] }, { @@ -239,6 +242,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -249,7 +253,7 @@ "ore": 5, "culture_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "GreatStatue" @@ -277,7 +281,8 @@ "Wonder": "GreatStatue" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Build Wonder" @@ -299,10 +304,7 @@ } } ], - "log": [ - "Player1: Great Statue: Pay 3 food, 4 wood, 5 ore and 5 culture tokens, Draw an objective card", - "Player1: Build Wonder: Play Great Statue, Gain Great Statue at A1" - ] + "active_events": 1 }, { "action": { @@ -312,6 +314,10 @@ } } }, + "player": 0, + "origin": { + "Wonder": "GreatStatue" + }, "items": [ { "player": 0, @@ -337,9 +343,6 @@ "Ability": "Great Statue" } } - ], - "log": [ - "Player1: Great Statue: Start action, Discard Large Civilization/Draft, Gain 1 action" ] } ] diff --git a/server/tests/test_games/wonders/great_wall.outcome3.json b/server/tests/test_games/wonders/great_wall.outcome3.json index 31e3b3a6..c8ff7b55 100644 --- a/server/tests/test_games/wonders/great_wall.outcome3.json +++ b/server/tests/test_games/wonders/great_wall.outcome3.json @@ -252,6 +252,10 @@ } } }, + "player": 1, + "origin": { + "Ability": "Move" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -283,25 +287,117 @@ "items": [ { "player": 1, - "Action": { - "balance": "Loss" + "Move": { + "units": { + "infantry": 2 + }, + "start": "B1", + "destination": "A1" }, "origin": { "Ability": "Move" } }, + { + "player": 1, + "Action": { + "balance": "Pay" + }, + "origin": { + "Ability": "Move" + } + }, + { + "player": 1, + "CombatRound": { + "attackers": { + "infantry": 2 + }, + "defending_player": 0, + "defenders": { + "infantry": 1, + "cavalry": 1 + }, + "round": 1 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + } + ], + "combat_value": 14, + "hits": 2 + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 0, + "CombatRoll": { + "rolls": [ + { + "value": 6, + "unit_type": "Infantry", + "bonus": true + }, + { + "value": 6, + "unit_type": "Infantry", + "bonus": false + } + ], + "combat_value": 11, + "hits": 2, + "combat_modifiers": [ + "Great Wall gives -2 combat value in the first round" + ] + }, + "origin": { + "Ability": "Combat" + } + }, + { + "player": 1, + "Text": "Remove all attacking units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 1, "Units": { "units": { "infantry": 2 }, - "balance": "Loss" + "balance": "Loss", + "position": "B1" }, "origin": { "Ability": "Combat" } }, + { + "player": 0, + "Text": "Remove all defending units", + "origin": { + "Ability": "Choose Casualties" + } + }, { "player": 0, "Units": { @@ -309,29 +405,40 @@ "infantry": 1, "cavalry": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "A1" }, "origin": { "Ability": "Combat" } + }, + { + "player": 1, + "Text": "ends the battle in a draw", + "origin": { + "Ability": "Combat" + } } - ], - "log": [ - "Player2: Move: marched 2 infantry from B1 to A1, Pay 1 action", - "Combat round 1", - "Player2: Combat: Attacking with 2 infantry, Roll 6 (infantry, +1 combat value), 6 (infantry, +1 combat value) for combined combat value of 14 and gets 2 hits against defending units, Lost 2 infantry at B1", - "Player1: Combat: Defending with 1 infantry and 1 cavalry, Roll 6 (infantry, +1 combat value), 6 (infantry, no bonus) for combined combat value of 11 and gets 2 hits against attacking units, Combat modifiers: Great Wall gives -2 combat value in the first round, Lost 1 infantry and 1 cavalry at A1", - "Player2: Choose Casualties: Remove all attacking units", - "Player1: Choose Casualties: Remove all defending units", - "Battle ends in a draw" ] }, { "action": { "Playing": "EndTurn" }, - "log": [ - "Player2: End Turn: 1 actions left" + "player": 1, + "origin": { + "Ability": "End Turn" + }, + "items": [ + { + "player": 1, + "Action": { + "balance": "Loss" + }, + "origin": { + "Ability": "End Turn" + } + } ] } ] @@ -357,6 +464,10 @@ } } }, + "player": 0, + "origin": { + "Ability": "Advance" + }, "combat_stats": { "round": 1, "battleground": "City", @@ -386,7 +497,7 @@ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -398,7 +509,7 @@ "resources": { "ideas": 2 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Advance" @@ -420,13 +531,43 @@ "player": 0, "Advance": { "advance": "Storage", - "take_incident_token": true, + "incident_token": { + "Take": 0 + }, "balance": "Gain" }, "origin": { "Ability": "Advance" } }, + { + "player": 0, + "Text": "triggers the event Envoy", + "origin": { + "Advance": "Storage" + } + }, + { + "player": 0, + "Text": "Base effect: Barbarians move", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Barbarians move from A2 to A1: 1 infantry and 1 elephant and", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "Automatic win against Barbarians", + "origin": { + "Wonder": "GreatWall" + } + }, { "player": 2, "Units": { @@ -434,7 +575,8 @@ "infantry": 1, "elephants": 1 }, - "balance": "Loss" + "balance": "Loss", + "position": "A2" }, "origin": { "Ability": "Combat" @@ -458,7 +600,8 @@ "units": { "infantry": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "B3" }, "origin": { "Incident": 40 @@ -477,6 +620,20 @@ "Incident": 40 } }, + { + "player": 0, + "Text": "No Wonders left to draw", + "origin": { + "Incident": 40 + } + }, + { + "player": 0, + "Text": "No wonders left to draw as public wonder card", + "origin": { + "Incident": 40 + } + }, { "player": 1, "Resources": { @@ -489,18 +646,6 @@ "Incident": 40 } } - ], - "log": [ - "Player1: Advance: Pay 1 action, Pay 2 ideas, Gain Storage and take an event token (triggering an incident)", - "Player1: Storage: Gain 1 mood token", - "A new game event has been triggered: Envoy", - "Player1: Envoy: Base effect: Barbarians move, Barbarians move from A2 to A1: 1 infantry and 1 elephant, Gain 1 idea and 1 culture token, No wonders left to draw as public wonder card", - "Player1: Great Wall: Automatic win against Barbarians", - "Barbarians: Combat: Lost 1 infantry and 1 elephant at A2", - "Player1: Barbarian battle: Gain 1 gold", - "Barbarians: Envoy: Gain 1 infantry at B3", - "No Wonders left to draw", - "Player2: Envoy: Gain 1 culture token" ] }, { @@ -509,6 +654,10 @@ "ActionCard": 5 } }, + "player": 0, + "origin": { + "CivilCard": 5 + }, "items": [ { "player": 0, @@ -535,10 +684,6 @@ "CivilCard": 5 } } - ], - "log": [ - "Player1: Action Card: Play Hero General/Wedge Formation", - "Player1: Hero General: City C2 became Neutral" ] } ] diff --git a/server/tests/test_games/wonders/library.outcome2.json b/server/tests/test_games/wonders/library.outcome2.json index c61841a0..891d8c6b 100644 --- a/server/tests/test_games/wonders/library.outcome2.json +++ b/server/tests/test_games/wonders/library.outcome2.json @@ -202,7 +202,9 @@ ], "next_unit_id": 8, "played_once_per_turn_actions": [ - "GreatLibrary" + { + "Custom": "GreatLibrary" + } ] }, { @@ -321,9 +323,10 @@ } } }, - "log": [ - "Player1: Great Library: Start action" - ] + "player": 0, + "origin": { + "Wonder": "GreatLibrary" + } }, { "action": { @@ -331,9 +334,17 @@ "SelectAdvance": "Engineering" } }, - "log": [ - "Player1: Great Library: Use Engineering for the turn" - ] + "player": 0, + "items": [ + { + "player": 0, + "Text": "Use Engineering for the turn", + "origin": { + "Ability": "Great Library" + } + } + ], + "active_events": 1 }, { "action": { @@ -341,19 +352,20 @@ "WonderCard": "Pyramids" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Pyramids, Decided to build Pyramids in city C2, Pay 1 action" ] } ] diff --git a/server/tests/test_games/wonders/lighthouse.outcome3.json b/server/tests/test_games/wonders/lighthouse.outcome3.json index 142b7587..9edcd4ae 100644 --- a/server/tests/test_games/wonders/lighthouse.outcome3.json +++ b/server/tests/test_games/wonders/lighthouse.outcome3.json @@ -219,19 +219,20 @@ "WonderCard": "GreatLighthouse" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Great Lighthouse, Decided to build Great Lighthouse in city A1, Pay 1 action" ] }, { @@ -247,6 +248,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -257,7 +259,7 @@ "ore": 4, "culture_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "GreatLighthouse" @@ -285,17 +287,15 @@ "Wonder": "GreatLighthouse" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Build Wonder" } } ], - "log": [ - "Player1: Great Lighthouse: Pay 3 food, 5 wood, 4 ore and 5 culture tokens", - "Player1: Build Wonder: Play Great Lighthouse, Gain Great Lighthouse at A1" - ] + "active_events": 1 }, { "action": { @@ -305,9 +305,10 @@ } } }, - "log": [ - "Player1: Great Lighthouse: Start action" - ] + "player": 0, + "origin": { + "Wonder": "GreatLighthouse" + } }, { "action": { @@ -317,6 +318,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -334,16 +336,15 @@ "units": { "ships": 1 }, - "balance": "Gain" + "balance": "Gain", + "position": "C3" }, "origin": { "Ability": "Great Lighthouse" } } ], - "log": [ - "Player1: Great Lighthouse: City A1 became Neutral, Gain 1 ship at C3" - ] + "active_events": 1 } ] } diff --git a/server/tests/test_games/wonders/pyramids.outcome2.json b/server/tests/test_games/wonders/pyramids.outcome2.json index 7753e6f6..5d0f0e36 100644 --- a/server/tests/test_games/wonders/pyramids.outcome2.json +++ b/server/tests/test_games/wonders/pyramids.outcome2.json @@ -212,19 +212,20 @@ "WonderCard": "Pyramids" } }, + "player": 0, + "origin": { + "Ability": "Build Wonder" + }, "items": [ { "player": 0, "Action": { - "balance": "Loss" + "balance": "Pay" }, "origin": { "Ability": "Build Wonder" } } - ], - "log": [ - "Player1: Build Wonder: Play the wonder card Pyramids, Decided to build Pyramids in city A1, Pay 1 action" ] }, { @@ -241,6 +242,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -252,7 +254,7 @@ "gold": 1, "culture_tokens": 5 }, - "balance": "Loss" + "balance": "Pay" }, "origin": { "Wonder": "Pyramids" @@ -280,17 +282,15 @@ "Wonder": "Pyramids" }, "balance": "Gain", - "position": "A1" + "position": "A1", + "port_position": null }, "origin": { "Ability": "Build Wonder" } } ], - "log": [ - "Player1: Pyramids: Pay 2 food, 3 wood, 6 ore, 1 gold and 5 culture tokens", - "Player1: Build Wonder: Play Pyramids, Gain Pyramids at A1" - ] + "active_events": 1 }, { "action": { @@ -302,6 +302,7 @@ ] } }, + "player": 0, "items": [ { "player": 0, @@ -321,9 +322,7 @@ } } ], - "log": [ - "Player1: Complete Objectives: Complete Magnificent Culture using Magnificent Culture/Outpost" - ] + "active_events": 1 } ] } diff --git a/server/tests/undo_tests.rs b/server/tests/undo_tests.rs index c1150903..e8b8e1b0 100644 --- a/server/tests/undo_tests.rs +++ b/server/tests/undo_tests.rs @@ -1,7 +1,7 @@ use common::{JsonTest, move_action, payment_response}; use server::action::{Action, execute_action}; use server::collect::{Collect, PositionCollection}; -use server::content::custom_actions::CustomActionType::FreeEconomyCollect; +use server::content::custom_actions::PlayingActionModifier::FreeEconomyCollect; use server::game::Game; use server::game_api; use server::log::{LogSliceOptions, current_turn_log_mut}; @@ -36,7 +36,7 @@ fn collect(action_type: PlayingActionType) -> Action { #[test] fn undone_collect_does_not_block_free_economy() { let start = JsonTest::new("advances").load_game("collect_free_economy"); - let free = PlayingActionType::Custom(FreeEconomyCollect); + let free = FreeEconomyCollect.playing_action_type(); assert!(free.is_available(&start, 0).is_ok()); let game = execute_action(start.clone(), collect(PlayingActionType::Collect), 0); assert!(free.is_available(&game, 0).is_err()); @@ -74,8 +74,8 @@ fn repeated_undo_redo_and_branching_keep_the_correct_action_log() { assert_eq!(game_api::log_length(&game), game_api::log_length(&start)); game = execute_action(game, Action::Redo, 0); let actions = ¤t_turn_log_mut(&mut game).actions; - assert!(!actions[0].log.is_empty()); - assert!(actions[1].log.is_empty()); + assert!(!actions[0].items.is_empty()); + assert!(actions[1].items.is_empty()); assert_eq!( game_api::log_length(&game), game_api::log_length(&start) + 1 diff --git a/web-client/src/babylonia.test.ts b/web-client/src/babylonia.test.ts index 923f9e0e..ba5a1e8a 100644 --- a/web-client/src/babylonia.test.ts +++ b/web-client/src/babylonia.test.ts @@ -1,3 +1,4 @@ +import { readableHistory } from './structured-log.ts'; import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createRequire } from 'node:module'; @@ -27,13 +28,7 @@ async function fixture(name: string) { } async function babylonia(leader?: string) { - let state = await engine.init( - 2, - [], - { civilization: 'ChooseCivilization' }, - 'babylonia-rules', - {}, - ); + let state = await engine.init(2, [], { civilization: 'ChooseCivilization' }, 'babylonia-rules', {}); state = engine.tryMove( state, JSON.stringify({ ChooseCivilization: 'Babylonia' }), @@ -98,7 +93,7 @@ test('Canals adds food only when the entire collection contains exactly one food assert.equal(none.total.food ?? 0, 0); const after = move(game, mixed.action); assert.equal(after.players[seat(game)].resources.food, 2); - assert.match(JSON.stringify(after.log), /Canals.*Added 1 food/); + assert.match(JSON.stringify(after.log), /Added 1 food.*Canals/); // Focused Collection permits two resources from one tile; that already meets 2 food. const raw = await fixture('civilizations/china/rice'); raw.players[0].civilization = 'Babylonia'; @@ -164,7 +159,10 @@ test('Star Catalogues asks for its reward before revealing or removing an event const after = move(pending, { Response: { ResourceReward: { ideas: 1 } } }); assert.equal(after.incidents_left.length, beforeDeck.length - 1); assert.ok((after.players[seat(game)].resources.ideas ?? 0) >= 1); - assert.equal(JSON.stringify(after.log).match(/Star Catalogues.*?Gain 1 idea/g)?.length, 1); + assert.equal( + JSON.stringify(readableHistory(after).log).match(/Star Catalogues.*?Gain 1 ideas?/g)?.length, + 1, + ); }); test('Hammurabi discounts only his Fortress and offers Lawgiver alongside normal happiness costs', async () => { diff --git a/web-client/src/civilization-draft.test.ts b/web-client/src/civilization-draft.test.ts index 78a15931..c2340519 100644 --- a/web-client/src/civilization-draft.test.ts +++ b/web-client/src/civilization-draft.test.ts @@ -95,7 +95,7 @@ test('private offers and locked choices never leak through player/spectator stat assert.deepEqual(g.civilization_draft.ready, [false, false, true]); assert.equal(view(s, seat).civilizationDraft.chosen, seat === 2 ? offers[2][0] : null); assert.ok(engine.factions(s).every((c: string) => c === 'Choose Civilization')); - assert.deepEqual(engine.logSlice(s, { start: 0, player: seat }), ['Setup']); + assert.deepEqual(engine.logSlice(s, { start: 0, player: seat }), []); } }); diff --git a/web-client/src/combat-journal.test.ts b/web-client/src/combat-journal.test.ts index 4cfe15fa..a530ecd8 100644 --- a/web-client/src/combat-journal.test.ts +++ b/web-client/src/combat-journal.test.ts @@ -84,7 +84,7 @@ test('rosters, tactics and rolls combine across payment prompts without treating assert.equal(combat.defender.tactics, 'Encircled'); assert.deepEqual(combat.attacker.modifiers, [ 'steel weapons added 1 combat value', - 'Peltasts rolled a 6 and ignored a hit', + 'Peltasts rolls a 6 and ignored a hit', ]); assert.equal(combat.attacker.value, 22); assert.equal(combat.result, 'Rome wins'); @@ -102,9 +102,9 @@ test('elephant blocks, leader rerolls and unknown loss text survive formatting', effect: '-1 hits, no combat value', }); assert.deepEqual(combat.defender.dice?.[0], { value: 1, symbol: 'Leader', effect: 're-roll' }); - assert.deepEqual(combat.defender.units?.[0].type, { Leader: 'Gaius Julius Caesar' }); + assert.deepEqual(combat.defender.units?.[0].type, { Leader: 'Caesar' }); assert.equal(combat.defender.hits, 0); - assert.ok(combat.outcomes.some((entry) => entry.notes.includes('Lost Gaius Julius Caesar at C1'))); + assert.ok(combat.outcomes.some((entry) => entry.notes.includes('Lose Caesar at C1'))); }); test('each round and each separate battle retains its own casualties and result', () => { diff --git a/web-client/src/combat-journal.ts b/web-client/src/combat-journal.ts index 383c1f1b..6ec521cf 100644 --- a/web-client/src/combat-journal.ts +++ b/web-client/src/combat-journal.ts @@ -125,7 +125,8 @@ export function combatJournal(entries: JournalEntry[]): JournalEntry[] { ? `${current.combat.defender.civilization ?? 'Defender'} wins` : 'Draw'; latest(); - current = undefined; + // Captures and casualty choices can follow the winner announcement. + // Keep this battle until the next round marker or turn. continue; } if (entry.title === 'Tactics' && current?.combat) { diff --git a/web-client/src/decision-controls.test.ts b/web-client/src/decision-controls.test.ts index 79b01b03..214bedcd 100644 --- a/web-client/src/decision-controls.test.ts +++ b/web-client/src/decision-controls.test.ts @@ -122,7 +122,10 @@ for (const seat of [0, 1]) { } test('free research exposes exactly the legal choices without paid actions or resource requirements', () => { - const raw = JSON.parse(fixture('status_phase/free_advance.outcome')); + const initial = fixture('status_phase/free_advance'); + const raw = JSON.parse( + engine.tryMove(initial, JSON.stringify({ Playing: 'EndTurn' }), engine.currentPlayer(initial)), + ); const seat = engine.currentPlayer(JSON.stringify(raw)); raw.players[seat].resources = {}; const state = JSON.stringify(raw); diff --git a/web-client/src/india.test.ts b/web-client/src/india.test.ts index 68cd004c..85313f17 100644 --- a/web-client/src/india.test.ts +++ b/web-client/src/india.test.ts @@ -1,3 +1,4 @@ +import { readableHistory } from './structured-log.ts'; import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createRequire } from 'node:module'; @@ -154,7 +155,7 @@ test('Proselytism exposes settler origins, adds range and rejects a forged origi assert.throws(() => move(g, attempt), /origin|range/); const after = move(g, settler.action); assert.equal(after.players[1].cities[0].city_pieces.temple, 0); - assert.match(JSON.stringify(after.log), /from B3/); + assert.match(JSON.stringify(readableHistory(after).log), /from B3/); g.players[0].advances = g.players[0].advances.filter((a: string) => a !== 'StateReligion'); assert.ok( !view(g) @@ -272,7 +273,12 @@ test('Bladed Tusks persists after Akbar dies and is optional before battle', asy after = move(after, { Response: { SelectUnits: [0] } }); assert.ok(!after.players[0].units.some((u: any) => u.unit_type?.Leader === 'Akbar')); after = move(after, { Response: { Bool: false } }); - const last = after.log.at(-1).rounds.at(-1).turns.at(-1).actions.at(-1).log.join(' '); + const last = readableHistory(after) + .log!.at(-1)! + .rounds.at(-1)! + .turns.at(-1)! + .actions!.at(-1)! + .log!.join(' '); assert.match(last, /Combat round 2/); assert.match(last, /Bladed Tusks adds \+2 combat value/); }); diff --git a/web-client/src/journal.ts b/web-client/src/journal.ts index cfb166a8..54cff623 100644 --- a/web-client/src/journal.ts +++ b/web-client/src/journal.ts @@ -1,3 +1,4 @@ +import { readableHistory } from './structured-log.ts'; import { activeHistory } from './active-history.ts'; import type { Game, JournalEntry, JournalToken, LoggedAction, Pile, Player, Resource } from './types.ts'; import type { View } from './types.ts'; @@ -119,7 +120,7 @@ function confirmPayments(action: LoggedAction, payments: PaymentLog[], entries: if (!deferred) return; const balances = new Map(); for (const item of action.items ?? []) { - if (item.Resources?.balance !== 'Loss') continue; + if (!item.Resources || !['Loss', 'Pay'].includes(item.Resources.balance)) continue; const balance = balances.get(item.player) ?? {}; for (const [resource, amount] of Object.entries(item.Resources.resources)) balance[resource as Resource] = (balance[resource as Resource] ?? 0) + amount; @@ -234,8 +235,9 @@ function addClause(entry: JournalEntry, clause: string, payments: PaymentLog[]): export function journal( game: Game, - view?: Pick, + view?: Pick, ): JournalEntry[] { + game = readableHistory(game, view); const historicalCities = collectionCities(game); const eventNames = [ ...new Set([ @@ -312,7 +314,11 @@ export function journal( text: '', tokens: [], notes: [], - event: { outcomes: [], explanations: [], triggeredBy: entries.at(-1)?.player }, + event: { + outcomes: [], + explanations: [], + triggeredBy: action.player ?? entries.at(-1)?.player, + }, }); continue; } diff --git a/web-client/src/movement-bonus.ts b/web-client/src/movement-bonus.ts index fdf26038..f463c417 100644 --- a/web-client/src/movement-bonus.ts +++ b/web-client/src/movement-bonus.ts @@ -1,3 +1,4 @@ +import { readableHistory } from './structured-log.ts'; import type { Game } from './types.ts'; export interface MovementBonus { @@ -10,7 +11,7 @@ export interface MovementBonus { // Undone actions remain in older saves, but their logs and items are cleared. export function movementBonus(game: Game | null): MovementBonus | null { if (!game?.state || typeof game.state !== 'object' || !('Movement' in game.state)) return null; - const age = game.log?.at(-1); + const age = readableHistory(game).log?.at(-1); const round = age?.rounds.at(-1); const turn = round?.turns.at(-1); const actions = turn?.actions ?? []; @@ -21,7 +22,10 @@ export function movementBonus(game: Game | null): MovementBonus | null { if (!action || typeof action !== 'object') continue; if ('Movement' in action) { // A paid move starts a fresh allowance, even after Expansion in the same turn. - if (action.Movement === 'Stop' || entry.items?.some((item) => item.Action?.balance === 'Loss')) + if ( + action.Movement === 'Stop' || + entry.items?.some((item) => ['Loss', 'Pay'].includes(item.Action?.balance ?? '')) + ) return null; continue; } diff --git a/web-client/src/playback.ts b/web-client/src/playback.ts index eca53e6c..466b5961 100644 --- a/web-client/src/playback.ts +++ b/web-client/src/playback.ts @@ -111,9 +111,22 @@ export function frameDetails( for (const action of actions) { const playing = typeof action.action === 'object' && action.action?.Playing; if (!playing || typeof playing !== 'object' || !('Custom' in playing)) continue; - const name = action.log - ?.map((line) => line.match(/: ([^:]+): (?:.*?, )?Start action(?: in city [A-Z]\d+)?(?:,|$)/)?.[1]) - .find(Boolean); + const special = (playing.Custom as { action?: string })?.action; + const structuredName = + special && + action.items?.find((item) => + Object.values(item.origin ?? {}).some( + (name) => typeof name === 'string' && name.replaceAll(' ', '') === special, + ), + )?.origin; + const name = + (structuredName && + Object.values(structuredName) + .find((name): name is string => typeof name === 'string') + ?.replace(/([a-z])([A-Z])/g, '$1 $2')) ?? + action.log + ?.map((line) => line.match(/: ([^:]+): (?:.*?, )?Start action(?: in city [A-Z]\d+)?(?:,|$)/)?.[1]) + .find(Boolean); if (name) { description = name; break; diff --git a/web-client/src/research-choices.test.ts b/web-client/src/research-choices.test.ts index fa454de0..3688d51f 100644 --- a/web-client/src/research-choices.test.ts +++ b/web-client/src/research-choices.test.ts @@ -85,7 +85,6 @@ test('Philosophy adds a sourced idea bonus to Science cards and it matches the a assert.equal(after.players[0].resources.culture_tokens, p.resources.culture_tokens + 1); p.advances = p.advances.filter((a: string) => a !== 'Philosophy'); assert.ok(view(g).advances.every((a) => !a.bonusEffects?.length)); - }); test('Great Library uses the shared tree without promising research bonuses or applying prerequisites', () => { @@ -107,9 +106,7 @@ test('Great Library uses the shared tree without promising research bonuses or a test('Free Economy exposes its mood cost before collect is submitted', () => { const v = view(fixture('advances/collect_free_economy')); - const economy = v.collectActions!.find( - (a) => typeof a.value === 'object' && a.value.Custom === 'FreeEconomyCollect', - )!; + const economy = v.collectActions!.find((a) => a.name === 'Free Economy')!; assert.equal(economy.free, true); assert.deepEqual(economy.payment, { mood_tokens: 1 }); assert.deepEqual(v.collectActions!.find((a) => a.value === 'Collect')!.payment, {}); diff --git a/web-client/src/structured-log.test.ts b/web-client/src/structured-log.test.ts new file mode 100644 index 00000000..03091198 --- /dev/null +++ b/web-client/src/structured-log.test.ts @@ -0,0 +1,42 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { journal } from './journal.ts'; +import { combatJournal } from './combat-journal.ts'; +import type { Game } from './types.ts'; +const fixture = (name: string): Game => + JSON.parse(readFileSync(new URL(`../../server/tests/test_games/${name}.json`, import.meta.url), 'utf8')); + +test('structured collection records keep gains, waste and included bonuses readable without modifying engine data', () => { + const game = fixture('base/collect.outcome'); + const before = JSON.stringify(game); + const entries = journal(game); + const collection = entries.find((entry) => entry.collection); + assert.ok(collection); + assert.equal(collection.player, 0); + assert.equal(collection.collection?.tiles.length, 2); + assert.ok(collection.tokens.some((token) => token.icon === 'ideas' && token.value === '+1')); + assert.ok( + !entries.some((entry) => entry.title === 'Public Education'), + 'Included bonus is not counted twice', + ); + assert.ok( + entries.some( + (entry) => + entry.title === 'Waste' && entry.tokens.some((token) => token.icon === 'ore' && token.value === '−1'), + ), + ); + assert.equal(JSON.stringify(game), before); +}); + +test('structured combat records retain participants, dice and rule modifiers', () => { + const game = fixture('combat/direct_capture_city_metallurgy.outcome'); + const combat = combatJournal(journal(game)).find((entry) => entry.combat)?.combat; + assert.ok(combat); + assert.equal(combat.attacker.player, 0); + assert.equal(combat.defender.player, 1); + assert.ok(combat.attacker.dice?.length); + assert.ok( + combat.attacker.modifiers.includes('steel weapons added 2 combat value (Metallurgy: no ore cost)'), + ); +}); diff --git a/web-client/src/structured-log.ts b/web-client/src/structured-log.ts new file mode 100644 index 00000000..1ca7a73e --- /dev/null +++ b/web-client/src/structured-log.ts @@ -0,0 +1,206 @@ +import type { Game, LoggedAction, Pile, View } from './types.ts'; + +type Units = Record; +type Item = NonNullable[number]; +type Context = Pick; +const words = (name: unknown): string => + typeof name === 'string' + ? name.replace(/([a-z])([A-Z])/g, '$1 $2').replaceAll('_', ' ') + : name && typeof name === 'object' + ? Object.values(name).map(words).join(' ') + : String(name ?? ''); +const unitList = (units: Units): string => + Object.entries(units) + .filter(([, count]) => !!count) + .map(([type, count]) => (typeof count === 'number' ? `${count} ${type}` : words(count))) + .join(' and ') || 'no units'; +const pileText = (pile: Pile): string => + Object.entries(pile) + .filter(([, amount]) => amount) + .map(([resource, amount]) => `${amount} ${words(resource)}`) + .join(' and '); +const actor = (game: Game, player: number): string => + game.players.find((p) => p.id === player)?.name ?? `Player ${player + 1}`; +function source(item: Item, context?: Context): string { + const origin = item.origin ?? {}; + const label = context?.logOriginNames?.[JSON.stringify(origin)]; + if (label) return label; + if (origin.Incident !== undefined) + return ( + context?.eventCatalog?.find((event) => event.id === origin.Incident)?.name ?? `Event ${origin.Incident}` + ); + if (origin.CivilCard !== undefined) return `Card ${origin.CivilCard}`; + if (origin.TacticsCard !== undefined) return 'Tactics'; + return words(Object.values(origin)[0]); +} + +// Keep the journal's presentation parsers at a single boundary. Engine records +// remain structured and immutable; legacy saved logs already contain prose. +function lines(game: Game, action: LoggedAction, context?: Context): string[] { + if (action.log) return action.log; + const result: string[] = []; + const stats = action.combat_stats as { attacker?: { player?: number } } | undefined; + let attacker = stats?.attacker?.player; + const playing = action.action && typeof action.action === 'object' ? action.action.Playing : undefined; + const collect = + playing && typeof playing === 'object' && 'Collect' in playing + ? (playing.Collect as { city_position: string }) + : undefined; + const add = (player: number, origin: string, text: string) => + result.push(`${actor(game, player)}: ${origin}: ${text}`); + if (collect && action.items?.length) + add(action.player ?? action.items[0].player, 'Collect', `Use city ${collect.city_position}`); + for (const item of action.items ?? []) { + const origin = source(item, context); + const write = (text: string) => add(item.player, origin, text); + if (item.Text !== undefined) { + const event = item.Text.match(/^triggers the event (.+)$/); + if (event) result.push(`A new game event has been triggered: ${event[1]}`); + else if (item.Text === 'wins the battle') + result.push(item.player === attacker ? 'Attacker wins' : 'Defender wins'); + else if (item.Text === 'ends the battle in a draw') result.push('Battle ends in a draw'); + else write(item.Text); + } + if (item.Resources) + write( + `${item.Resources.balance === 'Gain' ? 'Gain' : item.Resources.balance === 'Pay' ? 'Pay' : 'Lose'} ${pileText(item.Resources.resources)}`, + ); + if (item.Action) + write(`${item.Action.balance === 'Gain' ? 'Gain' : 'Pay'} ${item.Action.amount ?? 1} actions`); + if (item.Advance) { + const advance = item.Advance; + if (advance.balance === 'Gain') { + const token = advance.incident_token; + const taken = token && typeof token === 'object' ? token.Take : undefined; + write( + `Gain ${words(advance.advance)} ${taken === undefined ? 'without taking an event token' : `and take an event token (${taken === 0 ? 'triggering an incident' : taken})`}`, + ); + } else write(`Lose advance ${words(advance.advance)}`); + } + if (item.Structure) { + const structure = item.Structure; + write( + `${structure.balance === 'Gain' ? 'Gain' : 'Lose'} ${structure.structure === 'CityCenter' ? 'city' : words(structure.structure) + ' at'} ${structure.position}`, + ); + } + if (item.Units) { + const units = item.Units; + for (const [type, count] of Object.entries(units.units)) + if (count) + write( + `${units.balance === 'Gain' ? 'Gain' : 'Lose'} ${typeof count === 'number' ? `${count} ${count === 1 ? type.replace(/s$/, '') : type}` : words(count)}${units.position ? ` at ${units.position}` : ''}`, + ); + } + if (item.MoodChange) write(`City ${item.MoodChange.city} became ${item.MoodChange.mood}`); + if (item.Move) { + const move = item.Move; + write(`Move ${unitList(move.units)} from ${move.start} to ${move.destination}`); + } + if (item.Explore) + write( + `Explore ${item.Explore.tiles.map(([position, terrain]) => `${position}: ${words(terrain)}`).join('; ')}`, + ); + if (item.HandCard) { + const { card, from, to } = item.HandCard; + const type = + card && typeof card === 'object' && 'ObjectiveCard' in card + ? 'objective' + : card && typeof card === 'object' && 'Wonder' in card + ? 'wonder' + : 'action'; + const hand = (location: unknown) => + !!location && typeof location === 'object' && ('Hand' in location || 'RevealedHand' in location); + if (hand(to)) write(`Draw 1 ${type} card`); + else if (to && typeof to === 'object' && 'CompleteObjective' in to) + write(`Complete objective ${words(to.CompleteObjective)}`); + else if (hand(from)) write(`Discard 1 ${type} card`); + else write(`${words(to)} ${type} card`); + } + if (item.CombatRound) { + const round = item.CombatRound; + attacker = item.player; + result.push(`Combat round ${round.round}`); + add(item.player, 'Combat', `Attacking with ${unitList(round.attackers)}`); + add(round.defending_player, 'Combat', `Defending with ${unitList(round.defenders)}`); + } + if (item.CombatRoll) { + const roll = item.CombatRoll; + const dice = + roll.rolls + .map((die) => { + const unit = typeof die.unit_type === 'object' ? 'leader' : die.unit_type.toLowerCase(); + const effect = !die.bonus + ? 'no bonus' + : unit === 'elephant' + ? '-1 hits, no combat value' + : unit === 'leader' + ? 're-roll' + : `+${die.combat_bonus ?? (unit === 'infantry' ? 1 : 2)} combat value${die.combat_bonus === 3 ? ' (Horsemanship)' : ''}`; + return `${die.value} (${unit} face: ${effect})`; + }) + .join(', ') || 'no dice'; + add( + item.player, + 'Combat', + `Roll ${dice} → combat value ${roll.combat_value} → ${roll.hits} hits against ${item.player === attacker ? 'defending' : 'attacking'} units`, + ); + if (roll.combat_modifiers?.length) + add(item.player, 'Combat', `Combat modifiers: ${roll.combat_modifiers.join(', ')}`); + } + if (item.InfluenceCultureAttempt) { + const attempt = item.InfluenceCultureAttempt; + write( + `Influence ${words(attempt.structure)} at ${attempt.position} from ${attempt.starting_city_position}`, + ); + } + } + return result; +} + +export function readableHistory(game: Game, context?: Context): Game { + const inferred: Record = {}; + let eventName: string | undefined; + const playedCards = new Map(); + for (const age of game.log ?? []) + for (const round of age.rounds) + for (const turn of round.turns) + for (const action of turn.actions ?? []) + for (const item of action.items ?? []) { + const handCard = item.HandCard; + if ( + handCard?.to === 'PlayToDiscardFaceDown' && + handCard.card && + typeof handCard.card === 'object' && + 'ActionCard' in handCard.card && + typeof handCard.card.ActionCard === 'number' + ) + playedCards.set(item.player, handCard.card.ActionCard); + const tactics = item.Text?.match(/^Reveal Tactics Card (.+)$/); + const cardId = playedCards.get(item.player); + if (tactics && cardId) inferred[JSON.stringify({ TacticsCard: cardId })] = tactics[1]; + const trigger = item.Text?.match(/^triggers the event (.+)$/); + if (trigger) eventName = trigger[1]; + else if (eventName && item.origin?.Incident !== undefined) { + inferred[JSON.stringify(item.origin)] = eventName; + eventName = undefined; + } + } + context = { ...context, logOriginNames: { ...inferred, ...context?.logOriginNames } }; + return { + ...game, + log: game.log?.map((age) => ({ + ...age, + rounds: age.rounds.map((round) => ({ + ...round, + turns: round.turns.map((turn) => ({ + ...turn, + turn_type: + turn.turn_type && typeof turn.turn_type === 'object' && 'Setup' in turn.turn_type + ? 'Setup' + : turn.turn_type, + actions: turn.actions?.map((action) => ({ ...action, log: lines(game, action, context) })), + })), + })), + })), + }; +} diff --git a/web-client/src/types.ts b/web-client/src/types.ts index 96024238..36c087a2 100644 --- a/web-client/src/types.ts +++ b/web-client/src/types.ts @@ -85,16 +85,43 @@ export interface Game { log_index: number; } export interface LoggedAction { + player?: number; action?: Move; log?: string[]; items?: { player: number; origin?: Record; - Action?: { balance: string }; + Text?: string; + Move?: { units: Record; start: string; destination: string }; + Explore?: { tiles: [string, unknown][] }; + CombatRound?: { + round: number; + attackers: Record; + defenders: Record; + defending_player: number; + }; + CombatRoll?: { + rolls: { + value: number; + unit_type: string | { Leader: string }; + bonus: boolean; + combat_bonus?: number; + }[]; + combat_value: number; + hits: number; + combat_modifiers?: string[]; + }; + InfluenceCultureAttempt?: { position: string; starting_city_position: string; structure: unknown }; + Action?: { balance: string; amount?: number }; Structure?: { structure: unknown; balance: string; position: string }; - HandCard?: { to: unknown }; - Advance?: { advance: string; balance: string; take_incident_token?: boolean }; - Units?: { units: Record; balance: string }; + HandCard?: { card?: unknown; from?: unknown; to: unknown }; + Advance?: { + advance: string; + balance: string; + take_incident_token?: boolean; + incident_token?: 'NoChange' | { Take: number }; + }; + Units?: { units: Record; balance: string; position?: string }; Resources?: { resources: Pile; balance: string }; MoodChange?: { city: string; mood: string }; }[]; @@ -200,6 +227,7 @@ export interface WonderCard { export type CardDraw = { kind: 'wonder'; card: WonderCard } | { kind: 'objective'; card: View['objectiveCards'][number] }; export interface View { + logOriginNames?: Record; activePlayers?: number[]; civilizationDraft?: { ready: boolean[]; chosen: string | null; waiting: boolean } | null; builtWonders?: Pick[];