import { EquipmentSlot } from "@minecraft/server";
import { afterEvents, namespace as ns } from "./eternal/constants";

afterEvents.entityHitEntity.subscribe((e) => {
  const { damagingEntity, hitEntity } = e;
  if (damagingEntity.isPlayer) {
    const item = damagingEntity.getEquipment(EquipmentSlot.Mainhand);
    if (item && item.typeId === `${ns}:talon_dagger`) {
      hitEntity.addEffect("poison", 100);
    }
  }
});
