AI always activates invulnerability and extra damage if it has them
authorunc0rr
Tue, 28 Jan 2014 17:00:46 +0400
changeset 10084 83156a03e574
parent 10083 b20f9481e5cb
child 10085 3e6cb7d80986
AI always activates invulnerability and extra damage if it has them
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Mon Jan 27 23:44:28 2014 -0500
+++ b/hedgewars/uAI.pas	Tue Jan 28 17:00:46 2014 +0400
@@ -135,6 +135,20 @@
                     inc(BestActions.Score, Score);
                     BestActions.isWalkingToABetterPlace:= false;
 
+                    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; 
+    
                     AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
 
                     if (ap.Angle > 0) then