176 |
176 |
177 if (Ammoz[a].Ammo.Propz and ammoprop_OscAim) <> 0 then |
177 if (Ammoz[a].Ammo.Propz and ammoprop_OscAim) <> 0 then |
178 begin |
178 begin |
179 AddAction(BestActions, aia_attack, aim_push, 350 + random(200), 0, 0); |
179 AddAction(BestActions, aia_attack, aim_push, 350 + random(200), 0, 0); |
180 AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); |
180 AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); |
|
181 |
|
182 AddAction(BestActions, aia_Down, aim_push, 100 + random(150), 0, 0); |
|
183 AddAction(BestActions, aia_Down, aim_release, 32, 0, 0); |
|
184 |
181 AddAction(BestActions, aia_waitAngle, ap.Angle, 250, 0, 0); |
185 AddAction(BestActions, aia_waitAngle, ap.Angle, 250, 0, 0); |
182 AddAction(BestActions, aia_attack, aim_push, 1, 0, 0); |
186 AddAction(BestActions, aia_attack, aim_push, 1, 0, 0); |
183 AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); |
187 AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); |
184 end else |
188 end else |
185 if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then |
189 if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then |
429 BeginThread(@Think, Me, ThinkThread); |
433 BeginThread(@Think, Me, ThinkThread); |
430 {$ENDIF} |
434 {$ENDIF} |
431 AddFileLog('Thread started'); |
435 AddFileLog('Thread started'); |
432 end; |
436 end; |
433 |
437 |
|
438 var scoreShown: boolean = false; |
|
439 |
434 procedure ProcessBot; |
440 procedure ProcessBot; |
435 const cStopThinkTime = 40; |
441 const cStopThinkTime = 40; |
436 begin |
442 begin |
437 with CurrentHedgehog^ do |
443 with CurrentHedgehog^ do |
438 if (Gear <> nil) |
444 if (Gear <> nil) |
445 if Gear^.Message <> 0 then |
451 if Gear^.Message <> 0 then |
446 begin |
452 begin |
447 StopMessages(Gear^.Message); |
453 StopMessages(Gear^.Message); |
448 TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true); |
454 TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true); |
449 end; |
455 end; |
|
456 |
450 if Gear^.Message <> 0 then |
457 if Gear^.Message <> 0 then |
451 exit; |
458 exit; |
|
459 |
|
460 scoreShown:= false; |
452 StartThink(Gear); |
461 StartThink(Gear); |
453 StartTicks:= GameTicks |
462 StartTicks:= GameTicks |
454 |
463 |
455 end else |
464 end else |
456 ProcessAction(BestActions, Gear) |
465 begin |
|
466 if not scoreShown then |
|
467 begin |
|
468 if BestActions.Score > 0 then ParseCommand('/say Expected score = ' + inttostr(BestActions.Score div 1024), true); |
|
469 scoreShown:= true |
|
470 end; |
|
471 ProcessAction(BestActions, Gear) |
|
472 end |
457 else if ((GameTicks - StartTicks) > cMaxAIThinkTime) |
473 else if ((GameTicks - StartTicks) > cMaxAIThinkTime) |
458 or (TurnTimeLeft <= cStopThinkTime) then |
474 or (TurnTimeLeft <= cStopThinkTime) then |
459 StopThinking:= true |
475 StopThinking:= true |
460 end; |
476 end; |
461 |
477 |