package com.zivilon.cinder_loe.enchants;

import lotr.common.enchant.LOTREnchantmentProtectionRanged;
import lotr.common.enchant.LOTREnchantmentProtectionSpecial;
import lotr.common.item.LOTRMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;

public class LOTREnchantmentWeakProtectionRanged extends LOTREnchantmentProtectionSpecial {

    public LOTREnchantmentWeakProtectionRanged(String s, int level) {
        super(s, level);
    }

    @Override
    public String getDescription(ItemStack itemstack) {
        return StatCollector.translateToLocalFormatted((String)"lotr.enchant.protectRanged.desc", (Object[])new Object[]{this.formatAdditiveInt(this.calcIntProtection())});
    }

    @Override
    public boolean canApply(ItemStack itemstack, boolean considering) {
        if (super.canApply(itemstack, considering)) {
            Item item = itemstack.getItem();
            return !(item instanceof ItemArmor) || ((ItemArmor)item).getArmorMaterial() != LOTRMaterial.GALVORN.toArmorMaterial();
        }
        return false;
    }


    @Override
    public boolean isBeneficial() {
        // This enchantment is detrimental, so return false
        return false;
    }

    @Override
    protected boolean protectsAgainst(DamageSource damageSource) {
        return false;
    }

    @Override
    protected int calcIntProtection() {
        return this.protectLevel;
    }
}


