package com.zivilon.cinder_loe.entity.corrupt;

import com.zivilon.cinder_loe.CinderLoE_Config;
import lotr.common.LOTRFoods;
import lotr.common.LOTRMod;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityElf;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.entity.npc.LOTRNames;
import lotr.common.fac.LOTRFaction;
import lotr.common.item.LOTRItemMug;
import lotr.common.world.structure.LOTRChestContents;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class CorruptElf  extends LOTREntityElf {
    private LOTRFaction faction;
    @Override
    public ItemStack getPickedResult(MovingObjectPosition target) {
        return null;
    }
    public CorruptElf(World world) {
        super(world);
    }
    @Override
    protected LOTRFoods getElfDrinks() {
        return LOTRFoods.ORC_DRINK;
    }
    @Override
    protected EntityAIBase createElfMeleeAttackAI() {
        return new LOTREntityAIAttackOnCollide(this, 1.5, false);
    }
    @Override
    protected EntityAIBase createElfRangedAttackAI() {
        return this.createElfMeleeAttackAI();
    }

    @Override
    public void setupNPCName() {
        this.familyInfo.setName(LOTRNames.getSindarinName(this.rand, this.familyInfo.isMale()));
    }
    @Override
    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        data = super.onSpawnWithEgg(data);
        return data;
    }

    @Override
    protected void onAttackModeChange(LOTREntityNPC.AttackMode mode, boolean mounted) {
        if (mode == LOTREntityNPC.AttackMode.IDLE) {
            this.tasks.removeTask(this.meleeAttackAI);
            this.tasks.removeTask(this.rangedAttackAI);
            this.setCurrentItemOrArmor(0, this.npcItemsInv.getIdleItem());
        } else {
            this.tasks.removeTask(this.meleeAttackAI);
            this.tasks.removeTask(this.rangedAttackAI);
            this.tasks.addTask(2, this.meleeAttackAI);
            this.setCurrentItemOrArmor(0, this.npcItemsInv.getMeleeWeapon());
        }
    }
    @Override
    public LOTRFaction getFaction() {
        return LOTRFaction.valueOf(CinderLoE_Config.corrupt_faction);
    }
    @Override
    public float getAlignmentBonus() {
        return 0.0f;
    }

    @Override
    protected void dropElfItems(boolean flag, int i) {
        super.dropElfItems(flag, i);
    }

    @Override
    public boolean canElfSpawnHere() {
        return false;
    }
    @Override
    public String getSpeechBank(EntityPlayer entityplayer) {
        if (this.isFriendlyAndAligned(entityplayer)) {
            return "corruptSpeak/all/neutral";
        }
        return "corruptSpeak/all/hostile";
    }

    @Override
    public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) {
    }
    @Override
    protected float getSoundPitch() {
        return super.getSoundPitch() * 0.65f;
    }
    @Override
    public String getHurtSound() {
        return "lotr:orc.hurt";
    }
    @Override
    public String getDeathSound() {
        return "lotr:orc.death";
    }

    @Override
    public String getAttackSound() {
        return "lotr:orc.attack";
    }
    @Override
    public void onKillEntity(EntityLivingBase entity) {
        super.onKillEntity(entity);
        this.playSound("lotr:orc.kill", this.getSoundVolume(), this.getSoundPitch());
    }
    @Override
    protected void dropFewItems(boolean flag, int i) {
        super.dropFewItems(flag, i);
    }
}
