39 function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
39 function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
40 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
40 function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
41 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
41 function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
42 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
42 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
43 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
43 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
|
44 function TestWhip(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
44 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
45 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
45 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
46 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
46 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
47 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
47 |
48 |
48 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
49 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
64 (proc: nil; flags: 0), // amRope |
65 (proc: nil; flags: 0), // amRope |
65 (proc: nil; flags: 0), // amMine |
66 (proc: nil; flags: 0), // amMine |
66 (proc: @TestDesertEagle; flags: 0), // amDEagle |
67 (proc: @TestDesertEagle; flags: 0), // amDEagle |
67 (proc: nil; flags: 0), // amDynamite |
68 (proc: nil; flags: 0), // amDynamite |
68 (proc: @TestFirePunch; flags: 0), // amFirePunch |
69 (proc: @TestFirePunch; flags: 0), // amFirePunch |
69 (proc: @TestFirePunch; flags: 0), // amWhip |
70 (proc: @TestWhip; flags: 0), // amWhip |
70 (proc: @TestBaseballBat; flags: 0), // amBaseballBat |
71 (proc: @TestBaseballBat; flags: 0), // amBaseballBat |
71 (proc: nil; flags: 0), // amParachute |
72 (proc: nil; flags: 0), // amParachute |
72 (proc: @TestAirAttack; flags: amtest_OnTurn), // amAirAttack |
73 (proc: @TestAirAttack; flags: amtest_OnTurn), // amAirAttack |
73 (proc: nil; flags: 0), // amMineStrike |
74 (proc: nil; flags: 0), // amMineStrike |
74 (proc: nil; flags: 0), // amBlowTorch |
75 (proc: nil; flags: 0), // amBlowTorch |
616 y:= Me^.Y; |
617 y:= Me^.Y; |
617 if (Targ.X) - hwRound(x) >= 0 then |
618 if (Targ.X) - hwRound(x) >= 0 then |
618 ap.Angle:= cMaxAngle div 4 |
619 ap.Angle:= cMaxAngle div 4 |
619 else |
620 else |
620 ap.Angle:= - cMaxAngle div 4; |
621 ap.Angle:= - cMaxAngle div 4; |
621 valueResult:= RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), hwRound(y), 15, 30); |
622 |
|
623 valueResult:= RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), hwRound(y), 15, 30, 115, hwSign(Me^.dX)*0.353, -0.353, 1); |
622 if valueResult <= 0 then |
624 if valueResult <= 0 then |
623 valueResult:= BadTurn |
625 valueResult:= BadTurn |
624 else |
626 else |
625 inc(valueResult); |
627 inc(valueResult); |
626 TestBaseballBat:= valueResult; |
628 TestBaseballBat:= valueResult; |
639 y:= Me^.Y; |
641 y:= Me^.Y; |
640 if (Abs(hwRound(x) - Targ.X) > 25) |
642 if (Abs(hwRound(x) - Targ.X) > 25) |
641 or (Abs(hwRound(y) - 50 - Targ.Y) > 50) then |
643 or (Abs(hwRound(y) - 50 - Targ.Y) > 50) then |
642 begin |
644 begin |
643 if TestColl(hwRound(x), hwRound(y) - 16, 6) |
645 if TestColl(hwRound(x), hwRound(y) - 16, 6) |
644 and (RateShove(Me, hwRound(x) + 10 * hwSign(Me^.dX), hwRound(y) - 40, 30, 30) = 0) then |
646 and (RateShove(Me, hwRound(x) + 10 * hwSign(Me^.dX), hwRound(y) - 40, 30, 30, 40, hwSign(Me^.dX)*0.45, -0.9, 1) = 0) then |
645 valueResult:= Succ(BadTurn) |
647 valueResult:= Succ(BadTurn) |
646 else |
648 else |
647 valueResult:= BadTurn; |
649 valueResult:= BadTurn; |
648 exit(valueResult) |
650 exit(valueResult) |
649 end; |
651 end; |
650 |
652 |
651 valueResult:= 0; |
653 valueResult:= 0; |
652 for i:= 0 to 4 do |
654 for i:= 0 to 4 do |
653 valueResult:= valueResult + RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), |
655 valueResult:= valueResult + RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), |
654 hwRound(y) - 20 * i - 5, 10, 30); |
656 hwRound(y) - 20 * i - 5, 10, 30, 40, hwSign(Me^.dX)*0.45, -0.9, 1); |
655 if valueResult <= 0 then |
657 if valueResult <= 0 then |
656 valueResult:= BadTurn |
658 valueResult:= BadTurn |
657 else |
659 else |
658 inc(valueResult); |
660 inc(valueResult); |
659 |
661 |
660 TestFirePunch:= valueResult; |
662 TestFirePunch:= valueResult; |
|
663 end; |
|
664 |
|
665 function TestWhip(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
|
666 var i, valueResult: LongInt; |
|
667 x, y: hwFloat; |
|
668 begin |
|
669 Level:= Level; // avoid compiler hint |
|
670 ap.ExplR:= 0; |
|
671 ap.Time:= 0; |
|
672 ap.Power:= 1; |
|
673 ap.Angle:= 0; |
|
674 x:= Me^.X; |
|
675 y:= Me^.Y; |
|
676 if (Abs(hwRound(x) - Targ.X) > 25) |
|
677 or (Abs(hwRound(y) - 50 - Targ.Y) > 50) then |
|
678 begin |
|
679 if TestColl(hwRound(x), hwRound(y) - 16, 6) |
|
680 and (RateShove(Me, hwRound(x) + 10 * hwSign(Me^.dX), hwRound(y) - 40, 30, 30, 40, hwSign(Me^.dX), -0.8, 1) = 0) then |
|
681 valueResult:= Succ(BadTurn) |
|
682 else |
|
683 valueResult:= BadTurn; |
|
684 exit(valueResult) |
|
685 end; |
|
686 |
|
687 valueResult:= 0; |
|
688 for i:= 0 to 4 do |
|
689 valueResult:= valueResult + RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), |
|
690 hwRound(y) - 20 * i - 5, 10, 30, 40, hwSign(Me^.dX), -0.8, 1); |
|
691 if valueResult <= 0 then |
|
692 valueResult:= BadTurn |
|
693 else |
|
694 inc(valueResult); |
|
695 |
|
696 TestWhip:= valueResult; |
661 end; |
697 end; |
662 |
698 |
663 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
699 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
664 var rate: LongInt; |
700 var rate: LongInt; |
665 begin |
701 begin |