--- a/hedgewars/uAI.pas Sun May 27 23:42:43 2012 +0400
+++ b/hedgewars/uAI.pas Fri May 25 15:35:48 2012 +0400
@@ -142,41 +142,41 @@
inc(BestActions.Score, Score);
BestActions.isWalkingToABetterPlace:= false;
- if (ap.Angle > 0) then
- AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
- else if (ap.Angle < 0) then
- AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
+ AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
- AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
-
- if (ap.Time <> 0) then
- AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0);
- if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
- begin
- ap.Angle:= LongInt(Me^.Angle) - Abs(ap.Angle);
- if ap.Angle > 0 then
+ if (ap.Angle > 0) then
+ AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
+ else if (ap.Angle < 0) then
+ AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
+
+ if (ap.Time <> 0) then
+ AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0);
+ if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
begin
- AddAction(BestActions, aia_Up, aim_push, 300 + random(250), 0, 0);
- AddAction(BestActions, aia_Up, aim_release, ap.Angle, 0, 0)
- end
- else if ap.Angle < 0 then
+ ap.Angle:= LongInt(Me^.Angle) - Abs(ap.Angle);
+ if ap.Angle > 0 then
+ begin
+ AddAction(BestActions, aia_Up, aim_push, 300 + random(250), 0, 0);
+ AddAction(BestActions, aia_Up, aim_release, ap.Angle, 0, 0)
+ end
+ else if ap.Angle < 0 then
+ begin
+ AddAction(BestActions, aia_Down, aim_push, 300 + random(250), 0, 0);
+ AddAction(BestActions, aia_Down, aim_release, -ap.Angle, 0, 0)
+ end
+ end;
+ if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
begin
- AddAction(BestActions, aia_Down, aim_push, 300 + random(250), 0, 0);
- AddAction(BestActions, aia_Down, aim_release, -ap.Angle, 0, 0)
- end
- end;
- if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
- begin
- AddAction(BestActions, aia_Put, 0, 1, ap.AttackPutX, ap.AttackPutY)
- end;
- if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then
- begin
- AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0);
- AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0);
- end;
- if ap.ExplR > 0 then
- AddAction(BestActions, aia_AwareExpl, ap.ExplR, 10, ap.ExplX, ap.ExplY);
- end
+ AddAction(BestActions, aia_Put, 0, 1, ap.AttackPutX, ap.AttackPutY)
+ end;
+ if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then
+ begin
+ AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0);
+ AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0);
+ end;
+ if ap.ExplR > 0 then
+ AddAction(BestActions, aia_AwareExpl, ap.ExplR, 10, ap.ExplX, ap.ExplY);
+ end
end;
if a = High(TAmmoType) then
a:= Low(TAmmoType)
@@ -205,10 +205,6 @@
BotLevel:= Me^.Hedgehog^.BotLevel;
-tmp:= random(2) + 1;
-Push(0, Actions, Me^, tmp);
-Push(0, Actions, Me^, tmp xor 3);
-
if (Me^.State and gstAttacked) = 0 then
maxticks:= Max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
else
@@ -221,8 +217,12 @@
BaseRate:= Max(BestRate, 0);
if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
- AddAction(Actions, aia_Weapon, Longword(amNothing), 100 + random(200), 0, 0);
+ AddAction(Actions, aia_Weapon, Longword(amSkip), 100 + random(200), 0, 0);
+tmp:= random(2) + 1;
+Push(0, Actions, Me^, tmp);
+Push(0, Actions, Me^, tmp xor 3);
+
while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
begin
Pop(ticks, Actions, Me^);