import { world } from "@minecraft/server";
import { handleProjectileHit } from "../C/Attacking";
import { applyWitherEffectToProjectileOwner } from "../A/ShadowPhoenixArmor";
import { getArmorType } from "../U/ArmorUtility";
import { ArmorType } from "../DATA/ArmorConfig";
import { strikeLightningEffectOnAttacker } from "../A/PegasusArmour";
export function runProjectileHitEventAfterEvent(log) {
    world.afterEvents.projectileHitBlock.subscribe(handleProjectileHit);
    world.afterEvents.projectileHitEntity.subscribe((event) => {
        const attacker = event.source;
        const hitEntity = event.getEntityHit().entity;
        const hitEntityId = hitEntity?.typeId;
        if (hitEntityId === "minecraft:player" && attacker?.isValid()) {
            const armorType = getArmorType(hitEntity);
            if (armorType === ArmorType.ShadowPhoenix) {
                applyWitherEffectToProjectileOwner(attacker);
            }
            if (armorType === ArmorType.Pegasus) {
                strikeLightningEffectOnAttacker(log, attacker, hitEntity);
            }
        }
    });
}

//# sourceMappingURL=../../../../../_KiCuMountsBPDebug/kicu/mmad/ESS/projectileHitEvent.js.map
