Search in sources :

Example 11 with ItemEffect

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

the class EnchantingUtils method getImportedSVGString.

public static String getImportedSVGString(AbstractCoreItem item, Colour importedColour, List<ItemEffect> effects) {
    if (((AbstractItem) item).getItemType().getId().equals(ItemType.ORIENTATION_HYPNO_WATCH.getId())) {
        if (effects.isEmpty() || effects.get(0).getPrimaryModifier() == TFModifier.REMOVAL) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchBase();
        }
        if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_GYNEPHILIC) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchGynephilic();
        } else if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_AMBIPHILIC) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchAmbiphilic();
        } else {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchAndrophilic();
        }
    }
    StringBuilder SVGImageSB = new StringBuilder();
    String importedColourString = SVGImages.SVG_IMAGE_PROVIDER.getRefinedBackgroundMap().get(importedColour);
    if (importedColourString == null || importedColourString.isEmpty() || importedColourString.equals("null")) {
        importedColourString = SVGImages.SVG_IMAGE_PROVIDER.getRefinedBackgroundMap().get(effects.get(0).getItemEffectType().getColour());
    }
    SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + importedColourString + "</div>");
    String s = item.getSVGString();
    Colour colour = Colour.CLOTHING_BLUE_LIGHT;
    for (ItemEffect ie : effects) {
        if (ie.getPrimaryModifier() != null && ie.getPrimaryModifier() != TFModifier.NONE) {
            colour = ie.getPrimaryModifier().getColour();
            break;
        }
    }
    s = s.replaceAll("#ff2a2a", colour.getShades()[0]);
    s = s.replaceAll("#ff5555", colour.getShades()[1]);
    s = s.replaceAll("#ff8080", colour.getShades()[2]);
    s = s.replaceAll("#ffaaaa", colour.getShades()[3]);
    s = s.replaceAll("#ffd5d5", colour.getShades()[4]);
    SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + s + "</div>");
    for (ItemEffect ie : effects) {
        if (ie.getSecondaryModifier() != null && ie.getSecondaryModifier() != TFModifier.NONE) {
            SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + SVGImages.SVG_IMAGE_PROVIDER.getRefinedSwirlsMap().get(ie.getSecondaryModifier().getColour()) + "</div>");
            break;
        }
    }
    return SVGImageSB.toString();
}
Also used : ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) Colour(com.lilithsthrone.utils.Colour)

Example 12 with ItemEffect

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

the class EnchantingUtils method getCost.

public static int getCost(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    int cost = 0;
    Map<ItemEffect, Integer> effectCount = new HashMap<>();
    for (ItemEffect ie : effects) {
        effectCount.putIfAbsent(ie, 0);
        effectCount.put(ie, effectCount.get(ie) + 1);
    }
    for (ItemEffect ie : ingredient.getEffects()) {
        if (effects.contains(ie)) {
            effectCount.put(ie, effectCount.get(ie) - 1);
        } else {
            effectCount.putIfAbsent(ie, 0);
            effectCount.put(ie, effectCount.get(ie) + 1);
        }
    }
    for (Entry<ItemEffect, Integer> entry : effectCount.entrySet()) {
        cost += entry.getKey().getCost() * Math.abs(entry.getValue());
    }
    if (Main.game.getPlayer().hasFetish(Fetish.FETISH_TRANSFORMATION_GIVING) && ingredient instanceof AbstractItem) {
        cost /= 2;
    }
    if (Main.game.getPlayer().hasTrait(Perk.CLOTHING_ENCHANTER, true) && ingredient instanceof AbstractClothing) {
        cost /= 2;
    }
    return cost;
}
Also used : HashMap(java.util.HashMap) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem)

Example 13 with ItemEffect

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

the class EnchantingUtils method craftClothing.

public static AbstractClothing craftClothing(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    AbstractClothing craftedClothing = null;
    List<ItemEffect> effectsToBeAdded = new ArrayList<>();
    effectsToBeAdded.addAll(effects);
    craftedClothing = AbstractClothingType.generateClothing((AbstractClothingType) ingredient.getEnchantmentItemType(effects), ingredient.getColour(), ((AbstractClothing) ingredient).getSecondaryColour(), ((AbstractClothing) ingredient).getTertiaryColour(), effectsToBeAdded);
    craftedClothing.setEnchantmentKnown(true);
    return craftedClothing;
}
Also used : AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ArrayList(java.util.ArrayList) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect)

Example 14 with ItemEffect

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

the class EnchantingUtils method getSVGString.

public static String getSVGString(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    if (ingredient.getEnchantmentItemType(effects) instanceof AbstractClothingType) {
        return ingredient.getSVGString();
    }
    if (((AbstractItem) ingredient).getItemType().getId().equals(ItemType.ORIENTATION_HYPNO_WATCH.getId())) {
        if (effects.isEmpty() || effects.get(0).getPrimaryModifier() == TFModifier.REMOVAL) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchBase();
        }
        if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_GYNEPHILIC) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchGynephilic();
        } else if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_AMBIPHILIC) {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchAmbiphilic();
        } else {
            return SVGImages.SVG_IMAGE_PROVIDER.getHypnoWatchAndrophilic();
        }
    }
    StringBuilder SVGImageSB = new StringBuilder();
    SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + SVGImages.SVG_IMAGE_PROVIDER.getRefinedBackgroundMap().get(ingredient.getEnchantmentEffect().getColour()) + "</div>");
    String s = ((AbstractItemType) ingredient.getEnchantmentItemType(effects)).getSVGString();
    Colour colour = Colour.CLOTHING_BLUE_LIGHT;
    for (ItemEffect ie : effects) {
        if (ie.getPrimaryModifier() != null && ie.getPrimaryModifier() != TFModifier.NONE) {
            colour = ie.getPrimaryModifier().getColour();
            break;
        }
    }
    s = s.replaceAll("#ff2a2a", colour.getShades()[0]);
    s = s.replaceAll("#ff5555", colour.getShades()[1]);
    s = s.replaceAll("#ff8080", colour.getShades()[2]);
    s = s.replaceAll("#ffaaaa", colour.getShades()[3]);
    s = s.replaceAll("#ffd5d5", colour.getShades()[4]);
    SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + s + "</div>");
    for (ItemEffect ie : effects) {
        if (ie.getSecondaryModifier() != null && ie.getSecondaryModifier() != TFModifier.NONE) {
            SVGImageSB.append("<div style='width:100%;height:100%;position:absolute;left:0;bottom:0;'>" + SVGImages.SVG_IMAGE_PROVIDER.getRefinedSwirlsMap().get(ie.getSecondaryModifier().getColour()) + "</div>");
            break;
        }
    }
    return SVGImageSB.toString();
}
Also used : AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) Colour(com.lilithsthrone.utils.Colour)

Example 15 with ItemEffect

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

the class GameCharacter method applyUnequipClothingEffects.

private void applyUnequipClothingEffects(AbstractClothing clothing) {
    incrementBonusAttribute(Attribute.RESISTANCE_PHYSICAL, -clothing.getClothingType().getPhysicalResistance());
    for (Entry<Attribute, Integer> e : clothing.getAttributeModifiers().entrySet()) {
        incrementBonusAttribute(e.getKey(), -e.getValue());
    }
    for (ItemEffect ie : clothing.getEffects()) {
        if (ie.getSecondaryModifier() != null && ie.getSecondaryModifier().getFetish() != null) {
            Fetish associatedFetish = ie.getSecondaryModifier().getFetish();
            switch(ie.getPotency()) {
                case MINOR_BOOST:
                    clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) - 1);
                    break;
                case BOOST:
                    clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) - 2);
                    break;
                case MAJOR_BOOST:
                    fetishesFromClothing.remove(associatedFetish);
                    applyFetishLossEffects(associatedFetish);
                    break;
                case MINOR_DRAIN:
                    clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 1);
                    break;
                case DRAIN:
                    clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 2);
                    break;
                case MAJOR_DRAIN:
                    clothingFetishDesireModifiersMap.putIfAbsent(associatedFetish, 0);
                    clothingFetishDesireModifiersMap.put(associatedFetish, clothingFetishDesireModifiersMap.get(associatedFetish) + 999);
                    break;
            }
        }
    }
}
Also used : Fetish(com.lilithsthrone.game.character.fetishes.Fetish) Attribute(com.lilithsthrone.game.character.attributes.Attribute) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect)

Aggregations

ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)22 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)9 ArrayList (java.util.ArrayList)9 TFModifier (com.lilithsthrone.game.inventory.enchanting.TFModifier)7 AbstractItemType (com.lilithsthrone.game.inventory.item.AbstractItemType)7 Attribute (com.lilithsthrone.game.character.attributes.Attribute)6 AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)6 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)4 AbstractClothingType (com.lilithsthrone.game.inventory.clothing.AbstractClothingType)4 TFPotency (com.lilithsthrone.game.inventory.enchanting.TFPotency)4 Colour (com.lilithsthrone.utils.Colour)4 HashMap (java.util.HashMap)4 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)3 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)2 ListValue (com.lilithsthrone.utils.Util.ListValue)2 Value (com.lilithsthrone.utils.Util.Value)2 Element (org.w3c.dom.Element)2 TooltipUpdateThread (com.lilithsthrone.controller.TooltipUpdateThread)1 EnchantmentEventListener (com.lilithsthrone.controller.eventListeners.EnchantmentEventListener)1 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)1