equal
deleted
inserted
replaced
106 end |
106 end |
107 end; |
107 end; |
108 |
108 |
109 |
109 |
110 |
110 |
111 procedure TestAmmos(var Actions: TActions; Me: PGear; isMoved: boolean); |
111 procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean); |
112 var BotLevel: Byte; |
112 var BotLevel: Byte; |
113 ap: TAttackParams; |
113 ap: TAttackParams; |
114 Score, i, dAngle: LongInt; |
114 Score, i, dAngle: LongInt; |
115 a, aa: TAmmoType; |
115 a, aa: TAmmoType; |
116 begin |
116 begin |
128 {$ELSE} |
128 {$ELSE} |
129 ThreadSwitch(); |
129 ThreadSwitch(); |
130 {$ENDIF} |
130 {$ENDIF} |
131 repeat |
131 repeat |
132 if (CanUseAmmo[a]) |
132 if (CanUseAmmo[a]) |
133 and ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) |
133 and ((not rareChecks) or ((AmmoTests[a].flags and amtest_Rare) = 0)) |
134 and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0)) |
134 and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0)) |
135 then |
135 then |
136 begin |
136 begin |
137 {$HINTS OFF} |
137 {$HINTS OFF} |
138 Score:= AmmoTests[a].proc(Me, Targets.ar[i].Point, BotLevel, ap); |
138 Score:= AmmoTests[a].proc(Me, Targets.ar[i].Point, BotLevel, ap); |
215 end; |
215 end; |
216 |
216 |
217 procedure Walk(Me: PGear; var Actions: TActions); |
217 procedure Walk(Me: PGear; var Actions: TActions); |
218 const FallPixForBranching = cHHRadius; |
218 const FallPixForBranching = cHHRadius; |
219 var |
219 var |
220 ticks, maxticks, steps, tmp: Longword; |
220 ticks, maxticks, oldticks, steps, tmp: Longword; |
221 BaseRate, BestRate, Rate: integer; |
221 BaseRate, BestRate, Rate: integer; |
222 GoInfo: TGoInfo; |
222 GoInfo: TGoInfo; |
223 CanGo: boolean; |
223 CanGo: boolean; |
224 AltMe: TGear; |
224 AltMe: TGear; |
225 BotLevel: Byte; |
225 BotLevel: Byte; |
226 a: TAmmoType; |
226 a: TAmmoType; |
227 begin |
227 begin |
228 ticks:= 0; // avoid compiler hint |
228 ticks:= 0; |
|
229 oldticks:= 0; // avoid compiler hint |
229 Stack.Count:= 0; |
230 Stack.Count:= 0; |
230 |
231 |
231 clearAllMarks; |
232 clearAllMarks; |
232 |
233 |
233 for a:= Low(TAmmoType) to High(TAmmoType) do |
234 for a:= Low(TAmmoType) to High(TAmmoType) do |
272 while (not StopThinking) do |
273 while (not StopThinking) do |
273 begin |
274 begin |
274 {$HINTS OFF} |
275 {$HINTS OFF} |
275 CanGo:= HHGo(Me, @AltMe, GoInfo); |
276 CanGo:= HHGo(Me, @AltMe, GoInfo); |
276 {$HINTS ON} |
277 {$HINTS ON} |
|
278 oldticks:= ticks; |
277 inc(ticks, GoInfo.Ticks); |
279 inc(ticks, GoInfo.Ticks); |
278 if ticks > maxticks then |
280 if ticks > maxticks then |
279 break; |
281 break; |
280 |
282 |
281 if (BotLevel < 5) |
283 if (BotLevel < 5) |
347 if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then |
349 if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then |
348 begin |
350 begin |
349 if (steps > 4) and checkMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere) then |
351 if (steps > 4) and checkMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere) then |
350 break; |
352 break; |
351 addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere); |
353 addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere); |
352 |
354 |
353 TestAmmos(Actions, Me, true); |
355 TestAmmos(Actions, Me, ticks shr 12 = oldticks shr 12); |
354 end; |
356 end; |
355 |
357 |
356 if GoInfo.FallPix >= FallPixForBranching then |
358 if GoInfo.FallPix >= FallPixForBranching then |
357 Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right |
359 Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right |
358 end {while}; |
360 end {while}; |