hedgewars/uAIAmmoTests.pas
branchwebgl
changeset 9160 fc46e75f6b72
parent 9136 78f087fd3e5b
parent 9145 6b51a32e48ed
child 9521 8054d9d775fd
equal deleted inserted replaced
9136:78f087fd3e5b 9160:fc46e75f6b72
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uAIAmmoTests;
    21 unit uAIAmmoTests;
    22 interface
    22 interface
    23 uses SDLh, uConsts, uFloat, uTypes, uAIMisc;
    23 uses uConsts, uFloat, uTypes, uAIMisc;
    24 const
    24 const
    25     amtest_Rare     = $00000001; // check only several positions
    25     amtest_Rare     = $00000001; // check only several positions
    26     amtest_NoTarget = $00000002; // each pos, but no targetting
    26     amtest_NoTarget = $00000002; // each pos, but no targetting
    27 
    27 
    28 var windSpeed: real;
    28 var windSpeed: real;
   328 end;
   328 end;
   329 
   329 
   330 function TestMolotov(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   330 function TestMolotov(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   331 var Vx, Vy, r: real;
   331 var Vx, Vy, r: real;
   332     Score, EX, EY, valueResult: LongInt;
   332     Score, EX, EY, valueResult: LongInt;
   333     TestTime: Longword;
   333     TestTime: LongInt;
   334     x, y, dY, meX, meY: real;
   334     x, y, dY, meX, meY: real;
   335     t: LongInt;
   335     t: LongInt;
   336 begin
   336 begin
   337 meX:= hwFloat2Float(Me^.X);
   337 meX:= hwFloat2Float(Me^.X);
   338 meY:= hwFloat2Float(Me^.Y);
   338 meY:= hwFloat2Float(Me^.Y);
   380 
   380 
   381 function TestGrenade(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   381 function TestGrenade(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt;
   382 const tDelta = 24;
   382 const tDelta = 24;
   383 var Vx, Vy, r: real;
   383 var Vx, Vy, r: real;
   384     Score, EX, EY, valueResult: LongInt;
   384     Score, EX, EY, valueResult: LongInt;
   385     TestTime: Longword;
   385     TestTime: LongInt;
   386     x, y, meX, meY, dY: real;
   386     x, y, meX, meY, dY: real;
   387     t: LongInt;
   387     t: LongInt;
   388 begin
   388 begin
   389 valueResult:= BadTurn;
   389 valueResult:= BadTurn;
   390 TestTime:= 0;
   390 TestTime:= 0;
   679 end;
   679 end;
   680 
   680 
   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) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) 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;
   722 
   722 
   723 
   723 
   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) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) 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;