106 procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean); |
106 procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean); |
107 var BotLevel: Byte; |
107 var BotLevel: Byte; |
108 ap: TAttackParams; |
108 ap: TAttackParams; |
109 Score, i, t, n, dAngle: LongInt; |
109 Score, i, t, n, dAngle: LongInt; |
110 a, aa: TAmmoType; |
110 a, aa: TAmmoType; |
|
111 useThisActions: boolean; |
111 begin |
112 begin |
112 BotLevel:= Me^.Hedgehog^.BotLevel; |
113 BotLevel:= Me^.Hedgehog^.BotLevel; |
113 windSpeed:= hwFloat2Float(cWindSpeed); |
114 windSpeed:= hwFloat2Float(cWindSpeed); |
|
115 useThisActions:= false; |
114 |
116 |
115 for i:= 0 to Pred(Targets.Count) do |
117 for i:= 0 to Pred(Targets.Count) do |
116 if (Targets.ar[i].Score >= 0) and (not StopThinking) then |
118 if (Targets.ar[i].Score >= 0) and (not StopThinking) then |
117 begin |
119 begin |
118 with Me^.Hedgehog^ do |
120 with Me^.Hedgehog^ do |
126 then |
128 then |
127 begin |
129 begin |
128 {$HINTS OFF} |
130 {$HINTS OFF} |
129 Score:= AmmoTests[a].proc(Me, Targets.ar[i], BotLevel, ap); |
131 Score:= AmmoTests[a].proc(Me, Targets.ar[i], BotLevel, ap); |
130 {$HINTS ON} |
132 {$HINTS ON} |
131 if Actions.Score + Score > BestActions.Score then |
133 if (Score > BadTurn) and (Actions.Score + Score > BestActions.Score) then |
132 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel - 1) * 2048) then |
134 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel - 1) * 2048) then |
133 begin |
135 begin |
134 BestActions:= Actions; |
136 if useThisActions then |
135 inc(BestActions.Score, Score); |
137 begin |
136 BestActions.isWalkingToABetterPlace:= false; |
138 BestActions.Count:= Actions.Count |
|
139 end |
|
140 else |
|
141 begin |
|
142 BestActions:= Actions; |
|
143 BestActions.isWalkingToABetterPlace:= false; |
|
144 useThisActions:= true |
|
145 end; |
|
146 |
|
147 BestActions.Score:= Actions.Score + Score; |
137 |
148 |
138 if HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0 then |
149 if HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0 then |
139 begin |
150 begin |
140 AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0); |
151 AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0); |
141 AddAction(BestActions, aia_attack, aim_push, 10, 0, 0); |
152 AddAction(BestActions, aia_attack, aim_push, 10, 0, 0); |