hedgewars/uAIAmmoTests.pas
changeset 7134 beb16926ae5c
parent 7132 baf3351646f4
child 7154 56e329edf4b8
equal deleted inserted replaced
7132:baf3351646f4 7134:beb16926ae5c
   661 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   661 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   662 var val1: LongInt;
   662 var val1: LongInt;
   663     x, y: real;
   663     x, y: real;
   664 begin
   664 begin
   665 Level:= Level; // avoid compiler hint
   665 Level:= Level; // avoid compiler hint
       
   666 TestFirePunch:= BadTurn;
   666 ap.ExplR:= 0;
   667 ap.ExplR:= 0;
   667 ap.Time:= 0;
   668 ap.Time:= 0;
   668 ap.Power:= 1;
   669 ap.Power:= 1;
   669 ap.Angle:= hwSign(Me^.dX);
   670 ap.Angle:= hwSign(Me^.dX);
   670 x:= hwFloat2Float(Me^.X);
   671 x:= hwFloat2Float(Me^.X);
   671 y:= hwFloat2Float(Me^.Y);
   672 y:= hwFloat2Float(Me^.Y);
   672 if (Abs(trunc(x) - Targ.X) > 25)
   673 if (Abs(trunc(x) - Targ.X) < 25)
   673 or (Abs(trunc(y) - 50 - Targ.Y) > 50) then
   674     and (Abs(trunc(y) - 50 - Targ.Y) < 50) then
   674     begin
   675     begin
   675 // TODO - find out WTH this works.
   676 // TODO - find out WTH this works.
   676     if TestColl(trunc(x), trunc(y) - 16, 6) and 
   677     if TestColl(trunc(x), trunc(y) - 16, 6) and 
   677        (RateShove(Me, trunc(x) + LongWord(10 * hwSign(Me^.dX)), 
   678        (RateShove(Me, trunc(x) + LongWord(10 * hwSign(Me^.dX)), 
   678                       trunc(y) - 40, 30, 30, 40, hwSign(Me^.dX)*0.45, -0.9,  1) = 0) then
   679                       trunc(y) - 40, 30, 30, 40, hwSign(Me^.dX)*0.45, -0.9,  1) = 0) then