Merge pull request #147 from argonui/token-manager-counter-token

Token Manager: Bugfix for spawning of multiple tokens and default rotation of damage and horror tokens
This commit is contained in:
Chr1Z 2023-01-04 10:22:32 +01:00 committed by GitHub
commit 817a15bec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 205 additions and 219 deletions

View File

@ -87,9 +87,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.000002114869,
"rotY": 180,
"rotZ": -0.00000344551631,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -144,9 +144,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": -0.00000637244239,
"rotY": 180,
"rotZ": 1.0489314e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -201,9 +201,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.000006856813,
"rotY": 180,
"rotZ": 6.24681149e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -258,9 +258,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000810479651,
"rotY": 180,
"rotZ": 4.15571648e-8,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -315,9 +315,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000515672855,
"rotY": 180,
"rotZ": -9.08177e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -372,9 +372,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.000007670889,
"rotY": 180,
"rotZ": 2.730384e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -429,9 +429,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.000009659233,
"rotY": 180,
"rotZ": 0.000003145974,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -486,9 +486,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": 9.30901138e-7,
"rotY": 180,
"rotZ": 0.0000140537149,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -543,9 +543,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000349763832,
"rotY": 180,
"rotZ": -0.000011208811,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -600,9 +600,9 @@
"posX": -26.8049335,
"posY": 1.01000011,
"posZ": 9.519388,
"rotX": -0.00000487788157,
"rotY": 180.000015,
"rotZ": 0.00000283701524,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -657,9 +657,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": -0.0000112864509,
"rotY": 180,
"rotZ": 0.000009893568,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -714,9 +714,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000381104314,
"rotY": 180.000015,
"rotZ": -0.0000125628785,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -771,9 +771,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.0000109130187,
"rotY": 180,
"rotZ": 0.00001615263,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -828,9 +828,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": 3.85535827e-7,
"rotY": 180.000015,
"rotZ": -3.36548e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -885,9 +885,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.0000105401759,
"rotY": 180.000015,
"rotZ": 0.00000126669079,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -942,9 +942,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000114314139,
"rotY": 180.000015,
"rotZ": 0.00000173802164,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -999,9 +999,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000184584269,
"rotY": 180.000015,
"rotZ": 0.0000053036315,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1056,9 +1056,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000102766649,
"rotY": 180.000015,
"rotZ": -0.0000137765155,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1113,9 +1113,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.0000019677243,
"rotY": 180.000015,
"rotZ": 0.00000249157665,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1170,9 +1170,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00001276227,
"rotY": 180.000015,
"rotZ": 0.00000153182373,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1227,9 +1227,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000313882947,
"rotY": 180.000015,
"rotZ": -4.327291e-8,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1284,9 +1284,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -9.526744e-8,
"rotY": 180,
"rotZ": -7.436876e-8,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1341,9 +1341,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000168156157,
"rotY": 180.000015,
"rotZ": 0.00000219717617,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1398,9 +1398,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.0000069150783,
"rotY": 180.000015,
"rotZ": 0.000002574338,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1455,9 +1455,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.000011233,
"rotY": 180,
"rotZ": 0.0000167793787,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1512,9 +1512,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000190952255,
"rotY": 180,
"rotZ": 6.814834e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1569,9 +1569,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.0000108585373,
"rotY": 180,
"rotZ": 0.00000540023439,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1626,9 +1626,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000721516062,
"rotY": 180,
"rotZ": -0.000002222035,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1683,9 +1683,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000655812164,
"rotY": 180,
"rotZ": -4.21542978e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1740,9 +1740,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.000008363716,
"rotY": 180,
"rotZ": 0.0000125134511,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1797,9 +1797,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000165363917,
"rotY": 180,
"rotZ": 0.00000755110068,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1854,9 +1854,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": -0.00000433588548,
"rotY": 180,
"rotZ": 0.0000134007632,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1911,9 +1911,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.000003948265,
"rotY": 180,
"rotZ": -0.0000210753624,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -1968,9 +1968,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000305671983,
"rotY": 180,
"rotZ": -0.000004596211,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2025,9 +2025,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 6.80305163e-7,
"rotY": 180,
"rotZ": -0.00000447995035,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2082,9 +2082,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000368703422,
"rotY": 180,
"rotZ": 2.98529955e-7,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2139,9 +2139,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000327916132,
"rotY": 180,
"rotZ": 8.00865e-8,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2196,9 +2196,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.0000132305695,
"rotY": 180,
"rotZ": -0.000008536388,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2253,9 +2253,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": 0.000008879468,
"rotY": 180,
"rotZ": -0.0000035132357,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2310,9 +2310,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000577568835,
"rotY": 180,
"rotZ": 0.000007164294,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2367,9 +2367,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.0000150068281,
"rotY": 180,
"rotZ": 0.00000370904536,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2424,9 +2424,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000477549,
"rotY": 180,
"rotZ": -0.000008039457,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2481,9 +2481,9 @@
"posX": -26.8049335,
"posY": 1.01000011,
"posZ": 9.519388,
"rotX": -0.0000132930072,
"rotY": 180,
"rotZ": -0.0000175149926,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2538,9 +2538,9 @@
"posX": -26.8049335,
"posY": 1.00999987,
"posZ": 9.519388,
"rotX": -0.0000251728725,
"rotY": 180,
"rotZ": -0.0000107583146,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2595,9 +2595,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.0000107346423,
"rotY": 180,
"rotZ": 0.0000103672137,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2652,9 +2652,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 1.53614124e-7,
"rotY": 180,
"rotZ": -0.000009400431,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2709,9 +2709,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": -0.00000806476,
"rotY": 180,
"rotZ": -0.0000194595268,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2766,9 +2766,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000166816653,
"rotY": 180,
"rotZ": -0.0000142901517,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2823,9 +2823,9 @@
"posX": -26.8049335,
"posY": 1.01,
"posZ": 9.519388,
"rotX": 0.00000192622952,
"rotY": 180,
"rotZ": 0.00000437234166,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.239203319,
"scaleY": 1,
"scaleZ": 0.239203319
@ -2840,9 +2840,9 @@
"posX": 78.665,
"posY": 2.351,
"posZ": -1.205,
"rotX": 357,
"rotX": 0,
"rotY": 270,
"rotZ": 5,
"rotZ": 0,
"scaleX": 0.24,
"scaleY": 1,
"scaleZ": 0.24

View File

@ -87,9 +87,9 @@
"posX": -27.7533741,
"posY": 1.210006,
"posZ": 15.9442654,
"rotX": -0.0000202706469,
"rotY": 270.015259,
"rotZ": 0.0000220759175,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -144,9 +144,9 @@
"posX": -27.7533741,
"posY": 1.210006,
"posZ": 15.9442368,
"rotX": -0.0000104253941,
"rotY": 270.015137,
"rotZ": 0.0000102804506,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -201,9 +201,9 @@
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.9442348,
"rotX": 0.00000189065361,
"rotY": 270.01532,
"rotZ": 0.0000159575811,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -258,9 +258,9 @@
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.9442024,
"rotX": -0.00003432232,
"rotY": 270.016,
"rotZ": -0.00000373151761,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -315,9 +315,9 @@
"posX": -27.7533741,
"posY": 1.21000624,
"posZ": 15.94415,
"rotX": -0.0000249414188,
"rotY": 270.0157,
"rotZ": 0.00000292043842,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -372,9 +372,9 @@
"posX": -27.7533741,
"posY": 1.21000612,
"posZ": 15.944108,
"rotX": -0.0000233948358,
"rotY": 270.015656,
"rotZ": 0.00000218774017,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -429,9 +429,9 @@
"posX": -27.753376,
"posY": 1.210006,
"posZ": 15.9440966,
"rotX": -1.57902083e-8,
"rotY": 270.016541,
"rotZ": -0.0000219759459,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -486,9 +486,9 @@
"posX": -27.753376,
"posY": 1.21000612,
"posZ": 15.9440622,
"rotX": -0.0000209277514,
"rotY": 270.016724,
"rotZ": 0.00004970206,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25
@ -503,9 +503,9 @@
"posX": 79.031,
"posY": 2.307,
"posZ": -1.38,
"rotX": 358,
"rotX": 0,
"rotY": 270,
"rotZ": 1,
"rotZ": 0,
"scaleX": 0.25,
"scaleY": 1,
"scaleZ": 0.25

View File

@ -4,22 +4,22 @@ do
local PLAYER_CARD_TOKEN_OFFSETS = {
[1] = {
Vector(0, 8, -0.2)
Vector(0, 3, -0.2)
},
[2] = {
Vector(0.4, 20, -0.2),
Vector(-0.4, 20, -0.2)
Vector(0.4, 3, -0.2),
Vector(-0.4, 3, -0.2)
},
[3] = {
Vector(0, 8, -0.9),
Vector(0.4, 8, -0.2),
Vector(-0.4, 8, -0.2)
Vector(0, 3, -0.9),
Vector(0.4, 3, -0.2),
Vector(-0.4, 3, -0.2)
},
[4] = {
Vector(0.4, 10, -0.9),
Vector(-0.4, 10, -0.9),
Vector(0.4, 10, -0.2),
Vector(-0.4, 10, -0.2)
Vector(0.4, 3, -0.9),
Vector(-0.4, 3, -0.9),
Vector(0.4, 3, -0.2),
Vector(-0.4, 3, -0.2)
},
[5] = {
Vector(0.7, 3, -0.9),
@ -145,9 +145,9 @@ do
---@param card Object Card to spawn tokens on
---@param tokenType String type of token to spawn, valid values are "damage", "horror",
-- "resource", "doom", or "clue"
---@param tokenCount How many tokens to spawn. For damage or horror this value will be set to the
---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the
-- spawned state object rather than spawning multiple tokens
---@param shiftDown An offset for the z-value of this group of tokens
---@param shiftDown Number An offset for the z-value of this group of tokens
TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown)
local optionPanel = Global.getTable("optionPanel")
@ -165,27 +165,13 @@ do
---@param card Object Card to spawn tokens on
---@param tokenType String type of token to spawn, valid values are "damage" and "horror". Other
-- types should use spawnMultipleTokens()
---@param tokenValue Value to set the damage/horror to
---@param shiftDown An offset for the z-value of this group of tokens
---@param tokenValue Number Value to set the damage/horror to
TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)
if tokenCount < 1 or tokenCount > 50 then
return
end
local offsets = PLAYER_CARD_TOKEN_OFFSETS[1]
if shiftDown ~= nil then
-- Copy the offsets to make sure we don't change the static values
local baseOffsets = offsets
offsets = { }
for i, baseOffset in ipairs(baseOffsets) do
offsets[i] = baseOffset
offsets[i][3] = offsets[i][3] + shiftDown
end
end
local pos = card.positionToWorld(offsets[1])
pos.y = card.getPosition().y + 0.15
TokenManager.spawnToken(pos, tokenType, card.getRotation(), function(spawned)
spawned.setState(tokenValue)
end)
if tokenValue < 1 or tokenValue > 50 then return end
local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))
local rot = card.getRotation()
TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)
end
TokenManager.spawnResourceCounterToken = function(card, tokenCount)
@ -199,18 +185,17 @@ do
-- Spawns a number of tokens.
---@param tokenType String type of token to spawn, valid values are resource", "doom", or "clue".
-- Other types should use spawnCounterToken()
---@param tokenCount How many tokens to spawn. For damage or horror this value will be set to the
-- spawned state object rather than spawning multiple tokens
---@param shiftDown An offset for the z-value of this group of tokens
---@param tokenCount Number How many tokens to spawn
---@param shiftDown Number An offset for the z-value of this group of tokens
TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown)
if tokenCount < 1 or tokenCount > 12 then
return
end
local offsets
local offsets = {}
if tokenType == "clue" then
offsets = internal.buildClueOffsets(card, tokenCount)
else
offsets = { }
for i = 1, tokenCount do
offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])
-- Fix the y-position for the spawn, since positionToWorld considers rotation which can
@ -218,7 +203,7 @@ do
offsets[i].y = card.getPosition().y + 0.15
end
end
-- end
if shiftDown ~= nil then
-- Copy the offsets to make sure we don't change the static values
local baseOffsets = offsets
@ -228,8 +213,10 @@ do
offsets[i][3] = offsets[i][3] + shiftDown
end
end
if offsets == nil then
error("couldn't find offsets for " .. tokenCount .. ' tokens')
return
end
for i = 1, tokenCount do
@ -243,7 +230,7 @@ do
-- "resource", "doom", or "clue"
---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,
-- x and z will use the default rotation from the source bag
---@param callback A callback function triggered after the new token is spawned
---@param callback function A callback function triggered after the new token is spawned
TokenManager.spawnToken = function(position, tokenType, rotation, callback)
internal.initTokenTemplates()
if tokenTemplates[tokenType] == nil then
@ -251,14 +238,13 @@ do
return
end
local tokenTemplate = tokenTemplates[tokenType]
-- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag
local rot = Vector(tokenTemplate.Transform.rotX,
tokenTemplate.Transform.rotY,
270,
tokenTemplate.Transform.rotZ)
if rotation ~= nil then
rot.y = rotation.y
else
rot.y = 270
end
tokenTemplate.Nickname = ""
@ -363,7 +349,7 @@ do
end
log("Spawning use array tokens for "..card.getName()..'['..card.getDescription()..']: '..tokenCount.."x "..token)
-- Shift each spawned group after the first down so they don't pile on each other
TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.6)
TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8)
end
end
tokenSpawnTracker.markTokensSpawned(card.getGUID())
@ -409,7 +395,7 @@ do
end
internal.getPlayerCardData = function(card)
return playerCardData[card.getName()..':'..card.getDescription()]
return playerCardData[card.getName() .. ':' .. card.getDescription()]
or playerCardData[card.getName()]
end