393 begin |
391 begin |
394 dxdy:= abs(dX)+abs(dY); |
392 dxdy:= abs(dX)+abs(dY); |
395 if ((Kind = gtMine) and (dxdy > 0.35)) or |
393 if ((Kind = gtMine) and (dxdy > 0.35)) or |
396 ((Kind = gtExplosives) and |
394 ((Kind = gtExplosives) and |
397 (((State and gstTmpFlag <> 0) and (dxdy > 0.35)) or |
395 (((State and gstTmpFlag <> 0) and (dxdy > 0.35)) or |
398 ((State and gstTmpFlag <> 0) and |
396 ((State and gstTmpFlag = 0) and |
399 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and |
397 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and |
400 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then |
398 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then |
401 begin |
399 begin |
402 dmg := trunc(dxdy * 25); |
400 dmg := trunc(dxdy * 25); |
403 exit(dmg) |
401 exit(dmg) |
442 exit(dmg); |
440 exit(dmg); |
443 end |
441 end |
444 else |
442 else |
445 begin |
443 begin |
446 dxdy:= abs(dX)+abs(dY); |
444 dxdy:= abs(dX)+abs(dY); |
447 if ((Kind = gtMine) and (dxdy > 0.35)) or |
445 if ((Kind = gtMine) and (dxdy > 0.4)) or |
448 ((Kind = gtExplosives) and |
446 ((Kind = gtExplosives) and |
449 (((State and gstTmpFlag <> 0) and (dxdy > 0.35)) or |
447 (((State and gstTmpFlag <> 0) and (dxdy > 0.4)) or |
450 ((State and gstTmpFlag <> 0) and |
448 ((State and gstTmpFlag = 0) and |
451 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and |
449 ((abs(odX) > 0.15) or ((abs(odY) > 0.15) and |
452 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then |
450 (abs(odX) > 0.02))) and (dxdy > 0.35)))) then |
453 begin |
451 begin |
454 dmg := trunc(dxdy * 25); |
452 dmg := trunc(dxdy * 50); |
455 exit(dmg) |
453 exit(dmg) |
456 end |
454 end |
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 |
455 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 |
458 begin |
456 begin |
459 dmg := trunc(dy * 70); |
457 dmg := trunc(dy * 70); |
519 if dmg > 0 then |
517 if dmg > 0 then |
520 begin |
518 begin |
521 pX:= Point.x; |
519 pX:= Point.x; |
522 pY:= Point.y; |
520 pY:= Point.y; |
523 fallDmg:= 0; |
521 fallDmg:= 0; |
524 if (Flags and afTrackFall <> 0) and (dmg < abs(Score)) then |
522 if (Flags and afTrackFall <> 0) and (Score > 0) and (dmg < Score) then |
525 begin |
523 begin |
526 dX:= (0.005 * dmg + 0.01) / Density; |
524 dX:= (0.005 * dmg + 0.01) / Density; |
527 dY:= dX; |
525 dY:= dX; |
528 if (Kind = gtExplosives) and |
526 if (Kind = gtExplosives) and (State and gstTmpFlag = 0) and |
529 (((abs(dY) > 0.15) and (abs(dX) < 0.02)) or |
527 (((abs(dY) > 0.15) and (abs(dX) < 0.02)) or |
530 ((abs(dY) < 0.15) and (abs(dX) < 0.15))) then |
528 ((abs(dY) < 0.15) and (abs(dX) < 0.15))) then |
531 dX:= 0; |
529 dX:= 0; |
|
530 |
|
531 if pX - x < 0 then dX:= -dX; |
|
532 if pY - y < 0 then dY:= -dY; |
|
533 |
532 if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and |
534 if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and |
533 (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then |
535 (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then |
534 fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod) |
536 fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod) |
535 else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod) |
537 else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod) |
536 end; |
538 end; |
605 begin |
607 begin |
606 pX:= Point.x; |
608 pX:= Point.x; |
607 pY:= Point.y-2; |
609 pY:= Point.y-2; |
608 fallDmg:= 0; |
610 fallDmg:= 0; |
609 if (Flags and afSetSkip <> 0) then skip:= true; |
611 if (Flags and afSetSkip <> 0) then skip:= true; |
610 if (Flags and afTrackFall <> 0) and (Score > 0) then |
612 if not(dead) and (Flags and afTrackFall <> 0) and (Score > 0) and (power < Score) then |
611 fallDmg:= trunc(TraceShoveFall(pX, pY, dX, dY, Targets.ar[i]) * dmgMod); |
613 if (Kind = gtExplosives) and (State and gstTmpFlag = 0) and |
|
614 (((abs(dY) > 0.15) and (abs(dX) < 0.02)) or |
|
615 ((abs(dY) < 0.15) and (abs(dX) < 0.15))) then |
|
616 fallDmg:= trunc(TraceShoveFall(pX, pY, 0, dY, Targets.ar[i]) * dmgMod) |
|
617 else |
|
618 fallDmg:= trunc(TraceShoveFall(pX, pY, dX, dY, Targets.ar[i]) * dmgMod); |
612 if Kind = gtHedgehog then |
619 if Kind = gtHedgehog then |
613 begin |
620 begin |
614 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
621 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
615 begin |
622 begin |
616 if Score > 0 then |
623 if Score > 0 then |
695 dmg:= min(baseDmg - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y))), 25); |
702 dmg:= min(baseDmg - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y))), 25); |
696 dmg:= trunc(dmg * dmgMod); |
703 dmg:= trunc(dmg * dmgMod); |
697 end; |
704 end; |
698 if dmg > 0 then |
705 if dmg > 0 then |
699 begin |
706 begin |
700 pX:= Point.x; |
707 if not(dead) and (Score > 0) and (dmg < Score) then |
701 pY:= Point.y; |
708 begin |
702 dX:= gdX * dmg / Density; |
709 pX:= Point.x; |
703 dY:= gdY * dmg / Density; |
710 pY:= Point.y; |
704 if dX < 0 then dX:= dX - 0.01 |
711 dX:= gdX * dmg / Density; |
705 else dX:= dX + 0.01; |
712 dY:= gdY * dmg / Density; |
706 if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and |
713 if dX < 0 then dX:= dX - 0.01 |
707 (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then |
714 else dX:= dX + 0.01; |
708 fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod) |
715 if (Kind = gtExplosives) and (State and gstTmpFlag = 0) and |
709 else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod); |
716 (((abs(dY) > 0.15) and (abs(dX) < 0.02)) or |
|
717 ((abs(dY) < 0.15) and (abs(dX) < 0.15))) then |
|
718 dX:= 0; |
|
719 if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and |
|
720 (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then |
|
721 fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod) |
|
722 else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod) |
|
723 end; |
710 if Kind = gtHedgehog then |
724 if Kind = gtHedgehog then |
711 begin |
725 begin |
712 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
726 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
713 begin |
727 begin |
714 if Score > 0 then |
728 if Score > 0 then |