hedgewars/uAIAmmoTests.pas
changeset 3370 37f4f83fedb1
parent 3350 5cd02aafc612
child 3371 da73f471798f
equal deleted inserted replaced
3369:c7289e42f0ee 3370:37f4f83fedb1
    39 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    39 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    40 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    40 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    41 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    41 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    42 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    42 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    43 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    43 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
       
    44 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    44 
    45 
    45 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    46 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
    46     TAmmoTest = record
    47     TAmmoTest = record
    47             proc: TAmmoTestProc;
    48             proc: TAmmoTestProc;
    48             flags: Longword;
    49             flags: Longword;
    68             (proc: nil;              flags: 0), // amParachute
    69             (proc: nil;              flags: 0), // amParachute
    69             (proc: @TestAirAttack;   flags: amtest_OnTurn), // amAirAttack
    70             (proc: @TestAirAttack;   flags: amtest_OnTurn), // amAirAttack
    70             (proc: nil;              flags: 0), // amMineStrike
    71             (proc: nil;              flags: 0), // amMineStrike
    71             (proc: nil;              flags: 0), // amBlowTorch
    72             (proc: nil;              flags: 0), // amBlowTorch
    72             (proc: nil;              flags: 0), // amGirder
    73             (proc: nil;              flags: 0), // amGirder
    73             (proc: nil;              flags: amtest_OnTurn), // amTeleport
    74             (proc: @TestTeleport;    flags: amtest_OnTurn), // amTeleport
    74             (proc: nil;              flags: 0), // amSwitch
    75             (proc: nil;              flags: 0), // amSwitch
    75             (proc: @TestMortar;      flags: 0), // amMortar
    76             (proc: @TestMortar;      flags: 0), // amMortar
    76             (proc: nil;              flags: 0), // amKamikaze
    77             (proc: nil;              flags: 0), // amKamikaze
    77             (proc: nil;              flags: 0), // amCake
    78             (proc: nil;              flags: 0), // amCake
    78             (proc: nil;              flags: 0), // amSeduction
    79             (proc: nil;              flags: 0), // amSeduction
   633 
   634 
   634 if valueResult <= 0 then valueResult:= BadTurn;
   635 if valueResult <= 0 then valueResult:= BadTurn;
   635 TestAirAttack:= valueResult;
   636 TestAirAttack:= valueResult;
   636 end;
   637 end;
   637 
   638 
       
   639 
       
   640 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
       
   641 var
       
   642   i: longword;
       
   643 begin
       
   644   FillBonuses(true, [gtCase]);
       
   645   if bonuses.Count = 0 then
       
   646     TestTeleport := BadTurn
       
   647   else begin
       
   648 	i := random(bonuses.Count);
       
   649 	ap.AttackPutX := bonuses.ar[i].X;
       
   650 	ap.AttackPutY := bonuses.ar[i].Y - 50;
       
   651 	TestTeleport := 0;
       
   652   end;
       
   653 end;
       
   654 
   638 end.
   655 end.