import { world, EquipmentSlot } from "@minecraft/server"; // Asegúrate de importar EquipmentSlot

world.afterEvents.entityHitEntity.subscribe((e) => {
    const { hitEntity: target, damagingEntity: source } = e;
    
    if (source.hasComponent('minecraft:equippable')) {
        const equippable = source.getComponent('minecraft:equippable');
        const helmet = equippable.getEquipment(EquipmentSlot.Head); // Usa EquipmentSlot.Head
        
        if (helmet && helmet.typeId === 'mc_ark:gas_mask') {
            const duration = 3 * 20; // 10 segundos (en ticks)
            
            target.addEffect('poison', duration, {
                showParticles: true,
                amplifier: 0 // Nivel II (0 = I, 1 = II, etc.)
            });
        }
    }
});