48 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
48 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
49 function TestWhip(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
49 function TestWhip(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
50 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
50 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
51 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
51 function TestTeleport(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
52 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
52 function TestHammer(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
|
53 function TestCake(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
53 |
54 |
54 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
55 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
55 TAmmoTest = record |
56 TAmmoTest = record |
56 proc: TAmmoTestProc; |
57 proc: TAmmoTestProc; |
57 flags: Longword; |
58 flags: Longword; |
82 (proc: nil; flags: 0), // amTeleport |
83 (proc: nil; flags: 0), // amTeleport |
83 //(proc: @TestTeleport; flags: amtest_OnTurn), // amTeleport |
84 //(proc: @TestTeleport; flags: amtest_OnTurn), // amTeleport |
84 (proc: nil; flags: 0), // amSwitch |
85 (proc: nil; flags: 0), // amSwitch |
85 (proc: @TestMortar; flags: 0), // amMortar |
86 (proc: @TestMortar; flags: 0), // amMortar |
86 (proc: nil; flags: 0), // amKamikaze |
87 (proc: nil; flags: 0), // amKamikaze |
87 (proc: nil; flags: 0), // amCake |
88 (proc: @TestCake; flags: 0), // amCake |
88 (proc: nil; flags: 0), // amSeduction |
89 (proc: nil; flags: 0), // amSeduction |
89 (proc: @TestWatermelon; flags: 0), // amWatermelon |
90 (proc: @TestWatermelon; flags: 0), // amWatermelon |
90 (proc: nil; flags: 0), // amHellishBomb |
91 (proc: nil; flags: 0), // amHellishBomb |
91 (proc: nil; flags: 0), // amNapalm |
92 (proc: nil; flags: 0), // amNapalm |
92 (proc: nil; flags: 0), // amDrill |
93 (proc: nil; flags: 0), // amDrill |
979 TestTeleport := 0; |
980 TestTeleport := 0; |
980 end; |
981 end; |
981 end; |
982 end; |
982 end; |
983 end; |
983 |
984 |
|
985 |
|
986 function checkCakeWalk(Gear: PGear): LongInt; |
|
987 begin |
|
988 checkCakeWalk:= BadTurn |
|
989 end; |
|
990 |
|
991 function TestCake(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; |
|
992 var valueResult, v1, v2: LongInt; |
|
993 x, y, trackFall: LongInt; |
|
994 cake: TGear; |
|
995 begin |
|
996 Level:= Level; // avoid compiler hint |
|
997 ap.ExplR:= 0; |
|
998 ap.Time:= 0; |
|
999 ap.Power:= 1; |
|
1000 |
|
1001 cake.Radius:= 7; |
|
1002 |
|
1003 // check left direction |
|
1004 cake.Angle:= 3; |
|
1005 cake.dX.isNegative:= true; |
|
1006 cake.X:= Me^.X - _3; |
|
1007 cake.Y:= Me^.Y; |
|
1008 v1:= checkCakeWalk(@cake); |
|
1009 |
|
1010 // now try opposite direction |
|
1011 cake.Angle:= 1; |
|
1012 cake.dX.isNegative:= false; |
|
1013 cake.X:= Me^.X + _3; |
|
1014 cake.Y:= Me^.Y; |
|
1015 v2:= checkCakeWalk(@cake); |
|
1016 |
|
1017 if (v2 > v1) then |
|
1018 begin |
|
1019 ap.Angle:= 1; |
|
1020 valueResult:= v2 |
|
1021 end |
|
1022 else |
|
1023 begin |
|
1024 ap.Angle:= -1; |
|
1025 valueResult:= v1 |
|
1026 end; |
|
1027 |
|
1028 if valueResult <= 0 then |
|
1029 valueResult:= BadTurn; |
|
1030 |
|
1031 TestCake:= valueResult; |
|
1032 end; |
|
1033 |
984 end. |
1034 end. |