forked from a327ex/SNKRX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.lua
3326 lines (2913 loc) · 146 KB
/
player.lua
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
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Player = Object:extend()
Player:implement(GameObject)
Player:implement(Physics)
Player:implement(Unit)
function Player:init(args)
self:init_game_object(args)
self:init_unit()
if self.passives then for k, v in pairs(self.passives) do self[v.passive] = v.level end end
self.color = character_colors[self.character]
self:set_as_rectangle(9, 9, 'dynamic', 'player')
self.visual_shape = 'rectangle'
self.classes = character_classes[self.character]
self.damage_dealt = 0
if self.character == 'vagrant' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
end
end, nil, nil, 'shoot')
elseif self.character == 'swordsman' then
self.attack_sensor = Circle(self.x, self.y, 64)
self.t:cooldown(3, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
self:attack(96)
end, nil, nil, 'attack')
elseif self.character == 'wizard' then
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {chain = (self.level == 3 and 2 or 0)})
end
end, nil, nil, 'shoot')
elseif self.character == 'magician' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
if self.magician_invulnerable then return end
local enemy = self:get_random_object_in_shape(self.attack_sensor, main.current.enemies)
if enemy then
self:attack(32, {x = enemy.x, y = enemy.y})
end
end, nil, nil, 'attack')
if self.level == 3 then
self.t:every(12, function()
self.magician_invulnerable = true
self.t:after(6, function() self.magician_invulnerable = false end, 'magician_invulnerable')
end)
end
elseif self.character == 'gambler' then
self.sorcerer_count = 0
local cast = function(pitch_a)
local enemy = table.shuffle(main.current.main:get_objects_by_classes(main.current.enemies))[1]
if enemy then
gambler1:play{pitch = pitch_a, volume = math.remap(gold, 0, 50, 0, 0.8)}
enemy:hit(2*gold)
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self:sorcerer_repeat()
self.sorcerer_count = 0
self.t:after(0.25, function()
local enemy = table.shuffle(main.current.main:get_objects_by_classes(main.current.enemies))[1]
if enemy then
gambler1:play{pitch = pitch_a + 0.05, volume = math.remap(gold, 0, 50, 0, 0.8)}
enemy:hit(2*gold)
end
end)
end
end
end
end
self.t:every(2, function()
cast(1)
if self.level == 3 then
if random:bool(60) then
if random:bool(40) then
if random:bool(20) then
self.t:after(0.25, function()
cast(1.1)
self.t:after(0.25, function()
cast(1.2)
self.t:after(0.25, function()
cast(1.3)
end)
end)
end)
else
self.t:after(0.25, function()
cast(1.1)
self.t:after(0.25, function()
cast(1.2)
end)
end)
end
else
self.t:after(0.25, function()
cast(1.1)
end)
end
end
end
end, nil, nil, 'attack')
elseif self.character == 'archer' then
self.attack_sensor = Circle(self.x, self.y, 160)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {pierce = 1000, ricochet = (self.level == 3 and 3 or 0)})
end
end, nil, nil, 'shoot')
elseif self.character == 'scout' then
self.attack_sensor = Circle(self.x, self.y, 64)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {chain = (self.level == 3 and 6 or 3)})
end
end, nil, nil, 'shoot')
elseif self.character == 'thief' then
self.attack_sensor = Circle(self.x, self.y, 64)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {chain = (self.level == 3 and 10 or 5)})
end
end, nil, nil, 'shoot')
elseif self.character == 'cleric' then
self.t:every(6, function()
local all_units = self:get_all_units()
local unit_index = table.contains(all_units, function(v) return v.hp <= 0.5*v.max_hp end)
if unit_index then
local unit = all_units[unit_index]
self.last_heal_time = love.timer.getTime()
if self.level == 3 then
for _, unit in ipairs(all_units) do unit:heal(0.2*unit.max_hp*(self.heal_effect_m or 1)) end
else
unit:heal(0.2*unit.max_hp*(self.heal_effect_m or 1))
end
heal1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
end
end, nil, nil, 'heal')
elseif self.character == 'arcanist' then
self.sorcerer_count = 0
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(4, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {pierce = 10000, v = 40})
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self:sorcerer_repeat()
self.sorcerer_count = 0
self.t:after(0.25, function()
self:shoot(self:angle_to_object(closest_enemy), {pierce = 10000, v = 40})
end)
end
end
end
end, nil, nil, 'shoot')
elseif self.character == 'illusionist' then
self.sorcerer_count = 0
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self:sorcerer_repeat()
self.sorcerer_count = 0
self.t:after(0.25, function()
self:shoot(self:angle_to_object(closest_enemy))
end)
end
end
end
end, nil, nil, 'shoot')
self.t:every(8, function()
self.t:every(0.25, function()
SpawnEffect{group = main.current.effects, x = self.x, y = self.y, color = self.color, action = function(x, y)
illusion1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
local check_circle = Circle(self.x, self.y, 2)
local objects = main.current.main:get_objects_in_shape(check_circle, {Seeker, EnemyCritter, Critter, Illusion, Volcano, Saboteur, Pet, Turret})
if #objects == 0 then Illusion{group = main.current.main, x = x, y = y, parent = self, level = self.level, conjurer_buff_m = self.conjurer_buff_m or 1} end
end}
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self:sorcerer_repeat()
self.sorcerer_count = 0
self.t:after(0.25, function()
SpawnEffect{group = main.current.effects, x = self.x, y = self.y, color = self.color, action = function(x, y)
illusion1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
local check_circle = Circle(self.x, self.y, 2)
local objects = main.current.main:get_objects_in_shape(check_circle, {Seeker, EnemyCritter, Critter, Illusion, Volcano, Saboteur, Pet, Turret})
if #objects == 0 then Illusion{group = main.current.main, x = x, y = y, parent = self, level = self.level, conjurer_buff_m = self.conjurer_buff_m or 1} end
end}
end)
end
end
end, self.level == 3 and 2 or 1)
end)
elseif self.character == 'outlaw' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(3, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {homing = (self.level == 3)})
end
end, nil, nil, 'shoot')
elseif self.character == 'blade' then
self.attack_sensor = Circle(self.x, self.y, 64)
self.t:cooldown(4, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
self:shoot()
end, nil, nil, 'shoot')
elseif self.character == 'elementor' then
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(7, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local enemy = self:get_random_object_in_shape(self.attack_sensor, main.current.enemies)
if enemy then
self:attack(128, {x = enemy.x, y = enemy.y})
end
end, nil, nil, 'attack')
elseif self.character == 'psychic' then
self.sorcerer_count = 0
self.attack_sensor = Circle(self.x, self.y, self.level == 3 and 512 or 64)
self.t:cooldown(3, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local strike = function()
local enemy = self:get_random_object_in_shape(self.attack_sensor, main.current.enemies)
if enemy then
if self.level == 3 then
self:attack(32, {x = enemy.x, y = enemy.y})
self.t:after(0.5, function()
local enemy = self:get_random_object_in_shape(self.attack_sensor, main.current.enemies)
if enemy then
self:attack(32, {x = enemy.x, y = enemy.y})
end
end)
else
self:attack(32, {x = enemy.x, y = enemy.y})
end
end
end
strike()
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self.sorcerer_count = 0
self:sorcerer_repeat()
self.t:after(0.1, function()
strike()
end)
end
end
end, nil, nil, 'attack')
elseif self.character == 'saboteur' then
self.t:every(8, function()
self.t:every(0.25, function()
SpawnEffect{group = main.current.effects, x = self.x, y = self.y, color = self.color, action = function(x, y)
Saboteur{group = main.current.main, x = x, y = y, parent = self, level = self.level, conjurer_buff_m = self.conjurer_buff_m or 1, crit = (self.level == 3) and random:bool(50)}
end}
end, 2)
end, nil, nil, 'spawn')
elseif self.character == 'stormweaver' then
self.t:every(8, function()
stormweaver1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
local units = self:get_all_units()
for _, unit in ipairs(units) do
unit:chain_infuse(4)
end
end, nil, nil, 'buff')
elseif self.character == 'sage' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(9, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
end
end, nil, nil, 'shoot')
elseif self.character == 'cannoneer' then
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
end
end, nil, nil, 'shoot')
elseif self.character == 'vulcanist' then
self.sorcerer_count = 0
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:every(12, function()
local volcano = function()
local enemies = main.current.main:get_objects_by_classes(main.current.enemies)
local x, y = 0, 0
if enemies and #enemies > 0 then
for _, enemy in ipairs(enemies) do
x = x + enemy.x
y = y + enemy.y
end
x = x/#enemies
y = y/#enemies
end
if x == 0 and y == 0 then x, y = gw/2, gh/2 end
x, y = x + self.x, y + self.y
x, y = x/2, y/2
main.current.t:every_immediate(0.1, function()
local check_circle = Circle(x, y, 2)
local objects = main.current.main:get_objects_in_shape(check_circle, {Player, Seeker, EnemyCritter, Critter, Illusion, Saboteur, Pet, Turret})
if #objects == 0 then
Volcano{group = main.current.main, x = x, y = y, color = self.color, parent = self, rs = 24, level = self.level}
main.current.t:cancel('volcano_spawn')
end
end, nil, nil, 'volcano_spawn')
end
volcano()
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self.sorcerer_count = 0
self:sorcerer_repeat()
self.t:after(0.5, function()
volcano()
end)
end
end
end, nil, nil, 'attack')
elseif self.character == 'dual_gunner' then
self.dg_counter = 0
self.attack_sensor = Circle(self.x, self.y, 96)
self.gun_kata_sensor = Circle(self.x, self.y, 160)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
end
end, nil, nil, 'shoot')
elseif self.character == 'hunter' then
self.attack_sensor = Circle(self.x, self.y, 160)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy))
end
end, nil, nil, 'shoot')
elseif self.character == 'chronomancer' then
if self.level == 3 then
main.current.chronomancer_dot = 0.5
end
elseif self.character == 'spellblade' then
self.t:every(2, function()
self:shoot(random:float(0, 2*math.pi))
end, nil, nil, 'shoot')
elseif self.character == 'psykeeper' then
self.stored_heal = 0
self.last_heal_time = love.timer.getTime()
elseif self.character == 'engineer' then
self.t:every(8, function()
SpawnEffect{group = main.current.effects, x = self.x, y = self.y, color = orange[0], action = function(x, y)
Turret{group = main.current.main, x = x, y = y, parent = self}
end}
end)
if self.level == 3 then
self.t:every(24, function()
SpawnEffect{group = main.current.effects, x = self.x - 16, y = self.y + 16, color = orange[0], action = function(x, y) Turret{group = main.current.main, x = x, y = y, parent = self} end}
SpawnEffect{group = main.current.effects, x = self.x + 16, y = self.y + 16, color = orange[0], action = function(x, y) Turret{group = main.current.main, x = x, y = y, parent = self} end}
self.t:after(0.5, function()
local turrets = main.current.main:get_objects_by_class(Turret)
buff1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
for _, turret in ipairs(turrets) do
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = orange[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = turret, color = orange[0]}
turret:upgrade()
end
end)
end)
end
elseif self.character == 'plague_doctor' then
self.t:every(5, function()
self:dot_attack(24, {duration = 12, plague_doctor_unmovable = true})
end, nil, nil, 'attack')
if self.level == 3 then
self.t:after(0.01, function()
self.dot_area = DotArea{group = main.current.effects, x = self.x, y = self.y, rs = self.area_size_m*48, color = self.color, dmg = self.area_dmg_m*self.dmg, character = self.character, level = self.level, parent = self}
end)
end
elseif self.character == 'witch' then
self.sorcerer_count = 0
self.t:every(4, function()
self:dot_attack(42, {duration = random:float(12, 16)})
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self.sorcerer_count = 0
self:sorcerer_repeat()
self.t:after(0.25, function()
self:dot_attack(42, {duration = random:float(12, 16)})
end)
end
end
end, nil, nil, 'attack')
elseif self.character == 'barbarian' then
self.t:every(8, function()
self:attack(96, {stun = 4})
end, nil, nil, 'attack')
elseif self.character == 'juggernaut' then
self.t:every(8, function()
self:attack(128, {juggernaut_push = true})
end, nil, nil, 'attack')
elseif self.character == 'lich' then
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(4, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {chain = (self.level == 3 and 14 or 7), v = 140})
end
end, nil, nil, 'shoot')
elseif self.character == 'cryomancer' then
self.t:after(0.01, function()
self.dot_area = DotArea{group = main.current.effects, x = self.x, y = self.y, rs = self.area_size_m*48, color = self.color, dmg = self.area_dmg_m*self.dmg, character = self.character, level = self.level, parent = self}
end)
elseif self.character == 'pyromancer' then
self.t:after(0.01, function()
self.dot_area = DotArea{group = main.current.effects, x = self.x, y = self.y, rs = self.area_size_m*48, color = self.color, dmg = self.area_dmg_m*self.dmg, character = self.character, level = self.level, parent = self}
end)
elseif self.character == 'corruptor' then
self.attack_sensor = Circle(self.x, self.y, 160)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {spawn_critters_on_kill = 3, spawn_critters_on_hit = (self.level == 3 and 2 or nil)})
end
end, nil, nil, 'shoot')
elseif self.character == 'beastmaster' then
self.attack_sensor = Circle(self.x, self.y, 160)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {spawn_critters_on_crit = 2})
end
end, nil, nil, 'shoot')
elseif self.character == 'launcher' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = main.current.main:get_objects_by_classes(main.current.enemies)
for _, enemy in ipairs(enemies) do
if self:distance_to_object(enemy) < 128 then
local resonance_dmg = 0
if self.resonance then resonance_dmg = (self.level == 3 and 6*self.dmg*0.05*#enemies or 2*self.dmg*0.05*#enemies) end
enemy:curse('launcher', 4*(self.hex_duration_m or 1), (self.level == 3 and 6*self.dmg or 2*self.dmg) + resonance_dmg, self)
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = yellow[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = yellow[0]}
end
end
end, nil, nil, 'attack')
elseif self.character == 'jester' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.wide_attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = table.first2(table.shuffle(self:get_objects_in_shape(self.wide_attack_sensor, main.current.enemies)), 6 + ((self.malediction == 1 and 1) or (self.malediction == 2 and 3) or (self.malediction == 3 and 5) or 0))
for _, enemy in ipairs(enemies) do
if self:distance_to_object(enemy) < 128 then
enemy:curse('jester', 6*(self.hex_duration_m or 1), self.level == 3, self)
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = red[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = red[0]}
end
end
end, nil, nil, 'attack')
elseif self.character == 'usurer' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.wide_attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = table.first2(table.shuffle(self:get_objects_in_shape(self.wide_attack_sensor, main.current.enemies)), 3 + ((self.malediction == 1 and 1) or (self.malediction == 2 and 3) or (self.malediction == 3 and 5) or 0))
for _, enemy in ipairs(enemies) do
enemy:curse('usurer', 10000, self.level == 3, self)
enemy:apply_dot(self.dmg*(self.dot_dmg_m or 1)*(main.current.chronomancer_dot or 1), 10000)
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = purple[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = purple[0]}
end
end, nil, nil, 'attack')
elseif self.character == 'silencer' then
self.sorcerer_count = 0
self.attack_sensor = Circle(self.x, self.y, 96)
self.wide_attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local curse = function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = table.first2(table.shuffle(self:get_objects_in_shape(self.wide_attack_sensor, main.current.enemies)), 6 + ((self.malediction == 1 and 1) or (self.malediction == 2 and 3) or (self.malediction == 3 and 5) or 0))
for _, enemy in ipairs(enemies) do
enemy:curse('silencer', 6*(self.hex_duration_m or 1), self.level == 3, self)
if self.level == 3 then
local curse_m = 1
if main.current.curser_level == 2 then curse_m = 1.5
elseif main.current.curser_level == 1 then curse_m = 1.25
else curse_m = 1 end
enemy:apply_dot(self.dmg*(self.dot_dmg_m or 1)*(main.current.chronomancer_dot or 1), 6*(self.hex_duration_m or 1)*(curse_m or 1))
end
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = blue2[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = blue2[0]}
end
end
curse()
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self.sorcerer_count = 0
self:sorcerer_repeat()
self.t:after(0.5, function()
curse()
end)
end
end
end, nil, nil, 'attack')
elseif self.character == 'assassin' then
self.attack_sensor = Circle(self.x, self.y, 64)
self.t:cooldown(2, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
if closest_enemy then
self:shoot(self:angle_to_object(closest_enemy), {pierce = 1000})
end
end, nil, nil, 'shoot')
elseif self.character == 'host' then
if self.level == 3 then
self.t:every(1, function()
critter1:play{pitch = random:float(0.95, 1.05), volume = 0.35}
for i = 1, 2 do
Critter{group = main.current.main, x = self.x, y = self.y, color = orange[0], r = random:float(0, 2*math.pi), v = 10, dmg = self.dmg, parent = self}
end
end, nil, nil, 'spawn')
else
self.t:every(2, function()
critter1:play{pitch = random:float(0.95, 1.05), volume = 0.35}
Critter{group = main.current.main, x = self.x, y = self.y, color = orange[0], r = random:float(0, 2*math.pi), v = 10, dmg = self.dmg, parent = self}
end, nil, nil, 'spawn')
end
elseif self.character == 'carver' then
self.t:every(16, function()
Tree{group = main.current.main, x = self.x, y = self.y, color = self.color, parent = self, rs = self.area_size_m*(self.level == 3 and 128 or 64), level = self.level}
end, nil, nil, 'spawn')
elseif self.character == 'bane' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.wide_attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = table.first2(table.shuffle(self:get_objects_in_shape(self.wide_attack_sensor, main.current.enemies)), 6 + ((self.malediction == 1 and 1) or (self.malediction == 2 and 3) or (self.malediction == 3 and 5) or 0))
for _, enemy in ipairs(enemies) do
enemy:curse('bane', 6*(self.hex_duration_m or 1), self.level == 3, self)
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = purple[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = purple[0]}
end
end, nil, nil, 'attack')
elseif self.character == 'psykino' then
self.t:every(4, function()
local center_enemy = self:get_random_object_in_shape(Circle(self.x, self.y, 160), main.current.enemies)
if center_enemy then
ForceArea{group = main.current.effects, x = center_enemy.x, y = center_enemy.y, rs = self.area_size_m*64, color = self.color, character = self.character, level = self.level, parent = self}
end
end, nil, nil, 'attack')
elseif self.character == 'barrager' then
self.barrager_counter = 0
self.attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(4, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
local closest_enemy = self:get_closest_object_in_shape(self.attack_sensor, main.current.enemies)
local r = self:angle_to_object(closest_enemy)
self.barrager_counter = self.barrager_counter + 1
if self.barrager_counter == 3 and self.level == 3 then
self.barrage_counter = 0
for i = 1, 15 do
self.t:after((i-1)*0.05, function()
self:shoot(r + random:float(-math.pi/32, math.pi/32), {knockback = (self.level == 3 and 14 or 7)})
end)
end
else
for i = 1, 3 do
self.t:after((i-1)*0.075, function()
self:shoot(r + random:float(-math.pi/32, math.pi/32), {knockback = (self.level == 3 and 14 or 7)})
end)
end
end
end, nil, nil, 'shoot')
elseif self.character == 'highlander' then
self.attack_sensor = Circle(self.x, self.y, 48)
self.t:cooldown(4, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
if self.level == 3 then
self.t:every(0.25, function()
self:attack(72)
end, 3)
else
self:attack(72)
end
end, nil, nil, 'attack')
elseif self.character == 'fairy' then
self.t:every(6, function()
if self.level == 3 then
local units = self:get_all_units()
local unit_1 = random:table_remove(units)
local unit_2 = random:table_remove(units)
if unit_1 then
unit_1:heal(0.2*unit_1.max_hp*(self.heal_effect_m or 1))
unit_1.fairy_aspd_m = 3
unit_1.t:after(5.98, function() unit_1.fairy_aspd_m = 1 end)
end
if unit_2 then
unit_2:heal(0.2*unit_2.max_hp*(self.heal_effect_m or 1))
unit_2.fairy_aspd_m = 3
unit_2.t:after(5.98, function() unit_2.fairy_aspd_m = 1 end)
end
heal1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
buff1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
else
local unit = random:table(self:get_all_units())
if unit then
unit:heal(0.2*unit.max_hp*(self.heal_effect_m or 1))
unit.fairy_aspd_m = 2
unit.t:after(5.98, function() unit.fairy_aspd_m = 1 end)
end
heal1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
buff1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
end
end, nil, nil, 'heal')
elseif self.character == 'warden' then
self.sorcerer_count = 0
self.t:every(12, function()
local ward = function()
if self.level == 3 then
local units = self:get_all_units()
local unit_1 = random:table_remove(units)
local unit_2 = random:table_remove(units)
if unit_1 then
illusion1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
main.current.t:every_immediate(0.1, function()
local check_circle = Circle(unit_1.x, unit_1.y, 6)
local objects = main.current.main:get_objects_in_shape(check_circle, {Seeker, EnemyCritter})
if #objects == 0 then
ForceField{group = main.current.main, x = unit_1.x, y = unit_1.y, parent = unit_1}
main.current.t:cancel('warden_force_field_1')
end
end, nil, nil, 'warden_force_field_1')
end
if unit_2 then
illusion1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
ForceField{group = main.current.main, x = unit_2.x, y = unit_2.y, parent = unit_2}
main.current.t:every_immediate(0.1, function()
local check_circle = Circle(unit_2.x, unit_2.y, 6)
local objects = main.current.main:get_objects_in_shape(check_circle, {Seeker, EnemyCritter})
if #objects == 0 then
ForceField{group = main.current.main, x = unit_2.x, y = unit_2.y, parent = unit_2}
main.current.t:cancel('warden_force_field_2')
end
end, nil, nil, 'warden_force_field_2')
end
else
local unit = random:table(self:get_all_units())
if unit then
illusion1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
main.current.t:every_immediate(0.1, function()
local check_circle = Circle(unit.x, unit.y, 6)
local objects = main.current.main:get_objects_in_shape(check_circle, {Seeker, EnemyCritter})
if #objects == 0 then
ForceField{group = main.current.main, x = unit.x, y = unit.y, parent = unit}
main.current.t:cancel('warden_force_field_0')
end
end, nil, nil, 'warden_force_field_0')
end
end
end
ward()
if main.current.sorcerer_level > 0 then
self.sorcerer_count = self.sorcerer_count + 1
if self.sorcerer_count >= ((main.current.sorcerer_level == 3 and 2) or (main.current.sorcerer_level == 2 and 3) or (main.current.sorcerer_level == 1 and 4)) then
self.sorcerer_count = 0
self:sorcerer_repeat()
self.t:after(0.5, function()
ward()
end)
end
end
end, nil, nil, 'buff')
elseif self.character == 'priest' then
if self.level == 3 then
self.t:after(0.01, function()
local all_units = self:get_all_units()
local unit_1 = random:table_remove(all_units)
local unit_2 = random:table_remove(all_units)
local unit_3 = random:table_remove(all_units)
if unit_1 then unit_1.divined = true end
if unit_2 then unit_2.divined = true end
if unit_3 then unit_3.divined = true end
end)
end
self.t:every(10, function()
local all_units = self:get_all_units()
for _, unit in ipairs(all_units) do unit:heal(0.2*unit.max_hp*(self.heal_effect_m or 1)) end
heal1:play{pitch = random:float(0.95, 1.05), volume = 0.5}
end, nil, nil, 'heal')
elseif self.character == 'infestor' then
self.attack_sensor = Circle(self.x, self.y, 96)
self.wide_attack_sensor = Circle(self.x, self.y, 128)
self.t:cooldown(6, function() local enemies = self:get_objects_in_shape(self.attack_sensor, main.current.enemies); return enemies and #enemies > 0 end, function()
buff1:play{pitch = random:float(0.9, 1.1), volume = 0.5}
local enemies = table.first2(table.shuffle(self:get_objects_in_shape(self.wide_attack_sensor, main.current.enemies)), 8 + ((self.malediction == 1 and 1) or (self.malediction == 2 and 3) or (self.malediction == 3 and 5) or 0))
for _, enemy in ipairs(enemies) do
enemy:curse('infestor', 6*(self.hex_duration_m or 1), (self.level == 3 and 6 or 2), self.dmg, self)
HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6, color = orange[0], duration = 0.1}
LightningLine{group = main.current.effects, src = self, dst = enemy, color = orange[0]}
end
end, nil, nil, 'attack')
elseif self.character == 'flagellant' then
self.t:every(8, function()
if self.level == 3 then
flagellant1:play{pitch = random:float(0.95, 1.05), volume = 0.4}
buff1:play{pitch = random:float(0.95, 1.05), volume = 0.3}
local all_units = self:get_all_units()
local dmg = self.dmg
for _, unit in ipairs(all_units) do
hit2:play{pitch = random:float(0.95, 1.05), volume = 0.4}
unit:hit(2*dmg)
if not unit.flagellant_dmg_m then
unit.flagellant_dmg_m = 1
end
unit.flagellant_dmg_m = unit.flagellant_dmg_m + 0.12
end
else
buff1:play{pitch = random:float(0.95, 1.05), volume = 0.3}
flagellant1:play{pitch = random:float(0.95, 1.05), volume = 0.4}
local all_units = self:get_all_units()
for _, unit in ipairs(all_units) do
if unit.character == 'flagellant' then
hit2:play{pitch = random:float(0.95, 1.05), volume = 0.4}
unit:hit(2*unit.dmg)
end
if not unit.flagellant_dmg_m then
unit.flagellant_dmg_m = 1
end
unit.flagellant_dmg_m = unit.flagellant_dmg_m + 0.04
end
end
end, nil, nil, 'buff')
end
self:calculate_stats(true)
if self.leader then
self.previous_positions = {}
self.followers = {}
self.t:every(0.01, function()
table.insert(self.previous_positions, 1, {x = self.x, y = self.y, r = self.r})
if #self.previous_positions > 256 then self.previous_positions[257] = nil end
end)
end
if self.ouroboros_technique_r then
self.t:after(0.01, function()
self.t:every((self.ouroboros_technique_r == 1 and 0.5) or (self.ouroboros_technique_r == 2 and 0.33) or (self.ouroboros_technique_r == 3 and 0.25), function()
if self.leader and (state.mouse_control and table.all(self.mouse_control_v_buffer, function(v) return v >= 0.5 end)) or (self.move_right_pressed and love.timer.getTime() - self.move_right_pressed > 1) then
local target = self:get_closest_object_in_shape(Circle(self.x, self.y, 96), main.current.enemies)
if target then
local units = self:get_all_units()
local unit = random:table(units)
unit:barrage(unit:angle_to_object(target), 1)
else
local units = self:get_all_units()
local cx, cy = 0, 0
for _, unit in ipairs(units) do
cx = cx + unit.x
cy = cy + unit.y
end
cx = cx/#units
cy = cy/#units
local unit = random:table(units)
unit:barrage(unit:angle_from_point(cx, cy), 1)
end
end
end)
end)
end
if self.centipede then self.centipede_mvspd_m = (self.centipede == 1 and 1.1) or (self.centipede == 2 and 1.2) or (self.centipede == 3 and 1.3) end
if self.amplify then self.amplify_area_dmg_m = (self.amplify == 1 and 1.2) or (self.amplify == 2 and 1.35) or (self.amplify == 3 and 1.5) end
if self.ballista and launches_projectiles(self.character) then
self.ballista_dmg_m = (self.ballista == 1 and 1.2) or (self.ballista == 2 and 1.35) or (self.ballista == 3 and 1.5)
end
if self.chronomancy then
if table.any(self.classes, function(v) return v == 'mage' end) then
self.chronomancy_aspd_m = (self.chronomancy == 1 and 1.15) or (self.chronomancy == 2 and 1.25) or (self.chronomancy == 3 and 1.35)
end
end
if self.leader and self.awakening then
main.current.t:after(0.1, function()
local units = self:get_all_units()
local mages = {}
for _, unit in ipairs(units) do
if table.any(unit.classes, function(v) return v == 'mage' end) then
table.insert(mages, unit)
end
end
local mage = random:table(mages)
if mage then
mage.awakening_aspd_m = (self.awakening == 1 and 1.5) or (self.awakening == 2 and 1.75) or (self.awakening == 3 and 2)
mage.awakening_dmg_m = (self.awakening == 1 and 1.5) or (self.awakening == 2 and 1.75) or (self.awakening == 3 and 2)
end
end)
end
if self.leader and self.divine_punishment then
main.current.t:every(5, function()
local units = self:get_all_units()
local mages = {}
for _, unit in ipairs(units) do
if table.any(unit.classes, function(v) return v == 'mage' end) then
table.insert(mages, unit)
end
end
local leader = main.current.player:get_leader()
local enemies = main.current.main:get_objects_by_classes(main.current.enemies)
if #enemies > 0 then
thunder1:play{volume = 0.3}
camera:shake(4, 0.5)
end
for _, enemy in ipairs(enemies) do
enemy:hit(10*#mages)
LightningLine{group = main.current.effects, src = {x = enemy.x, y = enemy.y - 32}, dst = enemy, color = blue[0], duration = 0.2}
_G[random:table{'spark1', 'spark2', 'spark3'}]:play{pitch = random:float(0.9, 1.1), volume = 0.3}
end
end, nil, nil, 'divine_punishment')
end
if self.unwavering_stance and table.any(self.classes, function(v) return v == 'warrior' end) then
self.unwavering_stance_def_m = 1
self.t:every(5, function()
self.unwavering_stance_def_m = self.unwavering_stance_def_m + ((self.unwavering_stance == 1 and 0.04) or (self.unwavering_stance == 2 and 0.08) or (self.unwavering_stance == 3 and 0.12))
end)
end
if self.magnify then
self.magnify_area_size_m = (self.magnify == 1 and 1.2) or (self.magnify == 2 and 1.35) or (self.magnify == 3 and 1.5)
end
if self.unleash and table.any(self.classes, function(v) return v == 'nuker' end) then
self.unleash_area_dmg_m = 1
self.unleash_area_size_m = 1
self.t:every(1, function()
self.unleash_area_dmg_m = self.unleash_area_dmg_m + 0.01
self.unleash_area_size_m = self.unleash_area_size_m + 0.01
if self.dot_area then
self.dot_area:scale(self.unleash_area_size_m)
end
end)
end
if self.reinforce then
main.current.t:after(0.1, function()
local units = self:get_all_units()
local any_enchanter = false
for _, unit in ipairs(units) do
if table.any(unit.classes, function(v) return v == 'enchanter' end) then
any_enchanter = true
break
end
end
if any_enchanter then
local v = (self.reinforce == 1 and 1.1) or (self.reinforce == 2 and 1.2) or (self.reinforce == 3 and 1.3) or 1
self.reinforce_dmg_m = v
self.reinforce_def_m = v
self.reinforce_aspd_m = v
end
end)
end
if self.enchanted then
main.current.t:after(0.1, function()
local units = self:get_all_units()
local enchanter_amount = 0
for _, unit in ipairs(units) do
if table.any(unit.classes, function(v) return v == 'enchanter' end) then
enchanter_amount = enchanter_amount + 1
end
end
if enchanter_amount >= 2 then
local unit = random:table(units)
unit.enchanted_aspd_m = (self.enchanted == 1 and 1.1) or (self.enchanted == 2 and 1.2) or (self.enchanted == 3 and 1.3)
end
end)
end
if self.payback then
self.payback_dmg_m = 1
end
if self.hex_master then
self.hex_duration_m = 1.25
end
if self.unrelenting_stance then
self.unrelenting_stance_def_m = 1
end
if self.leader and self.immolation then
main.current.t:after(0.1, function()
local units = self:get_all_units()
local unit_1 = random:table_remove(units)
local unit_2 = random:table_remove(units)
local unit_3 = random:table_remove(units)
if unit_1 then unit_1.t:every(2, function() unit_1:hit(0.05*unit_1.max_hp) end) end
if unit_2 then unit_2.t:every(2, function() unit_2:hit(0.05*unit_2.max_hp) end) end
if unit_3 then unit_3.t:every(2, function() unit_3:hit(0.05*unit_3.max_hp) end) end
local units = self:get_all_units()
for _, unit in ipairs(units) do
unit.immolation_dmg_m = 1
unit.t:every(2, function() unit.immolation_dmg_m = unit.immolation_dmg_m + 0.08 end)
end
end)
end
if self.leader and self.shoot_5 then
main.current.t:after(0.1, function()
self.t:every(0.33, function()
local units = self:get_all_units()
local unit = units[5]
if unit then
local target = unit:get_closest_object_in_shape(Circle(unit.x, unit.y, 96), main.current.enemies)
if target then
unit:barrage(unit:angle_to_object(target), 1)
else
unit:barrage(random:float(0, 2*math.pi), 1)
end
end
end)
end)
end
if self.leader and self.death_6 then