author | unc0rr |
Fri, 17 May 2013 00:07:37 +0400 | |
changeset 9005 | 15a6ed0bd074 |
parent 8998 | d38fb4158342 |
child 9080 | 9b42757d7e71 |
permissions | -rw-r--r-- |
71 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
71 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
71 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
71 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
71 | 17 |
*) |
18 |
||
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uAIAmmoTests; |
22 |
interface |
|
8959 | 23 |
uses SDLh, uConsts, uFloat, uTypes, uAIMisc; |
8924 | 24 |
const |
7789
838d2e06c377
Check cake and air attack again if walked far from initial position (not tested)
unc0rr
parents:
7760
diff
changeset
|
25 |
amtest_Rare = $00000001; // check only several positions |
7178
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
26 |
amtest_NoTarget = $00000002; // each pos, but no targetting |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
27 |
|
7078
a3408d9ba5ad
AI can't use cWindSpeedf since it now does a smooth transition
nemo
parents:
7041
diff
changeset
|
28 |
var windSpeed: real; |
a3408d9ba5ad
AI can't use cWindSpeedf since it now does a smooth transition
nemo
parents:
7041
diff
changeset
|
29 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
30 |
type TAttackParams = record |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
31 |
Time: Longword; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
32 |
Angle, Power: LongInt; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
33 |
ExplX, ExplY, ExplR: LongInt; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
34 |
AttackPutX, AttackPutY: LongInt; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
35 |
end; |
433 | 36 |
|
8959 | 37 |
function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
38 |
function TestSnowball(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
39 |
function TestGrenade(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
40 |
function TestMolotov(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
41 |
function TestClusterBomb(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
42 |
function TestWatermelon(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
43 |
function TestDrillRocket(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
44 |
function TestMortar(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
45 |
function TestShotgun(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
46 |
function TestDesertEagle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
47 |
function TestSniperRifle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
48 |
function TestBaseballBat(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
49 |
function TestFirePunch(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
50 |
function TestWhip(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
51 |
function TestKamikaze(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
52 |
function TestAirAttack(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
53 |
function TestTeleport(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
54 |
function TestHammer(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
55 |
function TestCake(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
56 |
|
8959 | 57 |
type TAmmoTestProc = function (Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
58 |
TAmmoTest = record |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
59 |
proc: TAmmoTestProc; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
60 |
flags: Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
61 |
end; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
62 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
63 |
const AmmoTests: array[TAmmoType] of TAmmoTest = |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
64 |
( |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
65 |
(proc: nil; flags: 0), // amNothing |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
66 |
(proc: @TestGrenade; flags: 0), // amGrenade |
2978 | 67 |
(proc: @TestClusterBomb; flags: 0), // amClusterBomb |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
68 |
(proc: @TestBazooka; flags: 0), // amBazooka |
3080 | 69 |
(proc: nil; flags: 0), // amBee |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
70 |
(proc: @TestShotgun; flags: 0), // amShotgun |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
71 |
(proc: nil; flags: 0), // amPickHammer |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
72 |
(proc: nil; flags: 0), // amSkip |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
73 |
(proc: nil; flags: 0), // amRope |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
74 |
(proc: nil; flags: 0), // amMine |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
75 |
(proc: @TestDesertEagle; flags: 0), // amDEagle |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
76 |
(proc: nil; flags: 0), // amDynamite |
7178
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
77 |
(proc: @TestFirePunch; flags: amtest_NoTarget), // amFirePunch |
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
78 |
(proc: @TestWhip; flags: amtest_NoTarget), // amWhip |
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
79 |
(proc: @TestBaseballBat; flags: amtest_NoTarget), // amBaseballBat |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
80 |
(proc: nil; flags: 0), // amParachute |
7789
838d2e06c377
Check cake and air attack again if walked far from initial position (not tested)
unc0rr
parents:
7760
diff
changeset
|
81 |
(proc: @TestAirAttack; flags: amtest_Rare), // amAirAttack |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
82 |
(proc: nil; flags: 0), // amMineStrike |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
83 |
(proc: nil; flags: 0), // amBlowTorch |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
84 |
(proc: nil; flags: 0), // amGirder |
3739 | 85 |
(proc: nil; flags: 0), // amTeleport |
86 |
//(proc: @TestTeleport; flags: amtest_OnTurn), // amTeleport |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
87 |
(proc: nil; flags: 0), // amSwitch |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
88 |
(proc: @TestMortar; flags: 0), // amMortar |
7471 | 89 |
(proc: @TestKamikaze; flags: 0), // amKamikaze |
7789
838d2e06c377
Check cake and air attack again if walked far from initial position (not tested)
unc0rr
parents:
7760
diff
changeset
|
90 |
(proc: @TestCake; flags: amtest_Rare or amtest_NoTarget), // amCake |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
91 |
(proc: nil; flags: 0), // amSeduction |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
92 |
(proc: @TestWatermelon; flags: 0), // amWatermelon |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
93 |
(proc: nil; flags: 0), // amHellishBomb |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
94 |
(proc: nil; flags: 0), // amNapalm |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
95 |
(proc: @TestDrillRocket; flags: 0), // amDrill |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
96 |
(proc: nil; flags: 0), // amBallgun |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
97 |
(proc: nil; flags: 0), // amRCPlane |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
98 |
(proc: nil; flags: 0), // amLowGravity |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
99 |
(proc: nil; flags: 0), // amExtraDamage |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
100 |
(proc: nil; flags: 0), // amInvulnerable |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
101 |
(proc: nil; flags: 0), // amExtraTime |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
102 |
(proc: nil; flags: 0), // amLaserSight |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
103 |
(proc: nil; flags: 0), // amVampiric |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
104 |
(proc: @TestSniperRifle; flags: 0), // amSniperRifle |
3342
b4f01613dcd7
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
nemo
parents:
3236
diff
changeset
|
105 |
(proc: nil; flags: 0), // amJetpack |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3022
diff
changeset
|
106 |
(proc: @TestMolotov; flags: 0), // amMolotov |
3350 | 107 |
(proc: nil; flags: 0), // amBirdy |
108 |
(proc: nil; flags: 0), // amPortalGun |
|
3382 | 109 |
(proc: nil; flags: 0), // amPiano |
3384 | 110 |
(proc: @TestGrenade; flags: 0), // amGasBomb |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3439
diff
changeset
|
111 |
(proc: @TestShotgun; flags: 0), // amSineGun |
3710 | 112 |
(proc: nil; flags: 0), // amFlamethrower |
3717 | 113 |
(proc: @TestGrenade; flags: 0), // amSMine |
7178
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
114 |
(proc: @TestHammer; flags: amtest_NoTarget), // amHammer |
4246
e5cb885492df
drillstrike! might require the drill patch to improve behavior
koda
parents:
4226
diff
changeset
|
115 |
(proc: nil; flags: 0), // amResurrector |
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4580
diff
changeset
|
116 |
(proc: nil; flags: 0), // amDrillStrike |
7078
a3408d9ba5ad
AI can't use cWindSpeedf since it now does a smooth transition
nemo
parents:
7041
diff
changeset
|
117 |
(proc: nil; flags: 0), // amSnowball |
4883
7cddc9201a1d
added dummy for tardis and ugly icons for tardis and structure
Henek
parents:
4881
diff
changeset
|
118 |
(proc: nil; flags: 0), // amTardis |
8161 | 119 |
//(proc: nil; flags: 0), // amStructure |
7007 | 120 |
(proc: nil; flags: 0), // amLandGun |
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7721
diff
changeset
|
121 |
(proc: nil; flags: 0), // amIceGun |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7721
diff
changeset
|
122 |
(proc: nil; flags: 0) // amKnife |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
123 |
); |
4 | 124 |
|
125 |
implementation |
|
8959 | 126 |
uses uVariables, uUtils, uGearsHandlers; |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
369
diff
changeset
|
127 |
|
5150
63ad8a648afd
Allow head of rope to attach to hogs/barrels/crates again. Rope still does not, to avoid the bug.
nemo
parents:
5024
diff
changeset
|
128 |
function Metric(x1, y1, x2, y2: LongInt): LongInt; inline; |
4 | 129 |
begin |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
369
diff
changeset
|
130 |
Metric:= abs(x1 - x2) + abs(y1 - y2) |
4 | 131 |
end; |
132 |
||
8959 | 133 |
function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
5151
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5150
diff
changeset
|
134 |
var Vx, Vy, r, mX, mY: real; |
498 | 135 |
rTime: LongInt; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
136 |
EX, EY: LongInt; |
2695 | 137 |
valueResult: LongInt; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
138 |
x, y, dX, dY: real; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
139 |
t: LongInt; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
140 |
value: LongInt; |
4 | 141 |
begin |
5151
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5150
diff
changeset
|
142 |
mX:= hwFloat2Float(Me^.X); |
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5150
diff
changeset
|
143 |
mY:= hwFloat2Float(Me^.Y); |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
144 |
ap.Time:= 0; |
375 | 145 |
rTime:= 350; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
146 |
ap.ExplR:= 0; |
2695 | 147 |
valueResult:= BadTurn; |
4 | 148 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
149 |
rTime:= rTime + 300 + Level * 50 + random(300); |
8959 | 150 |
Vx:= - windSpeed * rTime * 0.5 + (Targ.Point.X + AIrndSign(2) - mX) / rTime; |
151 |
Vy:= cGravityf * rTime * 0.5 - (Targ.Point.Y + 1 - mY) / rTime; |
|
6775 | 152 |
r:= sqr(Vx) + sqr(Vy); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
153 |
if not (r > 1) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
154 |
begin |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
155 |
x:= mX; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
156 |
y:= mY; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
157 |
dX:= Vx; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
158 |
dY:= -Vy; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
159 |
t:= rTime; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
160 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
161 |
x:= x + dX; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
162 |
y:= y + dY; |
7078
a3408d9ba5ad
AI can't use cWindSpeedf since it now does a smooth transition
nemo
parents:
7041
diff
changeset
|
163 |
dX:= dX + windSpeed; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
164 |
dY:= dY + cGravityf; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
165 |
dec(t) |
8924 | 166 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
8895 | 167 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t <= 0); |
8924 | 168 |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
169 |
EX:= trunc(x); |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
170 |
EY:= trunc(y); |
7471 | 171 |
if Level = 1 then |
7161
21a9c70b2070
Name the flags for fall tracking and indicating whether the explosion erases terrain.
nemo
parents:
7154
diff
changeset
|
172 |
value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
6767
ccbf07b38a43
First pass at making AI drowning aware. No concerns of performance, only applied to bazooka (not bat/fp etc)
nemo
parents:
6700
diff
changeset
|
173 |
else value:= RateExplosion(Me, EX, EY, 101); |
8998
d38fb4158342
trying to prevent the AI from attacking barrels. feedback on this welcome.
nemo
parents:
8974
diff
changeset
|
174 |
if (value = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then |
8959 | 175 |
value:= 1024 - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64; |
6775 | 176 |
if valueResult <= value then |
177 |
begin |
|
6894 | 178 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
6775 | 179 |
ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
180 |
ap.ExplR:= 100; |
|
181 |
ap.ExplX:= EX; |
|
182 |
ap.ExplY:= EY; |
|
183 |
valueResult:= value |
|
184 |
end; |
|
185 |
end |
|
6772 | 186 |
//until (value > 204800) or (rTime > 4250); not so useful since adding score to the drowning |
8903 | 187 |
until rTime > 5050 - Level * 800; |
2695 | 188 |
TestBazooka:= valueResult |
39 | 189 |
end; |
374 | 190 |
|
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
191 |
|
8959 | 192 |
function TestDrillRocket(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
193 |
var Vx, Vy, r, mX, mY: real; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
194 |
rTime: LongInt; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
195 |
EX, EY: LongInt; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
196 |
valueResult: LongInt; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
197 |
x, y, dX, dY: real; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
198 |
t: LongInt; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
199 |
value: LongInt; |
8777
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
200 |
t2: real; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
201 |
timer: Longint; |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
202 |
begin |
8822
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8777
diff
changeset
|
203 |
if (Level > 3) then exit(BadTurn); |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8777
diff
changeset
|
204 |
|
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
205 |
mX:= hwFloat2Float(Me^.X); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
206 |
mY:= hwFloat2Float(Me^.Y); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
207 |
ap.Time:= 0; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
208 |
rTime:= 350; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
209 |
ap.ExplR:= 0; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
210 |
valueResult:= BadTurn; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
211 |
repeat |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
212 |
rTime:= rTime + 300 + Level * 50 + random(300); |
8959 | 213 |
Vx:= - windSpeed * rTime * 0.5 + (Targ.Point.X + AIrndSign(2) - mX) / rTime; |
214 |
Vy:= cGravityf * rTime * 0.5 - (Targ.Point.Y - 35 - mY) / rTime; |
|
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
215 |
r:= sqr(Vx) + sqr(Vy); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
216 |
if not (r > 1) then |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
217 |
begin |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
218 |
x:= mX; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
219 |
y:= mY; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
220 |
dX:= Vx; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
221 |
dY:= -Vy; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
222 |
t:= rTime; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
223 |
repeat |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
224 |
x:= x + dX; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
225 |
y:= y + dY; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
226 |
dX:= dX + windSpeed; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
227 |
dY:= dY + cGravityf; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
228 |
dec(t) |
8924 | 229 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
8895 | 230 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (y > cWaterLine); |
8777
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
231 |
|
8959 | 232 |
if TestCollExcludingObjects(trunc(x), trunc(y), 5) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then |
8777
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
233 |
begin |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
234 |
timer := 500; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
235 |
t2 := 0.5 / sqrt(sqr(dX) + sqr(dY)); |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
236 |
dX := dX * t2; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
237 |
dY := dY * t2; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
238 |
repeat |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
239 |
x:= x + dX; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
240 |
y:= y + dY; |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
241 |
dec(timer); |
8959 | 242 |
until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 22) |
8777
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
243 |
or (x < 0) |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
244 |
or (y < 0) |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
245 |
or (trunc(x) > LAND_WIDTH) |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
246 |
or (trunc(y) > LAND_HEIGHT) |
8895 | 247 |
or not TestCollExcludingObjects(trunc(x), trunc(y), 5) |
8777
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
248 |
or (timer = 0) |
cce79a042cfc
merge. hate the fact that "unsynced remote changes" is just a "note" now.
nemo
parents:
8751
diff
changeset
|
249 |
end; |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
250 |
EX:= trunc(x); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
251 |
EY:= trunc(y); |
8862 | 252 |
// Try to prevent AI from thinking firing into water will cause a drowning |
8959 | 253 |
if (EY < cWaterLine-5) and (Timer > 0) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then exit(BadTurn); |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
254 |
if Level = 1 then |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
255 |
value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
256 |
else value:= RateExplosion(Me, EX, EY, 101); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
257 |
if valueResult <= value then |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
258 |
begin |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
259 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
260 |
ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
261 |
ap.ExplR:= 100; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
262 |
ap.ExplX:= EX; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
263 |
ap.ExplY:= EY; |
8824
fe9eacd390f2
Unbreak lua localisation, fix untranslated login prompt, update translations.
nemo
parents:
8822
diff
changeset
|
264 |
valueResult:= value-2500 // trying to make it slightly less attractive than a bazooka, to prevent waste. AI could use awareness of weapon count |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
265 |
end; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
266 |
end |
8903 | 267 |
until rTime > 5050 - Level * 800; |
8033
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
268 |
TestDrillRocket:= valueResult |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
269 |
end; |
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
270 |
|
4e40503e2b2c
Pretend AI knows how to use drill rocket (actually has no idea of drilling)
unc0rr
parents:
8013
diff
changeset
|
271 |
|
8959 | 272 |
function TestSnowball(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
6775 | 273 |
var Vx, Vy, r: real; |
4580 | 274 |
rTime: LongInt; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
275 |
EX, EY: LongInt; |
4580 | 276 |
valueResult: LongInt; |
6775 | 277 |
x, y, dX, dY, meX, meY: real; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
278 |
t: LongInt; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
279 |
value: LongInt; |
4580 | 280 |
|
281 |
begin |
|
6775 | 282 |
meX:= hwFloat2Float(Me^.X); |
283 |
meY:= hwFloat2Float(Me^.Y); |
|
4580 | 284 |
ap.Time:= 0; |
285 |
rTime:= 350; |
|
286 |
ap.ExplR:= 0; |
|
287 |
valueResult:= BadTurn; |
|
288 |
repeat |
|
6775 | 289 |
rTime:= rTime + 300 + Level * 50 + random(1000); |
8959 | 290 |
Vx:= - windSpeed * rTime * 0.5 + ((Targ.Point.X + AIrndSign(2)) - meX) / rTime; |
291 |
Vy:= cGravityf * rTime * 0.5 - (Targ.Point.Y - meY) / rTime; |
|
6775 | 292 |
r:= sqr(Vx) + sqr(Vy); |
293 |
if not (r > 1) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
294 |
begin |
6775 | 295 |
x:= meX; |
296 |
y:= meY; |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
297 |
dX:= Vx; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
298 |
dY:= -Vy; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
299 |
t:= rTime; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
300 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
301 |
x:= x + dX; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
302 |
y:= y + dY; |
7078
a3408d9ba5ad
AI can't use cWindSpeedf since it now does a smooth transition
nemo
parents:
7041
diff
changeset
|
303 |
dX:= dX + windSpeed; |
6775 | 304 |
dY:= dY + cGravityf; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
305 |
dec(t) |
8924 | 306 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
8895 | 307 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t <= 0); |
6775 | 308 |
EX:= trunc(x); |
309 |
EY:= trunc(y); |
|
310 |
||
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
311 |
value:= RateShove(Me, trunc(x), trunc(y), 5, 1, trunc((abs(dX)+abs(dY))*20), -dX, -dY, afTrackFall); |
8013 | 312 |
// LOL copypasta: this is score for digging with... snowball |
313 |
//if value = 0 then |
|
8959 | 314 |
// value:= - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
315 |
|
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
316 |
if valueResult <= value then |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
317 |
begin |
6894 | 318 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
6775 | 319 |
ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
320 |
ap.ExplR:= 0; |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
321 |
ap.ExplX:= EX; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
322 |
ap.ExplY:= EY; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
323 |
valueResult:= value |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
324 |
end; |
4580 | 325 |
end |
8903 | 326 |
until (rTime > 5050 - Level * 800); |
4580 | 327 |
TestSnowball:= valueResult |
328 |
end; |
|
329 |
||
8959 | 330 |
function TestMolotov(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
6775 | 331 |
var Vx, Vy, r: real; |
3018
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
332 |
Score, EX, EY, valueResult: LongInt; |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
333 |
TestTime: Longword; |
6775 | 334 |
x, y, dY, meX, meY: real; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
335 |
t: LongInt; |
3018
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
336 |
begin |
6775 | 337 |
meX:= hwFloat2Float(Me^.X); |
338 |
meY:= hwFloat2Float(Me^.Y); |
|
3018
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
339 |
valueResult:= BadTurn; |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
340 |
TestTime:= 0; |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
341 |
ap.ExplR:= 0; |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
342 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
343 |
inc(TestTime, 300); |
8959 | 344 |
Vx:= (Targ.Point.X - meX) / TestTime; |
345 |
Vy:= cGravityf * (TestTime div 2) - Targ.Point.Y - meY / TestTime; |
|
6775 | 346 |
r:= sqr(Vx) + sqr(Vy); |
347 |
if not (r > 1) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
348 |
begin |
6775 | 349 |
x:= meX; |
350 |
y:= meY; |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
351 |
dY:= -Vy; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
352 |
t:= TestTime; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
353 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
354 |
x:= x + Vx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
355 |
y:= y + dY; |
6775 | 356 |
dY:= dY + cGravityf; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
357 |
dec(t) |
8924 | 358 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or |
8895 | 359 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 6))) or (t = 0); |
6775 | 360 |
EX:= trunc(x); |
361 |
EY:= trunc(y); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
362 |
if t < 50 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
363 |
Score:= RateExplosion(Me, EX, EY, 97) // average of 17 attempts, most good, but some failing spectacularly |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
364 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
365 |
Score:= BadTurn; |
8924 | 366 |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
367 |
if valueResult < Score then |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
368 |
begin |
6894 | 369 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
6775 | 370 |
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
371 |
ap.ExplR:= 100; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
372 |
ap.ExplX:= EX; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
373 |
ap.ExplY:= EY; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
374 |
valueResult:= Score |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
375 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
376 |
end |
8903 | 377 |
until (TestTime > 5050 - Level * 800); |
3018
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
378 |
TestMolotov:= valueResult |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
379 |
end; |
13ceaad4767e
Adjust tests for cluster and watermelon, add molotov, assign FP test to whip, try to keep AI from attempting fire walking.
nemo
parents:
2978
diff
changeset
|
380 |
|
8959 | 381 |
function TestGrenade(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
70 | 382 |
const tDelta = 24; |
6775 | 383 |
var Vx, Vy, r: real; |
2695 | 384 |
Score, EX, EY, valueResult: LongInt; |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
385 |
TestTime: Longword; |
6775 | 386 |
x, y, meX, meY, dY: real; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
387 |
t: LongInt; |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
388 |
begin |
2695 | 389 |
valueResult:= BadTurn; |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
390 |
TestTime:= 0; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
391 |
ap.ExplR:= 0; |
6775 | 392 |
meX:= hwFloat2Float(Me^.X); |
393 |
meY:= hwFloat2Float(Me^.Y); |
|
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
394 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
395 |
inc(TestTime, 1000); |
8959 | 396 |
Vx:= (Targ.Point.X - meX) / (TestTime + tDelta); |
397 |
Vy:= cGravityf * ((TestTime + tDelta) div 2) - (Targ.Point.Y - meY) / (TestTime + tDelta); |
|
6775 | 398 |
r:= sqr(Vx) + sqr(Vy); |
399 |
if not (r > 1) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
400 |
begin |
6775 | 401 |
x:= meX; |
8924 | 402 |
y:= meY; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
403 |
dY:= -Vy; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
404 |
t:= TestTime; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
405 |
repeat |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
406 |
x:= x + Vx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
407 |
y:= y + dY; |
6775 | 408 |
dY:= dY + cGravityf; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
409 |
dec(t) |
8924 | 410 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
8895 | 411 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t = 0); |
6775 | 412 |
EX:= trunc(x); |
413 |
EY:= trunc(y); |
|
8924 | 414 |
if t < 50 then |
7471 | 415 |
if Level = 1 then |
7161
21a9c70b2070
Name the flags for fall tracking and indicating whether the explosion erases terrain.
nemo
parents:
7154
diff
changeset
|
416 |
Score:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
6769
44ad49a3a126
Add drowning to grenade too, try some little optimisations
nemo
parents:
6767
diff
changeset
|
417 |
else Score:= RateExplosion(Me, EX, EY, 101) |
8924 | 418 |
else |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
419 |
Score:= BadTurn; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
420 |
|
8013 | 421 |
if (valueResult < Score) and (Score > 0) then |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
422 |
begin |
8903 | 423 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 3)); |
424 |
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 20); |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
425 |
ap.Time:= TestTime; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
426 |
ap.ExplR:= 100; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
427 |
ap.ExplX:= EX; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
428 |
ap.ExplY:= EY; |
2695 | 429 |
valueResult:= Score |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
430 |
end; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
431 |
end |
6772 | 432 |
//until (Score > 204800) or (TestTime > 4000); |
8903 | 433 |
until TestTime > 4500 - Level * 512; |
2695 | 434 |
TestGrenade:= valueResult |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
435 |
end; |
375 | 436 |
|
8959 | 437 |
function TestClusterBomb(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
2978 | 438 |
const tDelta = 24; |
6775 | 439 |
var Vx, Vy, r: real; |
2978 | 440 |
Score, EX, EY, valueResult: LongInt; |
441 |
TestTime: Longword; |
|
6775 | 442 |
x, y, dY, meX, meY: real; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
443 |
t: LongInt; |
2978 | 444 |
begin |
445 |
valueResult:= BadTurn; |
|
7441 | 446 |
TestTime:= 500; |
2978 | 447 |
ap.ExplR:= 0; |
6775 | 448 |
meX:= hwFloat2Float(Me^.X); |
449 |
meY:= hwFloat2Float(Me^.Y); |
|
2978 | 450 |
repeat |
7441 | 451 |
inc(TestTime, 900); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
452 |
// Try to overshoot slightly, seems to pay slightly better dividends in terms of hitting cluster |
8959 | 453 |
if meX<Targ.Point.X then |
454 |
Vx:= ((Targ.Point.X+10) - meX) / (TestTime + tDelta) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
455 |
else |
8959 | 456 |
Vx:= ((Targ.Point.X-10) - meX) / (TestTime + tDelta); |
457 |
Vy:= cGravityf * ((TestTime + tDelta) div 2) - ((Targ.Point.Y-50) - meY) / (TestTime + tDelta); |
|
6775 | 458 |
r:= sqr(Vx)+sqr(Vy); |
459 |
if not (r > 1) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
460 |
begin |
6775 | 461 |
x:= meX; |
462 |
y:= meY; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
463 |
dY:= -Vy; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
464 |
t:= TestTime; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
465 |
repeat |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
466 |
x:= x + Vx; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
467 |
y:= y + dY; |
6775 | 468 |
dY:= dY + cGravityf; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
469 |
dec(t) |
8924 | 470 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
8895 | 471 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t = 0); |
6775 | 472 |
EX:= trunc(x); |
473 |
EY:= trunc(y); |
|
8924 | 474 |
if t < 50 then |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
475 |
Score:= RateExplosion(Me, EX, EY, 41) |
8924 | 476 |
else |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
477 |
Score:= BadTurn; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
478 |
|
8974
d360e97ce842
I don't see how rating these against others is useful, given the limited radius, and the cluster bomb thing just seems counterproductive. Anyway, this prevents AI from picking on barrels.
nemo
parents:
8971
diff
changeset
|
479 |
if Score > 0 then |
2978 | 480 |
begin |
8903 | 481 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level * 2)); |
7132 | 482 |
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
7441 | 483 |
ap.Time:= TestTime div 1000 * 1000; |
2978 | 484 |
ap.ExplR:= 90; |
485 |
ap.ExplX:= EX; |
|
486 |
ap.ExplY:= EY; |
|
487 |
valueResult:= Score |
|
488 |
end; |
|
489 |
end |
|
7441 | 490 |
until (TestTime = 4100); |
2978 | 491 |
TestClusterBomb:= valueResult |
492 |
end; |
|
493 |
||
8959 | 494 |
function TestWatermelon(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
495 |
const tDelta = 24; |
6775 | 496 |
var Vx, Vy, r: real; |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
497 |
Score, EX, EY, valueResult: LongInt; |
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
498 |
TestTime: Longword; |
6775 | 499 |
x, y, dY, meX, meY: real; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
500 |
t: LongInt; |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
501 |
begin |
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
502 |
valueResult:= BadTurn; |
7441 | 503 |
TestTime:= 500; |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
504 |
ap.ExplR:= 0; |
6775 | 505 |
meX:= hwFloat2Float(Me^.X); |
506 |
meY:= hwFloat2Float(Me^.Y); |
|
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
507 |
repeat |
7441 | 508 |
inc(TestTime, 900); |
8959 | 509 |
Vx:= (Targ.Point.X - meX) / (TestTime + tDelta); |
510 |
Vy:= cGravityf * ((TestTime + tDelta) div 2) - ((Targ.Point.Y-50) - meY) / (TestTime + tDelta); |
|
6775 | 511 |
r:= sqr(Vx)+sqr(Vy); |
512 |
if not (r > 1) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
513 |
begin |
6775 | 514 |
x:= meX; |
515 |
y:= meY; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
516 |
dY:= -Vy; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
517 |
t:= TestTime; |
7132 | 518 |
repeat |
519 |
x:= x + Vx; |
|
520 |
y:= y + dY; |
|
521 |
dY:= dY + cGravityf; |
|
522 |
dec(t) |
|
8924 | 523 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or |
8895 | 524 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 6))) or (t = 0); |
8924 | 525 |
|
7132 | 526 |
EX:= trunc(x); |
527 |
EY:= trunc(y); |
|
8924 | 528 |
if t < 50 then |
7132 | 529 |
Score:= RateExplosion(Me, EX, EY, 200) + RateExplosion(Me, EX, EY + 120, 200) |
8924 | 530 |
else |
7132 | 531 |
Score:= BadTurn; |
8924 | 532 |
|
7132 | 533 |
if valueResult < Score then |
534 |
begin |
|
535 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
|
536 |
ap.Power:= trunc(sqrt(r) * cMaxPower) + AIrndSign(random(Level) * 15); |
|
7441 | 537 |
ap.Time:= TestTime div 1000 * 1000; |
7132 | 538 |
ap.ExplR:= 300; |
539 |
ap.ExplX:= EX; |
|
540 |
ap.ExplY:= EY; |
|
541 |
valueResult:= Score |
|
542 |
end; |
|
543 |
end |
|
7441 | 544 |
until (TestTime = 4100); |
2973
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
545 |
TestWatermelon:= valueResult |
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
546 |
end; |
b51a0f57cd43
Crude copy of grenade routine to allow AI to use watermelon bomb with reasonable lethalness.
nemo
parents:
2948
diff
changeset
|
547 |
|
994 | 548 |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
549 |
function Solve(TX, TY, MX, MY: LongInt): LongWord; |
6775 | 550 |
var A, B, D, T: real; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
551 |
C: LongInt; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
552 |
begin |
7132 | 553 |
A:= sqr(cGravityf); |
6775 | 554 |
B:= - cGravityf * (TY - MY) - 1; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
555 |
C:= sqr(TY - MY) + sqr(TX - MX); |
7132 | 556 |
D:= sqr(B) - A * C; |
6775 | 557 |
if D >= 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
558 |
begin |
7132 | 559 |
D:= sqrt(D) - B; |
6775 | 560 |
if D >= 0 then |
7132 | 561 |
T:= sqrt(D * 2 / A) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
562 |
else |
6775 | 563 |
T:= 0; |
564 |
Solve:= trunc(T) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
565 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
566 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
567 |
Solve:= 0 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
568 |
end; |
8924 | 569 |
|
8959 | 570 |
function TestMortar(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
571 |
//const tDelta = 24; |
6775 | 572 |
var Vx, Vy: real; |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
573 |
Score, EX, EY: LongInt; |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
574 |
TestTime: Longword; |
6775 | 575 |
x, y, dY, meX, meY: real; |
994 | 576 |
begin |
7041 | 577 |
TestMortar:= BadTurn; |
578 |
ap.ExplR:= 0; |
|
7790 | 579 |
|
7041 | 580 |
meX:= hwFloat2Float(Me^.X); |
581 |
meY:= hwFloat2Float(Me^.Y); |
|
994 | 582 |
|
7041 | 583 |
if (Level > 2) then |
584 |
exit(BadTurn); |
|
994 | 585 |
|
8959 | 586 |
TestTime:= Solve(Targ.Point.X, Targ.Point.Y, trunc(meX), trunc(meY)); |
994 | 587 |
|
7041 | 588 |
if TestTime = 0 then |
589 |
exit(BadTurn); |
|
994 | 590 |
|
8959 | 591 |
Vx:= (Targ.Point.X - meX) / TestTime; |
592 |
Vy:= cGravityf * (TestTime div 2) - (Targ.Point.Y - meY) / TestTime; |
|
994 | 593 |
|
6775 | 594 |
x:= meX; |
595 |
y:= meY; |
|
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
596 |
dY:= -Vy; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
597 |
|
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
598 |
repeat |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
599 |
x:= x + Vx; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
600 |
y:= y + dY; |
6775 | 601 |
dY:= dY + cGravityf; |
602 |
EX:= trunc(x); |
|
603 |
EY:= trunc(y); |
|
8924 | 604 |
until (((Me = CurrentHedgehog^.Gear) and TestColl(EX, EY, 4)) or |
8895 | 605 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, EX, EY, 4))) or (EY > cWaterLine); |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
606 |
|
6775 | 607 |
if (EY < cWaterLine) and (dY >= 0) then |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
608 |
begin |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
609 |
Score:= RateExplosion(Me, EX, EY, 91); |
9005 | 610 |
if (Score = 0) then |
611 |
if (dY > 0.15) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then |
|
8959 | 612 |
Score:= - abs(Targ.Point.Y - EY) div 32 |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
613 |
else |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
614 |
Score:= BadTurn |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
615 |
else if (Score < 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
616 |
Score:= BadTurn |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
617 |
end |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
618 |
else |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
619 |
Score:= BadTurn; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6453
diff
changeset
|
620 |
|
8998
d38fb4158342
trying to prevent the AI from attacking barrels. feedback on this welcome.
nemo
parents:
8974
diff
changeset
|
621 |
if Score > 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
622 |
begin |
6894 | 623 |
ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random(Level)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
624 |
ap.Power:= 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
625 |
ap.ExplR:= 100; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
626 |
ap.ExplX:= EX; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
627 |
ap.ExplY:= EY; |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
628 |
TestMortar:= Score |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2695
diff
changeset
|
629 |
end; |
994 | 630 |
end; |
631 |
||
8959 | 632 |
function TestShotgun(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
1941 | 633 |
const |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
634 |
MIN_RANGE = 80; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
635 |
MAX_RANGE = 400; |
6775 | 636 |
var Vx, Vy, x, y: real; |
2695 | 637 |
rx, ry, valueResult: LongInt; |
1941 | 638 |
range: integer; |
375 | 639 |
begin |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
640 |
TestShotgun:= BadTurn; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
641 |
ap.ExplR:= 0; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
642 |
ap.Time:= 0; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
643 |
ap.Power:= 1; |
6775 | 644 |
x:= hwFloat2Float(Me^.X); |
645 |
y:= hwFloat2Float(Me^.Y); |
|
8959 | 646 |
range:= Metric(trunc(x), trunc(y), Targ.Point.X, Targ.Point.Y); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
647 |
if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then |
7041 | 648 |
exit(BadTurn); |
649 |
||
8959 | 650 |
Vx:= (Targ.Point.X - x) * 1 / 1024; |
651 |
Vy:= (Targ.Point.Y - y) * 1 / 1024; |
|
6894 | 652 |
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); |
70 | 653 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
654 |
x:= x + vX; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
655 |
y:= y + vY; |
6775 | 656 |
rx:= trunc(x); |
657 |
ry:= trunc(y); |
|
8924 | 658 |
if ((Me = CurrentHedgehog^.Gear) and TestColl(rx, ry, 2)) or |
8895 | 659 |
((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, rx, ry, 2)) then |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
660 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
661 |
x:= x + vX * 8; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
662 |
y:= y + vY * 8; |
6775 | 663 |
valueResult:= RateShotgun(Me, vX, vY, rx, ry); |
8924 | 664 |
|
8998
d38fb4158342
trying to prevent the AI from attacking barrels. feedback on this welcome.
nemo
parents:
8974
diff
changeset
|
665 |
if (valueResult = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then |
8959 | 666 |
valueResult:= 1024 - Metric(Targ.Point.X, Targ.Point.Y, rx, ry) div 64 |
8924 | 667 |
else |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
668 |
dec(valueResult, Level * 4000); |
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6894
diff
changeset
|
669 |
// 27/20 is reuse bonus |
7041 | 670 |
exit(valueResult * 27 div 20) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
671 |
end |
8959 | 672 |
until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4) |
6775 | 673 |
or (x < 0) |
674 |
or (y < 0) |
|
675 |
or (trunc(x) > LAND_WIDTH) |
|
676 |
or (trunc(y) > LAND_HEIGHT); |
|
4157 | 677 |
|
375 | 678 |
TestShotgun:= BadTurn |
70 | 679 |
end; |
438 | 680 |
|
8959 | 681 |
function TestDesertEagle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8959
diff
changeset
|
682 |
var Vx, Vy, x, y, t: real; |
75 | 683 |
d: Longword; |
6783 | 684 |
fallDmg, valueResult: LongInt; |
75 | 685 |
begin |
8974
d360e97ce842
I don't see how rating these against others is useful, given the limited radius, and the cluster bomb thing just seems counterproductive. Anyway, this prevents AI from picking on barrels.
nemo
parents:
8971
diff
changeset
|
686 |
if (Level > 4) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn); |
3407 | 687 |
Level:= Level; // avoid compiler hint |
8952
a6ee1e7310fb
trying to make AI aware of mine/explosive break point. also remove redundant test.
nemo
parents:
8950
diff
changeset
|
688 |
ap.ExplR:= 1; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
689 |
ap.Time:= 0; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
690 |
ap.Power:= 1; |
7471 | 691 |
|
6775 | 692 |
x:= hwFloat2Float(Me^.X); |
693 |
y:= hwFloat2Float(Me^.Y); |
|
7471 | 694 |
|
8959 | 695 |
if Abs(trunc(x) - Targ.Point.X) + Abs(trunc(y) - Targ.Point.Y) < 20 then |
7041 | 696 |
exit(BadTurn); |
7471 | 697 |
|
8959 | 698 |
t:= 2 / sqrt(sqr(Targ.Point.X - x)+sqr(Targ.Point.Y-y)); |
699 |
Vx:= (Targ.Point.X - x) * t; |
|
700 |
Vy:= (Targ.Point.Y - y) * t; |
|
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
701 |
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
702 |
d:= 0; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
703 |
|
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
704 |
repeat |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
705 |
x:= x + vX; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
706 |
y:= y + vY; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
707 |
if ((trunc(x) and LAND_WIDTH_MASK) = 0)and((trunc(y) and LAND_HEIGHT_MASK) = 0) |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
708 |
and (Land[trunc(y), trunc(x)] <> 0) then |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
709 |
inc(d); |
8959 | 710 |
until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 5) |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
711 |
or (x < 0) |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
712 |
or (y < 0) |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
713 |
or (trunc(x) > LAND_WIDTH) |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
714 |
or (trunc(y) > LAND_HEIGHT) |
7760
ccc8bd5205ff
Tweak TestDesertEagle. Bots should prefer direct shots to shots through land now, but I didn't test that yet.
unc0rr
parents:
7752
diff
changeset
|
715 |
or (d > 48); |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
716 |
|
8959 | 717 |
if Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 5 then |
718 |
valueResult:= RateShove(Me, Targ.Point.X, Targ.Point.Y, 1, 7, 20, vX*0.125, vY*0.125, afTrackFall) |
|
8952
a6ee1e7310fb
trying to make AI aware of mine/explosive break point. also remove redundant test.
nemo
parents:
8950
diff
changeset
|
719 |
else valueResult:= BadTurn; |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
720 |
TestDesertEagle:= valueResult |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
721 |
end; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
722 |
|
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
723 |
|
8959 | 724 |
function TestSniperRifle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8959
diff
changeset
|
725 |
var Vx, Vy, x, y, t, dmg: real; |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
726 |
d: Longword; |
7716 | 727 |
fallDmg: LongInt; |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
728 |
begin |
8974
d360e97ce842
I don't see how rating these against others is useful, given the limited radius, and the cluster bomb thing just seems counterproductive. Anyway, this prevents AI from picking on barrels.
nemo
parents:
8971
diff
changeset
|
729 |
if (Level > 3) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn); |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
730 |
Level:= Level; // avoid compiler hint |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
731 |
ap.ExplR:= 0; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
732 |
ap.Time:= 0; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
733 |
ap.Power:= 1; |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
734 |
x:= hwFloat2Float(Me^.X); |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
735 |
y:= hwFloat2Float(Me^.Y); |
8959 | 736 |
if Abs(trunc(x) - Targ.Point.X) + Abs(trunc(y) - Targ.Point.Y) < 40 then |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
737 |
exit(BadTurn); |
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
738 |
|
8959 | 739 |
dmg:= sqrt(sqr(Targ.Point.X - x)+sqr(Targ.Point.Y-y)); |
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
740 |
t:= 1.5 / dmg; |
7208
62e36dc45098
Ignore all objects for fall tracing with shove to avoid considering checkins as obstacles. many objects will get knocked by the kick anyway, so end result should be pretty good. Oh, and ditch the sniper rifle doubling.
nemo
parents:
7206
diff
changeset
|
741 |
dmg:= dmg * 0.025; // div 40 |
8959 | 742 |
Vx:= (Targ.Point.X - x) * t; |
743 |
Vy:= (Targ.Point.Y - y) * t; |
|
6894 | 744 |
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); |
75 | 745 |
d:= 0; |
1941 | 746 |
|
75 | 747 |
repeat |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
748 |
x:= x + vX; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
749 |
y:= y + vY; |
6775 | 750 |
if ((trunc(x) and LAND_WIDTH_MASK) = 0)and((trunc(y) and LAND_HEIGHT_MASK) = 0) |
751 |
and (Land[trunc(y), trunc(x)] <> 0) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
752 |
inc(d); |
8959 | 753 |
until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4) |
6775 | 754 |
or (x < 0) |
755 |
or (y < 0) |
|
756 |
or (trunc(x) > LAND_WIDTH) |
|
757 |
or (trunc(y) > LAND_HEIGHT) |
|
7873 | 758 |
or (d > 22); |
1941 | 759 |
|
8959 | 760 |
if Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4 then |
761 |
TestSniperRifle:= RateShove(Me, Targ.Point.X, Targ.Point.Y, 1, trunc(dmg), 20, vX*0.166, vY*0.166, afTrackFall) |
|
8952
a6ee1e7310fb
trying to make AI aware of mine/explosive break point. also remove redundant test.
nemo
parents:
8950
diff
changeset
|
762 |
else TestSniperRifle:= BadTurn; |
75 | 763 |
end; |
438 | 764 |
|
7197
5a9775b97c7e
- TestSniperRifle ftw (still needs some consts adjustments, because AI seems to love sniper rifle too much)
unc0rr
parents:
7178
diff
changeset
|
765 |
|
8959 | 766 |
function TestBaseballBat(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
7212 | 767 |
var valueResult, a, v1, v2: LongInt; |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
768 |
x, y, trackFall: LongInt; |
7212 | 769 |
dx, dy: real; |
79 | 770 |
begin |
7716 | 771 |
Targ:= Targ; // avoid compiler hint |
772 |
||
7471 | 773 |
if Level < 3 then trackFall:= afTrackFall |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
774 |
else trackFall:= 0; |
7471 | 775 |
|
7212 | 776 |
ap.ExplR:= 0; |
777 |
ap.Time:= 0; |
|
778 |
ap.Power:= 1; |
|
779 |
x:= hwRound(Me^.X); |
|
780 |
y:= hwRound(Me^.Y); |
|
781 |
||
7424
fe0f07667f24
Prefer to bat enemy away dealing the same amount of damage
unc0rr
parents:
7416
diff
changeset
|
782 |
a:= cMaxAngle div 2; |
7212 | 783 |
valueResult:= 0; |
784 |
||
7424
fe0f07667f24
Prefer to bat enemy away dealing the same amount of damage
unc0rr
parents:
7416
diff
changeset
|
785 |
while a >= 0 do |
7212 | 786 |
begin |
787 |
dx:= sin(a / cMaxAngle * pi) * 0.5; |
|
788 |
dy:= cos(a / cMaxAngle * pi) * 0.5; |
|
433 | 789 |
|
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
790 |
v1:= RateShove(Me, x - 10, y + 2 |
7427 | 791 |
, 32, 30, 115 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
792 |
, -dx, -dy, trackFall); |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
793 |
v2:= RateShove(Me, x + 10, y + 2 |
7427 | 794 |
, 32, 30, 115 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
795 |
, dx, -dy, trackFall); |
7212 | 796 |
if (v1 > valueResult) or (v2 > valueResult) then |
8924 | 797 |
if (v2 > v1) |
7212 | 798 |
or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then |
799 |
begin |
|
800 |
ap.Angle:= a; |
|
801 |
valueResult:= v2 |
|
802 |
end |
|
8924 | 803 |
else |
7212 | 804 |
begin |
805 |
ap.Angle:= -a; |
|
806 |
valueResult:= v1 |
|
807 |
end; |
|
6770
7d2c6cdb816a
Start on adding drowning bonus to bat/firepunch/whip. AI still is not smart enough to change direction when firepunching to face the water, or change the angle of the bat.
nemo
parents:
6769
diff
changeset
|
808 |
|
7424
fe0f07667f24
Prefer to bat enemy away dealing the same amount of damage
unc0rr
parents:
7416
diff
changeset
|
809 |
a:= a - 15 - random(cMaxAngle div 16) |
7212 | 810 |
end; |
8924 | 811 |
|
7212 | 812 |
if valueResult <= 0 then |
813 |
valueResult:= BadTurn; |
|
814 |
||
815 |
TestBaseballBat:= valueResult; |
|
79 | 816 |
end; |
817 |
||
8959 | 818 |
function TestFirePunch(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
819 |
var valueResult, v1, v2, i: LongInt; |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
820 |
x, y, trackFall: LongInt; |
82 | 821 |
begin |
7716 | 822 |
Targ:= Targ; // avoid compiler hint |
823 |
||
7471 | 824 |
if Level = 1 then trackFall:= afTrackFall |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
825 |
else trackFall:= 0; |
7471 | 826 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
827 |
ap.ExplR:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
828 |
ap.Time:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
829 |
ap.Power:= 1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
830 |
x:= hwRound(Me^.X); |
7427 | 831 |
y:= hwRound(Me^.Y) + 4; |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
832 |
|
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
833 |
v1:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
834 |
for i:= 0 to 8 do |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
835 |
begin |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
836 |
v1:= v1 + RateShove(Me, x - 5, y - 10 * i |
7427 | 837 |
, 19, 30, 40 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
838 |
, -0.45, -0.9, trackFall or afSetSkip); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
839 |
end; |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
840 |
v1:= v1 + RateShove(Me, x - 5, y - 90 |
7427 | 841 |
, 19, 30, 40 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
842 |
, -0.45, -0.9, trackFall); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
843 |
|
433 | 844 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
845 |
// now try opposite direction |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
846 |
v2:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
847 |
for i:= 0 to 8 do |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
848 |
begin |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
849 |
v2:= v2 + RateShove(Me, x + 5, y - 10 * i |
7427 | 850 |
, 19, 30, 40 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
851 |
, 0.45, -0.9, trackFall or afSetSkip); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
852 |
end; |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
853 |
v2:= v2 + RateShove(Me, x + 5, y - 90 |
7427 | 854 |
, 19, 30, 40 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
855 |
, 0.45, -0.9, trackFall); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
856 |
|
8924 | 857 |
if (v2 > v1) |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
858 |
or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
859 |
begin |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
860 |
ap.Angle:= 1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
861 |
valueResult:= v2 |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
862 |
end |
8924 | 863 |
else |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
864 |
begin |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
865 |
ap.Angle:= -1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
866 |
valueResult:= v1 |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
867 |
end; |
8924 | 868 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
869 |
if valueResult <= 0 then |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
870 |
valueResult:= BadTurn; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
871 |
|
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
872 |
TestFirePunch:= valueResult; |
82 | 873 |
end; |
433 | 874 |
|
7178
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
875 |
|
8959 | 876 |
function TestWhip(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
7154 | 877 |
var valueResult, v1, v2: LongInt; |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
878 |
x, y, trackFall: LongInt; |
6770
7d2c6cdb816a
Start on adding drowning bonus to bat/firepunch/whip. AI still is not smart enough to change direction when firepunching to face the water, or change the angle of the bat.
nemo
parents:
6769
diff
changeset
|
879 |
begin |
7716 | 880 |
Targ:= Targ; // avoid compiler hint |
881 |
||
7471 | 882 |
if Level = 1 then trackFall:= afTrackFall |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
883 |
else trackFall:= 0; |
7471 | 884 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
885 |
ap.ExplR:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
886 |
ap.Time:= 0; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
887 |
ap.Power:= 1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
888 |
x:= hwRound(Me^.X); |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
889 |
y:= hwRound(Me^.Y); |
7154 | 890 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
891 |
// check left direction |
8924 | 892 |
{first RateShove checks farthermost of two whip's AmmoShove attacks |
893 |
to encourage distant attacks (damaged hog is excluded from view of second |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
894 |
RateShove call)} |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
895 |
v1:= RateShove(Me, x - 13, y |
7210
2ff30b79d2b0
- Adjust some consts so whip and firepunch work perfectly
unc0rr
parents:
7208
diff
changeset
|
896 |
, 30, 30, 25 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
897 |
, -1, -0.8, trackFall or afSetSkip); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
898 |
v1:= v1 + |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
899 |
RateShove(Me, x - 2, y |
7210
2ff30b79d2b0
- Adjust some consts so whip and firepunch work perfectly
unc0rr
parents:
7208
diff
changeset
|
900 |
, 30, 30, 25 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
901 |
, -1, -0.8, trackFall); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
902 |
// now try opposite direction |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
903 |
v2:= RateShove(Me, x + 13, y |
7210
2ff30b79d2b0
- Adjust some consts so whip and firepunch work perfectly
unc0rr
parents:
7208
diff
changeset
|
904 |
, 30, 30, 25 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
905 |
, 1, -0.8, trackFall or afSetSkip); |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
906 |
v2:= v2 + |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
907 |
RateShove(Me, x + 2, y |
7210
2ff30b79d2b0
- Adjust some consts so whip and firepunch work perfectly
unc0rr
parents:
7208
diff
changeset
|
908 |
, 30, 30, 25 |
7348
2a69f2ed9273
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
nemo
parents:
7274
diff
changeset
|
909 |
, 1, -0.8, trackFall); |
7154 | 910 |
|
8924 | 911 |
if (v2 > v1) |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
912 |
or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
913 |
begin |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
914 |
ap.Angle:= 1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
915 |
valueResult:= v2 |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
916 |
end |
8924 | 917 |
else |
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
918 |
begin |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
919 |
ap.Angle:= -1; |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
920 |
valueResult:= v1 |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
921 |
end; |
8924 | 922 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
923 |
if valueResult <= 0 then |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
924 |
valueResult:= BadTurn |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
925 |
else |
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
926 |
inc(valueResult); |
6770
7d2c6cdb816a
Start on adding drowning bonus to bat/firepunch/whip. AI still is not smart enough to change direction when firepunching to face the water, or change the angle of the bat.
nemo
parents:
6769
diff
changeset
|
927 |
|
7200
744c8a5546c6
New bright and shiny TestFirepunch which actually works
unc0rr
parents:
7197
diff
changeset
|
928 |
TestWhip:= valueResult; |
6770
7d2c6cdb816a
Start on adding drowning bonus to bat/firepunch/whip. AI still is not smart enough to change direction when firepunching to face the water, or change the angle of the bat.
nemo
parents:
6769
diff
changeset
|
929 |
end; |
7d2c6cdb816a
Start on adding drowning bonus to bat/firepunch/whip. AI still is not smart enough to change direction when firepunching to face the water, or change the angle of the bat.
nemo
parents:
6769
diff
changeset
|
930 |
|
8959 | 931 |
function TestKamikaze(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
7471 | 932 |
const step = 8; |
7474 | 933 |
var valueResult, i, v, tx: LongInt; |
7471 | 934 |
trackFall: LongInt; |
935 |
t, d, x, y, dx, dy, cx: real; |
|
936 |
begin |
|
937 |
ap.ExplR:= 0; |
|
938 |
ap.Time:= 0; |
|
939 |
ap.Power:= 1; |
|
940 |
||
8924 | 941 |
if Level = 1 then |
7471 | 942 |
trackFall:= afTrackFall |
943 |
else if Level = 2 then |
|
944 |
trackFall:= 0 |
|
945 |
else |
|
946 |
exit(BadTurn); |
|
8924 | 947 |
|
7471 | 948 |
valueResult:= 0; |
7486 | 949 |
v:= 0; |
7471 | 950 |
|
951 |
x:= hwFloat2Float(Me^.X); |
|
952 |
y:= hwFloat2Float(Me^.Y); |
|
8959 | 953 |
d:= sqrt(sqr(Targ.Point.X - x) + sqr(Targ.Point.Y - y)); |
7486 | 954 |
if d < 10 then |
7474 | 955 |
begin |
956 |
dx:= 0; |
|
957 |
dy:= 8; |
|
958 |
ap.Angle:= 2048 |
|
959 |
end |
|
960 |
else |
|
961 |
begin |
|
962 |
t:= step / d; |
|
8959 | 963 |
dx:= (Targ.Point.X - x) * t; |
964 |
dy:= (Targ.Point.Y - y) * t; |
|
7471 | 965 |
|
7474 | 966 |
ap.Angle:= DxDy2AttackAnglef(dx, -dy) |
967 |
end; |
|
8924 | 968 |
|
7471 | 969 |
if dx >= 0 then cx:= 0.45 else cx:= -0.45; |
970 |
||
971 |
for i:= 0 to 512 div step - 2 do |
|
972 |
begin |
|
8924 | 973 |
valueResult:= valueResult + |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
974 |
RateShove(Me, trunc(x), trunc(y) |
7471 | 975 |
, 30, 30, 25 |
976 |
, cx, -0.9, trackFall or afSetSkip); |
|
8924 | 977 |
|
7471 | 978 |
x:= x + dx; |
979 |
y:= y + dy; |
|
980 |
end; |
|
7474 | 981 |
if dx = 0 then |
982 |
begin |
|
983 |
x:= hwFloat2Float(Me^.X); |
|
984 |
y:= hwFloat2Float(Me^.Y); |
|
985 |
tx:= trunc(x); |
|
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
986 |
v:= RateShove(Me, tx, trunc(y) |
7486 | 987 |
, 30, 30, 25 |
988 |
, -cx, -0.9, trackFall); |
|
7474 | 989 |
for i:= 1 to 512 div step - 2 do |
990 |
begin |
|
991 |
y:= y + dy; |
|
8924 | 992 |
v:= v + |
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
993 |
RateShove(Me, tx, trunc(y) |
7474 | 994 |
, 30, 30, 25 |
995 |
, -cx, -0.9, trackFall or afSetSkip); |
|
996 |
end |
|
997 |
end; |
|
998 |
if v > valueResult then |
|
999 |
begin |
|
1000 |
ap.Angle:= -2048; |
|
1001 |
valueResult:= v |
|
1002 |
end; |
|
7716 | 1003 |
|
8950
3bf81ed1f984
Make hogs aware of dud mines and explosives. Still a bit more needed.
nemo
parents:
8924
diff
changeset
|
1004 |
v:= RateShove(Me, trunc(x), trunc(y) |
7471 | 1005 |
, 30, 30, 25 |
1006 |
, cx, -0.9, trackFall); |
|
1007 |
valueResult:= valueResult + v - KillScore * friendlyfactor div 100 * 1024; |
|
7716 | 1008 |
|
7471 | 1009 |
if v < 65536 then |
1010 |
inc(valueResult, RateExplosion(Me, trunc(x), trunc(y), 30)); |
|
1011 |
||
1012 |
TestKamikaze:= valueResult; |
|
1013 |
end; |
|
1014 |
||
8959 | 1015 |
function TestHammer(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
5645 | 1016 |
var rate: LongInt; |
1017 |
begin |
|
1018 |
Level:= Level; // avoid compiler hint |
|
7716 | 1019 |
Targ:= Targ; |
1020 |
||
5645 | 1021 |
ap.ExplR:= 0; |
1022 |
ap.Time:= 0; |
|
1023 |
ap.Power:= 1; |
|
1024 |
ap.Angle:= 0; |
|
8924 | 1025 |
|
7178
c61cfc9eb29d
Don't make unnecessary calls to TestWhip, TestFirePunch, TestBaseballBat and TestHammer functions as they have no need to take Targ parameter into account and thus may only be called once per position
unc0rr
parents:
7161
diff
changeset
|
1026 |
rate:= RateHammer(Me); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1027 |
if rate = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1028 |
rate:= BadTurn; |
5645 | 1029 |
TestHammer:= rate; |
1030 |
end; |
|
1031 |
||
8959 | 1032 |
function TestAirAttack(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
556
49675457d76e
Bots aims not directly at the center of enemy hedgehog
unc0rr
parents:
554
diff
changeset
|
1033 |
const cShift = 4; |
6775 | 1034 |
var bombsSpeed, X, Y, dY: real; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1035 |
b: array[0..9] of boolean; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1036 |
dmg: array[0..9] of LongInt; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1037 |
fexit: boolean; |
2695 | 1038 |
i, t, valueResult: LongInt; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1039 |
begin |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1040 |
ap.ExplR:= 0; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1041 |
ap.Time:= 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1042 |
if (Level > 3) then |
7041 | 1043 |
exit(BadTurn); |
554 | 1044 |
|
7132 | 1045 |
ap.Angle:= 0; |
8959 | 1046 |
ap.AttackPutX:= Targ.Point.X; |
1047 |
ap.AttackPutY:= Targ.Point.Y; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1048 |
|
6775 | 1049 |
bombsSpeed:= hwFloat2Float(cBombsSpeed); |
8959 | 1050 |
X:= Targ.Point.X - 135 - cShift; // hh center - cShift |
1051 |
X:= X - bombsSpeed * sqrt(((Targ.Point.Y + 128) * 2) / cGravityf); |
|
6775 | 1052 |
Y:= -128; |
1053 |
dY:= 0; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1054 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1055 |
for i:= 0 to 9 do |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1056 |
begin |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1057 |
b[i]:= true; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1058 |
dmg[i]:= 0 |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1059 |
end; |
2695 | 1060 |
valueResult:= 0; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1061 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1062 |
repeat |
6775 | 1063 |
X:= X + bombsSpeed; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1064 |
Y:= Y + dY; |
6775 | 1065 |
dY:= dY + cGravityf; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1066 |
fexit:= true; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1067 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1068 |
for i:= 0 to 9 do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1069 |
if b[i] then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1070 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1071 |
fexit:= false; |
6992 | 1072 |
if TestColl(trunc(X) + LongWord(i * 30), trunc(Y), 4) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1073 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1074 |
b[i]:= false; |
6992 | 1075 |
dmg[i]:= RateExplosion(Me, trunc(X) + LongWord(i * 30), trunc(Y), 58) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1076 |
// 58 (instead of 60) for better prediction (hh moves after explosion of one of the rockets) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1077 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1078 |
end; |
6775 | 1079 |
until fexit or (Y > cWaterLine); |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1080 |
|
2695 | 1081 |
for i:= 0 to 5 do inc(valueResult, dmg[i]); |
1082 |
t:= valueResult; |
|
8959 | 1083 |
ap.AttackPutX:= Targ.Point.X - 60; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1084 |
|
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1085 |
for i:= 0 to 3 do |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1086 |
begin |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1087 |
dec(t, dmg[i]); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1088 |
inc(t, dmg[i + 6]); |
2695 | 1089 |
if t > valueResult then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1090 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1091 |
valueResult:= t; |
8959 | 1092 |
ap.AttackPutX:= Targ.Point.X - 30 - cShift + i * 30 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1093 |
end |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1094 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1095 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1096 |
if valueResult <= 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1097 |
valueResult:= BadTurn; |
2695 | 1098 |
TestAirAttack:= valueResult; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1099 |
end; |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
534
diff
changeset
|
1100 |
|
3370 | 1101 |
|
8959 | 1102 |
function TestTeleport(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
3370 | 1103 |
var |
3439 | 1104 |
i, failNum: longword; |
1105 |
maxTop: longword; |
|
3370 | 1106 |
begin |
3439 | 1107 |
TestTeleport := BadTurn; |
7041 | 1108 |
exit(BadTurn); |
3439 | 1109 |
Level:= Level; // avoid compiler hint |
6888 | 1110 |
//FillBonuses(true, [gtCase]); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1111 |
if bonuses.Count = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1112 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1113 |
if Me^.Health <= 100 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1114 |
begin |
8959 | 1115 |
maxTop := Targ.Point.Y - cHHRadius * 2; |
8924 | 1116 |
|
8959 | 1117 |
while not TestColl(Targ.Point.X, maxTop, cHHRadius) and (maxTop > topY + cHHRadius * 2 + 1) do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1118 |
dec(maxTop, cHHRadius*2); |
8959 | 1119 |
if not TestColl(Targ.Point.X, maxTop + cHHRadius, cHHRadius) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1120 |
begin |
8959 | 1121 |
ap.AttackPutX := Targ.Point.X; |
3439 | 1122 |
ap.AttackPutY := maxTop + cHHRadius; |
8959 | 1123 |
TestTeleport := Targ.Point.Y - maxTop; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1124 |
end; |
3439 | 1125 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1126 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1127 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1128 |
begin |
3439 | 1129 |
failNum := 0; |
3697 | 1130 |
repeat |
3439 | 1131 |
i := random(bonuses.Count); |
1132 |
inc(failNum); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1133 |
until not TestColl(bonuses.ar[i].X, bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius, cHHRadius) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1134 |
or (failNum = bonuses.Count*2); |
8924 | 1135 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1136 |
if failNum < bonuses.Count*2 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1137 |
begin |
3439 | 1138 |
ap.AttackPutX := bonuses.ar[i].X; |
1139 |
ap.AttackPutY := bonuses.ar[i].Y - cHHRadius - bonuses.ar[i].Radius; |
|
1140 |
TestTeleport := 0; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6474
diff
changeset
|
1141 |
end; |
3439 | 1142 |
end; |
3370 | 1143 |
end; |
1144 |
||
7398 | 1145 |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1146 |
procedure checkCakeWalk(Me, Gear: PGear; var ap: TAttackParams); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1147 |
var i: Longword; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1148 |
v: LongInt; |
7398 | 1149 |
begin |
8370 | 1150 |
while (not TestColl(hwRound(Gear^.X), hwRound(Gear^.Y), 6)) and (Gear^.Y.Round < LongWord(LAND_HEIGHT)) do |
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1151 |
Gear^.Y:= Gear^.Y + _1; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1152 |
|
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1153 |
for i:= 0 to 2040 do |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1154 |
begin |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1155 |
cakeStep(Gear); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1156 |
v:= RateExplosion(Me, hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg * 2, afTrackFall); |
8924 | 1157 |
if v > ap.Power then |
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1158 |
begin |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1159 |
ap.ExplX:= hwRound(Gear^.X); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1160 |
ap.ExplY:= hwRound(Gear^.Y); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1161 |
ap.Power:= v |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1162 |
end |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1163 |
end; |
7398 | 1164 |
end; |
1165 |
||
8959 | 1166 |
function TestCake(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
7398 | 1167 |
var valueResult, v1, v2: LongInt; |
1168 |
cake: TGear; |
|
1169 |
begin |
|
7716 | 1170 |
Targ:= Targ; // avoid compiler hint |
1171 |
||
7501 | 1172 |
if (Level > 2) then |
1173 |
exit(BadTurn); |
|
7716 | 1174 |
|
7398 | 1175 |
ap.ExplR:= 0; |
1176 |
ap.Time:= 0; |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1177 |
ap.Power:= BadTurn; // use it as max score value in checkCakeWalk |
7398 | 1178 |
|
7721 | 1179 |
//FillChar(cake, sizeof(cake), 0); |
7398 | 1180 |
cake.Radius:= 7; |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
1181 |
cake.CollisionMask:= lfNotCurrentMask; |
7752 | 1182 |
cake.Hedgehog:= Me^.Hedgehog; |
7398 | 1183 |
|
1184 |
// check left direction |
|
1185 |
cake.Angle:= 3; |
|
1186 |
cake.dX.isNegative:= true; |
|
1187 |
cake.X:= Me^.X - _3; |
|
1188 |
cake.Y:= Me^.Y; |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1189 |
checkCakeWalk(Me, @cake, ap); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1190 |
v1:= ap.Power; |
7398 | 1191 |
|
1192 |
// now try opposite direction |
|
1193 |
cake.Angle:= 1; |
|
1194 |
cake.dX.isNegative:= false; |
|
1195 |
cake.X:= Me^.X + _3; |
|
1196 |
cake.Y:= Me^.Y; |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1197 |
checkCakeWalk(Me, @cake, ap); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1198 |
v2:= ap.Power; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1199 |
|
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7398
diff
changeset
|
1200 |
ap.Power:= 1; |
7398 | 1201 |
|
1202 |
if (v2 > v1) then |
|
1203 |
begin |
|
1204 |
ap.Angle:= 1; |
|
1205 |
valueResult:= v2 |
|
1206 |
end |
|
1207 |
else |
|
1208 |
begin |
|
1209 |
ap.Angle:= -1; |
|
1210 |
valueResult:= v1 |
|
1211 |
end; |
|
1212 |
||
1213 |
if valueResult <= 0 then |
|
1214 |
valueResult:= BadTurn; |
|
1215 |
||
1216 |
TestCake:= valueResult; |
|
1217 |
end; |
|
1218 |
||
4 | 1219 |
end. |