# HG changeset patch # User unc0rr # Date 1547151727 -3600 # Node ID 7e4862823649d313065a378ab4543dc20a87285e # Parent adf3e7d94db0ae79e19222e5438c15d5b55e7cc7 Fix broken kamikaze logic when target position is close to attacker diff -r adf3e7d94db0 -r 7e4862823649 .hgignore --- a/.hgignore Thu Jan 10 19:47:18 2019 +0100 +++ b/.hgignore Thu Jan 10 21:22:07 2019 +0100 @@ -90,3 +90,5 @@ *.user *.iml build-qmlfrontend* +.cabal-sandbox +cabal.sandbox.config diff -r adf3e7d94db0 -r 7e4862823649 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu Jan 10 19:47:18 2019 +0100 +++ b/hedgewars/uAIAmmoTests.pas Thu Jan 10 21:22:07 2019 +0100 @@ -1149,17 +1149,18 @@ if dx >= 0 then cx:= 0.45 else cx:= -0.45; - for i:= 0 to 512 div step - 2 do + for i:= 1 to 512 div step - 2 do begin + x:= x + dx; + y:= y + dy; + valueResult:= valueResult + RateShove(Me, trunc(x), trunc(y) , 30, 30, 25 , cx, -0.9, trackFall or afSetSkip); + end; - x:= x + dx; - y:= y + dy; - end; - if dx = 0 then + if (d < 10) and (dx = 0) then begin x:= hwFloat2Float(Me^.X); y:= hwFloat2Float(Me^.Y); @@ -1176,8 +1177,10 @@ , -cx, -0.9, trackFall or afSetSkip); end end; + if v > valueResult then - begin + begin + cx:= -cx; ap.Angle:= -2048; valueResult:= v end;