98 if (Hedgehogs[i].Gear <> nil) |
99 if (Hedgehogs[i].Gear <> nil) |
99 and (Hedgehogs[i].Gear <> ThinkingHH) then |
100 and (Hedgehogs[i].Gear <> ThinkingHH) then |
100 begin |
101 begin |
101 with Targets.ar[Targets.Count], Hedgehogs[i] do |
102 with Targets.ar[Targets.Count], Hedgehogs[i] do |
102 begin |
103 begin |
|
104 skip:= false; |
103 Point.X:= hwRound(Gear^.X); |
105 Point.X:= hwRound(Gear^.X); |
104 Point.Y:= hwRound(Gear^.Y); |
106 Point.Y:= hwRound(Gear^.Y); |
105 if Clan <> CurrentTeam^.Clan then |
107 if Clan <> CurrentTeam^.Clan then |
106 begin |
108 begin |
107 Score:= Gear^.Health; |
109 Score:= Gear^.Health; |
394 dY:= gdY * 0.005 * kick; |
396 dY:= gdY * 0.005 * kick; |
395 dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; |
397 dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; |
396 rate:= 0; |
398 rate:= 0; |
397 for i:= 0 to Pred(Targets.Count) do |
399 for i:= 0 to Pred(Targets.Count) do |
398 with Targets.ar[i] do |
400 with Targets.ar[i] do |
|
401 if skip then |
|
402 if (Flags and fSetSkip = 0) then skip:= false else {still skip} |
|
403 else |
399 begin |
404 begin |
400 dmg:= 0; |
405 dmg:= 0; |
401 if abs(Point.x - x) + abs(Point.y - y) < r then |
406 if abs(Point.x - x) + abs(Point.y - y) < r then |
402 begin |
407 begin |
403 dmg:= r - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y))); |
408 dmg:= r - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y))); |
404 dmg:= trunc(dmg * dmgMod); |
409 dmg:= trunc(dmg * dmgMod); |
405 end; |
410 end; |
406 if dmg > 0 then |
411 if dmg > 0 then |
407 begin |
412 begin |
|
413 if (Flags and fSetSkip <> 0) then skip:= true; |
408 if (Flags and 1 <> 0) then |
414 if (Flags and 1 <> 0) then |
409 fallDmg:= trunc(TraceShoveFall(Me, Point.x, Point.y-2, dX, dY) * dmgMod); |
415 fallDmg:= trunc(TraceShoveFall(Me, Point.x, Point.y - 2, dX, dY) * dmgMod); |
410 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
416 if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI |
411 if Score > 0 then |
417 if Score > 0 then |
412 inc(rate, KillScore + Score div 10) // Add a bit of a bonus for bigger hog drownings |
418 inc(rate, KillScore + Score div 10) // Add a bit of a bonus for bigger hog drownings |
413 else |
419 else |
414 dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs |
420 dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs |