anchor.diff:  
   
   procedure TKMArmyManagement.UpdateState(aTick: Cardinal);
  -begin
  -
  -
  -  if (aTick + Byte(fOwner)) mod MAX_HANDS = 0 then
  -  begin
  -    if (gGame.MissionMode = mm_Tactic) then  // DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG
  -      fAttack.UpdateState(aTick);
  -
  -    //CheckEnemyPresence; //Check enemy threat in close range and issue defensive attacks (or flee?)
  -    //CheckAndIssueAttack; //Attack enemy
  -    //Anything Else?
  +const
  +  PERF_TIME_LIMIT = MAX_HANDS * 10;
  +  PERF_TIME_LIMIT_2 = MAX_HANDS * 11;
  +begin
  +  if (aTick mod MAX_HANDS = fOwner) then
  +  begin
  +    if (aTick mod PERF_TIME_LIMIT = fOwner) then
  +      fDefence.UpdateDefences();
  +    if (aTick mod PERF_TIME_LIMIT_2 = fOwner) then
  +      CheckAttack();
  +    RecruitSoldiers();
  +    CheckGroupsState();
  +    fAttack.UpdateState(aTick);
  +    fDefence.UpdateState(aTick);
     end;
   end;
   
  
positive.code:   fSetup := aSetup;
  
    fAttack := TKMArmyAttack.Create(aPlayer);
    //fAttacks := TAIAttacks.Create;
    //fDefencePositions := TAIDefencePositions.Create;
  end;
  
  
  destructor TKMArmyManagement.Destroy;
  begin
    //fDefencePositions.Free;
    //fAttacks.Free;
  
    fAttack.Free;
    inherited;
  end;
  
  
  procedure TKMArmyManagement.AfterMissionInit();
  begin
    fAttack.AfterMissionInit();
    if (gGame.MissionMode = mm_Tactic) then  // DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG
      fAttack.OrderToAttack();
  end;
  
  
  procedure TKMArmyManagement.OwnerUpdate(aPlayer: TKMHandIndex);
  begin
    fOwner := aPlayer;
  end;
  
  
  procedure TKMArmyManagement.Save(SaveStream: TKMemoryStream);
  begin
    SaveStream.Write(fOwner);
    SaveStream.Write(fLastEquippedTimeIron);
    SaveStream.Write(fLastEquippedTimeLeather);
    //fAttacks.Save(SaveStream);
    //fDefencePositions.Save(SaveStream);
  end;
  
  
  procedure TKMArmyManagement.Load(LoadStream: TKMemoryStream);
  begin
    LoadStream.Read(fOwner);
    LoadStream.Read(fLastEquippedTimeIron);
    LoadStream.Read(fLastEquippedTimeLeather);
    //fAttacks.Load(LoadStream);
    //fDefencePositions.Load(LoadStream);
  end;
  
  
  procedure TKMArmyManagement.SyncLoad;
  begin
    //fDefencePositions.SyncLoad;
  end;
  
  
  
  
negative.code: interface
  uses
    Classes, KromUtils, Math, SysUtils,
    KM_CommonClasses, KM_Defaults, KM_Points,
    KM_Units, KM_UnitGroups, KM_AISetup,
    KM_HandStats, KM_ArmyAttack, KM_ArmyDefence,
    KM_NavMeshFloodPositioning;
  
  type
    TKMArmyManagement = class
    private
      fOwner: TKMHandIndex;
      fSetup: TKMHandAISetup;
      fLastEquippedTimeIron, fLastEquippedTimeLeather: Cardinal;
  
      fAttack: TKMArmyAttack;
      fDefence: TKMArmyDefence;
  
      fBalanceText: UnicodeString;
  
      procedure RecruitSoldiers();
      procedure CheckGroupsState();
      procedure CheckAttack();
    public
      constructor Create(aPlayer: TKMHandIndex; aSetup: TKMHandAISetup);
      destructor Destroy; override;
      procedure Save(SaveStream: TKMemoryStream);
      procedure Load(LoadStream: TKMemoryStream);
      procedure SyncLoad();
  
      property Attack: TKMArmyAttack read fAttack write fAttack;
      property Defence: TKMArmyDefence read fDefence write fDefence;
  
      procedure AfterMissionInit();
      procedure UpdateState(aTick: Cardinal);
      procedure OwnerUpdate(aPlayer: TKMHandIndex);
      procedure WarriorEquipped(aGroup: TKMUnitGroup);
      //function GetArmyDemand(): ...;
      //procedure RetaliateAgainstThreat(aAttacker: TKMUnit);
  
      procedure LogStatus(var aBalanceText: UnicodeString);
      procedure Paint();
  