AI doesn't use extra damage/vampirism/invulnerable again if already active
authorWuzzy <almikes@aol.com>
Wed, 18 Oct 2017 03:39:01 +0200
changeset 12709 8673892ebf24
parent 12708 5ef6780b1c05
child 12710 1ab53b945140
AI doesn't use extra damage/vampirism/invulnerable again if already active
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Wed Oct 18 03:19:43 2017 +0200
+++ b/hedgewars/uAI.pas	Wed Oct 18 03:39:01 2017 +0200
@@ -150,20 +150,20 @@
                     // if not between shots, activate invulnerability/vampirism if available
                     if CurrentHedgehog^.MultiShootAttacks = 0 then
                         begin
-                        if HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0 then
+                        if (HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0) and (Me^.Hedgehog^.Effects[heInvulnerable] = 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
+                        if (HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0) and (cDamageModifier <> _1_5) 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;
-                        if HHHasAmmo(Me^.Hedgehog^, amVampiric) > 0 then
+                        if (HHHasAmmo(Me^.Hedgehog^, amVampiric) > 0) and (not cVampiric) then
                             begin
                             AddAction(BestActions, aia_Weapon, Longword(amVampiric), 80, 0, 0);
                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);