140 begin |
140 begin |
141 BestActions:= Actions; |
141 BestActions:= Actions; |
142 inc(BestActions.Score, Score); |
142 inc(BestActions.Score, Score); |
143 BestActions.isWalkingToABetterPlace:= false; |
143 BestActions.isWalkingToABetterPlace:= false; |
144 |
144 |
145 if (ap.Angle > 0) then |
145 AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0); |
146 AddAction(BestActions, aia_LookRight, 0, 200, 0, 0) |
146 |
147 else if (ap.Angle < 0) then |
147 if (ap.Angle > 0) then |
148 AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0); |
148 AddAction(BestActions, aia_LookRight, 0, 200, 0, 0) |
149 |
149 else if (ap.Angle < 0) then |
150 AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0); |
150 AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0); |
151 |
151 |
152 if (ap.Time <> 0) then |
152 if (ap.Time <> 0) then |
153 AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0); |
153 AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0); |
154 if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then |
154 if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then |
155 begin |
|
156 ap.Angle:= LongInt(Me^.Angle) - Abs(ap.Angle); |
|
157 if ap.Angle > 0 then |
|
158 begin |
155 begin |
159 AddAction(BestActions, aia_Up, aim_push, 300 + random(250), 0, 0); |
156 ap.Angle:= LongInt(Me^.Angle) - Abs(ap.Angle); |
160 AddAction(BestActions, aia_Up, aim_release, ap.Angle, 0, 0) |
157 if ap.Angle > 0 then |
161 end |
158 begin |
162 else if ap.Angle < 0 then |
159 AddAction(BestActions, aia_Up, aim_push, 300 + random(250), 0, 0); |
|
160 AddAction(BestActions, aia_Up, aim_release, ap.Angle, 0, 0) |
|
161 end |
|
162 else if ap.Angle < 0 then |
|
163 begin |
|
164 AddAction(BestActions, aia_Down, aim_push, 300 + random(250), 0, 0); |
|
165 AddAction(BestActions, aia_Down, aim_release, -ap.Angle, 0, 0) |
|
166 end |
|
167 end; |
|
168 if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
163 begin |
169 begin |
164 AddAction(BestActions, aia_Down, aim_push, 300 + random(250), 0, 0); |
170 AddAction(BestActions, aia_Put, 0, 1, ap.AttackPutX, ap.AttackPutY) |
165 AddAction(BestActions, aia_Down, aim_release, -ap.Angle, 0, 0) |
171 end; |
166 end |
172 if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then |
167 end; |
173 begin |
168 if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
174 AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0); |
169 begin |
175 AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0); |
170 AddAction(BestActions, aia_Put, 0, 1, ap.AttackPutX, ap.AttackPutY) |
176 end; |
171 end; |
177 if ap.ExplR > 0 then |
172 if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then |
178 AddAction(BestActions, aia_AwareExpl, ap.ExplR, 10, ap.ExplX, ap.ExplY); |
173 begin |
179 end |
174 AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0); |
|
175 AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0); |
|
176 end; |
|
177 if ap.ExplR > 0 then |
|
178 AddAction(BestActions, aia_AwareExpl, ap.ExplR, 10, ap.ExplX, ap.ExplY); |
|
179 end |
|
180 end; |
180 end; |
181 if a = High(TAmmoType) then |
181 if a = High(TAmmoType) then |
182 a:= Low(TAmmoType) |
182 a:= Low(TAmmoType) |
183 else inc(a) |
183 else inc(a) |
184 until (a = aa) or (CurrentHedgehog^.MultiShootAttacks > 0) or // shooting same weapon |
184 until (a = aa) or (CurrentHedgehog^.MultiShootAttacks > 0) or // shooting same weapon |
219 |
215 |
220 BestRate:= RatePlace(Me); |
216 BestRate:= RatePlace(Me); |
221 BaseRate:= Max(BestRate, 0); |
217 BaseRate:= Max(BestRate, 0); |
222 |
218 |
223 if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
219 if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
224 AddAction(Actions, aia_Weapon, Longword(amNothing), 100 + random(200), 0, 0); |
220 AddAction(Actions, aia_Weapon, Longword(amSkip), 100 + random(200), 0, 0); |
225 |
221 |
|
222 tmp:= random(2) + 1; |
|
223 Push(0, Actions, Me^, tmp); |
|
224 Push(0, Actions, Me^, tmp xor 3); |
|
225 |
226 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do |
226 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do |
227 begin |
227 begin |
228 Pop(ticks, Actions, Me^); |
228 Pop(ticks, Actions, Me^); |
229 |
229 |
230 AddAction(Actions, Me^.Message, aim_push, 250, 0, 0); |
230 AddAction(Actions, Me^.Message, aim_push, 250, 0, 0); |