Search in sources :

Example 6 with AbstractItem

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

the class EnchantmentDialogue method craftItem.

public static void craftItem(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    if (ingredient instanceof AbstractItem) {
        Main.game.getPlayer().removeItem((AbstractItem) ingredient);
        AbstractItem craftedItem = EnchantingUtils.craftItem(ingredient, effects);
        Main.game.getPlayer().addItem(craftedItem, false, true);
    } else if (ingredient instanceof AbstractClothing) {
        Main.game.getPlayer().removeClothing((AbstractClothing) ingredient);
        AbstractClothing craftedClothing = EnchantingUtils.craftClothing(ingredient, effects);
        Main.game.getPlayer().addClothing(craftedClothing, false);
    } else if (ingredient instanceof AbstractWeapon) {
        Main.game.getPlayer().removeWeapon((AbstractWeapon) ingredient);
    }
    Main.game.getPlayer().incrementEssenceCount(ingredient.getRelatedEssence(), -EnchantingUtils.getCost(ingredient, effects));
    previousIngredient = ingredient;
    previousPrimaryMod = primaryMod;
    previousSecondaryMod = secondaryMod;
    previousEffects.clear();
    previousEffects.addAll(EnchantmentDialogue.effects);
    resetEnchantmentVariables();
    EnchantmentDialogue.effects.clear();
}
Also used : AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon)

Example 7 with AbstractItem

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

the class EnchantingUtils method getPotionName.

public static String getPotionName(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    if (ingredient.getEnchantmentItemType(effects) instanceof AbstractClothingType) {
        return Util.capitaliseSentence(ingredient.getName());
    }
    if (((AbstractItem) ingredient).getItemType().getId().equals(ItemType.ORIENTATION_HYPNO_WATCH.getId())) {
        if (effects.isEmpty() || effects.get(0).getPrimaryModifier() == TFModifier.REMOVAL) {
            return "Hypno-Watch";
        }
        if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_GYNEPHILIC) {
            return "Gynephilic Hypno-Watch";
        } else if (effects.get(0).getPrimaryModifier() == TFModifier.ORIENTATION_AMBIPHILIC) {
            return "Ambiphilic Hypno-Watch";
        } else {
            return "Androphilic Hypno-Watch";
        }
    }
    String potionName = ((AbstractItemType) ingredient.getEnchantmentItemType(effects)).getName(false);
    String potionDescriptor = "";
    String potionSuffix = "";
    // it was either PreSuffix or PrefixSuffix...
    String potionPreSuffix = "";
    if (ingredient != null) {
        switch(ingredient.getEnchantmentEffect()) {
            case ATTRIBUTE_CORRUPTION:
                potionDescriptor = "viscous ";
                break;
            case ATTRIBUTE_ARCANE:
                potionDescriptor = "soothing ";
                break;
            case ATTRIBUTE_PHYSIQUE:
                potionDescriptor = "vivid ";
                break;
            case ATTRIBUTE_SEXUAL:
                potionDescriptor = "aphrodisiac ";
                break;
            case RACE_CAT_MORPH:
                potionDescriptor = "feline ";
                break;
            case RACE_DOG_MORPH:
                potionDescriptor = "canine ";
                break;
            case RACE_HORSE_MORPH:
                potionDescriptor = "equine ";
                break;
            case RACE_WOLF_MORPH:
                potionDescriptor = "lupine ";
                break;
            case RACE_HARPY:
                potionDescriptor = "avian ";
                break;
            case RACE_HUMAN:
                potionDescriptor = "human ";
                break;
            case RACE_DEMON:
                potionDescriptor = "demonic ";
                break;
            case RACE_COW_MORPH:
                potionDescriptor = "bovine ";
                break;
            case RACE_SQUIRREL_MORPH:
                potionDescriptor = "squirrel ";
                break;
            case RACE_ALLIGATOR_MORPH:
                potionDescriptor = "alligator ";
                break;
            default:
                break;
        }
    }
    String finalPotionName = potionDescriptor + potionName;
    for (ItemEffect ie : effects) {
        if (ie.getPrimaryModifier() != null && ie.getPrimaryModifier() != TFModifier.NONE) {
            potionSuffix = ie.getPrimaryModifier().getDescriptor();
            if (ie.getSecondaryModifier() != TFModifier.NONE) {
                potionPreSuffix = ie.getSecondaryModifier().getDescriptor();
            }
            if (potionSuffix != "") {
                if (potionPreSuffix != "") {
                    if (ie.getSecondaryModifier().isSoloDescriptor())
                        finalPotionName += " of " + potionPreSuffix;
                    else
                        finalPotionName += " of " + potionPreSuffix + " " + potionSuffix;
                } else {
                    finalPotionName += " of " + potionSuffix;
                }
            }
            break;
        }
    }
    return Util.capitaliseSentence(finalPotionName);
}
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)

Example 8 with AbstractItem

use of com.lilithsthrone.game.inventory.item.AbstractItem 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 9 with AbstractItem

use of com.lilithsthrone.game.inventory.item.AbstractItem 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 10 with AbstractItem

use of com.lilithsthrone.game.inventory.item.AbstractItem 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)

Aggregations

AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)16 ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)9 AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)8 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)7 ArrayList (java.util.ArrayList)6 AbstractItemType (com.lilithsthrone.game.inventory.item.AbstractItemType)5 Colour (com.lilithsthrone.utils.Colour)4 NPC (com.lilithsthrone.game.character.npc.NPC)3 AbstractClothingType (com.lilithsthrone.game.inventory.clothing.AbstractClothingType)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 Attribute (com.lilithsthrone.game.character.attributes.Attribute)2 Perk (com.lilithsthrone.game.character.effects.Perk)2 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)2 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)2 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)2 SpecialAttack (com.lilithsthrone.game.combat.SpecialAttack)2 Spell (com.lilithsthrone.game.combat.Spell)2