hedgewars/uAIAmmoTests.pas
changeset 15749 82fd124e6512
parent 15744 97a9ac5d4c83
child 15836 f7875779d910
equal deleted inserted replaced
15748:ff8bd08f7d98 15749:82fd124e6512
  1965     valueResult:= valueResult * 27 div 20;
  1965     valueResult:= valueResult * 27 div 20;
  1966 TestSMine:= valueResult
  1966 TestSMine:= valueResult
  1967 end;
  1967 end;
  1968 
  1968 
  1969 function TestPiano(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt;
  1969 function TestPiano(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt;
  1970 const BOUNCES = 5;
  1970 // TODO: Test all 5 bounces
       
  1971 const BOUNCES = 1; // we only test 1 bounce to avoid the rating getting excessively high
  1971 var X, Y: real;
  1972 var X, Y: real;
  1972     dmg: array[0..BOUNCES-1] of LongInt;
  1973     dmg: array[0..BOUNCES-1] of LongInt;
  1973     i, e, rate, valueResult, targetY: LongInt;
  1974     i, e, rate, valueResult, targetY: LongInt;
  1974     firstHit, solidBounce: boolean;
  1975     firstHit, solidBounce: boolean;
  1975 begin
  1976 begin
  2012             // Don't change Y when indestructible land was hit
  2013             // Don't change Y when indestructible land was hit
  2013             solidBounce:= true;
  2014             solidBounce:= true;
  2014 
  2015 
  2015         for e:= -1 to 1 do
  2016         for e:= -1 to 1 do
  2016             begin
  2017             begin
       
  2018             // TODO: RateExplosion should remember hogs that already died in the simulation;
       
  2019             // because currently, dead hogs might still be counted for damage
  2017             rate:= RateExplosion(Me, trunc(X) + 30*e, trunc(Y)+40, 161, afIgnoreMe);
  2020             rate:= RateExplosion(Me, trunc(X) + 30*e, trunc(Y)+40, 161, afIgnoreMe);
  2018             if rate <> BadTurn then
  2021             if rate <> BadTurn then
  2019                 dmg[i]:= dmg[i] + rate;
  2022                 dmg[i]:= dmg[i] + rate;
  2020             end;
  2023             end;
  2021 
  2024