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

import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityDaleSoldier;
import lotr.common.entity.npc.LOTREntityDunedain;
import lotr.common.fac.LOTRFaction;
import lotr.common.quest.LOTRMiniQuest;
import lotr.common.quest.LOTRMiniQuestFactory;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class EsgarothSoldier extends LOTREntityDaleSoldier {
    public EsgarothSoldier(World world) {
        super(world);
        this.npcShield = LOTRShields.ALIGNMENT_ESGAROTH;
    }
    @Override
    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = this.rand.nextInt(2);
        if (i == 0) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.greatswordDale));
            if (this.rand.nextInt(5) == 0) {
                this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
                this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearDale));
            }
        } else if (i == 1) {
            this.npcItemsInv.setMeleeWeapon(new ItemStack(LOTRMod.spearDale));
            this.npcItemsInv.setSpearBackup(null);
        }
        this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
        this.setCurrentItemOrArmor(1, new ItemStack(CinderLoE.bootsEsgaroth));
        this.setCurrentItemOrArmor(2, new ItemStack(CinderLoE.legsEsgaroth));
        this.setCurrentItemOrArmor(3, new ItemStack(CinderLoE.bodyEsgaroth));
        if (this.rand.nextInt(10) != 0) {
            this.setCurrentItemOrArmor(4, new ItemStack(CinderLoE.helmetEsgaroth));
        } else {
            this.setCurrentItemOrArmor(4, null);
        }
        return data;
    }
}
