hedgewars/uAIAmmoTests.pas
branchtransitional_engine
changeset 16051 2003b466b279
parent 15929 128ace913837
parent 16043 e66feb918d71
equal deleted inserted replaced
16050:6a3dc15b78b9 16051:2003b466b279
  2476 
  2476 
  2477 Vx:= (Targ.Point.X - x) * 1 / 1024;
  2477 Vx:= (Targ.Point.X - x) * 1 / 1024;
  2478 Vy:= (Targ.Point.Y - y) * 1 / 1024;
  2478 Vy:= (Targ.Point.Y - y) * 1 / 1024;
  2479 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
  2479 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
  2480 // Minigun angle is limited
  2480 // Minigun angle is limited
  2481 if (ap.Angle < Ammoz[amMinigun].minAngle) or (ap.Angle > Ammoz[amMinigun].maxAngle) then
  2481 if (abs(ap.Angle) < Ammoz[amMinigun].minAngle) or (abs(ap.Angle) > Ammoz[amMinigun].maxAngle) then
  2482     exit(BadTurn);
  2482     exit(BadTurn);
  2483 
  2483 
  2484 // Apply inaccuracy
  2484 // Apply inaccuracy
  2485 if (not aiLaserSighting) then
  2485 if (not aiLaserSighting) then
  2486     inc(ap.Angle, AIrndSign(random((Level - 1) * 10)));
  2486     inc(ap.Angle, AIrndSign(random((Level - 1) * 10)));