@almadar/std 16.108.0 → 16.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/behaviors/registry/ui/game/2d/organisms/ui-battle-board.orb +213 -125
  2. package/behaviors/registry/ui/game/2d/organisms/ui-fishing-board.orb +2302 -705
  3. package/behaviors/registry/ui/game/2d/organisms/ui-minigolf-board.orb +7872 -1934
  4. package/behaviors/registry/ui/game/2d/organisms/ui-pinball-board.orb +2739 -3050
  5. package/behaviors/registry/ui/game/2d/organisms/ui-roguelike-board.orb +5204 -2967
  6. package/behaviors/registry/ui/game/2d/organisms/ui-sokoban-board.orb +3330 -1619
  7. package/behaviors/registry/ui/game/2d/organisms/ui-space-shmup-board.orb +4637 -4059
  8. package/behaviors/registry/ui/game/2d/organisms/ui-tanks-board.orb +76 -103
  9. package/behaviors/registry/ui/game/2d/organisms/ui-topdown-dungeon-board.orb +4579 -4356
  10. package/behaviors/registry/ui/game/2d/organisms/ui-uncontrolled-battle-board.orb +1164 -2247
  11. package/behaviors/registry/ui/game/2d/organisms/ui-winter-ski-board.orb +4573 -4553
  12. package/behaviors/registry/ui/game/3d/organisms/ui-arcade-board-3d.orb +379 -2
  13. package/behaviors/registry/ui/game/3d/organisms/ui-brick-sandbox-board-3d.orb +168 -1
  14. package/behaviors/registry/ui/game/3d/organisms/ui-city-board-3d.orb +801 -169
  15. package/behaviors/registry/ui/game/3d/organisms/ui-fantasy-town-board-3d.orb +1666 -702
  16. package/behaviors/registry/ui/game/3d/organisms/ui-game-board-3d.orb +1323 -514
  17. package/behaviors/registry/ui/game/3d/organisms/ui-graveyard-board-3d.orb +1186 -384
  18. package/behaviors/registry/ui/game/3d/organisms/ui-hex-strategy-board-3d.orb +342 -170
  19. package/behaviors/registry/ui/game/3d/organisms/ui-holiday-board-3d.orb +509 -3
  20. package/behaviors/registry/ui/game/3d/organisms/ui-market-board-3d.orb +632 -419
  21. package/behaviors/registry/ui/game/3d/organisms/ui-minigolf-board-3d.orb +503 -145
  22. package/behaviors/registry/ui/game/3d/organisms/ui-nature-survival-board-3d.orb +1157 -134
  23. package/behaviors/registry/ui/game/3d/organisms/ui-pirate-board-3d.orb +1203 -383
  24. package/behaviors/registry/ui/game/3d/organisms/ui-platformer-board-3d.orb +1157 -205
  25. package/behaviors/registry/ui/game/3d/organisms/ui-racing-board-3d.orb +656 -565
  26. package/behaviors/registry/ui/game/3d/organisms/ui-skatepark-board-3d.orb +1205 -137
  27. package/behaviors/registry/ui/game/3d/organisms/ui-space-board-3d.orb +1333 -513
  28. package/behaviors/registry/ui/game/3d/organisms/ui-tower-defense-board-3d.orb +332 -7
  29. package/behaviors/registry/ui/game/3d/organisms/ui-toy-track-board-3d.orb +1202 -287
  30. package/dist/behaviors/behaviors-registry.json +282 -273
  31. package/dist/behaviors/registry/ui/game/2d/organisms/ui-battle-board.orb +213 -125
  32. package/dist/behaviors/registry/ui/game/2d/organisms/ui-fishing-board.orb +2302 -705
  33. package/dist/behaviors/registry/ui/game/2d/organisms/ui-minigolf-board.orb +7872 -1934
  34. package/dist/behaviors/registry/ui/game/2d/organisms/ui-pinball-board.orb +2739 -3050
  35. package/dist/behaviors/registry/ui/game/2d/organisms/ui-roguelike-board.orb +5204 -2967
  36. package/dist/behaviors/registry/ui/game/2d/organisms/ui-sokoban-board.orb +3330 -1619
  37. package/dist/behaviors/registry/ui/game/2d/organisms/ui-space-shmup-board.orb +4637 -4059
  38. package/dist/behaviors/registry/ui/game/2d/organisms/ui-tanks-board.orb +76 -103
  39. package/dist/behaviors/registry/ui/game/2d/organisms/ui-topdown-dungeon-board.orb +4579 -4356
  40. package/dist/behaviors/registry/ui/game/2d/organisms/ui-uncontrolled-battle-board.orb +1164 -2247
  41. package/dist/behaviors/registry/ui/game/2d/organisms/ui-winter-ski-board.orb +4573 -4553
  42. package/dist/behaviors/registry/ui/game/3d/organisms/ui-arcade-board-3d.orb +379 -2
  43. package/dist/behaviors/registry/ui/game/3d/organisms/ui-brick-sandbox-board-3d.orb +168 -1
  44. package/dist/behaviors/registry/ui/game/3d/organisms/ui-city-board-3d.orb +801 -169
  45. package/dist/behaviors/registry/ui/game/3d/organisms/ui-fantasy-town-board-3d.orb +1666 -702
  46. package/dist/behaviors/registry/ui/game/3d/organisms/ui-game-board-3d.orb +1323 -514
  47. package/dist/behaviors/registry/ui/game/3d/organisms/ui-graveyard-board-3d.orb +1186 -384
  48. package/dist/behaviors/registry/ui/game/3d/organisms/ui-hex-strategy-board-3d.orb +342 -170
  49. package/dist/behaviors/registry/ui/game/3d/organisms/ui-holiday-board-3d.orb +509 -3
  50. package/dist/behaviors/registry/ui/game/3d/organisms/ui-market-board-3d.orb +632 -419
  51. package/dist/behaviors/registry/ui/game/3d/organisms/ui-minigolf-board-3d.orb +503 -145
  52. package/dist/behaviors/registry/ui/game/3d/organisms/ui-nature-survival-board-3d.orb +1157 -134
  53. package/dist/behaviors/registry/ui/game/3d/organisms/ui-pirate-board-3d.orb +1203 -383
  54. package/dist/behaviors/registry/ui/game/3d/organisms/ui-platformer-board-3d.orb +1157 -205
  55. package/dist/behaviors/registry/ui/game/3d/organisms/ui-racing-board-3d.orb +656 -565
  56. package/dist/behaviors/registry/ui/game/3d/organisms/ui-skatepark-board-3d.orb +1205 -137
  57. package/dist/behaviors/registry/ui/game/3d/organisms/ui-space-board-3d.orb +1333 -513
  58. package/dist/behaviors/registry/ui/game/3d/organisms/ui-tower-defense-board-3d.orb +332 -7
  59. package/dist/behaviors/registry/ui/game/3d/organisms/ui-toy-track-board-3d.orb +1202 -287
  60. package/dist/behaviors-registry.json +282 -273
  61. package/dist/registry/ui/game/2d/organisms/ui-battle-board.orb +213 -125
  62. package/dist/registry/ui/game/2d/organisms/ui-fishing-board.orb +2302 -705
  63. package/dist/registry/ui/game/2d/organisms/ui-minigolf-board.orb +7872 -1934
  64. package/dist/registry/ui/game/2d/organisms/ui-pinball-board.orb +2739 -3050
  65. package/dist/registry/ui/game/2d/organisms/ui-roguelike-board.orb +5204 -2967
  66. package/dist/registry/ui/game/2d/organisms/ui-sokoban-board.orb +3330 -1619
  67. package/dist/registry/ui/game/2d/organisms/ui-space-shmup-board.orb +4637 -4059
  68. package/dist/registry/ui/game/2d/organisms/ui-tanks-board.orb +76 -103
  69. package/dist/registry/ui/game/2d/organisms/ui-topdown-dungeon-board.orb +4579 -4356
  70. package/dist/registry/ui/game/2d/organisms/ui-uncontrolled-battle-board.orb +1164 -2247
  71. package/dist/registry/ui/game/2d/organisms/ui-winter-ski-board.orb +4573 -4553
  72. package/dist/registry/ui/game/3d/organisms/ui-arcade-board-3d.orb +379 -2
  73. package/dist/registry/ui/game/3d/organisms/ui-brick-sandbox-board-3d.orb +168 -1
  74. package/dist/registry/ui/game/3d/organisms/ui-city-board-3d.orb +801 -169
  75. package/dist/registry/ui/game/3d/organisms/ui-fantasy-town-board-3d.orb +1666 -702
  76. package/dist/registry/ui/game/3d/organisms/ui-game-board-3d.orb +1323 -514
  77. package/dist/registry/ui/game/3d/organisms/ui-graveyard-board-3d.orb +1186 -384
  78. package/dist/registry/ui/game/3d/organisms/ui-hex-strategy-board-3d.orb +342 -170
  79. package/dist/registry/ui/game/3d/organisms/ui-holiday-board-3d.orb +509 -3
  80. package/dist/registry/ui/game/3d/organisms/ui-market-board-3d.orb +632 -419
  81. package/dist/registry/ui/game/3d/organisms/ui-minigolf-board-3d.orb +503 -145
  82. package/dist/registry/ui/game/3d/organisms/ui-nature-survival-board-3d.orb +1157 -134
  83. package/dist/registry/ui/game/3d/organisms/ui-pirate-board-3d.orb +1203 -383
  84. package/dist/registry/ui/game/3d/organisms/ui-platformer-board-3d.orb +1157 -205
  85. package/dist/registry/ui/game/3d/organisms/ui-racing-board-3d.orb +656 -565
  86. package/dist/registry/ui/game/3d/organisms/ui-skatepark-board-3d.orb +1205 -137
  87. package/dist/registry/ui/game/3d/organisms/ui-space-board-3d.orb +1333 -513
  88. package/dist/registry/ui/game/3d/organisms/ui-tower-defense-board-3d.orb +332 -7
  89. package/dist/registry/ui/game/3d/organisms/ui-toy-track-board-3d.orb +1202 -287
  90. package/package.json +1 -1
@@ -308,6 +308,51 @@
308
308
  "name": "attackTargets",
309
309
  "type": "array"
310
310
  },
311
+ {
312
+ "default": [],
313
+ "items": {
314
+ "properties": {
315
+ "id": {
316
+ "name": "id",
317
+ "required": true,
318
+ "type": "string"
319
+ },
320
+ "message": {
321
+ "name": "message",
322
+ "required": false,
323
+ "type": "string"
324
+ },
325
+ "ttl": {
326
+ "name": "ttl",
327
+ "required": true,
328
+ "type": "number"
329
+ },
330
+ "type": {
331
+ "name": "type",
332
+ "required": true,
333
+ "type": "string"
334
+ },
335
+ "x": {
336
+ "name": "x",
337
+ "required": true,
338
+ "type": "number"
339
+ },
340
+ "y": {
341
+ "name": "y",
342
+ "required": false,
343
+ "type": "number"
344
+ },
345
+ "z": {
346
+ "name": "z",
347
+ "required": false,
348
+ "type": "number"
349
+ }
350
+ },
351
+ "type": "object"
352
+ },
353
+ "name": "fx",
354
+ "type": "array"
355
+ },
311
356
  {
312
357
  "default": "observation",
313
358
  "name": "phase",
@@ -1786,36 +1831,6 @@
1786
1831
  }
1787
1832
  },
1788
1833
  "emits": [
1789
- {
1790
- "description": "-- Callbacks --",
1791
- "event": "ATTACK",
1792
- "payloadSchema": [
1793
- {
1794
- "name": "attacker",
1795
- "type": "object"
1796
- },
1797
- {
1798
- "name": "target",
1799
- "type": "object"
1800
- },
1801
- {
1802
- "name": "damage",
1803
- "type": "number"
1804
- },
1805
- {
1806
- "name": "attackerId",
1807
- "required": true,
1808
- "type": "string"
1809
- },
1810
- {
1811
- "name": "targetId",
1812
- "required": true,
1813
- "type": "string"
1814
- }
1815
- ],
1816
- "scope": "external",
1817
- "tier": "domain"
1818
- },
1819
1834
  {
1820
1835
  "description": "Called when the match ends",
1821
1836
  "event": "GAME_END",
@@ -1941,6 +1956,7 @@
1941
1956
  "attackTargets",
1942
1957
  "currentTeam",
1943
1958
  "enemyTurn",
1959
+ "fx",
1944
1960
  "gridHeight",
1945
1961
  "gridWidth",
1946
1962
  "movementRange",
@@ -1959,10 +1975,6 @@
1959
1975
  "scope": "instance",
1960
1976
  "stateMachine": {
1961
1977
  "events": [
1962
- {
1963
- "key": "START",
1964
- "name": "Start"
1965
- },
1966
1978
  {
1967
1979
  "key": "INIT",
1968
1980
  "name": "Initialize"
@@ -2010,36 +2022,6 @@
2010
2022
  ],
2011
2023
  "tier": "domain"
2012
2024
  },
2013
- {
2014
- "description": "-- Callbacks --",
2015
- "key": "ATTACK",
2016
- "name": "Attack",
2017
- "payloadSchema": [
2018
- {
2019
- "name": "attacker",
2020
- "type": "object"
2021
- },
2022
- {
2023
- "name": "target",
2024
- "type": "object"
2025
- },
2026
- {
2027
- "name": "damage",
2028
- "type": "number"
2029
- },
2030
- {
2031
- "name": "attackerId",
2032
- "required": true,
2033
- "type": "string"
2034
- },
2035
- {
2036
- "name": "targetId",
2037
- "required": true,
2038
- "type": "string"
2039
- }
2040
- ],
2041
- "tier": "domain"
2042
- },
2043
2025
  {
2044
2026
  "description": "Emits UI:{endTurnEvent} with {} on end turn",
2045
2027
  "key": "END_TURN",
@@ -2122,9 +2104,6 @@
2122
2104
  "isInitial": true,
2123
2105
  "name": "playing"
2124
2106
  },
2125
- {
2126
- "name": "menu"
2127
- },
2128
2107
  {
2129
2108
  "name": "gameover"
2130
2109
  }
@@ -2152,6 +2131,11 @@
2152
2131
  "@entity.attackTargets",
2153
2132
  []
2154
2133
  ],
2134
+ [
2135
+ "set",
2136
+ "@entity.fx",
2137
+ []
2138
+ ],
2155
2139
  [
2156
2140
  "set",
2157
2141
  "@entity.turn",
@@ -2177,14 +2161,55 @@
2177
2161
  "@entity.enemyTurn",
2178
2162
  false
2179
2163
  ],
2164
+ [
2165
+ "set",
2166
+ "@entity.gridWidth",
2167
+ 5.0
2168
+ ],
2169
+ [
2170
+ "set",
2171
+ "@entity.gridHeight",
2172
+ 5.0
2173
+ ],
2174
+ [
2175
+ "set",
2176
+ "@entity.movementRange",
2177
+ 2.0
2178
+ ],
2180
2179
  [
2181
2180
  "render-ui",
2182
2181
  "main",
2183
2182
  {
2183
+ "addons": {
2184
+ "children": [
2185
+ {
2186
+ "action": "END_TURN",
2187
+ "label": "End Turn",
2188
+ "type": "button",
2189
+ "variant": "primary"
2190
+ },
2191
+ {
2192
+ "action": "CANCEL",
2193
+ "label": "Cancel",
2194
+ "type": "button",
2195
+ "variant": "secondary"
2196
+ },
2197
+ {
2198
+ "action": "PLAY_AGAIN",
2199
+ "label": "Restart",
2200
+ "type": "button",
2201
+ "variant": "secondary"
2202
+ }
2203
+ ],
2204
+ "direction": "vertical",
2205
+ "gap": "sm",
2206
+ "type": "stack"
2207
+ },
2184
2208
  "children": [
2185
2209
  {
2186
2210
  "attackTargets": "@entity.attackTargets",
2187
2211
  "backgroundColor": "@config.bgColor",
2212
+ "events": "@entity.fx",
2188
2213
  "features": "@config.features",
2189
2214
  "interpolateUnits": true,
2190
2215
  "scale": "@config.scale",
@@ -2219,8 +2244,8 @@
2219
2244
  }
2220
2245
  ]
2221
2246
  ],
2222
- "event": "START",
2223
- "from": "menu",
2247
+ "event": "INIT",
2248
+ "from": "playing",
2224
2249
  "to": "playing"
2225
2250
  },
2226
2251
  {
@@ -2228,7 +2253,38 @@
2228
2253
  [
2229
2254
  "set",
2230
2255
  "@entity.units",
2231
- "@config.units"
2256
+ [
2257
+ "array/map",
2258
+ "@entity.units",
2259
+ [
2260
+ "fn",
2261
+ "u",
2262
+ [
2263
+ "if",
2264
+ [
2265
+ "==",
2266
+ "@u.id",
2267
+ "@payload.unitId"
2268
+ ],
2269
+ [
2270
+ "object/merge",
2271
+ "@u",
2272
+ {
2273
+ "health": [
2274
+ "math/max",
2275
+ 0.0,
2276
+ [
2277
+ "-",
2278
+ "@u.health",
2279
+ "@config.attackDamage"
2280
+ ]
2281
+ ]
2282
+ }
2283
+ ],
2284
+ "@u"
2285
+ ]
2286
+ ]
2287
+ ]
2232
2288
  ],
2233
2289
  [
2234
2290
  "set",
@@ -2245,16 +2301,6 @@
2245
2301
  "@entity.attackTargets",
2246
2302
  []
2247
2303
  ],
2248
- [
2249
- "set",
2250
- "@entity.turn",
2251
- 0.0
2252
- ],
2253
- [
2254
- "set",
2255
- "@entity.result",
2256
- "none"
2257
- ],
2258
2304
  [
2259
2305
  "set",
2260
2306
  "@entity.phase",
@@ -2262,37 +2308,155 @@
2262
2308
  ],
2263
2309
  [
2264
2310
  "set",
2265
- "@entity.currentTeam",
2266
- "player"
2311
+ "@entity.result",
2312
+ [
2313
+ "if",
2314
+ [
2315
+ "==",
2316
+ [
2317
+ "array/len",
2318
+ [
2319
+ "array/filter",
2320
+ "@entity.units",
2321
+ [
2322
+ "fn",
2323
+ "u",
2324
+ [
2325
+ "and",
2326
+ [
2327
+ "==",
2328
+ "@u.team",
2329
+ "enemy"
2330
+ ],
2331
+ [
2332
+ ">",
2333
+ "@u.health",
2334
+ 0.0
2335
+ ]
2336
+ ]
2337
+ ]
2338
+ ]
2339
+ ],
2340
+ 0.0
2341
+ ],
2342
+ "victory",
2343
+ "none"
2344
+ ]
2267
2345
  ],
2268
2346
  [
2269
- "set",
2270
- "@entity.enemyTurn",
2271
- false
2347
+ "if",
2348
+ [
2349
+ "!=",
2350
+ "@entity.result",
2351
+ "none"
2352
+ ],
2353
+ [
2354
+ "emit",
2355
+ "GAME_END",
2356
+ {
2357
+ "result": "@entity.result"
2358
+ }
2359
+ ],
2360
+ null
2272
2361
  ],
2273
2362
  [
2274
2363
  "set",
2275
- "@entity.gridWidth",
2276
- 5.0
2277
- ],
2278
- [
2279
- "set",
2280
- "@entity.gridHeight",
2281
- 5.0
2282
- ],
2283
- [
2284
- "set",
2285
- "@entity.movementRange",
2286
- 2.0
2364
+ "@entity.fx",
2365
+ [
2366
+ "array/append",
2367
+ "@entity.fx",
2368
+ {
2369
+ "id": [
2370
+ "str/concat",
2371
+ "fx-atk-",
2372
+ "@entity.turn"
2373
+ ],
2374
+ "message": [
2375
+ "str/concat",
2376
+ "-",
2377
+ "@config.attackDamage"
2378
+ ],
2379
+ "ttl": 3.0,
2380
+ "type": "hit",
2381
+ "x": [
2382
+ "object/get",
2383
+ [
2384
+ "object/get",
2385
+ [
2386
+ "array/find",
2387
+ "@entity.units",
2388
+ [
2389
+ "fn",
2390
+ "u",
2391
+ [
2392
+ "==",
2393
+ "@u.id",
2394
+ "@payload.unitId"
2395
+ ]
2396
+ ]
2397
+ ],
2398
+ "position"
2399
+ ],
2400
+ "x"
2401
+ ],
2402
+ "z": [
2403
+ "object/get",
2404
+ [
2405
+ "object/get",
2406
+ [
2407
+ "array/find",
2408
+ "@entity.units",
2409
+ [
2410
+ "fn",
2411
+ "u",
2412
+ [
2413
+ "==",
2414
+ "@u.id",
2415
+ "@payload.unitId"
2416
+ ]
2417
+ ]
2418
+ ],
2419
+ "position"
2420
+ ],
2421
+ "y"
2422
+ ]
2423
+ }
2424
+ ]
2287
2425
  ],
2288
2426
  [
2289
2427
  "render-ui",
2290
2428
  "main",
2291
2429
  {
2430
+ "addons": {
2431
+ "children": [
2432
+ {
2433
+ "action": "END_TURN",
2434
+ "label": "End Turn",
2435
+ "type": "button",
2436
+ "variant": "primary"
2437
+ },
2438
+ {
2439
+ "action": "CANCEL",
2440
+ "label": "Cancel",
2441
+ "type": "button",
2442
+ "variant": "secondary"
2443
+ },
2444
+ {
2445
+ "action": "PLAY_AGAIN",
2446
+ "label": "Restart",
2447
+ "type": "button",
2448
+ "variant": "secondary"
2449
+ }
2450
+ ],
2451
+ "direction": "vertical",
2452
+ "gap": "sm",
2453
+ "type": "stack"
2454
+ },
2292
2455
  "children": [
2293
2456
  {
2294
2457
  "attackTargets": "@entity.attackTargets",
2295
2458
  "backgroundColor": "@config.bgColor",
2459
+ "events": "@entity.fx",
2296
2460
  "features": "@config.features",
2297
2461
  "interpolateUnits": true,
2298
2462
  "scale": "@config.scale",
@@ -2327,8 +2491,105 @@
2327
2491
  }
2328
2492
  ]
2329
2493
  ],
2330
- "event": "INIT",
2494
+ "event": "UNIT_CLICK",
2331
2495
  "from": "playing",
2496
+ "guard": [
2497
+ "and",
2498
+ [
2499
+ "==",
2500
+ "@entity.phase",
2501
+ "action"
2502
+ ],
2503
+ [
2504
+ "and",
2505
+ [
2506
+ "==",
2507
+ [
2508
+ "object/get",
2509
+ [
2510
+ "array/find",
2511
+ "@entity.units",
2512
+ [
2513
+ "fn",
2514
+ "u",
2515
+ [
2516
+ "==",
2517
+ "@u.id",
2518
+ "@payload.unitId"
2519
+ ]
2520
+ ]
2521
+ ],
2522
+ "team"
2523
+ ],
2524
+ "enemy"
2525
+ ],
2526
+ [
2527
+ "and",
2528
+ [
2529
+ ">",
2530
+ [
2531
+ "object/get",
2532
+ [
2533
+ "array/find",
2534
+ "@entity.units",
2535
+ [
2536
+ "fn",
2537
+ "u",
2538
+ [
2539
+ "==",
2540
+ "@u.id",
2541
+ "@payload.unitId"
2542
+ ]
2543
+ ]
2544
+ ],
2545
+ "health"
2546
+ ],
2547
+ 0.0
2548
+ ],
2549
+ [
2550
+ "<=",
2551
+ [
2552
+ "grid/manhattan-distance",
2553
+ [
2554
+ "object/get",
2555
+ [
2556
+ "array/find",
2557
+ "@entity.units",
2558
+ [
2559
+ "fn",
2560
+ "u",
2561
+ [
2562
+ "==",
2563
+ "@u.id",
2564
+ "@entity.selectedUnitId"
2565
+ ]
2566
+ ]
2567
+ ],
2568
+ "position"
2569
+ ],
2570
+ [
2571
+ "object/get",
2572
+ [
2573
+ "array/find",
2574
+ "@entity.units",
2575
+ [
2576
+ "fn",
2577
+ "u",
2578
+ [
2579
+ "==",
2580
+ "@u.id",
2581
+ "@payload.unitId"
2582
+ ]
2583
+ ]
2584
+ ],
2585
+ "position"
2586
+ ]
2587
+ ],
2588
+ 1.0
2589
+ ]
2590
+ ]
2591
+ ]
2592
+ ],
2332
2593
  "to": "playing"
2333
2594
  },
2334
2595
  {
@@ -2423,10 +2684,36 @@
2423
2684
  "render-ui",
2424
2685
  "main",
2425
2686
  {
2687
+ "addons": {
2688
+ "children": [
2689
+ {
2690
+ "action": "END_TURN",
2691
+ "label": "End Turn",
2692
+ "type": "button",
2693
+ "variant": "primary"
2694
+ },
2695
+ {
2696
+ "action": "CANCEL",
2697
+ "label": "Cancel",
2698
+ "type": "button",
2699
+ "variant": "secondary"
2700
+ },
2701
+ {
2702
+ "action": "PLAY_AGAIN",
2703
+ "label": "Restart",
2704
+ "type": "button",
2705
+ "variant": "secondary"
2706
+ }
2707
+ ],
2708
+ "direction": "vertical",
2709
+ "gap": "sm",
2710
+ "type": "stack"
2711
+ },
2426
2712
  "children": [
2427
2713
  {
2428
2714
  "attackTargets": "@entity.attackTargets",
2429
2715
  "backgroundColor": "@config.bgColor",
2716
+ "events": "@entity.fx",
2430
2717
  "features": "@config.features",
2431
2718
  "interpolateUnits": true,
2432
2719
  "scale": "@config.scale",
@@ -2646,10 +2933,36 @@
2646
2933
  "render-ui",
2647
2934
  "main",
2648
2935
  {
2936
+ "addons": {
2937
+ "children": [
2938
+ {
2939
+ "action": "END_TURN",
2940
+ "label": "End Turn",
2941
+ "type": "button",
2942
+ "variant": "primary"
2943
+ },
2944
+ {
2945
+ "action": "CANCEL",
2946
+ "label": "Cancel",
2947
+ "type": "button",
2948
+ "variant": "secondary"
2949
+ },
2950
+ {
2951
+ "action": "PLAY_AGAIN",
2952
+ "label": "Restart",
2953
+ "type": "button",
2954
+ "variant": "secondary"
2955
+ }
2956
+ ],
2957
+ "direction": "vertical",
2958
+ "gap": "sm",
2959
+ "type": "stack"
2960
+ },
2649
2961
  "children": [
2650
2962
  {
2651
2963
  "attackTargets": "@entity.attackTargets",
2652
2964
  "backgroundColor": "@config.bgColor",
2965
+ "events": "@entity.fx",
2653
2966
  "features": "@config.features",
2654
2967
  "interpolateUnits": true,
2655
2968
  "scale": "@config.scale",
@@ -2766,10 +3079,36 @@
2766
3079
  "render-ui",
2767
3080
  "main",
2768
3081
  {
3082
+ "addons": {
3083
+ "children": [
3084
+ {
3085
+ "action": "END_TURN",
3086
+ "label": "End Turn",
3087
+ "type": "button",
3088
+ "variant": "primary"
3089
+ },
3090
+ {
3091
+ "action": "CANCEL",
3092
+ "label": "Cancel",
3093
+ "type": "button",
3094
+ "variant": "secondary"
3095
+ },
3096
+ {
3097
+ "action": "PLAY_AGAIN",
3098
+ "label": "Restart",
3099
+ "type": "button",
3100
+ "variant": "secondary"
3101
+ }
3102
+ ],
3103
+ "direction": "vertical",
3104
+ "gap": "sm",
3105
+ "type": "stack"
3106
+ },
2769
3107
  "children": [
2770
3108
  {
2771
3109
  "attackTargets": "@entity.attackTargets",
2772
3110
  "backgroundColor": "@config.bgColor",
3111
+ "events": "@entity.fx",
2773
3112
  "features": "@config.features",
2774
3113
  "interpolateUnits": true,
2775
3114
  "scale": "@config.scale",
@@ -2907,42 +3246,11 @@
2907
3246
  "effects": [
2908
3247
  [
2909
3248
  "set",
2910
- "@entity.units",
3249
+ "@entity.turn",
2911
3250
  [
2912
- "array/map",
2913
- "@entity.units",
2914
- [
2915
- "fn",
2916
- "u",
2917
- [
2918
- "if",
2919
- [
2920
- "==",
2921
- "@u.id",
2922
- "@payload.targetId"
2923
- ],
2924
- [
2925
- "object/merge",
2926
- "@u",
2927
- {
2928
- "health": [
2929
- "math/max",
2930
- 0.0,
2931
- [
2932
- "-",
2933
- [
2934
- "object/get",
2935
- "@u",
2936
- "health"
2937
- ],
2938
- "@payload.damage"
2939
- ]
2940
- ]
2941
- }
2942
- ],
2943
- "@u"
2944
- ]
2945
- ]
3251
+ "+",
3252
+ "@entity.turn",
3253
+ 1.0
2946
3254
  ]
2947
3255
  ],
2948
3256
  [
@@ -2960,19 +3268,55 @@
2960
3268
  "@entity.attackTargets",
2961
3269
  []
2962
3270
  ],
3271
+ [
3272
+ "set",
3273
+ "@entity.enemyTurn",
3274
+ true
3275
+ ],
3276
+ [
3277
+ "set",
3278
+ "@entity.currentTeam",
3279
+ "enemy"
3280
+ ],
2963
3281
  [
2964
3282
  "set",
2965
3283
  "@entity.phase",
2966
- "observation"
3284
+ "enemy_turn"
2967
3285
  ],
2968
3286
  [
2969
3287
  "render-ui",
2970
3288
  "main",
2971
3289
  {
3290
+ "addons": {
3291
+ "children": [
3292
+ {
3293
+ "action": "END_TURN",
3294
+ "label": "End Turn",
3295
+ "type": "button",
3296
+ "variant": "primary"
3297
+ },
3298
+ {
3299
+ "action": "CANCEL",
3300
+ "label": "Cancel",
3301
+ "type": "button",
3302
+ "variant": "secondary"
3303
+ },
3304
+ {
3305
+ "action": "PLAY_AGAIN",
3306
+ "label": "Restart",
3307
+ "type": "button",
3308
+ "variant": "secondary"
3309
+ }
3310
+ ],
3311
+ "direction": "vertical",
3312
+ "gap": "sm",
3313
+ "type": "stack"
3314
+ },
2972
3315
  "children": [
2973
3316
  {
2974
3317
  "attackTargets": "@entity.attackTargets",
2975
3318
  "backgroundColor": "@config.bgColor",
3319
+ "events": "@entity.fx",
2976
3320
  "features": "@config.features",
2977
3321
  "interpolateUnits": true,
2978
3322
  "scale": "@config.scale",
@@ -3007,121 +3351,21 @@
3007
3351
  }
3008
3352
  ]
3009
3353
  ],
3010
- "event": "ATTACK",
3354
+ "event": "END_TURN",
3011
3355
  "from": "playing",
3012
3356
  "guard": [
3013
- "let",
3357
+ "==",
3358
+ "@entity.result",
3359
+ "none"
3360
+ ],
3361
+ "to": "playing"
3362
+ },
3363
+ {
3364
+ "effects": [
3014
3365
  [
3015
- [
3016
- "ap",
3017
- [
3018
- "object/get",
3019
- [
3020
- "array/find",
3021
- "@entity.units",
3022
- [
3023
- "fn",
3024
- "u",
3025
- [
3026
- "==",
3027
- "@u.id",
3028
- "@payload.attackerId"
3029
- ]
3030
- ]
3031
- ],
3032
- "position"
3033
- ]
3034
- ],
3035
- [
3036
- "tp",
3037
- [
3038
- "object/get",
3039
- [
3040
- "array/find",
3041
- "@entity.units",
3042
- [
3043
- "fn",
3044
- "u",
3045
- [
3046
- "==",
3047
- "@u.id",
3048
- "@payload.targetId"
3049
- ]
3050
- ]
3051
- ],
3052
- "position"
3053
- ]
3054
- ]
3055
- ],
3056
- [
3057
- "and",
3058
- [
3059
- "<=",
3060
- [
3061
- "math/abs",
3062
- [
3063
- "-",
3064
- [
3065
- "object/get",
3066
- "@ap",
3067
- "x"
3068
- ],
3069
- [
3070
- "object/get",
3071
- "@tp",
3072
- "x"
3073
- ]
3074
- ]
3075
- ],
3076
- 1.0
3077
- ],
3078
- [
3079
- "and",
3080
- [
3081
- "<=",
3082
- [
3083
- "math/abs",
3084
- [
3085
- "-",
3086
- [
3087
- "object/get",
3088
- "@ap",
3089
- "y"
3090
- ],
3091
- [
3092
- "object/get",
3093
- "@tp",
3094
- "y"
3095
- ]
3096
- ]
3097
- ],
3098
- 1.0
3099
- ],
3100
- [
3101
- "!=",
3102
- "@ap",
3103
- "@tp"
3104
- ]
3105
- ]
3106
- ]
3107
- ],
3108
- "to": "playing"
3109
- },
3110
- {
3111
- "effects": [
3112
- [
3113
- "set",
3114
- "@entity.turn",
3115
- [
3116
- "+",
3117
- "@entity.turn",
3118
- 1.0
3119
- ]
3120
- ],
3121
- [
3122
- "set",
3123
- "@entity.selectedUnitId",
3124
- ""
3366
+ "set",
3367
+ "@entity.selectedUnitId",
3368
+ ""
3125
3369
  ],
3126
3370
  [
3127
3371
  "set",
@@ -3133,102 +3377,45 @@
3133
3377
  "@entity.attackTargets",
3134
3378
  []
3135
3379
  ],
3136
- [
3137
- "set",
3138
- "@entity.enemyTurn",
3139
- true
3140
- ],
3141
- [
3142
- "set",
3143
- "@entity.currentTeam",
3144
- "enemy"
3145
- ],
3146
3380
  [
3147
3381
  "set",
3148
3382
  "@entity.phase",
3149
- "enemy_turn"
3383
+ "observation"
3150
3384
  ],
3151
3385
  [
3152
3386
  "render-ui",
3153
3387
  "main",
3154
3388
  {
3155
- "children": [
3156
- {
3157
- "attackTargets": "@entity.attackTargets",
3158
- "backgroundColor": "@config.bgColor",
3159
- "features": "@config.features",
3160
- "interpolateUnits": true,
3161
- "scale": "@config.scale",
3162
- "selectedUnitId": "@entity.selectedUnitId",
3163
- "tileClickEvent": "TILE_CLICK",
3164
- "tiles": "@config.tiles",
3165
- "type": "game-canvas-3d",
3166
- "unitClickEvent": "UNIT_CLICK",
3167
- "unitScale": "@config.unitScale",
3168
- "units": "@entity.units",
3169
- "validMoves": "@entity.validMoves"
3170
- }
3171
- ],
3172
- "hud": {
3173
- "stats": [
3389
+ "addons": {
3390
+ "children": [
3174
3391
  {
3175
- "label": "Turn",
3176
- "value": "@entity.turn"
3392
+ "action": "END_TURN",
3393
+ "label": "End Turn",
3394
+ "type": "button",
3395
+ "variant": "primary"
3177
3396
  },
3178
3397
  {
3179
- "label": "Phase",
3180
- "value": "@entity.phase"
3398
+ "action": "CANCEL",
3399
+ "label": "Cancel",
3400
+ "type": "button",
3401
+ "variant": "secondary"
3181
3402
  },
3182
3403
  {
3183
- "label": "Result",
3184
- "value": "@entity.result"
3404
+ "action": "PLAY_AGAIN",
3405
+ "label": "Restart",
3406
+ "type": "button",
3407
+ "variant": "secondary"
3185
3408
  }
3186
3409
  ],
3187
- "type": "game-hud"
3410
+ "direction": "vertical",
3411
+ "gap": "sm",
3412
+ "type": "stack"
3188
3413
  },
3189
- "type": "game-shell"
3190
- }
3191
- ]
3192
- ],
3193
- "event": "END_TURN",
3194
- "from": "playing",
3195
- "guard": [
3196
- "==",
3197
- "@entity.result",
3198
- "none"
3199
- ],
3200
- "to": "playing"
3201
- },
3202
- {
3203
- "effects": [
3204
- [
3205
- "set",
3206
- "@entity.selectedUnitId",
3207
- ""
3208
- ],
3209
- [
3210
- "set",
3211
- "@entity.validMoves",
3212
- []
3213
- ],
3214
- [
3215
- "set",
3216
- "@entity.attackTargets",
3217
- []
3218
- ],
3219
- [
3220
- "set",
3221
- "@entity.phase",
3222
- "observation"
3223
- ],
3224
- [
3225
- "render-ui",
3226
- "main",
3227
- {
3228
3414
  "children": [
3229
3415
  {
3230
3416
  "attackTargets": "@entity.attackTargets",
3231
3417
  "backgroundColor": "@config.bgColor",
3418
+ "events": "@entity.fx",
3232
3419
  "features": "@config.features",
3233
3420
  "interpolateUnits": true,
3234
3421
  "scale": "@config.scale",
@@ -3355,10 +3542,36 @@
3355
3542
  "render-ui",
3356
3543
  "main",
3357
3544
  {
3545
+ "addons": {
3546
+ "children": [
3547
+ {
3548
+ "action": "END_TURN",
3549
+ "label": "End Turn",
3550
+ "type": "button",
3551
+ "variant": "primary"
3552
+ },
3553
+ {
3554
+ "action": "CANCEL",
3555
+ "label": "Cancel",
3556
+ "type": "button",
3557
+ "variant": "secondary"
3558
+ },
3559
+ {
3560
+ "action": "PLAY_AGAIN",
3561
+ "label": "Restart",
3562
+ "type": "button",
3563
+ "variant": "secondary"
3564
+ }
3565
+ ],
3566
+ "direction": "vertical",
3567
+ "gap": "sm",
3568
+ "type": "stack"
3569
+ },
3358
3570
  "children": [
3359
3571
  {
3360
3572
  "attackTargets": "@entity.attackTargets",
3361
3573
  "backgroundColor": "@config.bgColor",
3574
+ "events": "@entity.fx",
3362
3575
  "features": "@config.features",
3363
3576
  "interpolateUnits": true,
3364
3577
  "scale": "@config.scale",
@@ -3389,6 +3602,41 @@
3389
3602
  ],
3390
3603
  "type": "game-hud"
3391
3604
  },
3605
+ "overlay": [
3606
+ "if",
3607
+ [
3608
+ "!=",
3609
+ "@entity.result",
3610
+ "none"
3611
+ ],
3612
+ {
3613
+ "options": [
3614
+ {
3615
+ "event": "PLAY_AGAIN",
3616
+ "id": "again",
3617
+ "label": "Play Again",
3618
+ "variant": "primary"
3619
+ }
3620
+ ],
3621
+ "subtitle": [
3622
+ "str/concat",
3623
+ "Turn ",
3624
+ "@entity.turn"
3625
+ ],
3626
+ "title": [
3627
+ "if",
3628
+ [
3629
+ "==",
3630
+ "@entity.result",
3631
+ "victory"
3632
+ ],
3633
+ "VICTORY",
3634
+ "DEFEAT"
3635
+ ],
3636
+ "type": "game-menu"
3637
+ },
3638
+ null
3639
+ ],
3392
3640
  "type": "game-shell"
3393
3641
  }
3394
3642
  ]
@@ -3486,6 +3734,11 @@
3486
3734
  "@entity.attackTargets",
3487
3735
  []
3488
3736
  ],
3737
+ [
3738
+ "set",
3739
+ "@entity.fx",
3740
+ []
3741
+ ],
3489
3742
  [
3490
3743
  "set",
3491
3744
  "@entity.turn",
@@ -3515,10 +3768,36 @@
3515
3768
  "render-ui",
3516
3769
  "main",
3517
3770
  {
3771
+ "addons": {
3772
+ "children": [
3773
+ {
3774
+ "action": "END_TURN",
3775
+ "label": "End Turn",
3776
+ "type": "button",
3777
+ "variant": "primary"
3778
+ },
3779
+ {
3780
+ "action": "CANCEL",
3781
+ "label": "Cancel",
3782
+ "type": "button",
3783
+ "variant": "secondary"
3784
+ },
3785
+ {
3786
+ "action": "PLAY_AGAIN",
3787
+ "label": "Restart",
3788
+ "type": "button",
3789
+ "variant": "secondary"
3790
+ }
3791
+ ],
3792
+ "direction": "vertical",
3793
+ "gap": "sm",
3794
+ "type": "stack"
3795
+ },
3518
3796
  "children": [
3519
3797
  {
3520
3798
  "attackTargets": "@entity.attackTargets",
3521
3799
  "backgroundColor": "@config.bgColor",
3800
+ "events": "@entity.fx",
3522
3801
  "features": "@config.features",
3523
3802
  "interpolateUnits": true,
3524
3803
  "scale": "@config.scale",
@@ -3549,19 +3828,169 @@
3549
3828
  ],
3550
3829
  "type": "game-hud"
3551
3830
  },
3831
+ "overlay": [
3832
+ "if",
3833
+ [
3834
+ "!=",
3835
+ "@entity.result",
3836
+ "none"
3837
+ ],
3838
+ {
3839
+ "options": [
3840
+ {
3841
+ "event": "PLAY_AGAIN",
3842
+ "id": "again",
3843
+ "label": "Play Again",
3844
+ "variant": "primary"
3845
+ }
3846
+ ],
3847
+ "subtitle": [
3848
+ "str/concat",
3849
+ "Turn ",
3850
+ "@entity.turn"
3851
+ ],
3852
+ "title": [
3853
+ "if",
3854
+ [
3855
+ "==",
3856
+ "@entity.result",
3857
+ "victory"
3858
+ ],
3859
+ "VICTORY",
3860
+ "DEFEAT"
3861
+ ],
3862
+ "type": "game-menu"
3863
+ },
3864
+ null
3865
+ ],
3552
3866
  "type": "game-shell"
3553
3867
  }
3554
3868
  ]
3555
3869
  ],
3556
3870
  "event": "PLAY_AGAIN",
3557
3871
  "from": "gameover",
3558
- "to": "menu"
3872
+ "to": "playing"
3559
3873
  }
3560
3874
  ]
3561
3875
  },
3562
3876
  "ticks": [
3563
3877
  {
3564
3878
  "effects": [
3879
+ [
3880
+ "set",
3881
+ "@entity.fx",
3882
+ [
3883
+ "array/concat",
3884
+ "@entity.fx",
3885
+ [
3886
+ "array/map",
3887
+ [
3888
+ "array/filter",
3889
+ "@entity.units",
3890
+ [
3891
+ "fn",
3892
+ "u",
3893
+ [
3894
+ "and",
3895
+ [
3896
+ "and",
3897
+ [
3898
+ "==",
3899
+ "@u.team",
3900
+ "player"
3901
+ ],
3902
+ [
3903
+ ">",
3904
+ "@u.health",
3905
+ 0.0
3906
+ ]
3907
+ ],
3908
+ [
3909
+ ">",
3910
+ [
3911
+ "array/len",
3912
+ [
3913
+ "array/filter",
3914
+ "@entity.units",
3915
+ [
3916
+ "fn",
3917
+ "e",
3918
+ [
3919
+ "and",
3920
+ [
3921
+ "and",
3922
+ [
3923
+ "==",
3924
+ "@e.team",
3925
+ "enemy"
3926
+ ],
3927
+ [
3928
+ ">",
3929
+ "@e.health",
3930
+ 0.0
3931
+ ]
3932
+ ],
3933
+ [
3934
+ "==",
3935
+ [
3936
+ "grid/manhattan-distance",
3937
+ [
3938
+ "object/get",
3939
+ "@e",
3940
+ "position"
3941
+ ],
3942
+ [
3943
+ "object/get",
3944
+ "@u",
3945
+ "position"
3946
+ ]
3947
+ ],
3948
+ 1.0
3949
+ ]
3950
+ ]
3951
+ ]
3952
+ ]
3953
+ ],
3954
+ 0.0
3955
+ ]
3956
+ ]
3957
+ ]
3958
+ ],
3959
+ [
3960
+ "fn",
3961
+ "u",
3962
+ {
3963
+ "id": [
3964
+ "str/concat",
3965
+ "fx-ai-",
3966
+ "@u.id"
3967
+ ],
3968
+ "message": "-1",
3969
+ "ttl": 3.0,
3970
+ "type": "hit",
3971
+ "x": [
3972
+ "object/get",
3973
+ [
3974
+ "object/get",
3975
+ "@u",
3976
+ "position"
3977
+ ],
3978
+ "x"
3979
+ ],
3980
+ "z": [
3981
+ "object/get",
3982
+ [
3983
+ "object/get",
3984
+ "@u",
3985
+ "position"
3986
+ ],
3987
+ "y"
3988
+ ]
3989
+ }
3990
+ ]
3991
+ ]
3992
+ ]
3993
+ ],
3565
3994
  [
3566
3995
  "set",
3567
3996
  "@entity.units",
@@ -3738,7 +4167,7 @@
3738
4167
  [
3739
4168
  "target",
3740
4169
  [
3741
- "array/first",
4170
+ "array/reduce",
3742
4171
  [
3743
4172
  "array/filter",
3744
4173
  "@entity.units",
@@ -3759,107 +4188,295 @@
3759
4188
  ]
3760
4189
  ]
3761
4190
  ]
3762
- ]
3763
- ]
3764
- ]
3765
- ],
3766
- [
3767
- "object/merge",
3768
- "@u",
3769
- {
3770
- "position": {
3771
- "x": [
3772
- "math/clamp",
4191
+ ],
4192
+ [
4193
+ "fn",
4194
+ [
4195
+ "nearest",
4196
+ "p"
4197
+ ],
3773
4198
  [
3774
- "+",
4199
+ "if",
3775
4200
  [
3776
- "object/get",
4201
+ "or",
3777
4202
  [
3778
- "object/get",
3779
- "@u",
3780
- "position"
4203
+ "==",
4204
+ "@nearest",
4205
+ null
3781
4206
  ],
3782
- "x"
3783
- ],
3784
- [
3785
- "math/sign",
3786
4207
  [
3787
- "-",
4208
+ "<",
3788
4209
  [
3789
- "object/get",
4210
+ "grid/manhattan-distance",
3790
4211
  [
3791
4212
  "object/get",
3792
- "@target",
4213
+ "@p",
3793
4214
  "position"
3794
4215
  ],
3795
- "x"
4216
+ [
4217
+ "object/get",
4218
+ "@u",
4219
+ "position"
4220
+ ]
3796
4221
  ],
3797
4222
  [
3798
- "object/get",
4223
+ "grid/manhattan-distance",
3799
4224
  [
3800
4225
  "object/get",
3801
- "@u",
4226
+ "@nearest",
3802
4227
  "position"
3803
4228
  ],
3804
- "x"
4229
+ [
4230
+ "object/get",
4231
+ "@u",
4232
+ "position"
4233
+ ]
3805
4234
  ]
3806
4235
  ]
3807
- ]
3808
- ],
3809
- 0.0,
3810
- [
3811
- "-",
3812
- "@entity.gridWidth",
3813
- 1.0
4236
+ ],
4237
+ "@p",
4238
+ "@nearest"
3814
4239
  ]
3815
4240
  ],
3816
- "y": [
3817
- "math/clamp",
4241
+ null
4242
+ ]
4243
+ ]
4244
+ ],
4245
+ [
4246
+ "if",
4247
+ [
4248
+ "==",
4249
+ "@target",
4250
+ null
4251
+ ],
4252
+ "@u",
4253
+ [
4254
+ "let",
4255
+ [
4256
+ [
4257
+ "nextX",
3818
4258
  [
3819
- "+",
4259
+ "math/clamp",
3820
4260
  [
3821
- "object/get",
4261
+ "+",
3822
4262
  [
3823
4263
  "object/get",
3824
- "@u",
3825
- "position"
4264
+ [
4265
+ "object/get",
4266
+ "@u",
4267
+ "position"
4268
+ ],
4269
+ "x"
3826
4270
  ],
3827
- "y"
3828
- ],
3829
- [
3830
- "math/sign",
3831
4271
  [
3832
- "-",
4272
+ "math/sign",
3833
4273
  [
3834
- "object/get",
4274
+ "-",
3835
4275
  [
3836
4276
  "object/get",
3837
- "@target",
3838
- "position"
4277
+ [
4278
+ "object/get",
4279
+ "@target",
4280
+ "position"
4281
+ ],
4282
+ "x"
3839
4283
  ],
3840
- "y"
3841
- ],
4284
+ [
4285
+ "object/get",
4286
+ [
4287
+ "object/get",
4288
+ "@u",
4289
+ "position"
4290
+ ],
4291
+ "x"
4292
+ ]
4293
+ ]
4294
+ ]
4295
+ ],
4296
+ 0.0,
4297
+ [
4298
+ "-",
4299
+ "@entity.gridWidth",
4300
+ 1.0
4301
+ ]
4302
+ ]
4303
+ ],
4304
+ [
4305
+ "nextY",
4306
+ [
4307
+ "math/clamp",
4308
+ [
4309
+ "+",
4310
+ [
4311
+ "object/get",
3842
4312
  [
3843
4313
  "object/get",
4314
+ "@u",
4315
+ "position"
4316
+ ],
4317
+ "y"
4318
+ ],
4319
+ [
4320
+ "math/sign",
4321
+ [
4322
+ "-",
3844
4323
  [
3845
4324
  "object/get",
3846
- "@u",
3847
- "position"
4325
+ [
4326
+ "object/get",
4327
+ "@target",
4328
+ "position"
4329
+ ],
4330
+ "y"
3848
4331
  ],
3849
- "y"
4332
+ [
4333
+ "object/get",
4334
+ [
4335
+ "object/get",
4336
+ "@u",
4337
+ "position"
4338
+ ],
4339
+ "y"
4340
+ ]
3850
4341
  ]
3851
4342
  ]
4343
+ ],
4344
+ 0.0,
4345
+ [
4346
+ "-",
4347
+ "@entity.gridHeight",
4348
+ 1.0
3852
4349
  ]
4350
+ ]
4351
+ ]
4352
+ ],
4353
+ [
4354
+ "if",
4355
+ [
4356
+ "and",
4357
+ [
4358
+ "grid/in-bounds",
4359
+ {
4360
+ "x": "@nextX",
4361
+ "y": "@nextY"
4362
+ },
4363
+ "@entity.gridWidth",
4364
+ "@entity.gridHeight"
3853
4365
  ],
3854
- 0.0,
3855
4366
  [
3856
- "-",
3857
- "@entity.gridHeight",
3858
- 1.0
4367
+ "and",
4368
+ [
4369
+ "==",
4370
+ [
4371
+ "object/get",
4372
+ [
4373
+ "array/find",
4374
+ "@config.tiles",
4375
+ [
4376
+ "fn",
4377
+ "t",
4378
+ [
4379
+ "and",
4380
+ [
4381
+ "==",
4382
+ [
4383
+ "object/get",
4384
+ "@t",
4385
+ "x"
4386
+ ],
4387
+ "@nextX"
4388
+ ],
4389
+ [
4390
+ "==",
4391
+ [
4392
+ "object/get",
4393
+ "@t",
4394
+ "y"
4395
+ ],
4396
+ "@nextY"
4397
+ ]
4398
+ ]
4399
+ ]
4400
+ ],
4401
+ "passable"
4402
+ ],
4403
+ true
4404
+ ],
4405
+ [
4406
+ "==",
4407
+ [
4408
+ "array/len",
4409
+ [
4410
+ "array/filter",
4411
+ "@entity.units",
4412
+ [
4413
+ "fn",
4414
+ "o",
4415
+ [
4416
+ "and",
4417
+ [
4418
+ "!=",
4419
+ "@o.id",
4420
+ "@u.id"
4421
+ ],
4422
+ [
4423
+ "and",
4424
+ [
4425
+ ">",
4426
+ "@o.health",
4427
+ 0.0
4428
+ ],
4429
+ [
4430
+ "and",
4431
+ [
4432
+ "==",
4433
+ [
4434
+ "object/get",
4435
+ [
4436
+ "object/get",
4437
+ "@o",
4438
+ "position"
4439
+ ],
4440
+ "x"
4441
+ ],
4442
+ "@nextX"
4443
+ ],
4444
+ [
4445
+ "==",
4446
+ [
4447
+ "object/get",
4448
+ [
4449
+ "object/get",
4450
+ "@o",
4451
+ "position"
4452
+ ],
4453
+ "y"
4454
+ ],
4455
+ "@nextY"
4456
+ ]
4457
+ ]
4458
+ ]
4459
+ ]
4460
+ ]
4461
+ ]
4462
+ ],
4463
+ 0.0
4464
+ ]
3859
4465
  ]
3860
- ]
3861
- }
3862
- }
4466
+ ],
4467
+ [
4468
+ "object/merge",
4469
+ "@u",
4470
+ {
4471
+ "position": {
4472
+ "x": "@nextX",
4473
+ "y": "@nextY"
4474
+ }
4475
+ }
4476
+ ],
4477
+ "@u"
4478
+ ]
4479
+ ]
3863
4480
  ]
3864
4481
  ],
3865
4482
  "@u"
@@ -3982,10 +4599,36 @@
3982
4599
  "render-ui",
3983
4600
  "main",
3984
4601
  {
4602
+ "addons": {
4603
+ "children": [
4604
+ {
4605
+ "action": "END_TURN",
4606
+ "label": "End Turn",
4607
+ "type": "button",
4608
+ "variant": "primary"
4609
+ },
4610
+ {
4611
+ "action": "CANCEL",
4612
+ "label": "Cancel",
4613
+ "type": "button",
4614
+ "variant": "secondary"
4615
+ },
4616
+ {
4617
+ "action": "PLAY_AGAIN",
4618
+ "label": "Restart",
4619
+ "type": "button",
4620
+ "variant": "secondary"
4621
+ }
4622
+ ],
4623
+ "direction": "vertical",
4624
+ "gap": "sm",
4625
+ "type": "stack"
4626
+ },
3985
4627
  "children": [
3986
4628
  {
3987
4629
  "attackTargets": "@entity.attackTargets",
3988
4630
  "backgroundColor": "@config.bgColor",
4631
+ "events": "@entity.fx",
3989
4632
  "features": "@config.features",
3990
4633
  "interpolateUnits": true,
3991
4634
  "scale": "@config.scale",
@@ -4016,6 +4659,41 @@
4016
4659
  ],
4017
4660
  "type": "game-hud"
4018
4661
  },
4662
+ "overlay": [
4663
+ "if",
4664
+ [
4665
+ "!=",
4666
+ "@entity.result",
4667
+ "none"
4668
+ ],
4669
+ {
4670
+ "options": [
4671
+ {
4672
+ "event": "PLAY_AGAIN",
4673
+ "id": "again",
4674
+ "label": "Play Again",
4675
+ "variant": "primary"
4676
+ }
4677
+ ],
4678
+ "subtitle": [
4679
+ "str/concat",
4680
+ "Turn ",
4681
+ "@entity.turn"
4682
+ ],
4683
+ "title": [
4684
+ "if",
4685
+ [
4686
+ "==",
4687
+ "@entity.result",
4688
+ "victory"
4689
+ ],
4690
+ "VICTORY",
4691
+ "DEFEAT"
4692
+ ],
4693
+ "type": "game-menu"
4694
+ },
4695
+ null
4696
+ ],
4019
4697
  "type": "game-shell"
4020
4698
  }
4021
4699
  ]
@@ -4035,6 +4713,130 @@
4035
4713
  ],
4036
4714
  "interval": 1000.0,
4037
4715
  "name": "enemyAiTick"
4716
+ },
4717
+ {
4718
+ "effects": [
4719
+ [
4720
+ "set",
4721
+ "@entity.fx",
4722
+ [
4723
+ "array/filter",
4724
+ [
4725
+ "array/map",
4726
+ "@entity.fx",
4727
+ [
4728
+ "fn",
4729
+ "e",
4730
+ [
4731
+ "object/merge",
4732
+ "@e",
4733
+ {
4734
+ "ttl": [
4735
+ "-",
4736
+ [
4737
+ "object/get",
4738
+ "@e",
4739
+ "ttl"
4740
+ ],
4741
+ 1.0
4742
+ ]
4743
+ }
4744
+ ]
4745
+ ]
4746
+ ],
4747
+ [
4748
+ "fn",
4749
+ "e",
4750
+ [
4751
+ ">",
4752
+ [
4753
+ "object/get",
4754
+ "@e",
4755
+ "ttl"
4756
+ ],
4757
+ 0.0
4758
+ ]
4759
+ ]
4760
+ ]
4761
+ ],
4762
+ [
4763
+ "render-ui",
4764
+ "main",
4765
+ {
4766
+ "addons": {
4767
+ "children": [
4768
+ {
4769
+ "action": "END_TURN",
4770
+ "label": "End Turn",
4771
+ "type": "button",
4772
+ "variant": "primary"
4773
+ },
4774
+ {
4775
+ "action": "CANCEL",
4776
+ "label": "Cancel",
4777
+ "type": "button",
4778
+ "variant": "secondary"
4779
+ },
4780
+ {
4781
+ "action": "PLAY_AGAIN",
4782
+ "label": "Restart",
4783
+ "type": "button",
4784
+ "variant": "secondary"
4785
+ }
4786
+ ],
4787
+ "direction": "vertical",
4788
+ "gap": "sm",
4789
+ "type": "stack"
4790
+ },
4791
+ "children": [
4792
+ {
4793
+ "attackTargets": "@entity.attackTargets",
4794
+ "backgroundColor": "@config.bgColor",
4795
+ "events": "@entity.fx",
4796
+ "features": "@config.features",
4797
+ "interpolateUnits": true,
4798
+ "scale": "@config.scale",
4799
+ "selectedUnitId": "@entity.selectedUnitId",
4800
+ "tileClickEvent": "TILE_CLICK",
4801
+ "tiles": "@config.tiles",
4802
+ "type": "game-canvas-3d",
4803
+ "unitClickEvent": "UNIT_CLICK",
4804
+ "unitScale": "@config.unitScale",
4805
+ "units": "@entity.units",
4806
+ "validMoves": "@entity.validMoves"
4807
+ }
4808
+ ],
4809
+ "hud": {
4810
+ "stats": [
4811
+ {
4812
+ "label": "Turn",
4813
+ "value": "@entity.turn"
4814
+ },
4815
+ {
4816
+ "label": "Phase",
4817
+ "value": "@entity.phase"
4818
+ },
4819
+ {
4820
+ "label": "Result",
4821
+ "value": "@entity.result"
4822
+ }
4823
+ ],
4824
+ "type": "game-hud"
4825
+ },
4826
+ "type": "game-shell"
4827
+ }
4828
+ ]
4829
+ ],
4830
+ "guard": [
4831
+ ">",
4832
+ [
4833
+ "array/len",
4834
+ "@entity.fx"
4835
+ ],
4836
+ 0.0
4837
+ ],
4838
+ "interval": 500.0,
4839
+ "name": "fxTick"
4038
4840
  }
4039
4841
  ]
4040
4842
  }