hedgewars/uGearsUtils.pas
changeset 10011 ead5e4b21671
parent 10010 2a1483d91977
child 10012 82dd9f0c88f7
--- a/hedgewars/uGearsUtils.pas	Fri Jan 17 15:37:24 2014 -0500
+++ b/hedgewars/uGearsUtils.pas	Fri Jan 17 16:13:10 2014 -0500
@@ -135,7 +135,7 @@
                             //AddFileLog('Damage: ' + inttostr(dmg));
                             if (Mask and EXPLNoDamage) = 0 then
                                 begin
-                                if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
+                                if (Gear^.Kind <> gtHedgehog) or (Gear^.Hedgehog^.Effects[heInvulnerable] = 0) then
                                     ApplyDamage(Gear, AttackingHog, dmg, dsExplosion)
                                 else
                                     Gear^.State:= Gear^.State or gstWinner;
@@ -148,7 +148,7 @@
 
                                 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser);
                                 if Gear^.Kind = gtKnife then Gear^.State:= Gear^.State and (not gstCollision);
-                                if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
+                                if (Gear^.Kind = gtHedgehog) and (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
@@ -824,7 +824,7 @@
                         end;
                     if dmg > 0 then
                         begin
-                        if t^.Hedgehog^.Effects[heInvulnerable] = 0 then
+                        if (Gear^.Kind <> gtHedgehog) or (t^.Hedgehog^.Effects[heInvulnerable] = 0) then
                             ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet)
                         else
                             Gear^.State:= Gear^.State or gstWinner;
@@ -920,7 +920,7 @@
                 Ammo^.Timer:= 0;
                 exit;
                 end;
-            if Gear^.Hedgehog^.Effects[heInvulnerable] = 0 then
+            if (Gear^.Kind <> gtHedgehog) or (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