222 dX:= dX + windSpeed; |
226 dX:= dX + windSpeed; |
223 dY:= dY + cGravityf; |
227 dY:= dY + cGravityf; |
224 dec(t) |
228 dec(t) |
225 until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
229 until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
226 ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (y > cWaterLine); |
230 ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (y > cWaterLine); |
227 |
231 |
|
232 if TestCollWithLand(trunc(x), trunc(y), 5) and (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) > 21) then |
|
233 begin |
|
234 timer := 500; |
|
235 t2 := 0.5 / sqrt(sqr(dX) + sqr(dY)); |
|
236 dX := dX * t2; |
|
237 dY := dY * t2; |
|
238 repeat |
|
239 x:= x + dX; |
|
240 y:= y + dY; |
|
241 dec(timer); |
|
242 until (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 22) |
|
243 or (x < 0) |
|
244 or (y < 0) |
|
245 or (trunc(x) > LAND_WIDTH) |
|
246 or (trunc(y) > LAND_HEIGHT) |
|
247 or not TestCollWithLand(trunc(x), trunc(y), 5) |
|
248 or (timer = 0) |
|
249 end; |
228 EX:= trunc(x); |
250 EX:= trunc(x); |
229 EY:= trunc(y); |
251 EY:= trunc(y); |
230 if Level = 1 then |
252 if Level = 1 then |
231 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
253 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
232 else value:= RateExplosion(Me, EX, EY, 101); |
254 else value:= RateExplosion(Me, EX, EY, 101); |
233 if value = 0 then |
|
234 value:= 1024 - Metric(Targ.X, Targ.Y, EX, EY) div 64; |
|
235 if valueResult <= value then |
255 if valueResult <= value then |
236 begin |
256 begin |
237 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
257 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
238 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
258 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
239 ap.ExplR:= 100; |
259 ap.ExplR:= 100; |
240 ap.ExplX:= EX; |
260 ap.ExplX:= EX; |
241 ap.ExplY:= EY; |
261 ap.ExplY:= EY; |
242 valueResult:= value |
262 valueResult:= value-2500 // trying to make it slightly less attractive than a bazooka, to prevent waste. AI could use awareness of weapon count |
243 end; |
263 end; |
244 end |
264 end |
245 until rTime > 4250; |
265 until rTime > 4250; |
246 TestDrillRocket:= valueResult |
266 TestDrillRocket:= valueResult |
247 end; |
267 end; |