Agent Harness · VibeGit
Agent Harness Публичная копия обвязки агентной разработки: гейты, journeys, скиллы и шаблоны. Без ключей и личных данных.
agent-harness / tools / spells-assets / ue / spells / arcane.js 925 строк · изменён 6 нояб., 03:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
import * as THREE from 'three' ;
import { U , COMMON_GLSL , NOISE_GLSL , LINES_BLENDING , arenaStatic } from '../vfx/common.js' ;
import { REFRACT_GLSL } from '../vfx/Refraction.js' ;
import { instanced } from '../vfx/Ribbons.js' ;
_a _b _c _d
_e1 _e2 _om _t
_pa _ba
_pa p a _ba b a
h _pa _ba _ba _ba
_pa _ba h r
fx
spark
sparkle
mote
rise
shellMote
shellSpark
ringSpark
waveSpark
deflect
tintC
col core glow
uColor uCore uGlow
look
cC cK cG
p
p cC p cK p cG
cC p cK p cG p
col cC core cK glow cG
uColor col col col uCore core core core uGlow glow glow glow
cK cC
cK cG
cK cC
sgeo
sgeo
sgeo
aA sgeo aB sgeo aV sgeo
sgeo
sprites sgeo
sprites
sprites
fx sprites
pops
popHead
q pops popHead popHead popHead
q pos q size q life q q fx
q c k q c k q c k
groups
shellGeo
shields
i i i
su
look uColor uCore uGlow
mat
su
mesh shellGeo mat
mesh
mesh
mesh
fx mesh
shields
mesh su
seen
c dp fx c out dp c dp out c
out m
d p
o fx
o
o o o o
d d p o o o
d
best bd
sh shields
sh sh
dist pos sh
dist sh
k dist sh
k bd bd k best sh
best
_d pos sh
l _d
l _d _d l
h sh sh
sh sh
h _d h h s
h tint col
sh sh s
sh s
sh
sh _d sh sh sh s
h core
sh pos
sh
sh pos strength tint
_e1 pos sh
_a sh _e1 sh
spark _a spark _e1 spark strength
spark
_a _e1
deflect _a deflect _e1 deflect strength
deflect
_a strength tint col
c str i c c c
h spell
h h out col
out h h h h h h
out c c
m g i
_e1 c
_e1 _e1
_e1
_e2 _e1 c
a i g c fx
_c _e1 a _e2 a
c m _c
m _c fx p c
fx p
_t fx fx fx
m fx fx fx c
c m
m m
m fx
m fx fx
m fx
tr m
tr
tr tr p tr tr tr tr
tr p tr col core
m col p
spark m spark m spark p
spark
c c
tgt c m _b
r _a tgt m dist r
speed m
dist speed dt
rh r dist
_om m rh dist
_d _om rh p speed
_d _t rh p m m
vh _t m speed
_e1 vh
_e1 _e1
_e1
_e2 _e1 vh
ph m m m wa p dist
_d _e1 ph wa _e2 ph wa
along _d vh
_d vh along
lat _d amax
lat amax _d amax lat
aimK vh rh
_d vh aimK p speed aimK speed aimK
m _d dt
m m dt
m dt
m m c
m
g
m m
sh m
sh sh m
_e1 m
spark m spark _e1 spark p
spark
deflect m deflect _e1 deflect p
deflect
m col p
sh fx m
m
p col p
fx
m
m m
c g
fx
g g g fx m col
sh c fx c _e1
fx
c m
c
m m c
c c c p
sh
s shields s sh s
d sh
sh c
caster p
caster p p
caster _a c c
c _a fx c
_a c c
sh _a
s shields s sh s s s sh s s s
sh sh sh c sh sh sh sh p
sh sh sh sh sh caster sh sh sh
sh fx
h sh h
c sh
sh sh
col c
sh fx
sh fx
sh sh sh sh col sh sh
c sh
sh
sh
sh
sh sh
sh sh fx sh sh sh
sh fx
sh
sh col core sh
rf sh
sh sh rf rf
p col p
fx
ringSpark sh sh ringSpark rf ringSpark
ringSpark p
sh sh rf
c
fx
fx
fx p
d c g d
g
m g m m m
g g g
sh d
sh sh c
sh sh sh sh
sh sh sh sh
sh sh sh
d d
d d d d
hit
sh shields
sh sh x sh z sh sh sh
out sh
sh
k k k
p d c
name
d d d d
d
d
c c p d
g d groups c
g p g g
m g m m
d fx
d d d d d col c d d d
c c col
c
d fx
name
c fx
name
c d c p d
name c
c
p g c
g
g g c g c g g p
i i g i
m g i
m c m p dt c c g m p
g g
p d c
c c p d dt
d k c c c
fade c c c
d d dt
d
close c c c d
c d
d k
d k d p close
d c
c
c mote mote k p dt
c k p
g d
n first last
g c i i g i
m g i
m
m m
sparkle m sparkle m sparkle p dt
first first m
last m
n
n d
kk dt
first kk last kk
n n fade p d p
p
look p p
list fx list
list c list
was seen c
seen c c c
c c was c c
sh c
sh
_a c sh
_a sh
c _a _a c sh
_a sh sh
_a c
_a c tintC
cam fx
sh shields
on sh sh
sh on
on
u sh
rise sh
dis sh sh
breathe sh sh sh
u sh sh sh sh
u rise dis p sh breathe dis sh
u sh
u cam sh sh sh
nh
h sh
h h dt h h
h
u nh h h h
u nh h h h h h h h
u nh
aA aB aV
n
p
g groups
g
i i g n i
m g i
m
o n
o m o m o m o m m
o col o col o col o m
o m o m o m o m
n
q pops
q q
q dt
q q n
o n
o q o q o q o q
o q o q o q o q q
o o o o q
n
sgeo n
sprites n
n aA aB aV
sh d
sh sh c
rf sh
c
k c c
sh sh k sh p sh c
rise sh sh rise rf rise k
rise k p dt
sh sh k p
sh dt
sh sh dt
t sh
om
sh om om sh om sh dt
sh sh sh dt
dis sh t
dis sh
sh
shellMote sh shellMote sh shellMote shellMote p
shellMote
t sh c sh
riseK t uF riseK
uF
pol uF sh sh yF sh sh pol
ringSpark sh yF sh ringSpark sh pol
ringSpark ringSpark p dt
dis shellSpark sh shellSpark sh shellSpark p dis dt
hb
h sh h h hb h hb hb h
hb dis
th hb look
th
_e1 hb hb _t
_e2 hb _e1
az fx ca az sa az
_c _e1 ca _e2 sa
_d hb th _c th
_a sh _d sh
_a
_b hb th _c th
waveSpark _a waveSpark _b _d
waveSpark hb p hb
dis fx p dt
_a fx fx fx sh sh
sh _a
shellMote sh shellMote sh shellMote p dis dt
sh dt
sh dis
sh
sh sh rf
c t
fx
sh sh p t sh c
sh sh sh riseK dis dis dis p
sh dt
sh sh sh p sh t
const
TAU
=
Math
.
PI
*
2
;
const
MAX_MISSILES
=
12
,
LAUNCH_GAP
=
0.06
,
MAX_CASTS
=
16
;
const
MAX_SHIELDS
=
3
,
MAX_HITS
=
8
,
MAX_SPRITES
=
128
,
MAX_POPS
=
48
;
const
FORM_TIME
=
0.45
,
DISSOLVE_TIME
=
0.8
;
const
SHIELD_VERT
=
`
uniform vec4 uSphere; // centre, radius (0 = hidden)
uniform vec4 uWobble; // x: l = 2 membrane mode amplitude (fraction of r)
out vec3 vPos;
out float vViewZ;
void main() {
vec3 n = normalize(position);
vPos = uSphere.xyz + n * uSphere.w * (1.0 + uWobble.x * (1.5 * n.y * n.y - 0.5));
vec4 view = viewMatrix * vec4(vPos, 1.0);
vViewZ = -view.z;
gl_Position = uSphere.w > 0.0 ? projectionMatrix * view : vec4(2.0, 2.0, 2.0, 1.0);
} `
;
const
SHIELD_FRAG
=
`
uniform vec4 uSphere;
uniform vec4 uForm; // rise front (0 floor .. 1.25 past the crown), dissolve 0..1, intensity, seed
uniform vec4 uHits[ ${ MAX_HITS } ]; // live ripples first: dir * strength, age s
uniform vec3 uHitC[ ${ MAX_HITS } ]; // the attacker's colour (linear) per ripple
uniform int uHitN;
uniform vec4 uLook; // filaments, distortion, ripple speed rad/s, thin film
uniform vec3 uColor;
uniform vec3 uCore;
uniform vec3 uGlow;
uniform float uInside; // 1: the camera is inside, the wall is the back faces (no far wall)
in vec3 vPos;
in float vViewZ;
out vec4 fragColor;
float gField; // fbm at the last wall point: film thickness, ragged fronts
// plasma filaments crawling over the membrane: ridged fbm, domain-warped by curl noise. Main veins
// are a white-hot ^16 core in a soft ^4 sheath; fine veins (second octave) crawl faster and
// flicker; a Worley mask leaves calm patches between the burning ones
float filaments(vec3 n) {
float t = uTime;
vec3 w = curl3(n * 0.31 + vec3(uForm.w, t * 0.05, 0.0));
vec3 p = n * 0.83 + w * 0.12 + vec3(t * 0.025, -t * 0.06, uForm.w);
vec4 A = noise3v(p);
float b = noise3(p * 2.17 + w * 0.1 + vec3(0.37, 0.37 - t * 0.22, 0.37));
gField = A.r;
float ra = 1.0 - abs(A.r * 2.0 - 1.0), rb = 1.0 - abs(b * 2.0 - 1.0);
float r4 = ra * ra; r4 *= r4;
float r16 = r4 * r4; r16 *= r16;
float f4 = rb * rb; f4 *= f4;
float f16 = f4 * f4; f16 *= f16;
float mask = smoothstep(0.3, 0.75, A.g);
return (r16 * 1.5 + r4 * 0.06 + f16 * 0.45) * (0.15 + 0.85 * mask);
}
// hexagonal lattice: xy = offset from the cell centre (edge at |.| ~ 0.5), zw = cell id
vec4 hexCell(vec2 p) {
const vec2 k = vec2(1.0, 1.7320508);
vec4 hc = floor(vec4(p, p - vec2(0.5, 1.0)) / k.xyxy) + 0.5;
vec4 h = vec4(p - hc.xy * k, p - (hc.zw + 0.5) * k);
return dot(h.xy, h.xy) < dot(h.zw, h.zw) ? vec4(h.xy, hc.xy) : vec4(h.zw, hc.zw + 0.5);
}
// ripple packets: slope along the great circle (tilt, for refraction), crest light per channel
// (focusing; the RGB phase split is the dispersion fringe) and the hot spot where it struck.
// ink: what the hit throws onto the shell, in the attacker's colour. Its energy splashes out over
// the membrane and tears along the plasma (fil) instead of passing through, and the field's hex
// lattice lights cell by cell as the front sweeps past (film shield-impact language)
void ripples(vec3 n, float fil, out vec3 tilt, out vec3 crest, out float spot, out vec3 ink) {
tilt = vec3(0.0); crest = vec3(0.0); spot = 0.0; ink = vec3(0.0);
for (int i = 0; i < ${ MAX_HITS } ; i++) {
if (i >= uHitN) break;
vec4 H = uHits[i];
float s = length(H.xyz);
vec3 hd = H.xyz / s;
float c = clamp(dot(n, hd), -1.0, 1.0), ang = acos(c);
float fr = H.w * uLook.z, x = (ang - fr) / 0.15;
float A = s * exp(-1.4 * H.w - x * x) * inversesqrt(max(sin(ang), 0.15));
vec3 ph = x * 4.2 + vec3(-0.22, 0.0, 0.22);
vec3 cr = max(cos(ph), 0.0); cr *= cr; cr *= cr;
crest += A * cr;
vec3 away = n * c - hd;
float al = sqrt(dot(away, away));
tilt += away * (A * sin(ph.y) / max(al, 1e-3));
spot += s * exp(-ang * ang * 45.0 - H.w * 6.0);
// splash: spreads like a thrown liquid (radius ~ sqrt t), thinning and tearing as it goes
float sp = 0.12 + 0.95 * sqrt(H.w);
float splash = s * exp(-2.2 * H.w) * smoothstep(sp, sp * 0.35, ang) * (0.25 + 2.5 * fil + 0.6 * smoothstep(0.3, 0.0, ang));
// hex cells in the impact's own azimuthal-equidistant frame (true near the hit, where they show)
vec3 t1 = normalize(cross(hd, abs(hd.y) < 0.9 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0))), t2 = cross(hd, t1);
vec2 q = vec2(dot(away, t1), dot(away, t2)) * (ang / max(al, 1e-4)) / 0.11;
vec4 hx = hexCell(q);
float he = max(dot(abs(hx.xy), vec2(0.5, 0.8660254)), abs(hx.x)); // 0.5 on the cell border
float ca = length(q - hx.xy) * 0.11, d = fr - ca; // the cell centre's angle, front lead
float lit = smoothstep(-0.04, 0.02, d) * exp(-max(d, 0.0) * 4.5) * smoothstep(1.7, 0.5, ca);
float hexE = s * exp(-1.2 * H.w) * lit * (smoothstep(0.38, 0.49, he) + 0.1) * (0.4 + hash12(hx.zw + float(i) * 7.3));
ink += uHitC[i] * (splash * 2.2 + hexE * 2.5 * uLook.x);
}
}
// emission of the membrane at p (unit normal n); lb = 1 - |cos| (0 face-on, 1 grazing).
// alive: membrane present (the rise front passed, not burnt away); edge: the incandescent fronts
vec3 wall(vec3 p, vec3 n, float lb, out float alive, out float edge, out vec3 tilt) {
float fil = filaments(n);
// u: arc length up the dome, 0 on the floor ring, 1 at the crown (fronts move at even surface speed)
float phi0 = acos(clamp(-uSphere.y / uSphere.w, -1.0, 1.0));
float u = clamp(1.0 - acos(clamp(n.y, -1.0, 1.0)) / phi0, 0.0, 1.0);
float f = uForm.x - u - 0.2 * (gField - 0.5); // ragged rise front
float g = gField * 0.9 + (1.0 - u) * 0.45 + 0.05 - uForm.y * 1.45; // burn-through holes, crown first
alive = step(0.0, f) * step(0.0, g);
// fronts: a thin white-hot line in a narrow coloured sheath
edge = exp(-f * f * 5000.0) + 0.15 * exp(-f * f * 500.0);
if (uForm.y > 0.0) edge += exp(-g * g * 6000.0) + 0.15 * exp(-g * g * 600.0);
vec3 crest, ink; float spot;
ripples(n, fil, tilt, crest, spot, ink);
float rim = lb * lb * lb, wave = crest.g;
// a thin glowing film: near-clear face-on, limb-brightened where the eye grazes through it
vec3 e = uGlow * (0.012 + 0.55 * rim) // sheath
+ mix(uColor, uCore, 0.3) * fil * uLook.x * (0.3 + 1.4 * rim + 2.5 * wave) // filaments
+ (uCore * 1.5 + uColor) * crest * 1.1 // caustic crests
+ ink + (uCore * 4.0 + ink * 0.5) * spot;
return e * alive + (uCore * 3.0 + uColor * 2.0) * edge;
}
void main() {
bool inside = uInside > 0.5;
if (gl_FrontFacing == inside) discard;
vec3 C = uSphere.xyz;
float R = uSphere.w;
vec3 rd = normalize(vPos - cameraPosition);
vec3 n = normalize(vPos - C);
float cv = -dot(n, rd), ac = abs(cv), lb = 1.0 - ac;
float alive, edge; vec3 tilt;
vec3 emit = wall(vPos, n, lb, alive, edge, tilt);
float field = gField;
float sceneZ = linearDepth(texelFetch(uSceneDepth, ivec2(gl_FragCoord.xy), 0).r);
// the hot line where the membrane cuts the floor or a dummy
float dz = max(sceneZ - vViewZ, 0.0);
emit += (uCore * exp(-dz / 0.035) * 2.5 + uColor * exp(-dz / 0.18)) * alive;
if (!inside) {
// the far wall through this one: the ray's exit from the sphere, unless the floor or what
// stands inside is in front of it; then the glowing haze along the chord in between
vec3 oc = cameraPosition - C;
float b = dot(oc, rd);
float tOut = -b + sqrt(max(b * b - dot(oc, oc) + R * R, 0.0));
vec3 pB = cameraPosition + rd * tOut;
float kz = max(dot(rd, -vec3(viewMatrix[0][2], viewMatrix[1][2], viewMatrix[2][2])), 1e-3);
float zB = tOut * kz;
if (zB < sceneZ && pB.y > 0.0) {
float aB, eB; vec3 tB;
emit += wall(pB, (pB - C) / R, lb, aB, eB, tB) * 0.45;
}
float dzB = abs(sceneZ - zB);
emit += (uCore * exp(-dzB / 0.035) * 1.8 + uColor * exp(-dzB / 0.18) * 0.7) * alive * step(-0.2, pB.y);
float chord = clamp(min(tOut, sceneZ / kz) - vViewZ / kz, 0.0, 2.0 * R);
emit += uGlow * chord * 0.02 * alive;
}
// optics. Thin film (n = 1.33): R = 4 F sin^2(pi OPD / lambda), OPD = 2 n d cos(theta_t); the film
// swirls with the plasma and drains down (thicker low), thinning to black near the crown
vec3 nf = cv < 0.0 ? -n : n;
float F = fresnel(ac, 0.02) * alive;
float y01 = clamp(vPos.y / max(C.y + R, 1e-3), 0.0, 1.0);
float dnm = mix(120.0, 680.0, field) + 280.0 * (1.0 - y01);
float ct = sqrt(1.0 - (1.0 - ac * ac) / 1.769);
vec3 sp = sin(PI * 2.66 * dnm * ct / vec3(650.0, 532.0, 450.0));
vec3 film = min(4.0 * F * sp * sp, vec3(1.0)) * uLook.w;
vec3 refl = envReflect(reflect(rd, nf), 0.06) * film;
// refraction where the membrane bends (rim lens, ripples, burning fronts) plus a heat-haze wobble
// there, each channel displaced a little differently (dispersion). Elsewhere a thin film passes
// the scene straight through: blend weight w, so whatever was drawn before shows unharmed
vec3 bend = (tilt * 0.05 + nf * (0.03 * lb * lb + 0.05 * edge)) * (alive + edge);
vec3 haze = curl3(vPos * 0.45 + vec3(0.0, -uTime * 0.3, uForm.w)) * 0.006;
float hh = 0.5 * projectionMatrix[1][1] / max(vViewZ, 1e-3);
vec2 sc = vec2(hh * uResolution.y / uResolution.x, hh) * uLook.y;
vec2 off = -(mat3(viewMatrix) * bend).xy * sc;
float w = smoothstep(0.3, 1.5, length(off * uResolution));
off -= (mat3(viewMatrix) * haze).xy * sc * w;
vec2 uv0 = gl_FragCoord.xy / uResolution;
float z1 = linearDepth(textureLod(uSceneDepth, uv0 + off, 0.0).r);
off *= smoothstep(vViewZ - 0.2, vViewZ + 0.2, z1); // never pull in what is in front of the membrane
vec3 refr = vec3(textureLod(uSceneColor, uv0 + off * 0.8, 0.0).r, textureLod(uSceneColor, uv0 + off, 0.0).g,
textureLod(uSceneColor, uv0 + off * 1.2, 0.0).b);
vec3 col = refr * (1.0 - F) * w + refl + emit * uForm.z;
if (uDebug > 0.5 && uDebug < 1.5) { fragColor = vec4(0.04, 0.012, 0.004, 0.0); return; } // overdraw view
// premultiplied over: col + dst (1 - a), dst passes as (1 - F) when unbent
fragColor = vec4(col, 1.0 - (1.0 - F) * (1.0 - w));
} `
;
const
SPRITE_VERT
=
`
in vec4 aA; // centre, size m (0 = dead)
in vec4 aB; // rgb * intensity, type: [0, 1) missile (seed), [1, 2] pop (1 + age 0..1)
in vec4 aV; // world velocity (missiles: motion streak), seed
out vec2 vQ; // sprite units: head at the origin, +x along the screen velocity
out float vL; // streak length (sprite units, trailing to -x)
out vec3 vCol;
out vec2 vT; // type, seed
void main() {
vQ = vec2(0.0); vCol = vec3(0.0); vT = vec2(0.0); vL = 0.0;
if (aA.w <= 0.0) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
vec4 view = viewMatrix * vec4(aA.xyz, 1.0);
float viewZ = max(-view.z, 0.05);
float pxW = 2.0 * viewZ / (projectionMatrix[1][1] * uResolution.y);
float s = max(aA.w, 4.0 * pxW), aa = aA.w / s; // clamp to 4 px, keep the energy
vec2 vel = (mat3(viewMatrix) * aV.xyz).xy;
float sp = length(vel);
vec2 dir = sp > 1e-3 ? vel / sp : vec2(1.0, 0.0);
float L = aB.w < 1.0 ? min(sp * 0.016 / s, 2.0) : 0.0; // one 60 Hz frame of motion blur
if (aB.w >= 1.0) dir = vec2(cos(aV.w), sin(aV.w));
float x = position.x < 0.0 ? -1.0 - L : 1.0;
view.xy += (dir * x + vec2(-dir.y, dir.x) * position.y) * s;
gl_Position = projectionMatrix * view;
vQ = vec2(x, position.y);
vL = L;
// a streak spreads the same energy over a longer quad (motion-blur conservation)
vCol = aB.rgb * aa * aa * smoothstep(0.15, 0.6, viewZ) / (1.0 + 0.6 * L);
vT = vec2(aB.w, aV.w);
} `
;
const
SPRITE_FRAG
=
`
in vec2 vQ;
in float vL;
in vec3 vCol;
in vec2 vT;
out vec4 fragColor;
float pnoise(float x, float period) { // smooth periodic value noise
float i = floor(x), f = fract(x);
f = f * f * (3.0 - 2.0 * f);
return mix(hash11(mod(i, period) + 0.37), hash11(mod(i + 1.0, period) + 0.37), f);
}
void main() {
float peak = max(vCol.r, max(vCol.g, vCol.b));
float ang = atan(vQ.y, vQ.x) / 6.2832 + 0.5;
vec3 col;
if (vT.x < 1.0) {
// plasma knot: capsule from the head back along the streak
float tf = clamp(-vQ.x / max(vL, 1e-3), 0.0, 1.0);
vec2 p = vec2(vQ.x - clamp(vQ.x, -vL, 0.0), vQ.y);
float r2 = dot(p, p), r = sqrt(r2);
if (r >= 1.0) discard;
float sd = vT.y * 37.0;
float tail = mix(1.0, 0.3, tf);
float flick = 0.8 + 0.4 * pnoise(uTime * 31.0 + sd, 4096.0);
float core = exp(-r2 * 110.0) * tail * flick;
float sheath = exp(-r2 * 22.0) * tail;
// filaments crawling round the knot (two periodic octaves over the angle, counter-rotating)
float fil = pnoise(ang * 9.0 + uTime * 2.3 + sd, 9.0) * 0.6 + pnoise(ang * 17.0 - uTime * 3.9 + sd * 2.0, 17.0) * 0.4;
fil *= fil; fil *= fil * fil;
float tend = fil * exp(-r * 6.0) * smoothstep(0.03, 0.14, r) * mix(1.0, 0.4, tf);
// halo: inverse-square scatter round the knot, red reaching further than blue (dispersion)
vec3 halo = (0.012 / (r2 * vec3(0.8, 1.0, 1.3) + 0.012) - 0.012) * 0.45 * mix(1.0, 0.4, tf);
float edge = 1.0 - r2; edge *= edge;
col = (vec3(peak) * (core * 2.6 + sheath * 0.25) + vCol * (core * 0.6 + sheath * 0.6 + tend * 2.0 + halo)) * edge;
} else {
// plasma burst: white flash, a shock ring split per channel, thin spark rays flying out
float r2 = dot(vQ, vQ), r = sqrt(r2);
if (r >= 1.0) discard;
float x = clamp(vT.x - 1.0, 0.0, 1.0), k = 1.0 - x;
// the luminous shock front: a soft shell of compressed glowing air, not a drawn ring
vec3 y = (r - (0.06 + 0.8 * sqrt(x)) * vec3(1.035, 1.0, 0.965)) / (0.14 + 0.22 * x);
vec3 ring = exp(-y * y) * k * k * smoothstep(0.0, 0.5, r);
float fl = exp(-r2 * 30.0) * k * k * k;
float slot = floor(ang * 32.0), h = hash11(slot * 1.31 + vT.y);
float head = 0.12 + (0.5 + 0.5 * h) * 0.9 * x;
float u = (fract(ang * 32.0) - 0.5) * 6.2832 * r / 32.0;
float along = clamp(r - head, -0.22, 0.0);
float ray = step(0.45, h) * exp(-u * u / 0.0001) * exp(along * 12.0) * step(r, head) * k * k;
float edge = 1.0 - r2; edge *= edge;
col = (vec3(peak) * (fl * 2.4 + ray * 1.2) + vCol * (ring * 0.45 + fl * 1.5 + ray * 0.7)) * edge;
}
if (uDebug > 0.5 && uDebug < 1.5) col = vec3(0.04, 0.012, 0.004);
fragColor = vec4(col, 1.0);
} `
;
const
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
;
const
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
;
const
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
;
const
UP
=
new
THREE. Vector3
(
0
,
1
,
0
)
;
function
capsuleDist
(
p, a, b, r
)
{
.
subVectors
(
,
)
;
.
subVectors
(
,
)
;
const
=
Math
.
min
(
1
,
Math
.
max
(
0
,
.
dot
(
)
/
Math
.
max
(
.
dot
(
)
,
1e-6
)
)
)
;
return
.
addScaledVector
(
,
-
)
.
length
(
)
-
;
}
export
default
{
id
:
'arcane'
,
name
:
'Arcane'
,
key
:
'0'
,
hue
:
'#ff4fd8'
,
shape
:
'projectile'
,
forms
:
[
'Arcane Barrage'
,
'Aegis'
]
,
speed
:
24
,
radius
:
0.2
,
params
:
{
missiles
:
8
,
speed
:
24
,
homing
:
4
,
spread
:
1
,
weave
:
0.6
,
sparkles
:
1
,
intensity
:
1
,
shield
:
1.45
,
duration
:
6
,
hex
:
1
,
distortion
:
1
,
pulse
:
0.6
,
anchor
:
'target'
,
color
:
'#ff4fd8'
,
core
:
'#ffe3fb'
,
glow
:
'#b347ff'
,
}
,
ranges
:
{
missiles
:
[
1
,
MAX_MISSILES
,
1
]
,
speed
:
[
8
,
45
,
0.1
]
,
homing
:
[
2
,
8
,
0.1
]
,
spread
:
[
0
,
2
,
0.01
]
,
weave
:
[
0
,
2
,
0.01
]
,
sparkles
:
[
0
,
3
,
0.01
]
,
intensity
:
[
0.1
,
3
,
0.01
]
,
shield
:
[
0.8
,
3
,
0.01
]
,
duration
:
[
1
,
20
,
0.1
]
,
hex
:
[
0
,
3
,
0.01
]
,
distortion
:
[
0
,
3
,
0.01
]
,
pulse
:
[
0
,
3
,
0.01
]
,
anchor
:
[
'target'
,
'caster'
]
,
}
,
presets
:
{
'frost ward'
:
{
color
:
'#4fc8ff'
,
core
:
'#e6faff'
,
glow
:
'#2f5bff'
}
,
'golden aegis'
:
{
color
:
'#ffb54a'
,
core
:
'#fff4dc'
,
glow
:
'#ff6a1a'
,
hex
:
1.4
}
,
'void swarm'
:
{
color
:
'#a35cff'
,
core
:
'#f1e6ff'
,
glow
:
'#2a0a6e'
,
missiles
:
12
,
weave
:
1.3
,
homing
:
5.5
}
,
}
,
timing
:
{
charge
:
0.55
,
impact
:
0.12
,
linger
:
1.1
}
,
kinds
:
{
spark
:
{
style
:
'glow'
,
drag
:
1.1
,
gravity
:
5
,
restitution
:
0.35
,
friction
:
0.4
,
life
:
[
0.2
,
0.6
]
,
size
:
[
0.028
,
0.006
]
,
stretch
:
0.04
,
emissive
:
7
,
color
:
[
'#ffe3fb'
,
'#ff4fd8'
]
,
alpha
:
[
1
,
0
]
}
,
sparkle
:
{
style
:
'glow'
,
drag
:
2.2
,
curl
:
1.4
,
curlScale
:
0.5
,
life
:
[
0.25
,
0.7
]
,
size
:
[
0.024
,
0.004
]
,
stretch
:
0.02
,
emissive
:
6
,
color
:
[
'#ffe3fb'
,
'#b347ff'
]
,
alpha
:
[
1
,
0
]
,
fadeIn
:
0.01
,
fadeOut
:
0.5
}
,
mote
:
{
style
:
'glow'
,
drag
:
0.3
,
life
:
[
0.4
,
0.6
]
,
size
:
[
0.012
,
0.026
]
,
stretch
:
0.05
,
emissive
:
5
,
color
:
[
'#ffe3fb'
,
'#ff4fd8'
]
,
alpha
:
[
0.2
,
1
]
,
fadeIn
:
0.3
,
fadeOut
:
0.15
,
forceResponse
:
0.3
}
,
deflect
:
{
style
:
'glow'
,
drag
:
0.7
,
gravity
:
9.8
,
restitution
:
0.35
,
friction
:
0.15
,
life
:
[
0.25
,
0.8
]
,
size
:
[
0.022
,
0.006
]
,
stretch
:
0.05
,
emissive
:
4
,
temp
:
[
2600
,
1100
]
,
alpha
:
[
1
,
0
]
,
fadeOut
:
0.3
}
,
}
,
create
(
fx
)
{
const
S
=
this
,
P
=
.
particles
;
const
=
P
.
emitter
(
'arcane.spark'
,
{
shape
:
'sphere'
,
radius
:
0.05
,
spread
:
3.5
,
radial
:
3
}
)
;
const
=
P
.
emitter
(
'arcane.sparkle'
,
{
shape
:
'sphere'
,
radius
:
0.05
,
spread
:
1.4
}
)
;
const
=
P
.
emitter
(
'arcane.mote'
,
{
shape
:
'shell'
,
radius
:
1.2
,
spread
:
0.1
,
radial
:
-
2.4
}
)
;
const
=
P
.
emitter
(
'arcane.mote'
,
{
shape
:
'ring'
,
radius
:
1
,
spread
:
0.15
}
)
;
const
=
P
.
emitter
(
'arcane.mote'
,
{
shape
:
'shell'
,
radius
:
1.45
,
spread
:
0.05
,
radial
:
0.25
}
)
;
const
=
P
.
emitter
(
'arcane.spark'
,
{
shape
:
'shell'
,
radius
:
1.45
,
spread
:
0.8
,
radial
:
2.2
}
)
;
const
=
P
.
emitter
(
'arcane.spark'
,
{
shape
:
'ring'
,
radius
:
1
,
spread
:
1
,
radial
:
2.5
}
)
;
const
=
P
.
emitter
(
'arcane.spark'
,
{
shape
:
'sphere'
,
radius
:
0.03
,
spread
:
0.6
}
)
;
const
=
P
.
emitter
(
'arcane.deflect'
,
{
shape
:
'sphere'
,
radius
:
0.12
,
spread
:
4.5
}
)
;
const
=
new
THREE. Color
(
)
;
const
=
new
THREE. Color
(
)
,
=
new
THREE. Color
(
)
,
=
new
THREE. Color
(
)
;
const
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
,
=
new
THREE. Vector3
(
)
;
const
=
new
THREE. Vector4
(
1
,
1
,
2.4
,
1
)
;
let
=
''
,
=
''
,
=
''
;
function
syncColors
(
)
{
const
=
S
.
params
;
if
(
.
color
===
&&
.
core
===
&&
.
glow
===
)
return
;
=
.
color
;
=
.
core
;
=
.
glow
;
.
set
(
)
;
.
set
(
)
;
.
set
(
)
;
.
set
(
.
r
,
.
g
,
.
b
)
;
.
set
(
.
r
,
.
g
,
.
b
)
;
.
set
(
.
r
,
.
g
,
.
b
)
;
P
.
setKind
(
'arcane.spark'
,
{
color
:
[
,
]
}
)
;
P
.
setKind
(
'arcane.sparkle'
,
{
color
:
[
,
]
}
)
;
P
.
setKind
(
'arcane.mote'
,
{
color
:
[
,
]
}
)
;
}
const
SIG
=
{
pos
:
new
THREE. Vector3
(
)
,
normal
:
new
THREE. Vector3
(
)
,
radius
:
1
,
color
:
new
THREE. Color
(
)
,
intensity
:
0
,
reveal
:
0
,
rotation
:
0
,
style
:
'arcane'
,
seed
:
0
}
;
const
SHOCK
=
{
pos
:
new
THREE. Vector3
(
)
,
radius0
:
0.05
,
radius1
:
1
,
duration
:
0.3
,
thickness
:
0.25
,
distortion
:
0.02
,
color
:
new
THREE. Color
(
)
,
intensity
:
0
,
ground
:
false
}
;
const
SPLAT
=
{
x
:
0
,
z
:
0
,
radius
:
1
,
glow
:
0
,
corruption
:
0
,
heat
:
0
,
char
:
0
,
pattern
:
'ring'
,
seed
:
0
}
;
const
SCORCH
=
new
THREE. Color
(
1
,
0.4
,
0.1
)
;
const
=
new
THREE. InstancedBufferGeometry
(
)
;
.
setAttribute
(
'position'
,
new
THREE. Float32BufferAttribute
(
[
-
1
,
-
1
,
0
,
1
,
-
1
,
0
,
1
,
1
,
0
,
-
1
,
1
,
0
]
,
3
)
)
;
.
setIndex
(
[
0
,
1
,
2
,
0
,
2
,
3
]
)
;
const
=
instanced
(
,
'aA'
,
MAX_SPRITES
)
,
=
instanced
(
,
'aB'
,
MAX_SPRITES
)
,
=
instanced
(
,
'aV'
,
MAX_SPRITES
)
;
.
instanceCount
=
0
;
const
=
new
THREE. Mesh
(
,
new
THREE. ShaderMaterial
(
{
glslVersion
:
THREE
.
GLSL3
,
uniforms
:
{
...
U
}
,
...
LINES_BLENDING
,
vertexShader
:
COMMON_GLSL
+
SPRITE_VERT
,
fragmentShader
:
COMMON_GLSL
+
SPRITE_FRAG
,
}
)
)
;
.
frustumCulled
=
false
;
.
visible
=
false
;
.
scenes
.
lines
.
add
(
)
;
const
=
Array
.
from
(
{
length
:
MAX_POPS
}
,
(
)
=>
(
{
pos
:
new
THREE. Vector3
(
)
,
age
:
1
,
life
:
0
,
size
:
0
,
r
:
0
,
g
:
0
,
b
:
0
,
seed
:
0
}
)
)
;
let
=
0
;
function
addPop
(
pos, size, c, k, life
)
{
const
=
[
]
;
=
(
+
1
)
%
MAX_POPS
;
.
pos
.
copy
(
)
;
.
size
=
;
.
life
=
;
.
age
=
0
;
.
seed
=
.
rand
(
)
*
TAU
;
.
r
=
.
r
*
;
.
g
=
.
g
*
;
.
b
=
.
b
*
;
}
const
=
Array
.
from
(
{
length
:
MAX_CASTS
}
,
(
)
=>
(
{
n
:
0
,
launched
:
0
,
landed
:
0
,
ms
:
Array
.
from
(
{
length
:
MAX_MISSILES
}
,
(
)
=>
(
{
pos
:
new
THREE. Vector3
(
)
,
vel
:
new
THREE. Vector3
(
)
,
off
:
new
THREE. Vector3
(
)
,
alive
:
false
,
age
:
0
,
ph
:
0
,
w
:
0
,
trail
:
null
}
)
)
,
}
)
)
;
const
=
new
THREE. IcosahedronGeometry
(
1
,
18
)
;
const
=
[
]
;
for
(
let
=
0
;
<
MAX_SHIELDS
;
++
)
{
const
=
{
uSphere
:
{
value
:
new
THREE. Vector4
(
)
}
,
uForm
:
{
value
:
new
THREE. Vector4
(
)
}
,
uWobble
:
{
value
:
new
THREE. Vector4
(
)
}
,
uHits
:
{
value
:
Array
.
from
(
{
length
:
MAX_HITS
}
,
(
)
=>
new
THREE. Vector4
(
)
)
}
,
uHitC
:
{
value
:
Array
.
from
(
{
length
:
MAX_HITS
}
,
(
)
=>
new
THREE. Vector3
(
)
)
}
,
uHitN
:
{
value
:
0
}
,
uInside
:
{
value
:
0
}
,
uLook
:
{
value
:
}
,
uColor
:
{
value
:
}
,
uCore
:
{
value
:
}
,
uGlow
:
{
value
:
}
,
}
;
const
=
new
THREE. ShaderMaterial
(
{
glslVersion
:
THREE
.
GLSL3
,
uniforms
:
{
...
U
,
...
}
,
side
:
THREE
.
DoubleSide
,
transparent
:
true
,
depthWrite
:
false
,
depthTest
:
true
,
blending
:
THREE
.
CustomBlending
,
blendEquation
:
THREE
.
AddEquation
,
blendSrc
:
THREE
.
OneFactor
,
blendDst
:
THREE
.
OneMinusSrcAlphaFactor
,
blendEquationAlpha
:
THREE
.
AddEquation
,
blendSrcAlpha
:
THREE
.
ZeroFactor
,
blendDstAlpha
:
THREE
.
OneFactor
,
vertexShader
:
COMMON_GLSL
+
SHIELD_VERT
,
fragmentShader
:
COMMON_GLSL
+
NOISE_GLSL
+
REFRACT_GLSL
+
SHIELD_FRAG
,
}
)
;
const
=
new
THREE. Mesh
(
,
)
;
.
frustumCulled
=
false
;
.
visible
=
false
;
.
renderOrder
=
-
1
;
.
scenes
.
refract
.
add
(
)
;
.
push
(
{
active
:
false
,
formed
:
false
,
,
u
:
,
cast
:
null
,
center
:
new
THREE. Vector3
(
)
,
R
:
1
,
r
:
0
,
t
:
0
,
end
:
0
,
flash
:
0
,
phase
:
0
,
burst
:
false
,
resplat
:
0
,
caster
:
false
,
occ
:
null
,
light
:
null
,
hitLight
:
null
,
hitK
:
0
,
sigil
:
null
,
head
:
0
,
wob
:
0
,
wobV
:
0
,
hits
:
Array
.
from
(
{
length
:
MAX_HITS
}
,
(
)
=>
(
{
dir
:
new
THREE. Vector3
(
)
,
age
:
0
,
s
:
0
,
col
:
new
THREE. Color
(
)
}
)
)
,
}
)
;
}
const
=
Array
.
from
(
{
length
:
MAX_CASTS
}
,
(
)
=>
'done'
)
;
function
aim
(
c, m, out
)
{
if
(
.
target
>=
0
)
{
const
=
.
dummies
[
.
target
]
.
pos
;
.
set
(
.
x
,
.
to
.
y
,
.
z
)
;
}
else
.
copy
(
.
to
)
;
return
.
add
(
.
off
)
;
}
function
sceneDist
(
p, from
)
{
let
=
arenaStatic
(
)
;
for
(
const
of
.
occluders
.
list
)
{
if
(
.
kind
===
4
)
continue
;
if
(
.
kind
===
3
&&
from
.
distanceToSquared
(
.
a
)
<
.
radius
*
.
radius
)
continue
;
=
Math
.
min
(
,
capsuleDist
(
,
.
a
,
.
b
,
.
radius
)
)
;
}
return
;
}
function
shieldNear
(
pos
)
{
let
=
null
,
=
1e9
;
for
(
const
of
)
{
if
(
!
.
active
||
!
.
formed
)
continue
;
const
=
.
distanceTo
(
.
center
)
;
if
(
>
.
r
+
0.9
)
continue
;
const
=
Math
.
abs
(
-
.
r
)
;
if
(
<
)
{
=
;
=
;
}
}
return
;
}
function
ripple
(
sh, pos, s, tint = null
)
{
.
subVectors
(
,
.
center
)
;
const
=
.
length
(
)
;
if
(
<
1e-4
)
.
set
(
0
,
1
,
0
)
;
else
.
multiplyScalar
(
1
/
)
;
const
=
.
hits
[
.
head
]
;
.
head
=
(
.
head
+
1
)
%
MAX_HITS
;
.
dir
.
copy
(
)
;
.
age
=
0
;
.
s
=
;
.
col
.
copy
(
??
)
;
.
flash
=
Math
.
min
(
1.5
,
.
flash
+
0.4
*
)
;
.
wobV
+=
0.12
*
;
const
L
=
.
hitLight
;
if
(
L
)
{
L
.
pos
.
copy
(
.
center
)
.
addScaledVector
(
,
Math
.
max
(
.
r
-
0.25
,
0.1
)
)
;
.
hitK
=
Math
.
min
(
2
,
.
hitK
+
)
;
L
.
color
.
copy
(
.
col
)
.
lerp
(
,
0.45
)
;
}
}
function
hit
(
pos, strength = 1 , tint = null
)
{
const
=
shieldNear
(
)
;
if
(
!
)
return
false
;
ripple
(
,
,
,
)
;
.
subVectors
(
,
.
center
)
.
normalize
(
)
;
.
copy
(
.
center
)
.
addScaledVector
(
,
.
r
)
;
.
pos
.
copy
(
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
2.5
)
;
.
burst
(
30
*
*
S
.
params
.
sparkles
)
;
.
vel
.
set
(
0
,
0
,
0
)
;
.
addScaledVector
(
,
0.07
)
;
.
pos
.
copy
(
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
1.2
)
;
.
burst
(
70
*
*
S
.
params
.
sparkles
)
;
.
vel
.
set
(
0
,
0
,
0
)
;
addPop
(
,
0.55
+
0.25
*
Math
.
min
(
,
2
)
,
??
,
6
*
S
.
params
.
intensity
,
0.25
)
;
return
true
;
}
const
hx
=
(
str, i
)
=>
{
const
=
.
charCodeAt
(
)
;
return
<=
57
?
-
48
:
(
|
32
)
-
87
;
}
;
function
hueOf
(
spell, out
)
{
const
=
.
hue
;
if
(
typeof
!==
'string'
||
.
length
!==
7
)
return
.
copy
(
)
;
return
.
setRGB
(
(
hx
(
,
1
)
*
16
+
hx
(
,
2
)
)
/
255
,
(
hx
(
,
3
)
*
16
+
hx
(
,
4
)
)
/
255
,
(
hx
(
,
5
)
*
16
+
hx
(
,
6
)
)
/
255
,
THREE
.
SRGBColorSpace
)
;
}
function
launchCentre
(
c, out
)
{
return
.
copy
(
.
from
)
.
addScaledVector
(
.
dir
,
0.45
)
;
}
function
launch
(
c, g, i, p
)
{
const
=
.
ms
[
]
;
.
crossVectors
(
.
dir
,
UP
)
;
if
(
.
lengthSq
(
)
<
1e-6
)
.
set
(
1
,
0
,
0
)
;
.
normalize
(
)
;
.
crossVectors
(
,
.
dir
)
;
const
=
(
/
.
n
)
*
TAU
+
(
.
seed
%
628
)
*
0.01
+
(
.
rand
(
)
-
0.5
)
*
0.5
;
.
copy
(
)
.
multiplyScalar
(
Math
.
cos
(
)
)
.
addScaledVector
(
,
Math
.
sin
(
)
)
;
launchCentre
(
,
.
pos
)
.
addScaledVector
(
,
0.55
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
(
4
+
3
*
.
rand
(
)
)
*
.
spread
)
.
addScaledVector
(
.
dir
,
4
)
.
addScaledVector
(
UP
,
(
0.5
+
1.5
*
.
rand
(
)
)
*
.
spread
)
.
add
(
.
set
(
.
rand
(
)
-
0.5
,
.
rand
(
)
-
0.5
,
.
rand
(
)
-
0.5
)
.
multiplyScalar
(
1.5
)
)
;
.
off
.
set
(
.
rand
(
)
-
0.5
,
.
rand
(
)
-
0.5
,
.
rand
(
)
-
0.5
)
.
multiplyScalar
(
.
target
>=
0
?
0.45
:
0.9
)
;
if
(
.
target
<
0
)
.
off
.
y
=
0
;
.
age
=
0
;
.
alive
=
true
;
.
ph
=
.
rand
(
)
*
TAU
;
.
w
=
(
7
+
5
*
.
rand
(
)
)
*
(
.
rand
(
)
<
0.5
?
-
1
:
1
)
;
.
trail
=
.
trails
.
acquire
(
)
;
const
=
.
trail
;
if
(
)
{
.
width
=
0.016
;
.
intensity
=
2.6
*
.
intensity
;
.
glow
=
9
;
.
glowIntensity
=
0.12
;
.
fadeTime
=
0.13
;
.
spacing
=
0.08
;
.
distortion
=
0.04
*
.
distortion
;
.
color
.
copy
(
)
.
lerp
(
,
0.35
)
;
}
addPop
(
.
pos
,
0.45
,
,
6
*
.
intensity
,
0.2
)
;
.
pos
.
copy
(
.
pos
)
;
.
vel
.
copy
(
.
vel
)
.
multiplyScalar
(
0.3
)
;
.
burst
(
14
*
.
sparkles
)
;
.
vel
.
set
(
0
,
0
,
0
)
;
.
data
.
flash
=
Math
.
max
(
.
data
.
flash
,
0.5
)
;
}
function
steer
(
c, m, p, dt
)
{
const
=
aim
(
,
,
)
;
const
=
.
subVectors
(
,
.
pos
)
,
=
.
length
(
)
;
const
=
.
vel
.
length
(
)
;
if
(
<
0.22
+
*
*
0.6
)
return
true
;
const
=
.
multiplyScalar
(
1
/
)
;
.
crossVectors
(
.
vel
,
)
.
multiplyScalar
(
1
/
)
;
.
crossVectors
(
,
)
.
multiplyScalar
(
.
homing
*
Math
.
max
(
,
4
)
)
;
.
addScaledVector
(
.
copy
(
)
.
multiplyScalar
(
.
speed
)
.
sub
(
.
vel
)
,
1.5
+
4
*
Math
.
max
(
0
,
.
age
-
0.5
)
)
;
const
=
.
copy
(
.
vel
)
.
multiplyScalar
(
1
/
Math
.
max
(
,
1e-3
)
)
;
.
crossVectors
(
,
UP
)
;
if
(
.
lengthSq
(
)
<
1e-6
)
.
set
(
1
,
0
,
0
)
;
.
normalize
(
)
;
.
crossVectors
(
,
)
;
const
=
.
ph
+
.
age
*
.
w
,
=
.
weave
*
28
*
Math
.
min
(
1
,
/
4
)
;
.
addScaledVector
(
,
Math
.
cos
(
)
*
)
.
addScaledVector
(
,
Math
.
sin
(
)
*
)
;
const
=
.
dot
(
)
;
.
addScaledVector
(
,
-
)
;
const
=
.
length
(
)
,
=
220
;
if
(
>
)
.
multiplyScalar
(
/
)
;
const
=
.
dot
(
)
;
.
addScaledVector
(
,
>
0
?
(
.
speed
-
)
*
5
*
:
-
*
1.5
*
-
)
;
.
vel
.
addScaledVector
(
,
)
;
.
pos
.
addScaledVector
(
.
vel
,
)
;
.
age
+=
;
return
.
age
>
0.05
&&
sceneDist
(
.
pos
,
.
from
)
<
0.06
;
}
function
land
(
c, g, m, p
)
{
.
alive
=
false
;
.
landed
++
;
.
trail
?.
release
(
)
;
.
trail
=
null
;
const
=
shieldNear
(
.
pos
)
;
if
(
)
ripple
(
,
.
pos
,
0.9
)
;
.
copy
(
.
vel
)
.
normalize
(
)
;
.
pos
.
copy
(
.
pos
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
-
2.2
)
;
.
burst
(
30
*
.
sparkles
)
;
.
vel
.
set
(
0
,
0
,
0
)
;
.
pos
.
copy
(
.
pos
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
-
2.6
)
;
.
burst
(
34
*
.
sparkles
)
;
.
vel
.
set
(
0
,
0
,
0
)
;
addPop
(
.
pos
,
0.7
,
,
2.2
*
.
intensity
,
0.28
)
;
if
(
!
)
.
impacts
.
add
(
'scorch'
,
.
pos
,
0.32
,
0.35
,
7
,
SCORCH
)
;
SHOCK
.
pos
.
copy
(
.
pos
)
;
SHOCK
.
radius0
=
0.05
;
SHOCK
.
radius1
=
1.1
;
SHOCK
.
duration
=
0.28
;
SHOCK
.
thickness
=
0.22
;
SHOCK
.
distortion
=
0.03
*
.
distortion
;
SHOCK
.
color
.
copy
(
)
;
SHOCK
.
intensity
=
1.5
*
.
intensity
;
SHOCK
.
ground
=
false
;
.
shocks
?.
spawn
(
SHOCK
)
;
if
(
.
pos
.
y
<
2.2
)
{
SPLAT
.
x
=
.
pos
.
x
;
SPLAT
.
z
=
.
pos
.
z
;
SPLAT
.
radius
=
0.55
;
SPLAT
.
glow
=
0.12
;
SPLAT
.
corruption
=
0.12
;
SPLAT
.
heat
=
0.35
;
SPLAT
.
char
=
0.3
;
SPLAT
.
pattern
=
'noise'
;
SPLAT
.
seed
=
(
.
seed
+
.
landed
*
17
)
%
100
;
.
ground
.
splat
(
SPLAT
)
;
SPLAT
.
heat
=
SPLAT
.
char
=
0
;
}
if
(
.
landed
===
1
||
.
landed
===
.
n
)
.
impacts
.
add
(
'holy'
,
.
pos
,
0.8
,
0.6
,
1.5
,
)
;
if
(
!
&&
.
target
>=
0
)
.
dummies
[
.
target
]
.
hit
(
,
0.18
)
;
.
rig
.
shake
(
0.05
,
22
)
;
.
pos
.
copy
(
.
pos
)
;
const
L
=
.
data
.
light
;
if
(
L
)
{
L
.
pos
.
copy
(
.
pos
)
;
L
.
end
.
copy
(
.
pos
)
;
.
data
.
flash
=
1
;
}
}
function
aegisCharge
(
c, p, d
)
{
.
durations
.
charge
=
0.4
;
.
durations
.
impact
=
0.35
;
.
durations
.
linger
=
.
duration
+
2
;
let
=
null
;
for
(
const
of
)
if
(
!
.
active
)
{
=
;
break
;
}
.
sh
=
;
if
(
!
)
{
.
durations
.
linger
=
0
;
return
;
}
const
=
.
anchor
===
'caster'
;
const
R
=
?
Math
.
max
(
.
shield
,
1.4
)
:
.
shield
;
if
(
)
.
set
(
.
from
.
x
,
0
,
.
from
.
z
)
;
else
if
(
.
target
>=
0
)
.
copy
(
.
dummies
[
.
target
]
.
pos
)
.
setY
(
0
)
;
else
.
set
(
.
to
.
x
,
0
,
.
to
.
z
)
;
.
center
.
copy
(
)
.
setY
(
0.55
*
R
)
;
for
(
const
of
)
if
(
!==
&&
.
active
&&
.
formed
&&
.
center
.
distanceToSquared
(
.
center
)
<
0.25
)
.
end
=
Math
.
min
(
.
end
,
.
t
+
0.6
)
;
.
active
=
true
;
.
formed
=
false
;
.
cast
=
;
.
R
=
R
;
.
r
=
R
;
.
t
=
0
;
.
end
=
FORM_TIME
+
.
duration
;
.
flash
=
0
;
.
burst
=
false
;
.
resplat
=
0
;
.
head
=
0
;
.
caster
=
;
.
hitK
=
0
;
.
wob
=
0
;
.
wobV
=
0
;
.
phase
=
.
rand
(
)
;
for
(
const
of
.
hits
)
.
s
=
0
;
.
pos
.
copy
(
.
center
)
;
SIG
.
pos
.
set
(
.
center
.
x
,
0.02
,
.
center
.
z
)
;
SIG
.
normal
.
set
(
0
,
1
,
0
)
;
SIG
.
radius
=
0.835
*
R
*
1.15
;
SIG
.
color
.
copy
(
)
;
SIG
.
intensity
=
0
;
SIG
.
reveal
=
0
;
SIG
.
rotation
=
0
;
SIG
.
seed
=
.
seed
%
1000
;
.
sigil
=
.
sigils
.
acquire
(
SIG
)
;
.
light
=
.
lights
.
acquire
(
)
;
if
(
.
light
)
{
.
light
.
range
=
3.2
*
R
;
.
light
.
intensity
=
0
;
.
light
.
color
.
copy
(
)
;
.
light
.
pos
.
copy
(
.
center
)
.
addScaledVector
(
UP
,
0.35
*
R
)
;
}
}
function
aegisForm
(
c, p, sh
)
{
.
pos
.
copy
(
.
center
)
;
.
formed
=
true
;
.
t
=
0
;
.
flash
=
1.2
;
.
wob
=
-
0.05
;
.
wobV
=
0.4
;
.
occ
=
.
caster
?
null
:
.
occluders
.
add
(
.
center
,
.
center
,
.
r
,
3
)
;
.
hitLight
=
.
lights
.
acquire
(
)
;
const
H
=
.
hitLight
;
if
(
H
)
{
H
.
type
=
2
;
H
.
cookie
[
0
]
=
1
;
H
.
cookie
[
1
]
=
2.4
;
H
.
range
=
2.6
*
.
R
;
H
.
shadow
=
true
;
H
.
intensity
=
0
;
H
.
color
.
copy
(
)
.
lerp
(
,
0.5
)
;
H
.
pos
.
copy
(
.
center
)
;
}
const
=
0.835
*
.
R
;
SHOCK
.
pos
.
set
(
.
center
.
x
,
0.05
,
.
center
.
z
)
;
SHOCK
.
radius0
=
*
0.5
;
SHOCK
.
radius1
=
*
3
;
SHOCK
.
duration
=
0.45
;
SHOCK
.
thickness
=
0.5
;
SHOCK
.
distortion
=
0.04
*
.
distortion
;
SHOCK
.
color
.
copy
(
)
;
SHOCK
.
intensity
=
2
*
.
intensity
;
SHOCK
.
ground
=
true
;
.
shocks
?.
spawn
(
SHOCK
)
;
.
pos
.
set
(
.
center
.
x
,
0.08
,
.
center
.
z
)
;
.
radius
=
;
.
vel
.
set
(
0
,
2.5
,
0
)
;
.
burst
(
160
*
.
sparkles
)
;
SPLAT
.
x
=
.
center
.
x
;
SPLAT
.
z
=
.
center
.
z
;
SPLAT
.
radius
=
;
SPLAT
.
glow
=
0.7
;
SPLAT
.
corruption
=
0.3
;
SPLAT
.
pattern
=
'ring'
;
SPLAT
.
seed
=
.
seed
%
100
;
.
ground
.
splat
(
SPLAT
)
;
.
rig
.
shake
(
0.15
,
14
)
;
.
flash
(
0.08
*
.
intensity
)
;
}
function
release
(
c
)
{
const
=
.
data
,
=
.
g
;
if
(
)
{
for
(
const
of
.
ms
)
{
.
alive
=
false
;
.
trail
?.
release
(
)
;
.
trail
=
null
;
}
.
n
=
.
launched
=
.
landed
=
0
;
}
const
=
.
sh
;
if
(
&&
.
cast
===
)
{
.
occ
?.
release
(
)
;
.
light
?.
release
(
)
;
.
hitLight
?.
release
(
)
;
.
sigil
?.
release
(
)
;
.
occ
=
.
light
=
.
hitLight
=
.
sigil
=
null
;
.
active
=
.
formed
=
false
;
.
cast
=
null
;
}
.
light
?.
release
(
)
;
.
sig
?.
release
(
)
;
.
g
=
.
sh
=
.
light
=
.
sig
=
null
;
}
syncColors
(
)
;
return
{
,
shieldOver
(
x, z, out
)
{
for
(
const
of
)
{
if
(
!
.
active
||
!
.
formed
||
(
-
.
center
.
x
)
**
2
+
(
-
.
center
.
z
)
**
2
>
.
r
*
.
r
)
continue
;
.
copy
(
.
center
)
;
return
.
r
;
}
return
0
;
}
,
onParam
(
k
)
{
if
(
===
'color'
||
===
'core'
||
===
'glow'
)
syncColors
(
)
;
}
,
phase
(
c, name
)
{
const
=
S
.
params
,
=
.
data
;
syncColors
(
)
;
if
(
===
'charge'
)
{
.
g
=
.
sh
=
.
light
=
.
sig
=
null
;
.
flash
=
0
;
.
shielded
=
false
;
if
(
.
form
===
'Aegis'
)
{
aegisCharge
(
,
,
)
;
return
;
}
const
=
.
g
=
[
.
index
]
;
.
n
=
Math
.
round
(
.
missiles
)
;
.
launched
=
0
;
.
landed
=
0
;
for
(
const
of
.
ms
)
{
.
alive
=
false
;
.
trail
=
null
;
}
.
light
=
.
lights
.
acquire
(
)
;
if
(
.
light
)
{
.
light
.
type
=
1
;
.
light
.
range
=
9
;
.
light
.
intensity
=
0
;
.
light
.
color
.
copy
(
)
;
launchCentre
(
,
.
light
.
pos
)
;
.
light
.
end
.
copy
(
.
light
.
pos
)
;
}
launchCentre
(
,
SIG
.
pos
)
;
SIG
.
normal
.
copy
(
.
dir
)
;
SIG
.
radius
=
0.8
;
SIG
.
color
.
copy
(
)
;
SIG
.
intensity
=
0
;
SIG
.
reveal
=
0
;
SIG
.
rotation
=
0
;
SIG
.
seed
=
.
seed
%
1000
;
.
sig
=
.
sigils
.
acquire
(
SIG
)
;
}
else
if
(
===
'release'
)
{
if
(
.
form
!==
'Aegis'
)
.
rig
.
shake
(
0.08
,
12
)
;
}
else
if
(
===
'impact'
)
{
if
(
.
form
===
'Aegis'
&&
.
sh
)
aegisForm
(
,
,
.
sh
)
;
}
else
if
(
===
'done'
)
release
(
)
;
}
,
travel
(
c, dt
)
{
if
(
.
form
===
'Aegis'
)
return
true
;
const
=
S
.
params
,
=
.
data
.
g
;
if
(
!
)
return
true
;
while
(
.
launched
<
.
n
&&
.
t
>=
.
launched
*
LAUNCH_GAP
)
launch
(
,
,
.
launched
++
,
)
;
for
(
let
=
0
;
<
.
launched
;
++
)
{
const
=
.
ms
[
]
;
if
(
.
alive
&&
(
steer
(
,
,
,
)
||
.
t
>
6
)
)
land
(
,
,
,
)
;
}
return
.
landed
>=
.
n
;
}
,
update
(
c, dt
)
{
const
=
S
.
params
,
=
.
data
;
if
(
.
form
===
'Aegis'
)
{
updateAegis
(
,
,
,
)
;
return
;
}
const
L
=
.
light
,
=
.
phase
===
'charge'
?
.
t
/
.
durations
.
charge
:
1
;
const
=
.
phase
===
'linger'
?
Math
.
max
(
0
,
1
-
.
t
/
.
durations
.
linger
)
:
1
;
.
flash
=
Math
.
max
(
0
,
.
flash
-
*
6
)
;
if
(
.
sig
)
{
const
=
.
phase
===
'charge'
?
1
:
.
phase
===
'travel'
?
Math
.
min
(
1
,
Math
.
max
(
0
,
1
-
(
.
t
-
.
g
.
n
*
LAUNCH_GAP
)
/
0.35
)
)
:
0
;
launchCentre
(
,
.
sig
.
pos
)
;
.
sig
.
reveal
=
Math
.
min
(
1
,
*
1.25
)
;
.
sig
.
intensity
=
(
2.6
+
2
*
+
4
*
.
flash
)
*
.
intensity
*
;
.
sig
.
rotation
=
.
age
*
0.9
;
}
if
(
.
phase
===
'charge'
)
{
launchCentre
(
,
.
pos
)
;
.
rate
(
500
*
*
.
sparkles
,
)
;
if
(
L
)
{
launchCentre
(
,
L
.
pos
)
;
L
.
end
.
copy
(
L
.
pos
)
;
L
.
intensity
=
6
*
*
.
intensity
;
}
return
;
}
const
=
.
g
;
let
=
0
,
=
null
,
=
null
;
if
(
&&
.
phase
===
'travel'
)
for
(
let
=
0
;
<
.
launched
;
++
)
{
const
=
.
ms
[
]
;
if
(
!
.
alive
)
continue
;
.
trail
?.
push
(
.
pos
)
;
.
pos
.
copy
(
.
pos
)
;
.
vel
.
copy
(
.
vel
)
.
multiplyScalar
(
-
0.15
)
;
.
rate
(
90
*
.
sparkles
,
)
;
if
(
!
)
=
;
=
;
++
;
}
if
(
L
)
{
if
(
>
0
&&
.
flash
<
0.3
)
{
const
=
Math
.
min
(
1
,
*
12
)
;
L
.
pos
.
lerp
(
.
pos
,
)
;
L
.
end
.
lerp
(
.
pos
,
)
;
}
L
.
intensity
=
(
>
0
?
8
+
2.4
*
:
2
*
)
*
.
intensity
+
20
*
.
flash
*
.
intensity
;
}
}
,
tick
(
dt
)
{
syncColors
(
)
;
const
=
S
.
params
;
.
set
(
.
hex
,
.
distortion
,
2.4
,
2
)
;
const
=
.
casts
?.
;
if
(
)
for
(
const
of
)
{
const
=
[
.
index
]
;
[
.
index
]
=
.
alive
?
.
phase
:
'done'
;
if
(
!
.
alive
||
.
phase
!==
'impact'
||
===
'impact'
||
.
spell
===
S
||
.
data
.
shielded
)
continue
;
const
=
shieldNear
(
.
pos
)
;
if
(
!
)
continue
;
.
subVectors
(
.
pos
,
.
center
)
;
if
(
.
length
(
)
<
.
r
*
0.8
)
{
if
(
.
spell
.
shape
===
'strike'
)
.
copy
(
UP
)
;
else
.
subVectors
(
.
from
,
.
center
)
;
.
normalize
(
)
.
multiplyScalar
(
.
r
)
.
add
(
.
center
)
;
}
else
.
copy
(
.
pos
)
;
hit
(
,
1.6
,
hueOf
(
.
spell
,
)
)
;
}
const
=
.
camera
.
position
;
for
(
const
of
)
{
const
=
.
active
&&
.
formed
;
.
mesh
.
visible
=
;
if
(
!
)
continue
;
const
=
.
u
;
const
=
1.25
*
(
1
-
(
1
-
Math
.
min
(
1
,
.
t
/
FORM_TIME
)
)
**
2
)
;
const
=
Math
.
min
(
1
,
Math
.
max
(
0
,
1
-
(
.
end
-
.
t
)
/
DISSOLVE_TIME
)
)
;
const
=
0.93
+
0.07
*
Math
.
sin
(
.
t
*
5.1
+
.
phase
*
9
)
*
Math
.
sin
(
.
t
*
2.3
)
;
.
uSphere
.
value
.
set
(
.
center
.
x
,
.
center
.
y
,
.
center
.
z
,
.
r
)
;
.
uForm
.
value
.
set
(
,
,
.
intensity
*
(
1
+
0.35
*
.
flash
)
*
*
(
1
+
0.5
*
)
,
.
phase
*
7.3
)
;
.
uWobble
.
value
.
x
=
.
wob
;
.
uInside
.
value
=
.
distanceToSquared
(
.
center
)
<
.
r
*
.
r
?
1
:
0
;
let
=
0
;
for
(
const
of
.
hits
)
{
if
(
.
s
>
0
)
{
.
age
+=
;
if
(
.
age
>
3
)
.
s
=
0
;
}
if
(
.
s
<=
0
)
continue
;
.
uHitC
.
value
[
]
.
set
(
.
col
.
r
,
.
col
.
g
,
.
col
.
b
)
;
.
uHits
.
value
[
++
]
.
set
(
.
dir
.
x
*
.
s
,
.
dir
.
y
*
.
s
,
.
dir
.
z
*
.
s
,
.
age
)
;
}
.
uHitN
.
value
=
;
}
const
A
=
.
array
,
B
=
.
array
,
V
=
.
array
;
let
=
0
;
const
I
=
5
*
.
intensity
;
for
(
const
of
)
{
if
(
.
n
===
0
)
continue
;
for
(
let
=
0
;
<
.
launched
&&
<
MAX_SPRITES
;
++
)
{
const
=
.
ms
[
]
;
if
(
!
.
alive
)
continue
;
const
=
*
4
;
A
[
]
=
.
pos
.
x
;
A
[
+
1
]
=
.
pos
.
y
;
A
[
+
2
]
=
.
pos
.
z
;
A
[
+
3
]
=
0.42
*
(
1
+
0.15
*
Math
.
sin
(
.
age
*
40
+
.
ph
)
)
;
B
[
]
=
.
r
*
I
;
B
[
+
1
]
=
.
g
*
I
;
B
[
+
2
]
=
.
b
*
I
;
B
[
+
3
]
=
.
ph
/
TAU
*
0.999
;
V
[
]
=
.
vel
.
x
;
V
[
+
1
]
=
.
vel
.
y
;
V
[
+
2
]
=
.
vel
.
z
;
V
[
+
3
]
=
.
ph
;
++
;
}
}
for
(
const
of
)
{
if
(
.
age
>=
.
life
)
continue
;
.
age
+=
;
if
(
.
age
>=
.
life
||
>=
MAX_SPRITES
)
continue
;
const
=
*
4
;
A
[
]
=
.
pos
.
x
;
A
[
+
1
]
=
.
pos
.
y
;
A
[
+
2
]
=
.
pos
.
z
;
A
[
+
3
]
=
.
size
;
B
[
]
=
.
r
;
B
[
+
1
]
=
.
g
;
B
[
+
2
]
=
.
b
;
B
[
+
3
]
=
1
+
.
age
/
.
life
;
V
[
]
=
0
;
V
[
+
1
]
=
0
;
V
[
+
2
]
=
0
;
V
[
+
3
]
=
.
seed
;
++
;
}
.
instanceCount
=
;
.
visible
=
>
0
;
if
(
>
0
)
.
needsUpdate
=
.
needsUpdate
=
.
needsUpdate
=
true
;
}
,
}
;
function
updateAegis
(
c, p, d, dt
)
{
const
=
.
sh
;
if
(
!
||
.
cast
!==
)
return
;
const
=
0.835
*
.
R
;
if
(
.
phase
===
'charge'
)
{
const
=
.
t
/
.
durations
.
charge
;
if
(
.
sigil
)
{
.
sigil
.
reveal
=
;
.
sigil
.
intensity
=
4
*
.
intensity
;
.
sigil
.
rotation
=
.
age
*
0.6
;
}
.
pos
.
set
(
.
center
.
x
,
0.05
,
.
center
.
z
)
;
.
radius
=
;
.
vel
.
set
(
0
,
1.6
+
2
*
,
0
)
;
.
rate
(
500
*
*
.
sparkles
,
)
;
if
(
.
light
)
.
light
.
intensity
=
6
*
*
.
intensity
;
return
;
}
.
t
+=
;
.
flash
=
Math
.
max
(
0
,
.
flash
-
*
2.5
)
;
const
=
.
t
;
const
=
TAU
*
2.4
;
.
wobV
+=
(
-
*
*
.
wob
-
2
*
0.16
*
*
.
wobV
)
*
;
.
wob
=
Math
.
max
(
-
0.08
,
Math
.
min
(
0.08
,
.
wob
+
.
wobV
*
)
)
;
const
=
Math
.
min
(
1
,
Math
.
max
(
0
,
1
-
(
.
end
-
)
/
DISSOLVE_TIME
)
)
;
if
(
>
0
&&
!
.
burst
)
{
.
burst
=
true
;
.
pos
.
copy
(
.
center
)
;
.
radius
=
.
r
;
.
radial
=
1.2
;
.
burst
(
400
*
.
sparkles
)
;
.
radial
=
0.25
;
}
if
(
>=
.
end
)
{
.
durations
.
linger
=
0
;
.
formed
=
false
;
return
;
}
const
=
Math
.
min
(
1
,
/
FORM_TIME
)
,
=
Math
.
min
(
1
,
1.25
*
(
1
-
(
1
-
)
**
2
)
)
;
if
(
<
1
)
{
const
=
(
1
-
)
*
Math
.
acos
(
-
.
center
.
y
/
.
r
)
,
=
.
center
.
y
+
.
r
*
Math
.
cos
(
)
;
.
pos
.
set
(
.
center
.
x
,
,
.
center
.
z
)
;
.
radius
=
.
r
*
Math
.
sin
(
)
;
.
vel
.
set
(
0
,
1.2
,
0
)
;
.
rate
(
420
*
.
sparkles
,
)
;
}
if
(
>
0
)
{
.
pos
.
copy
(
.
center
)
;
.
radius
=
.
r
;
.
rate
(
500
*
.
sparkles
*
(
1
-
)
,
)
;
}
let
=
null
;
for
(
const
of
.
hits
)
if
(
.
s
>
0
&&
.
age
<
0.9
&&
(
!
||
.
age
<
.
age
)
)
=
;
if
(
&&
===
0
)
{
const
=
.
age
*
.
z
;
if
(
<
2.8
)
{
.
crossVectors
(
.
dir
,
Math
.
abs
(
.
dir
.
y
)
<
0.9
?
UP
:
.
set
(
1
,
0
,
0
)
)
.
normalize
(
)
;
.
crossVectors
(
.
dir
,
)
;
const
=
.
rand
(
)
*
TAU
,
=
Math
.
cos
(
)
,
=
Math
.
sin
(
)
;
.
copy
(
)
.
multiplyScalar
(
)
.
addScaledVector
(
,
)
;
.
copy
(
.
dir
)
.
multiplyScalar
(
Math
.
cos
(
)
)
.
addScaledVector
(
,
Math
.
sin
(
)
)
;
.
copy
(
.
center
)
.
addScaledVector
(
,
.
r
)
;
if
(
.
y
>
0.05
)
{
.
copy
(
.
dir
)
.
multiplyScalar
(
-
Math
.
sin
(
)
)
.
addScaledVector
(
,
Math
.
cos
(
)
)
;
.
pos
.
copy
(
)
;
.
vel
.
copy
(
)
.
multiplyScalar
(
3.5
)
.
addScaledVector
(
,
1.5
)
;
.
burst
(
4
*
.
s
*
.
sparkles
*
Math
.
exp
(
-
2
*
.
age
)
)
;
}
}
}
if
(
===
0
&&
.
rand
(
)
<
.
pulse
*
)
{
.
set
(
.
rand
(
)
-
0.5
,
0.1
+
0.8
*
.
rand
(
)
,
.
rand
(
)
-
0.5
)
.
normalize
(
)
.
multiplyScalar
(
.
r
)
.
add
(
.
center
)
;
ripple
(
,
,
0.45
)
;
}
.
pos
.
copy
(
.
center
)
;
.
radius
=
.
r
*
1.01
;
.
rate
(
40
*
.
sparkles
*
(
1
-
)
,
)
;
.
resplat
-=
;
if
(
.
resplat
<=
0
&&
===
0
)
{
.
resplat
=
1.5
;
SPLAT
.
x
=
.
center
.
x
;
SPLAT
.
z
=
.
center
.
z
;
SPLAT
.
radius
=
;
SPLAT
.
glow
=
0.25
;
SPLAT
.
corruption
=
0
;
SPLAT
.
pattern
=
'ring'
;
SPLAT
.
seed
=
(
.
seed
+
Math
.
floor
(
)
)
%
100
;
.
ground
.
splat
(
SPLAT
)
;
}
if
(
.
sigil
)
{
.
sigil
.
intensity
=
4
*
.
intensity
*
Math
.
max
(
0
,
1
-
/
0.8
)
;
.
sigil
.
rotation
=
.
age
*
0.6
;
}
if
(
.
light
)
.
light
.
intensity
=
(
(
9
+
22
*
.
flash
)
*
*
(
1
-
)
+
20
*
*
(
1
-
)
)
*
.
intensity
;
.
hitK
*=
Math
.
exp
(
-
/
0.14
)
;
if
(
.
hitLight
)
{
.
hitLight
.
intensity
=
28
*
.
hitK
*
.
intensity
;
.
hitLight
.
cookie
[
2
]
=
*
0.7
;
}
}
}
,
}
;