# HG changeset patch # User nemo # Date 1389993190 18000 # Node ID ead5e4b21671f3b7fb1a59b922ce21c51eb80b28 # Parent 2a1483d91977689a331dbc56f46732838447a688 Add check for gear kind of hedgehog on invulnerability effect. This probably fixes bug #766, is similar to change in previous r2a1483d91977 and was introduced by r7d925e82e572 diff -r 2a1483d91977 -r ead5e4b21671 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Fri Jan 17 15:37:24 2014 -0500 +++ b/hedgewars/uGearsHandlersMess.pas Fri Jan 17 16:13:10 2014 -0500 @@ -208,7 +208,7 @@ if (gi^.Kind = gtHedgehog) then begin d := r - hwRound(Distance(gi^.X - x, gi^.Y - y)); - if (d > 1) and ((gi^.Hedgehog^.Effects[heInvulnerable] = 0)) and (GetRandom(2) = 0) then + if (d > 1) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) and (GetRandom(2) = 0) then begin if (CurrentHedgehog^.Gear = gi) then PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) @@ -2905,7 +2905,7 @@ dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius); if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi); if (dmg > 1) then - if (CurrentHedgehog^.Gear = gi) and ((gi^.Hedgehog^.Effects[heInvulnerable] = 0)) then + if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then gi^.State := gi^.State or gstLoser else gi^.State := gi^.State or gstWinner; @@ -4826,7 +4826,7 @@ if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then begin //tmp^.State:= tmp^.State or gstFlatened; - if (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then + if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown); //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); diff -r 2a1483d91977 -r ead5e4b21671 hedgewars/uGearsUtils.pas --- 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