Program: 171373
Project: 171373
Buggy source:
public void endTurn(int turnTime,boolean advanceTime){
  if (advanceTime) {
    minutesPassed+=turnTime;
    setResponses(currentDialogueNode,false);
  }
  handleAtmosphericConditions(turnTime);
  NPCMap.entrySet().removeIf(e -> (e.getValue().getLocationPlace().getPlaceType() != Dominion.CITY_BACK_ALLEYS && e.getValue().getWorldLocation() == WorldType.DOMINION && !Main.game.getPlayer().getLocation().equals(e.getValue().getLocation())));
  boolean randomAttackerSEApplied=false;
  for (  NPC npc : NPCMap.values()) {
    npc.calculateStatusEffects(turnTime);
    if (npc.isPendingClothingDressing()) {
      npc.equipClothing(true,true);
      npc.setPendingClothingDressing(false);
    }
    if (npc.hasStatusEffect(StatusEffect.PREGNANT_3) && (minutesPassed - npc.getTimeProgressedToFinalPregnancyStage()) > (12 * 60)) {
      if (npc == lilaya) {
        if (!Main.game.getDialogueFlags().reactedToPregnancyLilaya) {
          npc.endPregnancy(true);
        }
      }
 else {
        npc.endPregnancy(true);
        if (npc == kate) {
          Main.game.getDialogueFlags().reactedToKatePregnancy=false;
        }
      }
    }
    if (npc == activeNPC) {
      randomAttackerSEApplied=true;
    }
    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 (activeNPC != null && !randomAttackerSEApplied) {
    activeNPC.calculateStatusEffects(turnTime);
  }
  if (!inCombat) {
    currentCell=activeWorld.getCell(player.getLocation());
    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);
    }
  }
  if ((int)(minutesPassed / (60 * 24)) != (int)(((minutesPassed - turnTime) / (60 * 24)))) {
    ralph.applyReset();
    nyan.applyReset();
    vicky.applyReset();
    kate.applyReset();
    finch.applyReset();
    alexa.applyReset();
    for (    NPC slave : Main.game.getPlayer().getSlavesOwned()) {
      slave.incrementAffection(Main.game.getPlayer(),slave.getDailyAffectionChange());
      slave.incrementObedience(slave.getDailyObedienceChange());
    }
  }
  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_JINXED_CLOTHING) && Main.game.getPlayer().hasStatusEffect(StatusEffect.CLOTHING_JINXED)) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_JINXED_CLOTHING));
        }
        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){
  if (advanceTime) {
    minutesPassed+=turnTime;
    setResponses(currentDialogueNode,false);
  }
  boolean newDay=((int)(minutesPassed / (60 * 24)) != (int)(((minutesPassed - turnTime) / (60 * 24))));
  handleAtmosphericConditions(turnTime);
  NPCMap.entrySet().removeIf(e -> (e.getValue().getLocationPlace().getPlaceType() != Dominion.CITY_BACK_ALLEYS && e.getValue().getWorldLocation() == WorldType.DOMINION && !Main.game.getPlayer().getLocation().equals(e.getValue().getLocation())));
  for (  NPC npc : NPCMap.values()) {
    npc.calculateStatusEffects(turnTime);
    if (npc.isPendingClothingDressing()) {
      npc.equipClothing(true,true);
      npc.setPendingClothingDressing(false);
    }
    if (npc.hasStatusEffect(StatusEffect.PREGNANT_3) && (minutesPassed - npc.getTimeProgressedToFinalPregnancyStage()) > (12 * 60)) {
      if (npc == lilaya) {
        if (!Main.game.getDialogueFlags().reactedToPregnancyLilaya) {
          npc.endPregnancy(true);
        }
      }
 else {
        npc.endPregnancy(true);
        if (npc == kate) {
          Main.game.getDialogueFlags().reactedToKatePregnancy=false;
        }
      }
    }
    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();
      if (npc.isSlave()) {
        npc.incrementAffection(npc.getOwner(),npc.getDailyAffectionChange());
        npc.incrementObedience(npc.getDailyObedienceChange());
      }
    }
  }
  if (!isInCombat()) {
    currentCell=activeWorld.getCell(player.getLocation());
    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_JINXED_CLOTHING) && Main.game.getPlayer().hasStatusEffect(StatusEffect.CLOTHING_JINXED)) {
          Main.game.getTextEndStringBuilder().append(Main.game.getPlayer().incrementQuest(QuestLine.SIDE_JINXED_CLOTHING));
        }
        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();
  }
}