I don't see how rating these against others is useful, given the limited radius, and the cluster bomb thing just seems counterproductive. Anyway, this prevents AI from picking on barrels.
authornemo
Fri, 10 May 2013 21:00:06 -0400
changeset 8974 d360e97ce842
parent 8973 7bcb77379a4b
child 8975 188a71ceda72
I don't see how rating these against others is useful, given the limited radius, and the cluster bomb thing just seems counterproductive. Anyway, this prevents AI from picking on barrels.
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas	Fri May 10 12:00:51 2013 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Fri May 10 21:00:06 2013 -0400
@@ -476,7 +476,7 @@
     else
         Score:= BadTurn;
 
-     if valueResult < Score then
+     if Score > 0 then
         begin
         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 2));
         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
@@ -683,7 +683,7 @@
     d: Longword;
     fallDmg, valueResult: LongInt;
 begin
-if Level > 4 then exit(BadTurn);
+if (Level > 4) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn);
 Level:= Level; // avoid compiler hint
 ap.ExplR:= 1;
 ap.Time:= 0;
@@ -726,7 +726,7 @@
     d: Longword;
     fallDmg: LongInt;
 begin
-if Level > 3 then exit(BadTurn);
+if (Level > 3) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn);
 Level:= Level; // avoid compiler hint
 ap.ExplR:= 0;
 ap.Time:= 0;