hedgewars/uAIAmmoTests.pas
changeset 6774 237b96f06aae
parent 6772 13d13aefa4de
child 6775 22b5fb7217db
equal deleted inserted replaced
6773:46cd5dad1a28 6774:237b96f06aae
   574 ap.ExplR:= 0;
   574 ap.ExplR:= 0;
   575 ap.Time:= 0;
   575 ap.Time:= 0;
   576 ap.Power:= 1;
   576 ap.Power:= 1;
   577 x:= Me^.X;
   577 x:= Me^.X;
   578 y:= Me^.Y;
   578 y:= Me^.Y;
   579 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then
   579 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 320 then
   580    exit(BadTurn);
   580    exit(BadTurn);
   581 t:= _0_5 / Distance(int2hwFloat(Targ.X) - x, int2hwFloat(Targ.Y) - y);
   581 t:= _0_5 / Distance(int2hwFloat(Targ.X) - x, int2hwFloat(Targ.Y) - y);
   582 Vx:= (int2hwFloat(Targ.X) - x) * t;
   582 Vx:= (int2hwFloat(Targ.X) - x) * t;
   583 Vy:= (int2hwFloat(Targ.Y) - y) * t;
   583 Vy:= (int2hwFloat(Targ.Y) - y) * t;
   584 ap.Angle:= DxDy2AttackAngle(Vx, -Vy);
   584 ap.Angle:= DxDy2AttackAngle(Vx, -Vy);
   596     or (x.Round > LongWord(LAND_WIDTH))
   596     or (x.Round > LongWord(LAND_WIDTH))
   597     or (y.Round > LongWord(LAND_HEIGHT))
   597     or (y.Round > LongWord(LAND_HEIGHT))
   598     or (d > 200);
   598     or (d > 200);
   599 
   599 
   600 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then
   600 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then
   601     valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
   601     begin
       
   602     if TraceShoveDrown(Me, Targ.X, Targ.Y, hwFloat2Float(vX) * 0.005 * 20, hwFloat2Float(vY) * 0.005 * 20) then
       
   603         valueResult:= 204800
       
   604     else valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
       
   605     end
   602 else
   606 else
   603     valueResult:= BadTurn;
   607     valueResult:= BadTurn;
   604 TestDesertEagle:= valueResult
   608 TestDesertEagle:= valueResult
   605 end;
   609 end;
   606 
   610