hedgewars/uAIAmmoTests.pas
changeset 8974 d360e97ce842
parent 8971 fcb29a13b1b1
child 8998 d38fb4158342
equal deleted inserted replaced
8973:7bcb77379a4b 8974:d360e97ce842
   474     if t < 50 then
   474     if t < 50 then
   475         Score:= RateExplosion(Me, EX, EY, 41)
   475         Score:= RateExplosion(Me, EX, EY, 41)
   476     else
   476     else
   477         Score:= BadTurn;
   477         Score:= BadTurn;
   478 
   478 
   479      if valueResult < Score then
   479      if Score > 0 then
   480         begin
   480         begin
   481         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 2));
   481         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 2));
   482         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
   482         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
   483         ap.Time:= TestTime div 1000 * 1000;
   483         ap.Time:= TestTime div 1000 * 1000;
   484         ap.ExplR:= 90;
   484         ap.ExplR:= 90;
   681 function TestDesertEagle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   681 function TestDesertEagle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   682 var Vx, Vy, x, y, t: real;
   682 var Vx, Vy, x, y, t: real;
   683     d: Longword;
   683     d: Longword;
   684     fallDmg, valueResult: LongInt;
   684     fallDmg, valueResult: LongInt;
   685 begin
   685 begin
   686 if Level > 4 then exit(BadTurn);
   686 if (Level > 4) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn);
   687 Level:= Level; // avoid compiler hint
   687 Level:= Level; // avoid compiler hint
   688 ap.ExplR:= 1;
   688 ap.ExplR:= 1;
   689 ap.Time:= 0;
   689 ap.Time:= 0;
   690 ap.Power:= 1;
   690 ap.Power:= 1;
   691 
   691 
   724 function TestSniperRifle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   724 function TestSniperRifle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   725 var Vx, Vy, x, y, t, dmg: real;
   725 var Vx, Vy, x, y, t, dmg: real;
   726     d: Longword;
   726     d: Longword;
   727     fallDmg: LongInt;
   727     fallDmg: LongInt;
   728 begin
   728 begin
   729 if Level > 3 then exit(BadTurn);
   729 if (Level > 3) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn);
   730 Level:= Level; // avoid compiler hint
   730 Level:= Level; // avoid compiler hint
   731 ap.ExplR:= 0;
   731 ap.ExplR:= 0;
   732 ap.Time:= 0;
   732 ap.Time:= 0;
   733 ap.Power:= 1;
   733 ap.Power:= 1;
   734 x:= hwFloat2Float(Me^.X);
   734 x:= hwFloat2Float(Me^.X);