package com.zivilon.cinder_loe.entity.corrupt;

import com.zivilon.cinder_loe.CinderLoE_Config;
import lotr.common.LOTRLevelData;
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
import lotr.common.entity.npc.LOTREntityGondorMan;
import lotr.common.entity.npc.LOTRNames;
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.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class CorruptSkeleton extends CorruptMan {

    public CorruptSkeleton(World world) {
        super(world);
        this.addTargetTasks(true);
    }
    @Override
    public void setupNPCName() {
        this.familyInfo.setName(LOTRNames.getGondorName(this.rand, this.familyInfo.isMale()));
    }

    @Override
    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(70.0);
    }

    @Override
    public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
        return null;
    }

    @Override
    public LOTRFaction getFaction() {
        /**
         * ok doesnt work, will need an alternative, maybe a new method
        if (hiredNPCInfo.getHiringPlayer() != null) {
            if (LOTRLevelData.getData(hiredNPCInfo.getHiringPlayer()).getPledgeFaction() != null) {
                return LOTRFaction.valueOf(String.valueOf(LOTRLevelData.getData(hiredNPCInfo.getHiringPlayer()).getPledgeFaction()));
            }
        }
         */
        return LOTRFaction.valueOf(CinderLoE_Config.skeleton_faction);
    }

    @Override
    public String getNPCName() {
        return this.familyInfo.getName();
    }
    @Override
    protected float getSoundPitch() {
        return super.getSoundPitch() * 0.65f;
    }
    @Override
    public String getHurtSound() {
        return "mob.skeleton.hurt";
    }
    @Override
    public String getDeathSound() {
        return "mob.skeleton.death";
    }

    public String getLivingSound() {
        return "mob.skeleton.say";
    }

    @Override
    public String getAttackSound() {
        return "mob.skeleton.say";
    }
    @Override
    public String getSpeechBank(EntityPlayer entityplayer) {
        if (this.isFriendlyAndAligned(entityplayer)) {
            return "corruptSpeak/all/skeleton";
        }
        return "corruptSpeak/all/skeleton";
    }
    @Override
    protected void dropFewItems(boolean flag, int i) {
        super.dropFewItems(flag, i);
        int bones = this.rand.nextInt(3) + this.rand.nextInt(i + 1);
        for (int l = 0; l < bones; ++l) {
            this.dropItem(Items.bone, 1);
        }
    }
}
