Search in sources :

Example 1 with CoverableArea

use of com.lilithsthrone.game.character.body.CoverableArea in project liliths-throne-public by Innoxia.

the class SexAction method getFetishesForEitherPartner.

public List<Fetish> getFetishesForEitherPartner(GameCharacter characterPerformingAction, boolean characterPerformingActionFetishes) {
    // if(characterFetishes==null || characterFetishes.get(characterPerformingAction)==null) {
    GameCharacter characterTarget = Sex.getTargetedPartner(characterPerformingAction);
    characterFetishes = new HashMap<>();
    characterFetishesForPartner = new HashMap<>();
    characterFetishes.putIfAbsent(characterPerformingAction, new HashSet<>());
    characterFetishesForPartner.putIfAbsent(characterPerformingAction, new HashSet<>());
    if (this.getParticipantType() == SexParticipantType.SELF && !characterPerformingActionFetishes) {
        // If this is a self action, do not apply fetishes to other partner.
        return new ArrayList<>(characterFetishesForPartner.get(characterPerformingAction));
    }
    if (this.getParticipantType() != SexParticipantType.SELF && characterPerformingAction.isRelatedTo(characterTarget)) {
        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_INCEST);
        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_INCEST);
    }
    if (this.getSexPace(characterPerformingAction) != null) {
        switch(this.getSexPace(characterPerformingAction)) {
            case DOM_GENTLE:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                break;
            case DOM_NORMAL:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                break;
            case DOM_ROUGH:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SADIST);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_MASOCHIST);
                break;
            case SUB_EAGER:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                break;
            case SUB_NORMAL:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                break;
            case SUB_RESISTING:
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SUBMISSIVE);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_DOMINANT);
                characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_NON_CON_SUB);
                characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_NON_CON_DOM);
                break;
        }
    }
    List<CoverableArea> cummedOnList = this.getAreasCummedOn(characterPerformingAction, characterTarget);
    if (cummedOnList != null) {
        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_CUM_STUD);
        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_CUM_ADDICT);
        for (CoverableArea area : cummedOnList) {
            switch(area) {
                case ANUS:
                case ASS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ANAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ANAL_RECEIVING);
                    break;
                case BACK:
                    break;
                case BREASTS:
                case NIPPLES:
                    if (characterTarget.getBreastRawMilkStorageValue() > 0) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_OTHERS);
                        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_SELF);
                    }
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_OTHERS);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_SELF);
                    break;
                case HAIR:
                    break;
                case LEGS:
                case THIGHS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LEG_LOVER);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_STRUTTER);
                    break;
                case MOUND:
                    break;
                case MOUTH:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ORAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ORAL_RECEIVING);
                    break;
                case PENIS:
                case TESTICLES:
                    break;
                case STOMACH:
                    break;
                case VAGINA:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_RECEIVING);
                    break;
            }
        }
    }
    cummedOnList = this.getAreasCummedOn(characterTarget, characterPerformingAction);
    if (cummedOnList != null) {
        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_CUM_ADDICT);
        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_CUM_STUD);
        for (CoverableArea area : cummedOnList) {
            switch(area) {
                case ANUS:
                case ASS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ANAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ANAL_GIVING);
                    break;
                case BACK:
                    break;
                case BREASTS:
                case NIPPLES:
                    if (characterPerformingAction.getBreastRawMilkStorageValue() > 0) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_SELF);
                        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_OTHERS);
                    }
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_SELF);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_OTHERS);
                    break;
                case HAIR:
                    break;
                case LEGS:
                case THIGHS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_STRUTTER);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LEG_LOVER);
                    break;
                case MOUND:
                    break;
                case MOUTH:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ORAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ORAL_GIVING);
                    break;
                case PENIS:
                case TESTICLES:
                    break;
                case STOMACH:
                    break;
                case VAGINA:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_GIVING);
                    break;
            }
        }
    }
    List<OrificeType> cummedInList = this.getAreasCummedIn(characterPerformingAction, characterTarget);
    if (cummedInList != null) {
        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_CUM_STUD);
        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_CUM_ADDICT);
        for (OrificeType orifice : cummedInList) {
            switch(orifice) {
                case ANUS:
                case ASS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ANAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ANAL_RECEIVING);
                    break;
                case BREAST:
                case NIPPLE:
                    if (characterTarget.getBreastRawMilkStorageValue() > 0) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_OTHERS);
                        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_SELF);
                    }
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_OTHERS);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_SELF);
                    break;
                case THIGHS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LEG_LOVER);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_STRUTTER);
                    break;
                case MOUTH:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ORAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ORAL_RECEIVING);
                    break;
                case VAGINA:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_GIVING);
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_IMPREGNATION);
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SEEDER);
                    if (this.getParticipantType() == SexParticipantType.SELF) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_PREGNANCY);
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BROODMOTHER);
                    }
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_PREGNANCY);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_BROODMOTHER);
                    break;
                case URETHRA:
                    break;
            }
        }
    }
    cummedInList = this.getAreasCummedIn(characterTarget, characterPerformingAction);
    if (cummedInList != null) {
        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_CUM_ADDICT);
        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_CUM_STUD);
        for (OrificeType orifice : cummedInList) {
            switch(orifice) {
                case ANUS:
                case ASS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ANAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ANAL_GIVING);
                    break;
                case BREAST:
                case NIPPLE:
                    if (characterPerformingAction.getBreastRawMilkStorageValue() > 0) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_SELF);
                        characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LACTATION_OTHERS);
                    }
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_SELF);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_BREASTS_OTHERS);
                    break;
                case THIGHS:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_STRUTTER);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_LEG_LOVER);
                    break;
                case MOUTH:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_ORAL_RECEIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_ORAL_GIVING);
                    break;
                case VAGINA:
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_RECEIVING);
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_PREGNANCY);
                    characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_BROODMOTHER);
                    if (this.getParticipantType() == SexParticipantType.SELF) {
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_IMPREGNATION);
                        characterFetishes.get(characterPerformingAction).add(Fetish.FETISH_SEEDER);
                    }
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_VAGINAL_GIVING);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_IMPREGNATION);
                    characterFetishesForPartner.get(characterPerformingAction).add(Fetish.FETISH_SEEDER);
                    break;
                case URETHRA:
                    break;
            }
        }
    }
    if (this.getAssociatedPenetrationType() != null && this.getAssociatedOrificeType() != null && this.getActionType() != SexActionType.PLAYER_STOP_PENETRATION && this.getActionType() != SexActionType.PARTNER_STOP_PENETRATION && this.getParticipantType() != SexParticipantType.MISC) {
        if (characterPerformingActionFetishes) {
            characterFetishes.get(characterPerformingAction).addAll(getFetishesFromPenetrationAndOrificeTypes(characterPerformingAction, this.getAssociatedPenetrationType(), this.getAssociatedOrificeType(), characterPerformingActionFetishes));
        } else {
            characterFetishesForPartner.get(characterPerformingAction).addAll(getFetishesFromPenetrationAndOrificeTypes(characterPerformingAction, this.getAssociatedPenetrationType(), this.getAssociatedOrificeType(), characterPerformingActionFetishes));
        }
    }
    characterFetishes.get(characterPerformingAction).removeIf(f -> !characterTarget.hasVagina() && (f == Fetish.FETISH_VAGINAL_GIVING || f == Fetish.FETISH_IMPREGNATION || f == Fetish.FETISH_SEEDER));
    characterFetishesForPartner.get(characterPerformingAction).removeIf(f -> !characterTarget.hasVagina() && (f == Fetish.FETISH_VAGINAL_GIVING || f == Fetish.FETISH_IMPREGNATION || f == Fetish.FETISH_SEEDER));
    if (characterPerformingActionFetishes) {
        return new ArrayList<>(characterFetishes.get(characterPerformingAction));
    } else {
        return new ArrayList<>(characterFetishesForPartner.get(characterPerformingAction));
    }
}
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)

Example 2 with CoverableArea

use of com.lilithsthrone.game.character.body.CoverableArea 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 3 with CoverableArea

use of com.lilithsthrone.game.character.body.CoverableArea 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)

Example 4 with CoverableArea

use of com.lilithsthrone.game.character.body.CoverableArea in project liliths-throne-public by Innoxia.

the class Game method endTurn.

public void endTurn(int turnTime, boolean advanceTime) {
    // long tStart = System.nanoTime();
    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);
            }
        }
    }
    // Slavery: TODO
    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);
    }
    // If the time has passed midnight on this turn:
    boolean newDay = ((int) (minutesPassed / (60 * 24)) != (int) (((minutesPassed - turnTime) / (60 * 24))));
    if (newDay) {
        // TODO replace with methods in each GenericPlace:
        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;
        // Reindeer:
        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);
    // Apply status effects and update all NPCs:
    isInNPCUpdateLoop = true;
    for (NPC npc : NPCMap.values()) {
        // Remove Dominion attackers if they aren't in alleyways: TODO this is because storm attackers need to be removed after a storm
        if (npc.getLocationPlace().getPlaceType() != PlaceType.DOMINION_BACK_ALLEYS && npc.getWorldLocation() == WorldType.DOMINION && npc instanceof DominionAlleywayAttacker && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
            banishNPC(npc);
        }
        // Non-slave NPCs clean clothes:
        if (!npc.isSlave() && !Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
            npc.cleanAllClothing();
            npc.cleanAllDirtySlots();
        }
        // Set NPC resource values:
        if (!Main.game.isInCombat() && !Main.game.isInSex()) {
            if (!Main.game.getPlayer().getLocation().equals(npc.getLocation())) {
                npc.setHealthPercentage(1);
                npc.setManaPercentage(1);
            // npc.setLust(npc.getRestingLust());
            }
            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);
        }
        // Prostitutes stay on promiscuity pills to avoid pregnancies, and, if the NPC is male, to avoid knocking up their clients
        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)) {
                    // Lilaya will only end pregnancy after you've seen it.
                    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 not in combat:
    if (!isInCombat()) {
        // Regenerate health and stamina over time:
        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("", "", 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();
    }
// System.out.println((System.nanoTime()-tStart)/1000000000d+"s");
}
Also used : TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) GenericFemaleNPC(com.lilithsthrone.game.character.npc.GenericFemaleNPC) GenericAndrogynousNPC(com.lilithsthrone.game.character.npc.GenericAndrogynousNPC) GenericMaleNPC(com.lilithsthrone.game.character.npc.GenericMaleNPC) CoverableArea(com.lilithsthrone.game.character.body.CoverableArea) Kate(com.lilithsthrone.game.character.npc.dominion.Kate) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) TransformerException(javax.xml.transform.TransformerException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) Lilaya(com.lilithsthrone.game.character.npc.dominion.Lilaya) Response(com.lilithsthrone.game.dialogue.responses.Response) SlaveInStocks(com.lilithsthrone.game.character.npc.dominion.SlaveInStocks) DominionAlleywayAttacker(com.lilithsthrone.game.character.npc.dominion.DominionAlleywayAttacker)

Aggregations

CoverableArea (com.lilithsthrone.game.character.body.CoverableArea)4 OrificeType (com.lilithsthrone.game.sex.OrificeType)3 GameCharacter (com.lilithsthrone.game.character.GameCharacter)2 PenetrationType (com.lilithsthrone.game.sex.PenetrationType)2 SexParticipantType (com.lilithsthrone.game.sex.SexParticipantType)2 ArrayList (java.util.ArrayList)2 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 GenericAndrogynousNPC (com.lilithsthrone.game.character.npc.GenericAndrogynousNPC)1 GenericFemaleNPC (com.lilithsthrone.game.character.npc.GenericFemaleNPC)1 GenericMaleNPC (com.lilithsthrone.game.character.npc.GenericMaleNPC)1 NPC (com.lilithsthrone.game.character.npc.NPC)1 DominionAlleywayAttacker (com.lilithsthrone.game.character.npc.dominion.DominionAlleywayAttacker)1 Kate (com.lilithsthrone.game.character.npc.dominion.Kate)1 Lilaya (com.lilithsthrone.game.character.npc.dominion.Lilaya)1