hedgewars/uAIAmmoTests.pas
changeset 8903 b35752efd5df
parent 8895 95177c18e38c
child 8924 13ac59499066
equal deleted inserted replaced
8901:505307b9735d 8903:b35752efd5df
   182             ap.ExplY:= EY;
   182             ap.ExplY:= EY;
   183             valueResult:= value
   183             valueResult:= value
   184             end;
   184             end;
   185         end
   185         end
   186 //until (value > 204800) or (rTime > 4250); not so useful since adding score to the drowning
   186 //until (value > 204800) or (rTime > 4250); not so useful since adding score to the drowning
   187 until rTime > 4250;
   187 until rTime > 5050 - Level * 800;
   188 TestBazooka:= valueResult
   188 TestBazooka:= valueResult
   189 end;
   189 end;
   190 
   190 
   191 
   191 
   192 function TestDrillRocket(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   192 function TestDrillRocket(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   262                 ap.ExplX:= EX;
   262                 ap.ExplX:= EX;
   263                 ap.ExplY:= EY;
   263                 ap.ExplY:= EY;
   264                 valueResult:= value-2500 // trying to make it slightly less attractive than a bazooka, to prevent waste.  AI could use awareness of weapon count
   264                 valueResult:= value-2500 // trying to make it slightly less attractive than a bazooka, to prevent waste.  AI could use awareness of weapon count
   265                 end;
   265                 end;
   266             end
   266             end
   267     until rTime > 4250;
   267     until rTime > 5050 - Level * 800;
   268     TestDrillRocket:= valueResult
   268     TestDrillRocket:= valueResult
   269 end;
   269 end;
   270 
   270 
   271 
   271 
   272 function TestSnowball(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   272 function TestSnowball(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   321             ap.ExplX:= EX;
   321             ap.ExplX:= EX;
   322             ap.ExplY:= EY;
   322             ap.ExplY:= EY;
   323             valueResult:= value
   323             valueResult:= value
   324             end;
   324             end;
   325      end
   325      end
   326 until (rTime > 4250);
   326 until (rTime > 5050 - Level * 800);
   327 TestSnowball:= valueResult
   327 TestSnowball:= valueResult
   328 end;
   328 end;
   329 
   329 
   330 function TestMolotov(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   330 function TestMolotov(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   331 var Vx, Vy, r: real;
   331 var Vx, Vy, r: real;
   372             ap.ExplX:= EX;
   372             ap.ExplX:= EX;
   373             ap.ExplY:= EY;
   373             ap.ExplY:= EY;
   374             valueResult:= Score
   374             valueResult:= Score
   375             end;
   375             end;
   376         end
   376         end
   377 until (TestTime > 4250);
   377 until (TestTime > 5050 - Level * 800);
   378 TestMolotov:= valueResult
   378 TestMolotov:= valueResult
   379 end;
   379 end;
   380 
   380 
   381 function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   381 function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   382 const tDelta = 24;
   382 const tDelta = 24;
   418     else 
   418     else 
   419         Score:= BadTurn;
   419         Score:= BadTurn;
   420 
   420 
   421     if (valueResult < Score) and (Score > 0) then
   421     if (valueResult < Score) and (Score > 0) then
   422         begin
   422         begin
   423         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
   423         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 3));
   424         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
   424         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 20);
   425         ap.Time:= TestTime;
   425         ap.Time:= TestTime;
   426         ap.ExplR:= 100;
   426         ap.ExplR:= 100;
   427         ap.ExplX:= EX;
   427         ap.ExplX:= EX;
   428         ap.ExplY:= EY;
   428         ap.ExplY:= EY;
   429         valueResult:= Score
   429         valueResult:= Score
   430         end;
   430         end;
   431     end
   431     end
   432 //until (Score > 204800) or (TestTime > 4000);
   432 //until (Score > 204800) or (TestTime > 4000);
   433 until TestTime > 4000;
   433 until TestTime > 4500 - Level * 512;
   434 TestGrenade:= valueResult
   434 TestGrenade:= valueResult
   435 end;
   435 end;
   436 
   436 
   437 function TestClusterBomb(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   437 function TestClusterBomb(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
   438 const tDelta = 24;
   438 const tDelta = 24;
   476     else 
   476     else 
   477         Score:= BadTurn;
   477         Score:= BadTurn;
   478 
   478 
   479      if valueResult < Score then
   479      if valueResult < Score then
   480         begin
   480         begin
   481         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level));
   481         ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 2));
   482         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
   482         ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15);
   483         ap.Time:= TestTime div 1000 * 1000;
   483         ap.Time:= TestTime div 1000 * 1000;
   484         ap.ExplR:= 90;
   484         ap.ExplR:= 90;
   485         ap.ExplX:= EX;
   485         ap.ExplX:= EX;
   486         ap.ExplY:= EY;
   486         ap.ExplY:= EY;