hedgewars/uAIAmmoTests.pas
changeset 1292 a63a13eda583
parent 1263 24677a82531d
child 1293 5943efa67299
equal deleted inserted replaced
1291:1332d0a8f871 1292:a63a13eda583
   359 begin
   359 begin
   360 ap.ExplR:= 0;
   360 ap.ExplR:= 0;
   361 ap.Time:= 0;
   361 ap.Time:= 0;
   362 ap.Power:= 1;
   362 ap.Power:= 1;
   363 ap.Angle:= 0;
   363 ap.Angle:= 0;
   364 if (Abs(hwRound(Me^.X) - Targ.X) > 25) or (Abs(hwRound(Me^.Y) - 50 - Targ.Y) > 50) then
   364 if (Abs(hwRound(Me^.X) - Targ.X) > 25)
   365    exit(BadTurn);
   365 or (Abs(hwRound(Me^.Y) - 50 - Targ.Y) > 50) then
       
   366 	begin
       
   367 	if TestColl(hwRound(Me^.Y), hwRound(Me^.Y) - 16, 6) then
       
   368 		Result:= 1
       
   369 	else
       
   370 		Result:= BadTurn;
       
   371 	exit(Result)
       
   372 	end;
   366 
   373 
   367 Result:= 0;
   374 Result:= 0;
   368 for i:= 0 to 4 do
   375 for i:= 0 to 4 do
   369     Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X),
   376 	Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X),
   370                                     hwRound(Me^.Y) - 20 * i - 5, 10, 30);
   377                                     hwRound(Me^.Y) - 20 * i - 5, 10, 30);
   371 if Result <= 0 then Result:= BadTurn else inc(Result);
   378 if Result <= 0 then
       
   379 	Result:= BadTurn
       
   380 else
       
   381 	inc(Result);
       
   382 
   372 TestFirePunch:= Result
   383 TestFirePunch:= Result
   373 end;
   384 end;
   374 
   385 
   375 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   386 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   376 const cShift = 4;
   387 const cShift = 4;