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

import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;


public class RhudaurSoldier extends LOTREntityAngmarHillmanWarrior {

    private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.swordAngmar), new ItemStack(LOTRMod.battleaxeAngmar), new ItemStack(LOTRMod.hammerAngmar), new ItemStack(LOTRMod.polearmAngmar), new ItemStack(LOTRMod.spearAngmar)};
    private static ItemStack[] helmets = new ItemStack[]{new ItemStack(CinderLoE.helmetRhudaur)};
    private static ItemStack[] bodies = new ItemStack[]{new ItemStack(CinderLoE.bodyRhudaur)};
    private static ItemStack[] legs = new ItemStack[]{new ItemStack(CinderLoE.legsRhudaur)};
    private static ItemStack[] boots = new ItemStack[]{new ItemStack(CinderLoE.bootsRhudaur)};

    public RhudaurSoldier(World world) {
        super(world);
        this.npcShield = LOTRShields.ALIGNMENT_MORDOR;
    }

    @Override
    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = this.rand.nextInt(weapons.length);
        this.npcItemsInv.setMeleeWeapon(weapons[i].copy());
        this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
        i = this.rand.nextInt(boots.length);
        this.setCurrentItemOrArmor(1, boots[i].copy());
        i = this.rand.nextInt(legs.length);
        this.setCurrentItemOrArmor(2, legs[i].copy());
        i = this.rand.nextInt(bodies.length);
        this.setCurrentItemOrArmor(3, bodies[i].copy());
        if (this.rand.nextInt(5) != 0) {
            i = this.rand.nextInt(helmets.length);
            this.setCurrentItemOrArmor(4, helmets[i].copy());
        }
        return data;
    }
}
