hedgewars/uAIMisc.pas
changeset 14233 ca179b615c0b
parent 13668 2b194214732d
child 14234 09dacb61d526
--- a/hedgewars/uAIMisc.pas	Wed Nov 14 16:58:22 2018 +0100
+++ b/hedgewars/uAIMisc.pas	Thu Nov 15 15:12:18 2018 -0500
@@ -89,7 +89,8 @@
 function  RateHammer(Me: PGear): LongInt;
 
 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
-function  AIrndSign(num: LongInt): LongInt;
+function  AIrndSign(num: LongInt): LongInt; inline;
+function  AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
 
 var ThinkingHH: PGear;
     Targets: TTargets;
@@ -1028,7 +1029,7 @@
 HHJump(AltGear, jmpHJump, GoInfo);
 end;
 
-function AIrndSign(num: LongInt): LongInt;
+function AIrndSign(num: LongInt): LongInt; inline;
 begin
 if random(2) = 0 then
     AIrndSign:=   num
@@ -1036,6 +1037,14 @@
     AIrndSign:= - num
 end;
 
+function AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
+begin
+if Level <> 1 then exit(0);
+// at present level 2 doesn't track falls on most things
+//if Level = 2 then exit(round(targ.Radius*(random(5)-2)/2));
+if Level = 1 then exit(round(targ.Radius*(random(7)-3)/2))
+end;
+
 procedure initModule;
 begin
     friendlyfactor:= 300;