package com.zivilon.cinder_loe.entity.npc.evil_human;

import com.zivilon.cinder_loe.CinderLoE;

import lotr.common.LOTRShields;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class LimwaithBoneWarrior extends Limwaith {
    public LimwaithBoneWarrior(World world) {
        super(world);
        this.npcShield = LOTRShields.ALIGNMENT_MOREDAIN;
    }

    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = rand.nextInt(6);
        if (i == 0) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.truncheonLimwaith));
        } else if (i == 1 || i == 2) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.tridentLimwaith));
        } else if (i == 3 || i == 4) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.spearLimwaith));
        } else  {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.battleaxeLimwaith));
        }

        if (rand.nextInt(6) == 0) {
            this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.spearLimwaith));
        } 

        this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
        setCurrentItemOrArmor(1, new ItemStack(CinderLoE.bootsboneLimwaith));
        setCurrentItemOrArmor(2, new ItemStack(CinderLoE.legsboneLimwaith));
        setCurrentItemOrArmor(3, new ItemStack(CinderLoE.bodyboneLimwaith));
        if (rand.nextInt(10) != 0)
            setCurrentItemOrArmor(4, new ItemStack(CinderLoE.helmetboneLimwaith));
        return data;
    }
    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return new ItemStack(CinderLoE.spawnEgg, 1, 5);
    }
}
