hedgewars/uAIAmmoTests.pas
changeset 7427 48f9d53c844a
parent 7424 fe0f07667f24
child 7433 c7fff3e61d49
equal deleted inserted replaced
7424:fe0f07667f24 7427:48f9d53c844a
   715     while a >= 0 do
   715     while a >= 0 do
   716         begin
   716         begin
   717         dx:= sin(a / cMaxAngle * pi) * 0.5;
   717         dx:= sin(a / cMaxAngle * pi) * 0.5;
   718         dy:= cos(a / cMaxAngle * pi) * 0.5;
   718         dy:= cos(a / cMaxAngle * pi) * 0.5;
   719 
   719 
   720         v1:= RateShove(Me, x - 10, y
   720         v1:= RateShove(Me, x - 10, y + 2
   721                 , 33, 30, 115
   721                 , 32, 30, 115
   722                 , -dx, -dy, trackFall);
   722                 , -dx, -dy, trackFall);
   723         v2:= RateShove(Me, x + 10, y
   723         v2:= RateShove(Me, x + 10, y + 2
   724                 , 33, 30, 115
   724                 , 32, 30, 115
   725                 , dx, -dy, trackFall);
   725                 , dx, -dy, trackFall);
   726         if (v1 > valueResult) or (v2 > valueResult) then
   726         if (v1 > valueResult) or (v2 > valueResult) then
   727             if (v2 > v1) 
   727             if (v2 > v1) 
   728                 or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   728                 or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   729                 begin
   729                 begin
   754     Level:= Level; // avoid compiler hint
   754     Level:= Level; // avoid compiler hint
   755     ap.ExplR:= 0;
   755     ap.ExplR:= 0;
   756     ap.Time:= 0;
   756     ap.Time:= 0;
   757     ap.Power:= 1;
   757     ap.Power:= 1;
   758     x:= hwRound(Me^.X);
   758     x:= hwRound(Me^.X);
   759     y:= hwRound(Me^.Y);
   759     y:= hwRound(Me^.Y) + 4;
   760 
   760 
   761     v1:= 0;
   761     v1:= 0;
   762     for i:= 0 to 8 do
   762     for i:= 0 to 8 do
   763         begin
   763         begin
   764         v1:= v1 + RateShove(Me, x - 10, y - 10 * i
   764         v1:= v1 + RateShove(Me, x - 5, y - 10 * i
   765                 , 18, 30, 40
   765                 , 19, 30, 40
   766                 , -0.45, -0.9, trackFall or afSetSkip);
   766                 , -0.45, -0.9, trackFall or afSetSkip);
   767         end;
   767         end;
   768     v1:= v1 + RateShove(Me, x - 10, y - 90
   768     v1:= v1 + RateShove(Me, x - 5, y - 90
   769             , 18, 30, 40
   769             , 19, 30, 40
   770             , -0.45, -0.9, trackFall);
   770             , -0.45, -0.9, trackFall);
   771 
   771 
   772 
   772 
   773     // now try opposite direction
   773     // now try opposite direction
   774     v2:= 0;
   774     v2:= 0;
   775     for i:= 0 to 8 do
   775     for i:= 0 to 8 do
   776         begin
   776         begin
   777         v2:= v2 + RateShove(Me, x + 10, y - 10 * i
   777         v2:= v2 + RateShove(Me, x + 5, y - 10 * i
   778                 , 18, 30, 40
   778                 , 19, 30, 40
   779                 , 0.45, -0.9, trackFall or afSetSkip);
   779                 , 0.45, -0.9, trackFall or afSetSkip);
   780         end;
   780         end;
   781     v2:= v2 + RateShove(Me, x + 10, y - 90
   781     v2:= v2 + RateShove(Me, x + 5, y - 90
   782             , 18, 30, 40
   782             , 19, 30, 40
   783             , 0.45, -0.9, trackFall);
   783             , 0.45, -0.9, trackFall);
   784 
   784 
   785     if (v2 > v1) 
   785     if (v2 > v1) 
   786         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   786         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   787         begin
   787         begin