-
Notifications
You must be signed in to change notification settings - Fork 48
/
BaseConflict.EntityComponents.Shared.Wela.pas
3387 lines (2953 loc) · 120 KB
/
BaseConflict.EntityComponents.Shared.Wela.pas
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
unit BaseConflict.EntityComponents.Shared.Wela;
interface
uses
Generics.Collections,
Math,
RTTI,
SysUtils,
StrUtils,
Engine.Log,
Engine.Math,
Engine.Math.Collision2D,
Engine.Helferlein,
Engine.Helferlein.DataStructures,
Engine.Helferlein.Windows,
Engine.Script,
BaseConflict.Map,
BaseConflict.Constants,
BaseConflict.Constants.Cards,
BaseConflict.Types.Shared,
BaseConflict.Types.Target,
BaseConflict.Entity;
type
{$RTTI EXPLICIT METHODS([vcPublic, vcPublished]) PROPERTIES([vcPublic, vcPublished]) FIELDS([vcPrivate, vcProtected, vcPublic])}
{$REGION 'Modifier Components'}
{$RTTI INHERIT}
/// <summary> Metaclass of classes which are adjusting unit properties, which are important for the client and the server,
/// e.g. walking speed. </summary>
TModifierComponent = class(TEntityComponent)
protected
FValueGroup, FReadyGroup : SetComponentGroup;
function IsActive : boolean;
public
constructor CreateGrouped(Owner : TEntity; ComponentGroup : TArray<byte>); override;
function SetValueGroup(const ValueGroup : TArray<byte>) : TModifierComponent;
function ReadyGroup(const ReadyGroup : TArray<byte>) : TModifierComponent;
end;
{$RTTI INHERIT}
/// <summary> Adds or removes damage types from a group. </summary>
TModifierDamageTypeComponent = class(TModifierComponent)
protected
FAdded, FRemoved : SetDamageType;
published
[XEvent(eiDamageType, epMiddle, etRead)]
function OnDamageType(Previous : RParam) : RParam;
public
function Add(const DamageTypes : TArray<byte>) : TModifierDamageTypeComponent;
function Remove(const DamageTypes : TArray<byte>) : TModifierDamageTypeComponent;
end;
{$RTTI INHERIT}
/// <summary> Increases of decreases the wela count by an offset (eiWelaModifier in ValueGroup).</summary>
TModifierWelaCountComponent = class(TModifierComponent)
protected
FTakeUnitCount : boolean;
FUnitProperties : SetUnitProperty;
FTeamConstraint : EnumTargetTeamConstraint;
FScalesWithResource : EnumResource;
published
[XEvent(eiWelaCount, epMiddle, etRead)]
/// <summary> Adjust wela count. </summary>
function OnWelaCount(Previous : RParam) : RParam;
public
function TakeGlobalUnitCountByProperty(const UnitProperties : TArray<byte>) : TModifierWelaCountComponent;
function TakeEnemyUnitCountByProperty(const UnitProperties : TArray<byte>) : TModifierWelaCountComponent;
function ScaleWithResource(Resource : EnumResource) : TModifierWelaCountComponent;
end;
{$RTTI INHERIT}
/// <summary> Increases or decreases the eiWelaTargetCount by a value (eiWelaModifier in ValueGroup).</summary>
TModifierWelaTargetCountComponent = class(TModifierComponent)
protected
FScalesWithResource : EnumResource;
published
[XEvent(eiWelaTargetCount, epMiddle, etRead)]
/// <summary> Adjust target count. </summary>
function OnWelaTargetCount(Previous : RParam) : RParam;
public
function ScaleWithResource(Resource : EnumResource) : TModifierWelaTargetCountComponent;
end;
{$RTTI INHERIT}
/// <summary> Increases of decreases the movement speed by a factor (eiWelaDamage in ValueGroup).</summary>
TModifierMultiplyMovementSpeedComponent = class(TModifierComponent)
published
[XEvent(eiSpeed, epMiddle, etRead)]
/// <summary> Adjust speed. </summary>
function OnSpeed(Previous : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Increases or decreases the health by an offset (eiWelaDamage in ValueGroup).</summary>
TModifierResourceComponent = class(TModifierComponent)
protected
FModifiedResource, FScaleWithResource : EnumResource;
FUseResourceCap, FAddModifier, FDontFillCap : boolean;
FChangedResource : single;
procedure BeforeComponentFree; override;
procedure ModifyResource(const Amount : single);
public
function Resource(ModifiedResource : EnumResource) : TModifierResourceComponent;
function ScaleWithResource(Resource : EnumResource) : TModifierResourceComponent;
/// <summary> Uses the resource cap instead of balance for ScaleWithResource. </summary>
function UseResourceCap : TModifierResourceComponent;
/// <summary> Adds the eiWelaModifier instead of multiplying it. </summary>
function AddModifier : TModifierResourceComponent;
/// <summary> As this modifier isn't based on altering an event, we have to trigger it manually. </summary>
function ApplyNow : TModifierResourceComponent;
function DontFillCap : TModifierResourceComponent;
end;
{$RTTI INHERIT}
/// <summary> Multiply all cooldowns of target group with multiplier eiWelaDamage of ValueGroup.</summary>
TModifierMultiplyCooldownComponent = class(TModifierComponent)
published
[XEvent(eiCooldown, epMiddle, etRead)]
/// <summary> Adjust cooldown. </summary>
function OnCooldown(Previous : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Modifies the armor type of this unit.</summary>
TModifierArmorTypeComponent = class(TModifierComponent)
protected
FChangeClassIndex : integer;
FSetArmorType : boolean;
published
[XEvent(eiArmorType, epMiddle, etRead)]
/// <summary> Adjust armor type. </summary>
function OnArmorType(Previous : RParam) : RParam;
public
function Increase : TModifierArmorTypeComponent;
function Decrease : TModifierArmorTypeComponent;
function SetTo(ArmorType : integer) : TModifierArmorTypeComponent;
end;
{$RTTI INHERIT}
/// <summary> Multiply all eiWelaDamage of target group with multiplier eiWelaModifier of ValueGroup.</summary>
TModifierWelaDamageComponent = class(TModifierComponent)
protected
FResourceGroup : SetComponentGroup;
FScalesWithResource : EnumResource;
FDivide, FMultiply, FNegate : boolean;
FFactor, FMaximumResourceScaleFactor, FResourceOffset : single;
FMustHave : SetUnitProperty;
published
[XEvent(eiWelaDamage, epMiddle, etRead)]
/// <summary> Adjust damage. </summary>
function OnWelaDamage(Previous : RParam) : RParam;
public
function ScaleWithResource(ResType : integer) : TModifierWelaDamageComponent;
function ResourceGroup(Group : TArray<byte>) : TModifierWelaDamageComponent;
function ResourceOffset(Offset : single) : TModifierWelaDamageComponent;
function FactorForUnitProperty(UnitProperties : TArray<byte>; Factor : single) : TModifierWelaDamageComponent;
function MaximumResourceScaleFactor(Maximum : single) : TModifierWelaDamageComponent;
function Divide : TModifierWelaDamageComponent;
function Multiply : TModifierWelaDamageComponent;
function Negate : TModifierWelaDamageComponent;
end;
{$RTTI INHERIT}
/// <summary> Multiply all eiWelaDamage of target group with multiplier eiWelaModifier of ValueGroup.</summary>
TModifierWelaRangeComponent = class(TModifierComponent)
protected
FTimer : TTimer;
FScaleWithTime, FActivateOnStand, FAdditive, FDeactivateOnMoveTo, FScaleWithStage : boolean;
published
[XEvent(eiWelaRange, epMiddle, etRead)]
/// <summary> Adjust range. </summary>
function OnWelaRange(Previous : RParam) : RParam;
[XEvent(eiStand, epLast, etTrigger)]
/// <summary> Start time scaling. </summary>
function OnStand() : boolean;
[XEvent(eiMoveTo, epLast, etTrigger)]
/// <summary> Stop time scaling resetting it. </summary>
function OnMoveTo(Target, Range : RParam) : boolean;
public
/// <summary> Adds the modifier to the value instead of multiplying it with it. </summary>
function AddModifier : TModifierWelaRangeComponent;
/// <summary> Scales the modifier by a time factor in eiCooldown of value group. </summary>
function ScaleWithTime : TModifierWelaRangeComponent;
/// <summary> Scales the modifier by stage times eiModifier. </summary>
function ScaleWithStage : TModifierWelaRangeComponent;
/// <summary> Time scaling is started on stand and not on create. </summary>
function ActivateOnStand : TModifierWelaRangeComponent;
/// <summary> Time scaling is started on stand and not on create. </summary>
function DeactivateOnMoveTo : TModifierWelaRangeComponent;
destructor Destroy; override;
end;
{$RTTI INHERIT}
/// <summary> Adds to all eiResourceCost of target group eiWelaModifier of ValueGroup.</summary>
TModifierCostComponent = class(TModifierComponent)
protected
FScalesWithResource : EnumResource;
published
[XEvent(eiResourceCost, epMiddle, etRead)]
/// <summary> Adjust costs. </summary>
function OnResourceCost(Previous : RParam) : RParam;
public
function ScaleWithResource(ResType : integer) : TModifierCostComponent;
end;
{$ENDREGION}
{$REGION 'Target Contraints Components'}
{$RTTI INHERIT}
/// <summary> Masterclass of targetconstraints. </summary>
TWelaTargetConstraintComponent = class(TEntityComponent)
protected
FForWarhead : boolean;
/// <summary> Makes a single check for a target. </summary>
function IsPossible(const Target : RTarget) : boolean; virtual;
/// <summary> Make a single check for each target. Can be overriden for meta-checks of multiple items in combination. </summary>
procedure Check(Targets : ATarget; var Validity : RTargetValidity); virtual;
published
[XEvent(eiWelaTargetPossible, epHigher, etRead), ScriptExcludeMember]
[XEvent(eiWarheadTargetPossible, epHigher, etRead), ScriptExcludeMember]
/// <summary> Return the result of the constraint. </summary>
function OnTargetPossible(Targets, PrevValue : RParam) : RParam;
public
function ConstraintsWarhead() : TWelaTargetConstraintComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the maximum distance between all targets. </summary>
TWelaTargetConstraintMaxTargetDistanceComponent = class(TWelaTargetConstraintComponent)
protected
procedure Check(Targets : ATarget; var Validity : RTargetValidity); override;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible buildtargets to buildzones of the own team. </summary>
TWelaTargetConstraintBuildTeamComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> The weapon can't target the unit itself. </summary>
TWelaTargetConstraintNotSelfComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> The weapon can't target units saved in eiWelaSavedTargets. </summary>
TWelaTargetConstraintBlacklistComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> The wela cannot be used. </summary>
TWelaTargetConstraintNeverComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> Checks the fill percentage of a resource with a reference. </summary>
TWelaTargetConstraintResourceComponent = class(TWelaTargetConstraintComponent)
protected
FCompareBalanceToReference, FCompareCapToReference, FCompareMissingToReference : boolean;
FReference : single;
FComparator : EnumComparator;
FComparedResource : EnumResource;
function IsPossible(const Target : RTarget) : boolean; override;
public
function CheckResource(ResourceID : EnumResource) : TWelaTargetConstraintResourceComponent;
/// <summary> Checks Balance / Cap <Comparator> Reference. </summary>
function Comparator(Comparator : EnumComparator) : TWelaTargetConstraintResourceComponent;
/// <summary> Sets the reference for the comparison. </summary>
function Reference(Reference : single) : TWelaTargetConstraintResourceComponent;
/// <summary> Compares the missing balance to the cap to the reference. </summary>
function CompareMissingToReference() : TWelaTargetConstraintResourceComponent;
/// <summary> Compares the balance to the reference. </summary>
function CompareBalanceToReference() : TWelaTargetConstraintResourceComponent;
/// <summary> Compares the cap to the reference. </summary>
function CompareCapToReference() : TWelaTargetConstraintResourceComponent;
/// <summary> Shorthand for coLowerEqual and 0. </summary>
function CheckEmpty() : TWelaTargetConstraintResourceComponent;
/// <summary> Shorthand for coGreater and 0. </summary>
function CheckNotEmpty() : TWelaTargetConstraintResourceComponent;
/// <summary> Shorthand for coGreaterEqual and 1. </summary>
function CheckFull() : TWelaTargetConstraintResourceComponent;
/// <summary> Shorthand for coLower and 1. </summary>
function CheckNotFull() : TWelaTargetConstraintResourceComponent;
/// <summary> Shorthand for CompareCapToReference, coGreater and 0. </summary>
function CheckHasResource() : TWelaTargetConstraintResourceComponent;
end;
{$RTTI INHERIT}
/// <summary> Compares a resource of the owner with the target. </summary>
TWelaTargetConstraintResourceCompareComponent = class(TWelaTargetConstraintComponent)
protected
FCompareCap : boolean;
FComparator : EnumComparator;
FComparedResource : EnumResource;
FAdditionalComparedResource : TArray<EnumResource>;
FTargetFactor : single;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
/// <summary> If called multiple, resources are added together. </summary>
function ComparedResource(Resource : EnumResource) : TWelaTargetConstraintResourceCompareComponent;
function ComparesResourceCap() : TWelaTargetConstraintResourceCompareComponent;
function SetComparator(Comparator : EnumComparator) : TWelaTargetConstraintResourceCompareComponent;
function TargetFactor(Factor : single) : TWelaTargetConstraintResourceCompareComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints buildtarget(if needed gridsize is bigger than 1, the RTarget points to
/// the front-left point of the needed rectangle) to have free space on the target grids. </summary>
TWelaTargetConstraintGridComponent = class(TWelaTargetConstraintComponent)
protected
CheckAllFields : boolean;
function CheckGridNode(TargetBuildZone : TBuildZone; WorldCoord : RVector2) : boolean; virtual;
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
EnumBooleanOperator = (boAnd, boOr);
/// <summary> Constraints different groups together. </summary>
TWelaTargetConstraintBooleanComponent = class(TWelaTargetConstraintComponent)
protected
FGroupA, FGroupB : SetComponentGroup;
FNotA, FNotB : boolean;
FOperator : EnumBooleanOperator;
function IsPossible(const Target : RTarget) : boolean; override;
public
function GroupA(Group : TArray<byte>) : TWelaTargetConstraintBooleanComponent;
function GroupB(Group : TArray<byte>) : TWelaTargetConstraintBooleanComponent;
function OperatorOr : TWelaTargetConstraintBooleanComponent;
function OperatorAnd : TWelaTargetConstraintBooleanComponent;
function NotA : TWelaTargetConstraintBooleanComponent;
function NotB : TWelaTargetConstraintBooleanComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela with a zone,
/// e.g. buildings can only be placed in the buildarea. </summary>
TWelaTargetConstraintZoneComponent = class(TWelaTargetConstraintComponent)
protected
FZone : string;
FPrefix : boolean;
FPadding : single;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; Zone : string; Prefix : boolean); reintroduce;
function SetPadding(Padding : single) : TWelaTargetConstraintZoneComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela to the proximity of units creating a field,
/// e.g. drops can only set near towers. </summary>
TWelaTargetConstraintDynamicZoneComponent = class(TWelaTargetConstraintComponent)
protected
FDynamicZone : SetDynamicZone;
FIgnoreTeam : boolean;
function IsPossible(const Target : RTarget) : boolean; override;
public
function SetZone(Zone : TArray<byte>) : TWelaTargetConstraintDynamicZoneComponent;
function IgnoresTeams() : TWelaTargetConstraintDynamicZoneComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela to targets with a specific team id. </summary>
TWelaTargetConstraintTeamIDComponent = class(TWelaTargetConstraintComponent)
protected
FTargetTeamID : integer;
FInvert : boolean;
function IsPossible(const Target : RTarget) : boolean; override;
public
function SetTargetTeam(TeamID : integer) : TWelaTargetConstraintTeamIDComponent;
/// <summary> Targets everything except the target team id. </summary>
function Invert : TWelaTargetConstraintTeamIDComponent;
end;
/// <summary> Constraints the possible targets of a wela to enemies or friends. </summary>
TWelaTargetConstraintTeamComponent = class(TWelaTargetConstraintComponent)
protected
FTargetsEnemies : boolean;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; TargetsEnemies : boolean); reintroduce;
end;
TWelaTargetConstraintAlliesComponent = class(TWelaTargetConstraintTeamComponent)
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); reintroduce;
end;
TWelaTargetConstraintEnemiesComponent = class(TWelaTargetConstraintTeamComponent)
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); reintroduce;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela to visible enemies. </summary>
TWelaTargetConstraintCardNameComponent = class(TWelaTargetConstraintComponent)
protected
FCards : TArray<string>;
function IsPossible(const Target : RTarget) : boolean; override;
public
function AddCard(const ScriptFileName : string) : TWelaTargetConstraintCardNameComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela to targets with their creator being alive. </summary>
TWelaTargetConstraintCreatorIsAliveComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela to targets with the same owning commander as self. </summary>
TWelaTargetConstraintOwningComponent = class(TWelaTargetConstraintComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> Blacklists or whitelists the possible targets of a wela depending of unitproperties. </summary>
TWelaTargetConstraintUnitPropertyComponent = class(TWelaTargetConstraintComponent)
protected
FMustNotList, FMustList, FMustNotAllList, FMustAnyList : SetUnitProperty;
function IsPossible(const Target : RTarget) : boolean; override;
public
function MustHave(Properties : TArray<byte>) : TWelaTargetConstraintUnitPropertyComponent;
function MustHaveAny(Properties : TArray<byte>) : TWelaTargetConstraintUnitPropertyComponent;
function MustNotHave(Properties : TArray<byte>) : TWelaTargetConstraintUnitPropertyComponent;
function MustNotHaveAll(Properties : TArray<byte>) : TWelaTargetConstraintUnitPropertyComponent;
end;
{$RTTI INHERIT}
/// <summary> Blacklists or whitelists the possible targets of a wela depending of unitproperties. </summary>
TWelaTargetConstraintCompareUnitPropertyComponent = class(TWelaTargetConstraintUnitPropertyComponent)
protected
function IsPossible(const Target : RTarget) : boolean; override;
public
/// <summary> All properties have to be present at owner and target. </summary>
function BothMustHave(Properties : TArray<byte>) : TWelaTargetConstraintCompareUnitPropertyComponent;
/// <summary> Any of these properties have to be present at owner and target. </summary>
function BothMustHaveAny(Properties : TArray<byte>) : TWelaTargetConstraintCompareUnitPropertyComponent;
/// <summary> None of these properties must be present at owner and target. </summary>
function BothMustNotHave(Properties : TArray<byte>) : TWelaTargetConstraintCompareUnitPropertyComponent;
/// <summary> These properties together must not be present at owner and target. </summary>
function BothMustNotHaveAll(Properties : TArray<byte>) : TWelaTargetConstraintCompareUnitPropertyComponent;
end;
{$RTTI INHERIT}
/// <summary> Blacklists or whitelists the possible targets of a wela depending of wela properties. </summary>
TWelaTargetConstraintWelaPropertyComponent = class(TWelaTargetConstraintComponent)
protected
FCheckGroup : SetComponentGroup;
FMustHave, FMustNotHave : SetDamageType;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); reintroduce;
function MustHave(Types : TArray<byte>) : TWelaTargetConstraintWelaPropertyComponent;
function MustNotHave(Types : TArray<byte>) : TWelaTargetConstraintWelaPropertyComponent;
function CheckGroup(Group : TArray<byte>) : TWelaTargetConstraintWelaPropertyComponent;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela with the return of an event (must be boolean) </summary>
TWelaTargetConstraintEventComponent = class(TWelaTargetConstraintComponent)
protected
FEvent : EnumEventIdentifier;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; Event : EnumEventIdentifier); reintroduce;
end;
{$RTTI INHERIT}
/// <summary> Constraints the possible targets of a wela with whether the unit have been buffer (buff types in the
/// constructor). </summary>
TWelaTargetConstraintBuffComponent = class(TWelaTargetConstraintComponent)
protected
FWhiteBuffTypes, FBlackBuffTypes : SetBuffType;
function IsPossible(const Target : RTarget) : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
function Whitelist(BuffTypes : TArray<byte>) : TWelaTargetConstraintBuffComponent;
function Blacklist(BuffTypes : TArray<byte>) : TWelaTargetConstraintBuffComponent;
end;
{$ENDREGION}
{$REGION 'Trigger check components'}
{$RTTI INHERIT}
/// <summary> Masterclass of trigger checks for take damage events. </summary>
TWelaTriggerCheckTakeDamageComponent = class abstract(TEntityComponent)
protected
/// <summary> Makes a single check for a target. </summary>
function IsValid(Amount : single; DamageType : SetDamageType; InflictorID : integer) : boolean; virtual; abstract;
published
[XEvent(eiWelaTriggerCheck, epHigher, etRead), ScriptExcludeMember]
/// <summary> Return the result of the constraint. </summary>
function OnTriggerCheck(Amount, DamageType, InflictorID, Previous : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Checks whether the taken damage is dealt by the entity itself. </summary>
TWelaTriggerCheckNotSelfComponent = class(TWelaTriggerCheckTakeDamageComponent)
protected
function IsValid(Amount : single; DamageType : SetDamageType; InflictorID : integer) : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> Checks whether the taken damage is over or under a certain threshold. Default is the GreaterEqual check. </summary>
TWelaTriggerCheckTakeDamageThresholdComponent = class(TWelaTriggerCheckTakeDamageComponent)
protected
FLesserEqualCheck : boolean;
/// <summary> Makes a single check for a target. </summary>
function IsValid(Amount : single; DamageType : SetDamageType; InflictorID : integer) : boolean; override;
public
function LesserEqual : TWelaTriggerCheckTakeDamageThresholdComponent;
end;
{$RTTI INHERIT}
/// <summary> Checks whether the taken damage has certain types. </summary>
TWelaTriggerCheckTakeDamageTypeComponent = class(TWelaTriggerCheckTakeDamageComponent)
protected
FMustHave, FMustNotHave : SetDamageType;
/// <summary> Makes a single check for a target. </summary>
function IsValid(Amount : single; DamageType : SetDamageType; InflictorID : integer) : boolean; override;
public
function MustHave(DamageTypes : TArray<byte>) : TWelaTriggerCheckTakeDamageTypeComponent;
function MustNotHave(DamageTypes : TArray<byte>) : TWelaTriggerCheckTakeDamageTypeComponent;
end;
{$ENDREGION}
{$REGION 'Wela Ready Components'}
{$RTTI INHERIT}
/// <summary> Mastercomponent for all readycomponents of welas, determines
/// whether a wela can be fired or not at the moment. </summary>
TWelaReadyComponent = class(TEntityComponent)
protected
function IsReady() : boolean; virtual;
published
[XEvent(eiIsReady, epFirst, etRead), ScriptExcludeMember]
/// <summary> Determines whether wela is ready or not. </summary>
function OnIsReady(PrevValue : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Constraints different groups together. </summary>
TWelaReadyBooleanComponent = class(TWelaReadyComponent)
protected
FGroupA, FGroupB : SetComponentGroup;
FNotA, FNotB : boolean;
FOperator : EnumBooleanOperator;
function IsReady() : boolean; override;
public
function GroupA(Group : TArray<byte>) : TWelaReadyBooleanComponent;
function GroupB(Group : TArray<byte>) : TWelaReadyBooleanComponent;
function OperatorOr : TWelaReadyBooleanComponent;
function OperatorAnd : TWelaReadyBooleanComponent;
function NotA : TWelaReadyBooleanComponent;
function NotB : TWelaReadyBooleanComponent;
end;
{$RTTI INHERIT}
/// <summary> Wela costs some resources. Payed by Entity itself. </summary>
TWelaReadyCostComponent = class(TWelaReadyComponent)
protected
FPayingGroup : TDictionary<EnumResource, SetComponentGroup>;
FDefaultPayingGroup, FValueGroup : SetComponentGroup;
FRedirectToCommander, FCostsCap : boolean;
function GetPayingGroup(ResType : EnumResource) : SetComponentGroup;
function IsReady() : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
/// <summary> Set a special group for paying the resources. Default is the ComponentGroup of this component. </summary>
function SetPayingGroup(Group : TArray<byte>) : TWelaReadyCostComponent;
/// <summary> Set a special group for paying a certain Resource. </summary>
function SetPayingGroupForType(ResourceType : integer; Group : TArray<byte>) : TWelaReadyCostComponent;
/// <summary> The commander pays for this effect. Changes paying group to []! </summary>
function CommanderPays() : TWelaReadyCostComponent;
/// <summary> Costs the current cap. </summary>
function CostsCap : TWelaReadyCostComponent;
/// <summary> Determines the group where the costs are fetched from. Defaults to ComponentGroup. </summary>
function ValueGroup(Group : TArray<byte>) : TWelaReadyCostComponent;
destructor Destroy; override;
end;
{$RTTI INHERIT}
/// <summary> Restricts abilities to be only done if a Resources percentage (Current/Max) pass the compare test. </summary>
TWelaReadyResourceCompareComponent = class(TWelaReadyComponent)
protected
FCompareCap, FChecksCommander, FReferenceIsAbsolute : boolean;
FComparator : EnumComparator;
FComparedResource : EnumResource;
FAdditionalComparedResource : TArray<EnumResource>;
FReferenceValue : single;
FCheckingGroup : SetComponentGroup;
function IsReady() : boolean; override;
public
function ComparedResource(Resource : EnumResource) : TWelaReadyResourceCompareComponent;
function SetComparator(Comparator : EnumComparator) : TWelaReadyResourceCompareComponent;
function ReferenceValue(ReferenceValue : single) : TWelaReadyResourceCompareComponent;
function ReferenceIsAbsolute : TWelaReadyResourceCompareComponent;
/// <summary> Shorthand for coLowerEqual and 0. </summary>
function CheckEmpty() : TWelaReadyResourceCompareComponent;
/// <summary> Shorthand for coGreater and 0. </summary>
function CheckNotEmpty() : TWelaReadyResourceCompareComponent;
/// <summary> Shorthand for coGreaterEqual and 1. </summary>
function CheckFull() : TWelaReadyResourceCompareComponent;
/// <summary> Shorthand for coLower and 1. </summary>
function CheckNotFull() : TWelaReadyResourceCompareComponent;
/// <summary> The group where the resources are checked. Default is the public group [] </summary>
function CheckingGroup(Group : TArray<byte>) : TWelaReadyResourceCompareComponent;
function ChecksCommander : TWelaReadyResourceCompareComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready if the spawned unit also is ready.
/// Used to determine things like legendary and heroic unique checks. </summary>
TWelaReadySpawnedComponent = class(TWelaReadyComponent)
protected
function IsReady() : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready if the entity has or has not a certain unit property. </summary>
TWelaReadyUnitPropertyComponent = class(TWelaReadyComponent)
protected
FMustNotList, FMustList, FMustNotAllList, FMustAnyList : SetUnitProperty;
FChecksCommander : boolean;
function IsReady() : boolean; override;
public
function MustHave(Properties : TArray<byte>) : TWelaReadyUnitPropertyComponent;
function MustHaveAny(Properties : TArray<byte>) : TWelaReadyUnitPropertyComponent;
function MustNotHave(Properties : TArray<byte>) : TWelaReadyUnitPropertyComponent;
function MustNotHaveAll(Properties : TArray<byte>) : TWelaReadyUnitPropertyComponent;
function ChecksCommander : TWelaReadyUnitPropertyComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready if enemies are in range of eiWelaRange. </summary>
TWelaReadyEnemiesNearbyComponent = class(TWelaReadyComponent)
protected
FValueGroup, FCheckGroup : SetComponentGroup;
function IsReady() : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
function ValueGroup(ValueGroup : TArray<byte>) : TWelaReadyEnemiesNearbyComponent;
function CheckGroup(CheckGroup : TArray<byte>) : TWelaReadyEnemiesNearbyComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready after the game started (post warming). Afterwards this component returns true for the whole time. </summary>
TWelaReadyAfterGameStartComponent = class(TWelaReadyComponent)
protected
FReady : boolean;
function IsReady() : boolean; override;
published
[XEvent(eiGameTick, epLast, etTrigger, esGlobal), ScriptExcludeMember]
/// <summary> Start weapon. </summary>
function OnGameTick() : boolean;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready after the game has fired a certain game event. Afterwards this component returns true for the whole time. </summary>
TWelaReadyAfterGameEventComponent = class(TWelaReadyComponent)
protected
FFired : boolean;
FEventUID : string;
function IsReady() : boolean; override;
published
[XEvent(eiAfterCreate, epLast, etTrigger), ScriptExcludeMember]
function OnAfterCreate() : boolean;
[XEvent(eiGameEvent, epLast, etTrigger, esGlobal)]
function OnGameEvent(EventIdentifier : RParam) : boolean;
public
function GameEvent(const EventUID : string) : TWelaReadyAfterGameEventComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready after the game has reached a certain duration. Afterwards this component returns true for the whole time. </summary>
TWelaReadyAfterGameTimeComponent = class(TWelaReadyComponent)
protected
FTime : integer;
function IsReady() : boolean; override;
public
function Time(Seconds : integer) : TWelaReadyAfterGameTimeComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready when the creator group is ready. If has no creator group, it is ready. </summary>
TWelaReadyCreatorComponent = class(TWelaReadyComponent)
protected
function IsReady() : boolean; override;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready when the creator group is ready. If has no creator group, it is ready. </summary>
TWelaReadyEventCompareComponent = class(TWelaReadyComponent)
protected
FComparator : EnumComparator;
FComparedEvent : EnumEventIdentifier;
FReferenceValue : single;
FCheckingGroup : SetComponentGroup;
function IsReady() : boolean; override;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
function ComparedEvent(EventIdentifier : EnumEventIdentifier) : TWelaReadyEventCompareComponent;
function SetComparator(Comparator : EnumComparator) : TWelaReadyEventCompareComponent;
function ReferenceValue(ReferenceValue : single) : TWelaReadyEventCompareComponent;
/// <summary> The group where the resources are checked. Default is the component group. </summary>
function CheckingGroup(Group : TArray<byte>) : TWelaReadyEventCompareComponent;
end;
{$RTTI INHERIT}
/// <summary> The associated wela is ready after expiration of a cooldown, which resets completely with an fire event.
/// Furthermore, at each fire the cooldown gets refreshed. So the cooldown doesn't change while wela is on cooldown. </summary>
TWelaReadyCooldownComponent = class(TEntityComponent)
protected
FCooldown : TGameTimer;
FReadyGroup, FFireGroup : SetComponentGroup;
FReadyAfterStart, FOnce, FOnceDone, FFixedCooldown : boolean;
FFixedInterval : integer;
function IsReady() : boolean;
{$IFDEF CLIENT}
// apply servertimer
procedure UpdateTimer;
{$ENDIF}
{$IFDEF SERVER}
// send time sync
procedure SaveTimer;
{$ENDIF}
procedure InitTimer();
procedure StartTimer();
procedure FinishTimer();
published
[XEvent(eiIsReady, epFirst, etRead), ScriptExcludeMember]
/// <summary> Determines whether wela is ready or not. </summary>
function OnIsReady(Previous : RParam) : RParam;
[XEvent(eiAfterCreate, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Apply wela active state. </summary>
function OnAfterCreate() : boolean;
[XEvent(eiFire, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Restart cooldown. </summary>
function OnFire(Targets : RParam) : boolean;
{$IFDEF CLIENT}
[XEvent(eiCooldownStartingTime, epLast, etWrite), ScriptExcludeMember]
/// <summary> Retrieve sync from server. </summary>
function OnWriteCooldownStartingTime(StartingTime : RParam) : boolean;
{$ENDIF}
[XEvent(eiCooldownRemainingTime, epLast, etRead), ScriptExcludeMember]
/// <summary> Returns the remaining time of this cooldown. </summary>
function OnCooldownRemainingTime() : RParam;
[XEvent(eiCooldownProgress, epLast, etRead), ScriptExcludeMember]
/// <summary> Returns the percentage of remaining time of this cooldown. </summary>
function OnCooldownProgress() : RParam;
[XEvent(eiWelaActive, epLast, etWrite), ScriptExcludeMember]
/// <summary> Activates or deactivates this timer. </summary>
function OnSetWelaActive(IsActive : RParam) : boolean;
[XEvent(eiWelaCooldownReset, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Resets this timer. </summary>
function OnCooldownReset(Finish : RParam) : boolean;
public
constructor CreateGrouped(Owner : TEntity; ComponentGroup : TArray<byte>; ReadyAtStart : boolean); reintroduce;
/// <summary> The ready group determines, where this component contribute its ready check. By default the ready group = component group.
/// Useful if multiple groups resets this counter, but some of them won't check the counter. </summary>
function ReadyGroup(ReadyGroup : TArray<byte>) : TWelaReadyCooldownComponent;
/// <summary> The fire group determines, where this component is reset by fire.
/// Useful if multiple groups read this counter, but some of them won't reset the counter. </summary>
function FireGroup(FireGroup : TArray<byte>) : TWelaReadyCooldownComponent;
function Cooldown(CooldownMs : integer) : TWelaReadyCooldownComponent;
function Once() : TWelaReadyCooldownComponent;
destructor Destroy; override;
end;
{$ENDREGION}
{$REGION 'Misc'}
{$RTTI INHERIT}
/// <summary> Some welas produces entities and need data from them. This component redirects
/// all eiResourceCost and eiWelaNeededGridSize reads to the meta of eiWelaUnitPattern.
/// If other data is saved in the blackboard this data is used instead of the redirected. </summary>
TWelaEventRedirecter = class(TEntityComponent)
protected
function GetPattern(TargetGroup : SetComponentGroup) : string;
function Redirect(Event : EnumEventIdentifier; Previous : RParam) : RParam;
published
[XEvent(eiResourceCost, epFirst, etRead)]
[XEvent(eiWelaNeededGridSize, epFirst, etRead)]
[XEvent(eiWelaDamage, epFirst, etRead)]
[XEvent(eiWelaRange, epFirst, etRead)]
[XEvent(eiWelaTargetCount, epFirst, etRead)]
[XEvent(eiCooldown, epFirst, etRead)]
[XEvent(eiColorIdentity, epFirst, etRead)]
function OnRedirect(Previous : RParam) : RParam;
[XEvent(eiCollisionRadius, epFirst, etRead)]
function OnCollisionRadius(Previous : RParam) : RParam;
public
function CopyIndexedValue(Event : EnumEventIdentifier; SourceGroup : TArray<byte>; Resource : integer; TargetGroup : TArray<byte>) : TWelaEventRedirecter;
function CopyValue(Event : EnumEventIdentifier; SourceGroup : TArray<byte>; TargetGroup : TArray<byte>) : TWelaEventRedirecter;
end;
{$RTTI INHERIT}
/// <summary> Applies a script to an entity. </summary>
TWarheadApplyScriptComponent = class(TEntityComponent)
protected
type
EnumParameterType = (ptNone, ptInteger, ptSingle, ptBoolean, ptBooleanSameTeam, ptDirectionToTarget, ptOffsetToTarget, ptIntegerEvent, ptSingleEvent, ptRVector2Event, ptResource);
RParameter = record
Owner : TWarheadApplyScriptComponent;
ParameterEvent : EnumEventIdentifier;
ParameterIntValue : integer;
ParameterSingleValue : single;
ParameterBooleanValue : boolean;
ParameterType : EnumParameterType;
ParameterResource : EnumResource;
ParameterGroup : SetComponentGroup;
UsesGroupOverride : boolean;
PublicEvent : boolean;
Index : integer;
function GetValue(Eventbus : TEventbus; ComponentGroup : SetComponentGroup) : TValue;
end;
var
FCurrentTarget : TEntity; // for passing direction to target on fire warhead
FAtUnitProduced, FNotAtFire, FAfterCreate : boolean;
FScriptName, FMethodname : string;
FSpellGroup, FUpgradeGroup, FChargeGroup : byte;
FParameters : TList<RParameter>;
FTimer : TTimer;
procedure Apply(Entity : TEntity);
published
[XEvent(eiAfterCreate, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Apply the script to the targets. </summary>
function OnAfterCreate() : boolean;
[XEvent(eiFireWarhead, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Apply the script to the targets. </summary>
function OnFireWarhead(Targets : RParam) : boolean;
[XEvent(eiWelaUnitProduced, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Apply the script to produced units. </summary>
function OnWelaUnitProduced(EntityID : RParam) : boolean;
[XEvent(eiIdle, epLast, etTrigger, esGlobal)]
/// <summary> Apply the script to self if delayed. </summary>
function OnIdle() : boolean;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; ScriptToApply : string); reintroduce;
/// <summary> Passes additional parameters to the Apply-Method. The order of the passmethod determines
/// their index. The parameters are placed AFTER the obligatory entity parameter. </summary>
function PassValueFromEvent(Event : integer) : TWarheadApplyScriptComponent;
function PassSavedTargetPosition(Index : integer) : TWarheadApplyScriptComponent;
function PassResource(Resource : EnumResource) : TWarheadApplyScriptComponent;
function PassIntValue(Value : integer) : TWarheadApplyScriptComponent;
function PassSingleValue(Value : single) : TWarheadApplyScriptComponent;
function PassBooleanValue(Value : boolean) : TWarheadApplyScriptComponent;
function PassSameTeam() : TWarheadApplyScriptComponent;
function PassDirectionToTarget : TWarheadApplyScriptComponent;
function PassOffsetToOwner : TWarheadApplyScriptComponent;
function OverrideLastParameterGroup(Group : TArray<byte>) : TWarheadApplyScriptComponent;
function Methodname(const Methodname : string) : TWarheadApplyScriptComponent;
function ApplyToProducedUnits : TWarheadApplyScriptComponent;
/// <summary> Applies the script to the entity itself after creation and frees this. </summary>
function ApplyToSelfAtCreate : TWarheadApplyScriptComponent;
function ApplyToSelfAfterDelay(Duration : integer) : TWarheadApplyScriptComponent;
destructor Destroy; override;
end;
/// <summary> Applies a script to an entity. </summary>
TWarheadLinkApplyScriptComponent = class(TWarheadApplyScriptComponent)
protected
FSavedScriptGroup : SetComponentGroup;
FActivateOnAfterCreate, FRemoveOnDestroy : boolean;
/// <summary> Remove the components of the linktarget. </summary>
procedure BeforeComponentFree; override;
published
[XEvent(eiAfterCreate, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Apply the script to the Linktarget. </summary>
function OnAfterCreate() : boolean;
[XEvent(eiReplaceEntity, epLast, etTrigger, esGlobal)]
/// <summary> Removes script from unit if replaced. </summary>
function OnReplaceEntity(OldEntityID, NewEntityID, IsSameEntity : RParam) : boolean;
public
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; ScriptToApply : string); reintroduce;
end;
{$RTTI INHERIT}
EnumResolveSource = (rsTeamID, rsLevel, rsResource, rsTier, rsOwnerTier);
/// <summary> Resolves the level (reLevel) for (eiWeladamage, eiWelaCount). Chooses the values saved
/// in the level index and return them. </summary>
TWelaHelperResolveComponent = class(TEntityComponent)
protected
FLevelGroup : SetComponentGroup;
FSource : EnumResolveSource;
FResource : EnumResource;
function GetCurrentIndex : integer;
published
[XEvent(eiWelaUnitPattern, epFirst, etRead)]
[XEvent(eiWelaCount, epFirst, etRead)]
[XEvent(eiWelaTargetCount, epFirst, etRead)]
[XEvent(eiWelaDamage, epFirst, etRead)]
[XEvent(eiWelaAreaOfEffect, epFirst, etRead)]
[XEvent(eiWelaSplashfactor, epFirst, etRead)]
[XEvent(eiWelaRange, epFirst, etRead)]
[XEvent(eiArmorType, epFirst, etRead)]
[XEvent(eiCooldown, epFirst, etRead)]
/// <summary> Resolves the right index. </summary>
function OnFetch(Previous : RParam) : RParam;
public
/// <summary> Sets the group which contains the level. </summary>
function ResolveLevel(LevelGroup : TArray<byte>) : TWelaHelperResolveComponent;
function ResolveTeamID() : TWelaHelperResolveComponent;
/// <summary> Resolve the tier the game currently is in. </summary>
function ResolveCurrentTier() : TWelaHelperResolveComponent;
/// <summary> Resolves the tier of the owner. </summary>
function ResolveTier() : TWelaHelperResolveComponent;
/// <summary> Sets the group which contains the level. </summary>
function ResolveResource(Resource : EnumResource; ResourceGroup : TArray<byte>) : TWelaHelperResolveComponent;
end;
{$ENDREGION}
implementation
uses
{$IFDEF SERVER}
BaseConflict.Globals.Server,
{$ENDIF}
{$IFDEF CLIENT}
BaseConflict.Globals.Client,
{$ENDIF}
BaseConflict.Globals;
{ TModifierComponent }
constructor TModifierComponent.CreateGrouped(Owner : TEntity; ComponentGroup : TArray<byte>);
begin
inherited CreateGrouped(Owner, ComponentGroup);
FValueGroup := self.ComponentGroup;
end;
function TModifierComponent.IsActive : boolean;
begin
Result := (FReadyGroup = []) or Eventbus.Read(eiIsReady, [], FReadyGroup).AsBooleanDefaultTrue;
end;
function TModifierComponent.ReadyGroup(const ReadyGroup : TArray<byte>) : TModifierComponent;
begin
Result := self;
FReadyGroup := ByteArrayToComponentGroup(ReadyGroup);