hedgewars/uAIMisc.pas
branchwebgl
changeset 8026 4a4f21070479
parent 8013 5cbf6e4361f4
child 8833 c13ebed437cb
equal deleted inserted replaced
8023:7de85783b823 8026:4a4f21070479
    47     end;
    47     end;
    48 TBonus = record
    48 TBonus = record
    49     X, Y: LongInt;
    49     X, Y: LongInt;
    50     Radius: LongInt;
    50     Radius: LongInt;
    51     Score: LongInt;
    51     Score: LongInt;
    52     end;
    52 	 end;
       
    53 
       
    54 Tbonuses = record
       
    55 	      Count : Longword;
       
    56 	      ar    : array[0..Pred(MAXBONUS)] of TBonus;
       
    57 	   end;
       
    58 
       
    59 Twalkbonuses =  record
       
    60         Count: Longword;
       
    61         ar: array[0..Pred(MAXBONUS div 8)] of TBonus;  // don't use too many
       
    62         end;
    53 
    63 
    54 procedure initModule;
    64 procedure initModule;
    55 procedure freeModule;
    65 procedure freeModule;
    56 
    66 
    57 procedure FillTargets;
    67 procedure FillTargets;
    75 function  AIrndSign(num: LongInt): LongInt;
    85 function  AIrndSign(num: LongInt): LongInt;
    76 
    86 
    77 var ThinkingHH: PGear;
    87 var ThinkingHH: PGear;
    78     Targets: TTargets;
    88     Targets: TTargets;
    79 
    89 
    80     bonuses: record
    90     bonuses: Tbonuses;
    81         Count: Longword;
    91 
    82         ar: array[0..Pred(MAXBONUS)] of TBonus;
    92     walkbonuses: Twalkbonuses;
    83         end;
       
    84 
       
    85     walkbonuses: record
       
    86         Count: Longword;
       
    87         ar: array[0..Pred(MAXBONUS div 8)] of TBonus;  // don't use too many
       
    88         end;
       
    89 
    93 
    90 const KillScore = 200;
    94 const KillScore = 200;
    91 var friendlyfactor: LongInt = 300;
    95 var friendlyfactor: LongInt = 300;
    92 
    96 
    93 implementation
    97 implementation
   351     begin
   355     begin
   352         x:= x + dX;
   356         x:= x + dX;
   353         y:= y + dY;
   357         y:= y + dY;
   354         dY:= dY + cGravityf;
   358         dY:= dY + cGravityf;
   355         skipLandCheck:= skipLandCheck and (r <> 0) and (abs(eX-x) + abs(eY-y) < r) and ((abs(eX-x) < rCorner) or (abs(eY-y) < rCorner));
   359         skipLandCheck:= skipLandCheck and (r <> 0) and (abs(eX-x) + abs(eY-y) < r) and ((abs(eX-x) < rCorner) or (abs(eY-y) < rCorner));
   356         if not skipLandCheck and TestCollWithLand(trunc(x), trunc(y), cHHRadius) then
   360         if (not skipLandCheck) and TestCollWithLand(trunc(x), trunc(y), cHHRadius) then
   357         begin
   361         begin
   358             if 0.4 < dY then
   362             if 0.4 < dY then
   359             begin
   363             begin
   360                 dmg := 1 + trunc((abs(dY) - 0.4) * 70);
   364                 dmg := 1 + trunc((abs(dY) - 0.4) * 70);
   361                 if dmg >= 1 then
   365                 if dmg >= 1 then