Search in sources :

Example 1 with SexParticipantType

use of com.lilithsthrone.game.sex.SexParticipantType in project liliths-throne-public by Innoxia.

the class GameCharacter method saveAsXML.

@Override
public Element saveAsXML(Element parentElement, Document doc) {
    Element properties = doc.createElement("character");
    parentElement.appendChild(properties);
    // ************** Core information **************//
    Element characterCoreInfo = doc.createElement("core");
    Comment comment = doc.createComment("If you want to edit any of these values, just be warned that it might break the game...");
    properties.appendChild(characterCoreInfo);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "id", this.getId());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "pathName", this.getClass().getCanonicalName());
    Element name = doc.createElement("name");
    characterCoreInfo.appendChild(name);
    CharacterUtils.addAttribute(doc, name, "nameFeminine", this.getNameTriplet().getFeminine());
    CharacterUtils.addAttribute(doc, name, "nameAndrogynous", this.getNameTriplet().getAndrogynous());
    CharacterUtils.addAttribute(doc, name, "nameMasculine", this.getNameTriplet().getMasculine());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "surname", this.getSurname());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "description", this.getDescription());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "playerPetName", playerPetName);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "playerKnowsName", String.valueOf(this.isPlayerKnowsName()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "level", String.valueOf(this.getTrueLevel()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "version", Main.VERSION_NUMBER);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "history", this.getHistory().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "personality", this.getPersonality().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "sexualOrientation", this.getSexualOrientation().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "obedience", String.valueOf(this.getObedienceValue()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "genderIdentity", String.valueOf(this.getGenderIdentity()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "experience", String.valueOf(this.getExperience()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "perkPoints", String.valueOf(this.getPerkPoints()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "health", String.valueOf(this.getHealth()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "mana", String.valueOf(this.getMana()));
    // Knows area map:
    Element characterPlayerKnowsAreas = doc.createElement("playerKnowsAreas");
    characterCoreInfo.appendChild(characterPlayerKnowsAreas);
    for (CoverableArea area : getPlayerKnowsAreas()) {
        Element element = doc.createElement("area");
        characterPlayerKnowsAreas.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", area.toString());
    }
    characterCoreInfo.getParentNode().insertBefore(comment, characterCoreInfo);
    // ************** Location Information **************//
    Element locationInformation = doc.createElement("locationInformation");
    properties.appendChild(locationInformation);
    CharacterUtils.createXMLElementWithValue(doc, locationInformation, "worldLocation", this.getWorldLocation().toString());
    CharacterUtils.createXMLElementWithValue(doc, locationInformation, "homeWorldLocation", this.getHomeWorldLocation().toString());
    Element location = doc.createElement("location");
    locationInformation.appendChild(location);
    CharacterUtils.addAttribute(doc, location, "x", String.valueOf(this.getLocation().getX()));
    CharacterUtils.addAttribute(doc, location, "y", String.valueOf(this.getLocation().getY()));
    location = doc.createElement("homeLocation");
    locationInformation.appendChild(location);
    CharacterUtils.addAttribute(doc, location, "x", String.valueOf(this.getHomeLocation().getX()));
    CharacterUtils.addAttribute(doc, location, "y", String.valueOf(this.getHomeLocation().getY()));
    // ************** Body **************//
    Element characterBody = doc.createElement("body");
    properties.appendChild(characterBody);
    this.body.saveAsXML(characterBody, doc);
    // ************** Inventory **************//
    this.inventory.saveAsXML(properties, doc);
    // ************** Attributes **************//
    // Attributes:
    Element characterCoreAttributes = doc.createElement("attributes");
    properties.appendChild(characterCoreAttributes);
    for (Attribute att : Attribute.values()) {
        if (this.getBaseAttributeValue(att) != att.getBaseValue()) {
            Element element = doc.createElement("attribute");
            characterCoreAttributes.appendChild(element);
            CharacterUtils.addAttribute(doc, element, "type", att.toString());
            CharacterUtils.addAttribute(doc, element, "value", String.valueOf(this.getBaseAttributeValue(att)));
        }
    }
    Element characterPotionAttributes = doc.createElement("potionAttributes");
    properties.appendChild(characterPotionAttributes);
    for (Entry<Attribute, Float> entry : getPotionAttributes().entrySet()) {
        Element element = doc.createElement("attribute");
        characterPotionAttributes.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, element, "value", String.valueOf(entry.getValue()));
    }
    // Perks:
    Element characterEquippedPerks = doc.createElement("traits");
    properties.appendChild(characterEquippedPerks);
    for (Perk p : this.getTraits()) {
        Element element = doc.createElement("perk");
        characterEquippedPerks.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", p.toString());
    }
    Element characterPerks = doc.createElement("perks");
    properties.appendChild(characterPerks);
    for (Entry<Integer, Set<Perk>> p : this.getPerksMap().entrySet()) {
        for (Perk perk : p.getValue()) {
            Element element = doc.createElement("perk");
            characterPerks.appendChild(element);
            CharacterUtils.addAttribute(doc, element, "row", p.getKey().toString());
            CharacterUtils.addAttribute(doc, element, "type", perk.toString());
        }
    }
    // Fetishes:
    Element characterFetishes = doc.createElement("fetishes");
    properties.appendChild(characterFetishes);
    for (Fetish f : this.getFetishes()) {
        Element element = doc.createElement("fetish");
        characterFetishes.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", f.toString());
    }
    Element fetishDesire = doc.createElement("fetishDesire");
    properties.appendChild(fetishDesire);
    for (Entry<Fetish, FetishDesire> entry : this.getFetishDesireMap().entrySet()) {
        Element fondenessEntry = doc.createElement("entry");
        fetishDesire.appendChild(fondenessEntry);
        CharacterUtils.addAttribute(doc, fondenessEntry, "fetish", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, fondenessEntry, "desire", entry.getValue().toString());
    }
    Element fetishExperience = doc.createElement("fetishExperience");
    properties.appendChild(fetishExperience);
    for (Entry<Fetish, Integer> entry : this.getFetishExperienceMap().entrySet()) {
        Element expEntry = doc.createElement("entry");
        fetishExperience.appendChild(expEntry);
        CharacterUtils.addAttribute(doc, expEntry, "fetish", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, expEntry, "experience", String.valueOf(entry.getValue()));
    }
    // Status effects:
    Element characterStatusEffects = doc.createElement("statusEffects");
    properties.appendChild(characterStatusEffects);
    for (StatusEffect se : this.getStatusEffects()) {
        Element element = doc.createElement("statusEffect");
        characterStatusEffects.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", se.toString());
        CharacterUtils.addAttribute(doc, element, "value", String.valueOf(this.getStatusEffectDuration(se)));
    }
    // ************** Relationships **************//
    Element characterRelationships = doc.createElement("characterRelationships");
    properties.appendChild(characterRelationships);
    for (Entry<String, Float> entry : this.getAffectionMap().entrySet()) {
        Element relationship = doc.createElement("relationship");
        characterRelationships.appendChild(relationship);
        CharacterUtils.addAttribute(doc, relationship, "character", entry.getKey());
        CharacterUtils.addAttribute(doc, relationship, "value", String.valueOf(entry.getValue()));
    }
    // ************** Pregnancy **************//
    // Pregnancy:
    Element characterPregnancy = doc.createElement("pregnancy");
    properties.appendChild(characterPregnancy);
    CharacterUtils.addAttribute(doc, characterPregnancy, "timeProgressedToFinalPregnancyStage", String.valueOf(this.getTimeProgressedToFinalPregnancyStage()));
    Element characterPotentialPartnersAsMother = doc.createElement("potentialPartnersAsMother");
    characterPregnancy.appendChild(characterPotentialPartnersAsMother);
    for (PregnancyPossibility pregPoss : this.getPotentialPartnersAsMother()) {
        pregPoss.saveAsXML(characterPotentialPartnersAsMother, doc);
    }
    Element characterPotentialPartnersAsFather = doc.createElement("potentialPartnersAsFather");
    characterPregnancy.appendChild(characterPotentialPartnersAsFather);
    for (PregnancyPossibility pregPoss : this.getPotentialPartnersAsFather()) {
        pregPoss.saveAsXML(characterPotentialPartnersAsFather, doc);
    }
    Element characterPregnancyCurrentLitter = doc.createElement("pregnantLitter");
    characterPregnancy.appendChild(characterPregnancyCurrentLitter);
    if (this.getPregnantLitter() != null) {
        this.getPregnantLitter().saveAsXML(characterPregnancyCurrentLitter, doc);
    }
    Element characterPregnancyBirthedLitters = doc.createElement("birthedLitters");
    characterPregnancy.appendChild(characterPregnancyBirthedLitters);
    for (Litter litter : this.getLittersBirthed()) {
        litter.saveAsXML(characterPregnancyBirthedLitters, doc);
    }
    Element characterPregnancyLittersFathered = doc.createElement("littersFathered");
    characterPregnancy.appendChild(characterPregnancyLittersFathered);
    for (Litter litter : this.getLittersFathered()) {
        litter.saveAsXML(characterPregnancyLittersFathered, doc);
    }
    // ************** Family **************//
    Element characterFamily = doc.createElement("family");
    properties.appendChild(characterFamily);
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "motherId", this.getMotherId());
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "fatherId", this.getFatherId());
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "dayOfConception", String.valueOf(this.getDayOfConception()));
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "dayOfBirth", String.valueOf(this.getDayOfBirth()));
    // ************** Slavery **************//
    Element slaveryElement = doc.createElement("slavery");
    properties.appendChild(slaveryElement);
    Element slavesOwned = doc.createElement("slavesOwned");
    slaveryElement.appendChild(slavesOwned);
    for (String slave : this.getSlavesOwned()) {
        Element element = doc.createElement("slave");
        slavesOwned.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "id", slave);
    }
    CharacterUtils.createXMLElementWithValue(doc, slaveryElement, "owner", this.getOwner() == null ? "" : this.getOwner().getId());
    CharacterUtils.createXMLElementWithValue(doc, slaveryElement, "slaveJob", this.getSlaveJob().toString());
    Element slaveJobSettings = doc.createElement("slaveJobSettings");
    slaveryElement.appendChild(slaveJobSettings);
    for (SlaveJobSetting setting : this.getSlaveJobSettings()) {
        Element element = doc.createElement("setting");
        slaveJobSettings.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", setting.toString());
    }
    Element slavePermissionSettings = doc.createElement("slavePermissionSettings");
    slaveryElement.appendChild(slavePermissionSettings);
    for (Entry<SlavePermission, Set<SlavePermissionSetting>> entry : this.getSlavePermissionSettings().entrySet()) {
        Element element = doc.createElement("permission");
        slavePermissionSettings.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", entry.getKey().toString());
        for (SlavePermissionSetting setting : entry.getValue()) {
            Element settingElement = doc.createElement("setting");
            element.appendChild(settingElement);
            CharacterUtils.addAttribute(doc, settingElement, "value", setting.toString());
        }
    }
    Element slaveWorkHours = doc.createElement("slaveWorkHours");
    slaveryElement.appendChild(slaveWorkHours);
    for (int i = 0; i < workHours.length; i++) {
        CharacterUtils.addAttribute(doc, slaveWorkHours, "hour" + String.valueOf(i), String.valueOf(workHours[i]));
    }
    // ************** Sex Stats **************//
    Element characterSexStats = doc.createElement("sexStats");
    properties.appendChild(characterSexStats);
    Element characterCummedInAreas = doc.createElement("cummedInAreas");
    characterSexStats.appendChild(characterCummedInAreas);
    for (OrificeType orifice : OrificeType.values()) {
        Element element = doc.createElement("entry");
        characterCummedInAreas.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "orifice", orifice.toString());
        CharacterUtils.addAttribute(doc, element, "cumQuantity", String.valueOf(this.getCummedInAreaMap().get(orifice)));
    }
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexConsensualCount", String.valueOf(this.getSexConsensualCount()));
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexAsSubCount", String.valueOf(this.getSexAsSubCount()));
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexAsDomCount", String.valueOf(this.getSexAsDomCount()));
    Element characterCumCount = doc.createElement("cumCounts");
    characterSexStats.appendChild(characterCumCount);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getCumCount(new SexType(participant, pt, ot)) > 0) {
                    Element element = doc.createElement("cumCount");
                    characterCumCount.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "count", String.valueOf(this.getCumCount(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element characterSexCount = doc.createElement("sexCounts");
    characterSexStats.appendChild(characterSexCount);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getSexCount(new SexType(participant, pt, ot)) > 0) {
                    Element element = doc.createElement("sexCount");
                    characterSexCount.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "count", String.valueOf(this.getSexCount(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element characterVirginityTakenBy = doc.createElement("virginityTakenBy");
    characterSexStats.appendChild(characterVirginityTakenBy);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getVirginityLoss(new SexType(participant, pt, ot)) != null && !this.getVirginityLoss(new SexType(participant, pt, ot)).isEmpty()) {
                    Element element = doc.createElement("virginity");
                    characterVirginityTakenBy.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "takenBy", String.valueOf(this.getVirginityLoss(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element sexPartnerMapElement = doc.createElement("sexPartnerMap");
    characterSexStats.appendChild(sexPartnerMapElement);
    for (String s : sexPartnerMap.keySet()) {
        Element element = doc.createElement("id");
        sexPartnerMapElement.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", s);
        for (Entry<SexType, Integer> entry : sexPartnerMap.get(s).entrySet()) {
            Element entryElement = doc.createElement("entry");
            element.appendChild(entryElement);
            CharacterUtils.addAttribute(doc, entryElement, "participantType", entry.getKey().getAsParticipant().toString());
            CharacterUtils.addAttribute(doc, entryElement, "penetrationType", entry.getKey().getPenetrationType().toString());
            CharacterUtils.addAttribute(doc, entryElement, "orificeType", entry.getKey().getOrificeType().toString());
            CharacterUtils.addAttribute(doc, entryElement, "count", String.valueOf(entry.getValue()));
        }
    }
    // ************** Fluids **************//
    Element characterAddictionsCore = doc.createElement("addictionsCore");
    properties.appendChild(characterAddictionsCore);
    CharacterUtils.addAttribute(doc, characterAddictionsCore, "alcoholLevel", String.valueOf(alcoholLevel));
    Element characterAddictions = doc.createElement("addictions");
    characterAddictionsCore.appendChild(characterAddictions);
    for (Addiction add : addictions) {
        add.saveAsXML(characterAddictions, doc);
    }
    Element psychoactives = doc.createElement("psychoactiveFluids");
    characterAddictionsCore.appendChild(psychoactives);
    for (FluidType ft : this.getPsychoactiveFluidsIngested()) {
        Element element = doc.createElement("fluid");
        psychoactives.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", ft.toString());
    }
    return properties;
}
Also used : FluidType(com.lilithsthrone.game.character.body.types.FluidType) SlaveJobSetting(com.lilithsthrone.game.slavery.SlaveJobSetting) CoverableArea(com.lilithsthrone.game.character.body.CoverableArea) EnumSet(java.util.EnumSet) Set(java.util.Set) HashSet(java.util.HashSet) ClothingSet(com.lilithsthrone.game.inventory.clothing.ClothingSet) Attribute(com.lilithsthrone.game.character.attributes.Attribute) Element(org.w3c.dom.Element) SlavePermission(com.lilithsthrone.game.slavery.SlavePermission) PenetrationType(com.lilithsthrone.game.sex.PenetrationType) SexParticipantType(com.lilithsthrone.game.sex.SexParticipantType) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) Comment(org.w3c.dom.Comment) SexType(com.lilithsthrone.game.sex.SexType) OrificeType(com.lilithsthrone.game.sex.OrificeType) Perk(com.lilithsthrone.game.character.effects.Perk) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) SlavePermissionSetting(com.lilithsthrone.game.slavery.SlavePermissionSetting) Addiction(com.lilithsthrone.game.character.effects.Addiction) FetishDesire(com.lilithsthrone.game.character.fetishes.FetishDesire)

Example 2 with SexParticipantType

use of com.lilithsthrone.game.sex.SexParticipantType in project liliths-throne-public by Innoxia.

the class SexManagerDefault method getPartnerSexAction.

/**
 * New:</br>
 * - Get accessible areas</br>
 * - Choose foreplay & main sex</br>
 * - Choose positions for each</br>
 * - Clothing for foreplay</br>
 * - position</br>
 * - foreplay (self-actions take minimum priority)</br>
 * - clothing for main</br>
 * - position</br>
 * - main (self-actions take minimum priority)</br>
 * - orgasm
 */
@Override
public SexActionInterface getPartnerSexAction(SexActionInterface sexActionPlayer) {
    possibleActions.clear();
    bannedActions.clear();
    List<SexActionInterface> availableActions = Sex.getAvailableSexActionsPartner();
    if (Sex.getActivePartner().getArousal() >= ArousalLevel.FIVE_ORGASM_IMMINENT.getMaximumValue() && SexFlags.playerPreparedForOrgasm) {
        List<SexActionInterface> priorityOrgasms = new ArrayList<>();
        for (SexActionInterface action : availableActions) {
            for (GameCharacter character : Sex.getAllParticipants()) {
                if (action.getAreasCummedIn(Sex.getActivePartner(), character) != null) {
                    if ((action.getAreasCummedIn(Sex.getActivePartner(), character).contains(OrificeType.VAGINA) && (Sex.getActivePartner().hasFetish(Fetish.FETISH_IMPREGNATION) || Sex.getActivePartner().hasFetish(Fetish.FETISH_SEEDER))) || SexFlags.playerRequestedCreampie) {
                        priorityOrgasms.add(action);
                    } else if (SexFlags.playerRequestedPullOut && (Sex.isConsensual() || Sex.isSubHasEqualControl())) {
                        priorityOrgasms.add(action);
                    }
                }
                if (action.getAreasCummedIn(character, Sex.getActivePartner()) != null) {
                    if ((action.getAreasCummedIn(character, Sex.getActivePartner()).contains(OrificeType.VAGINA) && (Sex.getActivePartner().hasFetish(Fetish.FETISH_PREGNANCY) || Sex.getActivePartner().hasFetish(Fetish.FETISH_BROODMOTHER)))) {
                        priorityOrgasms.add(action);
                    }
                }
            }
        }
        if (!priorityOrgasms.isEmpty()) {
            return priorityOrgasms.get(Util.random.nextInt(priorityOrgasms.size()));
        } else {
            return availableActions.get(Util.random.nextInt(availableActions.size()));
        }
    }
    // If the partner is resisting, they will not want to remove any clothing, and will instead simply use an available option. (Which will be a SUB_RESIST or neutral pace one.)
    if (Sex.getSexPace(Sex.getActivePartner()) == SexPace.SUB_RESISTING) {
        possibleActions.addAll(Sex.getAvailableSexActionsPartner());
        if (!possibleActions.isEmpty()) {
            return possibleActions.get(Util.random.nextInt(possibleActions.size()));
        } else {
            return SexActionUtility.PARTNER_NONE;
        }
    }
    if (!Sex.getActivePartner().getSexPositionPreferences().contains(Sex.getSexPositionSlot(Sex.getActivePartner()))) {
        for (SexActionInterface action : availableActions) {
            if (action.getActionType() == SexActionType.PARTNER_POSITIONING) {
                possibleActions.add(action);
            }
        }
        // Choose a random position:
        if (!possibleActions.isEmpty()) {
            // }
            return possibleActions.get(Util.random.nextInt(possibleActions.size()));
        }
    } else {
        for (SexActionInterface action : availableActions) {
            if (action.getActionType() == SexActionType.PARTNER_POSITIONING) {
                bannedActions.add(action);
            }
        }
    }
    // Skip over remove clothing if action is of HIGH or MAX priority
    if (Sex.getAvailableSexActionsPartner().get(0).getPriority() != SexActionPriority.HIGH && Sex.getAvailableSexActionsPartner().get(0).getPriority() != SexActionPriority.UNIQUE_MAX) {
        List<CoverableArea> playerAreasToBeExposed = new ArrayList<>();
        List<CoverableArea> partnerAreasToBeExposed = new ArrayList<>();
        if (Sex.isInForeplay()) {
            if (Sex.getActivePartner().getForeplayPreference() != null) {
                PenetrationType pen = Sex.getActivePartner().getForeplayPreference().getPenetrationType();
                SexParticipantType participantType = Sex.getActivePartner().getForeplayPreference().getAsParticipant();
                if (participantType == SexParticipantType.CATCHER) {
                    if (pen == PenetrationType.PENIS && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.PENIS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (pen == PenetrationType.TONGUE && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        playerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                } else {
                    if (pen == PenetrationType.PENIS && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.PENIS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (pen == PenetrationType.TONGUE && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                }
                OrificeType orifice = Sex.getActivePartner().getForeplayPreference().getOrificeType();
                if (participantType == SexParticipantType.PITCHER) {
                    if (orifice == OrificeType.ANUS && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.ANUS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.ANUS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.ANUS);
                    } else if ((orifice == OrificeType.BREAST || orifice == OrificeType.NIPPLE) && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.NIPPLES) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        playerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (orifice == OrificeType.MOUTH && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        playerAreasToBeExposed.add(CoverableArea.MOUTH);
                    } else if (orifice == OrificeType.URETHRA && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.PENIS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (orifice == OrificeType.VAGINA && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.VAGINA) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                        playerAreasToBeExposed.add(CoverableArea.VAGINA);
                    }
                } else {
                    if (orifice == OrificeType.ANUS && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.ANUS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.ANUS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.ANUS);
                    } else if ((orifice == OrificeType.BREAST || orifice == OrificeType.NIPPLE) && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.NIPPLES) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (orifice == OrificeType.MOUTH && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.MOUTH);
                    } else if (orifice == OrificeType.URETHRA && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.PENIS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (orifice == OrificeType.VAGINA && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.VAGINA) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.VAGINA);
                    }
                }
            } else {
                if (playerAreasToBeExposed.isEmpty()) {
                    // }
                    if (!Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.NIPPLES) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        playerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (!Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        playerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                }
                if (partnerAreasToBeExposed.isEmpty()) {
                    // }
                    if (!Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.NIPPLES) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (!Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                }
            }
        } else {
            if (Sex.getActivePartner().getMainSexPreference() != null) {
                PenetrationType pen = Sex.getActivePartner().getMainSexPreference().getPenetrationType();
                SexParticipantType participantType = Sex.getActivePartner().getMainSexPreference().getAsParticipant();
                if (participantType == SexParticipantType.CATCHER) {
                    if (pen == PenetrationType.PENIS && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.PENIS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (pen == PenetrationType.TONGUE && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        playerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                } else {
                    if (pen == PenetrationType.PENIS && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.PENIS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (pen == PenetrationType.TONGUE && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.MOUTH);
                    }
                }
                OrificeType orifice = Sex.getActivePartner().getMainSexPreference().getOrificeType();
                if (participantType == SexParticipantType.PITCHER) {
                    if (orifice == OrificeType.ANUS && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.ANUS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.ANUS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.ANUS);
                    } else if ((orifice == OrificeType.BREAST || orifice == OrificeType.NIPPLE) && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.NIPPLES) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        playerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (orifice == OrificeType.MOUTH && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        playerAreasToBeExposed.add(CoverableArea.MOUTH);
                    } else if (orifice == OrificeType.URETHRA && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.PENIS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        playerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (orifice == OrificeType.VAGINA && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.VAGINA) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                        playerAreasToBeExposed.add(CoverableArea.VAGINA);
                    }
                } else {
                    if (orifice == OrificeType.ANUS && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.ANUS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.ANUS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.ANUS);
                    } else if ((orifice == OrificeType.BREAST || orifice == OrificeType.NIPPLE) && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.NIPPLES) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.NIPPLES);
                    } else if (orifice == OrificeType.MOUTH && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.MOUTH);
                    } else if (orifice == OrificeType.URETHRA && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.PENIS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.PENIS);
                    } else if (orifice == OrificeType.VAGINA && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.VAGINA) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                        partnerAreasToBeExposed.add(CoverableArea.VAGINA);
                    }
                }
            }
            // else {
            if (playerAreasToBeExposed.isEmpty()) {
                // } else
                if (Main.game.getPlayer().hasPenis() && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.PENIS) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                    playerAreasToBeExposed.add(CoverableArea.PENIS);
                } else if (Main.game.getPlayer().hasVagina() && !Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.VAGINA) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                    playerAreasToBeExposed.add(CoverableArea.VAGINA);
                }
            // else if(!Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.NIPPLES) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
            // playerAreasToBeExposed.add(CoverableArea.NIPPLES);
            // } else if(!Main.game.getPlayer().isCoverableAreaExposed(CoverableArea.MOUTH) && Main.game.getPlayer().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
            // playerAreasToBeExposed.add(CoverableArea.MOUTH);
            // }
            }
            if (partnerAreasToBeExposed.isEmpty()) {
                // } else
                if (Sex.getActivePartner().hasPenis() && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.PENIS) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
                    partnerAreasToBeExposed.add(CoverableArea.PENIS);
                } else if (Sex.getActivePartner().hasVagina() && !Sex.getActivePartner().isCoverableAreaExposed(CoverableArea.VAGINA) && Sex.getActivePartner().isAbleToAccessCoverableArea(CoverableArea.VAGINA, true)) {
                    partnerAreasToBeExposed.add(CoverableArea.VAGINA);
                }
            // else if(!Sex.getPartner().isCoverableAreaExposed(CoverableArea.NIPPLES) && Sex.getPartner().isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true)) {
            // partnerAreasToBeExposed.add(CoverableArea.NIPPLES);
            // } else if(!Sex.getPartner().isCoverableAreaExposed(CoverableArea.MOUTH) && Sex.getPartner().isAbleToAccessCoverableArea(CoverableArea.MOUTH, true)) {
            // partnerAreasToBeExposed.add(CoverableArea.MOUTH);
            // }
            }
        // }
        }
        if (!partnerAreasToBeExposed.isEmpty() && Sex.isCanRemoveSelfClothing(Sex.getActivePartner())) {
            Collections.shuffle(partnerAreasToBeExposed);
            if (partnerAreasToBeExposed.get(0) == CoverableArea.MOUND) {
                return Sex.partnerManageClothingToAccessCoverableArea(false, CoverableArea.VAGINA);
            } else {
                return Sex.partnerManageClothingToAccessCoverableArea(false, partnerAreasToBeExposed.get(0));
            }
        }
        if (!playerAreasToBeExposed.isEmpty() && Sex.isCanRemoveOthersClothing(Sex.getActivePartner())) {
            Collections.shuffle(playerAreasToBeExposed);
            if (playerAreasToBeExposed.get(0) == CoverableArea.MOUND) {
                return Sex.partnerManageClothingToAccessCoverableArea(true, CoverableArea.VAGINA);
            } else {
                return Sex.partnerManageClothingToAccessCoverableArea(true, playerAreasToBeExposed.get(0));
            }
        }
    }
    // Ban all penetrations if the partner is a virgin in the associated orifice:
    for (SexActionInterface action : availableActions) {
        // TODO
        if (action.getAssociatedOrificeType() != null && action.getActionType() == SexActionType.PARTNER_PENETRATION && action.getParticipantType().isUsingSelfOrificeType()) {
            switch(action.getAssociatedOrificeType()) {
                case ANUS:
                    if (Sex.getActivePartner().isAssVirgin() && Sex.getSexPace(Sex.getActivePartner()) != SexPace.SUB_EAGER) {
                        bannedActions.add(action);
                    }
                    break;
                case MOUTH:
                    if (Sex.getActivePartner().isFaceVirgin() && Sex.getSexPace(Sex.getActivePartner()) != SexPace.SUB_EAGER) {
                        bannedActions.add(action);
                    }
                    break;
                case NIPPLE:
                    if (Sex.getActivePartner().isNippleVirgin() && Sex.getSexPace(Sex.getActivePartner()) != SexPace.SUB_EAGER) {
                        bannedActions.add(action);
                    }
                    break;
                case URETHRA:
                    if (Sex.getActivePartner().isUrethraVirgin() && Sex.getSexPace(Sex.getActivePartner()) != SexPace.SUB_EAGER) {
                        bannedActions.add(action);
                    }
                    break;
                case VAGINA:
                    if (Sex.getActivePartner().hasStatusEffect(StatusEffect.FETISH_PURE_VIRGIN) || Sex.getActivePartner().hasStatusEffect(StatusEffect.FETISH_PURE_VIRGIN_LUSTY_MAIDEN) || (Sex.getActivePartner().isVaginaVirgin() && Sex.getSexPace(Sex.getActivePartner()) != SexPace.SUB_EAGER)) {
                        bannedActions.add(action);
                    }
                    break;
                default:
                    break;
            }
        }
    }
    // --- Priority 6 | Perform actions based on foreplay or sex ---
    // Perform foreplay action if arousal is < 25 and haven't orgasmed yet:
    SexAction actionToPerform = null;
    if (Sex.isInForeplay()) {
        actionToPerform = performForeplayAction(sexActionPlayer);
        if (actionToPerform != null) {
            return actionToPerform;
        }
    } else {
        actionToPerform = performSexAction(sexActionPlayer);
        if (actionToPerform != null) {
            return actionToPerform;
        }
    }
    // --- Priority 7 using other options at random ---
    possibleActions.addAll(availableActions);
    possibleActions.removeAll(bannedActions);
    if (!possibleActions.isEmpty()) {
        return possibleActions.get(Util.random.nextInt(possibleActions.size()));
    }
    // Priority 9 (last resort):
    return SexActionUtility.PARTNER_NONE;
}
Also used : CoverableArea(com.lilithsthrone.game.character.body.CoverableArea) OrificeType(com.lilithsthrone.game.sex.OrificeType) ArrayList(java.util.ArrayList) GameCharacter(com.lilithsthrone.game.character.GameCharacter) SexActionInterface(com.lilithsthrone.game.sex.sexActions.SexActionInterface) SexAction(com.lilithsthrone.game.sex.sexActions.SexAction) PenetrationType(com.lilithsthrone.game.sex.PenetrationType) SexParticipantType(com.lilithsthrone.game.sex.SexParticipantType)

Aggregations

CoverableArea (com.lilithsthrone.game.character.body.CoverableArea)2 OrificeType (com.lilithsthrone.game.sex.OrificeType)2 PenetrationType (com.lilithsthrone.game.sex.PenetrationType)2 SexParticipantType (com.lilithsthrone.game.sex.SexParticipantType)2 GameCharacter (com.lilithsthrone.game.character.GameCharacter)1 Attribute (com.lilithsthrone.game.character.attributes.Attribute)1 FluidType (com.lilithsthrone.game.character.body.types.FluidType)1 Addiction (com.lilithsthrone.game.character.effects.Addiction)1 Perk (com.lilithsthrone.game.character.effects.Perk)1 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)1 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)1 FetishDesire (com.lilithsthrone.game.character.fetishes.FetishDesire)1 ClothingSet (com.lilithsthrone.game.inventory.clothing.ClothingSet)1 SexType (com.lilithsthrone.game.sex.SexType)1 SexAction (com.lilithsthrone.game.sex.sexActions.SexAction)1 SexActionInterface (com.lilithsthrone.game.sex.sexActions.SexActionInterface)1 SlaveJobSetting (com.lilithsthrone.game.slavery.SlaveJobSetting)1 SlavePermission (com.lilithsthrone.game.slavery.SlavePermission)1 SlavePermissionSetting (com.lilithsthrone.game.slavery.SlavePermissionSetting)1 ArrayList (java.util.ArrayList)1