hedgewars/uAIAmmoTests.pas
changeset 7210 2ff30b79d2b0
parent 7208 62e36dc45098
child 7212 ab60dbe8fd0c
equal deleted inserted replaced
7208:62e36dc45098 7210:2ff30b79d2b0
   724 
   724 
   725     v1:= 0;
   725     v1:= 0;
   726     for i:= 0 to 8 do
   726     for i:= 0 to 8 do
   727         begin
   727         begin
   728         v1:= v1 + RateShove(Me, x - 10, y - 10 * i
   728         v1:= v1 + RateShove(Me, x - 10, y - 10 * i
   729                 , 15, 30, 40
   729                 , 18, 30, 40
   730                 , -0.45, -0.9, afTrackFall or afSetSkip);
   730                 , -0.45, -0.9, afTrackFall or afSetSkip);
   731         end;
   731         end;
   732     v1:= v1 + RateShove(Me, x - 10, y - 90
   732     v1:= v1 + RateShove(Me, x - 10, y - 90
   733             , 15, 30, 40
   733             , 18, 30, 40
   734             , -0.45, -0.9, afTrackFall);
   734             , -0.45, -0.9, afTrackFall);
   735 
   735 
   736 
   736 
   737     // now try opposite direction
   737     // now try opposite direction
   738     v2:= 0;
   738     v2:= 0;
   739     for i:= 0 to 8 do
   739     for i:= 0 to 8 do
   740         begin
   740         begin
   741         v2:= v2 + RateShove(Me, x + 10, y - 10 * i
   741         v2:= v2 + RateShove(Me, x + 10, y - 10 * i
   742                 , 15, 30, 40
   742                 , 18, 30, 40
   743                 , 0.45, -0.9, afTrackFall or afSetSkip);
   743                 , 0.45, -0.9, afTrackFall or afSetSkip);
   744         end;
   744         end;
   745     v2:= v2 + RateShove(Me, x + 10, y - 90
   745     v2:= v2 + RateShove(Me, x + 10, y - 90
   746             , 15, 30, 40
   746             , 18, 30, 40
   747             , 0.45, -0.9, afTrackFall);
   747             , 0.45, -0.9, afTrackFall);
   748 
   748 
   749     if (v2 > v1) 
   749     if (v2 > v1) 
   750         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   750         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   751         begin
   751         begin
   779     // check left direction
   779     // check left direction
   780     {first RateShove checks farthermost of two whip's AmmoShove attacks 
   780     {first RateShove checks farthermost of two whip's AmmoShove attacks 
   781     to encourage distant attacks (damaged hog is excluded from view of second 
   781     to encourage distant attacks (damaged hog is excluded from view of second 
   782     RateShove call)}
   782     RateShove call)}
   783     v1:= RateShove(Me, x - 15, y
   783     v1:= RateShove(Me, x - 15, y
   784             , 30, 30, 40
   784             , 30, 30, 25
   785             , -1, -0.8, afTrackFall or afSetSkip);
   785             , -1, -0.8, afTrackFall or afSetSkip);
   786     v1:= v1 +
   786     v1:= v1 +
   787         RateShove(Me, x, y
   787         RateShove(Me, x, y
   788             , 30, 30, 40
   788             , 30, 30, 25
   789             , -1, -0.8, afTrackFall);
   789             , -1, -0.8, afTrackFall);
   790     // now try opposite direction
   790     // now try opposite direction
   791     v2:= RateShove(Me, x + 15, y
   791     v2:= RateShove(Me, x + 15, y
   792             , 30, 30, 40
   792             , 30, 30, 25
   793             , 1, -0.8, afTrackFall or afSetSkip);
   793             , 1, -0.8, afTrackFall or afSetSkip);
   794     v2:= v2 +
   794     v2:= v2 +
   795         RateShove(Me, x, y
   795         RateShove(Me, x, y
   796             , 30, 30, 40
   796             , 30, 30, 25
   797             , 1, -0.8, afTrackFall);
   797             , 1, -0.8, afTrackFall);
   798 
   798 
   799     if (v2 > v1) 
   799     if (v2 > v1) 
   800         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   800         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
   801         begin
   801         begin