hedgewars/uAIMisc.pas
changeset 14212 ca179b615c0b
parent 13668 2b194214732d
child 14213 09dacb61d526
equal deleted inserted replaced
14211:0f7b92397b9e 14212:ca179b615c0b
    87 function  RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    87 function  RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    88 function  RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    88 function  RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    89 function  RateHammer(Me: PGear): LongInt;
    89 function  RateHammer(Me: PGear): LongInt;
    90 
    90 
    91 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
    91 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
    92 function  AIrndSign(num: LongInt): LongInt;
    92 function  AIrndSign(num: LongInt): LongInt; inline;
       
    93 function  AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
    93 
    94 
    94 var ThinkingHH: PGear;
    95 var ThinkingHH: PGear;
    95     Targets: TTargets;
    96     Targets: TTargets;
    96 
    97 
    97     bonuses: TBonuses;
    98     bonuses: TBonuses;
  1026 until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstMoving) = 0);
  1027 until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstMoving) = 0);
  1027 
  1028 
  1028 HHJump(AltGear, jmpHJump, GoInfo);
  1029 HHJump(AltGear, jmpHJump, GoInfo);
  1029 end;
  1030 end;
  1030 
  1031 
  1031 function AIrndSign(num: LongInt): LongInt;
  1032 function AIrndSign(num: LongInt): LongInt; inline;
  1032 begin
  1033 begin
  1033 if random(2) = 0 then
  1034 if random(2) = 0 then
  1034     AIrndSign:=   num
  1035     AIrndSign:=   num
  1035 else
  1036 else
  1036     AIrndSign:= - num
  1037     AIrndSign:= - num
  1037 end;
  1038 end;
  1038 
  1039 
       
  1040 function AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
       
  1041 begin
       
  1042 if Level <> 1 then exit(0);
       
  1043 // at present level 2 doesn't track falls on most things
       
  1044 //if Level = 2 then exit(round(targ.Radius*(random(5)-2)/2));
       
  1045 if Level = 1 then exit(round(targ.Radius*(random(7)-3)/2))
       
  1046 end;
       
  1047 
  1039 procedure initModule;
  1048 procedure initModule;
  1040 begin
  1049 begin
  1041     friendlyfactor:= 300;
  1050     friendlyfactor:= 300;
  1042     KnownExplosion.X:= 0;
  1051     KnownExplosion.X:= 0;
  1043     KnownExplosion.Y:= 0;
  1052     KnownExplosion.Y:= 0;