# HG changeset patch # User alfadur # Date 1634335565 -10800 # Node ID c5198f55ee1cfdf1d109fcbb6ff181c69f3ff714 # Parent 0c21cdbc5207d8a645a1218f5d1d452bb5a9911c reduce digging damage frequency diff -r 0c21cdbc5207 -r c5198f55ee1c hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Thu Sep 09 21:06:45 2021 +0300 +++ b/hedgewars/uGearsHandlersMess.pas Sat Oct 16 01:06:05 2021 +0300 @@ -1849,6 +1849,7 @@ var HHGear: PGear; dig, hit: boolean; + newX, newY: hwFloat; begin AllInactive := false; WorldWrap(Gear); @@ -1879,7 +1880,7 @@ dig := true end; - if ((HHGear^.State and gstMoving) <> 0) then + if (HHGear^.State and gstMoving) <> 0 then begin doStepHedgehogMoving(HHGear); if (HHGear^.State and gstHHDriven) = 0 then @@ -1897,25 +1898,28 @@ else HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight; - if ((HHGear^.State and gstMoving) = 0) then + if (HHGear^.State and gstMoving) = 0 then begin HHGear^.State := HHGear^.State and (not gstAttacking); - if CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),lfIndestructible) then + if CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), lfIndestructible) then HedgehogStep(HHGear); HHGear^.State := HHGear^.State or gstAttacking end; + newX := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); + newY := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); + if CheckLandValue(hwRound(newX + SignAs(_6, Gear^.dX)), hwRound(newY), lfIndestructible) then + begin + Gear^.X := newX; + Gear^.Y := newY; + end; + inc(BTSteps); - if BTSteps = 11 then + if BTSteps = 15 then begin BTSteps := 0; - if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then - begin - Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); - Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); - end; hit := true end; end;