hedgewars/uAIMisc.pas
changeset 5642 0ce9e01bae56
parent 5604 d81727c49617
child 5645 b434ba5d064e
equal deleted inserted replaced
5640:07676ee23aff 5642:0ce9e01bae56
   229      end;
   229      end;
   230 // rate explosion
   230 // rate explosion
   231 for i:= 0 to Targets.Count do
   231 for i:= 0 to Targets.Count do
   232     with Targets.ar[i] do
   232     with Targets.ar[i] do
   233          begin
   233          begin
   234          dmg:= r + cHHRadius div 2 - hwRound(DistanceI(Point.x - x, Point.y - y));
   234          dmg:= hwRound(_0_01 * cDamageModifier
       
   235             * min((r + cHHRadius div 2 - DistanceI(Point.x - x, Point.y - y).Round) div 2, r) * cDamagePercent);
       
   236 
   235          if dmg > 0 then
   237          if dmg > 0 then
   236             begin
   238             begin
   237             dmg:= min(dmg div 2, r);
       
   238             if dmg >= abs(Score) then
   239             if dmg >= abs(Score) then
   239                if Score > 0 then inc(rate, KillScore)
   240                if Score > 0 then inc(rate, KillScore)
   240                             else dec(rate, KillScore * friendlyfactor div 100)
   241                             else dec(rate, KillScore * friendlyfactor div 100)
   241             else
   242             else
   242                if Score > 0 then inc(rate, dmg)
   243                if Score > 0 then inc(rate, dmg)
   253 rate:= 0;
   254 rate:= 0;
   254 for i:= 0 to Pred(Targets.Count) do
   255 for i:= 0 to Pred(Targets.Count) do
   255     with Targets.ar[i] do
   256     with Targets.ar[i] do
   256          begin
   257          begin
   257          dmg:= r - hwRound(DistanceI(Point.x - x, Point.y - y));
   258          dmg:= r - hwRound(DistanceI(Point.x - x, Point.y - y));
       
   259          dmg:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent);
   258          if dmg > 0 then
   260          if dmg > 0 then
   259             begin
   261             begin
   260             if power >= abs(Score) then
   262             if power >= abs(Score) then
   261                if Score > 0 then inc(rate, KillScore)
   263                if Score > 0 then inc(rate, KillScore)
   262                             else dec(rate, KillScore * friendlyfactor div 100)
   264                             else dec(rate, KillScore * friendlyfactor div 100)
   267          end;
   269          end;
   268 RateShove:= rate * 1024
   270 RateShove:= rate * 1024
   269 end;
   271 end;
   270 
   272 
   271 function RateShotgun(Me: PGear; x, y: LongInt): LongInt;
   273 function RateShotgun(Me: PGear; x, y: LongInt): LongInt;
   272 const
       
   273   REUSE_BONUS = 1.35;
       
   274 var i, dmg, rate: LongInt;
   274 var i, dmg, rate: LongInt;
   275 begin
   275 begin
   276 rate:= 0;
   276 rate:= 0;
   277 // add our virtual position
   277 // add our virtual position
   278 with Targets.ar[Targets.Count] do
   278 with Targets.ar[Targets.Count] do
   283      end;
   283      end;
   284 // rate shot
   284 // rate shot
   285 for i:= 0 to Targets.Count do
   285 for i:= 0 to Targets.Count do
   286     with Targets.ar[i] do
   286     with Targets.ar[i] do
   287          begin
   287          begin
   288          dmg:= min(cHHRadius + cShotgunRadius - hwRound(DistanceI(Point.x - x, Point.y - y)), 25);
   288          dmg:= min(cHHRadius + cShotgunRadius + 4 - hwRound(DistanceI(Point.x - x, Point.y - y)), 25);
   289          dmg := round(dmg * REUSE_BONUS);
   289          dmg:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent);
   290          if dmg > 0 then
   290          if dmg > 0 then
   291             begin
   291             begin
   292                 if dmg >= abs(Score) then dmg := KillScore;
   292                 if dmg >= abs(Score) then dmg := KillScore;
   293                 if Score > 0 then inc(rate, dmg)
   293                 if Score > 0 then inc(rate, dmg)
   294                 else dec(rate, dmg * friendlyfactor div 100);
   294                 else dec(rate, dmg * friendlyfactor div 100);
   295             end;
   295             end;
   296          end;
   296          end;        
   297 RateShotgun:= rate * 1024;
   297 RateShotgun:= rate * 1024;
   298 end;
   298 end;
   299 
   299 
   300 function HHJump(Gear: PGear; JumpType: TJumpType; var GoInfo: TGoInfo): boolean;
   300 function HHJump(Gear: PGear; JumpType: TJumpType; var GoInfo: TGoInfo): boolean;
   301 var bX, bY: LongInt;
   301 var bX, bY: LongInt;