hedgewars/uAIMisc.pas
changeset 6774 237b96f06aae
parent 6773 46cd5dad1a28
child 6775 22b5fb7217db
equal deleted inserted replaced
6773:46cd5dad1a28 6774:237b96f06aae
    51 procedure FillBonuses(isAfterAttack: boolean; filter: TGearsType = []);
    51 procedure FillBonuses(isAfterAttack: boolean; filter: TGearsType = []);
    52 procedure AwareOfExplosion(x, y, r: LongInt); inline;
    52 procedure AwareOfExplosion(x, y, r: LongInt); inline;
    53 function RatePlace(Gear: PGear): LongInt;
    53 function RatePlace(Gear: PGear): LongInt;
    54 function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
    54 function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
    55 function TestColl(x, y, r: LongInt): boolean; inline;
    55 function TestColl(x, y, r: LongInt): boolean; inline;
       
    56 function TraceShoveDrown(Me: PGear; x, y, dX, dY: Real): boolean;
    56 function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord = 0): LongInt;
    57 function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord = 0): LongInt;
    57 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    58 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    58 function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    59 function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    59 function RateHammer(Me: PGear): LongInt;
    60 function RateHammer(Me: PGear): LongInt;
    60 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
    61 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
   359                 dX:= gdX * 0.005 * kick;
   360                 dX:= gdX * 0.005 * kick;
   360                 dY:= gdY * 0.005 * kick;
   361                 dY:= gdY * 0.005 * kick;
   361                 end;
   362                 end;
   362             if (Flags and 1 <> 0) and TraceShoveDrown(Me, Point.x, Point.y, dX, dY) then
   363             if (Flags and 1 <> 0) and TraceShoveDrown(Me, Point.x, Point.y, dX, dY) then
   363                 if Score > 0 then
   364                 if Score > 0 then
   364                     inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
   365                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   365                 else
   366                 else
   366                     dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
   367                     dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs
   367             else if power >= abs(Score) then
   368             else if power >= abs(Score) then
   368                 if Score > 0 then
   369                 if Score > 0 then
   369                     inc(rate, KillScore)
   370                     inc(rate, KillScore)
   370                 else
   371                 else
   371                     dec(rate, KillScore * friendlyfactor div 100)
   372                     dec(rate, KillScore * friendlyfactor div 100)
   410             dY:= gdY * dmg * 0.01;
   411             dY:= gdY * dmg * 0.01;
   411             if dX < 0 then dX:= dX - 0.01
   412             if dX < 0 then dX:= dX - 0.01
   412             else dX:= dX + 0.01;
   413             else dX:= dX + 0.01;
   413             if TraceDrown(x, y, Point.x, Point.y, dX, dY, erasure) then
   414             if TraceDrown(x, y, Point.x, Point.y, dX, dY, erasure) then
   414                 if Score > 0 then
   415                 if Score > 0 then
   415                     inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
   416                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   416                 else
   417                 else
   417                     dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
   418                     dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs
   418             else if dmg >= abs(Score) then
   419             else if dmg >= abs(Score) then
   419                 dmg := KillScore;
   420                 dmg := KillScore;
   420             if Score > 0 then
   421             if Score > 0 then
   421                 inc(rate, dmg)
   422                 inc(rate, dmg)
   422             else
   423             else