Program: 171237
Project: 171237
Buggy source:
public default Response toResponse(){
  if (isBaseRequirementsMet() && isPhysicallyPossible() && !isBannedFromSexManager()) {
    if (this.getActionType() == SexActionType.POSITIONING && !Sex.isPositionChangingAllowed()) {
      return null;
    }
    for (    Entry<SexAreaInterface,SexAreaInterface> entry : getSexAreaInteractions().entrySet()) {
      if (isForbiddenArea(entry.getKey()) || isForbiddenArea(entry.getValue())) {
        return null;
      }
    }
    if (Sex.getCharacterPerformingAction().isPlayer()) {
      if (this.getParticipantType() == SexParticipantType.CATCHER && this.getTargetedCharacterPenetrations().contains(SexAreaPenetration.PENIS) && !Sex.getCharacterTargetedForSexAction().getPlayerKnowsAreas().contains(CoverableArea.PENIS)) {
        return null;
      }
      for (      SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
          if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.NIPPLES)) {
            return null;
          }
        break;
case URETHRA_PENIS:
      if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.PENIS)) {
        return null;
      }
    break;
case URETHRA_VAGINA:
  if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.VAGINA)) {
    return null;
  }
break;
case VAGINA:
if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.VAGINA)) {
return null;
}
break;
default :
break;
}
}
}
if (Sex.getCharacterPerformingAction().isPlayer() && getActionType() == SexActionType.PREPARE_FOR_PARTNER_ORGASM) {
if (!Sex.isPartnerReadyToOrgasm()) {
return null;
}
 else {
return convertToResponse();
}
}
if (!Sex.getCharacterPerformingAction().isPlayer() && getActionType() == SexActionType.PREPARE_FOR_PARTNER_ORGASM) {
if (!Sex.isPlayerReadyToOrgasm()) {
return null;
}
 else {
return convertToResponse();
}
}
if (getSexPace(Sex.getCharacterPerformingAction()) == SexPace.SUB_RESISTING) {
if (Sex.isConsensual() || !Main.game.isNonConEnabled()) {
return null;
}
}
if (getActionType() == SexActionType.POSITIONING) {
return convertToResponse();
}
 else if (getActionType() == SexActionType.STOP_ONGOING) {
if (!this.getSexAreaInteractions().isEmpty()) {
boolean ongoingFound=false;
for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
if (Sex.getCharacterContactingSexArea(Sex.getCharacterPerformingAction(),sArea).contains(Sex.getCharacterTargetedForSexAction())) {
ongoingFound=true;
break;
}
}
if (!ongoingFound) {
return null;
}
if (this.getParticipantType() != SexParticipantType.SELF) {
if (!Sex.isSubHasEqualControl() && !Sex.isDom(Sex.getCharacterPerformingAction())) {
return null;
}
}
}
 else {
return null;
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.START_ONGOING) {
if (!this.getSexAreaInteractions().isEmpty()) {
if (this.getParticipantType() != SexParticipantType.SELF) {
if ((!Sex.isSubHasEqualControl() && !Sex.isDom(Sex.getCharacterPerformingAction())) || getSexPace(Sex.getCharacterPerformingAction()) == SexPace.SUB_RESISTING) {
return null;
}
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
if (!Sex.getCharacterPerformingAction().isBreastFuckableNipplePenetration()) {
return null;
}
break;
default :
break;
}
if (!Sex.getCharacterPerformingAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
if (!Sex.getCharacterTargetedForSexAction().isBreastFuckableNipplePenetration()) {
return null;
}
break;
default :
break;
}
if (!Sex.getCharacterTargetedForSexAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!Sex.getCharacterPerformingAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!Sex.getCharacterTargetedForSexAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.REQUIRES_NO_PENETRATION_AND_EXPOSED) {
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!Sex.getCharacterPerformingAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!Sex.getCharacterTargetedForSexAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
if (!Sex.getCharacterPerformingAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
if (!Sex.getCharacterTargetedForSexAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.REQUIRES_NO_PENETRATION) {
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else {
if (!this.getSexAreaInteractions().isEmpty()) {
boolean ongoingFound=false;
for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
for (SexAreaInterface sAreaTarget : this.getSexAreaInteractions().values()) {
if (Sex.getContactingSexAreas(Sex.getCharacterPerformingAction(),sArea,Sex.getCharacterTargetedForSexAction()).contains(sAreaTarget)) {
ongoingFound=true;
return convertToResponse();
}
}
}
if (!ongoingFound) {
return null;
}
}
return convertToResponse();
}
}
 else {
return null;
}
}

Fixed version (ground truth):
public default Response toResponse(){
  if (isBaseRequirementsMet() && isPhysicallyPossible() && !isBannedFromSexManager()) {
    if (this.getActionType() == SexActionType.POSITIONING && !Sex.isPositionChangingAllowed()) {
      return null;
    }
    for (    Entry<SexAreaInterface,SexAreaInterface> entry : getSexAreaInteractions().entrySet()) {
      if (isForbiddenArea(entry.getKey()) || isForbiddenArea(entry.getValue())) {
        return null;
      }
    }
    if (Sex.getCharacterPerformingAction().isPlayer()) {
      if (this.getParticipantType() == SexParticipantType.CATCHER && this.getTargetedCharacterPenetrations().contains(SexAreaPenetration.PENIS) && !Sex.getCharacterTargetedForSexAction().getPlayerKnowsAreas().contains(CoverableArea.PENIS)) {
        return null;
      }
      for (      SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
          if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.NIPPLES)) {
            return null;
          }
        break;
case URETHRA_PENIS:
      if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.PENIS)) {
        return null;
      }
    break;
case URETHRA_VAGINA:
  if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.VAGINA)) {
    return null;
  }
break;
case VAGINA:
if (!Sex.getActivePartner().getPlayerKnowsAreas().contains(CoverableArea.VAGINA)) {
return null;
}
break;
default :
break;
}
}
}
if (Sex.getCharacterPerformingAction().isPlayer() && getActionType() == SexActionType.PREPARE_FOR_PARTNER_ORGASM) {
if (!Sex.isPartnerReadyToOrgasm()) {
return null;
}
 else {
return convertToResponse();
}
}
if (!Sex.getCharacterPerformingAction().isPlayer() && getActionType() == SexActionType.PREPARE_FOR_PARTNER_ORGASM) {
if (!Sex.isPlayerReadyToOrgasm()) {
return null;
}
 else {
return convertToResponse();
}
}
if (getSexPace(Sex.getCharacterPerformingAction()) == SexPace.SUB_RESISTING) {
if (Sex.isConsensual() || !Main.game.isNonConEnabled()) {
return null;
}
}
if (getActionType() == SexActionType.POSITIONING) {
return convertToResponse();
}
 else if (getActionType() == SexActionType.STOP_ONGOING) {
if (!this.getSexAreaInteractions().isEmpty()) {
boolean ongoingFound=false;
if (this.getParticipantType().isUsingSelfPenetrationType()) {
outerloop: for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
for (SexAreaInterface sAreaTarget : this.getSexAreaInteractions().values()) {
if (Sex.getContactingSexAreas(Sex.getCharacterPerformingAction(),sArea,Sex.getCharacterTargetedForSexAction()).contains(sAreaTarget)) {
ongoingFound=true;
break outerloop;
}
}
}
}
 else {
outerloop: for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
for (SexAreaInterface sAreaTarget : this.getSexAreaInteractions().values()) {
if (Sex.getContactingSexAreas(Sex.getCharacterTargetedForSexAction(),sArea,Sex.getCharacterPerformingAction()).contains(sAreaTarget)) {
ongoingFound=true;
break outerloop;
}
}
}
}
if (!ongoingFound) {
return null;
}
if (this.getParticipantType() != SexParticipantType.SELF) {
if (!Sex.isSubHasEqualControl() && !Sex.isDom(Sex.getCharacterPerformingAction())) {
return null;
}
}
}
 else {
return null;
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.START_ONGOING) {
if (!this.getSexAreaInteractions().isEmpty()) {
if (this.getParticipantType() != SexParticipantType.SELF) {
if ((!Sex.isSubHasEqualControl() && !Sex.isDom(Sex.getCharacterPerformingAction())) || getSexPace(Sex.getCharacterPerformingAction()) == SexPace.SUB_RESISTING) {
return null;
}
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
if (!Sex.getCharacterPerformingAction().isBreastFuckableNipplePenetration()) {
return null;
}
break;
default :
break;
}
if (!Sex.getCharacterPerformingAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
switch (sArea) {
case NIPPLE:
if (!Sex.getCharacterTargetedForSexAction().isBreastFuckableNipplePenetration()) {
return null;
}
break;
default :
break;
}
if (!Sex.getCharacterTargetedForSexAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!Sex.getCharacterPerformingAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!Sex.getCharacterTargetedForSexAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.REQUIRES_NO_PENETRATION_AND_EXPOSED) {
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!Sex.getCharacterPerformingAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!Sex.getCharacterTargetedForSexAction().isPenetrationTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
if (!Sex.getCharacterPerformingAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
if (!Sex.getCharacterTargetedForSexAction().isOrificeTypeExposed(sArea)) {
return convertToNullResponse();
}
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else if (getActionType() == SexActionType.REQUIRES_NO_PENETRATION) {
for (SexAreaPenetration sArea : this.getPerformingCharacterPenetrations()) {
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaPenetration sArea : this.getTargetedCharacterPenetrations()) {
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getPerformingCharacterOrifices()) {
if (!sArea.isFree(Sex.getCharacterPerformingAction())) {
return convertToNullResponse();
}
}
for (SexAreaOrifice sArea : this.getTargetedCharacterOrifices()) {
if (!sArea.isFree(Sex.getCharacterTargetedForSexAction())) {
return convertToNullResponse();
}
}
return convertToResponse();
}
 else {
if (!this.getSexAreaInteractions().isEmpty()) {
boolean ongoingFound=false;
if (this.getParticipantType().isUsingSelfPenetrationType()) {
for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
for (SexAreaInterface sAreaTarget : this.getSexAreaInteractions().values()) {
if (Sex.getContactingSexAreas(Sex.getCharacterPerformingAction(),sArea,Sex.getCharacterTargetedForSexAction()).contains(sAreaTarget)) {
ongoingFound=true;
return convertToResponse();
}
}
}
}
 else {
for (SexAreaInterface sArea : this.getSexAreaInteractions().keySet()) {
for (SexAreaInterface sAreaTarget : this.getSexAreaInteractions().values()) {
if (Sex.getContactingSexAreas(Sex.getCharacterTargetedForSexAction(),sArea,Sex.getCharacterPerformingAction()).contains(sAreaTarget)) {
ongoingFound=true;
return convertToResponse();
}
}
}
}
if (!ongoingFound) {
return null;
}
}
return convertToResponse();
}
}
 else {
return null;
}
}