@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
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "GameBoard3D — 3D tactics board organism composing game-shell + game-canvas-3d; owns full gameplay state (phase/selection/validMoves/attackTargets/result).",
2
+ "description": "GameBoard3D — 3D tactics board: select, move, attack, end turn, AI turn, restart loop.",
3
3
  "name": "ui-game-board-3d",
4
4
  "orbitals": [
5
5
  {
@@ -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",
@@ -872,6 +917,13 @@
872
917
  "tier": "presentation",
873
918
  "type": "GameBoard3DAssetManifest"
874
919
  },
920
+ "attackDamage": {
921
+ "default": 3.0,
922
+ "description": "Damage dealt when a selected unit attacks an adjacent enemy",
923
+ "label": "Attack Damage",
924
+ "tier": "presentation",
925
+ "type": "number"
926
+ },
875
927
  "className": {
876
928
  "default": "",
877
929
  "description": "className prop",
@@ -2159,36 +2211,6 @@
2159
2211
  }
2160
2212
  },
2161
2213
  "emits": [
2162
- {
2163
- "description": "-- Callbacks --",
2164
- "event": "ATTACK",
2165
- "payloadSchema": [
2166
- {
2167
- "name": "attacker",
2168
- "type": "object"
2169
- },
2170
- {
2171
- "name": "target",
2172
- "type": "object"
2173
- },
2174
- {
2175
- "name": "damage",
2176
- "type": "number"
2177
- },
2178
- {
2179
- "name": "attackerId",
2180
- "required": true,
2181
- "type": "string"
2182
- },
2183
- {
2184
- "name": "targetId",
2185
- "required": true,
2186
- "type": "string"
2187
- }
2188
- ],
2189
- "scope": "external",
2190
- "tier": "domain"
2191
- },
2192
2214
  {
2193
2215
  "description": "Called when the match ends",
2194
2216
  "event": "GAME_END",
@@ -2314,6 +2336,7 @@
2314
2336
  "attackTargets",
2315
2337
  "currentTeam",
2316
2338
  "enemyTurn",
2339
+ "fx",
2317
2340
  "gridHeight",
2318
2341
  "gridWidth",
2319
2342
  "movementRange",
@@ -2332,10 +2355,6 @@
2332
2355
  "scope": "instance",
2333
2356
  "stateMachine": {
2334
2357
  "events": [
2335
- {
2336
- "key": "START",
2337
- "name": "Start"
2338
- },
2339
2358
  {
2340
2359
  "key": "INIT",
2341
2360
  "name": "Initialize"
@@ -2383,36 +2402,6 @@
2383
2402
  ],
2384
2403
  "tier": "domain"
2385
2404
  },
2386
- {
2387
- "description": "-- Callbacks --",
2388
- "key": "ATTACK",
2389
- "name": "Attack",
2390
- "payloadSchema": [
2391
- {
2392
- "name": "attacker",
2393
- "type": "object"
2394
- },
2395
- {
2396
- "name": "target",
2397
- "type": "object"
2398
- },
2399
- {
2400
- "name": "damage",
2401
- "type": "number"
2402
- },
2403
- {
2404
- "name": "attackerId",
2405
- "required": true,
2406
- "type": "string"
2407
- },
2408
- {
2409
- "name": "targetId",
2410
- "required": true,
2411
- "type": "string"
2412
- }
2413
- ],
2414
- "tier": "domain"
2415
- },
2416
2405
  {
2417
2406
  "description": "Emits UI:{endTurnEvent} with {} on end turn",
2418
2407
  "key": "END_TURN",
@@ -2495,9 +2484,6 @@
2495
2484
  "isInitial": true,
2496
2485
  "name": "playing"
2497
2486
  },
2498
- {
2499
- "name": "menu"
2500
- },
2501
2487
  {
2502
2488
  "name": "gameover"
2503
2489
  }
@@ -2527,93 +2513,7 @@
2527
2513
  ],
2528
2514
  [
2529
2515
  "set",
2530
- "@entity.turn",
2531
- 0.0
2532
- ],
2533
- [
2534
- "set",
2535
- "@entity.result",
2536
- "none"
2537
- ],
2538
- [
2539
- "set",
2540
- "@entity.phase",
2541
- "observation"
2542
- ],
2543
- [
2544
- "set",
2545
- "@entity.currentTeam",
2546
- "player"
2547
- ],
2548
- [
2549
- "set",
2550
- "@entity.enemyTurn",
2551
- false
2552
- ],
2553
- [
2554
- "render-ui",
2555
- "main",
2556
- {
2557
- "children": [
2558
- {
2559
- "attackTargets": "@entity.attackTargets",
2560
- "features": "@config.features",
2561
- "scale": "@config.scale",
2562
- "selectedUnitId": "@entity.selectedUnitId",
2563
- "tileClickEvent": "TILE_CLICK",
2564
- "tiles": "@config.tiles",
2565
- "type": "game-canvas-3d",
2566
- "unitClickEvent": "UNIT_CLICK",
2567
- "unitScale": "@config.unitScale",
2568
- "units": "@entity.units",
2569
- "validMoves": "@entity.validMoves"
2570
- }
2571
- ],
2572
- "hud": {
2573
- "stats": [
2574
- {
2575
- "label": "Turn",
2576
- "value": "@entity.turn"
2577
- },
2578
- {
2579
- "label": "Phase",
2580
- "value": "@entity.phase"
2581
- },
2582
- {
2583
- "label": "Result",
2584
- "value": "@entity.result"
2585
- }
2586
- ],
2587
- "type": "game-hud"
2588
- },
2589
- "type": "game-shell"
2590
- }
2591
- ]
2592
- ],
2593
- "event": "START",
2594
- "from": "menu",
2595
- "to": "playing"
2596
- },
2597
- {
2598
- "effects": [
2599
- [
2600
- "set",
2601
- "@entity.units",
2602
- "@config.units"
2603
- ],
2604
- [
2605
- "set",
2606
- "@entity.selectedUnitId",
2607
- ""
2608
- ],
2609
- [
2610
- "set",
2611
- "@entity.validMoves",
2612
- []
2613
- ],
2614
- [
2615
- "set",
2616
- "@entity.attackTargets",
2516
+ "@entity.fx",
2617
2517
  []
2618
2518
  ],
2619
2519
  [
@@ -2660,9 +2560,35 @@
2660
2560
  "render-ui",
2661
2561
  "main",
2662
2562
  {
2563
+ "addons": {
2564
+ "children": [
2565
+ {
2566
+ "action": "END_TURN",
2567
+ "label": "End Turn",
2568
+ "type": "button",
2569
+ "variant": "primary"
2570
+ },
2571
+ {
2572
+ "action": "CANCEL",
2573
+ "label": "Cancel",
2574
+ "type": "button",
2575
+ "variant": "secondary"
2576
+ },
2577
+ {
2578
+ "action": "PLAY_AGAIN",
2579
+ "label": "Restart",
2580
+ "type": "button",
2581
+ "variant": "secondary"
2582
+ }
2583
+ ],
2584
+ "direction": "vertical",
2585
+ "gap": "sm",
2586
+ "type": "stack"
2587
+ },
2663
2588
  "children": [
2664
2589
  {
2665
2590
  "attackTargets": "@entity.attackTargets",
2591
+ "events": "@entity.fx",
2666
2592
  "features": "@config.features",
2667
2593
  "scale": "@config.scale",
2668
2594
  "selectedUnitId": "@entity.selectedUnitId",
@@ -2704,30 +2630,372 @@
2704
2630
  "effects": [
2705
2631
  [
2706
2632
  "set",
2707
- "@entity.phase",
2708
- "action"
2633
+ "@entity.units",
2634
+ [
2635
+ "array/map",
2636
+ "@entity.units",
2637
+ [
2638
+ "fn",
2639
+ "u",
2640
+ [
2641
+ "if",
2642
+ [
2643
+ "==",
2644
+ "@u.id",
2645
+ "@payload.unitId"
2646
+ ],
2647
+ [
2648
+ "object/merge",
2649
+ "@u",
2650
+ {
2651
+ "health": [
2652
+ "math/max",
2653
+ 0.0,
2654
+ [
2655
+ "-",
2656
+ "@u.health",
2657
+ "@config.attackDamage"
2658
+ ]
2659
+ ]
2660
+ }
2661
+ ],
2662
+ "@u"
2663
+ ]
2664
+ ]
2665
+ ]
2666
+ ],
2667
+ [
2668
+ "set",
2669
+ "@entity.selectedUnitId",
2670
+ ""
2671
+ ],
2672
+ [
2673
+ "set",
2674
+ "@entity.validMoves",
2675
+ []
2709
2676
  ],
2710
2677
  [
2711
2678
  "set",
2712
2679
  "@entity.attackTargets",
2680
+ []
2681
+ ],
2682
+ [
2683
+ "set",
2684
+ "@entity.phase",
2685
+ "observation"
2686
+ ],
2687
+ [
2688
+ "set",
2689
+ "@entity.result",
2713
2690
  [
2714
- "array/map",
2691
+ "if",
2715
2692
  [
2716
- "array/filter",
2717
- "@entity.units",
2693
+ "==",
2718
2694
  [
2719
- "fn",
2720
- "u",
2695
+ "array/len",
2721
2696
  [
2722
- "and",
2723
- [
2724
- "==",
2725
- "@u.team",
2726
- "enemy"
2727
- ],
2697
+ "array/filter",
2698
+ "@entity.units",
2728
2699
  [
2729
- ">",
2730
- "@u.health",
2700
+ "fn",
2701
+ "u",
2702
+ [
2703
+ "and",
2704
+ [
2705
+ "==",
2706
+ "@u.team",
2707
+ "enemy"
2708
+ ],
2709
+ [
2710
+ ">",
2711
+ "@u.health",
2712
+ 0.0
2713
+ ]
2714
+ ]
2715
+ ]
2716
+ ]
2717
+ ],
2718
+ 0.0
2719
+ ],
2720
+ "victory",
2721
+ "none"
2722
+ ]
2723
+ ],
2724
+ [
2725
+ "if",
2726
+ [
2727
+ "!=",
2728
+ "@entity.result",
2729
+ "none"
2730
+ ],
2731
+ [
2732
+ "emit",
2733
+ "GAME_END",
2734
+ {
2735
+ "result": "@entity.result"
2736
+ }
2737
+ ],
2738
+ null
2739
+ ],
2740
+ [
2741
+ "set",
2742
+ "@entity.fx",
2743
+ [
2744
+ "array/append",
2745
+ "@entity.fx",
2746
+ {
2747
+ "id": [
2748
+ "str/concat",
2749
+ "fx-atk-",
2750
+ "@entity.turn"
2751
+ ],
2752
+ "message": [
2753
+ "str/concat",
2754
+ "-",
2755
+ "@config.attackDamage"
2756
+ ],
2757
+ "ttl": 3.0,
2758
+ "type": "hit",
2759
+ "x": [
2760
+ "object/get",
2761
+ [
2762
+ "object/get",
2763
+ [
2764
+ "array/find",
2765
+ "@entity.units",
2766
+ [
2767
+ "fn",
2768
+ "u",
2769
+ [
2770
+ "==",
2771
+ "@u.id",
2772
+ "@payload.unitId"
2773
+ ]
2774
+ ]
2775
+ ],
2776
+ "position"
2777
+ ],
2778
+ "x"
2779
+ ],
2780
+ "z": [
2781
+ "object/get",
2782
+ [
2783
+ "object/get",
2784
+ [
2785
+ "array/find",
2786
+ "@entity.units",
2787
+ [
2788
+ "fn",
2789
+ "u",
2790
+ [
2791
+ "==",
2792
+ "@u.id",
2793
+ "@payload.unitId"
2794
+ ]
2795
+ ]
2796
+ ],
2797
+ "position"
2798
+ ],
2799
+ "y"
2800
+ ]
2801
+ }
2802
+ ]
2803
+ ],
2804
+ [
2805
+ "render-ui",
2806
+ "main",
2807
+ {
2808
+ "addons": {
2809
+ "children": [
2810
+ {
2811
+ "action": "END_TURN",
2812
+ "label": "End Turn",
2813
+ "type": "button",
2814
+ "variant": "primary"
2815
+ },
2816
+ {
2817
+ "action": "CANCEL",
2818
+ "label": "Cancel",
2819
+ "type": "button",
2820
+ "variant": "secondary"
2821
+ },
2822
+ {
2823
+ "action": "PLAY_AGAIN",
2824
+ "label": "Restart",
2825
+ "type": "button",
2826
+ "variant": "secondary"
2827
+ }
2828
+ ],
2829
+ "direction": "vertical",
2830
+ "gap": "sm",
2831
+ "type": "stack"
2832
+ },
2833
+ "children": [
2834
+ {
2835
+ "attackTargets": "@entity.attackTargets",
2836
+ "events": "@entity.fx",
2837
+ "features": "@config.features",
2838
+ "scale": "@config.scale",
2839
+ "selectedUnitId": "@entity.selectedUnitId",
2840
+ "tileClickEvent": "TILE_CLICK",
2841
+ "tiles": "@config.tiles",
2842
+ "type": "game-canvas-3d",
2843
+ "unitClickEvent": "UNIT_CLICK",
2844
+ "unitScale": "@config.unitScale",
2845
+ "units": "@entity.units",
2846
+ "validMoves": "@entity.validMoves"
2847
+ }
2848
+ ],
2849
+ "hud": {
2850
+ "stats": [
2851
+ {
2852
+ "label": "Turn",
2853
+ "value": "@entity.turn"
2854
+ },
2855
+ {
2856
+ "label": "Phase",
2857
+ "value": "@entity.phase"
2858
+ },
2859
+ {
2860
+ "label": "Result",
2861
+ "value": "@entity.result"
2862
+ }
2863
+ ],
2864
+ "type": "game-hud"
2865
+ },
2866
+ "type": "game-shell"
2867
+ }
2868
+ ]
2869
+ ],
2870
+ "event": "UNIT_CLICK",
2871
+ "from": "playing",
2872
+ "guard": [
2873
+ "and",
2874
+ [
2875
+ "==",
2876
+ "@entity.phase",
2877
+ "action"
2878
+ ],
2879
+ [
2880
+ "and",
2881
+ [
2882
+ "==",
2883
+ [
2884
+ "object/get",
2885
+ [
2886
+ "array/find",
2887
+ "@entity.units",
2888
+ [
2889
+ "fn",
2890
+ "u",
2891
+ [
2892
+ "==",
2893
+ "@u.id",
2894
+ "@payload.unitId"
2895
+ ]
2896
+ ]
2897
+ ],
2898
+ "team"
2899
+ ],
2900
+ "enemy"
2901
+ ],
2902
+ [
2903
+ "and",
2904
+ [
2905
+ ">",
2906
+ [
2907
+ "object/get",
2908
+ [
2909
+ "array/find",
2910
+ "@entity.units",
2911
+ [
2912
+ "fn",
2913
+ "u",
2914
+ [
2915
+ "==",
2916
+ "@u.id",
2917
+ "@payload.unitId"
2918
+ ]
2919
+ ]
2920
+ ],
2921
+ "health"
2922
+ ],
2923
+ 0.0
2924
+ ],
2925
+ [
2926
+ "<=",
2927
+ [
2928
+ "grid/manhattan-distance",
2929
+ [
2930
+ "object/get",
2931
+ [
2932
+ "array/find",
2933
+ "@entity.units",
2934
+ [
2935
+ "fn",
2936
+ "u",
2937
+ [
2938
+ "==",
2939
+ "@u.id",
2940
+ "@entity.selectedUnitId"
2941
+ ]
2942
+ ]
2943
+ ],
2944
+ "position"
2945
+ ],
2946
+ [
2947
+ "object/get",
2948
+ [
2949
+ "array/find",
2950
+ "@entity.units",
2951
+ [
2952
+ "fn",
2953
+ "u",
2954
+ [
2955
+ "==",
2956
+ "@u.id",
2957
+ "@payload.unitId"
2958
+ ]
2959
+ ]
2960
+ ],
2961
+ "position"
2962
+ ]
2963
+ ],
2964
+ 1.0
2965
+ ]
2966
+ ]
2967
+ ]
2968
+ ],
2969
+ "to": "playing"
2970
+ },
2971
+ {
2972
+ "effects": [
2973
+ [
2974
+ "set",
2975
+ "@entity.phase",
2976
+ "action"
2977
+ ],
2978
+ [
2979
+ "set",
2980
+ "@entity.attackTargets",
2981
+ [
2982
+ "array/map",
2983
+ [
2984
+ "array/filter",
2985
+ "@entity.units",
2986
+ [
2987
+ "fn",
2988
+ "u",
2989
+ [
2990
+ "and",
2991
+ [
2992
+ "==",
2993
+ "@u.team",
2994
+ "enemy"
2995
+ ],
2996
+ [
2997
+ ">",
2998
+ "@u.health",
2731
2999
  0.0
2732
3000
  ],
2733
3001
  [
@@ -2792,9 +3060,35 @@
2792
3060
  "render-ui",
2793
3061
  "main",
2794
3062
  {
3063
+ "addons": {
3064
+ "children": [
3065
+ {
3066
+ "action": "END_TURN",
3067
+ "label": "End Turn",
3068
+ "type": "button",
3069
+ "variant": "primary"
3070
+ },
3071
+ {
3072
+ "action": "CANCEL",
3073
+ "label": "Cancel",
3074
+ "type": "button",
3075
+ "variant": "secondary"
3076
+ },
3077
+ {
3078
+ "action": "PLAY_AGAIN",
3079
+ "label": "Restart",
3080
+ "type": "button",
3081
+ "variant": "secondary"
3082
+ }
3083
+ ],
3084
+ "direction": "vertical",
3085
+ "gap": "sm",
3086
+ "type": "stack"
3087
+ },
2795
3088
  "children": [
2796
3089
  {
2797
3090
  "attackTargets": "@entity.attackTargets",
3091
+ "events": "@entity.fx",
2798
3092
  "features": "@config.features",
2799
3093
  "scale": "@config.scale",
2800
3094
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3013,9 +3307,35 @@
3013
3307
  "render-ui",
3014
3308
  "main",
3015
3309
  {
3310
+ "addons": {
3311
+ "children": [
3312
+ {
3313
+ "action": "END_TURN",
3314
+ "label": "End Turn",
3315
+ "type": "button",
3316
+ "variant": "primary"
3317
+ },
3318
+ {
3319
+ "action": "CANCEL",
3320
+ "label": "Cancel",
3321
+ "type": "button",
3322
+ "variant": "secondary"
3323
+ },
3324
+ {
3325
+ "action": "PLAY_AGAIN",
3326
+ "label": "Restart",
3327
+ "type": "button",
3328
+ "variant": "secondary"
3329
+ }
3330
+ ],
3331
+ "direction": "vertical",
3332
+ "gap": "sm",
3333
+ "type": "stack"
3334
+ },
3016
3335
  "children": [
3017
3336
  {
3018
3337
  "attackTargets": "@entity.attackTargets",
3338
+ "events": "@entity.fx",
3019
3339
  "features": "@config.features",
3020
3340
  "scale": "@config.scale",
3021
3341
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3131,210 +3451,35 @@
3131
3451
  "render-ui",
3132
3452
  "main",
3133
3453
  {
3134
- "children": [
3135
- {
3136
- "attackTargets": "@entity.attackTargets",
3137
- "features": "@config.features",
3138
- "scale": "@config.scale",
3139
- "selectedUnitId": "@entity.selectedUnitId",
3140
- "tileClickEvent": "TILE_CLICK",
3141
- "tiles": "@config.tiles",
3142
- "type": "game-canvas-3d",
3143
- "unitClickEvent": "UNIT_CLICK",
3144
- "unitScale": "@config.unitScale",
3145
- "units": "@entity.units",
3146
- "validMoves": "@entity.validMoves"
3147
- }
3148
- ],
3149
- "hud": {
3150
- "stats": [
3454
+ "addons": {
3455
+ "children": [
3151
3456
  {
3152
- "label": "Turn",
3153
- "value": "@entity.turn"
3457
+ "action": "END_TURN",
3458
+ "label": "End Turn",
3459
+ "type": "button",
3460
+ "variant": "primary"
3154
3461
  },
3155
3462
  {
3156
- "label": "Phase",
3157
- "value": "@entity.phase"
3463
+ "action": "CANCEL",
3464
+ "label": "Cancel",
3465
+ "type": "button",
3466
+ "variant": "secondary"
3158
3467
  },
3159
3468
  {
3160
- "label": "Result",
3161
- "value": "@entity.result"
3469
+ "action": "PLAY_AGAIN",
3470
+ "label": "Restart",
3471
+ "type": "button",
3472
+ "variant": "secondary"
3162
3473
  }
3163
3474
  ],
3164
- "type": "game-hud"
3475
+ "direction": "vertical",
3476
+ "gap": "sm",
3477
+ "type": "stack"
3165
3478
  },
3166
- "type": "game-shell"
3167
- }
3168
- ]
3169
- ],
3170
- "event": "TILE_CLICK",
3171
- "from": "playing",
3172
- "guard": [
3173
- "and",
3174
- [
3175
- "!=",
3176
- "@entity.selectedUnitId",
3177
- ""
3178
- ],
3179
- [
3180
- "and",
3181
- [
3182
- "grid/in-bounds",
3183
- {
3184
- "x": "@payload.x",
3185
- "y": "@payload.z"
3186
- },
3187
- "@entity.gridWidth",
3188
- "@entity.gridHeight"
3189
- ],
3190
- [
3191
- "and",
3192
- [
3193
- "<=",
3194
- [
3195
- "grid/manhattan-distance",
3196
- [
3197
- "object/get",
3198
- [
3199
- "array/find",
3200
- "@entity.units",
3201
- [
3202
- "fn",
3203
- "u",
3204
- [
3205
- "==",
3206
- "@u.id",
3207
- "@entity.selectedUnitId"
3208
- ]
3209
- ]
3210
- ],
3211
- "position"
3212
- ],
3213
- {
3214
- "x": "@payload.x",
3215
- "y": "@payload.z"
3216
- }
3217
- ],
3218
- "@entity.movementRange"
3219
- ],
3220
- [
3221
- "==",
3222
- [
3223
- "array/len",
3224
- [
3225
- "array/filter",
3226
- "@entity.units",
3227
- [
3228
- "fn",
3229
- "u",
3230
- [
3231
- "and",
3232
- [
3233
- "==",
3234
- [
3235
- "object/get",
3236
- [
3237
- "object/get",
3238
- "@u",
3239
- "position"
3240
- ],
3241
- "x"
3242
- ],
3243
- "@payload.x"
3244
- ],
3245
- [
3246
- "==",
3247
- [
3248
- "object/get",
3249
- [
3250
- "object/get",
3251
- "@u",
3252
- "position"
3253
- ],
3254
- "y"
3255
- ],
3256
- "@payload.z"
3257
- ]
3258
- ]
3259
- ]
3260
- ]
3261
- ],
3262
- 0.0
3263
- ]
3264
- ]
3265
- ]
3266
- ],
3267
- "to": "playing"
3268
- },
3269
- {
3270
- "effects": [
3271
- [
3272
- "set",
3273
- "@entity.units",
3274
- [
3275
- "array/map",
3276
- "@entity.units",
3277
- [
3278
- "fn",
3279
- "u",
3280
- [
3281
- "if",
3282
- [
3283
- "==",
3284
- "@u.id",
3285
- "@payload.targetId"
3286
- ],
3287
- [
3288
- "object/merge",
3289
- "@u",
3290
- {
3291
- "health": [
3292
- "math/max",
3293
- 0.0,
3294
- [
3295
- "-",
3296
- [
3297
- "object/get",
3298
- "@u",
3299
- "health"
3300
- ],
3301
- "@payload.damage"
3302
- ]
3303
- ]
3304
- }
3305
- ],
3306
- "@u"
3307
- ]
3308
- ]
3309
- ]
3310
- ],
3311
- [
3312
- "set",
3313
- "@entity.selectedUnitId",
3314
- ""
3315
- ],
3316
- [
3317
- "set",
3318
- "@entity.validMoves",
3319
- []
3320
- ],
3321
- [
3322
- "set",
3323
- "@entity.attackTargets",
3324
- []
3325
- ],
3326
- [
3327
- "set",
3328
- "@entity.phase",
3329
- "observation"
3330
- ],
3331
- [
3332
- "render-ui",
3333
- "main",
3334
- {
3335
3479
  "children": [
3336
3480
  {
3337
3481
  "attackTargets": "@entity.attackTargets",
3482
+ "events": "@entity.fx",
3338
3483
  "features": "@config.features",
3339
3484
  "scale": "@config.scale",
3340
3485
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3364,104 +3509,103 @@
3364
3509
  ],
3365
3510
  "type": "game-hud"
3366
3511
  },
3367
- "type": "game-shell"
3368
- }
3369
- ]
3370
- ],
3371
- "event": "ATTACK",
3372
- "from": "playing",
3373
- "guard": [
3374
- "let",
3375
- [
3376
- [
3377
- "ap",
3378
- [
3379
- "object/get",
3380
- [
3381
- "array/find",
3382
- "@entity.units",
3383
- [
3384
- "fn",
3385
- "u",
3386
- [
3387
- "==",
3388
- "@u.id",
3389
- "@payload.attackerId"
3390
- ]
3391
- ]
3392
- ],
3393
- "position"
3394
- ]
3395
- ],
3396
- [
3397
- "tp",
3398
- [
3399
- "object/get",
3400
- [
3401
- "array/find",
3402
- "@entity.units",
3403
- [
3404
- "fn",
3405
- "u",
3406
- [
3407
- "==",
3408
- "@u.id",
3409
- "@payload.targetId"
3410
- ]
3411
- ]
3412
- ],
3413
- "position"
3414
- ]
3415
- ]
3512
+ "type": "game-shell"
3513
+ }
3514
+ ]
3515
+ ],
3516
+ "event": "TILE_CLICK",
3517
+ "from": "playing",
3518
+ "guard": [
3519
+ "and",
3520
+ [
3521
+ "!=",
3522
+ "@entity.selectedUnitId",
3523
+ ""
3416
3524
  ],
3417
3525
  [
3418
3526
  "and",
3419
3527
  [
3420
- "<=",
3421
- [
3422
- "math/abs",
3423
- [
3424
- "-",
3425
- [
3426
- "object/get",
3427
- "@ap",
3428
- "x"
3429
- ],
3430
- [
3431
- "object/get",
3432
- "@tp",
3433
- "x"
3434
- ]
3435
- ]
3436
- ],
3437
- 1.0
3528
+ "grid/in-bounds",
3529
+ {
3530
+ "x": "@payload.x",
3531
+ "y": "@payload.z"
3532
+ },
3533
+ "@entity.gridWidth",
3534
+ "@entity.gridHeight"
3438
3535
  ],
3439
3536
  [
3440
3537
  "and",
3441
3538
  [
3442
3539
  "<=",
3443
3540
  [
3444
- "math/abs",
3541
+ "grid/manhattan-distance",
3445
3542
  [
3446
- "-",
3543
+ "object/get",
3447
3544
  [
3448
- "object/get",
3449
- "@ap",
3450
- "y"
3545
+ "array/find",
3546
+ "@entity.units",
3547
+ [
3548
+ "fn",
3549
+ "u",
3550
+ [
3551
+ "==",
3552
+ "@u.id",
3553
+ "@entity.selectedUnitId"
3554
+ ]
3555
+ ]
3451
3556
  ],
3557
+ "position"
3558
+ ],
3559
+ {
3560
+ "x": "@payload.x",
3561
+ "y": "@payload.z"
3562
+ }
3563
+ ],
3564
+ "@entity.movementRange"
3565
+ ],
3566
+ [
3567
+ "==",
3568
+ [
3569
+ "array/len",
3570
+ [
3571
+ "array/filter",
3572
+ "@entity.units",
3452
3573
  [
3453
- "object/get",
3454
- "@tp",
3455
- "y"
3574
+ "fn",
3575
+ "u",
3576
+ [
3577
+ "and",
3578
+ [
3579
+ "==",
3580
+ [
3581
+ "object/get",
3582
+ [
3583
+ "object/get",
3584
+ "@u",
3585
+ "position"
3586
+ ],
3587
+ "x"
3588
+ ],
3589
+ "@payload.x"
3590
+ ],
3591
+ [
3592
+ "==",
3593
+ [
3594
+ "object/get",
3595
+ [
3596
+ "object/get",
3597
+ "@u",
3598
+ "position"
3599
+ ],
3600
+ "y"
3601
+ ],
3602
+ "@payload.z"
3603
+ ]
3604
+ ]
3456
3605
  ]
3457
3606
  ]
3458
3607
  ],
3459
- 1.0
3460
- ],
3461
- [
3462
- "!=",
3463
- "@ap",
3464
- "@tp"
3608
+ 0.0
3465
3609
  ]
3466
3610
  ]
3467
3611
  ]
@@ -3513,9 +3657,35 @@
3513
3657
  "render-ui",
3514
3658
  "main",
3515
3659
  {
3660
+ "addons": {
3661
+ "children": [
3662
+ {
3663
+ "action": "END_TURN",
3664
+ "label": "End Turn",
3665
+ "type": "button",
3666
+ "variant": "primary"
3667
+ },
3668
+ {
3669
+ "action": "CANCEL",
3670
+ "label": "Cancel",
3671
+ "type": "button",
3672
+ "variant": "secondary"
3673
+ },
3674
+ {
3675
+ "action": "PLAY_AGAIN",
3676
+ "label": "Restart",
3677
+ "type": "button",
3678
+ "variant": "secondary"
3679
+ }
3680
+ ],
3681
+ "direction": "vertical",
3682
+ "gap": "sm",
3683
+ "type": "stack"
3684
+ },
3516
3685
  "children": [
3517
3686
  {
3518
3687
  "attackTargets": "@entity.attackTargets",
3688
+ "events": "@entity.fx",
3519
3689
  "features": "@config.features",
3520
3690
  "scale": "@config.scale",
3521
3691
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3584,9 +3754,35 @@
3584
3754
  "render-ui",
3585
3755
  "main",
3586
3756
  {
3757
+ "addons": {
3758
+ "children": [
3759
+ {
3760
+ "action": "END_TURN",
3761
+ "label": "End Turn",
3762
+ "type": "button",
3763
+ "variant": "primary"
3764
+ },
3765
+ {
3766
+ "action": "CANCEL",
3767
+ "label": "Cancel",
3768
+ "type": "button",
3769
+ "variant": "secondary"
3770
+ },
3771
+ {
3772
+ "action": "PLAY_AGAIN",
3773
+ "label": "Restart",
3774
+ "type": "button",
3775
+ "variant": "secondary"
3776
+ }
3777
+ ],
3778
+ "direction": "vertical",
3779
+ "gap": "sm",
3780
+ "type": "stack"
3781
+ },
3587
3782
  "children": [
3588
3783
  {
3589
3784
  "attackTargets": "@entity.attackTargets",
3785
+ "events": "@entity.fx",
3590
3786
  "features": "@config.features",
3591
3787
  "scale": "@config.scale",
3592
3788
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3712,9 +3908,35 @@
3712
3908
  "render-ui",
3713
3909
  "main",
3714
3910
  {
3911
+ "addons": {
3912
+ "children": [
3913
+ {
3914
+ "action": "END_TURN",
3915
+ "label": "End Turn",
3916
+ "type": "button",
3917
+ "variant": "primary"
3918
+ },
3919
+ {
3920
+ "action": "CANCEL",
3921
+ "label": "Cancel",
3922
+ "type": "button",
3923
+ "variant": "secondary"
3924
+ },
3925
+ {
3926
+ "action": "PLAY_AGAIN",
3927
+ "label": "Restart",
3928
+ "type": "button",
3929
+ "variant": "secondary"
3930
+ }
3931
+ ],
3932
+ "direction": "vertical",
3933
+ "gap": "sm",
3934
+ "type": "stack"
3935
+ },
3715
3936
  "children": [
3716
3937
  {
3717
3938
  "attackTargets": "@entity.attackTargets",
3939
+ "events": "@entity.fx",
3718
3940
  "features": "@config.features",
3719
3941
  "scale": "@config.scale",
3720
3942
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3744,6 +3966,41 @@
3744
3966
  ],
3745
3967
  "type": "game-hud"
3746
3968
  },
3969
+ "overlay": [
3970
+ "if",
3971
+ [
3972
+ "!=",
3973
+ "@entity.result",
3974
+ "none"
3975
+ ],
3976
+ {
3977
+ "options": [
3978
+ {
3979
+ "event": "PLAY_AGAIN",
3980
+ "id": "again",
3981
+ "label": "Play Again",
3982
+ "variant": "primary"
3983
+ }
3984
+ ],
3985
+ "subtitle": [
3986
+ "str/concat",
3987
+ "Turn ",
3988
+ "@entity.turn"
3989
+ ],
3990
+ "title": [
3991
+ "if",
3992
+ [
3993
+ "==",
3994
+ "@entity.result",
3995
+ "victory"
3996
+ ],
3997
+ "VICTORY",
3998
+ "DEFEAT"
3999
+ ],
4000
+ "type": "game-menu"
4001
+ },
4002
+ null
4003
+ ],
3747
4004
  "type": "game-shell"
3748
4005
  }
3749
4006
  ]
@@ -3841,6 +4098,11 @@
3841
4098
  "@entity.attackTargets",
3842
4099
  []
3843
4100
  ],
4101
+ [
4102
+ "set",
4103
+ "@entity.fx",
4104
+ []
4105
+ ],
3844
4106
  [
3845
4107
  "set",
3846
4108
  "@entity.turn",
@@ -3870,9 +4132,35 @@
3870
4132
  "render-ui",
3871
4133
  "main",
3872
4134
  {
4135
+ "addons": {
4136
+ "children": [
4137
+ {
4138
+ "action": "END_TURN",
4139
+ "label": "End Turn",
4140
+ "type": "button",
4141
+ "variant": "primary"
4142
+ },
4143
+ {
4144
+ "action": "CANCEL",
4145
+ "label": "Cancel",
4146
+ "type": "button",
4147
+ "variant": "secondary"
4148
+ },
4149
+ {
4150
+ "action": "PLAY_AGAIN",
4151
+ "label": "Restart",
4152
+ "type": "button",
4153
+ "variant": "secondary"
4154
+ }
4155
+ ],
4156
+ "direction": "vertical",
4157
+ "gap": "sm",
4158
+ "type": "stack"
4159
+ },
3873
4160
  "children": [
3874
4161
  {
3875
4162
  "attackTargets": "@entity.attackTargets",
4163
+ "events": "@entity.fx",
3876
4164
  "features": "@config.features",
3877
4165
  "scale": "@config.scale",
3878
4166
  "selectedUnitId": "@entity.selectedUnitId",
@@ -3902,19 +4190,169 @@
3902
4190
  ],
3903
4191
  "type": "game-hud"
3904
4192
  },
4193
+ "overlay": [
4194
+ "if",
4195
+ [
4196
+ "!=",
4197
+ "@entity.result",
4198
+ "none"
4199
+ ],
4200
+ {
4201
+ "options": [
4202
+ {
4203
+ "event": "PLAY_AGAIN",
4204
+ "id": "again",
4205
+ "label": "Play Again",
4206
+ "variant": "primary"
4207
+ }
4208
+ ],
4209
+ "subtitle": [
4210
+ "str/concat",
4211
+ "Turn ",
4212
+ "@entity.turn"
4213
+ ],
4214
+ "title": [
4215
+ "if",
4216
+ [
4217
+ "==",
4218
+ "@entity.result",
4219
+ "victory"
4220
+ ],
4221
+ "VICTORY",
4222
+ "DEFEAT"
4223
+ ],
4224
+ "type": "game-menu"
4225
+ },
4226
+ null
4227
+ ],
3905
4228
  "type": "game-shell"
3906
4229
  }
3907
4230
  ]
3908
4231
  ],
3909
- "event": "PLAY_AGAIN",
3910
- "from": "gameover",
3911
- "to": "menu"
3912
- }
3913
- ]
3914
- },
3915
- "ticks": [
3916
- {
3917
- "effects": [
4232
+ "event": "PLAY_AGAIN",
4233
+ "from": "gameover",
4234
+ "to": "playing"
4235
+ }
4236
+ ]
4237
+ },
4238
+ "ticks": [
4239
+ {
4240
+ "effects": [
4241
+ [
4242
+ "set",
4243
+ "@entity.fx",
4244
+ [
4245
+ "array/concat",
4246
+ "@entity.fx",
4247
+ [
4248
+ "array/map",
4249
+ [
4250
+ "array/filter",
4251
+ "@entity.units",
4252
+ [
4253
+ "fn",
4254
+ "u",
4255
+ [
4256
+ "and",
4257
+ [
4258
+ "and",
4259
+ [
4260
+ "==",
4261
+ "@u.team",
4262
+ "player"
4263
+ ],
4264
+ [
4265
+ ">",
4266
+ "@u.health",
4267
+ 0.0
4268
+ ]
4269
+ ],
4270
+ [
4271
+ ">",
4272
+ [
4273
+ "array/len",
4274
+ [
4275
+ "array/filter",
4276
+ "@entity.units",
4277
+ [
4278
+ "fn",
4279
+ "e",
4280
+ [
4281
+ "and",
4282
+ [
4283
+ "and",
4284
+ [
4285
+ "==",
4286
+ "@e.team",
4287
+ "enemy"
4288
+ ],
4289
+ [
4290
+ ">",
4291
+ "@e.health",
4292
+ 0.0
4293
+ ]
4294
+ ],
4295
+ [
4296
+ "==",
4297
+ [
4298
+ "grid/manhattan-distance",
4299
+ [
4300
+ "object/get",
4301
+ "@e",
4302
+ "position"
4303
+ ],
4304
+ [
4305
+ "object/get",
4306
+ "@u",
4307
+ "position"
4308
+ ]
4309
+ ],
4310
+ 1.0
4311
+ ]
4312
+ ]
4313
+ ]
4314
+ ]
4315
+ ],
4316
+ 0.0
4317
+ ]
4318
+ ]
4319
+ ]
4320
+ ],
4321
+ [
4322
+ "fn",
4323
+ "u",
4324
+ {
4325
+ "id": [
4326
+ "str/concat",
4327
+ "fx-ai-",
4328
+ "@u.id"
4329
+ ],
4330
+ "message": "-1",
4331
+ "ttl": 3.0,
4332
+ "type": "hit",
4333
+ "x": [
4334
+ "object/get",
4335
+ [
4336
+ "object/get",
4337
+ "@u",
4338
+ "position"
4339
+ ],
4340
+ "x"
4341
+ ],
4342
+ "z": [
4343
+ "object/get",
4344
+ [
4345
+ "object/get",
4346
+ "@u",
4347
+ "position"
4348
+ ],
4349
+ "y"
4350
+ ]
4351
+ }
4352
+ ]
4353
+ ]
4354
+ ]
4355
+ ],
3918
4356
  [
3919
4357
  "set",
3920
4358
  "@entity.units",
@@ -4091,7 +4529,7 @@
4091
4529
  [
4092
4530
  "target",
4093
4531
  [
4094
- "array/first",
4532
+ "array/reduce",
4095
4533
  [
4096
4534
  "array/filter",
4097
4535
  "@entity.units",
@@ -4112,107 +4550,295 @@
4112
4550
  ]
4113
4551
  ]
4114
4552
  ]
4115
- ]
4116
- ]
4117
- ]
4118
- ],
4119
- [
4120
- "object/merge",
4121
- "@u",
4122
- {
4123
- "position": {
4124
- "x": [
4125
- "math/clamp",
4553
+ ],
4554
+ [
4555
+ "fn",
4556
+ [
4557
+ "nearest",
4558
+ "p"
4559
+ ],
4126
4560
  [
4127
- "+",
4561
+ "if",
4128
4562
  [
4129
- "object/get",
4563
+ "or",
4130
4564
  [
4131
- "object/get",
4132
- "@u",
4133
- "position"
4565
+ "==",
4566
+ "@nearest",
4567
+ null
4134
4568
  ],
4135
- "x"
4136
- ],
4137
- [
4138
- "math/sign",
4139
4569
  [
4140
- "-",
4570
+ "<",
4141
4571
  [
4142
- "object/get",
4572
+ "grid/manhattan-distance",
4143
4573
  [
4144
4574
  "object/get",
4145
- "@target",
4575
+ "@p",
4146
4576
  "position"
4147
4577
  ],
4148
- "x"
4578
+ [
4579
+ "object/get",
4580
+ "@u",
4581
+ "position"
4582
+ ]
4149
4583
  ],
4150
4584
  [
4151
- "object/get",
4585
+ "grid/manhattan-distance",
4152
4586
  [
4153
4587
  "object/get",
4154
- "@u",
4588
+ "@nearest",
4155
4589
  "position"
4156
4590
  ],
4157
- "x"
4591
+ [
4592
+ "object/get",
4593
+ "@u",
4594
+ "position"
4595
+ ]
4158
4596
  ]
4159
4597
  ]
4160
- ]
4161
- ],
4162
- 0.0,
4163
- [
4164
- "-",
4165
- "@entity.gridWidth",
4166
- 1.0
4598
+ ],
4599
+ "@p",
4600
+ "@nearest"
4167
4601
  ]
4168
4602
  ],
4169
- "y": [
4170
- "math/clamp",
4603
+ null
4604
+ ]
4605
+ ]
4606
+ ],
4607
+ [
4608
+ "if",
4609
+ [
4610
+ "==",
4611
+ "@target",
4612
+ null
4613
+ ],
4614
+ "@u",
4615
+ [
4616
+ "let",
4617
+ [
4618
+ [
4619
+ "nextX",
4171
4620
  [
4172
- "+",
4621
+ "math/clamp",
4173
4622
  [
4174
- "object/get",
4623
+ "+",
4175
4624
  [
4176
4625
  "object/get",
4177
- "@u",
4178
- "position"
4626
+ [
4627
+ "object/get",
4628
+ "@u",
4629
+ "position"
4630
+ ],
4631
+ "x"
4179
4632
  ],
4180
- "y"
4181
- ],
4182
- [
4183
- "math/sign",
4184
4633
  [
4185
- "-",
4634
+ "math/sign",
4186
4635
  [
4187
- "object/get",
4636
+ "-",
4188
4637
  [
4189
4638
  "object/get",
4190
- "@target",
4191
- "position"
4639
+ [
4640
+ "object/get",
4641
+ "@target",
4642
+ "position"
4643
+ ],
4644
+ "x"
4192
4645
  ],
4193
- "y"
4194
- ],
4646
+ [
4647
+ "object/get",
4648
+ [
4649
+ "object/get",
4650
+ "@u",
4651
+ "position"
4652
+ ],
4653
+ "x"
4654
+ ]
4655
+ ]
4656
+ ]
4657
+ ],
4658
+ 0.0,
4659
+ [
4660
+ "-",
4661
+ "@entity.gridWidth",
4662
+ 1.0
4663
+ ]
4664
+ ]
4665
+ ],
4666
+ [
4667
+ "nextY",
4668
+ [
4669
+ "math/clamp",
4670
+ [
4671
+ "+",
4672
+ [
4673
+ "object/get",
4195
4674
  [
4196
4675
  "object/get",
4676
+ "@u",
4677
+ "position"
4678
+ ],
4679
+ "y"
4680
+ ],
4681
+ [
4682
+ "math/sign",
4683
+ [
4684
+ "-",
4197
4685
  [
4198
4686
  "object/get",
4199
- "@u",
4200
- "position"
4687
+ [
4688
+ "object/get",
4689
+ "@target",
4690
+ "position"
4691
+ ],
4692
+ "y"
4201
4693
  ],
4202
- "y"
4694
+ [
4695
+ "object/get",
4696
+ [
4697
+ "object/get",
4698
+ "@u",
4699
+ "position"
4700
+ ],
4701
+ "y"
4702
+ ]
4203
4703
  ]
4204
4704
  ]
4705
+ ],
4706
+ 0.0,
4707
+ [
4708
+ "-",
4709
+ "@entity.gridHeight",
4710
+ 1.0
4205
4711
  ]
4712
+ ]
4713
+ ]
4714
+ ],
4715
+ [
4716
+ "if",
4717
+ [
4718
+ "and",
4719
+ [
4720
+ "grid/in-bounds",
4721
+ {
4722
+ "x": "@nextX",
4723
+ "y": "@nextY"
4724
+ },
4725
+ "@entity.gridWidth",
4726
+ "@entity.gridHeight"
4206
4727
  ],
4207
- 0.0,
4208
4728
  [
4209
- "-",
4210
- "@entity.gridHeight",
4211
- 1.0
4729
+ "and",
4730
+ [
4731
+ "==",
4732
+ [
4733
+ "object/get",
4734
+ [
4735
+ "array/find",
4736
+ "@config.tiles",
4737
+ [
4738
+ "fn",
4739
+ "t",
4740
+ [
4741
+ "and",
4742
+ [
4743
+ "==",
4744
+ [
4745
+ "object/get",
4746
+ "@t",
4747
+ "x"
4748
+ ],
4749
+ "@nextX"
4750
+ ],
4751
+ [
4752
+ "==",
4753
+ [
4754
+ "object/get",
4755
+ "@t",
4756
+ "y"
4757
+ ],
4758
+ "@nextY"
4759
+ ]
4760
+ ]
4761
+ ]
4762
+ ],
4763
+ "passable"
4764
+ ],
4765
+ true
4766
+ ],
4767
+ [
4768
+ "==",
4769
+ [
4770
+ "array/len",
4771
+ [
4772
+ "array/filter",
4773
+ "@entity.units",
4774
+ [
4775
+ "fn",
4776
+ "o",
4777
+ [
4778
+ "and",
4779
+ [
4780
+ "!=",
4781
+ "@o.id",
4782
+ "@u.id"
4783
+ ],
4784
+ [
4785
+ "and",
4786
+ [
4787
+ ">",
4788
+ "@o.health",
4789
+ 0.0
4790
+ ],
4791
+ [
4792
+ "and",
4793
+ [
4794
+ "==",
4795
+ [
4796
+ "object/get",
4797
+ [
4798
+ "object/get",
4799
+ "@o",
4800
+ "position"
4801
+ ],
4802
+ "x"
4803
+ ],
4804
+ "@nextX"
4805
+ ],
4806
+ [
4807
+ "==",
4808
+ [
4809
+ "object/get",
4810
+ [
4811
+ "object/get",
4812
+ "@o",
4813
+ "position"
4814
+ ],
4815
+ "y"
4816
+ ],
4817
+ "@nextY"
4818
+ ]
4819
+ ]
4820
+ ]
4821
+ ]
4822
+ ]
4823
+ ]
4824
+ ],
4825
+ 0.0
4826
+ ]
4212
4827
  ]
4213
- ]
4214
- }
4215
- }
4828
+ ],
4829
+ [
4830
+ "object/merge",
4831
+ "@u",
4832
+ {
4833
+ "position": {
4834
+ "x": "@nextX",
4835
+ "y": "@nextY"
4836
+ }
4837
+ }
4838
+ ],
4839
+ "@u"
4840
+ ]
4841
+ ]
4216
4842
  ]
4217
4843
  ],
4218
4844
  "@u"
@@ -4335,9 +4961,35 @@
4335
4961
  "render-ui",
4336
4962
  "main",
4337
4963
  {
4964
+ "addons": {
4965
+ "children": [
4966
+ {
4967
+ "action": "END_TURN",
4968
+ "label": "End Turn",
4969
+ "type": "button",
4970
+ "variant": "primary"
4971
+ },
4972
+ {
4973
+ "action": "CANCEL",
4974
+ "label": "Cancel",
4975
+ "type": "button",
4976
+ "variant": "secondary"
4977
+ },
4978
+ {
4979
+ "action": "PLAY_AGAIN",
4980
+ "label": "Restart",
4981
+ "type": "button",
4982
+ "variant": "secondary"
4983
+ }
4984
+ ],
4985
+ "direction": "vertical",
4986
+ "gap": "sm",
4987
+ "type": "stack"
4988
+ },
4338
4989
  "children": [
4339
4990
  {
4340
4991
  "attackTargets": "@entity.attackTargets",
4992
+ "events": "@entity.fx",
4341
4993
  "features": "@config.features",
4342
4994
  "scale": "@config.scale",
4343
4995
  "selectedUnitId": "@entity.selectedUnitId",
@@ -4367,6 +5019,41 @@
4367
5019
  ],
4368
5020
  "type": "game-hud"
4369
5021
  },
5022
+ "overlay": [
5023
+ "if",
5024
+ [
5025
+ "!=",
5026
+ "@entity.result",
5027
+ "none"
5028
+ ],
5029
+ {
5030
+ "options": [
5031
+ {
5032
+ "event": "PLAY_AGAIN",
5033
+ "id": "again",
5034
+ "label": "Play Again",
5035
+ "variant": "primary"
5036
+ }
5037
+ ],
5038
+ "subtitle": [
5039
+ "str/concat",
5040
+ "Turn ",
5041
+ "@entity.turn"
5042
+ ],
5043
+ "title": [
5044
+ "if",
5045
+ [
5046
+ "==",
5047
+ "@entity.result",
5048
+ "victory"
5049
+ ],
5050
+ "VICTORY",
5051
+ "DEFEAT"
5052
+ ],
5053
+ "type": "game-menu"
5054
+ },
5055
+ null
5056
+ ],
4370
5057
  "type": "game-shell"
4371
5058
  }
4372
5059
  ]
@@ -4386,6 +5073,128 @@
4386
5073
  ],
4387
5074
  "interval": 1000.0,
4388
5075
  "name": "enemyAiTick"
5076
+ },
5077
+ {
5078
+ "effects": [
5079
+ [
5080
+ "set",
5081
+ "@entity.fx",
5082
+ [
5083
+ "array/filter",
5084
+ [
5085
+ "array/map",
5086
+ "@entity.fx",
5087
+ [
5088
+ "fn",
5089
+ "e",
5090
+ [
5091
+ "object/merge",
5092
+ "@e",
5093
+ {
5094
+ "ttl": [
5095
+ "-",
5096
+ [
5097
+ "object/get",
5098
+ "@e",
5099
+ "ttl"
5100
+ ],
5101
+ 1.0
5102
+ ]
5103
+ }
5104
+ ]
5105
+ ]
5106
+ ],
5107
+ [
5108
+ "fn",
5109
+ "e",
5110
+ [
5111
+ ">",
5112
+ [
5113
+ "object/get",
5114
+ "@e",
5115
+ "ttl"
5116
+ ],
5117
+ 0.0
5118
+ ]
5119
+ ]
5120
+ ]
5121
+ ],
5122
+ [
5123
+ "render-ui",
5124
+ "main",
5125
+ {
5126
+ "addons": {
5127
+ "children": [
5128
+ {
5129
+ "action": "END_TURN",
5130
+ "label": "End Turn",
5131
+ "type": "button",
5132
+ "variant": "primary"
5133
+ },
5134
+ {
5135
+ "action": "CANCEL",
5136
+ "label": "Cancel",
5137
+ "type": "button",
5138
+ "variant": "secondary"
5139
+ },
5140
+ {
5141
+ "action": "PLAY_AGAIN",
5142
+ "label": "Restart",
5143
+ "type": "button",
5144
+ "variant": "secondary"
5145
+ }
5146
+ ],
5147
+ "direction": "vertical",
5148
+ "gap": "sm",
5149
+ "type": "stack"
5150
+ },
5151
+ "children": [
5152
+ {
5153
+ "attackTargets": "@entity.attackTargets",
5154
+ "events": "@entity.fx",
5155
+ "features": "@config.features",
5156
+ "scale": "@config.scale",
5157
+ "selectedUnitId": "@entity.selectedUnitId",
5158
+ "tileClickEvent": "TILE_CLICK",
5159
+ "tiles": "@config.tiles",
5160
+ "type": "game-canvas-3d",
5161
+ "unitClickEvent": "UNIT_CLICK",
5162
+ "unitScale": "@config.unitScale",
5163
+ "units": "@entity.units",
5164
+ "validMoves": "@entity.validMoves"
5165
+ }
5166
+ ],
5167
+ "hud": {
5168
+ "stats": [
5169
+ {
5170
+ "label": "Turn",
5171
+ "value": "@entity.turn"
5172
+ },
5173
+ {
5174
+ "label": "Phase",
5175
+ "value": "@entity.phase"
5176
+ },
5177
+ {
5178
+ "label": "Result",
5179
+ "value": "@entity.result"
5180
+ }
5181
+ ],
5182
+ "type": "game-hud"
5183
+ },
5184
+ "type": "game-shell"
5185
+ }
5186
+ ]
5187
+ ],
5188
+ "guard": [
5189
+ ">",
5190
+ [
5191
+ "array/len",
5192
+ "@entity.fx"
5193
+ ],
5194
+ 0.0
5195
+ ],
5196
+ "interval": 500.0,
5197
+ "name": "fxTick"
4389
5198
  }
4390
5199
  ]
4391
5200
  }