22 |
22 |
23 function TestBazooka(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
23 function TestBazooka(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
24 function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
24 function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
25 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
25 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
26 (*function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
26 (*function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
|
27 *) |
27 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
28 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
28 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
29 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
29 *) |
30 |
30 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
31 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
31 const AmmoTests: array[TAmmoType] of TAmmoTestProc = |
32 const AmmoTests: array[TAmmoType] of TAmmoTestProc = |
32 ( |
33 ( |
33 {amGrenade} @TestGrenade, |
34 {amGrenade} @TestGrenade, |
34 {amClusterBomb} nil, |
35 {amClusterBomb} nil, |
35 {amBazooka} @TestBazooka, |
36 {amBazooka} @TestBazooka, |
36 {amUFO} nil, |
37 {amUFO} nil, |
37 {amShotgun} @TestShotgun, |
38 {amShotgun} nil,//@TestShotgun, |
38 {amPickHammer} nil, |
39 {amPickHammer} nil, |
39 {amSkip} nil, |
40 {amSkip} nil, |
40 {amRope} nil, |
41 {amRope} nil, |
41 {amMine} nil, |
42 {amMine} nil, |
42 {amDEagle} nil,//TestDesertEagle, |
43 {amDEagle} nil,//TestDesertEagle, |
43 {amDynamite} nil, |
44 {amDynamite} nil, |
44 {amFirePunch} nil,//TestFirePunch, |
45 {amFirePunch} @TestFirePunch, |
45 {amBaseballBat} nil,//TestBaseballBat, |
46 {amBaseballBat} @TestBaseballBat, |
46 {amParachute} nil, |
47 {amParachute} nil, |
47 {amAirAttack} nil, |
48 {amAirAttack} nil, |
48 {amMineStrike} nil, |
49 {amMineStrike} nil, |
49 {amBlowTorch} nil, |
50 {amBlowTorch} nil, |
50 {amGirder} nil |
51 {amGirder} nil |
230 and (Land[round(y), round(x)] <> 0) then inc(d); |
231 and (Land[round(y), round(x)] <> 0) then inc(d); |
231 until (abs(Targ.X - x) + abs(Targ.Y - y) < 2) or (x < 0) or (y < 0) or (x > 2048) or (y > 1024) or (d > 200); |
232 until (abs(Targ.X - x) + abs(Targ.Y - y) < 2) or (x < 0) or (y < 0) or (x > 2048) or (y > 1024) or (d > 200); |
232 if abs(Targ.X - x) + abs(Targ.Y - y) < 2 then Result:= max(0, (4 - d div 50) * 7 * 1024) |
233 if abs(Targ.X - x) + abs(Targ.Y - y) < 2 then Result:= max(0, (4 - d div 50) * 7 * 1024) |
233 else Result:= Low(LongInt) |
234 else Result:= Low(LongInt) |
234 end; |
235 end; |
235 |
236 } |
236 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
237 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
237 begin |
238 var Result: LongInt; |
238 ExplR:= 0; |
239 begin |
239 if (Level > 2) and (abs(Me.X - Targ.X) + abs(Me.Y - Targ.Y) >= 25) then |
240 ExplR:= 0; |
240 begin |
241 if (Level > 2) and not (hwAbs(Me^.X - Targ.X) + hwAbs(Me^.Y - Targ.Y) < 25) then |
241 Result:= BadTurn; |
242 exit(BadTurn); |
242 exit |
243 |
243 end; |
244 Time:= 0; |
244 Time:= 0; |
245 Power:= 1; |
245 Power:= 1; |
246 Angle:= DxDy2AttackAngle(hwSign(Targ.X - Me^.X), 1); |
246 Angle:= DxDy2AttackAngle(hwSign(Targ.X - Me.X), 1); |
247 Result:= RateShove(Me, hwRound(Me^.X) + 10 * hwSign(Targ.X - Me^.X), hwRound(Me^.Y), 15, 30); |
247 Result:= RateShove(Me, round(Me.X) + 10 * hwSign(Targ.X - Me.X), round(Me.Y), 15, 30); |
248 if Result <= 0 then Result:= BadTurn else inc(Result); |
248 if Result <= 0 then Result:= BadTurn |
249 TestBaseballBat:= Result |
249 end; |
250 end; |
250 |
251 |
251 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
252 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var Time: Longword; var Angle, Power: LongInt; var ExplX, ExplY, ExplR: LongInt): LongInt; |
252 var i: LongInt; |
253 var i, Result: LongInt; |
253 begin |
254 begin |
254 ExplR:= 0; |
255 ExplR:= 0; |
255 if (abs(Me.X - Targ.X) > 25) or (abs(Me.Y - 50 - Targ.Y) > 50) then |
256 Time:= 0; |
256 begin |
257 Power:= 1; |
257 Result:= BadTurn; |
258 Angle:= 0; |
258 exit |
259 if (hwAbs(Me^.X - Targ.X) > 25) or (hwAbs(Me^.Y - 50 - Targ.Y) > 50) then |
259 end; |
260 exit(BadTurn); |
260 Time:= 0; |
261 |
261 Power:= 1; |
|
262 Angle:= DxDy2AttackAngle(hwSign(Targ.X - Me.X), 1); |
|
263 Result:= 0; |
262 Result:= 0; |
264 for i:= 0 to 4 do |
263 for i:= 0 to 4 do |
265 Result:= Result + RateShove(Me, round(Me.X) + 10 * hwSign(Targ.X - Me.X), round(Me.Y) - 20 * i - 5, 10, 30); |
264 Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(Targ.X - Me^.X), hwRound(Me^.Y) - 20 * i - 5, 10, 30); |
266 if Result <= 0 then Result:= BadTurn |
265 if Result <= 0 then Result:= BadTurn; |
267 end; |
266 TestFirePunch:= Result |
268 } |
267 end; |
|
268 |
269 end. |
269 end. |