Program: 171287
Project: 171287
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);
    }
    if (!npc.isSlave() && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
      npc.cleanAllClothing();
      npc.cleanAllDirtySlots();
    }
    if (!Main.game.getPlayer().getLocation().equals(npc.getLocation()) && !Main.game.isInCombat() && !Main.game.isInSex()) {
      npc.setHealthPercentage(1);
      npc.setManaPercentage(1);
      npc.alignLustToRestingLust(turnTime);
    }
    npc.calculateStatusEffects(turnTime);
    if ((npc.isPendingClothingDressing() || (!npc.isSlave() && !npc.isUnique() && (npc.hasStatusEffect(StatusEffect.EXPOSED) || npc.hasStatusEffect(StatusEffect.EXPOSED_BREASTS) || npc.hasStatusEffect(StatusEffect.EXPOSED_PLUS_BREASTS)))) && (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.getPlayerKnowsAreas().add(ca);
        }
      }
    }
    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 (!isInSex() && !currentDialogueNode.isRegenerationDisabled()) {
      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);
      }
      Main.game.getPlayer().alignLustToRestingLust(turnTime);
    }
  }
  if (Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
    Main.game.getPlayer().calculateStatusEffects(turnTime);
  }
  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().startQuest(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().startQuest(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 (!npc.isSlave() && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
      npc.cleanAllClothing();
      npc.cleanAllDirtySlots();
    }
    if (!Main.game.getPlayer().getLocation().equals(npc.getLocation()) && !Main.game.isInCombat() && !Main.game.isInSex()) {
      npc.setHealthPercentage(1);
      npc.setManaPercentage(1);
    }
    npc.alignLustToRestingLust(turnTime * 10);
    npc.calculateStatusEffects(turnTime);
    if ((npc.isPendingClothingDressing() || (!npc.isSlave() && !npc.isUnique() && (npc.hasStatusEffect(StatusEffect.EXPOSED) || npc.hasStatusEffect(StatusEffect.EXPOSED_BREASTS) || npc.hasStatusEffect(StatusEffect.EXPOSED_PLUS_BREASTS)))) && (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.getPlayerKnowsAreas().add(ca);
        }
      }
    }
    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 (!isInSex() && !currentDialogueNode.isRegenerationDisabled()) {
      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);
      }
      Main.game.getPlayer().alignLustToRestingLust(turnTime);
    }
  }
  if (Main.game.getCurrentDialogueNode() != MiscDialogue.STATUS_EFFECTS) {
    Main.game.getPlayer().calculateStatusEffects(turnTime);
  }
  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().startQuest(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().startQuest(QuestLine.SIDE_FIRST_TIME_PREGNANCY));
        }
      }
    }
);
    Main.game.getPlayer().getStatusEffectDescriptions().clear();
  }
}