hedgewars/uAIAmmoTests.pas
changeset 3372 5d3daec0d0b5
parent 3371 da73f471798f
child 3382 633046fa040c
equal deleted inserted replaced
3371:da73f471798f 3372:5d3daec0d0b5
   640 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   640 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   641 var
   641 var
   642   i, failNum: longword;
   642   i, failNum: longword;
   643 begin
   643 begin
   644   FillBonuses(true, [gtCase]);
   644   FillBonuses(true, [gtCase]);
   645   if bonuses.Count = 0 then
   645   if bonuses.Count = 0 then begin
   646     TestTeleport := BadTurn
   646     if Me^.Health <= 100  then begin
       
   647       ap.AttackPutX := Targ.X;
       
   648       ap.AttackPutY := topY + cHHRadius*2;
       
   649       TestTeleport := Targ.Y - topY;
       
   650     end
       
   651     else
       
   652       TestTeleport := BadTurn;
       
   653   end
   647   else begin
   654   else begin
   648 	failNum := 0;
   655 	failNum := 0;
   649     repeat 
   656     repeat 
   650 		i := random(bonuses.Count);
   657 		i := random(bonuses.Count);
   651 		inc(failNum);
   658 		inc(failNum);