# HG changeset patch # User Wuzzy # Date 1602153194 -7200 # Node ID 0b5aea8e5eaba247a1921b80a9d4526a10e6795e # Parent 8997e212be4c81f522f9e56766c8cb2bbc2f2112 Fix hammer not digging when hitting hog with 0 health diff -r 8997e212be4c -r 0b5aea8e5eab ChangeLog.txt --- a/ChangeLog.txt Thu Oct 08 11:12:22 2020 +0200 +++ b/ChangeLog.txt Thu Oct 08 12:33:14 2020 +0200 @@ -21,6 +21,7 @@ * Fix game hanging if computer hog has nothing to attack * Fix hog sometimes not falling after resurrection * Fix hog not returning from TimeBox when all land was destroyed + * Fix hammer not digging when hitting hog with 0 health Campaigns: + A Space Adventure: Spacetrip: Meteorite appears blown-up after victory diff -r 8997e212be4c -r 0b5aea8e5eab hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Thu Oct 08 11:12:22 2020 +0200 +++ b/hedgewars/uGearsHandlersMess.pas Thu Oct 08 12:33:14 2020 +0200 @@ -6087,22 +6087,20 @@ if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then begin dmg:= 0; - if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then + if (tmp^.Kind <> gtHedgehog) or + ((tmp^.Hedgehog^.Effects[heInvulnerable] = 0) and ((tmp^.State and gstHHDeath) = 0)) then begin // base damage on remaining health dmg:= (tmp^.Health - tmp^.Damage); + // always rounding down + dmg:= dmg div Gear^.Boom; + if dmg > 0 then - begin - // always rounding down - dmg:= dmg div Gear^.Boom; - - if dmg > 0 then - ApplyDamage(tmp, CurrentHedgehog, dmg, dsHammer); - end; - tmp^.dY:= _0_03 * Gear^.Boom + ApplyDamage(tmp, CurrentHedgehog, dmg, dsHammer); + tmp^.dY:= _0_03 * Gear^.Boom end; - if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then + if ((tmp^.Kind = gtHedgehog) and ((tmp^.State and gstHHDeath) = 0)) or (tmp^.Health > tmp^.Damage) then begin tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); tmp2^.LinkedGear:= tmp;