hedgewars/uAIAmmoTests.pas
changeset 3407 dcc129c4352e
parent 3384 7eb4707d43f0
child 3433 566788d32e52
equal deleted inserted replaced
3406:f4bdebced042 3407:dcc129c4352e
   376 until (TestTime = 4000);
   376 until (TestTime = 4000);
   377 TestWatermelon:= valueResult
   377 TestWatermelon:= valueResult
   378 end;
   378 end;
   379 
   379 
   380 function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   380 function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   381 const tDelta = 24;
   381 //const tDelta = 24;
   382 var Vx, Vy: hwFloat;
   382 var Vx, Vy: hwFloat;
   383     Score, EX, EY, valueResult: LongInt;
   383     Score, EX, EY, valueResult: LongInt;
   384     TestTime: Longword;
   384     TestTime: Longword;
   385 
   385 
   386     function CheckTrace: LongInt;
   386     function CheckTrace: LongInt;
   500 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   500 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   501 var Vx, Vy, x, y, t: hwFloat;
   501 var Vx, Vy, x, y, t: hwFloat;
   502     d: Longword;
   502     d: Longword;
   503     valueResult: LongInt;
   503     valueResult: LongInt;
   504 begin
   504 begin
       
   505 Level:= Level; // avoid compiler hint
   505 ap.ExplR:= 0;
   506 ap.ExplR:= 0;
   506 ap.Time:= 0;
   507 ap.Time:= 0;
   507 ap.Power:= 1;
   508 ap.Power:= 1;
   508 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then
   509 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then
   509    exit(BadTurn);
   510    exit(BadTurn);
   528 end;
   529 end;
   529 
   530 
   530 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   531 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   531 var valueResult: LongInt;
   532 var valueResult: LongInt;
   532 begin
   533 begin
       
   534 Level:= Level; // avoid compiler hint
   533 ap.ExplR:= 0;
   535 ap.ExplR:= 0;
   534 if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then
   536 if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then
   535    exit(BadTurn);
   537    exit(BadTurn);
   536 
   538 
   537 ap.Time:= 0;
   539 ap.Time:= 0;
   544 end;
   546 end;
   545 
   547 
   546 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   548 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   547 var i, valueResult: LongInt;
   549 var i, valueResult: LongInt;
   548 begin
   550 begin
       
   551 Level:= Level; // avoid compiler hint
   549 ap.ExplR:= 0;
   552 ap.ExplR:= 0;
   550 ap.Time:= 0;
   553 ap.Time:= 0;
   551 ap.Power:= 1;
   554 ap.Power:= 1;
   552 ap.Angle:= 0;
   555 ap.Angle:= 0;
   553 if (Abs(hwRound(Me^.X) - Targ.X) > 25)
   556 if (Abs(hwRound(Me^.X) - Targ.X) > 25)
   641 
   644 
   642 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   645 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   643 var
   646 var
   644   i, failNum: longword;
   647   i, failNum: longword;
   645 begin
   648 begin
       
   649   Level:= Level; // avoid compiler hint
   646   FillBonuses(true, [gtCase]);
   650   FillBonuses(true, [gtCase]);
   647   if bonuses.Count = 0 then begin
   651   if bonuses.Count = 0 then begin
   648     if Me^.Health <= 100  then begin
   652     if Me^.Health <= 100  then begin
   649       ap.AttackPutX := Targ.X;
   653       ap.AttackPutX := Targ.X;
   650       ap.AttackPutY := topY + cHHRadius*2;
   654       ap.AttackPutY := topY + cHHRadius*2;