Prevent AI to damage a teammate when trying to dig with firepunch (patch not tested)
authorunc0rr
Sun, 28 Sep 2008 22:47:13 +0000
changeset 1296 d7fffad44b7e
parent 1295 27bec661581c
child 1297 78670b0c4a23
Prevent AI to damage a teammate when trying to dig with firepunch (patch not tested)
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Sep 28 22:39:07 2008 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sun Sep 28 22:47:13 2008 +0000
@@ -364,7 +364,8 @@
 if (Abs(hwRound(Me^.X) - Targ.X) > 25)
 or (Abs(hwRound(Me^.Y) - 50 - Targ.Y) > 50) then
 	begin
-	if TestColl(hwRound(Me^.Y), hwRound(Me^.Y) - 16, 6) then
+	if TestColl(hwRound(Me^.Y), hwRound(Me^.Y) - 16, 6)
+	and (RateShove(Me, hwRound(Me^.X) + 10 * hwSign(Me^.dX), hwRound(Me^.Y) - 40, 30, 30) = 0) then
 		Result:= Succ(BadTurn)
 	else
 		Result:= BadTurn;