# HG changeset patch # User Wuzzy # Date 1591467777 -7200 # Node ID 30ad3fd974f1780a489c7283f4a3818a4dafcc02 # Parent 7d3877231b00180bd70ba930d37f36f0687a135b Teach AI to set minimum mine bounce for improved aiming diff -r 7d3877231b00 -r 30ad3fd974f1 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Sat Jun 06 20:21:08 2020 +0200 +++ b/hedgewars/uAI.pas Sat Jun 06 20:22:57 2020 +0200 @@ -180,6 +180,14 @@ if (Ammoz[a].Ammo.Propz and ammoprop_Timerable) <> 0 then AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0); + // Set minimum mine bounciness for improved aim + if (BotLevel < 5) and (a = amMine) then + begin + AddAction(BestActions, aia_Precise, aim_push, 10, 0, 0); + AddAction(BestActions, aia_Timer, 1, 200, 0, 0); + AddAction(BestActions, aia_Precise, aim_release, 10, 0, 0); + end; + if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then begin dAngle:= LongInt(Me^.Angle) - Abs(ap.Angle); diff -r 7d3877231b00 -r 30ad3fd974f1 hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Sat Jun 06 20:21:08 2020 +0200 +++ b/hedgewars/uAIActions.pas Sat Jun 06 20:22:57 2020 +0200 @@ -31,6 +31,7 @@ aia_Up = 5; aia_Down = 6; aia_Switch = 7; + aia_Precise = 8; aia_Weapon = $8000; aia_WaitXL = $8001; @@ -73,7 +74,7 @@ var PrevX: LongInt = 0; timedelta: Longword = 0; -const ActionIdToStr: array[0..7] of string[16] = ( +const ActionIdToStr: array[0..8] of string[16] = ( {aia_none} '', {aia_Left} 'left', {aia_Right} 'right', @@ -81,7 +82,8 @@ {aia_attack} 'attack', {aia_Up} 'up', {aia_Down} 'down', -{aia_Switch} 'switch' +{aia_Switch} 'switch', +{aia_Precise} 'precise' ); {$IFDEF TRACEAIACTIONS}