Program: 171298
Project: 171298
Buggy source:
public void endTurn(int turnTime,boolean advanceTime){
  long startHour=getHour();
  if (advanceTime) {
    minutesPassed+=turnTime;
    updateResponses();
  }
  if (Main.game.getCurrentWeather() != Weather.SNOW && Main.game.getSeason() != Season.WINTER) {
    Main.game.getDialogueFlags().values.remove(DialogueFlagValue.hasSnowedThisWinter);
    for (    NPC npc : Main.game.getReindeerOverseers()) {
      if (npc.getLocation() != Main.game.getPlayer().getLocation()) {
        npc.setLocation(WorldType.EMPTY,PlaceType.GENERIC_EMPTY_TILE,true);
      }
    }
  }
  int hoursPassed=(int)(getHour() - startHour);
  int hourStartTo24=(int)(startHour % 24);
  for (int i=1; i <= hoursPassed; i++) {
    slaveryUtil.performHourlyUpdate(this.getDayNumber(startHour * 60 + i * 60),(hourStartTo24 + i) % 24);
  }
  boolean newDay=((int)(minutesPassed / (60 * 24)) != (int)(((minutesPassed - turnTime) / (60 * 24))));
  if (newDay) {
    AbstractClothing goggles=AbstractClothingType.generateClothing(ClothingType.SCIENTIST_EYES_SAFETY_GOGGLES,Colour.CLOTHING_BLACK,false);
    if (!Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().hasClothing(goggles)) {
      Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().addClothing(goggles);
    }
    pendingSlaveInStocksReset=true;
    for (    NPC npc : Main.game.getReindeerOverseers()) {
      if (npc.getLocationPlace().getPlaceType() == PlaceType.DOMINION_STREET && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) {
        npc.moveToAdjacentMatchingCellType();
        Main.game.getDialogueFlags().dailyReindeerReset(npc.getId());
      }
    }
  }
  if (pendingSlaveInStocksReset && Main.game.getPlayer().getLocationPlace().getPlaceType() != PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS) {
    for (    NPC npc : Main.game.getCharactersPresent(Main.game.getWorlds().get(WorldType.SLAVER_ALLEY).getCell(PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS))) {
      if (npc instanceof SlaveInStocks) {
        Main.game.banishNPC(npc);
      }
    }
    for (int i=0; i < 4; i++) {
      SlaveInStocks slave=new SlaveInStocks(GenderPreference.getGenderFromUserPreferences());
      if (Math.random() > 0.5f) {
        Main.game.getGenericFemaleNPC().addSlave(slave);
      }
 else {
        Main.game.getGenericMaleNPC().addSlave(slave);
      }
      try {
        Main.game.addNPC(slave,false);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    pendingSlaveInStocksReset=false;
  }
  handleAtmosphericConditions(turnTime);
  isInNPCUpdateLoop=true;
  for (  NPC npc : NPCMap.values()) {
    if (npc.getLocationPlace().getPlaceType() != PlaceType.DOMINION_BACK_ALLEYS && npc.getWorldLocation() == WorldType.DOMINION && npc instanceof DominionAlleywayAttacker && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
      banishNPC(npc);
    }
  }
  for (  NPC npc : NPCMap.values()) {
    npc.calculateStatusEffects(turnTime);
    if (npc.isPendingClothingDressing() && (Main.game.getCurrentDialogueNode().equals(Main.game.getPlayer().getLocationPlace().getDialogue(false)) || !(npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation() && npc.getLocation().equals(Main.game.getPlayer().getLocation())))) {
      npc.equipClothing(true,true);
      npc.setPendingClothingDressing(false);
    }
    if (npc.isPendingTransformationToGenderIdentity()) {
      npc.setBody(npc.getGenderIdentity(),RacialBody.valueOfRace(npc.getRace()),npc.getRaceStage());
      CharacterUtils.randomiseBody(npc);
      npc.setPendingTransformationToGenderIdentity(false);
    }
    if ((!npc.isPregnant() && !npc.isSlave() && npc.getHistory() == History.PROSTITUTE && !npc.hasStatusEffect(StatusEffect.PROMISCUITY_PILL) && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) || (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_PROMISCUITY_PILLS))) {
      npc.useItem(AbstractItemType.generateItem(ItemType.PROMISCUITY_PILL),npc,false);
    }
    if (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_VIXENS_VIRILITY)) {
      npc.useItem(AbstractItemType.generateItem(ItemType.VIXENS_VIRILITY),npc,false);
    }
    if (npc.hasStatusEffect(StatusEffect.PREGNANT_3) && (minutesPassed - npc.getTimeProgressedToFinalPregnancyStage()) > (12 * 60)) {
      if (npc instanceof Lilaya) {
        if (!Main.game.getDialogueFlags().values.contains(DialogueFlagValue.reactedToPregnancyLilaya)) {
          npc.endPregnancy(true);
        }
      }
 else {
        npc.endPregnancy(true);
        if (npc instanceof Kate) {
          Main.game.getDialogueFlags().values.remove(DialogueFlagValue.reactedToKatePregnancy);
        }
      }
    }
    if (npc.getLocation().equals(Main.game.getPlayer().getLocation()) && npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation()) {
      for (      CoverableArea ca : CoverableArea.values()) {
        if (npc.isCoverableAreaExposed(ca) && ca != CoverableArea.MOUTH) {
          npc.getPlayerKnowsAreasMap().put(ca,true);
        }
      }
    }
    if (newDay) {
      npc.dailyReset();
    }
  }
  isInNPCUpdateLoop=false;
  for (  NPC npc : npcsToRemove) {
    NPCMap.remove(npc.getId());
  }
  for (  NPC npc : npcsToAdd) {
    NPCMap.put(npc.getId(),npc);
  }
  npcsToRemove.clear();
  npcsToAdd.clear();
  if (!isInCombat()) {
    if (Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
      Main.game.getPlayer().calculateStatusEffects(turnTime);
    }
    if (!inSex && !currentDialogueNode.isRegenerationDisabled()) {
      if (Main.game.getPlayer().getStaminaPercentage() < 1)       Main.game.getPlayer().incrementStamina(turnTime * 0.1f);
      if (Main.game.getPlayer().getHealthPercentage() < 1)       Main.game.getPlayer().incrementHealth(turnTime * 0.1f);
      if (Main.game.getPlayer().getManaPercentage() < 1)       Main.game.getPlayer().incrementMana(turnTime * 0.1f);
    }
  }
  RenderingEngine.ENGINE.renderButtons();
  Main.mainController.updateUI();
  Main.mainController.getTooltip().hide();
  if (!Main.game.getPlayer().getStatusEffectDescriptions().isEmpty() && Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
    if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
      Main.game.saveDialogueNode();
    }
    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",MiscDialogue.STATUS_EFFECTS){
      @Override public void effects(){
        if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY) && Main.game.getPlayer().hasNonArcaneEssences()) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY));
        }
        if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY) && Main.game.getPlayer().isVisiblyPregnant()) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY));
        }
      }
    }
);
    Main.game.getPlayer().getStatusEffectDescriptions().clear();
  }
}

Fixed version (ground truth):
public void endTurn(int turnTime,boolean advanceTime){
  long startHour=getHour();
  if (advanceTime) {
    minutesPassed+=turnTime;
    updateResponses();
  }
  if (Main.game.getCurrentWeather() != Weather.SNOW && Main.game.getSeason() != Season.WINTER) {
    Main.game.getDialogueFlags().values.remove(DialogueFlagValue.hasSnowedThisWinter);
    for (    NPC npc : Main.game.getReindeerOverseers()) {
      if (npc.getLocation() != Main.game.getPlayer().getLocation()) {
        npc.setLocation(WorldType.EMPTY,PlaceType.GENERIC_EMPTY_TILE,true);
      }
    }
  }
  int hoursPassed=(int)(getHour() - startHour);
  int hourStartTo24=(int)(startHour % 24);
  for (int i=1; i <= hoursPassed; i++) {
    slaveryUtil.performHourlyUpdate(this.getDayNumber(startHour * 60 + i * 60),(hourStartTo24 + i) % 24);
  }
  boolean newDay=((int)(minutesPassed / (60 * 24)) != (int)(((minutesPassed - turnTime) / (60 * 24))));
  if (newDay) {
    AbstractClothing goggles=AbstractClothingType.generateClothing(ClothingType.SCIENTIST_EYES_SAFETY_GOGGLES,Colour.CLOTHING_BLACK,false);
    if (!Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().hasClothing(goggles)) {
      Main.game.getWorlds().get(WorldType.LILAYAS_HOUSE_GROUND_FLOOR).getCell(PlaceType.LILAYA_HOME_LAB).getInventory().addClothing(goggles);
    }
    pendingSlaveInStocksReset=true;
    for (    NPC npc : Main.game.getReindeerOverseers()) {
      if (npc.getLocationPlace().getPlaceType() == PlaceType.DOMINION_STREET && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) {
        npc.moveToAdjacentMatchingCellType();
        Main.game.getDialogueFlags().dailyReindeerReset(npc.getId());
      }
    }
  }
  if (pendingSlaveInStocksReset && Main.game.getPlayer().getLocationPlace().getPlaceType() != PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS) {
    for (    NPC npc : Main.game.getCharactersPresent(Main.game.getWorlds().get(WorldType.SLAVER_ALLEY).getCell(PlaceType.SLAVER_ALLEY_PUBLIC_STOCKS))) {
      if (npc instanceof SlaveInStocks) {
        Main.game.banishNPC(npc);
      }
    }
    for (int i=0; i < 4; i++) {
      SlaveInStocks slave=new SlaveInStocks(GenderPreference.getGenderFromUserPreferences());
      if (Math.random() > 0.5f) {
        Main.game.getGenericFemaleNPC().addSlave(slave);
      }
 else {
        Main.game.getGenericMaleNPC().addSlave(slave);
      }
      try {
        Main.game.addNPC(slave,false);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    pendingSlaveInStocksReset=false;
  }
  handleAtmosphericConditions(turnTime);
  isInNPCUpdateLoop=true;
  for (  NPC npc : NPCMap.values()) {
    if (npc.getLocationPlace().getPlaceType() != PlaceType.DOMINION_BACK_ALLEYS && npc.getWorldLocation() == WorldType.DOMINION && npc instanceof DominionAlleywayAttacker && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
      banishNPC(npc);
    }
    if (!Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
      npc.setHealthPercentage(1);
      npc.setManaPercentage(1);
      npc.setStaminaPercentage(1);
    }
  }
  for (  NPC npc : NPCMap.values()) {
    npc.calculateStatusEffects(turnTime);
    if (npc.isPendingClothingDressing() && (Main.game.getCurrentDialogueNode().equals(Main.game.getPlayer().getLocationPlace().getDialogue(false)) || !(npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation() && npc.getLocation().equals(Main.game.getPlayer().getLocation())))) {
      npc.equipClothing(true,true);
      npc.setPendingClothingDressing(false);
    }
    if (npc.isPendingTransformationToGenderIdentity()) {
      npc.setBody(npc.getGenderIdentity(),RacialBody.valueOfRace(npc.getRace()),npc.getRaceStage());
      CharacterUtils.randomiseBody(npc);
      npc.setPendingTransformationToGenderIdentity(false);
    }
    if ((!npc.isPregnant() && !npc.isSlave() && npc.getHistory() == History.PROSTITUTE && !npc.hasStatusEffect(StatusEffect.PROMISCUITY_PILL) && !npc.getLocation().equals(Main.game.getPlayer().getLocation())) || (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_PROMISCUITY_PILLS))) {
      npc.useItem(AbstractItemType.generateItem(ItemType.PROMISCUITY_PILL),npc,false);
    }
    if (npc.isSlave() && npc.getSlaveJobSettings().contains(SlaveJobSetting.SEX_VIXENS_VIRILITY)) {
      npc.useItem(AbstractItemType.generateItem(ItemType.VIXENS_VIRILITY),npc,false);
    }
    if (npc.hasStatusEffect(StatusEffect.PREGNANT_3) && (minutesPassed - npc.getTimeProgressedToFinalPregnancyStage()) > (12 * 60)) {
      if (npc instanceof Lilaya) {
        if (!Main.game.getDialogueFlags().values.contains(DialogueFlagValue.reactedToPregnancyLilaya)) {
          npc.endPregnancy(true);
        }
      }
 else {
        npc.endPregnancy(true);
        if (npc instanceof Kate) {
          Main.game.getDialogueFlags().values.remove(DialogueFlagValue.reactedToKatePregnancy);
        }
      }
    }
    if (npc.getLocation().equals(Main.game.getPlayer().getLocation()) && npc.getWorldLocation() == Main.game.getPlayer().getWorldLocation()) {
      for (      CoverableArea ca : CoverableArea.values()) {
        if (npc.isCoverableAreaExposed(ca) && ca != CoverableArea.MOUTH) {
          npc.getPlayerKnowsAreasMap().put(ca,true);
        }
      }
    }
    if (newDay) {
      npc.dailyReset();
    }
  }
  isInNPCUpdateLoop=false;
  for (  NPC npc : npcsToRemove) {
    NPCMap.remove(npc.getId());
  }
  for (  NPC npc : npcsToAdd) {
    NPCMap.put(npc.getId(),npc);
  }
  npcsToRemove.clear();
  npcsToAdd.clear();
  if (!isInCombat()) {
    if (Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
      Main.game.getPlayer().calculateStatusEffects(turnTime);
    }
    if (!inSex && !currentDialogueNode.isRegenerationDisabled()) {
      if (Main.game.getPlayer().getStaminaPercentage() < 1)       Main.game.getPlayer().incrementStamina(turnTime * 0.1f);
      if (Main.game.getPlayer().getHealthPercentage() < 1)       Main.game.getPlayer().incrementHealth(turnTime * 0.1f);
      if (Main.game.getPlayer().getManaPercentage() < 1)       Main.game.getPlayer().incrementMana(turnTime * 0.1f);
    }
  }
  RenderingEngine.ENGINE.renderButtons();
  Main.mainController.updateUI();
  Main.mainController.getTooltip().hide();
  if (!Main.game.getPlayer().getStatusEffectDescriptions().isEmpty() && Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
    if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
      Main.game.saveDialogueNode();
    }
    Main.game.setContent(new Response("String_Node_Str","String_Node_Str",MiscDialogue.STATUS_EFFECTS){
      @Override public void effects(){
        if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY) && Main.game.getPlayer().hasNonArcaneEssences()) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_ENCHANTMENT_DISCOVERY));
        }
        if (!Main.game.getPlayer().hasQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY) && Main.game.getPlayer().isVisiblyPregnant()) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY));
        }
      }
    }
);
    Main.game.getPlayer().getStatusEffectDescriptions().clear();
  }
}