289 end |
289 end |
290 end; |
290 end; |
291 |
291 |
292 function Think(Me: Pointer): ptrint; |
292 function Think(Me: Pointer): ptrint; |
293 var BackMe, WalkMe: TGear; |
293 var BackMe, WalkMe: TGear; |
294 StartTicks, currHedgehogIndex, itHedgehog, switchesNum, i, switchCount: Longword; |
294 switchCount: LongInt; |
|
295 StartTicks, currHedgehogIndex, itHedgehog, switchesNum, i: Longword; |
295 switchImmediatelyAvailable: boolean; |
296 switchImmediatelyAvailable: boolean; |
296 Actions: TActions; |
297 Actions: TActions; |
297 begin |
298 begin |
298 InterlockedIncrement(hasThread); |
299 InterlockedIncrement(hasThread); |
299 StartTicks:= GameTicks; |
300 StartTicks:= GameTicks; |
317 if switchesNum > 0 then |
318 if switchesNum > 0 then |
318 begin |
319 begin |
319 if not switchImmediatelyAvailable then |
320 if not switchImmediatelyAvailable then |
320 begin |
321 begin |
321 // when AI has to use switcher, make it cost smth unless they have a lot of switches |
322 // when AI has to use switcher, make it cost smth unless they have a lot of switches |
322 if (SwitchCount < 10) then Actions.Score:= (-27+SwitchCount*3)*4000; |
323 if (switchCount < 10) then Actions.Score:= (-27+switchCount*3)*4000; |
323 AddAction(Actions, aia_Weapon, Longword(amSwitch), 300 + random(200), 0, 0); |
324 AddAction(Actions, aia_Weapon, Longword(amSwitch), 300 + random(200), 0, 0); |
324 AddAction(Actions, aia_attack, aim_push, 300 + random(300), 0, 0); |
325 AddAction(Actions, aia_attack, aim_push, 300 + random(300), 0, 0); |
325 AddAction(Actions, aia_attack, aim_release, 1, 0, 0); |
326 AddAction(Actions, aia_attack, aim_release, 1, 0, 0); |
326 end; |
327 end; |
327 for i:= 1 to switchesNum do |
328 for i:= 1 to switchesNum do |