package com.zivilon.cinder_loe.entity.npc;

import com.zivilon.cinder_loe.CinderLoE;
import lotr.common.LOTRMod;
import lotr.common.LOTRShields;
import lotr.common.entity.npc.LOTREntityBreeGuard;
import lotr.common.entity.npc.LOTREntityNearHaradrim;
import lotr.common.item.LOTRItemHaradRobes;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class HaradLevy extends LOTREntityNearHaradrim {
    private static ItemStack[] levyWeapons = new ItemStack[]{new ItemStack(LOTRMod.daggerHarad), new ItemStack(LOTRMod.daggerHaradPoisoned), new ItemStack(LOTRMod.swordHarad), new ItemStack(LOTRMod.swordMoredain), new ItemStack(LOTRMod.battleaxeBronze), new ItemStack(LOTRMod.maceNearHarad), new ItemStack(Items.iron_sword), new ItemStack(LOTRMod.swordBronze), new ItemStack(LOTRMod.battleaxeIron), new ItemStack(LOTRMod.poleaxeNearHarad), new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
    private static ItemStack[] levySpears = new ItemStack[]{new ItemStack(LOTRMod.spearHarad), new ItemStack(LOTRMod.spearIron), new ItemStack(LOTRMod.spearBronze)};
    private static ItemStack[] levyBodies = new ItemStack[]{new ItemStack(Items.leather_chestplate), new ItemStack(LOTRMod.bodyBronze), new ItemStack(LOTRMod.bodyHaradRobes)};
    private static ItemStack[] levyLegs = new ItemStack[]{new ItemStack(Items.leather_leggings), new ItemStack(LOTRMod.legsBronze)};
    private static ItemStack[] levyBoots = new ItemStack[]{new ItemStack(Items.leather_boots), new ItemStack(LOTRMod.bootsBronze), null};
    private static final int[] colors = new int[]{14823729, 5512477, 14196753, 11374145, 7366222};

    public HaradLevy(World world) {
        super(world);
        this.spawnRidingHorse = false;
        this.addTargetTasks(true);
        this.npcShield = null;
    }

    @Override
    public void setupNPCGender() {
        this.familyInfo.setMale(true);
    }

    @Override
    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        int i = (this).rand.nextInt(levyWeapons.length);
        this.npcItemsInv.setMeleeWeapon(levyWeapons[i].copy());
        this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
        if ((this).rand.nextInt(5) == 0) {
            this.npcItemsInv.setSpearBackup(this.npcItemsInv.getMeleeWeapon());
            i = (this).rand.nextInt(levySpears.length);
            this.npcItemsInv.setMeleeWeapon(levySpears[i].copy());
        }
        i = (this).rand.nextInt(levyBoots.length);
        this.setCurrentItemOrArmor(1, levyBoots[i].copy());
        i = (this).rand.nextInt(levyLegs.length);
        this.setCurrentItemOrArmor(2, levyLegs[i].copy());
        i = (this).rand.nextInt(levyBodies.length);
        this.setCurrentItemOrArmor(3, levyBodies[i].copy());
        this.setCurrentItemOrArmor(4, null);
        return data;
    }
}
