Don't activate invulnerability/vampirism between shots of multiattack weapon
authorunc0rr
Mon, 28 Apr 2014 19:01:08 +0400
changeset 10231 b2a68e75e55c
parent 10230 361d36ec5181
child 10232 93afc42147c8
Don't activate invulnerability/vampirism between shots of multiattack weapon
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Mon Apr 28 16:52:00 2014 +0200
+++ b/hedgewars/uAI.pas	Mon Apr 28 19:01:08 2014 +0400
@@ -146,19 +146,23 @@
 
                     BestActions.Score:= Actions.Score + Score;
 
-                    if HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0 then
+                    // if not between shots, activate invulnerability/vampirism if available
+                    if CurrentHedgehog^.MultiShootAttacks = 0 then
                         begin
-                        AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0);
-                        AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
-                        AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
+                        if HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0 then
+                            begin
+                            AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0);
+                            AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
+                            AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
+                            end;
+
+                        if HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0 then
+                            begin
+                            AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
+                            AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
+                            AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
+                            end; 
                         end;
-                        
-                    if HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0 then
-                        begin
-                        AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
-                        AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
-                        AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
-                        end; 
     
                     AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);