equal
deleted
inserted
replaced
164 else value:= RateExplosion(Me, EX, EY, 101); |
164 else value:= RateExplosion(Me, EX, EY, 101); |
165 if value = 0 then |
165 if value = 0 then |
166 value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; |
166 value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; |
167 if valueResult <= value then |
167 if valueResult <= value then |
168 begin |
168 begin |
169 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
169 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
170 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
170 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
171 ap.ExplR:= 100; |
171 ap.ExplR:= 100; |
172 ap.ExplX:= EX; |
172 ap.ExplX:= EX; |
173 ap.ExplY:= EY; |
173 ap.ExplY:= EY; |
174 valueResult:= value |
174 valueResult:= value |
221 if value = 0 then |
221 if value = 0 then |
222 value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; |
222 value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; |
223 |
223 |
224 if valueResult <= value then |
224 if valueResult <= value then |
225 begin |
225 begin |
226 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
226 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
227 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
227 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
228 ap.ExplR:= 0; |
228 ap.ExplR:= 0; |
229 ap.ExplX:= EX; |
229 ap.ExplX:= EX; |
230 ap.ExplY:= EY; |
230 ap.ExplY:= EY; |
231 valueResult:= value |
231 valueResult:= value |
271 else |
271 else |
272 Score:= BadTurn; |
272 Score:= BadTurn; |
273 |
273 |
274 if valueResult < Score then |
274 if valueResult < Score then |
275 begin |
275 begin |
276 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); |
276 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
277 ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
277 ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
278 ap.Time:= TestTime; |
278 ap.Time:= TestTime; |
279 ap.ExplR:= 100; |
279 ap.ExplR:= 100; |
280 ap.ExplX:= EX; |
280 ap.ExplX:= EX; |
281 ap.ExplY:= EY; |
281 ap.ExplY:= EY; |
325 else |
325 else |
326 Score:= BadTurn; |
326 Score:= BadTurn; |
327 |
327 |
328 if valueResult < Score then |
328 if valueResult < Score then |
329 begin |
329 begin |
330 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); |
330 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
331 ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
331 ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
332 ap.Time:= TestTime; |
332 ap.Time:= TestTime; |
333 ap.ExplR:= 100; |
333 ap.ExplR:= 100; |
334 ap.ExplX:= EX; |
334 ap.ExplX:= EX; |
335 ap.ExplY:= EY; |
335 ap.ExplY:= EY; |
382 else |
382 else |
383 Score:= BadTurn; |
383 Score:= BadTurn; |
384 |
384 |
385 if valueResult < Score then |
385 if valueResult < Score then |
386 begin |
386 begin |
387 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); |
387 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
388 ap.Power:= trunc(sqrt(r) * cMaxPower * 0.9) + AIrndSign(random(Level) * 15); |
388 ap.Power:= trunc(sqrt(r) * cMaxPower * 0.9) + AIrndSign(random(Level) * 15); |
389 ap.Time:= TestTime; |
389 ap.Time:= TestTime; |
390 ap.ExplR:= 90; |
390 ap.ExplR:= 90; |
391 ap.ExplX:= EX; |
391 ap.ExplX:= EX; |
392 ap.ExplY:= EY; |
392 ap.ExplY:= EY; |
434 else |
434 else |
435 Score:= BadTurn; |
435 Score:= BadTurn; |
436 |
436 |
437 if valueResult < Score then |
437 if valueResult < Score then |
438 begin |
438 begin |
439 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); |
439 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
440 ap.Power:= trunc(sqrt(r) * cMaxPower * 0.9) + AIrndSign(random(Level) * 15); |
440 ap.Power:= trunc(sqrt(r) * cMaxPower * 0.9) + AIrndSign(random(Level) * 15); |
441 ap.Time:= TestTime; |
441 ap.Time:= TestTime; |
442 ap.ExplR:= 300; |
442 ap.ExplR:= 300; |
443 ap.ExplX:= EX; |
443 ap.ExplX:= EX; |
444 ap.ExplY:= EY; |
444 ap.ExplY:= EY; |
520 else |
520 else |
521 Score:= BadTurn; |
521 Score:= BadTurn; |
522 |
522 |
523 if valueResult < Score then |
523 if valueResult < Score then |
524 begin |
524 begin |
525 ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); |
525 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
526 ap.Power:= 1; |
526 ap.Power:= 1; |
527 ap.ExplR:= 100; |
527 ap.ExplR:= 100; |
528 ap.ExplX:= EX; |
528 ap.ExplX:= EX; |
529 ap.ExplY:= EY; |
529 ap.ExplY:= EY; |
530 valueResult:= Score |
530 valueResult:= Score |
549 range:= Metric(trunc(x), trunc(y), Targ.X, Targ.Y); |
549 range:= Metric(trunc(x), trunc(y), Targ.X, Targ.Y); |
550 if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then |
550 if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then |
551 exit(BadTurn); |
551 exit(BadTurn); |
552 Vx:= (Targ.X - x) * 1 / 1024; |
552 Vx:= (Targ.X - x) * 1 / 1024; |
553 Vy:= (Targ.Y - y) * 1 / 1024; |
553 Vy:= (Targ.Y - y) * 1 / 1024; |
554 ap.Angle:= DxDy2AttackAngle(Vx, -Vy); |
554 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); |
555 repeat |
555 repeat |
556 x:= x + vX; |
556 x:= x + vX; |
557 y:= y + vY; |
557 y:= y + vY; |
558 rx:= trunc(x); |
558 rx:= trunc(x); |
559 ry:= trunc(y); |
559 ry:= trunc(y); |
593 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then |
593 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then |
594 exit(BadTurn); |
594 exit(BadTurn); |
595 t:= 0.5 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y)); |
595 t:= 0.5 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y)); |
596 Vx:= (Targ.X - x) * t; |
596 Vx:= (Targ.X - x) * t; |
597 Vy:= (Targ.Y - y) * t; |
597 Vy:= (Targ.Y - y) * t; |
598 ap.Angle:= DxDy2AttackAngle(Vx, -Vy); |
598 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); |
599 d:= 0; |
599 d:= 0; |
600 |
600 |
601 repeat |
601 repeat |
602 x:= x + vX; |
602 x:= x + vX; |
603 y:= y + vY; |
603 y:= y + vY; |