Only make AI avoid damaged dead mines and dangerously smoking barrels once the attack is finished.
authornemo
Fri, 18 Nov 2011 12:47:40 -0500
changeset 6396 71dd6b8494e5
parent 6395 bb04d7a9f7e2
child 6397 6eb58ae8b510
Only make AI avoid damaged dead mines and dangerously smoking barrels once the attack is finished.
hedgewars/uAIMisc.pas
--- a/hedgewars/uAIMisc.pas	Fri Nov 18 15:05:32 2011 +0400
+++ b/hedgewars/uAIMisc.pas	Fri Nov 18 12:47:40 2011 -0500
@@ -143,11 +143,11 @@
 // avoid mines unless they are very likely to be duds, or are duds. also avoid if they are about to blow 
           gtMine:  if ((Gear^.State and gstAttacking) = 0) and 
                       (((cMineDudPercent < 90) and (Gear^.Health <> 0)) or
-                       ((Gear^.Health = 0) and (Gear^.Damage > 30))) then
+                       (isAfterAttack and (Gear^.Health = 0) and (Gear^.Damage > 30))) then
                           AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 50, -50)
                       else if (Gear^.State and gstAttacking) <> 0 then
                           AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, -50); // mine is on
-          gtExplosives: AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 75, -60+Gear^.Health);
+          gtExplosives: if isAfterAttack then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 75, -60+Gear^.Health);
           gtSMine:    AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 50, -30);
           gtDynamite: AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -75);
           gtHedgehog: begin