hedgewars/uAIMisc.pas
changeset 8966 5ab59d79bc9a
parent 8964 962ede906da1
child 8969 ff121fd3d08f
equal deleted inserted replaced
8965:b4f10ff6ea90 8966:5ab59d79bc9a
   384         if not skipLandCheck and TestCollExcludingObjects(trunc(x), trunc(y), Target.Radius) then
   384         if not skipLandCheck and TestCollExcludingObjects(trunc(x), trunc(y), Target.Radius) then
   385             with Target do
   385             with Target do
   386                 begin
   386                 begin
   387                 if (Kind = gtHedgehog) and (0.4 < dY) then
   387                 if (Kind = gtHedgehog) and (0.4 < dY) then
   388                     begin
   388                     begin
   389                     dmg := 1 + trunc((abs(dY) - 0.4) * 70);
   389                     dmg := 1 + trunc((dY - 0.4) * 70);
   390                     if dmg >= 1 then exit(dmg)
   390                     exit(dmg)
   391                     end
   391                     end
   392                 else 
   392                 else 
   393                     begin
   393                     begin
   394                     dxdy:= abs(dX)+abs(dY);
   394                     dxdy:= abs(dX)+abs(dY);
   395                     if ((Kind = gtMine) and (dxdy > 0.35)) or 
   395                     if ((Kind = gtMine) and (dxdy > 0.35)) or 
   397                             (((Flags and gstTmpFlag <> 0) and (dxdy > 0.35)) or
   397                             (((Flags and gstTmpFlag <> 0) and (dxdy > 0.35)) or
   398                              ((Flags and gstTmpFlag <> 0) and 
   398                              ((Flags and gstTmpFlag <> 0) and 
   399                                 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and 
   399                                 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and 
   400                                 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then
   400                                 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then
   401                         begin
   401                         begin
   402                         dmg := 1 + trunc(dxdy * 25);
   402                         dmg := trunc(dxdy * 25);
   403                         exit(dmg)
   403                         exit(dmg)
   404                         end
   404                         end
   405                     else if (Kind = gtExplosives) and not((abs(odX) > 0.15) or ((abs(odY) > 0.15) and (abs(odX) > 0.02))) and (dY > 0.2) then
   405                     else if (Kind = gtExplosives) and not((abs(odX) > 0.15) or ((abs(odY) > 0.15) and (abs(odX) > 0.02))) and (dY > 0.2) then
   406                         begin
   406                         begin
   407                         dmg := 1 + trunc(dy * 70);
   407                         dmg := trunc(dy * 70);
   408                         exit(dmg)
   408                         exit(dmg)
   409                         end
   409                         end
   410                     end;
   410                     end;
   411             exit(0)
   411             exit(0)
   412             end;
   412             end;
   436         if TestCollExcludingObjects(trunc(x), trunc(y), Target.Radius) then
   436         if TestCollExcludingObjects(trunc(x), trunc(y), Target.Radius) then
   437             with Target do
   437             with Target do
   438                 begin
   438                 begin
   439                 if (Kind = gtHedgehog) and (0.4 < dY) then
   439                 if (Kind = gtHedgehog) and (0.4 < dY) then
   440                     begin
   440                     begin
   441                     dmg := 1 + trunc((abs(dY) - 0.4) * 70);
   441                     dmg := trunc((dY - 0.4) * 70);
   442                     if dmg >= 1 then
   442                     exit(dmg);
   443                         exit(dmg);
       
   444                     end
   443                     end
   445                 else 
   444                 else 
   446                     begin
   445                     begin
   447                     dxdy:= abs(dX)+abs(dY);
   446                     dxdy:= abs(dX)+abs(dY);
   448                     if ((Kind = gtMine) and (dxdy > 0.35)) or 
   447                     if ((Kind = gtMine) and (dxdy > 0.35)) or 
   450                             (((Flags and gstTmpFlag <> 0) and (dxdy > 0.35)) or
   449                             (((Flags and gstTmpFlag <> 0) and (dxdy > 0.35)) or
   451                              ((Flags and gstTmpFlag <> 0) and 
   450                              ((Flags and gstTmpFlag <> 0) and 
   452                                 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and 
   451                                 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and 
   453                                 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then
   452                                 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then
   454                         begin
   453                         begin
   455                         dmg := 1 + trunc(dxdy * 25);
   454                         dmg := trunc(dxdy * 25);
   456                         exit(dmg)
   455                         exit(dmg)
   457                         end
   456                         end
   458                     else if (Kind = gtExplosives) and not((abs(odX) > 0.15) or ((abs(odY) > 0.15) and (abs(odX) > 0.02))) and (dY > 0.2) then
   457                     else if (Kind = gtExplosives) and not((abs(odX) > 0.15) or ((abs(odY) > 0.15) and (abs(odX) > 0.02))) and (dY > 0.2) then
   459                         begin
   458                         begin
   460                         dmg := 1 + trunc(dy * 70);
   459                         dmg := trunc(dy * 70);
   461                         exit(dmg)
   460                         exit(dmg)
   462                         end
   461                         end
   463                     end;
   462                     end;
   464             exit(0)
   463             exit(0)
   465         end;
   464         end;