Search in sources :

Example 6 with AbstractClothing

use of com.lilithsthrone.game.inventory.clothing.AbstractClothing in project liliths-throne-public by Innoxia.

the class DebugDialogue method clothingCollage.

private static String clothingCollage() {
    clothingCollageSB = new StringBuilder("<div style='position:inline-block;width:90vw;float:left;'>");
    for (AbstractClothingType c : ClothingType.getAllClothing()) {
        AbstractClothing ac = AbstractClothingType.generateClothing(c);
        clothingCollageSB.append("<html><div style='width:10vw;height:10vw;float:left;all: unset;'>" + ac.getSVGString() + "</div></html>");
    }
    clothingCollageSB.append("</div>");
    return clothingCollageSB.toString();
}
Also used : AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing)

Example 7 with AbstractClothing

use of com.lilithsthrone.game.inventory.clothing.AbstractClothing in project liliths-throne-public by Innoxia.

the class CharacterInventory method isAbleToUnequip.

private boolean isAbleToUnequip(AbstractClothing clothing, boolean unequipIfAble, boolean automaticClothingManagement, GameCharacter characterClothingOwner, GameCharacter characterRemovingClothing, boolean continuingIsAbleToEquip) {
    if (!continuingIsAbleToEquip) {
        clothingToRemove.clear();
        equipTextSB.setLength(0);
    }
    if (clothing.isSealed()) {
        equipTextSB.append("Your " + clothing.getName() + " can't be removed because " + (clothing.getClothingType().isPlural() ? "they are" : "it is") + " <b style='color:" + Colour.SEALED.toWebHexString() + ";'>sealed</b>!");
        blockingClothing = clothing;
        return false;
    } else if (!continuingIsAbleToEquip) {
        clothingToRemove.put(clothing, DisplacementType.REMOVE_OR_EQUIP);
    }
    // Check for access needed: TODO check this works
    for (BlockedParts bp : clothing.getClothingType().getBlockedPartsList()) {
        // Keep iterating through until until we find the BlockedParts that corresponds to equipping (if not found, carry on, as this clothing doesn't need any access in order to be equipped):
        if (bp.displacementType == DisplacementType.REMOVE_OR_EQUIP)
            if (bp.clothingAccessRequired == null) {
                // This clothing doesn't need any access in order to be equipped, so just carry on.
                break;
            } else {
                // This clothing has access requirements in order to be equipped. Check each piece of equipped clothing to see if it's blocking the access required:
                for (AbstractClothing equippedClothing : clothingCurrentlyEquipped) {
                    if (equippedClothing != clothing)
                        for (BlockedParts bpEquipped : equippedClothing.getClothingType().getBlockedPartsList()) {
                            for (ClothingAccess caBlocked : bpEquipped.clothingAccessBlocked) {
                                if (bp.clothingAccessRequired.contains(caBlocked) && !equippedClothing.getDisplacedList().contains(bpEquipped.displacementType) && !isDisplacementAvailableFromElsewhere(equippedClothing, caBlocked)) {
                                    if (bpEquipped.displacementType != DisplacementType.REMOVE_OR_EQUIP) {
                                        // If clothingToRemove already contains this clothing, it's just going to be easier to remove the clothing fully than perform multiple displacements:
                                        if (!clothingToRemove.containsKey(equippedClothing))
                                            if (!equippedClothing.getDisplacedList().contains(bpEquipped.displacementType)) {
                                                // Not already displaced:
                                                if (automaticClothingManagement)
                                                    clothingToRemove.put(equippedClothing, bpEquipped.displacementType);
                                                else {
                                                    equipTextSB.append("Your <b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>" + equippedClothing.getName() + "</b> " + (equippedClothing.getClothingType().isPlural() ? "are" : "is") + " preventing you from being able to unequip your " + clothing.getName() + "!");
                                                    blockingClothing = equippedClothing;
                                                    return false;
                                                }
                                            }
                                    } else {
                                        if (isAbleToUnequip(equippedClothing, false, automaticClothingManagement, characterClothingOwner, characterRemovingClothing, true)) {
                                            // Can  be removed:
                                            clothingToRemove.put(equippedClothing, DisplacementType.REMOVE_OR_EQUIP);
                                        } else {
                                            equipTextSB.append("</br>Your " + clothing.getName() + " can't be unequipped because your " + equippedClothing.getName() + " " + (equippedClothing.getClothingType().isPlural() ? "are" : "is") + " in the way.");
                                            blockingClothing = equippedClothing;
                                            return false;
                                        }
                                    }
                                }
                            }
                        }
                }
            }
    }
    if (continuingIsAbleToEquip)
        return true;
    if (!automaticClothingManagement && clothingToRemove.size() != 1) {
        equipTextSB.append("Before your " + clothing.getName() + " " + (clothing.getClothingType().isPlural() ? "are" : "is") + " able to be removed, " + Util.clothesToStringList(clothingToRemove.keySet()) + " need" + (clothingToRemove.size() > 1 ? "" : "s") + " to be removed.");
        for (AbstractClothing c : clothingToRemove.keySet()) if (c != clothing) {
            blockingClothing = c;
            break;
        }
        return false;
    }
    // If you want to unequip this clothing now:
    if (unequipIfAble) {
        // Sort clothing to remove in zLayer order(so you take off your
        // shirt before removing bra etc.):
        List<AbstractClothing> tempClothingList = new ArrayList<>();
        tempClothingList.addAll(clothingToRemove.keySet());
        tempClothingList.sort(new ClothingZLayerComparator());
        // Description of each clothing item that is removed/displaced:
        for (AbstractClothing c : tempClothingList) {
            equipTextSB.append((equipTextSB.length() == 0 ? "" : "</br>") + (clothingToRemove.get(c) == DisplacementType.REMOVE_OR_EQUIP ? (// (Main.game.isInSex()?Sex.isSubResisting():false))
            c == clothing ? // (Main.game.isInSex()?Sex.isSubResisting():false))
            c.onUnequipApplyEffects(characterClothingOwner, characterRemovingClothing, false) : // (Main.game.isInSex()?Sex.isSubResisting():false)))
            c.onUnequipText(characterClothingOwner, characterRemovingClothing, false)) : // (Main.game.isInSex()?Sex.isSubResisting():false))));
            c.getClothingType().displaceText(characterClothingOwner, characterRemovingClothing, clothingToRemove.get(c), false)));
        // if(c==clothing)
        // unequipTextSB.append("</br>"+(isInventoryFull()?characterClothingOwner.droppedItemText(clothing):characterClothingOwner.addedItemToInventoryText(clothing)));
        }
        // Actually unequip the clothing:
        clothingCurrentlyEquipped.remove(clothing);
        // If it was displaced, clear it's displacements:
        clothing.getDisplacedList().clear();
        List<AbstractClothing> clothingToBeReplaced = new ArrayList<>();
        clothingToBeReplaced.addAll(clothingToRemove.keySet());
        clothingToBeReplaced.remove(clothing);
        clothingToBeReplaced.sort(new ReverseClothingZLayerComparator());
        if (!clothingToBeReplaced.isEmpty() && !continuingIsAbleToEquip) {
            equipTextSB.append("</br>You replace " + (characterClothingOwner.isPlayer() ? "your" : characterClothingOwner.getName() + "'s") + " " + Util.clothesToStringList(clothingToBeReplaced) + ".");
        }
        // Check for clothing sets:
        if (clothing.getClothingType().getClothingSet() != null) {
            clothingSetCount.put(clothing.getClothingType().getClothingSet(), clothingSetCount.get(clothing.getClothingType().getClothingSet()) - 1);
        }
        clothingCurrentlyEquipped.sort(new AbstractClothingRarityComparator());
    }
    return true;
}
Also used : ReverseClothingZLayerComparator(com.lilithsthrone.utils.ReverseClothingZLayerComparator) BlockedParts(com.lilithsthrone.game.inventory.clothing.BlockedParts) ReverseClothingZLayerComparator(com.lilithsthrone.utils.ReverseClothingZLayerComparator) ClothingZLayerComparator(com.lilithsthrone.utils.ClothingZLayerComparator) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ArrayList(java.util.ArrayList) AbstractClothingRarityComparator(com.lilithsthrone.utils.AbstractClothingRarityComparator) ClothingAccess(com.lilithsthrone.game.inventory.clothing.ClothingAccess)

Example 8 with AbstractClothing

use of com.lilithsthrone.game.inventory.clothing.AbstractClothing in project liliths-throne-public by Innoxia.

the class CharacterInventory method recalculateMapOfDuplicateClothing.

private void recalculateMapOfDuplicateClothing() {
    clothingDuplicates.clear();
    clothingInInventory.sort(new InventoryClothingComparator());
    for (AbstractClothing clothing : clothingInInventory) {
        if (!clothingDuplicates.containsKey(clothing))
            clothingDuplicates.put(clothing, 1);
        else
            clothingDuplicates.put(clothing, clothingDuplicates.get(clothing) + 1);
    }
}
Also used : AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) InventoryClothingComparator(com.lilithsthrone.utils.InventoryClothingComparator)

Example 9 with AbstractClothing

use of com.lilithsthrone.game.inventory.clothing.AbstractClothing in project liliths-throne-public by Innoxia.

the class CharacterInventory method calculateClothingPostTransformation.

public String calculateClothingPostTransformation(GameCharacter character) {
    tempSB = new StringBuilder();
    List<AbstractClothing> clothingToRemove = new ArrayList<>();
    for (AbstractClothing c : clothingCurrentlyEquipped) {
        // Race:
        if (c.getClothingType().getSlot().slotBlockedByRace(character) != null) {
            transformationIncompatible(character, c, clothingToRemove, c.getClothingType().getSlot().getCannotBeWornDescription(character));
        // Piercings:
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_EAR && !character.isPiercedEar()) {
            transformationIncompatible(character, c, clothingToRemove, "Your ears are no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_LIP && !character.isPiercedLip()) {
            transformationIncompatible(character, c, clothingToRemove, "Your lips are no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_NIPPLE && !character.isPiercedNipple()) {
            transformationIncompatible(character, c, clothingToRemove, "Your nipples are no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_NOSE && !character.isPiercedNose()) {
            transformationIncompatible(character, c, clothingToRemove, "Your nose is no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_PENIS && !character.isPiercedPenis()) {
            if (character.getPenisType() == PenisType.NONE)
                transformationIncompatible(character, c, clothingToRemove, "You no longer have a penis, so you can't wear the " + c.getName() + "!");
            else
                transformationIncompatible(character, c, clothingToRemove, "Your penis is no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_STOMACH && !character.isPiercedNavel()) {
            transformationIncompatible(character, c, clothingToRemove, "Your navel is no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_TONGUE && !character.isPiercedTongue()) {
            transformationIncompatible(character, c, clothingToRemove, "Your tongue is no longer pierced, so you can't wear the " + c.getName() + "!");
        } else if (c.getClothingType().getSlot() == InventorySlot.PIERCING_VAGINA && !character.isPiercedVagina()) {
            if (character.getVaginaType() == VaginaType.NONE)
                transformationIncompatible(character, c, clothingToRemove, "You no longer have a vagina, so you can't wear the " + c.getName() + "!");
            else
                transformationIncompatible(character, c, clothingToRemove, "Your vagina is no longer pierced, so you can't wear the " + c.getName() + "!");
        }
    }
    clothingCurrentlyEquipped.removeAll(clothingToRemove);
    return tempSB.toString();
}
Also used : AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ArrayList(java.util.ArrayList)

Example 10 with AbstractClothing

use of com.lilithsthrone.game.inventory.clothing.AbstractClothing in project liliths-throne-public by Innoxia.

the class CharacterInventory method getNextClothingToRemoveForCoverableAreaAccess.

public SimpleEntry<AbstractClothing, DisplacementType> getNextClothingToRemoveForCoverableAreaAccess(CoverableArea coverableArea) {
    // TODO
    AbstractClothing clothingToRemove = null;
    DisplacementType displacement = null;
    List<AbstractClothing> zLayerSortedList = new ArrayList<>(clothingCurrentlyEquipped);
    zLayerSortedList.sort(new ClothingZLayerComparator().reversed());
    outerloop: for (AbstractClothing clothing : zLayerSortedList) {
        for (BlockedParts bp : clothing.getClothingType().getBlockedPartsList()) if (bp.blockedBodyParts.contains(coverableArea) && !clothing.getDisplacedList().contains(bp.displacementType)) {
            if (!isCoverableAreaExposedFromElsewhere(clothing, coverableArea)) {
                // this clothing is blocking the part we want access to, so make that our starting point:
                clothingToRemove = clothing;
                displacement = bp.displacementType;
                break outerloop;
            }
        }
    }
    if (clothingToRemove == null) {
        throw new IllegalArgumentException("There is no clothing covering this part!");
    }
    boolean finished = false;
    while (!finished) {
        finished = true;
        outerloop2: for (BlockedParts bp : clothingToRemove.getClothingType().getBlockedPartsList()) {
            if (bp.displacementType == displacement) {
                for (ClothingAccess ca : bp.clothingAccessRequired) {
                    for (AbstractClothing clothing : zLayerSortedList) {
                        if (clothing != clothingToRemove) {
                            for (BlockedParts bpIterated : clothing.getClothingType().getBlockedPartsList()) {
                                if (bpIterated.clothingAccessBlocked.contains(ca) && !clothing.getDisplacedList().contains(bpIterated.displacementType)) {
                                    if (!isCoverableAreaExposedFromElsewhere(clothing, coverableArea)) {
                                        // this clothing is blocking the clothing we wanted to displace, so now we re-start by wanting to displace this new clothing:
                                        clothingToRemove = clothing;
                                        displacement = bpIterated.displacementType;
                                        finished = false;
                                        break outerloop2;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return new SimpleEntry<AbstractClothing, DisplacementType>(clothingToRemove, displacement);
}
Also used : DisplacementType(com.lilithsthrone.game.inventory.clothing.DisplacementType) SimpleEntry(java.util.AbstractMap.SimpleEntry) ReverseClothingZLayerComparator(com.lilithsthrone.utils.ReverseClothingZLayerComparator) ClothingZLayerComparator(com.lilithsthrone.utils.ClothingZLayerComparator) BlockedParts(com.lilithsthrone.game.inventory.clothing.BlockedParts) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ArrayList(java.util.ArrayList) ClothingAccess(com.lilithsthrone.game.inventory.clothing.ClothingAccess)

Aggregations

AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)28 ArrayList (java.util.ArrayList)15 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)8 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)7 BlockedParts (com.lilithsthrone.game.inventory.clothing.BlockedParts)6 ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)6 ClothingAccess (com.lilithsthrone.game.inventory.clothing.ClothingAccess)5 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)4 NPC (com.lilithsthrone.game.character.npc.NPC)4 AbstractClothingType (com.lilithsthrone.game.inventory.clothing.AbstractClothingType)4 ClothingZLayerComparator (com.lilithsthrone.utils.ClothingZLayerComparator)4 ReverseClothingZLayerComparator (com.lilithsthrone.utils.ReverseClothingZLayerComparator)4 Attribute (com.lilithsthrone.game.character.attributes.Attribute)3 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)3 Element (org.w3c.dom.Element)3 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)2 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)2 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)2 GameCharacter (com.lilithsthrone.game.character.GameCharacter)2 Perk (com.lilithsthrone.game.character.effects.Perk)2