hedgewars/uGearsUtils.pas
changeset 9685 7d925e82e572
parent 9561 aab34634a17b
child 9706 5178d2263521
--- a/hedgewars/uGearsUtils.pas	Thu Nov 07 23:08:28 2013 -0500
+++ b/hedgewars/uGearsUtils.pas	Fri Nov 08 23:11:13 2013 -0500
@@ -135,7 +135,7 @@
                             //AddFileLog('Damage: ' + inttostr(dmg));
                             if (Mask and EXPLNoDamage) = 0 then
                                 begin
-                                if not Gear^.Invulnerable then
+                                if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
                                     ApplyDamage(Gear, AttackingHog, dmg, dsExplosion)
                                 else
                                     Gear^.State:= Gear^.State or gstWinner;
@@ -148,12 +148,12 @@
 
                                 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser);
                                 if Gear^.Kind = gtKnife then Gear^.State:= Gear^.State and (not gstCollision);
-                                if not Gear^.Invulnerable then
+                                if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
                                     Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
                                 Gear^.Active:= true;
                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
                                 end;
-                            if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (not Gear^.Invulnerable) and ((Gear^.State and gstHHDeath) = 0) then
+                            if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.Effects[heInvulnerable] = 0) and (Gear^.State and gstHHDeath = 0) then
                                 Gear^.Hedgehog^.Effects[hePoisoned] := 1;
                             end;
 
@@ -249,9 +249,8 @@
                         end;
                     end
                 end;
-        if ((GameFlags and gfKarma) <> 0) and 
-        ((GameFlags and gfInvulnerable) = 0)
-        and (not CurrentHedgehog^.Gear^.Invulnerable) then
+        if (GameFlags and gfKarma <> 0) and (GameFlags and gfInvulnerable = 0) and 
+           (CurrentHedgehog^.Effects[heInvulnerable] = 0) then
             begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
             inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
             CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
@@ -322,7 +321,7 @@
             particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480);
         end;
 
-    if (Gear^.Invulnerable) then
+    if ((Gear^.Hedgehog^.Effects[heInvulnerable] <> 0)) then
         exit;
 
     //if _0_6 < Gear^.dY then
@@ -823,7 +822,7 @@
                         end;
                     if dmg > 0 then
                         begin
-                        if (not t^.Invulnerable) then
+                        if t^.Hedgehog^.Effects[heInvulnerable] = 0 then
                             ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet)
                         else
                             Gear^.State:= Gear^.State or gstWinner;
@@ -919,7 +918,7 @@
                 Ammo^.Timer:= 0;
                 exit;
                 end;
-            if (not Gear^.Invulnerable) then
+            if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
                 begin
                 if (Ammo^.Kind = gtKnife) and (tmpDmg > 0) then
                     for j:= 1 to max(1,min(3,tmpDmg div 5)) do