hedgewars/uAIMisc.pas
changeset 7360 d833d1010710
parent 7285 a9016b157535
child 7375 16ae2e1c9005
equal deleted inserted replaced
7357:06454899d0d2 7360:d833d1010710
   402             begin
   402             begin
   403             if Flags and afTrackFall <> 0 then
   403             if Flags and afTrackFall <> 0 then
   404                 begin
   404                 begin
   405                 dX:= 0.005 * dmg + 0.01;
   405                 dX:= 0.005 * dmg + 0.01;
   406                 dY:= dX;
   406                 dY:= dX;
   407                 fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
   407                 if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and 
       
   408                    (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
       
   409                      fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, 0) * dmgMod)
       
   410                 else fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod)
   408                 end;
   411                 end;
   409             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
   412             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
   410                 if Score > 0 then
   413                 if Score > 0 then
   411                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   414                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   412                 else
   415                 else
   501             begin
   504             begin
   502             dX:= gdX * dmg;
   505             dX:= gdX * dmg;
   503             dY:= gdY * dmg;
   506             dY:= gdY * dmg;
   504             if dX < 0 then dX:= dX - 0.01
   507             if dX < 0 then dX:= dX - 0.01
   505             else dX:= dX + 0.01;
   508             else dX:= dX + 0.01;
   506             fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
   509             if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and 
       
   510                (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
       
   511                  fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, 0) * dmgMod)
       
   512             else fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
   507             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
   513             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
   508                 if Score > 0 then
   514                 if Score > 0 then
   509                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   515                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
   510                 else
   516                 else
   511                     dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs
   517                     dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs