@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",
@@ -856,6 +901,13 @@
856
901
  "tier": "presentation",
857
902
  "type": "SpaceBoard3DAssetManifest"
858
903
  },
904
+ "attackDamage": {
905
+ "default": 3.0,
906
+ "description": "Damage a player unit deals to an adjacent enemy on attack",
907
+ "label": "Attack Damage",
908
+ "tier": "presentation",
909
+ "type": "number"
910
+ },
859
911
  "bgColor": {
860
912
  "default": "#05070f",
861
913
  "description": "Deep-space canvas background color",
@@ -2188,36 +2240,6 @@
2188
2240
  }
2189
2241
  },
2190
2242
  "emits": [
2191
- {
2192
- "description": "-- Callbacks --",
2193
- "event": "ATTACK",
2194
- "payloadSchema": [
2195
- {
2196
- "name": "attacker",
2197
- "type": "object"
2198
- },
2199
- {
2200
- "name": "target",
2201
- "type": "object"
2202
- },
2203
- {
2204
- "name": "damage",
2205
- "type": "number"
2206
- },
2207
- {
2208
- "name": "attackerId",
2209
- "required": true,
2210
- "type": "string"
2211
- },
2212
- {
2213
- "name": "targetId",
2214
- "required": true,
2215
- "type": "string"
2216
- }
2217
- ],
2218
- "scope": "external",
2219
- "tier": "domain"
2220
- },
2221
2243
  {
2222
2244
  "description": "Called when the match ends",
2223
2245
  "event": "GAME_END",
@@ -2343,6 +2365,7 @@
2343
2365
  "attackTargets",
2344
2366
  "currentTeam",
2345
2367
  "enemyTurn",
2368
+ "fx",
2346
2369
  "gridHeight",
2347
2370
  "gridWidth",
2348
2371
  "movementRange",
@@ -2361,10 +2384,6 @@
2361
2384
  "scope": "instance",
2362
2385
  "stateMachine": {
2363
2386
  "events": [
2364
- {
2365
- "key": "START",
2366
- "name": "Start"
2367
- },
2368
2387
  {
2369
2388
  "key": "INIT",
2370
2389
  "name": "Initialize"
@@ -2412,36 +2431,6 @@
2412
2431
  ],
2413
2432
  "tier": "domain"
2414
2433
  },
2415
- {
2416
- "description": "-- Callbacks --",
2417
- "key": "ATTACK",
2418
- "name": "Attack",
2419
- "payloadSchema": [
2420
- {
2421
- "name": "attacker",
2422
- "type": "object"
2423
- },
2424
- {
2425
- "name": "target",
2426
- "type": "object"
2427
- },
2428
- {
2429
- "name": "damage",
2430
- "type": "number"
2431
- },
2432
- {
2433
- "name": "attackerId",
2434
- "required": true,
2435
- "type": "string"
2436
- },
2437
- {
2438
- "name": "targetId",
2439
- "required": true,
2440
- "type": "string"
2441
- }
2442
- ],
2443
- "tier": "domain"
2444
- },
2445
2434
  {
2446
2435
  "description": "Emits UI:{endTurnEvent} with {} on end turn",
2447
2436
  "key": "END_TURN",
@@ -2524,9 +2513,6 @@
2524
2513
  "isInitial": true,
2525
2514
  "name": "playing"
2526
2515
  },
2527
- {
2528
- "name": "menu"
2529
- },
2530
2516
  {
2531
2517
  "name": "gameover"
2532
2518
  }
@@ -2556,94 +2542,7 @@
2556
2542
  ],
2557
2543
  [
2558
2544
  "set",
2559
- "@entity.turn",
2560
- 0.0
2561
- ],
2562
- [
2563
- "set",
2564
- "@entity.result",
2565
- "none"
2566
- ],
2567
- [
2568
- "set",
2569
- "@entity.phase",
2570
- "observation"
2571
- ],
2572
- [
2573
- "set",
2574
- "@entity.currentTeam",
2575
- "player"
2576
- ],
2577
- [
2578
- "set",
2579
- "@entity.enemyTurn",
2580
- false
2581
- ],
2582
- [
2583
- "render-ui",
2584
- "main",
2585
- {
2586
- "children": [
2587
- {
2588
- "attackTargets": "@entity.attackTargets",
2589
- "backgroundColor": "@config.bgColor",
2590
- "features": "@config.features",
2591
- "scale": "@config.scale",
2592
- "selectedUnitId": "@entity.selectedUnitId",
2593
- "tileClickEvent": "TILE_CLICK",
2594
- "tiles": "@config.tiles",
2595
- "type": "game-canvas-3d",
2596
- "unitClickEvent": "UNIT_CLICK",
2597
- "unitScale": "@config.unitScale",
2598
- "units": "@entity.units",
2599
- "validMoves": "@entity.validMoves"
2600
- }
2601
- ],
2602
- "hud": {
2603
- "stats": [
2604
- {
2605
- "label": "Turn",
2606
- "value": "@entity.turn"
2607
- },
2608
- {
2609
- "label": "Phase",
2610
- "value": "@entity.phase"
2611
- },
2612
- {
2613
- "label": "Result",
2614
- "value": "@entity.result"
2615
- }
2616
- ],
2617
- "type": "game-hud"
2618
- },
2619
- "type": "game-shell"
2620
- }
2621
- ]
2622
- ],
2623
- "event": "START",
2624
- "from": "menu",
2625
- "to": "playing"
2626
- },
2627
- {
2628
- "effects": [
2629
- [
2630
- "set",
2631
- "@entity.units",
2632
- "@config.units"
2633
- ],
2634
- [
2635
- "set",
2636
- "@entity.selectedUnitId",
2637
- ""
2638
- ],
2639
- [
2640
- "set",
2641
- "@entity.validMoves",
2642
- []
2643
- ],
2644
- [
2645
- "set",
2646
- "@entity.attackTargets",
2545
+ "@entity.fx",
2647
2546
  []
2648
2547
  ],
2649
2548
  [
@@ -2690,11 +2589,38 @@
2690
2589
  "render-ui",
2691
2590
  "main",
2692
2591
  {
2592
+ "addons": {
2593
+ "children": [
2594
+ {
2595
+ "action": "END_TURN",
2596
+ "label": "End Turn",
2597
+ "type": "button",
2598
+ "variant": "primary"
2599
+ },
2600
+ {
2601
+ "action": "CANCEL",
2602
+ "label": "Cancel",
2603
+ "type": "button",
2604
+ "variant": "secondary"
2605
+ },
2606
+ {
2607
+ "action": "PLAY_AGAIN",
2608
+ "label": "Restart",
2609
+ "type": "button",
2610
+ "variant": "secondary"
2611
+ }
2612
+ ],
2613
+ "direction": "vertical",
2614
+ "gap": "sm",
2615
+ "type": "stack"
2616
+ },
2693
2617
  "children": [
2694
2618
  {
2695
2619
  "attackTargets": "@entity.attackTargets",
2696
2620
  "backgroundColor": "@config.bgColor",
2621
+ "events": "@entity.fx",
2697
2622
  "features": "@config.features",
2623
+ "interpolateUnits": true,
2698
2624
  "scale": "@config.scale",
2699
2625
  "selectedUnitId": "@entity.selectedUnitId",
2700
2626
  "tileClickEvent": "TILE_CLICK",
@@ -2735,29 +2661,373 @@
2735
2661
  "effects": [
2736
2662
  [
2737
2663
  "set",
2738
- "@entity.phase",
2739
- "action"
2664
+ "@entity.units",
2665
+ [
2666
+ "array/map",
2667
+ "@entity.units",
2668
+ [
2669
+ "fn",
2670
+ "u",
2671
+ [
2672
+ "if",
2673
+ [
2674
+ "==",
2675
+ "@u.id",
2676
+ "@payload.unitId"
2677
+ ],
2678
+ [
2679
+ "object/merge",
2680
+ "@u",
2681
+ {
2682
+ "health": [
2683
+ "math/max",
2684
+ 0.0,
2685
+ [
2686
+ "-",
2687
+ "@u.health",
2688
+ "@config.attackDamage"
2689
+ ]
2690
+ ]
2691
+ }
2692
+ ],
2693
+ "@u"
2694
+ ]
2695
+ ]
2696
+ ]
2697
+ ],
2698
+ [
2699
+ "set",
2700
+ "@entity.selectedUnitId",
2701
+ ""
2702
+ ],
2703
+ [
2704
+ "set",
2705
+ "@entity.validMoves",
2706
+ []
2740
2707
  ],
2741
2708
  [
2742
2709
  "set",
2743
2710
  "@entity.attackTargets",
2711
+ []
2712
+ ],
2713
+ [
2714
+ "set",
2715
+ "@entity.phase",
2716
+ "observation"
2717
+ ],
2718
+ [
2719
+ "set",
2720
+ "@entity.result",
2744
2721
  [
2745
- "array/map",
2722
+ "if",
2746
2723
  [
2747
- "array/filter",
2748
- "@entity.units",
2724
+ "==",
2749
2725
  [
2750
- "fn",
2751
- "u",
2726
+ "array/len",
2752
2727
  [
2753
- "and",
2754
- [
2755
- "==",
2756
- "@u.team",
2757
- "enemy"
2758
- ],
2728
+ "array/filter",
2729
+ "@entity.units",
2759
2730
  [
2760
- ">",
2731
+ "fn",
2732
+ "u",
2733
+ [
2734
+ "and",
2735
+ [
2736
+ "==",
2737
+ "@u.team",
2738
+ "enemy"
2739
+ ],
2740
+ [
2741
+ ">",
2742
+ "@u.health",
2743
+ 0.0
2744
+ ]
2745
+ ]
2746
+ ]
2747
+ ]
2748
+ ],
2749
+ 0.0
2750
+ ],
2751
+ "victory",
2752
+ "none"
2753
+ ]
2754
+ ],
2755
+ [
2756
+ "if",
2757
+ [
2758
+ "!=",
2759
+ "@entity.result",
2760
+ "none"
2761
+ ],
2762
+ [
2763
+ "emit",
2764
+ "GAME_END",
2765
+ {
2766
+ "result": "@entity.result"
2767
+ }
2768
+ ],
2769
+ null
2770
+ ],
2771
+ [
2772
+ "set",
2773
+ "@entity.fx",
2774
+ [
2775
+ "array/append",
2776
+ "@entity.fx",
2777
+ {
2778
+ "id": [
2779
+ "str/concat",
2780
+ "fx-atk-",
2781
+ "@entity.turn"
2782
+ ],
2783
+ "message": [
2784
+ "str/concat",
2785
+ "-",
2786
+ "@config.attackDamage"
2787
+ ],
2788
+ "ttl": 3.0,
2789
+ "type": "hit",
2790
+ "x": [
2791
+ "object/get",
2792
+ [
2793
+ "object/get",
2794
+ [
2795
+ "array/find",
2796
+ "@entity.units",
2797
+ [
2798
+ "fn",
2799
+ "u",
2800
+ [
2801
+ "==",
2802
+ "@u.id",
2803
+ "@payload.unitId"
2804
+ ]
2805
+ ]
2806
+ ],
2807
+ "position"
2808
+ ],
2809
+ "x"
2810
+ ],
2811
+ "z": [
2812
+ "object/get",
2813
+ [
2814
+ "object/get",
2815
+ [
2816
+ "array/find",
2817
+ "@entity.units",
2818
+ [
2819
+ "fn",
2820
+ "u",
2821
+ [
2822
+ "==",
2823
+ "@u.id",
2824
+ "@payload.unitId"
2825
+ ]
2826
+ ]
2827
+ ],
2828
+ "position"
2829
+ ],
2830
+ "y"
2831
+ ]
2832
+ }
2833
+ ]
2834
+ ],
2835
+ [
2836
+ "render-ui",
2837
+ "main",
2838
+ {
2839
+ "addons": {
2840
+ "children": [
2841
+ {
2842
+ "action": "END_TURN",
2843
+ "label": "End Turn",
2844
+ "type": "button",
2845
+ "variant": "primary"
2846
+ },
2847
+ {
2848
+ "action": "CANCEL",
2849
+ "label": "Cancel",
2850
+ "type": "button",
2851
+ "variant": "secondary"
2852
+ },
2853
+ {
2854
+ "action": "PLAY_AGAIN",
2855
+ "label": "Restart",
2856
+ "type": "button",
2857
+ "variant": "secondary"
2858
+ }
2859
+ ],
2860
+ "direction": "vertical",
2861
+ "gap": "sm",
2862
+ "type": "stack"
2863
+ },
2864
+ "children": [
2865
+ {
2866
+ "attackTargets": "@entity.attackTargets",
2867
+ "backgroundColor": "@config.bgColor",
2868
+ "events": "@entity.fx",
2869
+ "features": "@config.features",
2870
+ "interpolateUnits": true,
2871
+ "scale": "@config.scale",
2872
+ "selectedUnitId": "@entity.selectedUnitId",
2873
+ "tileClickEvent": "TILE_CLICK",
2874
+ "tiles": "@config.tiles",
2875
+ "type": "game-canvas-3d",
2876
+ "unitClickEvent": "UNIT_CLICK",
2877
+ "unitScale": "@config.unitScale",
2878
+ "units": "@entity.units",
2879
+ "validMoves": "@entity.validMoves"
2880
+ }
2881
+ ],
2882
+ "hud": {
2883
+ "stats": [
2884
+ {
2885
+ "label": "Turn",
2886
+ "value": "@entity.turn"
2887
+ },
2888
+ {
2889
+ "label": "Phase",
2890
+ "value": "@entity.phase"
2891
+ },
2892
+ {
2893
+ "label": "Result",
2894
+ "value": "@entity.result"
2895
+ }
2896
+ ],
2897
+ "type": "game-hud"
2898
+ },
2899
+ "type": "game-shell"
2900
+ }
2901
+ ]
2902
+ ],
2903
+ "event": "UNIT_CLICK",
2904
+ "from": "playing",
2905
+ "guard": [
2906
+ "and",
2907
+ [
2908
+ "==",
2909
+ "@entity.phase",
2910
+ "action"
2911
+ ],
2912
+ [
2913
+ "and",
2914
+ [
2915
+ "==",
2916
+ [
2917
+ "object/get",
2918
+ [
2919
+ "array/find",
2920
+ "@entity.units",
2921
+ [
2922
+ "fn",
2923
+ "u",
2924
+ [
2925
+ "==",
2926
+ "@u.id",
2927
+ "@payload.unitId"
2928
+ ]
2929
+ ]
2930
+ ],
2931
+ "team"
2932
+ ],
2933
+ "enemy"
2934
+ ],
2935
+ [
2936
+ "and",
2937
+ [
2938
+ ">",
2939
+ [
2940
+ "object/get",
2941
+ [
2942
+ "array/find",
2943
+ "@entity.units",
2944
+ [
2945
+ "fn",
2946
+ "u",
2947
+ [
2948
+ "==",
2949
+ "@u.id",
2950
+ "@payload.unitId"
2951
+ ]
2952
+ ]
2953
+ ],
2954
+ "health"
2955
+ ],
2956
+ 0.0
2957
+ ],
2958
+ [
2959
+ "<=",
2960
+ [
2961
+ "grid/manhattan-distance",
2962
+ [
2963
+ "object/get",
2964
+ [
2965
+ "array/find",
2966
+ "@entity.units",
2967
+ [
2968
+ "fn",
2969
+ "u",
2970
+ [
2971
+ "==",
2972
+ "@u.id",
2973
+ "@entity.selectedUnitId"
2974
+ ]
2975
+ ]
2976
+ ],
2977
+ "position"
2978
+ ],
2979
+ [
2980
+ "object/get",
2981
+ [
2982
+ "array/find",
2983
+ "@entity.units",
2984
+ [
2985
+ "fn",
2986
+ "u",
2987
+ [
2988
+ "==",
2989
+ "@u.id",
2990
+ "@payload.unitId"
2991
+ ]
2992
+ ]
2993
+ ],
2994
+ "position"
2995
+ ]
2996
+ ],
2997
+ 1.0
2998
+ ]
2999
+ ]
3000
+ ]
3001
+ ],
3002
+ "to": "playing"
3003
+ },
3004
+ {
3005
+ "effects": [
3006
+ [
3007
+ "set",
3008
+ "@entity.phase",
3009
+ "action"
3010
+ ],
3011
+ [
3012
+ "set",
3013
+ "@entity.attackTargets",
3014
+ [
3015
+ "array/map",
3016
+ [
3017
+ "array/filter",
3018
+ "@entity.units",
3019
+ [
3020
+ "fn",
3021
+ "u",
3022
+ [
3023
+ "and",
3024
+ [
3025
+ "==",
3026
+ "@u.team",
3027
+ "enemy"
3028
+ ],
3029
+ [
3030
+ ">",
2761
3031
  "@u.health",
2762
3032
  0.0
2763
3033
  ],
@@ -2823,11 +3093,38 @@
2823
3093
  "render-ui",
2824
3094
  "main",
2825
3095
  {
3096
+ "addons": {
3097
+ "children": [
3098
+ {
3099
+ "action": "END_TURN",
3100
+ "label": "End Turn",
3101
+ "type": "button",
3102
+ "variant": "primary"
3103
+ },
3104
+ {
3105
+ "action": "CANCEL",
3106
+ "label": "Cancel",
3107
+ "type": "button",
3108
+ "variant": "secondary"
3109
+ },
3110
+ {
3111
+ "action": "PLAY_AGAIN",
3112
+ "label": "Restart",
3113
+ "type": "button",
3114
+ "variant": "secondary"
3115
+ }
3116
+ ],
3117
+ "direction": "vertical",
3118
+ "gap": "sm",
3119
+ "type": "stack"
3120
+ },
2826
3121
  "children": [
2827
3122
  {
2828
3123
  "attackTargets": "@entity.attackTargets",
2829
3124
  "backgroundColor": "@config.bgColor",
3125
+ "events": "@entity.fx",
2830
3126
  "features": "@config.features",
3127
+ "interpolateUnits": true,
2831
3128
  "scale": "@config.scale",
2832
3129
  "selectedUnitId": "@entity.selectedUnitId",
2833
3130
  "tileClickEvent": "TILE_CLICK",
@@ -3045,11 +3342,38 @@
3045
3342
  "render-ui",
3046
3343
  "main",
3047
3344
  {
3345
+ "addons": {
3346
+ "children": [
3347
+ {
3348
+ "action": "END_TURN",
3349
+ "label": "End Turn",
3350
+ "type": "button",
3351
+ "variant": "primary"
3352
+ },
3353
+ {
3354
+ "action": "CANCEL",
3355
+ "label": "Cancel",
3356
+ "type": "button",
3357
+ "variant": "secondary"
3358
+ },
3359
+ {
3360
+ "action": "PLAY_AGAIN",
3361
+ "label": "Restart",
3362
+ "type": "button",
3363
+ "variant": "secondary"
3364
+ }
3365
+ ],
3366
+ "direction": "vertical",
3367
+ "gap": "sm",
3368
+ "type": "stack"
3369
+ },
3048
3370
  "children": [
3049
3371
  {
3050
3372
  "attackTargets": "@entity.attackTargets",
3051
3373
  "backgroundColor": "@config.bgColor",
3374
+ "events": "@entity.fx",
3052
3375
  "features": "@config.features",
3376
+ "interpolateUnits": true,
3053
3377
  "scale": "@config.scale",
3054
3378
  "selectedUnitId": "@entity.selectedUnitId",
3055
3379
  "tileClickEvent": "TILE_CLICK",
@@ -3164,213 +3488,38 @@
3164
3488
  "render-ui",
3165
3489
  "main",
3166
3490
  {
3167
- "children": [
3168
- {
3169
- "attackTargets": "@entity.attackTargets",
3170
- "backgroundColor": "@config.bgColor",
3171
- "features": "@config.features",
3172
- "scale": "@config.scale",
3173
- "selectedUnitId": "@entity.selectedUnitId",
3174
- "tileClickEvent": "TILE_CLICK",
3175
- "tiles": "@config.tiles",
3176
- "type": "game-canvas-3d",
3177
- "unitClickEvent": "UNIT_CLICK",
3178
- "unitScale": "@config.unitScale",
3179
- "units": "@entity.units",
3180
- "validMoves": "@entity.validMoves"
3181
- }
3182
- ],
3183
- "hud": {
3184
- "stats": [
3491
+ "addons": {
3492
+ "children": [
3185
3493
  {
3186
- "label": "Turn",
3187
- "value": "@entity.turn"
3494
+ "action": "END_TURN",
3495
+ "label": "End Turn",
3496
+ "type": "button",
3497
+ "variant": "primary"
3188
3498
  },
3189
3499
  {
3190
- "label": "Phase",
3191
- "value": "@entity.phase"
3500
+ "action": "CANCEL",
3501
+ "label": "Cancel",
3502
+ "type": "button",
3503
+ "variant": "secondary"
3192
3504
  },
3193
3505
  {
3194
- "label": "Result",
3195
- "value": "@entity.result"
3506
+ "action": "PLAY_AGAIN",
3507
+ "label": "Restart",
3508
+ "type": "button",
3509
+ "variant": "secondary"
3196
3510
  }
3197
3511
  ],
3198
- "type": "game-hud"
3199
- },
3200
- "type": "game-shell"
3201
- }
3202
- ]
3203
- ],
3204
- "event": "TILE_CLICK",
3205
- "from": "playing",
3206
- "guard": [
3207
- "and",
3208
- [
3209
- "!=",
3210
- "@entity.selectedUnitId",
3211
- ""
3212
- ],
3213
- [
3214
- "and",
3215
- [
3216
- "grid/in-bounds",
3217
- {
3218
- "x": "@payload.x",
3219
- "y": "@payload.z"
3512
+ "direction": "vertical",
3513
+ "gap": "sm",
3514
+ "type": "stack"
3220
3515
  },
3221
- "@entity.gridWidth",
3222
- "@entity.gridHeight"
3223
- ],
3224
- [
3225
- "and",
3226
- [
3227
- "<=",
3228
- [
3229
- "grid/manhattan-distance",
3230
- [
3231
- "object/get",
3232
- [
3233
- "array/find",
3234
- "@entity.units",
3235
- [
3236
- "fn",
3237
- "u",
3238
- [
3239
- "==",
3240
- "@u.id",
3241
- "@entity.selectedUnitId"
3242
- ]
3243
- ]
3244
- ],
3245
- "position"
3246
- ],
3247
- {
3248
- "x": "@payload.x",
3249
- "y": "@payload.z"
3250
- }
3251
- ],
3252
- "@entity.movementRange"
3253
- ],
3254
- [
3255
- "==",
3256
- [
3257
- "array/len",
3258
- [
3259
- "array/filter",
3260
- "@entity.units",
3261
- [
3262
- "fn",
3263
- "u",
3264
- [
3265
- "and",
3266
- [
3267
- "==",
3268
- [
3269
- "object/get",
3270
- [
3271
- "object/get",
3272
- "@u",
3273
- "position"
3274
- ],
3275
- "x"
3276
- ],
3277
- "@payload.x"
3278
- ],
3279
- [
3280
- "==",
3281
- [
3282
- "object/get",
3283
- [
3284
- "object/get",
3285
- "@u",
3286
- "position"
3287
- ],
3288
- "y"
3289
- ],
3290
- "@payload.z"
3291
- ]
3292
- ]
3293
- ]
3294
- ]
3295
- ],
3296
- 0.0
3297
- ]
3298
- ]
3299
- ]
3300
- ],
3301
- "to": "playing"
3302
- },
3303
- {
3304
- "effects": [
3305
- [
3306
- "set",
3307
- "@entity.units",
3308
- [
3309
- "array/map",
3310
- "@entity.units",
3311
- [
3312
- "fn",
3313
- "u",
3314
- [
3315
- "if",
3316
- [
3317
- "==",
3318
- "@u.id",
3319
- "@payload.targetId"
3320
- ],
3321
- [
3322
- "object/merge",
3323
- "@u",
3324
- {
3325
- "health": [
3326
- "math/max",
3327
- 0.0,
3328
- [
3329
- "-",
3330
- [
3331
- "object/get",
3332
- "@u",
3333
- "health"
3334
- ],
3335
- "@payload.damage"
3336
- ]
3337
- ]
3338
- }
3339
- ],
3340
- "@u"
3341
- ]
3342
- ]
3343
- ]
3344
- ],
3345
- [
3346
- "set",
3347
- "@entity.selectedUnitId",
3348
- ""
3349
- ],
3350
- [
3351
- "set",
3352
- "@entity.validMoves",
3353
- []
3354
- ],
3355
- [
3356
- "set",
3357
- "@entity.attackTargets",
3358
- []
3359
- ],
3360
- [
3361
- "set",
3362
- "@entity.phase",
3363
- "observation"
3364
- ],
3365
- [
3366
- "render-ui",
3367
- "main",
3368
- {
3369
3516
  "children": [
3370
3517
  {
3371
3518
  "attackTargets": "@entity.attackTargets",
3372
3519
  "backgroundColor": "@config.bgColor",
3520
+ "events": "@entity.fx",
3373
3521
  "features": "@config.features",
3522
+ "interpolateUnits": true,
3374
3523
  "scale": "@config.scale",
3375
3524
  "selectedUnitId": "@entity.selectedUnitId",
3376
3525
  "tileClickEvent": "TILE_CLICK",
@@ -3400,103 +3549,102 @@
3400
3549
  "type": "game-hud"
3401
3550
  },
3402
3551
  "type": "game-shell"
3403
- }
3404
- ]
3405
- ],
3406
- "event": "ATTACK",
3407
- "from": "playing",
3408
- "guard": [
3409
- "let",
3410
- [
3411
- [
3412
- "ap",
3413
- [
3414
- "object/get",
3415
- [
3416
- "array/find",
3417
- "@entity.units",
3418
- [
3419
- "fn",
3420
- "u",
3421
- [
3422
- "==",
3423
- "@u.id",
3424
- "@payload.attackerId"
3425
- ]
3426
- ]
3427
- ],
3428
- "position"
3429
- ]
3430
- ],
3431
- [
3432
- "tp",
3433
- [
3434
- "object/get",
3435
- [
3436
- "array/find",
3437
- "@entity.units",
3438
- [
3439
- "fn",
3440
- "u",
3441
- [
3442
- "==",
3443
- "@u.id",
3444
- "@payload.targetId"
3445
- ]
3446
- ]
3447
- ],
3448
- "position"
3449
- ]
3450
- ]
3552
+ }
3553
+ ]
3554
+ ],
3555
+ "event": "TILE_CLICK",
3556
+ "from": "playing",
3557
+ "guard": [
3558
+ "and",
3559
+ [
3560
+ "!=",
3561
+ "@entity.selectedUnitId",
3562
+ ""
3451
3563
  ],
3452
3564
  [
3453
3565
  "and",
3454
3566
  [
3455
- "<=",
3456
- [
3457
- "math/abs",
3458
- [
3459
- "-",
3460
- [
3461
- "object/get",
3462
- "@ap",
3463
- "x"
3464
- ],
3465
- [
3466
- "object/get",
3467
- "@tp",
3468
- "x"
3469
- ]
3470
- ]
3471
- ],
3472
- 1.0
3567
+ "grid/in-bounds",
3568
+ {
3569
+ "x": "@payload.x",
3570
+ "y": "@payload.z"
3571
+ },
3572
+ "@entity.gridWidth",
3573
+ "@entity.gridHeight"
3473
3574
  ],
3474
3575
  [
3475
3576
  "and",
3476
3577
  [
3477
3578
  "<=",
3478
3579
  [
3479
- "math/abs",
3580
+ "grid/manhattan-distance",
3480
3581
  [
3481
- "-",
3582
+ "object/get",
3482
3583
  [
3483
- "object/get",
3484
- "@ap",
3485
- "y"
3584
+ "array/find",
3585
+ "@entity.units",
3586
+ [
3587
+ "fn",
3588
+ "u",
3589
+ [
3590
+ "==",
3591
+ "@u.id",
3592
+ "@entity.selectedUnitId"
3593
+ ]
3594
+ ]
3486
3595
  ],
3596
+ "position"
3597
+ ],
3598
+ {
3599
+ "x": "@payload.x",
3600
+ "y": "@payload.z"
3601
+ }
3602
+ ],
3603
+ "@entity.movementRange"
3604
+ ],
3605
+ [
3606
+ "==",
3607
+ [
3608
+ "array/len",
3609
+ [
3610
+ "array/filter",
3611
+ "@entity.units",
3487
3612
  [
3488
- "object/get",
3489
- "@tp",
3490
- "y"
3613
+ "fn",
3614
+ "u",
3615
+ [
3616
+ "and",
3617
+ [
3618
+ "==",
3619
+ [
3620
+ "object/get",
3621
+ [
3622
+ "object/get",
3623
+ "@u",
3624
+ "position"
3625
+ ],
3626
+ "x"
3627
+ ],
3628
+ "@payload.x"
3629
+ ],
3630
+ [
3631
+ "==",
3632
+ [
3633
+ "object/get",
3634
+ [
3635
+ "object/get",
3636
+ "@u",
3637
+ "position"
3638
+ ],
3639
+ "y"
3640
+ ],
3641
+ "@payload.z"
3642
+ ]
3643
+ ]
3491
3644
  ]
3492
3645
  ]
3493
3646
  ],
3494
- 1.0
3495
- ],
3496
- [
3497
- "!=",
3498
- "@ap",
3499
- "@tp"
3647
+ 0.0
3500
3648
  ]
3501
3649
  ]
3502
3650
  ]
@@ -3548,11 +3696,38 @@
3548
3696
  "render-ui",
3549
3697
  "main",
3550
3698
  {
3699
+ "addons": {
3700
+ "children": [
3701
+ {
3702
+ "action": "END_TURN",
3703
+ "label": "End Turn",
3704
+ "type": "button",
3705
+ "variant": "primary"
3706
+ },
3707
+ {
3708
+ "action": "CANCEL",
3709
+ "label": "Cancel",
3710
+ "type": "button",
3711
+ "variant": "secondary"
3712
+ },
3713
+ {
3714
+ "action": "PLAY_AGAIN",
3715
+ "label": "Restart",
3716
+ "type": "button",
3717
+ "variant": "secondary"
3718
+ }
3719
+ ],
3720
+ "direction": "vertical",
3721
+ "gap": "sm",
3722
+ "type": "stack"
3723
+ },
3551
3724
  "children": [
3552
3725
  {
3553
3726
  "attackTargets": "@entity.attackTargets",
3554
3727
  "backgroundColor": "@config.bgColor",
3728
+ "events": "@entity.fx",
3555
3729
  "features": "@config.features",
3730
+ "interpolateUnits": true,
3556
3731
  "scale": "@config.scale",
3557
3732
  "selectedUnitId": "@entity.selectedUnitId",
3558
3733
  "tileClickEvent": "TILE_CLICK",
@@ -3620,11 +3795,38 @@
3620
3795
  "render-ui",
3621
3796
  "main",
3622
3797
  {
3798
+ "addons": {
3799
+ "children": [
3800
+ {
3801
+ "action": "END_TURN",
3802
+ "label": "End Turn",
3803
+ "type": "button",
3804
+ "variant": "primary"
3805
+ },
3806
+ {
3807
+ "action": "CANCEL",
3808
+ "label": "Cancel",
3809
+ "type": "button",
3810
+ "variant": "secondary"
3811
+ },
3812
+ {
3813
+ "action": "PLAY_AGAIN",
3814
+ "label": "Restart",
3815
+ "type": "button",
3816
+ "variant": "secondary"
3817
+ }
3818
+ ],
3819
+ "direction": "vertical",
3820
+ "gap": "sm",
3821
+ "type": "stack"
3822
+ },
3623
3823
  "children": [
3624
3824
  {
3625
3825
  "attackTargets": "@entity.attackTargets",
3626
3826
  "backgroundColor": "@config.bgColor",
3827
+ "events": "@entity.fx",
3627
3828
  "features": "@config.features",
3829
+ "interpolateUnits": true,
3628
3830
  "scale": "@config.scale",
3629
3831
  "selectedUnitId": "@entity.selectedUnitId",
3630
3832
  "tileClickEvent": "TILE_CLICK",
@@ -3749,11 +3951,38 @@
3749
3951
  "render-ui",
3750
3952
  "main",
3751
3953
  {
3954
+ "addons": {
3955
+ "children": [
3956
+ {
3957
+ "action": "END_TURN",
3958
+ "label": "End Turn",
3959
+ "type": "button",
3960
+ "variant": "primary"
3961
+ },
3962
+ {
3963
+ "action": "CANCEL",
3964
+ "label": "Cancel",
3965
+ "type": "button",
3966
+ "variant": "secondary"
3967
+ },
3968
+ {
3969
+ "action": "PLAY_AGAIN",
3970
+ "label": "Restart",
3971
+ "type": "button",
3972
+ "variant": "secondary"
3973
+ }
3974
+ ],
3975
+ "direction": "vertical",
3976
+ "gap": "sm",
3977
+ "type": "stack"
3978
+ },
3752
3979
  "children": [
3753
3980
  {
3754
3981
  "attackTargets": "@entity.attackTargets",
3755
3982
  "backgroundColor": "@config.bgColor",
3983
+ "events": "@entity.fx",
3756
3984
  "features": "@config.features",
3985
+ "interpolateUnits": true,
3757
3986
  "scale": "@config.scale",
3758
3987
  "selectedUnitId": "@entity.selectedUnitId",
3759
3988
  "tileClickEvent": "TILE_CLICK",
@@ -3782,6 +4011,41 @@
3782
4011
  ],
3783
4012
  "type": "game-hud"
3784
4013
  },
4014
+ "overlay": [
4015
+ "if",
4016
+ [
4017
+ "!=",
4018
+ "@entity.result",
4019
+ "none"
4020
+ ],
4021
+ {
4022
+ "options": [
4023
+ {
4024
+ "event": "PLAY_AGAIN",
4025
+ "id": "again",
4026
+ "label": "Play Again",
4027
+ "variant": "primary"
4028
+ }
4029
+ ],
4030
+ "subtitle": [
4031
+ "str/concat",
4032
+ "Turn ",
4033
+ "@entity.turn"
4034
+ ],
4035
+ "title": [
4036
+ "if",
4037
+ [
4038
+ "==",
4039
+ "@entity.result",
4040
+ "victory"
4041
+ ],
4042
+ "VICTORY",
4043
+ "DEFEAT"
4044
+ ],
4045
+ "type": "game-menu"
4046
+ },
4047
+ null
4048
+ ],
3785
4049
  "type": "game-shell"
3786
4050
  }
3787
4051
  ]
@@ -3879,6 +4143,11 @@
3879
4143
  "@entity.attackTargets",
3880
4144
  []
3881
4145
  ],
4146
+ [
4147
+ "set",
4148
+ "@entity.fx",
4149
+ []
4150
+ ],
3882
4151
  [
3883
4152
  "set",
3884
4153
  "@entity.turn",
@@ -3908,11 +4177,38 @@
3908
4177
  "render-ui",
3909
4178
  "main",
3910
4179
  {
4180
+ "addons": {
4181
+ "children": [
4182
+ {
4183
+ "action": "END_TURN",
4184
+ "label": "End Turn",
4185
+ "type": "button",
4186
+ "variant": "primary"
4187
+ },
4188
+ {
4189
+ "action": "CANCEL",
4190
+ "label": "Cancel",
4191
+ "type": "button",
4192
+ "variant": "secondary"
4193
+ },
4194
+ {
4195
+ "action": "PLAY_AGAIN",
4196
+ "label": "Restart",
4197
+ "type": "button",
4198
+ "variant": "secondary"
4199
+ }
4200
+ ],
4201
+ "direction": "vertical",
4202
+ "gap": "sm",
4203
+ "type": "stack"
4204
+ },
3911
4205
  "children": [
3912
4206
  {
3913
4207
  "attackTargets": "@entity.attackTargets",
3914
4208
  "backgroundColor": "@config.bgColor",
4209
+ "events": "@entity.fx",
3915
4210
  "features": "@config.features",
4211
+ "interpolateUnits": true,
3916
4212
  "scale": "@config.scale",
3917
4213
  "selectedUnitId": "@entity.selectedUnitId",
3918
4214
  "tileClickEvent": "TILE_CLICK",
@@ -3941,19 +4237,169 @@
3941
4237
  ],
3942
4238
  "type": "game-hud"
3943
4239
  },
4240
+ "overlay": [
4241
+ "if",
4242
+ [
4243
+ "!=",
4244
+ "@entity.result",
4245
+ "none"
4246
+ ],
4247
+ {
4248
+ "options": [
4249
+ {
4250
+ "event": "PLAY_AGAIN",
4251
+ "id": "again",
4252
+ "label": "Play Again",
4253
+ "variant": "primary"
4254
+ }
4255
+ ],
4256
+ "subtitle": [
4257
+ "str/concat",
4258
+ "Turn ",
4259
+ "@entity.turn"
4260
+ ],
4261
+ "title": [
4262
+ "if",
4263
+ [
4264
+ "==",
4265
+ "@entity.result",
4266
+ "victory"
4267
+ ],
4268
+ "VICTORY",
4269
+ "DEFEAT"
4270
+ ],
4271
+ "type": "game-menu"
4272
+ },
4273
+ null
4274
+ ],
3944
4275
  "type": "game-shell"
3945
4276
  }
3946
4277
  ]
3947
4278
  ],
3948
- "event": "PLAY_AGAIN",
3949
- "from": "gameover",
3950
- "to": "menu"
3951
- }
3952
- ]
3953
- },
3954
- "ticks": [
3955
- {
3956
- "effects": [
4279
+ "event": "PLAY_AGAIN",
4280
+ "from": "gameover",
4281
+ "to": "playing"
4282
+ }
4283
+ ]
4284
+ },
4285
+ "ticks": [
4286
+ {
4287
+ "effects": [
4288
+ [
4289
+ "set",
4290
+ "@entity.fx",
4291
+ [
4292
+ "array/concat",
4293
+ "@entity.fx",
4294
+ [
4295
+ "array/map",
4296
+ [
4297
+ "array/filter",
4298
+ "@entity.units",
4299
+ [
4300
+ "fn",
4301
+ "u",
4302
+ [
4303
+ "and",
4304
+ [
4305
+ "and",
4306
+ [
4307
+ "==",
4308
+ "@u.team",
4309
+ "player"
4310
+ ],
4311
+ [
4312
+ ">",
4313
+ "@u.health",
4314
+ 0.0
4315
+ ]
4316
+ ],
4317
+ [
4318
+ ">",
4319
+ [
4320
+ "array/len",
4321
+ [
4322
+ "array/filter",
4323
+ "@entity.units",
4324
+ [
4325
+ "fn",
4326
+ "e",
4327
+ [
4328
+ "and",
4329
+ [
4330
+ "and",
4331
+ [
4332
+ "==",
4333
+ "@e.team",
4334
+ "enemy"
4335
+ ],
4336
+ [
4337
+ ">",
4338
+ "@e.health",
4339
+ 0.0
4340
+ ]
4341
+ ],
4342
+ [
4343
+ "==",
4344
+ [
4345
+ "grid/manhattan-distance",
4346
+ [
4347
+ "object/get",
4348
+ "@e",
4349
+ "position"
4350
+ ],
4351
+ [
4352
+ "object/get",
4353
+ "@u",
4354
+ "position"
4355
+ ]
4356
+ ],
4357
+ 1.0
4358
+ ]
4359
+ ]
4360
+ ]
4361
+ ]
4362
+ ],
4363
+ 0.0
4364
+ ]
4365
+ ]
4366
+ ]
4367
+ ],
4368
+ [
4369
+ "fn",
4370
+ "u",
4371
+ {
4372
+ "id": [
4373
+ "str/concat",
4374
+ "fx-ai-",
4375
+ "@u.id"
4376
+ ],
4377
+ "message": "-1",
4378
+ "ttl": 3.0,
4379
+ "type": "hit",
4380
+ "x": [
4381
+ "object/get",
4382
+ [
4383
+ "object/get",
4384
+ "@u",
4385
+ "position"
4386
+ ],
4387
+ "x"
4388
+ ],
4389
+ "z": [
4390
+ "object/get",
4391
+ [
4392
+ "object/get",
4393
+ "@u",
4394
+ "position"
4395
+ ],
4396
+ "y"
4397
+ ]
4398
+ }
4399
+ ]
4400
+ ]
4401
+ ]
4402
+ ],
3957
4403
  [
3958
4404
  "set",
3959
4405
  "@entity.units",
@@ -4130,7 +4576,7 @@
4130
4576
  [
4131
4577
  "target",
4132
4578
  [
4133
- "array/first",
4579
+ "array/reduce",
4134
4580
  [
4135
4581
  "array/filter",
4136
4582
  "@entity.units",
@@ -4151,107 +4597,295 @@
4151
4597
  ]
4152
4598
  ]
4153
4599
  ]
4154
- ]
4155
- ]
4156
- ]
4157
- ],
4158
- [
4159
- "object/merge",
4160
- "@u",
4161
- {
4162
- "position": {
4163
- "x": [
4164
- "math/clamp",
4600
+ ],
4601
+ [
4602
+ "fn",
4165
4603
  [
4166
- "+",
4604
+ "nearest",
4605
+ "p"
4606
+ ],
4607
+ [
4608
+ "if",
4167
4609
  [
4168
- "object/get",
4610
+ "or",
4169
4611
  [
4170
- "object/get",
4171
- "@u",
4172
- "position"
4612
+ "==",
4613
+ "@nearest",
4614
+ null
4173
4615
  ],
4174
- "x"
4175
- ],
4176
- [
4177
- "math/sign",
4178
4616
  [
4179
- "-",
4617
+ "<",
4180
4618
  [
4181
- "object/get",
4619
+ "grid/manhattan-distance",
4182
4620
  [
4183
4621
  "object/get",
4184
- "@target",
4622
+ "@p",
4185
4623
  "position"
4186
4624
  ],
4187
- "x"
4625
+ [
4626
+ "object/get",
4627
+ "@u",
4628
+ "position"
4629
+ ]
4188
4630
  ],
4189
4631
  [
4190
- "object/get",
4632
+ "grid/manhattan-distance",
4191
4633
  [
4192
4634
  "object/get",
4193
- "@u",
4635
+ "@nearest",
4194
4636
  "position"
4195
4637
  ],
4196
- "x"
4638
+ [
4639
+ "object/get",
4640
+ "@u",
4641
+ "position"
4642
+ ]
4197
4643
  ]
4198
4644
  ]
4199
- ]
4200
- ],
4201
- 0.0,
4202
- [
4203
- "-",
4204
- "@entity.gridWidth",
4205
- 1.0
4645
+ ],
4646
+ "@p",
4647
+ "@nearest"
4206
4648
  ]
4207
4649
  ],
4208
- "y": [
4209
- "math/clamp",
4650
+ null
4651
+ ]
4652
+ ]
4653
+ ],
4654
+ [
4655
+ "if",
4656
+ [
4657
+ "==",
4658
+ "@target",
4659
+ null
4660
+ ],
4661
+ "@u",
4662
+ [
4663
+ "let",
4664
+ [
4665
+ [
4666
+ "nextX",
4210
4667
  [
4211
- "+",
4668
+ "math/clamp",
4212
4669
  [
4213
- "object/get",
4670
+ "+",
4214
4671
  [
4215
4672
  "object/get",
4216
- "@u",
4217
- "position"
4673
+ [
4674
+ "object/get",
4675
+ "@u",
4676
+ "position"
4677
+ ],
4678
+ "x"
4218
4679
  ],
4219
- "y"
4220
- ],
4221
- [
4222
- "math/sign",
4223
4680
  [
4224
- "-",
4681
+ "math/sign",
4225
4682
  [
4226
- "object/get",
4683
+ "-",
4227
4684
  [
4228
4685
  "object/get",
4229
- "@target",
4230
- "position"
4686
+ [
4687
+ "object/get",
4688
+ "@target",
4689
+ "position"
4690
+ ],
4691
+ "x"
4231
4692
  ],
4232
- "y"
4233
- ],
4693
+ [
4694
+ "object/get",
4695
+ [
4696
+ "object/get",
4697
+ "@u",
4698
+ "position"
4699
+ ],
4700
+ "x"
4701
+ ]
4702
+ ]
4703
+ ]
4704
+ ],
4705
+ 0.0,
4706
+ [
4707
+ "-",
4708
+ "@entity.gridWidth",
4709
+ 1.0
4710
+ ]
4711
+ ]
4712
+ ],
4713
+ [
4714
+ "nextY",
4715
+ [
4716
+ "math/clamp",
4717
+ [
4718
+ "+",
4719
+ [
4720
+ "object/get",
4234
4721
  [
4235
4722
  "object/get",
4723
+ "@u",
4724
+ "position"
4725
+ ],
4726
+ "y"
4727
+ ],
4728
+ [
4729
+ "math/sign",
4730
+ [
4731
+ "-",
4236
4732
  [
4237
4733
  "object/get",
4238
- "@u",
4239
- "position"
4734
+ [
4735
+ "object/get",
4736
+ "@target",
4737
+ "position"
4738
+ ],
4739
+ "y"
4240
4740
  ],
4241
- "y"
4741
+ [
4742
+ "object/get",
4743
+ [
4744
+ "object/get",
4745
+ "@u",
4746
+ "position"
4747
+ ],
4748
+ "y"
4749
+ ]
4242
4750
  ]
4243
4751
  ]
4752
+ ],
4753
+ 0.0,
4754
+ [
4755
+ "-",
4756
+ "@entity.gridHeight",
4757
+ 1.0
4244
4758
  ]
4759
+ ]
4760
+ ]
4761
+ ],
4762
+ [
4763
+ "if",
4764
+ [
4765
+ "and",
4766
+ [
4767
+ "grid/in-bounds",
4768
+ {
4769
+ "x": "@nextX",
4770
+ "y": "@nextY"
4771
+ },
4772
+ "@entity.gridWidth",
4773
+ "@entity.gridHeight"
4245
4774
  ],
4246
- 0.0,
4247
4775
  [
4248
- "-",
4249
- "@entity.gridHeight",
4250
- 1.0
4776
+ "and",
4777
+ [
4778
+ "==",
4779
+ [
4780
+ "object/get",
4781
+ [
4782
+ "array/find",
4783
+ "@config.tiles",
4784
+ [
4785
+ "fn",
4786
+ "t",
4787
+ [
4788
+ "and",
4789
+ [
4790
+ "==",
4791
+ [
4792
+ "object/get",
4793
+ "@t",
4794
+ "x"
4795
+ ],
4796
+ "@nextX"
4797
+ ],
4798
+ [
4799
+ "==",
4800
+ [
4801
+ "object/get",
4802
+ "@t",
4803
+ "y"
4804
+ ],
4805
+ "@nextY"
4806
+ ]
4807
+ ]
4808
+ ]
4809
+ ],
4810
+ "passable"
4811
+ ],
4812
+ true
4813
+ ],
4814
+ [
4815
+ "==",
4816
+ [
4817
+ "array/len",
4818
+ [
4819
+ "array/filter",
4820
+ "@entity.units",
4821
+ [
4822
+ "fn",
4823
+ "o",
4824
+ [
4825
+ "and",
4826
+ [
4827
+ "!=",
4828
+ "@o.id",
4829
+ "@u.id"
4830
+ ],
4831
+ [
4832
+ "and",
4833
+ [
4834
+ ">",
4835
+ "@o.health",
4836
+ 0.0
4837
+ ],
4838
+ [
4839
+ "and",
4840
+ [
4841
+ "==",
4842
+ [
4843
+ "object/get",
4844
+ [
4845
+ "object/get",
4846
+ "@o",
4847
+ "position"
4848
+ ],
4849
+ "x"
4850
+ ],
4851
+ "@nextX"
4852
+ ],
4853
+ [
4854
+ "==",
4855
+ [
4856
+ "object/get",
4857
+ [
4858
+ "object/get",
4859
+ "@o",
4860
+ "position"
4861
+ ],
4862
+ "y"
4863
+ ],
4864
+ "@nextY"
4865
+ ]
4866
+ ]
4867
+ ]
4868
+ ]
4869
+ ]
4870
+ ]
4871
+ ],
4872
+ 0.0
4873
+ ]
4251
4874
  ]
4252
- ]
4253
- }
4254
- }
4875
+ ],
4876
+ [
4877
+ "object/merge",
4878
+ "@u",
4879
+ {
4880
+ "position": {
4881
+ "x": "@nextX",
4882
+ "y": "@nextY"
4883
+ }
4884
+ }
4885
+ ],
4886
+ "@u"
4887
+ ]
4888
+ ]
4255
4889
  ]
4256
4890
  ],
4257
4891
  "@u"
@@ -4374,11 +5008,38 @@
4374
5008
  "render-ui",
4375
5009
  "main",
4376
5010
  {
5011
+ "addons": {
5012
+ "children": [
5013
+ {
5014
+ "action": "END_TURN",
5015
+ "label": "End Turn",
5016
+ "type": "button",
5017
+ "variant": "primary"
5018
+ },
5019
+ {
5020
+ "action": "CANCEL",
5021
+ "label": "Cancel",
5022
+ "type": "button",
5023
+ "variant": "secondary"
5024
+ },
5025
+ {
5026
+ "action": "PLAY_AGAIN",
5027
+ "label": "Restart",
5028
+ "type": "button",
5029
+ "variant": "secondary"
5030
+ }
5031
+ ],
5032
+ "direction": "vertical",
5033
+ "gap": "sm",
5034
+ "type": "stack"
5035
+ },
4377
5036
  "children": [
4378
5037
  {
4379
5038
  "attackTargets": "@entity.attackTargets",
4380
5039
  "backgroundColor": "@config.bgColor",
5040
+ "events": "@entity.fx",
4381
5041
  "features": "@config.features",
5042
+ "interpolateUnits": true,
4382
5043
  "scale": "@config.scale",
4383
5044
  "selectedUnitId": "@entity.selectedUnitId",
4384
5045
  "tileClickEvent": "TILE_CLICK",
@@ -4407,6 +5068,41 @@
4407
5068
  ],
4408
5069
  "type": "game-hud"
4409
5070
  },
5071
+ "overlay": [
5072
+ "if",
5073
+ [
5074
+ "!=",
5075
+ "@entity.result",
5076
+ "none"
5077
+ ],
5078
+ {
5079
+ "options": [
5080
+ {
5081
+ "event": "PLAY_AGAIN",
5082
+ "id": "again",
5083
+ "label": "Play Again",
5084
+ "variant": "primary"
5085
+ }
5086
+ ],
5087
+ "subtitle": [
5088
+ "str/concat",
5089
+ "Turn ",
5090
+ "@entity.turn"
5091
+ ],
5092
+ "title": [
5093
+ "if",
5094
+ [
5095
+ "==",
5096
+ "@entity.result",
5097
+ "victory"
5098
+ ],
5099
+ "VICTORY",
5100
+ "DEFEAT"
5101
+ ],
5102
+ "type": "game-menu"
5103
+ },
5104
+ null
5105
+ ],
4410
5106
  "type": "game-shell"
4411
5107
  }
4412
5108
  ]
@@ -4426,6 +5122,130 @@
4426
5122
  ],
4427
5123
  "interval": 1000.0,
4428
5124
  "name": "enemyAiTick"
5125
+ },
5126
+ {
5127
+ "effects": [
5128
+ [
5129
+ "set",
5130
+ "@entity.fx",
5131
+ [
5132
+ "array/filter",
5133
+ [
5134
+ "array/map",
5135
+ "@entity.fx",
5136
+ [
5137
+ "fn",
5138
+ "e",
5139
+ [
5140
+ "object/merge",
5141
+ "@e",
5142
+ {
5143
+ "ttl": [
5144
+ "-",
5145
+ [
5146
+ "object/get",
5147
+ "@e",
5148
+ "ttl"
5149
+ ],
5150
+ 1.0
5151
+ ]
5152
+ }
5153
+ ]
5154
+ ]
5155
+ ],
5156
+ [
5157
+ "fn",
5158
+ "e",
5159
+ [
5160
+ ">",
5161
+ [
5162
+ "object/get",
5163
+ "@e",
5164
+ "ttl"
5165
+ ],
5166
+ 0.0
5167
+ ]
5168
+ ]
5169
+ ]
5170
+ ],
5171
+ [
5172
+ "render-ui",
5173
+ "main",
5174
+ {
5175
+ "addons": {
5176
+ "children": [
5177
+ {
5178
+ "action": "END_TURN",
5179
+ "label": "End Turn",
5180
+ "type": "button",
5181
+ "variant": "primary"
5182
+ },
5183
+ {
5184
+ "action": "CANCEL",
5185
+ "label": "Cancel",
5186
+ "type": "button",
5187
+ "variant": "secondary"
5188
+ },
5189
+ {
5190
+ "action": "PLAY_AGAIN",
5191
+ "label": "Restart",
5192
+ "type": "button",
5193
+ "variant": "secondary"
5194
+ }
5195
+ ],
5196
+ "direction": "vertical",
5197
+ "gap": "sm",
5198
+ "type": "stack"
5199
+ },
5200
+ "children": [
5201
+ {
5202
+ "attackTargets": "@entity.attackTargets",
5203
+ "backgroundColor": "@config.bgColor",
5204
+ "events": "@entity.fx",
5205
+ "features": "@config.features",
5206
+ "interpolateUnits": true,
5207
+ "scale": "@config.scale",
5208
+ "selectedUnitId": "@entity.selectedUnitId",
5209
+ "tileClickEvent": "TILE_CLICK",
5210
+ "tiles": "@config.tiles",
5211
+ "type": "game-canvas-3d",
5212
+ "unitClickEvent": "UNIT_CLICK",
5213
+ "unitScale": "@config.unitScale",
5214
+ "units": "@entity.units",
5215
+ "validMoves": "@entity.validMoves"
5216
+ }
5217
+ ],
5218
+ "hud": {
5219
+ "stats": [
5220
+ {
5221
+ "label": "Turn",
5222
+ "value": "@entity.turn"
5223
+ },
5224
+ {
5225
+ "label": "Phase",
5226
+ "value": "@entity.phase"
5227
+ },
5228
+ {
5229
+ "label": "Result",
5230
+ "value": "@entity.result"
5231
+ }
5232
+ ],
5233
+ "type": "game-hud"
5234
+ },
5235
+ "type": "game-shell"
5236
+ }
5237
+ ]
5238
+ ],
5239
+ "guard": [
5240
+ ">",
5241
+ [
5242
+ "array/len",
5243
+ "@entity.fx"
5244
+ ],
5245
+ 0.0
5246
+ ],
5247
+ "interval": 500.0,
5248
+ "name": "fxTick"
4429
5249
  }
4430
5250
  ]
4431
5251
  }