hedgewars/uAIAmmoTests.pas
changeset 7208 62e36dc45098
parent 7206 ce46b56ae9f5
child 7210 2ff30b79d2b0
equal deleted inserted replaced
7206:ce46b56ae9f5 7208:62e36dc45098
   622     or (trunc(y) > LAND_HEIGHT)
   622     or (trunc(y) > LAND_HEIGHT)
   623     or (d > 50);
   623     or (d > 50);
   624 
   624 
   625 if Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 5 then
   625 if Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 5 then
   626     begin
   626     begin
   627     fallDmg:= TraceShoveFall(Me, Targ.X, Targ.Y, vX * 0.00125 * 20, vY * 0.00125 * 20);
   627     fallDmg:= TraceShoveFall(Targ.X, Targ.Y, vX * 0.00125 * 20, vY * 0.00125 * 20);
   628     if fallDmg < 0 then
   628     if fallDmg < 0 then
   629         valueResult:= 204800
   629         valueResult:= 204800
   630     else valueResult:= Max(0, (4 - d div 50) * trunc((7+fallDmg)*dmgMod) * 1024)
   630     else valueResult:= Max(0, (4 - d div 50) * trunc((7+fallDmg)*dmgMod) * 1024)
   631     end
   631     end
   632 else
   632 else
   650 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then
   650 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then
   651     exit(BadTurn);
   651     exit(BadTurn);
   652 
   652 
   653 dmg:= sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
   653 dmg:= sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
   654 t:= 1.5 / dmg;
   654 t:= 1.5 / dmg;
   655 dmg:= dmg * 0.05; // div 40
   655 dmg:= dmg * 0.025; // div 40
   656 Vx:= (Targ.X - x) * t;
   656 Vx:= (Targ.X - x) * t;
   657 Vy:= (Targ.Y - y) * t;
   657 Vy:= (Targ.Y - y) * t;
   658 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
   658 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
   659 d:= 0;
   659 d:= 0;
   660 
   660 
   671     or (trunc(y) > LAND_HEIGHT)
   671     or (trunc(y) > LAND_HEIGHT)
   672     or (d > 23);
   672     or (d > 23);
   673 
   673 
   674 if Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 4 then
   674 if Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 4 then
   675     begin
   675     begin
   676     fallDmg:= TraceShoveFall(Me, Targ.X, Targ.Y, vX * 0.00166 * dmg, vY * 0.00166 * dmg);
   676     fallDmg:= TraceShoveFall(Targ.X, Targ.Y, vX * 0.00166 * dmg, vY * 0.00166 * dmg);
   677     if fallDmg < 0 then
   677     if fallDmg < 0 then
   678         TestSniperRifle:= BadTurn
   678         TestSniperRifle:= BadTurn
   679     else 
   679     else 
   680         TestSniperRifle:= Max(0, trunc((dmg + fallDmg) * dmgMod) * 1024)
   680         TestSniperRifle:= Max(0, trunc((dmg + fallDmg) * dmgMod) * 1024)
   681     end
   681     end