@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
@@ -168,6 +168,51 @@
168
168
  "name": "attackTargets",
169
169
  "type": "array"
170
170
  },
171
+ {
172
+ "default": [],
173
+ "items": {
174
+ "properties": {
175
+ "id": {
176
+ "name": "id",
177
+ "required": true,
178
+ "type": "string"
179
+ },
180
+ "message": {
181
+ "name": "message",
182
+ "required": false,
183
+ "type": "string"
184
+ },
185
+ "ttl": {
186
+ "name": "ttl",
187
+ "required": true,
188
+ "type": "number"
189
+ },
190
+ "type": {
191
+ "name": "type",
192
+ "required": true,
193
+ "type": "string"
194
+ },
195
+ "x": {
196
+ "name": "x",
197
+ "required": true,
198
+ "type": "number"
199
+ },
200
+ "y": {
201
+ "name": "y",
202
+ "required": false,
203
+ "type": "number"
204
+ },
205
+ "z": {
206
+ "name": "z",
207
+ "required": false,
208
+ "type": "number"
209
+ }
210
+ },
211
+ "type": "object"
212
+ },
213
+ "name": "fx",
214
+ "type": "array"
215
+ },
171
216
  {
172
217
  "default": "observation",
173
218
  "name": "phase",
@@ -245,6 +290,13 @@
245
290
  {
246
291
  "category": "interaction",
247
292
  "config": {
293
+ "attackDamage": {
294
+ "default": 4.0,
295
+ "description": "Cannon damage a player ship deals to an adjacent enemy on attack",
296
+ "label": "Attack Damage",
297
+ "tier": "presentation",
298
+ "type": "number"
299
+ },
248
300
  "bgColor": {
249
301
  "default": "#123a52",
250
302
  "description": "Canvas background color (deep sea)",
@@ -1278,36 +1330,6 @@
1278
1330
  }
1279
1331
  },
1280
1332
  "emits": [
1281
- {
1282
- "description": "Cannon fire between adjacent ships",
1283
- "event": "ATTACK",
1284
- "payloadSchema": [
1285
- {
1286
- "name": "attacker",
1287
- "type": "object"
1288
- },
1289
- {
1290
- "name": "target",
1291
- "type": "object"
1292
- },
1293
- {
1294
- "name": "damage",
1295
- "type": "number"
1296
- },
1297
- {
1298
- "name": "attackerId",
1299
- "required": true,
1300
- "type": "string"
1301
- },
1302
- {
1303
- "name": "targetId",
1304
- "required": true,
1305
- "type": "string"
1306
- }
1307
- ],
1308
- "scope": "external",
1309
- "tier": "domain"
1310
- },
1311
1333
  {
1312
1334
  "description": "Called when the naval skirmish ends",
1313
1335
  "event": "GAME_END",
@@ -1433,6 +1455,7 @@
1433
1455
  "attackTargets",
1434
1456
  "currentTeam",
1435
1457
  "enemyTurn",
1458
+ "fx",
1436
1459
  "gridHeight",
1437
1460
  "gridWidth",
1438
1461
  "movementRange",
@@ -1451,10 +1474,6 @@
1451
1474
  "scope": "instance",
1452
1475
  "stateMachine": {
1453
1476
  "events": [
1454
- {
1455
- "key": "START",
1456
- "name": "Start"
1457
- },
1458
1477
  {
1459
1478
  "key": "INIT",
1460
1479
  "name": "Initialize"
@@ -1502,36 +1521,6 @@
1502
1521
  ],
1503
1522
  "tier": "domain"
1504
1523
  },
1505
- {
1506
- "description": "Cannon fire between adjacent ships",
1507
- "key": "ATTACK",
1508
- "name": "Attack",
1509
- "payloadSchema": [
1510
- {
1511
- "name": "attacker",
1512
- "type": "object"
1513
- },
1514
- {
1515
- "name": "target",
1516
- "type": "object"
1517
- },
1518
- {
1519
- "name": "damage",
1520
- "type": "number"
1521
- },
1522
- {
1523
- "name": "attackerId",
1524
- "required": true,
1525
- "type": "string"
1526
- },
1527
- {
1528
- "name": "targetId",
1529
- "required": true,
1530
- "type": "string"
1531
- }
1532
- ],
1533
- "tier": "domain"
1534
- },
1535
1524
  {
1536
1525
  "description": "Emits UI:{endTurnEvent} with {} on end turn",
1537
1526
  "key": "END_TURN",
@@ -1614,9 +1603,6 @@
1614
1603
  "isInitial": true,
1615
1604
  "name": "playing"
1616
1605
  },
1617
- {
1618
- "name": "menu"
1619
- },
1620
1606
  {
1621
1607
  "name": "gameover"
1622
1608
  }
@@ -1644,6 +1630,11 @@
1644
1630
  "@entity.attackTargets",
1645
1631
  []
1646
1632
  ],
1633
+ [
1634
+ "set",
1635
+ "@entity.fx",
1636
+ []
1637
+ ],
1647
1638
  [
1648
1639
  "set",
1649
1640
  "@entity.turn",
@@ -1669,15 +1660,57 @@
1669
1660
  "@entity.enemyTurn",
1670
1661
  false
1671
1662
  ],
1663
+ [
1664
+ "set",
1665
+ "@entity.gridWidth",
1666
+ 6.0
1667
+ ],
1668
+ [
1669
+ "set",
1670
+ "@entity.gridHeight",
1671
+ 6.0
1672
+ ],
1673
+ [
1674
+ "set",
1675
+ "@entity.movementRange",
1676
+ 3.0
1677
+ ],
1672
1678
  [
1673
1679
  "render-ui",
1674
1680
  "main",
1675
1681
  {
1682
+ "addons": {
1683
+ "children": [
1684
+ {
1685
+ "action": "END_TURN",
1686
+ "label": "End Turn",
1687
+ "type": "button",
1688
+ "variant": "primary"
1689
+ },
1690
+ {
1691
+ "action": "CANCEL",
1692
+ "label": "Cancel",
1693
+ "type": "button",
1694
+ "variant": "secondary"
1695
+ },
1696
+ {
1697
+ "action": "PLAY_AGAIN",
1698
+ "label": "Restart",
1699
+ "type": "button",
1700
+ "variant": "secondary"
1701
+ }
1702
+ ],
1703
+ "direction": "vertical",
1704
+ "gap": "sm",
1705
+ "type": "stack"
1706
+ },
1676
1707
  "children": [
1677
1708
  {
1678
1709
  "attackTargets": "@entity.attackTargets",
1679
1710
  "backgroundColor": "@config.bgColor",
1711
+ "events": "@entity.fx",
1680
1712
  "features": "@config.features",
1713
+ "interpolateUnits": true,
1681
1714
  "scale": "@config.scale",
1682
1715
  "selectedUnitId": "@entity.selectedUnitId",
1683
1716
  "tileClickEvent": "TILE_CLICK",
@@ -1710,8 +1743,8 @@
1710
1743
  }
1711
1744
  ]
1712
1745
  ],
1713
- "event": "START",
1714
- "from": "menu",
1746
+ "event": "INIT",
1747
+ "from": "playing",
1715
1748
  "to": "playing"
1716
1749
  },
1717
1750
  {
@@ -1719,7 +1752,38 @@
1719
1752
  [
1720
1753
  "set",
1721
1754
  "@entity.units",
1722
- "@config.units"
1755
+ [
1756
+ "array/map",
1757
+ "@entity.units",
1758
+ [
1759
+ "fn",
1760
+ "u",
1761
+ [
1762
+ "if",
1763
+ [
1764
+ "==",
1765
+ "@u.id",
1766
+ "@payload.unitId"
1767
+ ],
1768
+ [
1769
+ "object/merge",
1770
+ "@u",
1771
+ {
1772
+ "health": [
1773
+ "math/max",
1774
+ 0.0,
1775
+ [
1776
+ "-",
1777
+ "@u.health",
1778
+ "@config.attackDamage"
1779
+ ]
1780
+ ]
1781
+ }
1782
+ ],
1783
+ "@u"
1784
+ ]
1785
+ ]
1786
+ ]
1723
1787
  ],
1724
1788
  [
1725
1789
  "set",
@@ -1736,16 +1800,6 @@
1736
1800
  "@entity.attackTargets",
1737
1801
  []
1738
1802
  ],
1739
- [
1740
- "set",
1741
- "@entity.turn",
1742
- 0.0
1743
- ],
1744
- [
1745
- "set",
1746
- "@entity.result",
1747
- "none"
1748
- ],
1749
1803
  [
1750
1804
  "set",
1751
1805
  "@entity.phase",
@@ -1753,38 +1807,157 @@
1753
1807
  ],
1754
1808
  [
1755
1809
  "set",
1756
- "@entity.currentTeam",
1757
- "player"
1810
+ "@entity.result",
1811
+ [
1812
+ "if",
1813
+ [
1814
+ "==",
1815
+ [
1816
+ "array/len",
1817
+ [
1818
+ "array/filter",
1819
+ "@entity.units",
1820
+ [
1821
+ "fn",
1822
+ "u",
1823
+ [
1824
+ "and",
1825
+ [
1826
+ "==",
1827
+ "@u.team",
1828
+ "enemy"
1829
+ ],
1830
+ [
1831
+ ">",
1832
+ "@u.health",
1833
+ 0.0
1834
+ ]
1835
+ ]
1836
+ ]
1837
+ ]
1838
+ ],
1839
+ 0.0
1840
+ ],
1841
+ "victory",
1842
+ "none"
1843
+ ]
1758
1844
  ],
1759
1845
  [
1760
- "set",
1761
- "@entity.enemyTurn",
1762
- false
1846
+ "if",
1847
+ [
1848
+ "!=",
1849
+ "@entity.result",
1850
+ "none"
1851
+ ],
1852
+ [
1853
+ "emit",
1854
+ "GAME_END",
1855
+ {
1856
+ "result": "@entity.result"
1857
+ }
1858
+ ],
1859
+ null
1763
1860
  ],
1764
1861
  [
1765
1862
  "set",
1766
- "@entity.gridWidth",
1767
- 6.0
1768
- ],
1769
- [
1770
- "set",
1771
- "@entity.gridHeight",
1772
- 6.0
1773
- ],
1774
- [
1775
- "set",
1776
- "@entity.movementRange",
1777
- 3.0
1863
+ "@entity.fx",
1864
+ [
1865
+ "array/append",
1866
+ "@entity.fx",
1867
+ {
1868
+ "id": [
1869
+ "str/concat",
1870
+ "fx-atk-",
1871
+ "@entity.turn"
1872
+ ],
1873
+ "message": [
1874
+ "str/concat",
1875
+ "-",
1876
+ "@config.attackDamage"
1877
+ ],
1878
+ "ttl": 3.0,
1879
+ "type": "hit",
1880
+ "x": [
1881
+ "object/get",
1882
+ [
1883
+ "object/get",
1884
+ [
1885
+ "array/find",
1886
+ "@entity.units",
1887
+ [
1888
+ "fn",
1889
+ "u",
1890
+ [
1891
+ "==",
1892
+ "@u.id",
1893
+ "@payload.unitId"
1894
+ ]
1895
+ ]
1896
+ ],
1897
+ "position"
1898
+ ],
1899
+ "x"
1900
+ ],
1901
+ "z": [
1902
+ "object/get",
1903
+ [
1904
+ "object/get",
1905
+ [
1906
+ "array/find",
1907
+ "@entity.units",
1908
+ [
1909
+ "fn",
1910
+ "u",
1911
+ [
1912
+ "==",
1913
+ "@u.id",
1914
+ "@payload.unitId"
1915
+ ]
1916
+ ]
1917
+ ],
1918
+ "position"
1919
+ ],
1920
+ "y"
1921
+ ]
1922
+ }
1923
+ ]
1778
1924
  ],
1779
1925
  [
1780
1926
  "render-ui",
1781
1927
  "main",
1782
1928
  {
1929
+ "addons": {
1930
+ "children": [
1931
+ {
1932
+ "action": "END_TURN",
1933
+ "label": "End Turn",
1934
+ "type": "button",
1935
+ "variant": "primary"
1936
+ },
1937
+ {
1938
+ "action": "CANCEL",
1939
+ "label": "Cancel",
1940
+ "type": "button",
1941
+ "variant": "secondary"
1942
+ },
1943
+ {
1944
+ "action": "PLAY_AGAIN",
1945
+ "label": "Restart",
1946
+ "type": "button",
1947
+ "variant": "secondary"
1948
+ }
1949
+ ],
1950
+ "direction": "vertical",
1951
+ "gap": "sm",
1952
+ "type": "stack"
1953
+ },
1783
1954
  "children": [
1784
1955
  {
1785
1956
  "attackTargets": "@entity.attackTargets",
1786
1957
  "backgroundColor": "@config.bgColor",
1958
+ "events": "@entity.fx",
1787
1959
  "features": "@config.features",
1960
+ "interpolateUnits": true,
1788
1961
  "scale": "@config.scale",
1789
1962
  "selectedUnitId": "@entity.selectedUnitId",
1790
1963
  "tileClickEvent": "TILE_CLICK",
@@ -1817,8 +1990,105 @@
1817
1990
  }
1818
1991
  ]
1819
1992
  ],
1820
- "event": "INIT",
1993
+ "event": "UNIT_CLICK",
1821
1994
  "from": "playing",
1995
+ "guard": [
1996
+ "and",
1997
+ [
1998
+ "==",
1999
+ "@entity.phase",
2000
+ "action"
2001
+ ],
2002
+ [
2003
+ "and",
2004
+ [
2005
+ "==",
2006
+ [
2007
+ "object/get",
2008
+ [
2009
+ "array/find",
2010
+ "@entity.units",
2011
+ [
2012
+ "fn",
2013
+ "u",
2014
+ [
2015
+ "==",
2016
+ "@u.id",
2017
+ "@payload.unitId"
2018
+ ]
2019
+ ]
2020
+ ],
2021
+ "team"
2022
+ ],
2023
+ "enemy"
2024
+ ],
2025
+ [
2026
+ "and",
2027
+ [
2028
+ ">",
2029
+ [
2030
+ "object/get",
2031
+ [
2032
+ "array/find",
2033
+ "@entity.units",
2034
+ [
2035
+ "fn",
2036
+ "u",
2037
+ [
2038
+ "==",
2039
+ "@u.id",
2040
+ "@payload.unitId"
2041
+ ]
2042
+ ]
2043
+ ],
2044
+ "health"
2045
+ ],
2046
+ 0.0
2047
+ ],
2048
+ [
2049
+ "<=",
2050
+ [
2051
+ "grid/manhattan-distance",
2052
+ [
2053
+ "object/get",
2054
+ [
2055
+ "array/find",
2056
+ "@entity.units",
2057
+ [
2058
+ "fn",
2059
+ "u",
2060
+ [
2061
+ "==",
2062
+ "@u.id",
2063
+ "@entity.selectedUnitId"
2064
+ ]
2065
+ ]
2066
+ ],
2067
+ "position"
2068
+ ],
2069
+ [
2070
+ "object/get",
2071
+ [
2072
+ "array/find",
2073
+ "@entity.units",
2074
+ [
2075
+ "fn",
2076
+ "u",
2077
+ [
2078
+ "==",
2079
+ "@u.id",
2080
+ "@payload.unitId"
2081
+ ]
2082
+ ]
2083
+ ],
2084
+ "position"
2085
+ ]
2086
+ ],
2087
+ 1.0
2088
+ ]
2089
+ ]
2090
+ ]
2091
+ ],
1822
2092
  "to": "playing"
1823
2093
  },
1824
2094
  {
@@ -1913,11 +2183,38 @@
1913
2183
  "render-ui",
1914
2184
  "main",
1915
2185
  {
2186
+ "addons": {
2187
+ "children": [
2188
+ {
2189
+ "action": "END_TURN",
2190
+ "label": "End Turn",
2191
+ "type": "button",
2192
+ "variant": "primary"
2193
+ },
2194
+ {
2195
+ "action": "CANCEL",
2196
+ "label": "Cancel",
2197
+ "type": "button",
2198
+ "variant": "secondary"
2199
+ },
2200
+ {
2201
+ "action": "PLAY_AGAIN",
2202
+ "label": "Restart",
2203
+ "type": "button",
2204
+ "variant": "secondary"
2205
+ }
2206
+ ],
2207
+ "direction": "vertical",
2208
+ "gap": "sm",
2209
+ "type": "stack"
2210
+ },
1916
2211
  "children": [
1917
2212
  {
1918
2213
  "attackTargets": "@entity.attackTargets",
1919
2214
  "backgroundColor": "@config.bgColor",
2215
+ "events": "@entity.fx",
1920
2216
  "features": "@config.features",
2217
+ "interpolateUnits": true,
1921
2218
  "scale": "@config.scale",
1922
2219
  "selectedUnitId": "@entity.selectedUnitId",
1923
2220
  "tileClickEvent": "TILE_CLICK",
@@ -2135,11 +2432,38 @@
2135
2432
  "render-ui",
2136
2433
  "main",
2137
2434
  {
2435
+ "addons": {
2436
+ "children": [
2437
+ {
2438
+ "action": "END_TURN",
2439
+ "label": "End Turn",
2440
+ "type": "button",
2441
+ "variant": "primary"
2442
+ },
2443
+ {
2444
+ "action": "CANCEL",
2445
+ "label": "Cancel",
2446
+ "type": "button",
2447
+ "variant": "secondary"
2448
+ },
2449
+ {
2450
+ "action": "PLAY_AGAIN",
2451
+ "label": "Restart",
2452
+ "type": "button",
2453
+ "variant": "secondary"
2454
+ }
2455
+ ],
2456
+ "direction": "vertical",
2457
+ "gap": "sm",
2458
+ "type": "stack"
2459
+ },
2138
2460
  "children": [
2139
2461
  {
2140
2462
  "attackTargets": "@entity.attackTargets",
2141
2463
  "backgroundColor": "@config.bgColor",
2464
+ "events": "@entity.fx",
2142
2465
  "features": "@config.features",
2466
+ "interpolateUnits": true,
2143
2467
  "scale": "@config.scale",
2144
2468
  "selectedUnitId": "@entity.selectedUnitId",
2145
2469
  "tileClickEvent": "TILE_CLICK",
@@ -2254,11 +2578,38 @@
2254
2578
  "render-ui",
2255
2579
  "main",
2256
2580
  {
2581
+ "addons": {
2582
+ "children": [
2583
+ {
2584
+ "action": "END_TURN",
2585
+ "label": "End Turn",
2586
+ "type": "button",
2587
+ "variant": "primary"
2588
+ },
2589
+ {
2590
+ "action": "CANCEL",
2591
+ "label": "Cancel",
2592
+ "type": "button",
2593
+ "variant": "secondary"
2594
+ },
2595
+ {
2596
+ "action": "PLAY_AGAIN",
2597
+ "label": "Restart",
2598
+ "type": "button",
2599
+ "variant": "secondary"
2600
+ }
2601
+ ],
2602
+ "direction": "vertical",
2603
+ "gap": "sm",
2604
+ "type": "stack"
2605
+ },
2257
2606
  "children": [
2258
2607
  {
2259
2608
  "attackTargets": "@entity.attackTargets",
2260
2609
  "backgroundColor": "@config.bgColor",
2610
+ "events": "@entity.fx",
2261
2611
  "features": "@config.features",
2612
+ "interpolateUnits": true,
2262
2613
  "scale": "@config.scale",
2263
2614
  "selectedUnitId": "@entity.selectedUnitId",
2264
2615
  "tileClickEvent": "TILE_CLICK",
@@ -2394,42 +2745,11 @@
2394
2745
  "effects": [
2395
2746
  [
2396
2747
  "set",
2397
- "@entity.units",
2748
+ "@entity.turn",
2398
2749
  [
2399
- "array/map",
2400
- "@entity.units",
2401
- [
2402
- "fn",
2403
- "u",
2404
- [
2405
- "if",
2406
- [
2407
- "==",
2408
- "@u.id",
2409
- "@payload.targetId"
2410
- ],
2411
- [
2412
- "object/merge",
2413
- "@u",
2414
- {
2415
- "health": [
2416
- "math/max",
2417
- 0.0,
2418
- [
2419
- "-",
2420
- [
2421
- "object/get",
2422
- "@u",
2423
- "health"
2424
- ],
2425
- "@payload.damage"
2426
- ]
2427
- ]
2428
- }
2429
- ],
2430
- "@u"
2431
- ]
2432
- ]
2750
+ "+",
2751
+ "@entity.turn",
2752
+ 1.0
2433
2753
  ]
2434
2754
  ],
2435
2755
  [
@@ -2447,20 +2767,57 @@
2447
2767
  "@entity.attackTargets",
2448
2768
  []
2449
2769
  ],
2770
+ [
2771
+ "set",
2772
+ "@entity.enemyTurn",
2773
+ true
2774
+ ],
2775
+ [
2776
+ "set",
2777
+ "@entity.currentTeam",
2778
+ "enemy"
2779
+ ],
2450
2780
  [
2451
2781
  "set",
2452
2782
  "@entity.phase",
2453
- "observation"
2783
+ "enemy_turn"
2454
2784
  ],
2455
2785
  [
2456
2786
  "render-ui",
2457
2787
  "main",
2458
2788
  {
2789
+ "addons": {
2790
+ "children": [
2791
+ {
2792
+ "action": "END_TURN",
2793
+ "label": "End Turn",
2794
+ "type": "button",
2795
+ "variant": "primary"
2796
+ },
2797
+ {
2798
+ "action": "CANCEL",
2799
+ "label": "Cancel",
2800
+ "type": "button",
2801
+ "variant": "secondary"
2802
+ },
2803
+ {
2804
+ "action": "PLAY_AGAIN",
2805
+ "label": "Restart",
2806
+ "type": "button",
2807
+ "variant": "secondary"
2808
+ }
2809
+ ],
2810
+ "direction": "vertical",
2811
+ "gap": "sm",
2812
+ "type": "stack"
2813
+ },
2459
2814
  "children": [
2460
2815
  {
2461
2816
  "attackTargets": "@entity.attackTargets",
2462
2817
  "backgroundColor": "@config.bgColor",
2818
+ "events": "@entity.fx",
2463
2819
  "features": "@config.features",
2820
+ "interpolateUnits": true,
2464
2821
  "scale": "@config.scale",
2465
2822
  "selectedUnitId": "@entity.selectedUnitId",
2466
2823
  "tileClickEvent": "TILE_CLICK",
@@ -2493,121 +2850,21 @@
2493
2850
  }
2494
2851
  ]
2495
2852
  ],
2496
- "event": "ATTACK",
2853
+ "event": "END_TURN",
2497
2854
  "from": "playing",
2498
2855
  "guard": [
2499
- "let",
2856
+ "==",
2857
+ "@entity.result",
2858
+ "none"
2859
+ ],
2860
+ "to": "playing"
2861
+ },
2862
+ {
2863
+ "effects": [
2500
2864
  [
2501
- [
2502
- "ap",
2503
- [
2504
- "object/get",
2505
- [
2506
- "array/find",
2507
- "@entity.units",
2508
- [
2509
- "fn",
2510
- "u",
2511
- [
2512
- "==",
2513
- "@u.id",
2514
- "@payload.attackerId"
2515
- ]
2516
- ]
2517
- ],
2518
- "position"
2519
- ]
2520
- ],
2521
- [
2522
- "tp",
2523
- [
2524
- "object/get",
2525
- [
2526
- "array/find",
2527
- "@entity.units",
2528
- [
2529
- "fn",
2530
- "u",
2531
- [
2532
- "==",
2533
- "@u.id",
2534
- "@payload.targetId"
2535
- ]
2536
- ]
2537
- ],
2538
- "position"
2539
- ]
2540
- ]
2541
- ],
2542
- [
2543
- "and",
2544
- [
2545
- "<=",
2546
- [
2547
- "math/abs",
2548
- [
2549
- "-",
2550
- [
2551
- "object/get",
2552
- "@ap",
2553
- "x"
2554
- ],
2555
- [
2556
- "object/get",
2557
- "@tp",
2558
- "x"
2559
- ]
2560
- ]
2561
- ],
2562
- 1.0
2563
- ],
2564
- [
2565
- "and",
2566
- [
2567
- "<=",
2568
- [
2569
- "math/abs",
2570
- [
2571
- "-",
2572
- [
2573
- "object/get",
2574
- "@ap",
2575
- "y"
2576
- ],
2577
- [
2578
- "object/get",
2579
- "@tp",
2580
- "y"
2581
- ]
2582
- ]
2583
- ],
2584
- 1.0
2585
- ],
2586
- [
2587
- "!=",
2588
- "@ap",
2589
- "@tp"
2590
- ]
2591
- ]
2592
- ]
2593
- ],
2594
- "to": "playing"
2595
- },
2596
- {
2597
- "effects": [
2598
- [
2599
- "set",
2600
- "@entity.turn",
2601
- [
2602
- "+",
2603
- "@entity.turn",
2604
- 1.0
2605
- ]
2606
- ],
2607
- [
2608
- "set",
2609
- "@entity.selectedUnitId",
2610
- ""
2865
+ "set",
2866
+ "@entity.selectedUnitId",
2867
+ ""
2611
2868
  ],
2612
2869
  [
2613
2870
  "set",
@@ -2619,102 +2876,47 @@
2619
2876
  "@entity.attackTargets",
2620
2877
  []
2621
2878
  ],
2622
- [
2623
- "set",
2624
- "@entity.enemyTurn",
2625
- true
2626
- ],
2627
- [
2628
- "set",
2629
- "@entity.currentTeam",
2630
- "enemy"
2631
- ],
2632
2879
  [
2633
2880
  "set",
2634
2881
  "@entity.phase",
2635
- "enemy_turn"
2882
+ "observation"
2636
2883
  ],
2637
2884
  [
2638
2885
  "render-ui",
2639
2886
  "main",
2640
2887
  {
2641
- "children": [
2642
- {
2643
- "attackTargets": "@entity.attackTargets",
2644
- "backgroundColor": "@config.bgColor",
2645
- "features": "@config.features",
2646
- "scale": "@config.scale",
2647
- "selectedUnitId": "@entity.selectedUnitId",
2648
- "tileClickEvent": "TILE_CLICK",
2649
- "tiles": "@config.tiles",
2650
- "type": "game-canvas-3d",
2651
- "unitClickEvent": "UNIT_CLICK",
2652
- "unitScale": "@config.unitScale",
2653
- "units": "@entity.units",
2654
- "validMoves": "@entity.validMoves"
2655
- }
2656
- ],
2657
- "hud": {
2658
- "stats": [
2888
+ "addons": {
2889
+ "children": [
2659
2890
  {
2660
- "label": "Turn",
2661
- "value": "@entity.turn"
2891
+ "action": "END_TURN",
2892
+ "label": "End Turn",
2893
+ "type": "button",
2894
+ "variant": "primary"
2662
2895
  },
2663
2896
  {
2664
- "label": "Phase",
2665
- "value": "@entity.phase"
2897
+ "action": "CANCEL",
2898
+ "label": "Cancel",
2899
+ "type": "button",
2900
+ "variant": "secondary"
2666
2901
  },
2667
2902
  {
2668
- "label": "Result",
2669
- "value": "@entity.result"
2903
+ "action": "PLAY_AGAIN",
2904
+ "label": "Restart",
2905
+ "type": "button",
2906
+ "variant": "secondary"
2670
2907
  }
2671
2908
  ],
2672
- "type": "game-hud"
2909
+ "direction": "vertical",
2910
+ "gap": "sm",
2911
+ "type": "stack"
2673
2912
  },
2674
- "type": "game-shell"
2675
- }
2676
- ]
2677
- ],
2678
- "event": "END_TURN",
2679
- "from": "playing",
2680
- "guard": [
2681
- "==",
2682
- "@entity.result",
2683
- "none"
2684
- ],
2685
- "to": "playing"
2686
- },
2687
- {
2688
- "effects": [
2689
- [
2690
- "set",
2691
- "@entity.selectedUnitId",
2692
- ""
2693
- ],
2694
- [
2695
- "set",
2696
- "@entity.validMoves",
2697
- []
2698
- ],
2699
- [
2700
- "set",
2701
- "@entity.attackTargets",
2702
- []
2703
- ],
2704
- [
2705
- "set",
2706
- "@entity.phase",
2707
- "observation"
2708
- ],
2709
- [
2710
- "render-ui",
2711
- "main",
2712
- {
2713
2913
  "children": [
2714
2914
  {
2715
2915
  "attackTargets": "@entity.attackTargets",
2716
2916
  "backgroundColor": "@config.bgColor",
2917
+ "events": "@entity.fx",
2717
2918
  "features": "@config.features",
2919
+ "interpolateUnits": true,
2718
2920
  "scale": "@config.scale",
2719
2921
  "selectedUnitId": "@entity.selectedUnitId",
2720
2922
  "tileClickEvent": "TILE_CLICK",
@@ -2839,11 +3041,38 @@
2839
3041
  "render-ui",
2840
3042
  "main",
2841
3043
  {
3044
+ "addons": {
3045
+ "children": [
3046
+ {
3047
+ "action": "END_TURN",
3048
+ "label": "End Turn",
3049
+ "type": "button",
3050
+ "variant": "primary"
3051
+ },
3052
+ {
3053
+ "action": "CANCEL",
3054
+ "label": "Cancel",
3055
+ "type": "button",
3056
+ "variant": "secondary"
3057
+ },
3058
+ {
3059
+ "action": "PLAY_AGAIN",
3060
+ "label": "Restart",
3061
+ "type": "button",
3062
+ "variant": "secondary"
3063
+ }
3064
+ ],
3065
+ "direction": "vertical",
3066
+ "gap": "sm",
3067
+ "type": "stack"
3068
+ },
2842
3069
  "children": [
2843
3070
  {
2844
3071
  "attackTargets": "@entity.attackTargets",
2845
3072
  "backgroundColor": "@config.bgColor",
3073
+ "events": "@entity.fx",
2846
3074
  "features": "@config.features",
3075
+ "interpolateUnits": true,
2847
3076
  "scale": "@config.scale",
2848
3077
  "selectedUnitId": "@entity.selectedUnitId",
2849
3078
  "tileClickEvent": "TILE_CLICK",
@@ -2872,6 +3101,41 @@
2872
3101
  ],
2873
3102
  "type": "game-hud"
2874
3103
  },
3104
+ "overlay": [
3105
+ "if",
3106
+ [
3107
+ "!=",
3108
+ "@entity.result",
3109
+ "none"
3110
+ ],
3111
+ {
3112
+ "options": [
3113
+ {
3114
+ "event": "PLAY_AGAIN",
3115
+ "id": "again",
3116
+ "label": "Play Again",
3117
+ "variant": "primary"
3118
+ }
3119
+ ],
3120
+ "subtitle": [
3121
+ "str/concat",
3122
+ "Turn ",
3123
+ "@entity.turn"
3124
+ ],
3125
+ "title": [
3126
+ "if",
3127
+ [
3128
+ "==",
3129
+ "@entity.result",
3130
+ "victory"
3131
+ ],
3132
+ "VICTORY",
3133
+ "DEFEAT"
3134
+ ],
3135
+ "type": "game-menu"
3136
+ },
3137
+ null
3138
+ ],
2875
3139
  "type": "game-shell"
2876
3140
  }
2877
3141
  ]
@@ -2969,6 +3233,11 @@
2969
3233
  "@entity.attackTargets",
2970
3234
  []
2971
3235
  ],
3236
+ [
3237
+ "set",
3238
+ "@entity.fx",
3239
+ []
3240
+ ],
2972
3241
  [
2973
3242
  "set",
2974
3243
  "@entity.turn",
@@ -2998,11 +3267,38 @@
2998
3267
  "render-ui",
2999
3268
  "main",
3000
3269
  {
3270
+ "addons": {
3271
+ "children": [
3272
+ {
3273
+ "action": "END_TURN",
3274
+ "label": "End Turn",
3275
+ "type": "button",
3276
+ "variant": "primary"
3277
+ },
3278
+ {
3279
+ "action": "CANCEL",
3280
+ "label": "Cancel",
3281
+ "type": "button",
3282
+ "variant": "secondary"
3283
+ },
3284
+ {
3285
+ "action": "PLAY_AGAIN",
3286
+ "label": "Restart",
3287
+ "type": "button",
3288
+ "variant": "secondary"
3289
+ }
3290
+ ],
3291
+ "direction": "vertical",
3292
+ "gap": "sm",
3293
+ "type": "stack"
3294
+ },
3001
3295
  "children": [
3002
3296
  {
3003
3297
  "attackTargets": "@entity.attackTargets",
3004
3298
  "backgroundColor": "@config.bgColor",
3299
+ "events": "@entity.fx",
3005
3300
  "features": "@config.features",
3301
+ "interpolateUnits": true,
3006
3302
  "scale": "@config.scale",
3007
3303
  "selectedUnitId": "@entity.selectedUnitId",
3008
3304
  "tileClickEvent": "TILE_CLICK",
@@ -3031,19 +3327,169 @@
3031
3327
  ],
3032
3328
  "type": "game-hud"
3033
3329
  },
3330
+ "overlay": [
3331
+ "if",
3332
+ [
3333
+ "!=",
3334
+ "@entity.result",
3335
+ "none"
3336
+ ],
3337
+ {
3338
+ "options": [
3339
+ {
3340
+ "event": "PLAY_AGAIN",
3341
+ "id": "again",
3342
+ "label": "Play Again",
3343
+ "variant": "primary"
3344
+ }
3345
+ ],
3346
+ "subtitle": [
3347
+ "str/concat",
3348
+ "Turn ",
3349
+ "@entity.turn"
3350
+ ],
3351
+ "title": [
3352
+ "if",
3353
+ [
3354
+ "==",
3355
+ "@entity.result",
3356
+ "victory"
3357
+ ],
3358
+ "VICTORY",
3359
+ "DEFEAT"
3360
+ ],
3361
+ "type": "game-menu"
3362
+ },
3363
+ null
3364
+ ],
3034
3365
  "type": "game-shell"
3035
3366
  }
3036
3367
  ]
3037
3368
  ],
3038
3369
  "event": "PLAY_AGAIN",
3039
3370
  "from": "gameover",
3040
- "to": "menu"
3371
+ "to": "playing"
3041
3372
  }
3042
3373
  ]
3043
3374
  },
3044
3375
  "ticks": [
3045
3376
  {
3046
3377
  "effects": [
3378
+ [
3379
+ "set",
3380
+ "@entity.fx",
3381
+ [
3382
+ "array/concat",
3383
+ "@entity.fx",
3384
+ [
3385
+ "array/map",
3386
+ [
3387
+ "array/filter",
3388
+ "@entity.units",
3389
+ [
3390
+ "fn",
3391
+ "u",
3392
+ [
3393
+ "and",
3394
+ [
3395
+ "and",
3396
+ [
3397
+ "==",
3398
+ "@u.team",
3399
+ "player"
3400
+ ],
3401
+ [
3402
+ ">",
3403
+ "@u.health",
3404
+ 0.0
3405
+ ]
3406
+ ],
3407
+ [
3408
+ ">",
3409
+ [
3410
+ "array/len",
3411
+ [
3412
+ "array/filter",
3413
+ "@entity.units",
3414
+ [
3415
+ "fn",
3416
+ "e",
3417
+ [
3418
+ "and",
3419
+ [
3420
+ "and",
3421
+ [
3422
+ "==",
3423
+ "@e.team",
3424
+ "enemy"
3425
+ ],
3426
+ [
3427
+ ">",
3428
+ "@e.health",
3429
+ 0.0
3430
+ ]
3431
+ ],
3432
+ [
3433
+ "==",
3434
+ [
3435
+ "grid/manhattan-distance",
3436
+ [
3437
+ "object/get",
3438
+ "@e",
3439
+ "position"
3440
+ ],
3441
+ [
3442
+ "object/get",
3443
+ "@u",
3444
+ "position"
3445
+ ]
3446
+ ],
3447
+ 1.0
3448
+ ]
3449
+ ]
3450
+ ]
3451
+ ]
3452
+ ],
3453
+ 0.0
3454
+ ]
3455
+ ]
3456
+ ]
3457
+ ],
3458
+ [
3459
+ "fn",
3460
+ "u",
3461
+ {
3462
+ "id": [
3463
+ "str/concat",
3464
+ "fx-ai-",
3465
+ "@u.id"
3466
+ ],
3467
+ "message": "-1",
3468
+ "ttl": 3.0,
3469
+ "type": "hit",
3470
+ "x": [
3471
+ "object/get",
3472
+ [
3473
+ "object/get",
3474
+ "@u",
3475
+ "position"
3476
+ ],
3477
+ "x"
3478
+ ],
3479
+ "z": [
3480
+ "object/get",
3481
+ [
3482
+ "object/get",
3483
+ "@u",
3484
+ "position"
3485
+ ],
3486
+ "y"
3487
+ ]
3488
+ }
3489
+ ]
3490
+ ]
3491
+ ]
3492
+ ],
3047
3493
  [
3048
3494
  "set",
3049
3495
  "@entity.units",
@@ -3220,7 +3666,7 @@
3220
3666
  [
3221
3667
  "target",
3222
3668
  [
3223
- "array/first",
3669
+ "array/reduce",
3224
3670
  [
3225
3671
  "array/filter",
3226
3672
  "@entity.units",
@@ -3241,107 +3687,295 @@
3241
3687
  ]
3242
3688
  ]
3243
3689
  ]
3244
- ]
3245
- ]
3246
- ]
3247
- ],
3248
- [
3249
- "object/merge",
3250
- "@u",
3251
- {
3252
- "position": {
3253
- "x": [
3254
- "math/clamp",
3690
+ ],
3691
+ [
3692
+ "fn",
3693
+ [
3694
+ "nearest",
3695
+ "p"
3696
+ ],
3255
3697
  [
3256
- "+",
3698
+ "if",
3257
3699
  [
3258
- "object/get",
3700
+ "or",
3259
3701
  [
3260
- "object/get",
3261
- "@u",
3262
- "position"
3702
+ "==",
3703
+ "@nearest",
3704
+ null
3263
3705
  ],
3264
- "x"
3265
- ],
3266
- [
3267
- "math/sign",
3268
3706
  [
3269
- "-",
3707
+ "<",
3270
3708
  [
3271
- "object/get",
3709
+ "grid/manhattan-distance",
3272
3710
  [
3273
3711
  "object/get",
3274
- "@target",
3712
+ "@p",
3275
3713
  "position"
3276
3714
  ],
3277
- "x"
3715
+ [
3716
+ "object/get",
3717
+ "@u",
3718
+ "position"
3719
+ ]
3278
3720
  ],
3279
3721
  [
3280
- "object/get",
3722
+ "grid/manhattan-distance",
3281
3723
  [
3282
3724
  "object/get",
3283
- "@u",
3725
+ "@nearest",
3284
3726
  "position"
3285
3727
  ],
3286
- "x"
3728
+ [
3729
+ "object/get",
3730
+ "@u",
3731
+ "position"
3732
+ ]
3287
3733
  ]
3288
3734
  ]
3289
- ]
3290
- ],
3291
- 0.0,
3292
- [
3293
- "-",
3294
- "@entity.gridWidth",
3295
- 1.0
3735
+ ],
3736
+ "@p",
3737
+ "@nearest"
3296
3738
  ]
3297
3739
  ],
3298
- "y": [
3299
- "math/clamp",
3740
+ null
3741
+ ]
3742
+ ]
3743
+ ],
3744
+ [
3745
+ "if",
3746
+ [
3747
+ "==",
3748
+ "@target",
3749
+ null
3750
+ ],
3751
+ "@u",
3752
+ [
3753
+ "let",
3754
+ [
3755
+ [
3756
+ "nextX",
3300
3757
  [
3301
- "+",
3758
+ "math/clamp",
3302
3759
  [
3303
- "object/get",
3760
+ "+",
3304
3761
  [
3305
3762
  "object/get",
3306
- "@u",
3307
- "position"
3763
+ [
3764
+ "object/get",
3765
+ "@u",
3766
+ "position"
3767
+ ],
3768
+ "x"
3308
3769
  ],
3309
- "y"
3310
- ],
3311
- [
3312
- "math/sign",
3313
3770
  [
3314
- "-",
3771
+ "math/sign",
3315
3772
  [
3316
- "object/get",
3773
+ "-",
3317
3774
  [
3318
3775
  "object/get",
3319
- "@target",
3320
- "position"
3776
+ [
3777
+ "object/get",
3778
+ "@target",
3779
+ "position"
3780
+ ],
3781
+ "x"
3321
3782
  ],
3322
- "y"
3323
- ],
3783
+ [
3784
+ "object/get",
3785
+ [
3786
+ "object/get",
3787
+ "@u",
3788
+ "position"
3789
+ ],
3790
+ "x"
3791
+ ]
3792
+ ]
3793
+ ]
3794
+ ],
3795
+ 0.0,
3796
+ [
3797
+ "-",
3798
+ "@entity.gridWidth",
3799
+ 1.0
3800
+ ]
3801
+ ]
3802
+ ],
3803
+ [
3804
+ "nextY",
3805
+ [
3806
+ "math/clamp",
3807
+ [
3808
+ "+",
3809
+ [
3810
+ "object/get",
3324
3811
  [
3325
3812
  "object/get",
3813
+ "@u",
3814
+ "position"
3815
+ ],
3816
+ "y"
3817
+ ],
3818
+ [
3819
+ "math/sign",
3820
+ [
3821
+ "-",
3326
3822
  [
3327
3823
  "object/get",
3328
- "@u",
3329
- "position"
3824
+ [
3825
+ "object/get",
3826
+ "@target",
3827
+ "position"
3828
+ ],
3829
+ "y"
3330
3830
  ],
3331
- "y"
3831
+ [
3832
+ "object/get",
3833
+ [
3834
+ "object/get",
3835
+ "@u",
3836
+ "position"
3837
+ ],
3838
+ "y"
3839
+ ]
3332
3840
  ]
3333
3841
  ]
3842
+ ],
3843
+ 0.0,
3844
+ [
3845
+ "-",
3846
+ "@entity.gridHeight",
3847
+ 1.0
3334
3848
  ]
3849
+ ]
3850
+ ]
3851
+ ],
3852
+ [
3853
+ "if",
3854
+ [
3855
+ "and",
3856
+ [
3857
+ "grid/in-bounds",
3858
+ {
3859
+ "x": "@nextX",
3860
+ "y": "@nextY"
3861
+ },
3862
+ "@entity.gridWidth",
3863
+ "@entity.gridHeight"
3335
3864
  ],
3336
- 0.0,
3337
3865
  [
3338
- "-",
3339
- "@entity.gridHeight",
3340
- 1.0
3866
+ "and",
3867
+ [
3868
+ "==",
3869
+ [
3870
+ "object/get",
3871
+ [
3872
+ "array/find",
3873
+ "@config.tiles",
3874
+ [
3875
+ "fn",
3876
+ "t",
3877
+ [
3878
+ "and",
3879
+ [
3880
+ "==",
3881
+ [
3882
+ "object/get",
3883
+ "@t",
3884
+ "x"
3885
+ ],
3886
+ "@nextX"
3887
+ ],
3888
+ [
3889
+ "==",
3890
+ [
3891
+ "object/get",
3892
+ "@t",
3893
+ "y"
3894
+ ],
3895
+ "@nextY"
3896
+ ]
3897
+ ]
3898
+ ]
3899
+ ],
3900
+ "passable"
3901
+ ],
3902
+ true
3903
+ ],
3904
+ [
3905
+ "==",
3906
+ [
3907
+ "array/len",
3908
+ [
3909
+ "array/filter",
3910
+ "@entity.units",
3911
+ [
3912
+ "fn",
3913
+ "o",
3914
+ [
3915
+ "and",
3916
+ [
3917
+ "!=",
3918
+ "@o.id",
3919
+ "@u.id"
3920
+ ],
3921
+ [
3922
+ "and",
3923
+ [
3924
+ ">",
3925
+ "@o.health",
3926
+ 0.0
3927
+ ],
3928
+ [
3929
+ "and",
3930
+ [
3931
+ "==",
3932
+ [
3933
+ "object/get",
3934
+ [
3935
+ "object/get",
3936
+ "@o",
3937
+ "position"
3938
+ ],
3939
+ "x"
3940
+ ],
3941
+ "@nextX"
3942
+ ],
3943
+ [
3944
+ "==",
3945
+ [
3946
+ "object/get",
3947
+ [
3948
+ "object/get",
3949
+ "@o",
3950
+ "position"
3951
+ ],
3952
+ "y"
3953
+ ],
3954
+ "@nextY"
3955
+ ]
3956
+ ]
3957
+ ]
3958
+ ]
3959
+ ]
3960
+ ]
3961
+ ],
3962
+ 0.0
3963
+ ]
3341
3964
  ]
3342
- ]
3343
- }
3344
- }
3965
+ ],
3966
+ [
3967
+ "object/merge",
3968
+ "@u",
3969
+ {
3970
+ "position": {
3971
+ "x": "@nextX",
3972
+ "y": "@nextY"
3973
+ }
3974
+ }
3975
+ ],
3976
+ "@u"
3977
+ ]
3978
+ ]
3345
3979
  ]
3346
3980
  ],
3347
3981
  "@u"
@@ -3464,11 +4098,38 @@
3464
4098
  "render-ui",
3465
4099
  "main",
3466
4100
  {
4101
+ "addons": {
4102
+ "children": [
4103
+ {
4104
+ "action": "END_TURN",
4105
+ "label": "End Turn",
4106
+ "type": "button",
4107
+ "variant": "primary"
4108
+ },
4109
+ {
4110
+ "action": "CANCEL",
4111
+ "label": "Cancel",
4112
+ "type": "button",
4113
+ "variant": "secondary"
4114
+ },
4115
+ {
4116
+ "action": "PLAY_AGAIN",
4117
+ "label": "Restart",
4118
+ "type": "button",
4119
+ "variant": "secondary"
4120
+ }
4121
+ ],
4122
+ "direction": "vertical",
4123
+ "gap": "sm",
4124
+ "type": "stack"
4125
+ },
3467
4126
  "children": [
3468
4127
  {
3469
4128
  "attackTargets": "@entity.attackTargets",
3470
4129
  "backgroundColor": "@config.bgColor",
4130
+ "events": "@entity.fx",
3471
4131
  "features": "@config.features",
4132
+ "interpolateUnits": true,
3472
4133
  "scale": "@config.scale",
3473
4134
  "selectedUnitId": "@entity.selectedUnitId",
3474
4135
  "tileClickEvent": "TILE_CLICK",
@@ -3497,6 +4158,41 @@
3497
4158
  ],
3498
4159
  "type": "game-hud"
3499
4160
  },
4161
+ "overlay": [
4162
+ "if",
4163
+ [
4164
+ "!=",
4165
+ "@entity.result",
4166
+ "none"
4167
+ ],
4168
+ {
4169
+ "options": [
4170
+ {
4171
+ "event": "PLAY_AGAIN",
4172
+ "id": "again",
4173
+ "label": "Play Again",
4174
+ "variant": "primary"
4175
+ }
4176
+ ],
4177
+ "subtitle": [
4178
+ "str/concat",
4179
+ "Turn ",
4180
+ "@entity.turn"
4181
+ ],
4182
+ "title": [
4183
+ "if",
4184
+ [
4185
+ "==",
4186
+ "@entity.result",
4187
+ "victory"
4188
+ ],
4189
+ "VICTORY",
4190
+ "DEFEAT"
4191
+ ],
4192
+ "type": "game-menu"
4193
+ },
4194
+ null
4195
+ ],
3500
4196
  "type": "game-shell"
3501
4197
  }
3502
4198
  ]
@@ -3516,6 +4212,130 @@
3516
4212
  ],
3517
4213
  "interval": 1000.0,
3518
4214
  "name": "enemyAiTick"
4215
+ },
4216
+ {
4217
+ "effects": [
4218
+ [
4219
+ "set",
4220
+ "@entity.fx",
4221
+ [
4222
+ "array/filter",
4223
+ [
4224
+ "array/map",
4225
+ "@entity.fx",
4226
+ [
4227
+ "fn",
4228
+ "e",
4229
+ [
4230
+ "object/merge",
4231
+ "@e",
4232
+ {
4233
+ "ttl": [
4234
+ "-",
4235
+ [
4236
+ "object/get",
4237
+ "@e",
4238
+ "ttl"
4239
+ ],
4240
+ 1.0
4241
+ ]
4242
+ }
4243
+ ]
4244
+ ]
4245
+ ],
4246
+ [
4247
+ "fn",
4248
+ "e",
4249
+ [
4250
+ ">",
4251
+ [
4252
+ "object/get",
4253
+ "@e",
4254
+ "ttl"
4255
+ ],
4256
+ 0.0
4257
+ ]
4258
+ ]
4259
+ ]
4260
+ ],
4261
+ [
4262
+ "render-ui",
4263
+ "main",
4264
+ {
4265
+ "addons": {
4266
+ "children": [
4267
+ {
4268
+ "action": "END_TURN",
4269
+ "label": "End Turn",
4270
+ "type": "button",
4271
+ "variant": "primary"
4272
+ },
4273
+ {
4274
+ "action": "CANCEL",
4275
+ "label": "Cancel",
4276
+ "type": "button",
4277
+ "variant": "secondary"
4278
+ },
4279
+ {
4280
+ "action": "PLAY_AGAIN",
4281
+ "label": "Restart",
4282
+ "type": "button",
4283
+ "variant": "secondary"
4284
+ }
4285
+ ],
4286
+ "direction": "vertical",
4287
+ "gap": "sm",
4288
+ "type": "stack"
4289
+ },
4290
+ "children": [
4291
+ {
4292
+ "attackTargets": "@entity.attackTargets",
4293
+ "backgroundColor": "@config.bgColor",
4294
+ "events": "@entity.fx",
4295
+ "features": "@config.features",
4296
+ "interpolateUnits": true,
4297
+ "scale": "@config.scale",
4298
+ "selectedUnitId": "@entity.selectedUnitId",
4299
+ "tileClickEvent": "TILE_CLICK",
4300
+ "tiles": "@config.tiles",
4301
+ "type": "game-canvas-3d",
4302
+ "unitClickEvent": "UNIT_CLICK",
4303
+ "unitScale": "@config.unitScale",
4304
+ "units": "@entity.units",
4305
+ "validMoves": "@entity.validMoves"
4306
+ }
4307
+ ],
4308
+ "hud": {
4309
+ "stats": [
4310
+ {
4311
+ "label": "Turn",
4312
+ "value": "@entity.turn"
4313
+ },
4314
+ {
4315
+ "label": "Phase",
4316
+ "value": "@entity.phase"
4317
+ },
4318
+ {
4319
+ "label": "Result",
4320
+ "value": "@entity.result"
4321
+ }
4322
+ ],
4323
+ "type": "game-hud"
4324
+ },
4325
+ "type": "game-shell"
4326
+ }
4327
+ ]
4328
+ ],
4329
+ "guard": [
4330
+ ">",
4331
+ [
4332
+ "array/len",
4333
+ "@entity.fx"
4334
+ ],
4335
+ 0.0
4336
+ ],
4337
+ "interval": 500.0,
4338
+ "name": "fxTick"
3519
4339
  }
3520
4340
  ]
3521
4341
  }