# HG changeset patch # User nemo # Date 1299084482 18000 # Node ID c89cca0a8785c5291c8a86162107f2e7b0fe8434 # Parent 088d40d8aba21d096c5a5301a7205d470ec100ca Try to make AI aware of dud mines by clearing gstAttacking on dud, and adding some rules on mine health/damage/dud probability to AI weighting. diff -r 088d40d8aba2 -r c89cca0a8785 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Wed Mar 02 00:27:20 2011 +0100 +++ b/hedgewars/GSHandlers.inc Wed Mar 02 11:48:02 2011 -0500 @@ -1741,7 +1741,7 @@ PlaySound(sndVaporize); Gear^.Health := 0; Gear^.Damage := 0; -AddFileLog('initial mine damage:'+IntToStr(Gear^.Damage)); + Gear^.State := Gear^.State and not gstAttacking end; exit end; diff -r 088d40d8aba2 -r c89cca0a8785 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Wed Mar 02 00:27:20 2011 +0100 +++ b/hedgewars/uAIMisc.pas Wed Mar 02 11:48:02 2011 -0500 @@ -1,6 +1,6 @@ (* * Hedgewars, a free turn based strategy game - * Copyright (c) 2004-2011 Andrey Korotaev + * Copyright (c) 2005-2011 Andrey Korotaev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -139,10 +139,13 @@ gtCase: AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 33, 25); gtFlame: if (Gear^.State and gsttmpFlag) <> 0 then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 20, -50); - gtMine: if (Gear^.State and gstAttacking) = 0 then - AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 50, -50) - else - AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, -50); // mine is on +// avoid mines unless they are very likely to be duds, or are duds. also avoid if they are about to blow + gtMine: if ((Gear^.State and gstAttacking) = 0) and + (((cMineDudPercent < 90) and (Gear^.Health <> 0)) or + ((Gear^.Health = 0) and (Gear^.Damage > 30))) then + AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 50, -50) + else if (Gear^.State and gstAttacking) <> 0 then + AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, -50); // mine is on gtDynamite: AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -75); gtHedgehog: begin if Gear^.Damage >= Gear^.Health then