hedgewars/uAIAmmoTests.pas
changeset 11476 c4e1d39acc56
parent 11475 1d478892cf1c
child 12193 71c47122fbc0
equal deleted inserted replaced
11475:1d478892cf1c 11476:c4e1d39acc56
   175         EY:= trunc(y);
   175         EY:= trunc(y);
   176         if Level = 1 then
   176         if Level = 1 then
   177             value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   177             value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   178         else value:= RateExplosion(Me, EX, EY, 101);
   178         else value:= RateExplosion(Me, EX, EY, 101);
   179         if (value = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then
   179         if (value = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then
   180             value:= 1024 - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64;
   180             if GameFlags and gfSolidLand = 0 then
       
   181                  value := 1024 - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64
       
   182             else value := BadTurn;
   181         if valueResult <= value then
   183         if valueResult <= value then
   182             begin
   184             begin
   183             ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
   185             ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
   184             ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1);
   186             ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1);
   185             ap.ExplR:= 100;
   187             ap.ExplR:= 100;
   774         x:= x + vX * 8;
   776         x:= x + vX * 8;
   775         y:= y + vY * 8;
   777         y:= y + vY * 8;
   776         valueResult:= RateShotgun(Me, vX, vY, rx, ry);
   778         valueResult:= RateShotgun(Me, vX, vY, rx, ry);
   777 
   779 
   778         if (valueResult = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then
   780         if (valueResult = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then
   779             valueResult:= 1024 - Metric(Targ.Point.X, Targ.Point.Y, rx, ry) div 64
   781             begin
       
   782             if GameFlags and gfSolidLand = 0 then
       
   783                  valueResult:= 1024 - Metric(Targ.Point.X, Targ.Point.Y, rx, ry) div 64
       
   784             else valueResult := BadTurn
       
   785             end
   780         else
   786         else
   781             dec(valueResult, Level * 4000);
   787             dec(valueResult, Level * 4000);
   782         // 27/20 is reuse bonus
   788         // 27/20 is reuse bonus
   783         exit(valueResult * 27 div 20)
   789         exit(valueResult * 27 div 20)
   784     end
   790     end