hedgewars/uAIAmmoTests.pas
changeset 4374 bcefeeabaa33
parent 4367 f4a0ec067601
child 4578 f3cf226fad16
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
   106             );
   106             );
   107 
   107 
   108 const BadTurn = Low(LongInt) div 4;
   108 const BadTurn = Low(LongInt) div 4;
   109 
   109 
   110 implementation
   110 implementation
   111 uses uMisc, uAIMisc, uVariables;
   111 uses uAIMisc, uVariables, uUtils;
   112 
   112 
   113 function Metric(x1, y1, x2, y2: LongInt): LongInt;
   113 function Metric(x1, y1, x2, y2: LongInt): LongInt;
   114 begin
   114 begin
   115 Metric:= abs(x1 - x2) + abs(y1 - y2)
   115 Metric:= abs(x1 - x2) + abs(y1 - y2)
   116 end;
   116 end;
   537     or (y.isNegative)
   537     or (y.isNegative)
   538     or (x.Round > LongWord(LAND_WIDTH))
   538     or (x.Round > LongWord(LAND_WIDTH))
   539     or (y.Round > LongWord(LAND_HEIGHT))
   539     or (y.Round > LongWord(LAND_HEIGHT))
   540     or (d > 200);
   540     or (d > 200);
   541 
   541 
   542 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= max(0, (4 - d div 50) * 7 * 1024)
   542 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
   543                                                            else valueResult:= BadTurn;
   543                                                            else valueResult:= BadTurn;
   544 TestDesertEagle:= valueResult
   544 TestDesertEagle:= valueResult
   545 end;
   545 end;
   546 
   546 
   547 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   547 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;