equal
deleted
inserted
replaced
56 BestActions.Pos:= 0 |
56 BestActions.Pos:= 0 |
57 end; |
57 end; |
58 |
58 |
59 procedure TestAmmos(var Actions: TActions; Me: PGear); |
59 procedure TestAmmos(var Actions: TActions; Me: PGear); |
60 var Time: Longword; |
60 var Time: Longword; |
61 Angle, Power, Score: integer; |
61 Angle, Power, Score, ExplX, ExplY, ExplR: integer; |
62 i: integer; |
62 i: integer; |
63 a, aa: TAmmoType; |
63 a, aa: TAmmoType; |
64 begin |
64 begin |
65 for i:= 0 to Pred(Targets.Count) do |
65 for i:= 0 to Pred(Targets.Count) do |
66 if Targets.ar[i].Score >= 0 then |
66 if Targets.ar[i].Score >= 0 then |
71 else a:= Low(TAmmoType); |
71 else a:= Low(TAmmoType); |
72 aa:= a; |
72 aa:= a; |
73 repeat |
73 repeat |
74 if Assigned(AmmoTests[a]) then |
74 if Assigned(AmmoTests[a]) then |
75 begin |
75 begin |
76 Score:= AmmoTests[a](Me, Targets.ar[i].Point, Time, Angle, Power); |
76 Score:= AmmoTests[a](Me, Targets.ar[i].Point, Time, Angle, Power, ExplX, ExplY, ExplR); |
77 if Actions.Score + Score + Targets.ar[i].Score > BestActions.Score then |
77 if Actions.Score + Score + Targets.ar[i].Score > BestActions.Score then |
78 begin |
78 begin |
79 BestActions:= Actions; |
79 BestActions:= Actions; |
80 inc(BestActions.Score, Score + Targets.ar[i].Score); |
80 inc(BestActions.Score, Score + Targets.ar[i].Score); |
81 AddAction(BestActions, aia_Weapon, Longword(a), 500); |
81 AddAction(BestActions, aia_Weapon, Longword(a), 500); |
92 AddAction(BestActions, aia_Down, aim_push, 500); |
92 AddAction(BestActions, aia_Down, aim_push, 500); |
93 AddAction(BestActions, aia_Down, aim_release, -Angle) |
93 AddAction(BestActions, aia_Down, aim_release, -Angle) |
94 end; |
94 end; |
95 AddAction(BestActions, aia_attack, aim_push, 800); |
95 AddAction(BestActions, aia_attack, aim_push, 800); |
96 AddAction(BestActions, aia_attack, aim_release, Power); |
96 AddAction(BestActions, aia_attack, aim_release, Power); |
|
97 if ExplR > 0 then |
|
98 AddAction(BestActions, aia_AwareExpl, ExplR, 10, ExplX, ExplY); |
97 end |
99 end |
98 end; |
100 end; |
99 if a = High(TAmmoType) then a:= Low(TAmmoType) |
101 if a = High(TAmmoType) then a:= Low(TAmmoType) |
100 else inc(a) |
102 else inc(a) |
101 until (a = aa) or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].AttacksNum > 0) |
103 until (a = aa) or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].AttacksNum > 0) |