-
Notifications
You must be signed in to change notification settings - Fork 1
/
SoccerBrainv3.pas
18064 lines (15565 loc) · 755 KB
/
SoccerBrainv3.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
{$R-}
//{$DEFINE ADDITIONAL_MATCHINFO}
unit SoccerBrainv3;
interface
uses DSE_theater, DSE_Random, DSE_PathPlanner, DSE_MISC,
generics.collections, generics.defaults, system.classes, ZLIBEX,
System.SysUtils, System.Types, strutils, Inifiles, IOUtils, winapi.windows , forms;
const Schemas = 4; // numero di schema delle uniformi
const MAX_LEVEL = 30;
const modifier_autotackle = 0;
const TurnMoves = 4; // Numero di mosse per turno
const TurnMovesStart = 2; // il calcio d'inizio ha solo 2 mosse
const SEASON_MATCHES = 38; // numero di partite a stagione
const REGEN_STAMINA = 10; // rigenerazione stamina dopo 1 partita
const YELLOW_DISQUALIFIED = 3;
const GKXP_REDUCTION = 20; // 20% di fare xp
const xp_SPEED_POINTS = 120;
const xp_DEFENSE_POINTS = 120;
const xp_PASSING_POINTS = 120;
const xp_BALLCONTROL_POINTS = 120;
const xp_SHOT_POINTS = 80;
const xp_HEADING_POINTS = 80;
const F_DEFENSESHOT = 3;
const M_DEFENSESHOT = 5;
// Queste costanti sono uguali al DB game.talents . Gli ID devono corrispondere
const NUM_TALENT = 24; // totale talenti di livelo 1
const TALENT_ID_GOALKEEPER = 1; // può giocare in porta
const TALENT_ID_CHALLENGE = 2; // lottatore + 1 autotackle
const TALENT_ID_TOUGHNESS = 3; // +1 tackle
const TALENT_ID_POWER = 4; // +1 resist tackle
const TALENT_ID_CROSSING = 5; // +1 crossing
const TALENT_ID_LONGPASS = 6; // +1 distanza passaggi
const TALENT_ID_EXPERIENCE = 7; // pressing non costa mosse
const TALENT_ID_DRIBBLING = 8; // +1 dribbling
const TALENT_ID_BULLDOG = 9; // mastino +1 intercept
const TALENT_ID_OFFENSIVE = 10; // durante ai_moveall tende ad attaccare
const TALENT_ID_DEFENSIVE = 11; // durante ai_moveall tende a difendere
const TALENT_ID_BOMB = 12; // tal_bomb è un +1 quando si buffa con corsa o riceve shp o vince tackle o vince dribbling
const TALENT_ID_PLAYMAKER = 13; // Cerca di avvicinarsi al proprio portatore di palla. Inoltre i suoi passaggi corti terminanti in area avversaria conferiscono un bonus al ricevente.
const TALENT_ID_FAUL = 14; // +15% chance di commettere un fallo. -30% chance di subire sanzioni.
const TALENT_ID_MARKING = 15; // DIF=Marca l'attaccante con il Tiro piu' alto. Cen=Marca il Centrocampista con il passaggio piu' alto. ATT=Marca il difensore con il Controllo piu' basso.
const TALENT_ID_POSITIONING = 16; // Cerca di tornare verso la propria zona di campo. talent2 offensive=ala o centravanti talent2 defensive=chiude le fascie o il centro
const TALENT_ID_FREEKICKS = 17; // +1 Tiro sui Calci di punizione e rigori.
const TALENT_ID_AGILITY = 18; // Quando riceve un passaggio corto distante almeno 2 celle, non costa mosse.
const TALENT_ID_RAPIDPASSING = 19; // Ha il 33% chance di effettuare un passaggio verso un compagno. non può essere intercettato
const TALENT_ID_AGGRESSION = 20; // cerca il portatore di palla
const TALENT_ID_ACE = 21; // Ha il 33% chance di effettuare un dribbling vincente quando subisce pressing
const TALENT_ID_HEADING = 22; // Ha una chance del 5% di ottenere +1 durante i colpi di testa.
const TALENT_ID_FINISHING = 23; // Quando ottiene la palla dopo un rimbalzo ha +1 Tiro.
const TALENT_ID_DIVING = 24; // +10% chance di subire un fallo durante i tackle.
//------------------------------------------------------------------
{ nel server c'è array xpNeedTAL[I] e si puntano così xpTAL[TALENT_ID_EXPERIENCE]. da modificare se si modifica qui}
const LOW_TALENT2 = 128; // id basso talenti di livelo 2
const HIGH_TALENT2 = 141; // id alto talenti di livelo 2
const LOW_TALENT2_GK = 250; // id basso talenti di livelo 2 solo del portiere (GK)
const HIGH_TALENT2_GK = 251; // id alto talenti di livelo 2 solo del portiere (GK)
const TALENT_ID_ADVANCED_CHALLENGE = 128; // prereq difesa 3/5 TALENT_ID_CHALLENGE --> 5% chance +1 autotackle
const TALENT_ID_ADVANCED_TOUGHNESS = 129; // prereq difesa 3/5 TALENT_ID_TOUGHNESS --> 5% chance +1 tackle
const TALENT_ID_ADVANCED_POWER = 130; // prereq ballcontrol 3 TALENT_ID_POWER --> 5% chance +1 resist tackle
const TALENT_ID_ADVANCED_CROSSING = 131; // prereq passing 3/5 TALENT_ID_CROSSING --> 5% chance +2 crossing
const TALENT_ID_ADVANCED_EXPERIENCE = 132; // prereq TALENT_ID_EXPERIENCE --> pressing costa cpst_pre - 1
const TALENT_ID_ADVANCED_DRIBBLING = 133; // prereq TALENT_ID_DRIBBLING --> +2 totale dribbling . strutture alzano questa chance
const TALENT_ID_ADVANCED_BULLDOG = 134; // prereq TALENT_ID_BULLDOG mastino +2 intercept
const TALENT_ID_ADVANCED_AGGRESSION = 135; // prereq TALENT_ID_AGGRESSION fa pressing automatico sul portatore di palla se lo raggiunge. 25% chance. no sistema di cariche qui.
const TALENT_ID_ADVANCED_BOMB = 136; // prereq tiro 3/5 talent bomb --> 5% chance che si attivi da solo tiro +2 su powershot, non precision.shot
const TALENT_ID_PRECISE_CROSSING = 137; // prereq passing 3 TALENT_ID_CROSSING --> +1 crossing dal fondo
const TALENT_ID_SUPER_DRIBBLING = 138; // prereq almeno 3 ball.control, talent dribbling --> dribbling +3 chance 15% ( dribbling2 è +1 fisso )
const TALENT_ID_BUFF_DEFENSE = 139; //prereq almeno 3/5 Defense, 1 talento qualsiasi --> skill 2x buff reparto (5% chance) dif 20 turni + defense ballcontrol passing +1
const TALENT_ID_BUFF_MIDDLE = 140; //prereq almeno 3/5 passing, 1 talento qualsiasi --> skill 2x buff reparto (5% chance) cen 20 turni + speed max 4,ballcontrol,passing ,shot +1
const TALENT_ID_BUFF_FORWARD = 141; //prereq almeno 3/5 Shot , 1 talento qualsiasi --> skill 2x buff reparto (5% chance) att 20 turni + ballcontrol, passing,shot +1
const TALENT_ID_GKMIRACLE = 250; //solo GK Ha una chance del 10% di ottenere +2 Difesa sui tiri precisi a distanza 1. Non valido sui rigori.
const TALENT_ID_GKPENALTY = 251; //specialista para rigori. ottiene +1 10% chance .
const Turnmilliseconds = 120 * 1000;// 120 secondi per turno giocatore;
// costi in stamina delle singole skill
const cost_bac = 1; // ball control su lop
const cost_plm = 1;
const cost_mov = 0; // ai_moveAll
const cost_shp = 0;
const cost_lop = 1;
const cost_pre = 3;
const cost_pro = 2;
const cost_dri = 1;
const cost_cro = 2;
const cost_prs = 2;
const cost_pos = 2;
const cost_hea = 2;
const cost_tac = 3;
const cost_autotac = 2;
const cost_cor = 1;
const cost_defshot = 1;
const cost_defdrib = 3;
const cost_GKprs = 6;
const cost_GKHeading = 8;
const cost_GKpos = 10;
const ShortPassRange = 2;
const LoftedPassRangeMin = 2;
const LoftedPassRangeMax = 4;
const CrossingRangeMin = 2;
const CrossingRangeMax = 5;
const PowerShotRange = 3;
const PrecisionShotRange = 3;
const TackleDiff = 2;
const VolleyRangeMin = 3;
const MARKET_VALUE_ATTRIBUTE_DEFENSE_GK = 3; // i portieri valgono il doppio attributo difesa
const MARKET_VALUE_ATTRIBUTE : array[1..10] of Single = (1, 2, 16, 64, 256, 512, 1024, 2048, 4096, 8192 ) ;
const MARKET_VALUE_TALENT1 = 1.4 ;
const MARKET_VALUE_TALENT2 = 1.2 ;
const GOLD_START = 210 ;
type TDecMovesLeft = ( DecNone, DecNormal, DecNoResetPlayer);
//--------------------------------------------------------
Type TShotCell = Class
DoorTeam: integer;
CellX: integer;
CellY: integer;
subCell : TList<Tpoint>;
Constructor Create;
Destructor Destroy;override;
end;
type TChance = record
Value : integer;
Modifier: Integer;
Modifier2: Integer; // es. 5% +1 autotackle. è una chance da mostare con un trattino
aString : string;
aString2 : string;
end;
type TDoorTeam = ( DoorFriendly, DoorOpponent);
type TGameMode =(pvnull,pve,pvp);
type TTVCrossAreaCell = record
DoorTeam: integer;
CellX: integer;
CellY: integer;
end;
type TAICrossAreaCell = record
DoorTeam: TDoorTeam;
CellX: integer;
CellY: integer;
end;
type TFieldCell = record
Team: byte;
AI,TV: Tpoint;
end;
//--------------------------------------------------------
//TYPE TAIProcedure = procedure of object;
type TShortPoint = record
X,Y: ShortInt;
end;
type TSubOUT = ( DefenderOUT,forwardOUT);
type TBetterSolution = ( SubAbs4, subDone, SubCant, TacticDone, StayFreeDone, CleanRowDone, None );
type TSubType = ( PossiblysameRole, BestShot, bestDefense, bestPassing );
type TTacticType = ( D4M, D4F, M4D, M4F, F4d,F4M );
type TTackleDirection = ( TackleBack, TackleSide, TackleAhead );
type TBottomPosition = ( NearCornerCell, BottomNoShot, BottomShot, BottomNone, BottomNoneCanCross);
TYPE TNotifyFileData = procedure (filename: string ) of object;
type TAccelerationMode = ( AccBestDistance, AccSelfY, AccDoor );
type TMoveModeX = ( LeftToRight, RightToLeft, Xnone);
type TMoveModeY= ( UpToDown, DownToUp, Ynone);
type TOneDir= ( TruncOneDir, AbortMultipleDirection, EveryDirection);
type TTrueFalse = array[Boolean] of String;
type TCornerMode = ( OpponentCorner, FriendlyCorner );
type TFormationCell = record // conversione per AI e formations
CellX, CellY : Integer;
Team: array[0..1] of TPoint;
Role: char;
end;
type Tscore = record
CliId: array[0..1] of integer; // cliId o account
UserName : array [0..1] of string[32];
Team: array[0..1] of string [35]; // name
Country: array[0..1] of word;
TeamGuid: array[0..1] of integer;
TeamSubs: array[0..1] of ShortInt;
Rank : array[0..1] of Byte;
TeamMI: array[0..1] of integer;
Season: array[0..1] of integer;
SeasonRound: array[0..1] of byte;
Points: array[0..1] of byte; // non sono i points del db. queste partono a 0 e serve al finalizeBrain
Uniform: array[0..1] of string [12];
DominantColor: array[0..1] of Integer;
FontColor: array[0..1] of Integer;
gol : array[0..1] of Byte;
BuffD : array[0..1] of ShortInt;
BuffM : array[0..1] of ShortInt;
BuffF : array[0..1] of ShortInt;
Minute : SmallInt;
AI: array[0..1] of boolean;
lstGol : string; //2=2434,6=1274 .... poi gestista come Tstringlist
end;
type TRoll = record
value: ShortInt; // può andare a -1 poi essere corretto
fatigue: char;
end;
type TFormation = record // formazioni es. 4-4-2
d,m,f: Integer; // Defend,Mddle,Forward = difensori, centrocampisti, attaccanti
Cells: array [2..11] of TPoint; // parte in base 2. il GK (portiere) è escluso perchè è sempre presente.
end;
type TAIMidChance = record
X: Integer;
Y: Integer;
Chance: Integer;
inputAI: string;
//AiProc : TAIProcedure;
end;
type TAICells = record
chance: Integer;
Cells: TPoint;
end;
type TCellAndPlayer = record
Player : string;
chance: integer;
CellX: integer;
CellY: integer;
end;
type TVirtualPlayer = record
ids : string;
Team : byte;
VirtualCellX: integer;
VirtualCellY: integer;
canMove: Boolean;
Role: char;
end;
Type TCornerMap = record
Team : integer; // corner a favore di questo team
GK: TPoint; // Portiere avversario al corner
CornerCell: TPoint;
HeadingCellA: array [0..2] of Tpoint; // 3 coa
HeadingCellD: array [0..2] of Tpoint; // 3 cod
end;
Type
TSoccerBrain = class;
TSoccerPlayer = class ;
TBall = Class;
TBall = Class
private
function GetCells : TPoint ;
procedure SetCells ( v: TPoint );
procedure SetCellX ( v: ShortInt );
procedure SetCellY ( v: ShortInt );
procedure SetPlayer ( v: TSoccerPlayer );
Function GetPlayer : TSoccerPlayer ;
Function GetZone : Byte ; // 0 2 1
protected
public
Se_sprite: Se_sprite;
Cx : ShortInt;
Cy : ShortInt;
fZone: byte;
brain : TSoccerBrain;
PathBall: dse_pathplanner.TPath;
Speed: Integer;
constructor create( aBrain: TSoccerBrain );
destructor Destroy; override;
Function BallIsOutSide : boolean;
property CellX : ShortInt read cx write SetCellX;
property CellY : ShortInt read cy write SetCellY;
property Zone: Byte read GetZone;
Property Player: TSoccerPlayer read GetPlayer write SetPlayer ;
property Cells : Tpoint read GetCells write SetCells;
end;
TSoccerPlayer = class
private
brain: TSoccerBrain;
fAttributes: Shortstring;
fDefaultAttributes: Shortstring;
fGameOver: boolean;
function GetCells : TPoint ;
procedure SetCells ( v: TPoint );
function GetDefaultCells : TPoint ;
procedure SetDefaultCells ( v: TPoint );
procedure SetCellX ( v: ShortInt );
procedure SetCellY ( v: ShortInt );
procedure LoadDefaultAttributes ( v: shortstring );
procedure LoadAttributes ( v: ShortString );
procedure SetGameOver( const value: Boolean);
procedure SetSpeed( v: ShortInt );
procedure SetStamina( v: SmallInt );
procedure SetDefense( v: ShortInt );
procedure SetBallControl( v: ShortInt );
procedure SetPassing( v: ShortInt );
procedure SetShot( v: ShortInt );
procedure SetHeading( v: ShortInt );
function GetMarketValue: Integer;
function GetActiveAttrTalValue: Integer;
protected
public
itag: Integer;
grouped : boolean; // utile per compileList sia al client che al server
stay: Boolean; // non si muove durante ai_moveall
// generali
MatchCost : integer;
MatchesPlayed: SmallInt;
Age: byte;
MatchesLeft: SmallInt;
Team: byte;
GuidTeam : Integer;
Ids: string;
SurName: string [25];
Role: char;
se_sprite: Se_sprite; // usato solo nel client
// le celle differiscono tra normale (chiamate TVcell a volte per la visuale del campo televisiva) e AIcell, celle che usa
// la AI e la formazione. il campo è ruotato di 90 gradi. la AI attacca sempre verso l'alto, la tv mostra il da sinistra a destra e viceversa
cx,cy: ShortInt; // coordinate celle
AIFormationCellX,AIFormationCellY: ShortInt;
DefaultCellX, DefaultCellY: ShortInt; //
// buff e debuff
CanMove, CanSkill, CanDribbling: boolean; // in base a certi debuff il player potrebbe non potere compiere certe azioni
PressingDone: Boolean; // ogni player fa pressing solo una volta in un turno e solo sul portatore di palla
TackleDone: Boolean; // un player fa solo un tackle alla volta per turno
BuffMorale : Shortint; // possono andare in negativo
BuffHome : Shortint;
BonusTackleTurn : ShortInt;
BonusLopBallControlTurn: ShortInt;
BonusProtectionTurn : ShortInt; // n turni Protection BonusProtection attivo //< Protection vs Pressing
UnderPressureTurn : ShortInt; // valore di difesa decrementato// n turni Pressing attivo
BonusSHPturn: ShortInt;
BonusSHPAREAturn: ShortInt;
BonusPLMturn: ShortInt;
BonusBuffD: ShortInt;
BonusBuffM: ShortInt;
BonusBuffF: ShortInt;
BonusFinishingTurn: ShortInt;
BonusFinishing: ShortInt;
isCOF: boolean; // chi batte il corner
isFK1: boolean; // chi batte un fallo a favore nella propria metacampo
isFK2: boolean; // chi batte un cross
isFK3: boolean; // chi batte una punizione con barriera
isFK4: boolean; // il rigorista
isFKD3 : Boolean; // se fa parte della barriera
face: integer; // id del bmp del viso
// comuni
fSpeed: ShortInt;
fStamina: SmallInt;
fDefense: ShortInt;
fBallControl: ShortInt;
fPassing: ShortInt;
fShot: ShortInt;
fHeading: ShortInt;
ActiveSkills: TstringList;
MovePath: dse_pathplanner.TPath;
MoveValue: byte;
// l'xp è nell'esatto ordine: 34,23,12,1,2,ecc.... 6 attributes base e a seguire i talenti
xp_Speed: integer;
xp_Defense: integer;
xp_BallControl: integer;
xp_Passing: integer;
xp_Shot: integer;
xp_Heading: integer;
history_Speed: ShortInt; // storia del player. se è migliorato o peggiorato
history_Defense: ShortInt;
history_BallControl: ShortInt;
history_Passing: ShortInt;
history_Shot: ShortInt;
history_Heading: ShortInt;
Flank: Integer;
InterceptModifier: integer;
XpTal: array [1..NUM_TALENT] of Integer; // come i talenti sul db game.talents. xp guadagnata in questa partita(brain) per futuro trylevelup del talento
PlayerOut : Boolean; // sostituito
Injured: ShortInt; // giornate di infortunio rimaste
YellowCard: ShortInt; // ammonizioni accumulate
RedCard: ShortInt; // espulsione diretta o con somma di gialli
disqualified: ShortInt; // giornate di squalifica
devA: Integer; // chance dopo N azioni di guadagnare 1 punto stat
devT: Integer; // chance dopo N azioni di guadagnare 1 talento
devI: Integer; // // chance dopo un infortunio (lungo) di perdere una stat
xpDevA : Integer;
xpDevT : Integer;
xpDevI : Integer;
DefaultSpeed: ShortInt;
DefaultStamina: ShortInt;
DefaultDefense: ShortInt;
DefaultBallControl: ShortInt;
DefaultPassing : ShortInt;
DefaultShot : ShortInt;
DefaultHeading : ShortInt;
DefaultShortPassing: ShortInt;
DefaultLoftedPass: ShortInt;
DefaultPressing: ShortInt;
DefaultPrecisionShot: ShortInt;
DefaultPowerShot: ShortInt;
DefaultCrossing: ShortInt;
Fitness: ShortInt;
Morale: ShortInt;
Country: SmallInt;
TalentId1: byte;
TalentId2: byte;
tmp: ShortInt;
OnMarket : Boolean;
constructor create ( const aTeam, aGuidTeam, aMatchesPlayed : integer; const aIds, aName, aSurname, AT: string; Talent1,Talent2: integer );
destructor Destroy; override;
function HasBall: boolean;
function InCrossingArea : boolean;
function InCrossingCell: boolean;
function InShotCell : boolean;
function onBottom : TBottomPosition; // 1 NearCornerCell 2 BottomNoShot 3 BottomShot
function GetField : byte;
function GetZoneRole : char;
property CellX : ShortInt read cx write SetCellX;
property CellY : ShortInt read cy write SetCellY;
property Attributes : ShortString read fAttributes write LoadAttributes;
property DefaultAttributes : ShortString read fDefaultAttributes write LoadDefaultAttributes;
property Speed : ShortInt read fSpeed write SetSpeed;
property Stamina : SmallInt read fStamina write SetStamina;
property Defense : ShortInt read fDefense write SetDefense;
property BallControl : ShortInt read fBallControl write SetBallControl;
property Passing : ShortInt read fPassing write SetPassing;
property Heading : ShortInt read fHeading write SetHeading;
property Shot : ShortInt read fShot write SetShot;
property Cells : Tpoint read GetCells write SetCells;
property DefaultCells : Tpoint read GetDefaultCells write SetDefaultCells;
property MarketValue : Integer read GetMarketValue;
property ActiveAttrTalValue : Integer read GetActiveAttrTalValue;
property field : byte read Getfield;
property ZoneRole: char read GetZoneRole;
property Gameover: Boolean read fGameOver Write SetGameOver;
procedure resetALL;
procedure resetTAC;
procedure resetLBC;
procedure resetPRO;
procedure resetPRE;
procedure resetSHP;
procedure resetSHPAREA;
procedure resetPLM;
procedure resetFIN;
end;
pSoccerPlayer = ^TSoccerplayer;
TAttributeName = ( atSpeed , atDefense, atBallControl, atPassing, atShot, atHeading);
TInteractivePlayer = class // Player che puòpublic interagire durante il turno dell'avversario. ad esempio Intercept su Short.passing dell'avversario
Player : TSoccerPlayer; // il player che interagisce
Cell: Tpoint; // la cella su cui interagisce
Attribute : TAttributeName;// TSoccerAttribute; // con quale attributo interagisce. per esempio heading su lofted.pass
end;
TSoccerBrain = class( TObject ) // l'oggetto principale del singolo match. contine tutta la partita in memoria
private
aStar: TAStarPathPlanner;
fdir_log: string;
function GetW_Something: Boolean;
procedure SetTeamMovesLeft ( const Value: ShortInt );
procedure SetMinute ( const Value: SmallInt );
procedure SetDirLog ( value: string );
protected
public
GameMode : TGameMode;
pvePostMessage: boolean;
debug_TACKLE_FAILED : Boolean; // sempre tackle fallito
debug_SETFAULT : Boolean; // sempre fallo
debug_SETRED : boolean; // sempre espulsione dopo fallo
debug_SetAlwaysGol : Boolean;
debug_Setposcrosscorner : Boolean;
debug_Buff100 : Boolean;
Season: integer;
Country : integer;
Division : integer;
Round : Integer;
fGender: Char;
GenderN: integer;
//Dice : Integer;
MAX_STAT : Integer;
MAX_DEFAULT_SPEED : Integer;
MAX_DEFAULT_DEFENSE : Integer;
MAX_DEFAULT_PASSING : Integer;
MAX_DEFAULT_BALLCONTROL :Integer;
MAX_DEFAULT_SHOT :Integer;
MAX_DEFAULT_HEADING :Integer;
PRE_VALUE : Integer;
PRO_VALUE : Integer;
CRO_MIN1 :Integer;
CRO_MIN2 :Integer;
CRO_MID1 :Integer;
CRO_MID2 :Integer;
CRO_MAX1 :Integer;
LOP_MIN1 :Integer;
LOP_MIN2 :Integer;
LOP_MID1 :Integer;
LOP_MID2 :Integer;
LOP_MAX1 :Integer;
LOP_BC_MIN1 :Integer;
LOP_BC_MIN2 :Integer;
LOP_BC_MID1 :Integer;
LOP_BC_MID2 :Integer;
LOP_BC_MAX1 :Integer;
DRIBBLING_MALUS: Integer;
DRIBBLING_DIFF: Integer;// buff
modifier_defenseShot: Integer;
modifier_penaltyPOS :Integer;
modifier_penaltyPRS :Integer;
CRO2_D2_MIN :Integer;
CRO2_D2_MAX :Integer;
CRO2_D1_MIN :Integer;
CRO2_D1_MAX :Integer;
CRO2_D0_MIN :Integer;
CRO2_D0_MAX :Integer;
CRO2_A2_MIN :Integer;
CRO2_A2_MAX :Integer;
CRO2_A1_MIN :Integer;
CRO2_A1_MAX :Integer;
CRO2_A0_MIN :Integer;
COR_D2_MIN :Integer;
COR_D2_MAX :Integer;
COR_D1_MIN :Integer;
COR_D1_MAX :Integer;
COR_D0_MIN :Integer;
COR_D0_MAX :Integer;
COR_A2_MIN :Integer;
COR_A2_MAX :Integer;
COR_A1_MIN :Integer;
COR_A1_MAX :Integer;
COR_A0_MIN :Integer;
lstSoccerPlayerALL : TObjectList<TSoccerPlayer>;
lstSoccerPlayer : TObjectList<TSoccerPlayer>;
lstSoccerReserve : TObjectList<TSoccerPlayer>;
lstSoccerGameOver : TObjectList<TSoccerPlayer>;
// AICrossingAreaCells: TList<TAICrossAreaCell>;
// TVCrossingAreaCells: TList<TTVCrossAreaCell>;
LogUser: array [0..1] of integer;
MMbraindata,MMbraindataZIP: TMemoryStream;
MatchInfo: TStringList; // Il tabellino della partita: gol, minuti, e cognomi. Tipologia se pos3 punizioni o pos4 rigore. cartellini. sostituzioni.
ReserveSlot,GameOverSlot : array [0..1, 0..21] of string;
Working: Boolean; // se true, sta elaborando un input e non può accettare input del client
brainIds: string[50]; // Identificativo globale del brain
brainSerie: string;
Paused: Boolean;
RandGen: TtdBasePRNG;
AI_GCD, LastTickCount: Integer;
utime: Boolean;
fmilliseconds: integer;
lstSpectator : TList<Integer>;
brainManager: TObject;
Score: TScore;
incMove : SmallInt;
BonusPowerShotGK: array [1..10] of integer; // pos modificatori al tiro in porta
BonusPrecisionShotGK: array [1..10] of integer; // prs modificatori al tiro in porta
ToEmptyCellBonusDefending: integer; // definizioni
Ball: Tball;
ShpFree: ShortInt; // può andare in negativo
fMinute: smallint;
TeamTurn: byte;
FTeamMovesLeft : ShortInt;
GameStarted: boolean;
FlagEndGame : boolean;
Finished: boolean;
FinishedTime: integer;
TeamCorner: ShortInt;
TeamFreeKick: ShortInt;
w_CornerSetup: boolean; // il brain è in fase di setup del corner
w_Coa : boolean; // il brain è in fase di setup del corner e aspetta chi lo batte e i 3 attaccanti schierati in area di rigore
w_Cod: boolean; // il brain è in fase di setup del corner e aspetta i 3 difensori schierati in area di rigore
w_CornerKick: boolean; // il brain aspetta che il corner sia battuto ( brain.exec_Corner )
w_FreeKickSetup1: boolean;
w_Fka1 : boolean; // normale
w_FreeKick1: boolean;
w_FreeKickSetup2: boolean;
w_Fka2 : boolean;
w_Fkd2: boolean; // 3 saltatori di testa
w_FreeKick2: boolean;
w_FreeKickSetup3: boolean;
w_Fka3 : boolean;
w_Fkd3: boolean; // 4 o 1 1 1 barriere
w_FreeKick3: boolean;
w_FreeKickSetup4: boolean;
w_Fka4 : boolean; // rigorista
w_FreeKick4: boolean;
tsSpeaker: TstringList;
tsScript: array [0..255] of TstringList; // la lista di ciò che accade sul server viene spedita al client
TsErrorLog: TStringList;
ExceptPlayers: TObjectList<TSoccerPlayer>; // lista di player che non si muoveranno durante la Ai_moveAll
ShpBuff: Boolean;
function findSpectator (Cliid: Integer): Boolean;
function RemoveSpectator (Cliid: Integer): Boolean;
constructor Create ( ids: string; AGender: Char; aSeason, aCountry, aDivision, aRound: integer);
destructor Destroy; override;
// procedure CreateFormationCells;
// procedure FormationCellCompleteInfo ( team, Fcx, Fcy: Integer; var CellX, CellY: Integer; var Role:string );
// function FieldCellToFormationCell ( CellX, CellY : integer ): TFormationCell;
function AdjustFatigue ( const Stamina , Roll: integer ): TRoll;
function RndGenerate( Upper: integer ): integer;
function RndGenerate0( Upper: integer ): integer;
function RndGenerateRange( Lower, Upper: integer ): integer;
procedure CornerSetup ( const aPlayer: TSoccerPlayer ); // Corner
procedure FreeKickSetup1 ( team : Integer ); // normale nella propria metacampo
procedure FreeKickSetup2 ( team : Integer ); // cross
procedure FreeKickSetup3 ( team : Integer ); // barriera
function GetBarrierCell (Team: Integer; CellX,CellY: integer ): TPoint;
procedure DeflateBarrier ( aCell: Tpoint; ExceptPlayer: TSoccerPlayer );
function FindDefensiveCellFree ( team: integer ): Tpoint;
procedure FreeKickSetup4 ( team : Integer ); // rigore
function GetPenaltyCell (Team: Integer ): TPoint;
procedure FreePenaltyArea ( team : Integer );
function FindDefensiveCellFreePenalty ( team: integer ): Tpoint;
procedure Start;
procedure LoadDefaultTeamPos ( aTeam: integer);
procedure BrainInput ( aCmd: string );
procedure InputSecureExit ( DoAiMoveAll: Boolean; DoTeamMovesLeft: TDecMovesLeft);
function CheckInputShp (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputLop (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputCro (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputDri (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputPos (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputPrs (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputPre (aPlayer: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckInputPro (aPlayer: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckInputTac (aPlayer: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckInputPlm (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputStay (aPlayer: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckInputFree (aPlayer: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckInputTactic (aPlayer: TsoccerPlayer; CellX, CellY: integer; tsCmd: Tstringlist): string;
function CheckInputSub (aPlayer,aPlayer2: TsoccerPlayer; tsCmd: Tstringlist): string;
function CheckOffside ( FromPlayer, aPossibleoffside: TSoccerPlayer ): boolean;
function GetOpponentDoor (SelectedPlayer: TSoccerPlayer ): TPoint;
function GetCorner (Team: integer; Y: integer; CornerMode: TCornerMode ): TCornerMap;
function IsCheatingBall ( TeamFault: Integer ) : boolean;
function IsCheatingBallGK ( OldTeamTurn: Integer ) : boolean;
function GetOpponentStart (SelectedPlayer: TSoccerPlayer ): TPoint;
property TeamMovesLeft : ShortInt read fTeamMovesLeft write SetTeamMovesLeft;
property Minute : SmallInt read fMinute write SetMinute;
function FindSwapCOAD ( SwapPlayer: TSoccerPlayer; CornerMap: TCornerMap ): Tpoint;
function exec_tackle ( ids: string):integer;
function exec_autotackle ( ids: string; LastPath: boolean ):boolean; // non c'è fallo
Function GetFault ( Team, CellX, CellY : integer): Integer;
procedure exec_corner ;
procedure exec_freekick2 ;
procedure TurnChange( MovesLeft: integer);
procedure Setmilliseconds ( value: integer);
procedure SetGender ( fm: char);
function inExceptPlayers ( aPlayer: TSoccerPlayer ) : Boolean;
procedure AI_MoveAll ; // !! movimento automatico dei player a fine turno
procedure AI_MovePlayer_DefaultX_minus_1 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_DefaultX_minus_2 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_DefaultX_plus_1 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_DefaultX_plus_2 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_DefaultX ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_DefaultY ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_Ball_equal ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_Ball_plus_1 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_Ball_plus_2 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_Ball_minus_1 ( aPlayer: TSoccerPlayer ) ;
procedure AI_MovePlayer_Ball_minus_2 ( aPlayer: TSoccerPlayer ) ;
// AI battle
function MirrorAIfield ( CellX,CellY: integer) : TPoint;
procedure AI_Think (Team: integer); // !! AI intelligenza artificiale
function AI_Injured_sub_tactic_stay (Team: integer): TBetterSolution; // // ai pensa a sostituzioni/tattiche/muovere,non muovere certi player, spostare il loro defaultcell
function AI_Think_sub (Team: Integer;anOutPlayer:TSoccerPlayer; SubType: TSubType ): TBetterSolution; // ai pensa a sostituzioni
function AI_Think_Tactic (Team, cks:integer ): TBetterSolution; // ai pensa a tattiche
function AI_Think_StayFree ( team, Cks:integer ): TbetterSolution; // ai pensa a muovere,non muovere certi player
function AI_Think_CleanSomeRows (team:Integer): TBetterSolution; // ai pensa di spostare qualche player
function AI_ForceRandomMove ( team : Integer ): Boolean;
function AI_TrySomeBuff ( team: integer ): Boolean;
function GetDummyTalentInRole ( team, TalentId: integer ): TSoccerPlayer;
procedure AI_Think_myball_iDefend ( Team: integer );
procedure AI_Think_myball_middle ( Team: integer );
procedure AI_Think_myball_iAttack ( Team: integer );
function DummyAheadPass( Team: integer ): Boolean;
function GetDummyAheadPass( Team: integer ): TSoccerPlayer; // in PlayMaker
function DummyTryCross( Team: integer ): Boolean;
function DummyReachTheCrossinArea1Moves( aPlayer: TSoccerPlayer; bestAttribute:TAttributeName) : boolean;
function DummyReachTheCrossinArea2Moves( aPlayer: TSoccerPlayer; bestAttribute:TAttributeName) : boolean;
function GetDummyCrossFriend ( aPlayer: TSoccerPlayer ): TSoccerPlayer;
function GetDummyVolleyFriend ( aPlayer: TSoccerPlayer ): TSoccerPlayer;
procedure DummyFindaWay( Team: integer );
procedure PosOrPrs ( Team, PosChance: integer );
// Dummy AI
function GetDummyGoAheadCell : TPoint; // il player con la palla cerca di avanzare
function GetDummyMaxAcceleration(AccelerationMode: TAccelerationMode): TPoint;
function GetDummyMaxAccelerationShotCells ( OnlyBuffed: boolean ): TPoint; // cerca di raggiungere una shotCell
function GetDummyMaxAccelerationBottom: TPoint; // cerca il fondo, l'ultima cella
function GetDummyShpCellXY : TPoint;
function DummyGetAnyFriendToBall ( dist, team: Integer; meIds:string; CellX, CellY: integer): TSoccerPlayer;
function GetDummyLopCellXY : Tpoint;
function GetDummyLopCellXYInfinite : Tpoint;
function GetDummyLopCellXYfriend : Tpoint; // utile per volley
procedure AI_Think_oppball_iDefend ( Team: integer );
procedure AI_Think_oppball_middle ( Team: integer );
procedure AI_Think_oppball_iAttack ( Team: integer );
procedure AiDummyTakeTheBall ( Team: integer );
function GetdummyTackle (team: Integer): TSoccerPlayer;
function GetdummyPressing (team: Integer): TSoccerPlayer;
procedure AI_Think_neutralball_iDefend ( Team: integer );
procedure AI_Think_neutralball_middle ( Team: integer );
procedure AI_Think_neutralball_iAttack ( Team: integer );
function DummyReachTheBall ( team: Integer): TSoccerPlayer;
function Tv2AiField ( Team, tvX,tvY: integer ): TPoint;
function AiField2TV ( Team, aiX,aiY: integer ): TPoint;
procedure CalculateChance ( A, B: integer; var chanceA, chanceB: integer);
procedure SaveData ( CurMove: Integer ); // !! salva i dati in memoria da spedire al client
function GetCrossDefenseBonus (aPlayer: TsoccerPlayer; CellX, CellY: integer ): integer;
function GetTeamBall: integer;
function NextReserveSlot ( aPlayer: TSoccerPlayer): Integer; overload;
function NextReserveSlot ( team: Integer): Integer; overload;
procedure PutInReserveSlot ( aPlayer: TSoccerPlayer ); overload;
procedure PutInReserveSlot ( aPlayer: TSoccerPlayer; ReserveCell: TPoint );overload; // mette il player nella cella indicata
procedure ClearReserveSlot;
function isReserveSlot (CellX, CellY: integer): boolean;
procedure CleanReserveSlot ( team: integer );
function NextGameOverSlot ( aPlayer: TSoccerPlayer): Integer; overload;
function NextGameOverSlot ( team: Integer): Integer; overload;
procedure PutInGameOverSlot ( aPlayer: TSoccerPlayer ); overload;
procedure PutInGameOverSlot ( aPlayer: TSoccerPlayer; GameOverCell: TPoint );overload; // mette il player nella cella indicata
procedure ClearGameOverSlot;
function isGameOverSlot (CellX, CellY: integer): boolean;
procedure CleanGameOverSlot ( team: integer );
procedure UpdateDevi; // sia team 0 che 1
procedure AddSoccerPlayer (aSoccerPlayer: TSoccerPlayer );
procedure AddSoccerReserve (aSoccerPlayer: TSoccerPlayer );
procedure AddSoccerGameOver (aSoccerPlayer: TSoccerPlayer );
procedure RemoveSoccerPlayer (aSoccerPlayer: TSoccerPlayer );
procedure RemoveSoccerReserve (aSoccerPlayer: TSoccerPlayer );
procedure RemoveSoccerGameOver (aSoccerPlayer: TSoccerPlayer );
procedure GetPath ( Team, X1, Y1, X2, Y2, Limit: integer; useFlank,FriendlyWall,OpponentWall,FinalWall: Boolean;OneDir: TOneDir; var aPath: dse_pathplanner.TPath );
procedure GetPath1dir ( Team, X1, Y1, X2, Y2, Limit: integer; useFlank,FriendlyWall,OpponentWall,FinalWall,OneDir: boolean; var aPath: dse_pathplanner.TPath );
procedure GetPathX ( Team, X1, Y1, X2, Y2, Limit: integer; useFlank,FriendlyWall,OpponentWall,FinalWall,OneDir: Boolean; var aPath: dse_pathplanner.TPath );
procedure GetPathY ( Team, X1, Y1, X2, Y2, Limit: integer; useFlank,FriendlyWall,OpponentWall,FinalWall,OneDir: Boolean; var aPath: dse_pathplanner.TPath );
procedure GetNeighbournsOpponent ( X, Y, Team: integer; var aList : TObjectList<TSoccerPlayer> );
function GetBounceCell ( StartX, StartY, ToX, ToY, Speed: integer; favourTeam: integer): TPoint;
function GetFriendAhead ( const aPlayer: TSoccerPlayer ) : TSoccerPlayer;
// SHP intercepts
procedure CompileInterceptList (ShpTeam, MaxDistance: integer; aPath : dse_pathplanner.TPath; var lstIntercepts: TList<TInteractivePlayer> );
// LOP heading
procedure CompileHeadingList (LopTeam, MaxDistance, CellX,CellY: integer; var lstHeading: TList<TInteractivePlayer> );
// LOP Speed
procedure CompileMovingList (MaxDistance, CellX,CellY: integer; var lstMoving: TList<TInteractivePlayer> );
// PLM autotackle
procedure CompileAutoTackleList (PlmTeam, MaxDistance: integer; aPath : dse_pathplanner.TPath; var lstAutoTackle: TList<TInteractivePlayer> );
// per i taleni buff
procedure CompileRoleList (team: Integer; role: Char; var lstRole: TObjectList<TSoccerPlayer> );
procedure CompileBuffedList (team: Integer; buff: Char; var lstRole: TObjectList<TSoccerPlayer> );
// CROSS
function GetFriendInCrossingArea ( const aPlayer: TSoccerPlayer ) : boolean;
function GetCrossOpponent ( aPlayer:TSoccerPlayer ): TSoccerPlayer;
function GetTotalReserve ( Team: integer; GK:boolean): integer;
function GetReservePlayerRandom ( Team: integer; GK:boolean): TSoccerPlayer;
function GetSoccerPlayerRandom ( Team: integer; GK:boolean): TSoccerPlayer;overload;
function GetSoccerPlayer (X,Y: integer): TSoccerPlayer;overload;
function GetSoccerPlayer (ids: string): TSoccerPlayer;overload;
function GetSoccerPlayer (ids: string; team: integer): TSoccerPlayer;overload;
function GetSoccerPlayer (X,Y, Team: integer): TSoccerPlayer;overload;
function GetSoccerPlayerOpponent (X,Y: Integer; Team: integer): TSoccerPlayer;overload;
function GetSoccerPlayerOpponent (ids: string; Team: integer): TSoccerPlayer;overload;
function GetSoccerPlayerDefault (X,Y: integer): TSoccerPlayer;
function GetSoccerPlayerDefault2 (X,Y: integer): TSoccerPlayer;
function GetSoccerPlayerReserve (ids : string): TSoccerPlayer;
function GetSoccerPlayerRandom3 : TSoccerPlayer; // cerca chi ha giocato in una partita ma non un GK
function GetSoccerPlayer2 (X,Y: integer): TSoccerPlayer;overload;
function GetSoccerPlayer2 (ids: string): TSoccerPlayer;overload;
function GetSoccerPlayer2 (X,Y, Team: integer): TSoccerPlayer;overload;
function GetSoccerPlayer2 (ids: string;Team: integer): TSoccerPlayer;overload;
function GetSoccerPlayerALL (ids: string): TSoccerPlayer;overload;
function GetSoccerPlayerALL (X,Y: integer): TSoccerPlayer;overload;
function GetSoccerPlayer3 ( ids: string ): TSoccerPlayer; // cerca chi ha giocato in una partita
function GetBestCrossing ( Team: integer ): string;
function GetBestHeading ( Team: integer; excludeIds: string ): string;
function GetBestPassing ( Team: integer ): string;
function GetBestShot ( Team: integer ): string;
function GetBestBarrier ( Team: integer ): string;
function GetBestPassingZone ( Team: integer; Zonerole:Char ): TSoccerPlayer;
function GetBestShotZone ( Team: integer; Zonerole:Char ): TSoccerPlayer;
function GetWorstBallControlZone ( Team: integer; Zonerole:Char ): TSoccerPlayer;
procedure ResetPassiveSkills;
function GetBestGKReserve ( Team,MinStamina: integer ): string;
function GetBestDefenseReserve ( Team,MinStamina: integer ): string;
function GetBestPassingReserve ( Team,MinStamina: integer ): string;
function GetBestShotReserve ( Team,MinStamina: integer ): string;
function GetWorstStamina ( Team: integer ): TSoccerPlayer;
function GetRandomDefaultMidFieldCellFree ( team:Integer ): TPoint;
function GetRandomDefaultDefenseCellFree ( team:Integer ): TPoint;
function GetRandomDefaultForwardCellFree ( team:Integer ): TPoint;
function CheckScore ( team: Integer): integer;
function GetPlayerForOUT (team: Integer; PlayerOUT: TSubOUT ):TSoccerPlayer;
function GetWorstPassing ( Team: integer ): TSoccerPlayer;
function GetWorstShot ( Team: integer ): TSoccerPlayer;
function GetWorstDefense ( Team: integer ): TSoccerPlayer;
// crossing
// intercept
// respinte portiere
function GetGKBounceCell ( GoalKeeper: TsoccerPlayer; GKX, GKY, Speed: integer; AllowCorner: boolean ): Tpoint;
Procedure CopyPath ( Path1, Path2 : dse_pathplanner.TPath );
procedure GetMarkingPath ( aPlayer: TSoccerPlayer );
procedure GetAggressionCellPath ( aSoccerPlayer: TSoccerPlayer; X2, Y2: integer );
procedure GetFavourCellPath ( aSoccerPlayer: TSoccerPlayer; X2, Y2: integer );
function GetRandomCell ( CellX, CellY, Speed: integer; noPlayer,noOutside: boolean ): Tpoint;
function GetRandomCellNO06 ( CellX, CellY, Speed: integer ): Tpoint;
function GetRandomCellNOPlayer ( CellX, CellY, Speed: integer ): Tpoint;
procedure GetNeighbournsCells ( CellX, CellY, Speed: integer; NoPlayer,noOutside,noGK: boolean; var aCellList:Tlist<TPoint> );
function GetZone ( Team, CellX, CellY: integer ): String;
function GetTackleDirection ( Team, StartX, StartY, ToX, ToY: Integer): TTackleDirection;
procedure GetNextDirectionCell ( StartX, StartY, ToX, ToY, Speed,Team: integer; FriendlyWall,OpponentWall: boolean; var aPath: dse_pathplanner.TPath );
procedure SwapPlayers (PlayerA, PlayerB: TsoccerPlayer);
procedure SwapDefaultPlayers (PlayerA, PlayerB: TsoccerPlayer);
procedure SwapformationPlayers (PlayerA, PlayerB: TsoccerPlayer);
function GetOpponentGK ( Team: integer): TSoccerPlayer;
function GetGK ( team: integer ): TSoccerPlayer;
function GetCof: TSoccerPlayer;
function GetFK1: TSoccerPlayer;
function GetFK2: TSoccerPlayer;
function GetFK3: TSoccerPlayer;
function GetFK4: TSoccerPlayer;
function GetInjuredPlayer( Team: integer ): TSoccerPlayer;
function IsOffSide ( FromPlayer, ToPlayer : TSoccerPlayer ): Boolean;
function IsLastMan ( aPlayer, BallPlayer : TSoccerPlayer ): Boolean;
function AllowCount ( team: Integer ): Integer;
function CurrentCount ( team: Integer ): Integer;
function CanDoSub ( team: Integer ): boolean;
function CalculateBasePrecisionShot ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBasePowerShot ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBasePrecisionShotGK ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBasePowerShotGK ( aPlayer: TSoccerPlayer ): Tchance;
// plm nove con autotackle
function CalculateBasePlmBallControl ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBasePlmBaseAutoTackle ( aPlayer: TSoccerPlayer ): Tchance;
// ShortPassing con Intercept e Stopped
function CalculateBaseShortPassing ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseShortPassingStopped ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseShortPassingIntercept ( CellX, CellY: Integer; aPlayer: TSoccerPlayer ): Tchance;
// LoftedPass
function CalculateBaseLoftedPass ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseLoftedPassBallControl ( aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseLoftedPassHeadingDefense ( CellX, CellY: Integer; aPlayer: TSoccerPlayer ): Tchance; // cellx e celly opzionali
function CalculateBaseLoftedPassEmptyPlmSpeed ( CellX, CellY: Integer; aPlayer: TSoccerPlayer ): Tchance; // cellx e celly opzionali
// Crossing
function CalculateBaseCrossing ( CellX, CellY: integer; aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseCrossingHeadingDefense ( CellX, CellY: integer; aPlayer: TSoccerPlayer ): Tchance;
function CalculateBaseCrossingHeadingFriend ( CellX, CellY: integer; aPlayer: TSoccerPlayer ): Tchance;
//Dribbling
function CalculateBaseDribblingChance ( CellX, CellY: integer; aPlayer: TSoccerPlayer ): Tchance;
function CalculatBaseDribblingDefense ( CellX, CellY: integer; anOpponent: TSoccerPlayer ): Tchance;
property milliseconds: Integer read fmilliseconds write setmilliseconds;
property Gender : char read fGender write SetGender;
property Dir_log : string read fdir_log write SetDirLog;
property W_SomeThing : Boolean read GetW_Something;