135 begin |
135 begin |
136 Metric:= abs(x1 - x2) + abs(y1 - y2) |
136 Metric:= abs(x1 - x2) + abs(y1 - y2) |
137 end; |
137 end; |
138 |
138 |
139 function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
139 function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; |
|
140 const cExtraTime = 300; |
140 var Vx, Vy, r, mX, mY: real; |
141 var Vx, Vy, r, mX, mY: real; |
141 rTime: LongInt; |
142 rTime: LongInt; |
142 EX, EY: LongInt; |
143 EX, EY: LongInt; |
143 valueResult: LongInt; |
144 valueResult: LongInt; |
144 targXWrap, x, y, dX, dY: real; |
145 targXWrap, x, y, dX, dY: real; |
177 dX:= dX + windSpeed; |
178 dX:= dX + windSpeed; |
178 //dX:= CheckBounce(x,dX); |
179 //dX:= CheckBounce(x,dX); |
179 dY:= dY + cGravityf; |
180 dY:= dY + cGravityf; |
180 dec(t) |
181 dec(t) |
181 until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
182 until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or |
182 ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t <= 0); |
183 ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(x), trunc(y), 5))) or (t < -cExtraTime); |
183 |
184 |
184 EX:= trunc(x); |
185 EX:= trunc(x); |
185 EY:= trunc(y); |
186 EY:= trunc(y); |
186 if (((Me = CurrentHedgehog^.Gear) and TestColl(EX, EY, 3)) or |
187 if t >= -cExtraTime then |
187 ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me^.Hedgehog^.Gear, EX, EY, 3))) then |
188 begin |
188 begin |
189 if Level = 1 then |
189 if Level = 1 then |
190 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
190 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) |
191 else |
191 else value:= RateExplosion(Me, EX, EY, 101); |
192 value:= RateExplosion(Me, EX, EY, 101); |
192 end; |
193 end else |
|
194 value:= BadTurn; |
|
195 |
193 if (value = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then |
196 if (value = 0) and (Targ.Kind = gtHedgehog) and (Targ.Score > 0) then |
194 if GameFlags and gfSolidLand = 0 then |
197 if GameFlags and gfSolidLand = 0 then |
195 value := 1024 - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64 |
198 value := 1024 - Metric(Targ.Point.X, Targ.Point.Y, EX, EY) div 64 |
196 else value := BadTurn; |
199 else value := BadTurn; |
197 if valueResult <= value then |
200 |
|
201 if (valueResult < value) or (valueResult = value and Level < 3) then |
198 begin |
202 begin |
199 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
203 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); |
200 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
204 ap.Power:= trunc(sqrt(r) * cMaxPower) - random((Level - 1) * 17 + 1); |
201 ap.ExplR:= 100; |
205 ap.ExplR:= 100; |
202 ap.ExplX:= EX; |
206 ap.ExplX:= EX; |
203 ap.ExplY:= EY; |
207 ap.ExplY:= EY; |
204 valueResult:= value |
208 valueResult:= value |
205 end; |
209 end; |
206 end |
210 end |
207 //until (value > 204800) or (rTime > 4250); not so useful since adding score to the drowning |
|
208 until rTime > 5050 - Level * 800; |
211 until rTime > 5050 - Level * 800; |
209 TestBazooka:= valueResult |
212 TestBazooka:= valueResult |
210 end; |
213 end; |
211 |
214 |
212 function calcBeeFlight(Me: PGear; x, y, dx, dy, tX, tY: real; var eX, eY: LongInt): LongInt; |
215 function calcBeeFlight(Me: PGear; x, y, dx, dy, tX, tY: real; var eX, eY: LongInt): LongInt; |