use of com.lilithsthrone.game.character.effects.Addiction in project liliths-throne-public by Innoxia.
the class GameCharacter method ingestFluid.
// Addictions:
/**
* @param fluid The FluidType to be ingested.
* @param orificeIngestedThrough Orifice through which the fluid is being ingested.
* @param addictive Is this fluid addictive or not.
* @return A <b>formatted paragraph</b> description of addiction increasing/satisfied, or an empty String if no addictive effects occur.
*/
public String ingestFluid(GameCharacter charactersFluid, FluidType fluid, OrificeType orificeIngestedThrough, int millilitres, List<FluidModifier> modifiers) {
StringBuilder fluidIngestionSB = new StringBuilder();
if (modifiers.contains(FluidModifier.ALCOHOLIC)) {
// TODO factor in body size:
this.incrementAlcoholLevel(millilitres * 0.001f);
}
if (modifiers.contains(FluidModifier.HALLUCINOGENIC)) {
this.addPsychoactiveFluidIngested(fluid);
this.addStatusEffect(StatusEffect.PSYCHOACTIVE, 6 * 60);
if (isPlayer()) {
fluidIngestionSB.append("<p>" + "Due to the psychoactive properties of " + (charactersFluid.isPlayer() ? "your" : charactersFluid.getName() + "'s") + " " + fluid.getName(charactersFluid) + ", you start <span style='color:" + Colour.PSYCHOACTIVE.toWebHexString() + ";'>tripping out</span>!" + "</p>");
} else {
fluidIngestionSB.append(UtilText.parse(this, "<p>" + "Due to the psychoactive properties of " + (charactersFluid.isPlayer() ? "your" : charactersFluid.getName() + "'s") + " " + fluid.getName(charactersFluid) + ", [npc.name] starts <span style='color:" + Colour.PSYCHOACTIVE.toWebHexString() + ";'>tripping out</span>!" + "</p>"));
}
}
if (modifiers.contains(FluidModifier.ADDICTIVE)) {
addAddiction(new Addiction(fluid, Main.game.getMinutesPassed(), charactersFluid.getId()));
if (isPlayer()) {
fluidIngestionSB.append("<p>" + "Due to the addictive properties of " + (charactersFluid.isPlayer() ? "your" : charactersFluid.getName() + "'s") + " " + fluid.getName(charactersFluid) + ", you find yourself [style.colourArcane(craving)] <span style='color:" + fluid.getRace().getColour().toWebHexString() + ";'>" + fluid.getDescriptor(charactersFluid) + "</span> " + fluid.getName(charactersFluid) + "!" + "</p>");
} else {
fluidIngestionSB.append(UtilText.parse(this, "<p>" + "Due to the addictive properties of " + (charactersFluid.equals(this) ? "[npc.her]" : (charactersFluid.isPlayer() ? "your" : charactersFluid.getName() + "'s")) + " " + fluid.getName(charactersFluid) + ", [npc.name] finds [npc.herself] [style.colourArcane(craving)] <span style='color:" + fluid.getRace().getColour().toWebHexString() + ";'>" + fluid.getDescriptor(charactersFluid) + "</span> " + fluid.getName(charactersFluid) + "!" + "</p>"));
}
} else if (this.getAddiction(fluid) != null) {
boolean curedWithdrawal = Main.game.getMinutesPassed() - this.getAddiction(fluid).getLastTimeSatisfied() >= 24 * 60;
setLastTimeSatisfiedAddiction(fluid, Main.game.getMinutesPassed());
if (isPlayer()) {
fluidIngestionSB.append(UtilText.parse(charactersFluid, "<p>" + "Your [style.colourArcane(craving)] for <span style='color:" + fluid.getRace().getColour().toWebHexString() + ";'>" + fluid.getDescriptor(charactersFluid) + "</span> " + fluid.getName(charactersFluid) + " has been satisfied!" + (curedWithdrawal ? " You feel deeply grateful to [npc.name] for providing you with what you needed most..." : " You weren't suffering from withdrawal, but you still feel thankful to [npc.name] for feeding your addiction...") + "</p>"));
} else {
if (charactersFluid.isPlayer()) {
fluidIngestionSB.append(UtilText.parse(this, "<p>" + "[npc.Name]'s [style.colourArcane(craving)] for <span style='color:" + fluid.getRace().getColour().toWebHexString() + ";'>" + fluid.getDescriptor(charactersFluid) + "</span> " + fluid.getName(charactersFluid) + " has been satisfied!" + (curedWithdrawal ? " [npc.She] feels deeply grateful to you for providing [npc.herHim] with what [npc.she] needed most..." + "</p>" + this.incrementAffection(charactersFluid, 5) + (this.isSlave() ? this.incrementObedience(5) : "") : " [npc.She] wasn't suffering from withdrawal, but [npc.she] still feels thankful to you for feeding [npc.her] addiction..." + "</p>")));
} else {
fluidIngestionSB.append(UtilText.parse(this, charactersFluid, "<p>" + "[npc.Name]'s [style.colourArcane(craving)] for <span style='color:" + fluid.getRace().getColour().toWebHexString() + ";'>" + fluid.getDescriptor(charactersFluid) + "</span> " + fluid.getName(charactersFluid) + " has been satisfied!" + (curedWithdrawal ? " [npc.She] feels deeply grateful to [npc2.name] for providing [npc.herHim] with what [npc.she] needed most..." + "</p>" + this.incrementAffection(charactersFluid, 5) + (this.isSlave() ? this.incrementObedience(5) : "") : " [npc.She] wasn't suffering from withdrawal, but [npc.she] still feels thankful to [npc2.name] for feeding [npc.her] addiction..." + "</p>")));
}
}
}
return fluidIngestionSB.toString();
}
use of com.lilithsthrone.game.character.effects.Addiction in project liliths-throne-public by Innoxia.
the class GameCharacter method addAddiction.
public boolean addAddiction(Addiction addiction) {
for (Addiction add : addictions) {
if (add.getFluid() == addiction.getFluid()) {
add.setLastTimeSatisfied(addiction.getLastTimeSatisfied());
add.getProviderIDs().addAll(addiction.getProviderIDs());
return true;
}
}
return addictions.add(addiction);
}
use of com.lilithsthrone.game.character.effects.Addiction 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;
}
Aggregations