Search in sources :

Example 6 with InventorySlot

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

the class CharacterUtils method equipClothing.

public static void equipClothing(GameCharacter character, boolean replaceUnsuitableClothing, boolean onlyAddCoreClothing) {
    Colour primaryColour = Colour.allClothingColours.get(Util.random.nextInt(Colour.allClothingColours.size())), secondaryColour = Colour.allClothingColours.get(Util.random.nextInt(Colour.allClothingColours.size())), lingerieColour = Colour.lingerieColours.get(Util.random.nextInt(Colour.lingerieColours.size()));
    List<InventorySlot> inventorySlotsInPriorityOrder = new ArrayList<>();
    // Torso needs to be randomly decided first, to give girls a chance to wear a dress.
    inventorySlotsInPriorityOrder.add(InventorySlot.TORSO_UNDER);
    for (InventorySlot slot : InventorySlot.values()) {
        if (slot != InventorySlot.TORSO_UNDER) {
            inventorySlotsInPriorityOrder.add(slot);
        }
    }
    if ((character.isFeminine() && !character.hasFetish(Fetish.FETISH_CROSS_DRESSER)) || (!character.isFeminine() && character.hasFetish(Fetish.FETISH_CROSS_DRESSER))) {
        for (InventorySlot slot : inventorySlotsInPriorityOrder) {
            if (replaceUnsuitableClothing) {
                if (character.getClothingInSlot(slot) != null) {
                    if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.MASCULINE) {
                        character.unequipClothingIntoVoid(character.getClothingInSlot(slot), true, character);
                    }
                }
            }
            if (!slot.isCoreClothing() && onlyAddCoreClothing) {
            // Don't add clothing if not core
            } else {
                if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
                    if (!ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
                        List<AbstractClothingType> clothingToUse = ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot);
                        if (character.getHistory() == History.PROSTITUTE) {
                            clothingToUse = suitableFeminineClothing.get(History.PROSTITUTE);
                        }
                        AbstractClothingType ct = getClothingTypeForSlot(character, slot, clothingToUse);
                        clothingToUse.remove(ClothingType.PENIS_CONDOM);
                        if (ct != null) {
                            character.equipClothingFromNowhere(AbstractClothingType.generateClothing(ct, (slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))), false), true, character);
                        }
                    }
                }
            }
        }
    } else {
        for (InventorySlot slot : inventorySlotsInPriorityOrder) {
            if (replaceUnsuitableClothing) {
                if (character.getClothingInSlot(slot) != null) {
                    if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.FEMININE) {
                        character.unequipClothingIntoVoid(character.getClothingInSlot(slot), true, character);
                    }
                }
            }
            if (!slot.isCoreClothing() && onlyAddCoreClothing) {
            // Don't add clothing if not core
            } else {
                if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
                    if (!ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
                        List<AbstractClothingType> clothingToUse = ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot);
                        clothingToUse.remove(ClothingType.PENIS_CONDOM);
                        AbstractClothingType ct = getClothingTypeForSlot(character, slot, clothingToUse);
                        if (ct != null) {
                            character.equipClothingFromNowhere(AbstractClothingType.generateClothing(ct, (slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))), false), true, character);
                        }
                    }
                }
            }
        }
    }
}
Also used : AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) ArrayList(java.util.ArrayList) Colour(com.lilithsthrone.utils.Colour)

Example 7 with InventorySlot

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

the class CharacterUtils method getClothingTypeForSlot.

private static AbstractClothingType getClothingTypeForSlot(GameCharacter character, InventorySlot slot, List<AbstractClothingType> clothingOptions) {
    List<AbstractClothingType> availableClothing = new ArrayList<>();
    boolean canEquip = true;
    for (AbstractClothingType ct : clothingOptions) {
        if (ct.getSlot() != slot) {
            continue;
        }
        canEquip = true;
        if (slot == InventorySlot.CHEST && !character.hasBreasts()) {
            canEquip = false;
        } else if (character.hasFetish(Fetish.FETISH_EXHIBITIONIST)) {
            for (BlockedParts bp : ct.getBlockedPartsList()) {
                boolean leavesAnusExposed = character.isCoverableAreaExposed(CoverableArea.ANUS) && !bp.blockedBodyParts.contains(CoverableArea.ANUS);
                boolean leavesNipplesExposed = character.isCoverableAreaExposed(CoverableArea.NIPPLES) && !bp.blockedBodyParts.contains(CoverableArea.NIPPLES);
                boolean leavesPenisExposed = !character.hasPenis() || (character.isCoverableAreaExposed(CoverableArea.PENIS) && !bp.blockedBodyParts.contains(CoverableArea.PENIS));
                boolean leavesVaginaExposed = !character.hasVagina() || (character.isCoverableAreaExposed(CoverableArea.VAGINA) && !bp.blockedBodyParts.contains(CoverableArea.VAGINA));
                // TODO
                if (!leavesNipplesExposed || (!leavesAnusExposed || !leavesPenisExposed && !leavesVaginaExposed)) {
                    canEquip = false;
                }
            }
        } else {
            for (InventorySlot is : ct.getIncompatibleSlots()) {
                if (character.getClothingInSlot(is) != null) {
                    canEquip = false;
                }
            }
        }
        if (canEquip) {
            availableClothing.add(ct);
        }
    }
    if (availableClothing.isEmpty()) {
        return null;
    } else {
        return availableClothing.get(Util.random.nextInt(availableClothing.size()));
    }
}
Also used : AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) BlockedParts(com.lilithsthrone.game.inventory.clothing.BlockedParts) ArrayList(java.util.ArrayList) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot)

Aggregations

InventorySlot (com.lilithsthrone.game.inventory.InventorySlot)7 ArrayList (java.util.ArrayList)6 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)3 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)3 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)3 GameCharacter (com.lilithsthrone.game.character.GameCharacter)3 Attribute (com.lilithsthrone.game.character.attributes.Attribute)3 Perk (com.lilithsthrone.game.character.effects.Perk)3 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)3 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)3 SpecialAttack (com.lilithsthrone.game.combat.SpecialAttack)3 Spell (com.lilithsthrone.game.combat.Spell)3 EventTarget (org.w3c.dom.events.EventTarget)3 NPC (com.lilithsthrone.game.character.npc.NPC)2 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)2 AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)2 AbstractClothingType (com.lilithsthrone.game.inventory.clothing.AbstractClothingType)2 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)2 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)2 Colour (com.lilithsthrone.utils.Colour)2