package common.entity.npc;

import common.entity.types.EntityLiving;
import common.init.Items;
import common.init.NameRegistry;
import common.item.ItemStack;
import common.rng.Random;
import common.world.World;

public class EntityElf extends EntityNPC {
	public EntityElf(World worldIn) {
		super(worldIn);
	}
	
//	public boolean isAggressive() {
//		return this.alignment == Alignment.CHAOTIC_EVIL;
//	}
//	
//    public boolean isPeaceful() {
//    	return false;
//    }
    
    public boolean isAggressive(Class<? extends EntityNPC> clazz) {
    	return this.alignment == Alignment.CHAOTIC_EVIL || clazz == EntityCultivator.class;
    }
    
    public boolean isPeaceful(Class<? extends EntityNPC> clazz) {
    	return !this.alignment.evil && clazz == EntityWoodElf.class;
    }
    
//    public boolean canInfight(Alignment align) {
//    	return this.alignment.evil;
//    }
//    
//    public boolean canMurder(Alignment align) {
//    	return false;
//    }
    
    public boolean canUseMagic() {
    	return true;
    }
    
//    public int getBaseEnergy(Random rand) {
//    	return rand.range(10, 30);
//    }
    
    public int getBaseHealth(Random rand) {
    	return rand.range(20, 24);
    }

    public float getHeightDeviationMin() {
    	return -0.2f;
    }

    public float getHeightDeviationMax() {
    	return 0.4f;
    }
    
    public float getSpeciesBaseSize() {
    	return 1.95f;
    }
    
    public Alignment getNaturalAlign() {
    	return rand.chance(50) ? 
    			(rand.chance(8) ? (rand.chance(5) ? Alignment.CHAOTIC_EVIL : Alignment.EVIL) : Alignment.LAWFUL_EVIL) : 
    			(rand.chance(5) ? Alignment.NEUTRAL : Alignment.LAWFUL);
    }
    
    public NameRegistry getNameType() {
        return NameRegistry.ELVEN;
    }
    
    public boolean canAmbush(EntityLiving entity) {
    	return (float)this.getHealth() >= ((float)this.getMaxHealth() / 5.0f);
    }

	protected ItemStack pickItem() {
		return new ItemStack(this.rand.chance(Items.bow, Items.iron_sword, 4));
	}
}
