54 function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; |
54 function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; |
55 function TestColl(x, y, r: LongInt): boolean; |
55 function TestColl(x, y, r: LongInt): boolean; |
56 function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; |
56 function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; |
57 function RateShove(Me: PGear; x, y, r, power: LongInt): LongInt; |
57 function RateShove(Me: PGear; x, y, r, power: LongInt): LongInt; |
58 function RateShotgun(Me: PGear; x, y: LongInt): LongInt; |
58 function RateShotgun(Me: PGear; x, y: LongInt): LongInt; |
|
59 function RateHammer(Me: PGear): LongInt; |
59 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
60 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
60 function AIrndSign(num: LongInt): LongInt; |
61 function AIrndSign(num: LongInt): LongInt; |
61 |
62 |
62 var ThinkingHH: PGear; |
63 var ThinkingHH: PGear; |
63 Targets: TTargets; |
64 Targets: TTargets; |
229 end; |
230 end; |
230 // rate explosion |
231 // rate explosion |
231 for i:= 0 to Targets.Count do |
232 for i:= 0 to Targets.Count do |
232 with Targets.ar[i] do |
233 with Targets.ar[i] do |
233 begin |
234 begin |
234 dmg:= r + cHHRadius div 2 - hwRound(DistanceI(Point.x - x, Point.y - y)); |
235 dmg:= hwRound(_0_01 * cDamageModifier |
|
236 * min((r + cHHRadius div 2 - DistanceI(Point.x - x, Point.y - y).Round) div 2, r) * cDamagePercent); |
|
237 |
235 if dmg > 0 then |
238 if dmg > 0 then |
236 begin |
239 begin |
237 dmg:= min(dmg div 2, r); |
|
238 if dmg >= abs(Score) then |
240 if dmg >= abs(Score) then |
239 if Score > 0 then inc(rate, KillScore) |
241 if Score > 0 then inc(rate, KillScore) |
240 else dec(rate, KillScore * friendlyfactor div 100) |
242 else dec(rate, KillScore * friendlyfactor div 100) |
241 else |
243 else |
242 if Score > 0 then inc(rate, dmg) |
244 if Score > 0 then inc(rate, dmg) |
253 rate:= 0; |
255 rate:= 0; |
254 for i:= 0 to Pred(Targets.Count) do |
256 for i:= 0 to Pred(Targets.Count) do |
255 with Targets.ar[i] do |
257 with Targets.ar[i] do |
256 begin |
258 begin |
257 dmg:= r - hwRound(DistanceI(Point.x - x, Point.y - y)); |
259 dmg:= r - hwRound(DistanceI(Point.x - x, Point.y - y)); |
|
260 dmg:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent); |
258 if dmg > 0 then |
261 if dmg > 0 then |
259 begin |
262 begin |
260 if power >= abs(Score) then |
263 if power >= abs(Score) then |
261 if Score > 0 then inc(rate, KillScore) |
264 if Score > 0 then inc(rate, KillScore) |
262 else dec(rate, KillScore * friendlyfactor div 100) |
265 else dec(rate, KillScore * friendlyfactor div 100) |
267 end; |
270 end; |
268 RateShove:= rate * 1024 |
271 RateShove:= rate * 1024 |
269 end; |
272 end; |
270 |
273 |
271 function RateShotgun(Me: PGear; x, y: LongInt): LongInt; |
274 function RateShotgun(Me: PGear; x, y: LongInt): LongInt; |
272 const |
|
273 REUSE_BONUS = 1.35; |
|
274 var i, dmg, rate: LongInt; |
275 var i, dmg, rate: LongInt; |
275 begin |
276 begin |
276 rate:= 0; |
277 rate:= 0; |
277 // add our virtual position |
278 // add our virtual position |
278 with Targets.ar[Targets.Count] do |
279 with Targets.ar[Targets.Count] do |
283 end; |
284 end; |
284 // rate shot |
285 // rate shot |
285 for i:= 0 to Targets.Count do |
286 for i:= 0 to Targets.Count do |
286 with Targets.ar[i] do |
287 with Targets.ar[i] do |
287 begin |
288 begin |
288 dmg:= min(cHHRadius + cShotgunRadius - hwRound(DistanceI(Point.x - x, Point.y - y)), 25); |
289 dmg:= min(cHHRadius + cShotgunRadius + 4 - hwRound(DistanceI(Point.x - x, Point.y - y)), 25); |
289 dmg := round(dmg * REUSE_BONUS); |
290 dmg:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent); |
290 if dmg > 0 then |
291 if dmg > 0 then |
291 begin |
292 begin |
292 if dmg >= abs(Score) then dmg := KillScore; |
293 if dmg >= abs(Score) then dmg := KillScore; |
293 if Score > 0 then inc(rate, dmg) |
294 if Score > 0 then inc(rate, dmg) |
294 else dec(rate, dmg * friendlyfactor div 100); |
295 else dec(rate, dmg * friendlyfactor div 100); |
295 end; |
296 end; |
|
297 end; |
|
298 RateShotgun:= rate * 1024; |
|
299 end; |
|
300 |
|
301 function RateHammer(Me: PGear): LongInt; |
|
302 var x, y, i, r, rate: LongInt; |
|
303 begin |
|
304 // hammer hit shift against attecker hog is 10 |
|
305 x:= hwRound(Me^.X) + hwSign(Me^.dX) * 10; |
|
306 y:= hwRound(Me^.Y); |
|
307 rate:= 0; |
|
308 |
|
309 for i:= 0 to Pred(Targets.Count) do |
|
310 with Targets.ar[i] do |
|
311 begin |
|
312 // hammer hit radius is 8, shift is 10 |
|
313 r:= hwRound(DistanceI(Point.x - x, Point.y - y)); |
|
314 |
|
315 if r <= 18 then |
|
316 if Score > 0 then |
|
317 inc(rate, Score div 3) |
|
318 else |
|
319 inc(rate, Score div 3 * friendlyfactor div 100) |
296 end; |
320 end; |
297 RateShotgun:= rate * 1024; |
321 RateHammer:= rate * 1024; |
298 end; |
322 end; |
299 |
323 |
300 function HHJump(Gear: PGear; JumpType: TJumpType; var GoInfo: TGoInfo): boolean; |
324 function HHJump(Gear: PGear; JumpType: TJumpType; var GoInfo: TGoInfo): boolean; |
301 var bX, bY: LongInt; |
325 var bX, bY: LongInt; |
302 bRes: boolean; |
326 bRes: boolean; |