Program: 171238
Project: 171238
Buggy source:
private SexAction performSexAction(SexActionInterface sexActionPlayer){
  List<SexActionInterface> availableActions=Sex.getAvailableSexActionsPartner();
  if (sexActionPlayer.getActionType() == SexActionType.STOP_ONGOING || sexActionPlayer.equals(GenericActions.PLAYER_FORBID_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_ALL_PENETRATIONS)) {
    availableActions.removeIf(sexAction -> sexAction.getActionType() == SexActionType.START_ONGOING);
  }
  bannedActions.add(PartnerSelfFingerMouth.PARTNER_SELF_FINGER_MOUTH_PENETRATION);
  availableActions.removeAll(bannedActions);
  List<SexActionInterface> returnableActions=new ArrayList<>();
  boolean isSexPenetration=false;
  boolean isSexPenetrationPossible=Sex.getActivePartner().hasPenis() || Sex.getActivePartner().getTailType().isSuitableForPenetration() || Main.game.getPlayer().hasPenis()|| Main.game.getPlayer().getTailType().isSuitableForPenetration();
  outerloop:   for (  GameCharacter penetrator : Sex.getAllParticipants()) {
    for (    GameCharacter penetrated : Sex.getAllParticipants()) {
      if ((penetrator.equals(Sex.getActivePartner()) || penetrated.equals(Sex.getActivePartner())) && !penetrator.equals(penetrated)) {
        for (        Map<GameCharacter,Set<SexAreaInterface>> e : Sex.getOngoingActionsMap(penetrator).values()) {
          for (          SexAreaInterface sArea : e.get(penetrated)) {
            if (sArea.isPenetration() && ((SexAreaPenetration)sArea).isTakesVirginity()) {
              isSexPenetration=true;
              break outerloop;
            }
          }
        }
      }
    }
  }
  if (!isSexPenetration && isSexPenetrationPossible) {
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.STOP_ONGOING) {
        if (!(action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE) && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH)) && !(Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_RECEIVING) && ((!action.getParticipantType().isUsingSelfOrificeType() && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || (!action.getParticipantType().isUsingSelfPenetrationType() && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE))))) && !(Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_GIVING) && ((action.getParticipantType().isUsingSelfOrificeType() && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || (action.getParticipantType().isUsingSelfPenetrationType() && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE)))))) {
          returnableActions.add(action);
        }
      }
    }
    if (returnableActions.size() <= 1) {
      SexFlags.positioningBlockedPartner=false;
    }
    if (!returnableActions.isEmpty()) {
      return (SexAction)returnableActions.get(Util.random.nextInt(returnableActions.size()));
    }
    List<SexActionInterface> penetrativeActionList=new ArrayList<>();
    if (Sex.getActivePartner().getMainSexPreference() != null) {
      List<SexActionInterface> highPriorityList=new ArrayList<>();
      for (      SexActionInterface action : availableActions) {
        if (action.getPerformingCharacterOrifices().contains(Sex.getActivePartner().getMainSexPreference().getOrificeType()) && action.getPerformingCharacterPenetrations().contains(Sex.getActivePartner().getMainSexPreference().getPenetrationType()) && action.getParticipantType() != SexParticipantType.SELF && action.getActionType() != SexActionType.STOP_ONGOING) {
          highPriorityList.add(action);
          if (action.getActionType() == SexActionType.START_ONGOING) {
            penetrativeActionList.add(action);
          }
        }
      }
      if (penetrativeActionList.isEmpty() && !highPriorityList.isEmpty() && Math.random() < 0.7f) {
        return (SexAction)highPriorityList.get(Util.random.nextInt(highPriorityList.size()));
      }
    }
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.START_ONGOING && action.getParticipantType().isUsingSelfPenetrationType()) {
        if (action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TAIL)) {
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_ANAL_GIVING) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.ANUS)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.ANUS)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.NIPPLE)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.NIPPLE)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.BREAST)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.BREAST)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_VAGINAL_GIVING) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.VAGINA)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.VAGINA)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_IMPREGNATION) || Sex.getActivePartner().hasFetish(Fetish.FETISH_SEEDER) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.VAGINA)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.VAGINA) && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_PREGNANCY) || Sex.getActivePartner().hasFetish(Fetish.FETISH_BROODMOTHER)) && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.VAGINA) && action.getTargetedCharacterPenetrations().contains(SexAreaPenetration.PENIS)) {
            penetrativeActionList.add(action);
          }
        }
      }
    }
    if (!penetrativeActionList.isEmpty()) {
      return (SexAction)penetrativeActionList.get(Util.random.nextInt(penetrativeActionList.size()));
    }
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.START_ONGOING) {
        if (action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TAIL)) {
          returnableActions.add(action);
        }
      }
    }
    returnableActions.removeAll(bannedActions);
    if (!returnableActions.isEmpty()) {
      return (SexAction)returnableActions.get(Util.random.nextInt(returnableActions.size()));
    }
  }
  for (  SexActionInterface action : availableActions) {
    if (action.getActionType() == SexActionType.STOP_ONGOING) {
      if (action.isTakesVirginity(Sex.getCharacterPerformingAction())) {
        bannedActions.add(action);
      }
      if (Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_RECEIVING) && (action.getTargetedCharacterOrifices().contains(SexAreaOrifice.MOUTH) || action.getTargetedCharacterPenetrations().contains(SexAreaPenetration.TONGUE))) {
        bannedActions.add(action);
      }
      if (Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_GIVING) && (action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE))) {
        bannedActions.add(action);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private SexAction performSexAction(SexActionInterface sexActionPlayer){
  List<SexActionInterface> availableActions=Sex.getAvailableSexActionsPartner();
  if (sexActionPlayer.getActionType() == SexActionType.STOP_ONGOING || sexActionPlayer.equals(GenericActions.PLAYER_FORBID_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_ALL_PENETRATIONS)) {
    availableActions.removeIf(sexAction -> sexAction.getActionType() == SexActionType.START_ONGOING);
  }
  bannedActions.add(PartnerSelfFingerMouth.PARTNER_SELF_FINGER_MOUTH_PENETRATION);
  availableActions.removeAll(bannedActions);
  List<SexActionInterface> returnableActions=new ArrayList<>();
  boolean isSexPenetration=false;
  boolean isSexPenetrationPossible=Sex.getActivePartner().hasPenis() || Sex.getActivePartner().getTailType().isSuitableForPenetration() || Main.game.getPlayer().hasPenis()|| Main.game.getPlayer().getTailType().isSuitableForPenetration();
  outerloop:   for (  GameCharacter penetrator : Sex.getAllParticipants()) {
    for (    GameCharacter penetrated : Sex.getAllParticipants()) {
      if ((penetrator.equals(Sex.getActivePartner()) || penetrated.equals(Sex.getActivePartner())) && !penetrator.equals(penetrated)) {
        for (        Map<GameCharacter,Set<SexAreaInterface>> e : Sex.getOngoingActionsMap(penetrator).values()) {
          if (e.containsKey(penetrated)) {
            for (            SexAreaInterface sArea : e.get(penetrated)) {
              if (sArea.isPenetration() && ((SexAreaPenetration)sArea).isTakesVirginity()) {
                isSexPenetration=true;
                break outerloop;
              }
            }
          }
        }
      }
    }
  }
  if (!isSexPenetration && isSexPenetrationPossible) {
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.STOP_ONGOING) {
        if (!(action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE) && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH)) && !(Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_RECEIVING) && ((!action.getParticipantType().isUsingSelfOrificeType() && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || (!action.getParticipantType().isUsingSelfPenetrationType() && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE))))) && !(Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_GIVING) && ((action.getParticipantType().isUsingSelfOrificeType() && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || (action.getParticipantType().isUsingSelfPenetrationType() && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE)))))) {
          returnableActions.add(action);
        }
      }
    }
    if (returnableActions.size() <= 1) {
      SexFlags.positioningBlockedPartner=false;
    }
    if (!returnableActions.isEmpty()) {
      return (SexAction)returnableActions.get(Util.random.nextInt(returnableActions.size()));
    }
    List<SexActionInterface> penetrativeActionList=new ArrayList<>();
    if (Sex.getActivePartner().getMainSexPreference() != null) {
      List<SexActionInterface> highPriorityList=new ArrayList<>();
      for (      SexActionInterface action : availableActions) {
        if (action.getPerformingCharacterOrifices().contains(Sex.getActivePartner().getMainSexPreference().getOrificeType()) && action.getPerformingCharacterPenetrations().contains(Sex.getActivePartner().getMainSexPreference().getPenetrationType()) && action.getParticipantType() != SexParticipantType.SELF && action.getActionType() != SexActionType.STOP_ONGOING) {
          highPriorityList.add(action);
          if (action.getActionType() == SexActionType.START_ONGOING) {
            penetrativeActionList.add(action);
          }
        }
      }
      if (penetrativeActionList.isEmpty() && !highPriorityList.isEmpty() && Math.random() < 0.7f) {
        return (SexAction)highPriorityList.get(Util.random.nextInt(highPriorityList.size()));
      }
    }
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.START_ONGOING && action.getParticipantType().isUsingSelfPenetrationType()) {
        if (action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TAIL)) {
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_ANAL_GIVING) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.ANUS)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.ANUS)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.NIPPLE)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.NIPPLE)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.BREAST)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.BREAST)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_VAGINAL_GIVING) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.VAGINA)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.VAGINA)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_IMPREGNATION) || Sex.getActivePartner().hasFetish(Fetish.FETISH_SEEDER) || Sex.getPlayerPenetrationRequests().contains(SexAreaOrifice.VAGINA)) && action.getTargetedCharacterOrifices().contains(SexAreaOrifice.VAGINA) && action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS)) {
            penetrativeActionList.add(action);
          }
          if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_PREGNANCY) || Sex.getActivePartner().hasFetish(Fetish.FETISH_BROODMOTHER)) && action.getPerformingCharacterOrifices().contains(SexAreaOrifice.VAGINA) && action.getTargetedCharacterPenetrations().contains(SexAreaPenetration.PENIS)) {
            penetrativeActionList.add(action);
          }
        }
      }
    }
    if (!penetrativeActionList.isEmpty()) {
      return (SexAction)penetrativeActionList.get(Util.random.nextInt(penetrativeActionList.size()));
    }
    for (    SexActionInterface action : availableActions) {
      if (action.getActionType() == SexActionType.START_ONGOING) {
        if (action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.PENIS) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TAIL)) {
          returnableActions.add(action);
        }
      }
    }
    returnableActions.removeAll(bannedActions);
    if (!returnableActions.isEmpty()) {
      return (SexAction)returnableActions.get(Util.random.nextInt(returnableActions.size()));
    }
  }
  for (  SexActionInterface action : availableActions) {
    if (action.getActionType() == SexActionType.STOP_ONGOING) {
      if (action.isTakesVirginity(Sex.getCharacterPerformingAction())) {
        bannedActions.add(action);
      }
      if (Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_RECEIVING) && (action.getTargetedCharacterOrifices().contains(SexAreaOrifice.MOUTH) || action.getTargetedCharacterPenetrations().contains(SexAreaPenetration.TONGUE))) {
        bannedActions.add(action);
      }
      if (Sex.getActivePartner().hasFetish(Fetish.FETISH_ORAL_GIVING) && (action.getPerformingCharacterOrifices().contains(SexAreaOrifice.MOUTH) || action.getPerformingCharacterPenetrations().contains(SexAreaPenetration.TONGUE))) {
        bannedActions.add(action);
      }
    }
  }
  return null;
}