anchor.diff:        Exit(True);
   
       if aGoal.HandIndex <> HAND_NONE then
  -      Stat := gHands[aGoal.HandIndex].Stats
  +      stats := gHands[aGoal.HandIndex].Stats
       else
  -      Stat := nil;
  +      stats := nil;
   
       case aGoal.GoalCondition of
         gcBuildTutorial:     Result := True; //Deprecated
         //gcTime is disabled as we process messages in Event system now. Return true so players
         //do not have to wait for all messages to show before they are allowed to win (same in TPR)
         gcTime:              Result := True; //Deprecated
  -      gcBuildings:         Result := (Stat.GetHouseQty(GOAL_BUILDINGS_HOUSES) > 0);
  -      gcTroops:            Result := (Stat.GetArmyCount > 0);
  -      gcMilitaryAssets:    Result := (Stat.GetArmyCount > 0) or
  -                                      (Stat.GetHouseQty([htBarracks, htCoalMine, htWeaponWorkshop, htArmorWorkshop, htStables,
  +      gcBuildings:         Result := (stats.GetHouseQty(GOAL_BUILDINGS_HOUSES) > 0);
  +      gcTroops:            Result := (stats.GetArmyCount > 0);
  +      gcMilitaryAssets:    Result := (stats.GetArmyCount > 0) or
  +                                      (stats.GetHouseQty([htBarracks, htCoalMine, htWeaponWorkshop, htArmorWorkshop, htStables,
                                                            htIronMine, htIronSmithy ,htWeaponSmithy, htArmorSmithy, htTownHall,
                                                            htSiegeWorkshop]) > 0);
  -      gcSerfsAndSchools:   Result := (Stat.GetHouseQty([htSchool]) > 0) or (Stat.GetUnitQty(utSerf) > 0);
  -      gcEconomyBuildings:  Result := (Stat.GetHouseQty([htStore, htSchool, htInn]) > 0);
  +      gcSerfsAndSchools:   Result := (stats.GetHouseQty([htSchool]) > 0) or (stats.GetUnitQty(utSerf) > 0);
  +      gcEconomyBuildings:  Result := (stats.GetHouseQty([htStore, htSchool, htInn]) > 0);
         else                  raise Exception.Create('Unknown goal');
       end;
       if aGoal.GoalStatus = gsFalse then
  
positive.code: //Defeated player remains in place, but does no actions
  procedure TKMHandAI.Defeat(aShowDefeatMessage: Boolean = True);
  begin
    if fWonOrLost = wolNone then
    begin
      fWonOrLost := wolLost;
  
      //Let the game know
      gGame.PlayerDefeat(fOwner, aShowDefeatMessage);
  
      //Script may have additional event processors
      gScriptEvents.ProcPlayerDefeated(fOwner);
    end;
  end;
  
  
  
negative.code:               //If we are a warrior we can also attack that unit ourselves
                if aUnit is TKMUnitWarrior then
                begin
                  group := gHands[fOwner].UnitGroups.GetGroupByMember(TKMUnitWarrior(aUnit));
                  //It's ok for the group to be nil, the warrior could still be walking out of the barracks
                  if (group <> nil) and not group.IsDead then
                    //If we are already in the process of attacking something, don't change our minds,
                    //otherwise you can make a unit walk backwards and forwards forever between two groups of archers
                    if not group.InFight then
                      //Make sure the group could possibly reach the offenders
                      if group.CanWalkTo(aAttacker.Position, group.FightMaxRange) then
                        group.OrderAttackUnit(aAttacker, True);
                end;
              end;
            end;
  