package common.item;

import java.util.List;

import common.color.TextColor;
import common.entity.DamageSource;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.util.BoundingBox;
import common.util.Vec3;
import common.world.AWorldServer;

public class ItemBanHammer extends ItemWand {
    public ItemBanHammer() {
        this.setColor(TextColor.DRED);
    }
    
    public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) {
		List<EntityLiving> list = world.getEntitiesWithinAABB(EntityLiving.class, new BoundingBox(
				vec.xCoord - 3.5, vec.yCoord - 3.5, vec.zCoord - 3.5, vec.xCoord + 3.5, vec.yCoord + 3.5, vec.zCoord + 3.5));
    	for(EntityLiving entity : list) {
    		if(entity != player)
    			entity.attackEntityFrom(DamageSource.causeExterminatusDamage(player), 1200);
    	}
		for(int z = 0; z < 8; z++) {
			world.strikeLightning(vec.xCoord - 0.5 + world.rand.drange(-2.5, 2.5), vec.yCoord, 
					vec.zCoord - 0.5 + world.rand.drange(-2.5, 2.5), 0x6f0000, 0, false, player);
		}
    }

    public boolean isMagnetic() {
    	return true;
    }
    
	public int getRange(ItemStack stack, EntityNPC player) {
		return 120;
	}
}
