use of com.lilithsthrone.game.character.GameCharacter 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;
}
use of com.lilithsthrone.game.character.GameCharacter in project liliths-throne-public by Innoxia.
the class SexManagerDefault method performSexAction.
// private boolean removedAllPenetrationAfterForeplay = false;
private SexAction performSexAction(SexActionInterface sexActionPlayer) {
List<SexActionInterface> availableActions = Sex.getAvailableSexActionsPartner();
if (sexActionPlayer.getActionType() == SexActionType.PLAYER_STOP_PENETRATION || sexActionPlayer.equals(GenericActions.PLAYER_FORBID_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_PARTNER_SELF) || sexActionPlayer.equals(GenericActions.PLAYER_STOP_ALL_PENETRATIONS)) {
availableActions.removeIf(sexAction -> sexAction.getActionType() == SexActionType.PARTNER_PENETRATION);
}
bannedActions.add(PartnerSelfFingerMouth.PARTNER_SELF_FINGER_MOUTH_PENETRATION);
availableActions.removeAll(bannedActions);
List<SexActionInterface> returnableActions = new ArrayList<>();
boolean isSexPenetration = false;
boolean isSexPenetrationPossible = Sex.getActivePartner().hasPenis() || Sex.getActivePartner().getTailType().isSuitableForPenetration() || Main.game.getPlayer().hasPenis() || Main.game.getPlayer().getTailType().isSuitableForPenetration();
// Is any sexual penetration happening:
outerloop: for (GameCharacter penetrator : Sex.getAllParticipants()) {
for (GameCharacter penetrated : Sex.getAllParticipants()) {
if ((penetrator.equals(Sex.getActivePartner()) || penetrated.equals(Sex.getActivePartner())) && !penetrator.equals(penetrated)) {
for (Entry<PenetrationType, Set<OrificeType>> e : Sex.getOngoingPenetrationMap(penetrator).get(penetrated).entrySet()) {
if (e.getKey().isTakesVirginity()) {
isSexPenetration = true;
break outerloop;
}
}
}
}
}
// If there is no real penetration going on:
if (!isSexPenetration && isSexPenetrationPossible) {
// --- Stop foreplay actions: ---
for (SexActionInterface action : availableActions) {
if (action.getActionType() == SexActionType.PARTNER_STOP_PENETRATION) {
if (!(action.getAssociatedPenetrationType() == PenetrationType.TONGUE && action.getAssociatedOrificeType() == OrificeType.MOUTH)) {
// Don't stop kissing actions:
returnableActions.add(action);
}
}
}
if (returnableActions.size() <= 1) {
SexFlags.positioningBlockedPartner = false;
}
if (!returnableActions.isEmpty()) {
return (SexAction) returnableActions.get(Util.random.nextInt(returnableActions.size()));
}
// Foreplay actions are stopped:
// If the NPC has a preference, they are more likely to choose actions related to that:
List<SexActionInterface> penetrativeActionList = new ArrayList<>();
if (Sex.getActivePartner().getMainSexPreference() != null) {
List<SexActionInterface> highPriorityList = new ArrayList<>();
for (SexActionInterface action : availableActions) {
if (action.getAssociatedOrificeType() == Sex.getActivePartner().getMainSexPreference().getOrificeType() && action.getAssociatedPenetrationType() == Sex.getActivePartner().getMainSexPreference().getPenetrationType() && !action.isPartnerSelfAction() && action.getActionType() != SexActionType.PARTNER_STOP_PENETRATION) {
highPriorityList.add(action);
if (action.getActionType() == SexActionType.PARTNER_PENETRATION) {
// If a penetrative action is in the list, always return that first.
penetrativeActionList.add(action);
}
}
}
if (penetrativeActionList.isEmpty() && !highPriorityList.isEmpty() && Math.random() < 0.7f) {
// 70% chance, so that there is some chance of using other actions as well:
return (SexAction) highPriorityList.get(Util.random.nextInt(highPriorityList.size()));
}
}
// --- Start penetrating: ---
for (SexActionInterface action : availableActions) {
if (action.getActionType() == SexActionType.PARTNER_PENETRATION && action.getParticipantType().isUsingSelfPenetrationType()) {
if (action.getAssociatedPenetrationType() == PenetrationType.PENIS || action.getAssociatedPenetrationType() == PenetrationType.TAIL || action.getAssociatedPenetrationType() == PenetrationType.TAIL) {
// Anal penetrations:
if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_ANAL_GIVING) || Sex.getPlayerPenetrationRequests().contains(OrificeType.ANUS)) && action.getAssociatedOrificeType() != null && action.getAssociatedOrificeType() == OrificeType.ANUS) {
penetrativeActionList.add(action);
}
// Nipple penetrations:
if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(OrificeType.NIPPLE)) && action.getAssociatedOrificeType() != null && action.getAssociatedOrificeType() == OrificeType.NIPPLE) {
penetrativeActionList.add(action);
}
// Paizuri:
if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_BREASTS_OTHERS) || Sex.getPlayerPenetrationRequests().contains(OrificeType.BREAST)) && action.getAssociatedOrificeType() != null && action.getAssociatedOrificeType() == OrificeType.BREAST) {
penetrativeActionList.add(action);
}
// Vaginal penetration on player:
if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_IMPREGNATION) || Sex.getActivePartner().hasFetish(Fetish.FETISH_SEEDER) || Sex.getPlayerPenetrationRequests().contains(OrificeType.VAGINA)) && action.getAssociatedOrificeType() != null && action.getAssociatedOrificeType() == OrificeType.VAGINA && action.getAssociatedPenetrationType() != null && action.getAssociatedPenetrationType() == PenetrationType.PENIS) {
penetrativeActionList.add(action);
}
// Vaginal penetration for self:
if ((Sex.getActivePartner().hasFetish(Fetish.FETISH_PREGNANCY) || Sex.getActivePartner().hasFetish(Fetish.FETISH_BROODMOTHER)) && action.getAssociatedOrificeType() != null && action.getAssociatedOrificeType() == OrificeType.VAGINA && action.getAssociatedPenetrationType() != null && action.getAssociatedPenetrationType() == PenetrationType.PENIS) {
penetrativeActionList.add(action);
}
}
}
}
if (!penetrativeActionList.isEmpty()) {
return (SexAction) penetrativeActionList.get(Util.random.nextInt(penetrativeActionList.size()));
}
for (SexActionInterface action : availableActions) {
if (action.getActionType() == SexActionType.PARTNER_PENETRATION) {
if (action.getAssociatedPenetrationType() == PenetrationType.PENIS || action.getAssociatedPenetrationType() == PenetrationType.TAIL) {
returnableActions.add(action);
}
}
}
returnableActions.removeAll(bannedActions);
if (!returnableActions.isEmpty()) {
return (SexAction) returnableActions.get(Util.random.nextInt(returnableActions.size()));
}
}
// Ban stop penetration actions:
for (SexActionInterface action : availableActions) {
if (action.getActionType() == SexActionType.PARTNER_STOP_PENETRATION) {
if (action.getAssociatedPenetrationType().isTakesVirginity()) {
bannedActions.add(action);
}
}
}
return null;
}
use of com.lilithsthrone.game.character.GameCharacter in project liliths-throne-public by Innoxia.
the class GenericOrgasms method getGenericPenisOrgasmDescription.
private static String getGenericPenisOrgasmDescription(GameCharacter characterOrgasming, OrgasmCumTarget cumTarget) {
genericOrgasmSB.setLength(0);
genericOrgasmSB.append(getPositionPreparation(characterOrgasming));
GameCharacter characterPenetrated = null;
OrificeType orificePenetrated = null;
if (!Sex.getCharactersBeingPenetratedBy(characterOrgasming, PenetrationType.PENIS).isEmpty()) {
characterPenetrated = Sex.getCharactersBeingPenetratedBy(characterOrgasming, PenetrationType.PENIS).get(0);
orificePenetrated = Sex.getOrificesBeingPenetratedBy(characterOrgasming, PenetrationType.PENIS, characterPenetrated).get(0);
}
if (characterPenetrated == null || cumTarget != OrgasmCumTarget.INSIDE) {
List<String> modifiers = new ArrayList<>();
for (PenisModifier mod : PenisModifier.values()) {
switch(mod) {
case BARBED:
break;
case BLUNT:
break;
case FLARED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" The wide, flared head of your [npc1.cock] swells up, and you feel your [npc1.balls+] tightening as you start to cum.");
} else {
modifiers.add(" The wide, flared head of [npc.name]'s [npc.cock] swells up, and [npc.she] feels [npc.her] [npc.balls+] tightening as [npc.she] starts to cum.");
}
}
break;
case KNOTTED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" The thick knot at the base of your [npc1.cock] swells up, and you feel your [npc1.balls+] tightening as you start to cum.");
} else {
modifiers.add(" The thick knot at the base of [npc.name]'s [npc.cock] swells up, and [npc.she] feels [npc.her] [npc.balls+] tightening as [npc.she] starts to cum.");
}
}
break;
case PREHENSILE:
break;
case RIBBED:
break;
case SHEATHED:
break;
case TAPERED:
break;
case TENTACLED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" The little tentacles lining your [npc1.cock] start frantically wriggling, and you feel your [npc1.balls+] tightening as you start to cum.");
} else {
modifiers.add(" The little tentacles lining [npc.name]'s [npc.cock] start frantically wriggling, and [npc.she] feels [npc.her] [npc.balls+] tightening as [npc.she] starts to cum.");
}
}
break;
case VEINY:
break;
}
}
if (!modifiers.isEmpty()) {
genericOrgasmSB.append(modifiers.get(Util.random.nextInt(modifiers.size())));
} else {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Your [npc1.cock+] twitches, and you feel your [npc1.balls+] tightening as you start to cum.");
} else {
genericOrgasmSB.append(" [npc.Name]'s [npc1.cock+] twitches, and [npc.she] feels [npc.her] [npc.balls+] tightening as [npc.she] starts to cum.");
}
}
if (characterPenetrated != null) {
genericOrgasmSB.append("</br>");
switch(orificePenetrated) {
case ANUS:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out of [npc2.name]'s [npc2.asshole+]");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of your [npc2.asshole+]");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of [npc2.name]'s [npc2.asshole+]");
}
}
break;
case ASS:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out from between [npc2.name]'s ass cheeks");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between your ass cheeks");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between [npc2.name]'s ass cheeks");
}
}
break;
case BREAST:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out from between [npc2.name]'s [npc2.breasts+]");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between your [npc2.breasts+]");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between [npc2.name]'s [npc2.breasts+]");
}
}
break;
case MOUTH:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out of [npc2.name]'s mouth");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of your mouth");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of [npc2.name]'s mouth");
}
}
break;
case NIPPLE:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out of [npc2.name]'s [npc2.nipple+]");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of your [npc2.nipple+]");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of [npc2.name]'s [npc2.nipple+]");
}
}
break;
case THIGHS:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out from between [npc2.name]'s thighs");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between your thighs");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out from between [npc2.name]'s thighs");
}
}
break;
case URETHRA:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out of [npc2.name]'s [npc2.urethra+]");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of your [npc2.urethra+]");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of [npc2.name]'s [npc2.urethra+]");
}
}
break;
case VAGINA:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("You slide your [npc1.cock+] out of [npc2.name]'s [npc2.pussy+]");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of your [npc2.pussy+]");
} else {
genericOrgasmSB.append("[npc1.Name] slides [npc.her] [npc1.cock+] out of [npc2.name]'s [npc2.pussy+]");
}
}
break;
default:
break;
}
if (!characterOrgasming.getPenisModifiers().isEmpty()) {
switch(characterOrgasming.getPenisModifiers().get(Util.random.nextInt(characterOrgasming.getPenisModifiers().size()))) {
case BARBED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and sliding your [pc.hand] up and down over your sensitive little barbs.");
} else {
genericOrgasmSB.append(", before reaching down and sliding [npc1.her] [npc1.hand] up and down over [npc1.her] sensitive little barbs.");
}
break;
case BLUNT:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] running up the length of your [pc.cock] to rub and tease your blunt head.");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; [npc1.her] [npc1.hand] running up the length of [npc1.her] [npc1.cock] to rub and tease [npc1.her] blunt head.");
}
break;
case FLARED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] running up the length of your [pc.cock] to rub and tease your wide, flared head.");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; [npc1.her] [npc1.hand] running up the length of [npc1.her] [npc1.cock] to rub and tease [npc1.her] wide, flared head.");
}
break;
case KNOTTED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] sliding down the length of your [pc.cock] to grip and rub at your swollen knot.");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; [npc1.her] [npc1.hand] sliding down the length of [npc1.her] [npc1.cock] to grip and rub at [npc1.her] swollen knot.");
}
break;
case PREHENSILE:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] running up the length of your prehensile [pc.cock] as you curl it back against your [pc.fingers].");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate;" + " [npc1.her] [npc1.hand] sliding down the length of [npc1.her] prehensile [npc1.cock] as [npc1.she] curls it back against [npc1.her] [npc1.fingers].");
}
break;
case RIBBED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and sliding your [pc.hand] up and down over the bumpy ribs that line your [pc.cock].");
} else {
genericOrgasmSB.append(", before reaching down and sliding [npc1.her] [npc1.hand] up and down over the bumpy ribs that line [npc1.her] [npc1.cock].");
}
break;
case SHEATHED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] sliding down the length of your [pc.cock] to bump against your sheath, before rising back up to your [pc.cockHead+].");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate;" + " [npc1.her] [npc1.hand] sliding down the length of [npc1.her] [npc1.cock] to bump against [npc1.her] sheath, before rising back up to [npc1.her] [npc1.cockHead+].");
}
break;
case TAPERED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] running up the length of your [pc.cock] to rub and tease your tapered head.");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; [npc1.her] [npc1.hand] running up the length of [npc1.her] [npc1.cock] to rub and tease [npc1.her] tapered head.");
}
break;
case TENTACLED:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and sliding your [pc.hand] up and down over the squirming tentacles that line the sides of your [pc.cock].");
} else {
genericOrgasmSB.append(", before reaching down and sliding [npc1.her] [npc1.hand] up and down over the squirming tentacles that line the sides of [npc1.her] [npc1.cock].");
}
break;
case VEINY:
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and sliding your [pc.hand] up and down over your veiny [pc.cock].");
} else {
genericOrgasmSB.append(", before reaching down and sliding [npc1.her] [npc1.hand] up and down over [npc1.her] veiny [npc1.cock].");
}
break;
}
} else {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; your [pc.hand] running up the length of your [pc.cock] to rub and tease your [pc.cockHead].");
} else {
genericOrgasmSB.append(", before reaching down and starting to furiously masturbate; [npc1.her] [npc1.hand] running up the length of [npc1.her] [npc1.cock] to rub and tease [npc1.her] [npc1.cockHead].");
}
}
}
} else if (cumTarget == OrgasmCumTarget.INSIDE) {
List<String> modifiers = new ArrayList<>();
switch(orificePenetrated) {
case ANUS:
case NIPPLE:
case VAGINA:
String orificeName = (orificePenetrated == OrificeType.VAGINA ? "[npc2.pussy]" : (orificePenetrated == OrificeType.ANUS ? "[npc2.asshole]" : "[npc2.nipple]"));
String orificeNamePlusDescriptor = (orificePenetrated == OrificeType.VAGINA ? "[npc2.pussy+]" : (orificePenetrated == OrificeType.ANUS ? "[npc2.asshole+]" : "[npc2.nipple+]"));
if (characterOrgasming.hasPenisModifier(PenisModifier.KNOTTED)) {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Pushing forwards, you ram the knot at the base of your [npc1.cock+] against [npc2.name]'s " + orificeNamePlusDescriptor + "." + " It's already started to swell up so much that you don't manage to get it inside on the first thrust," + " but, after pulling back and slamming your [pc.hips] forwards, you manage to push the thick knot into [npc2.her] " + orificeNamePlusDescriptor + ".");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" [npc1.Name] pushes forwards, and you feel [npc1.herHim] ramming the knot at the base of [npc1.her] [npc1.cock+] against your " + orificeNamePlusDescriptor + "." + " It's already started to swell up so much that [npc.she] doesn't manage to get it inside on the first thrust," + " but, after pulling back and slamming [npc1.her] [npc1.hips] forwards, [npc1.she] manages to push the thick knot into your " + orificeNamePlusDescriptor + ".");
} else {
genericOrgasmSB.append(" Ramming the knot at the base of [npc1.her] [npc1.cock+] into [npc2.name]'s " + orificeNamePlusDescriptor + ", [npc1.name] lets out [npc1.a_moan+] as it starts to swell up inside of [npc2.herHim].");
}
}
} else {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Ramming your [npc1.cock+] deep into [npc2.name]'s " + orificeNamePlusDescriptor + ", you let out [npc1.a_moan+] as you feel your [npc1.cock+] start to twitch.");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" Ramming [npc1.her] [npc1.cock+] deep into your " + orificeNamePlusDescriptor + ", [npc1.name] lets out [npc1.a_moan+] as it starts to twitch inside of you.");
} else {
genericOrgasmSB.append(" Ramming [npc1.her] [npc1.cock+] deep into [npc2.name]'s " + orificeNamePlusDescriptor + ", [npc1.name] lets out [npc1.a_moan+] as it starts to twitch inside of [npc2.herHim].");
}
}
}
modifiers.clear();
for (PenisModifier mod : PenisModifier.values()) {
switch(mod) {
case BARBED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You continue to make small, thrusting movements, raking your barbs back against the inner walls of [npc2.her] " + orificeName + " and causing [npc2.herHim] to let out [npc2.a_moan+].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" [npc1.Name] continues to make small, thrusting movements, raking [npc1.her] barbs back against the inner walls of your " + orificeName + " and causing you to let out [npc2.a_moan+].");
} else {
modifiers.add(" [npc1.Name] continues to make small, thrusting movements, raking [npc1.her] barbs back against the inner walls of [npc2.name]'s " + orificeName + " and causing [npc2.herHim] to let out [npc2.a_moan+].");
}
}
}
break;
case BLUNT:
break;
case FLARED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel the wide, flared head of your [npc1.cock] swell up, making a seal with which to trap your [npc1.cum] deep within [npc2.her] " + orificeName + ".");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The wide, flared head of [npc1.name]'s [npc1.cock] swells up, making a seal with which to trap [npc1.her] [npc1.cum] deep within your " + orificeName + ".");
} else {
modifiers.add(" The wide, flared head of [npc1.name]'s [npc1.cock] swells up, making a seal with which to trap [npc1.her] [npc1.cum] deep within [npc2.name]'s " + orificeName + ".");
}
}
}
break;
case KNOTTED:
break;
case PREHENSILE:
break;
case RIBBED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel your ribbed [npc1.cock] bumping against the inner walls of [npc2.her] " + orificeName + ", which causes [npc2.herHim] to let out [npc2.a_moan+].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The ribbed length of [npc1.name]'s [npc1.cock] bumps against the inner walls of your " + orificeName + ", which causes you to let out [npc2.a_moan+].");
} else {
modifiers.add(" The ribbed length of [npc1.name]'s [npc1.cock] bumps against the inner walls of [npc2.name]'s " + orificeName + ", which causes [npc2.herHim] to let out [npc2.a_moan+].");
}
}
}
break;
case SHEATHED:
break;
case TAPERED:
break;
case TENTACLED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel the wriggling tentacles lining your [npc1.cock] start to massage the inner walls of [npc2.her] " + orificeName + ", which causes [npc2.herHim] to let out [npc2.a_moan+].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The wriggling tentacles lining [npc1.name]'s [npc1.cock] start to massage the inner walls of your " + orificeName + ", which causes you to let out [npc2.a_moan+].");
} else {
modifiers.add(" The wriggling tentacles lining [npc1.name]'s [npc1.cock] start to massage the inner walls of [npc2.name]'s " + orificeName + ", which causes [npc2.herHim] to let out [npc2.a_moan+].");
}
}
}
break;
case VEINY:
break;
}
}
if (!modifiers.isEmpty()) {
genericOrgasmSB.append(modifiers.get(Util.random.nextInt(modifiers.size())));
}
if (characterOrgasming.hasPenisModifier(PenisModifier.KNOTTED)) {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Keeping your [npc1.hips] pushed tightly against [npc2.name]'s " + orificeName + ", you let out [npc1.a_moan+] as you feel your knot swell up to its full size." + " Bucking back a little, you grin as you feel [npc2.name] pulled along with you; evidence that your [npc1.cock] is now firmly locked inside [npc2.her] " + orificeNamePlusDescriptor + ".");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" Keeping [npc1.her] [npc1.hips] pushed tightly against your " + orificeName + ", [npc1.name] lets out [npc1.a_moan+] as [npc1.her] knot swells up to its full size." + " [npc.She] then bucks back a little, and you let out a startled cry as you're pulled along with [npc.herHim]; evidence that [npc1.her] [npc1.cock] is now firmly locked inside your " + orificeNamePlusDescriptor + ".");
} else {
genericOrgasmSB.append(" After just a moment, [npc1.her] knot has fully swollen in size, locking [npc1.her] [npc1.cock] inside [npc2.name]'s " + orificeName + ".");
}
}
}
break;
case ASS:
break;
case BREAST:
break;
case MOUTH:
if (characterOrgasming.hasPenisModifier(PenisModifier.KNOTTED)) {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Pushing forwards, you ram the knot at the base of your [npc1.cock+] against [npc2.name]'s [npc2.face+]." + " It's already started to swell up so much that you don't manage to get it past [npc2.her] [npc2.lips+] on the first thrust," + " but, after pulling back and slamming your [pc.hips] forwards, you manage to push the thick knot into [npc2.her] [npc2.mouth].");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" [npc1.Name] pushes forwards, ramming the knot at the base of [npc1.her] [npc1.cock+] into your [npc2.face+]." + " It's already started to swell up so much that [npc.she] doesn't manage to get it past your [npc2.lips+] on the first thrust," + " but, after pulling back and slamming [npc1.her] [npc1.hips] forwards, [npc1.she] manages to push the thick knot into your [npc2.mouth].");
} else {
genericOrgasmSB.append(" Ramming the knot at the base of [npc1.her] [npc1.cock+] into [npc2.name]'s mouth, [npc1.name] lets out [npc1.a_moan+] as it starts to swell up inside of [npc2.herHim].");
}
}
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Ramming the knot at the base of your [npc1.cock+] into [npc2.name]'s mouth, you let out [npc1.a_moan+] as you feel it start to swell up.");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" Ramming the knot at the base of [npc1.her] [npc1.cock+] into your mouth, [npc1.name] lets out [npc1.a_moan+] as it starts to swell up inside of you.");
} else {
genericOrgasmSB.append(" Ramming the knot at the base of [npc1.her] [npc1.cock+] into [npc2.name]'s mouth, [npc1.name] lets out [npc1.a_moan+] as it starts to swell up inside of [npc2.herHim].");
}
}
} else {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Ramming your [npc1.cock+] deep down [npc2.name]'s throat, you let out [npc1.a_moan+] as you feel your [npc1.cock+] start to twitch.");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" Ramming [npc1.her] [npc1.cock+] deep down your throat, [npc1.name] lets out [npc1.a_moan+] as it starts to twitch inside of you.");
} else {
genericOrgasmSB.append(" Ramming [npc1.her] [npc1.cock+] deep down [npc2.name]'s throat, [npc1.name] lets out [npc1.a_moan+] as it starts to twitch inside of [npc2.herHim].");
}
}
}
modifiers.clear();
for (PenisModifier mod : PenisModifier.values()) {
switch(mod) {
case BARBED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You continue to make small, thrusting movements, raking your barbs back against the lining of [npc2.her] throat and causing [npc2.herHim] to let out a choking [npc2.moan].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" [npc1.Name] continues to make small, thrusting movements, raking [npc1.her] barbs back against the lining of your throat and causing you to let out a choking [npc2.moan].");
} else {
modifiers.add(" [npc1.Name] continues to make small, thrusting movements, raking [npc1.her] barbs back against the lining of [npc2.name]'s throat and causing [npc2.herHim] to let out a choking [npc2.moan].");
}
}
}
break;
case BLUNT:
break;
case FLARED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel the wide, flared head of your [npc1.cock] swell up, making a seal with which to trap your [npc1.cum] deep down [npc2.her] throat.");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The wide, flared head of [npc1.name]'s [npc1.cock] swells up, making a seal with which to trap [npc1.her] [npc1.cum] deep down your throat.");
} else {
modifiers.add(" The wide, flared head of [npc1.name]'s [npc1.cock] swells up, making a seal with which to trap [npc1.her] [npc1.cum] deep down [npc2.name]'s throat.");
}
}
}
break;
case KNOTTED:
break;
case PREHENSILE:
break;
case RIBBED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel your ribbed [npc1.cock] bumping against the lining of [npc2.her] throat, which causes [npc2.herHim] to let out a muffled [npc2.moan].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The ribbed length of [npc1.name]'s [npc1.cock] bumps against the lining of your throat, which causes you to let out a muffled [npc2.moan].");
} else {
modifiers.add(" The ribbed length of [npc1.name]'s [npc1.cock] bumps against the lining of [npc2.name]'s throat, which causes [npc2.herHim] to let out a muffled [npc2.moan].");
}
}
}
break;
case SHEATHED:
break;
case TAPERED:
break;
case TENTACLED:
if (characterOrgasming.hasPenisModifier(mod)) {
if (characterOrgasming.isPlayer()) {
modifiers.add(" You feel the wriggling tentacles lining your [npc1.cock] start to massage the lining of [npc2.her] throat, which causes [npc2.herHim] to let out a muffled [npc2.moan].");
} else {
if (characterPenetrated.isPlayer()) {
modifiers.add(" The wriggling tentacles lining [npc1.name]'s [npc1.cock] start to massage the lining of your throat, which causes you to let out a muffled [npc2.moan].");
} else {
modifiers.add(" The wriggling tentacles lining [npc1.name]'s [npc1.cock] start to massage the lining of [npc2.name]'s throat, which causes [npc2.herHim] to let out a muffled [npc2.moan].");
}
}
}
break;
case VEINY:
break;
}
}
if (!modifiers.isEmpty()) {
genericOrgasmSB.append(modifiers.get(Util.random.nextInt(modifiers.size())));
}
if (characterOrgasming.hasPenisModifier(PenisModifier.KNOTTED)) {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" Keeping your [npc1.hips] pushed tightly against [npc2.name]'s [npc2.face], you let out [npc1.a_moan+] as you feel your knot swell up to its full size." + " Bucking back a little, you grin as [npc2.name]'s pulled along with you; evidence that your [npc1.cock] is now firmly locked inside [npc2.her] [npc2.mouth].");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append(" Keeping [npc1.her] [npc1.hips] pushed tightly against your [npc2.face], [npc1.name] lets out [npc1.a_moan+] as [npc1.her] knot swells up to its full size." + " [npc.She] then bucks back a little, and you let out a very muffled cry as you're pulled along with [npc1.herHim]; evidence that [npc1.her] [npc1.cock] is now firmly locked inside your [npc2.mouth].");
} else {
genericOrgasmSB.append(" After just a moment, [npc1.her] knot has fully swollen in size, locking [npc1.her] [npc1.cock] inside [npc2.name]'s [npc2.mouth].");
}
}
}
break;
case THIGHS:
break;
case URETHRA:
break;
default:
break;
}
}
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append(" As your [npc1.balls+] tense up, ");
} else {
genericOrgasmSB.append(" As [npc1.her] [npc1.balls+] tense up, ");
}
genericOrgasmSB.append(getCumQuantityDescription(characterOrgasming));
if (characterOrgasming.getPenisRawCumProductionValue() > 0) {
genericOrgasmSB.append(cumTargetDescription(characterOrgasming, characterPenetrated, cumTarget));
}
if (characterOrgasming.hasPenisModifier(PenisModifier.KNOTTED) && cumTarget == OrgasmCumTarget.INSIDE) {
if (characterOrgasming.isPlayer()) {
genericOrgasmSB.append("</br>" + "Even after your [npc1.balls+] have pumped their entire load into [npc2.name], your knot remains swollen, locking you and your partner together." + " It takes a few minutes for it to start to deflate, and with a wet pop, you're finally able to pull your [npc1.cock+] free.");
} else {
if (characterPenetrated.isPlayer()) {
genericOrgasmSB.append("</br>" + "Even after [npc1.name]'s [npc1.balls+] have pumped their entire load into you, [npc1.her] knot remains swollen, locking you and your partner together." + " It takes a few minutes for it to start to deflate, and with a wet pop, [npc1.she]'s finally able to pull [npc1.her] [npc1.cock+] free.");
} else {
genericOrgasmSB.append("</br>" + "Even after [npc1.name]'s [npc1.balls+] have pumped their entire load into [ncp2.name], [npc1.her] knot remains swollen, locking [npc1.herHim] and [npc1.her] partner together." + " It takes a few minutes for it to start to deflate, and with a wet pop, [npc1.she]'s finally able to pull [npc1.her] [npc1.cock+] free.");
}
}
}
if (characterPenetrated != null) {
return UtilText.parse(characterOrgasming, characterPenetrated, genericOrgasmSB.toString());
} else {
return UtilText.parse(characterOrgasming, genericOrgasmSB.toString());
}
}
use of com.lilithsthrone.game.character.GameCharacter in project liliths-throne-public by Innoxia.
the class MainController method manageAttributeListeners.
private void manageAttributeListeners() {
documentAttributes = (Document) webEngineAttributes.executeScript("document");
EventListenerDataMap.put(documentAttributes, new ArrayList<>());
// Map:
if (((EventTarget) documentAttributes.getElementById("upButton")) != null) {
addEventListener(documentAttributes, "upButton", "click", moveNorthListener, true);
}
if (((EventTarget) documentAttributes.getElementById("downButton")) != null) {
addEventListener(documentAttributes, "downButton", "click", moveSouthListener, true);
}
if (((EventTarget) documentAttributes.getElementById("leftButton")) != null) {
addEventListener(documentAttributes, "leftButton", "click", moveWestListener, true);
}
if (((EventTarget) documentAttributes.getElementById("rightButton")) != null) {
addEventListener(documentAttributes, "rightButton", "click", moveEastListener, true);
}
// Inventory:
// For all equipped clothing slots:
String id;
for (InventorySlot invSlot : InventorySlot.values()) {
id = invSlot.toString() + "Slot";
if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(Main.game.getPlayer(), invSlot);
addEventListener(documentAttributes, id, "click", el, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
} else {
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(Main.game.getPlayer(), invSlot);
addEventListener(documentAttributes, id, "click", el, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
}
}
id = "DATE_DISPLAY_TOGGLE";
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
Main.getProperties().calendarDisplay = !Main.getProperties().calendarDisplay;
Main.saveProperties();
this.updateUI();
}, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Calendar Display", "Toggle the date's display between a calendar and day count.");
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
id = "TWENTY_FOUR_HOUR_TIME_TOGGLE";
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
Main.getProperties().twentyFourHourTime = !Main.getProperties().twentyFourHourTime;
Main.saveProperties();
this.updateUI();
}, false);
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Time Display", "Toggle the display of time between a 24 and 12-hour clock.");
addEventListener(documentAttributes, id, "mouseenter", el2, false);
}
if (((EventTarget) documentAttributes.getElementById("ESSENCE_" + TFEssence.ARCANE.hashCode())) != null) {
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseleave", hideTooltipListener, false);
InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setEssence(TFEssence.ARCANE);
addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseenter", el2, false);
}
Attribute[] attributes = { Attribute.HEALTH_MAXIMUM, Attribute.MANA_MAXIMUM, Attribute.EXPERIENCE, Attribute.MAJOR_PHYSIQUE, Attribute.MAJOR_ARCANE, Attribute.MAJOR_CORRUPTION, Attribute.AROUSAL, Attribute.LUST };
List<GameCharacter> charactersBeingRendered = new ArrayList<>();
if (Main.game.isInSex()) {
charactersBeingRendered.addAll(Sex.getDominantParticipants().keySet());
charactersBeingRendered.addAll(Sex.getSubmissiveParticipants().keySet());
} else if (Main.game.isInCombat()) {
charactersBeingRendered.add(Main.game.getPlayer());
charactersBeingRendered.addAll(Combat.getAllies());
} else {
if (Main.game.getPlayer() != null) {
charactersBeingRendered.add(Main.game.getPlayer());
}
}
for (GameCharacter character : charactersBeingRendered) {
String idModifier = (character.isPlayer() ? "PLAYER_" : "NPC_" + character.getId() + "_");
for (Attribute a : attributes) {
if (((EventTarget) documentAttributes.getElementById(idModifier + a.getName())) != null) {
if (a == Attribute.EXPERIENCE) {
((EventTarget) documentAttributes.getElementById(idModifier + a.getName())).addEventListener("click", e -> {
if (character.isPlayer()) {
// block when in character creation
if (Main.game.isInNewWorld()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_APPEARANCE) {
openPhone();
} else {
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
}
} else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
}
}
} else {
openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
}
}, false);
}
addEventListener(documentAttributes, idModifier + a.getName(), "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, idModifier + a.getName(), "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setAttribute(a, character);
addEventListener(documentAttributes, idModifier + a.getName(), "mouseenter", el, false);
}
}
if (((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")) != null) {
((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")).addEventListener("click", e -> {
if (character.isPlayer()) {
// block when in character creation
if (Main.game.isInNewWorld()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_LEVEL_UP) {
openPhone();
} else {
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
}
} else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
Main.game.saveDialogueNode();
}
Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
}
}
} else {
// TODO display NPC perk tree
openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
}
}, false);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setExtraAttributes(character);
addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseenter", el, false);
}
// For status effect slots:
for (StatusEffect se : character.getStatusEffects()) {
if (((EventTarget) documentAttributes.getElementById("SE_" + idModifier + se)) != null) {
addEventListener(documentAttributes, "SE_" + idModifier + se, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setStatusEffect(se, character);
addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseenter", el, false);
}
}
for (Perk trait : character.getTraits()) {
id = "TRAIT_" + idModifier + trait;
if (((EventTarget) documentAttributes.getElementById(id)) != null) {
addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setPerk(trait, character);
addEventListener(documentAttributes, id, "mouseenter", el, false);
}
}
for (Fetish f : character.getFetishes()) {
if (((EventTarget) documentAttributes.getElementById("FETISH_" + idModifier + f)) != null) {
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setFetish(f, character);
addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseenter", el, false);
}
}
for (SpecialAttack sa : character.getSpecialAttacks()) {
if (((EventTarget) documentAttributes.getElementById("SA_" + idModifier + sa)) != null) {
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setSpecialAttack(sa, character);
addEventListener(documentAttributes, "SA_" + idModifier + sa, "mouseenter", el, false);
}
}
for (Spell s : character.getAllSpells()) {
if (((EventTarget) documentAttributes.getElementById("SPELL_" + idModifier + s)) != null) {
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mousemove", moveTooltipListener, false);
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseleave", hideTooltipListener, false);
TooltipInformationEventListener el = new TooltipInformationEventListener().setSpell(s, character.getLevel(), character);
addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseenter", el, false);
}
}
}
}
use of com.lilithsthrone.game.character.GameCharacter in project liliths-throne-public by Innoxia.
the class Game method exportGame.
public static void exportGame(String exportFileName, boolean allowOverwrite) {
File dir = new File("data/");
dir.mkdir();
dir = new File("data/saves");
dir.mkdir();
boolean overwrite = false;
if (dir.isDirectory()) {
File[] directoryListing = dir.listFiles((path, filename) -> filename.endsWith(".xml"));
if (directoryListing != null) {
for (File child : directoryListing) {
if (child.getName().equals(exportFileName + ".xml")) {
if (!allowOverwrite) {
Main.game.flashMessage(Colour.GENERIC_BAD, "Name already exists!");
return;
} else {
overwrite = true;
}
}
}
}
}
try {
if (timeLog) {
timeStart = System.nanoTime();
System.out.println(timeStart);
}
// Starting stuff:
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// Writing game stuff to export:
Element game = doc.createElement("game");
doc.appendChild(game);
Element informationNode = doc.createElement("coreInfo");
game.appendChild(informationNode);
CharacterUtils.addAttribute(doc, informationNode, "version", Main.VERSION_NUMBER);
CharacterUtils.addAttribute(doc, informationNode, "minutesPassed", String.valueOf(Main.game.minutesPassed));
CharacterUtils.addAttribute(doc, informationNode, "debugMode", String.valueOf(Main.game.debugMode));
CharacterUtils.addAttribute(doc, informationNode, "imperialMeasurements", String.valueOf(Main.game.imperialMeasurements));
CharacterUtils.addAttribute(doc, informationNode, "weather", Main.game.currentWeather.toString());
CharacterUtils.addAttribute(doc, informationNode, "nextStormTime", String.valueOf(Main.game.nextStormTime));
CharacterUtils.addAttribute(doc, informationNode, "weatherTimeRemaining", String.valueOf(Main.game.weatherTimeRemaining));
Element dateNode = doc.createElement("date");
informationNode.appendChild(dateNode);
CharacterUtils.addAttribute(doc, dateNode, "year", String.valueOf(Main.game.startingDate.getYear()));
CharacterUtils.addAttribute(doc, dateNode, "month", String.valueOf(Main.game.startingDate.getMonthValue()));
CharacterUtils.addAttribute(doc, dateNode, "dayOfMonth", String.valueOf(Main.game.startingDate.getDayOfMonth()));
CharacterUtils.addAttribute(doc, dateNode, "hour", String.valueOf(Main.game.startingDate.getHour()));
CharacterUtils.addAttribute(doc, dateNode, "minute", String.valueOf(Main.game.startingDate.getMinute()));
Main.game.dialogueFlags.saveAsXML(game, doc);
Element eventLogNode = doc.createElement("eventLog");
game.appendChild(eventLogNode);
for (EventLogEntry event : Main.game.getEventLog().subList(Math.max(0, Main.game.getEventLog().size() - 50), Main.game.getEventLog().size())) {
event.saveAsXML(eventLogNode, doc);
}
Element slaveryEventLogNode = doc.createElement("slaveryEventLog");
game.appendChild(slaveryEventLogNode);
for (int day : Main.game.getSlaveryEventLog().keySet()) {
Element element = doc.createElement("day");
slaveryEventLogNode.appendChild(element);
CharacterUtils.addAttribute(doc, element, "value", String.valueOf(day));
for (SlaveryEventLogEntry event : Main.game.getSlaveryEventLog().get(day)) {
event.saveAsXML(element, doc);
}
}
// Add maps:
Element mapNode = doc.createElement("maps");
game.appendChild(mapNode);
for (World world : Main.game.getWorlds().values()) {
if (world != null) {
world.saveAsXML(mapNode, doc);
}
}
// Add player:
Element characterNode = doc.createElement("playerCharacter");
game.appendChild(characterNode);
Main.game.getPlayer().saveAsXML(characterNode, doc);
// Add all NPCs:
for (GameCharacter character : Main.game.getNPCMap().values()) {
characterNode = doc.createElement("NPC");
game.appendChild(characterNode);
character.saveAsXML(characterNode, doc);
}
// Ending stuff:
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer1 = tf.newTransformer();
transformer1.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
StringWriter writer = new StringWriter();
transformer1.transform(new DOMSource(doc), new StreamResult(writer));
// Save this xml:
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
DOMSource source = new DOMSource(doc);
String saveLocation = "data/saves/" + exportFileName + ".xml";
StreamResult result = new StreamResult(new File(saveLocation));
transformer.transform(source, result);
if (!exportFileName.startsWith("AutoSave")) {
if (overwrite) {
Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(), "[style.colourGood(Game saved)]", saveLocation), false);
Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()), false, Colour.GENERIC_GOOD, "Save game overwritten!");
} else {
Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(), "[style.colourGood(Game saved)]", saveLocation), false);
Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()), false, Colour.GENERIC_GOOD, "Game saved!");
}
}
if (timeLog) {
System.out.println("Difference: " + (System.nanoTime() - timeStart) / 1000000000f);
}
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
} catch (TransformerException tfe) {
tfe.printStackTrace();
}
}
Aggregations