--- a/hedgewars/uAIAmmoTests.pas Wed Nov 07 23:04:29 2012 -0500
+++ b/hedgewars/uAIAmmoTests.pas Thu Nov 08 17:18:49 2012 +0400
@@ -121,8 +121,6 @@
(proc: nil; flags: 0) // amKnife
);
-const BadTurn = Low(LongInt) div 4;
-
implementation
uses uAIMisc, uVariables, uUtils, uGearsHandlers;
@@ -149,7 +147,7 @@
repeat
rTime:= rTime + 300 + Level * 50 + random(300);
Vx:= - windSpeed * rTime * 0.5 + (Targ.X + AIrndSign(2) - mX) / rTime;
- Vy:= cGravityf * rTime * 0.5 - (Targ.Y - mY) / rTime;
+ Vy:= cGravityf * rTime * 0.5 - (Targ.Y + 1 - mY) / rTime;
r:= sqr(Vx) + sqr(Vy);
if not (r > 1) then
begin
@@ -173,7 +171,7 @@
value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
else value:= RateExplosion(Me, EX, EY, 101);
if value = 0 then
- value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
+ value:= 1024 - Metric(Targ.X, Targ.Y, EX, EY) div 64;
if valueResult <= value then
begin
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
@@ -229,8 +227,9 @@
EY:= trunc(y);
value:= RateShove(trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall);
- if value = 0 then
- value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
+ // LOL copypasta: this is score for digging with... snowball
+ //if value = 0 then
+ // value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
if valueResult <= value then
begin
@@ -337,7 +336,7 @@
else
Score:= BadTurn;
- if valueResult < Score then
+ if (valueResult < Score) and (Score > 0) then
begin
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
@@ -582,7 +581,7 @@
valueResult:= RateShotgun(Me, vX, vY, rx, ry);
if valueResult = 0 then
- valueResult:= - Metric(Targ.X, Targ.Y, rx, ry) div 64
+ valueResult:= 1024 - Metric(Targ.X, Targ.Y, rx, ry) div 64
else
dec(valueResult, Level * 4000);
// 27/20 is reuse bonus