Search in sources :

Example 21 with ItemEffect

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

the class EnchantingUtils method craftItem.

public static AbstractItem craftItem(AbstractCoreItem ingredient, List<ItemEffect> effects) {
    AbstractItem craftedItem = null;
    craftedItem = AbstractItemType.generateItem((AbstractItemType) ingredient.getEnchantmentItemType(effects));
    List<ItemEffect> effectsToBeAdded = new ArrayList<>();
    effectsToBeAdded.addAll(effects);
    craftedItem.setItemEffects(effectsToBeAdded);
    craftedItem.setName(getPotionName(ingredient, effectsToBeAdded));
    craftedItem.setColour(ingredient.getEnchantmentEffect().getColour());
    craftedItem.setSVGString(getSVGString(ingredient, effectsToBeAdded));
    return craftedItem;
}
Also used : AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) ArrayList(java.util.ArrayList) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem)

Example 22 with ItemEffect

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

the class EnchantmentEventListener method handleEvent.

@Override
public void handleEvent(Event event) {
    if (itemToEnchant != null) {
        if (itemToEnchant.getEnchantmentEffect() != null) {
            EnchantmentDialogue.resetEnchantmentVariables();
            EnchantmentDialogue.ingredient = itemToEnchant;
        }
    } else if (primaryModifier != null) {
        EnchantmentDialogue.primaryMod = primaryModifier;
    } else if (secondaryModifier != null) {
        EnchantmentDialogue.secondaryMod = secondaryModifier;
    } else if (potency != null) {
        EnchantmentDialogue.potency = potency;
    } else if (effect) {
        ItemEffect e = EnchantmentDialogue.effects.get(effectIndex);
        EnchantmentDialogue.effects.remove(e);
    } else if (limit != EnchantmentDialogue.limit) {
        EnchantmentDialogue.limit = limit;
    }
    if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getPrimaryModifiers().contains(EnchantmentDialogue.primaryMod)) {
        EnchantmentDialogue.primaryMod = EnchantmentDialogue.ingredient.getEnchantmentEffect().getPrimaryModifiers().get(0);
    }
    if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getSecondaryModifiers(EnchantmentDialogue.primaryMod).contains(EnchantmentDialogue.secondaryMod)) {
        EnchantmentDialogue.secondaryMod = EnchantmentDialogue.ingredient.getEnchantmentEffect().getSecondaryModifiers(EnchantmentDialogue.primaryMod).get(0);
    }
    if (!EnchantmentDialogue.ingredient.getEnchantmentEffect().getPotencyModifiers(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod).contains(EnchantmentDialogue.potency)) {
        EnchantmentDialogue.potency = TFPotency.MINOR_BOOST;
    }
    if (EnchantmentDialogue.limit > EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod)) {
        EnchantmentDialogue.limit = EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod);
    }
    Main.game.setContent(new Response("Enchanting", "Start enchanting.", EnchantmentDialogue.ENCHANTMENT_MENU));
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response) 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