import * as mc from "@minecraft/server";
import { MeleeAttack, mclog } from "../utils/index";
export function initMuleWeapon() {
    new MeleeAttack({
        attackID: "ldz:mule_weapon",
        damage: 4,
        range: 3,
        subscribeToScriptEvent: true,
        hitCallbacks: [
            (player, hitEntity) => {
                mclog(`${player.nameTag} used mule_weapon`);
                useMuleWeapon(player, hitEntity);
            }
        ],
    });
}
function useMuleWeapon(player, hitEntity) {
    player.addEffect("fire_resistance", 10, { showParticles: false });
    player.setProperty("ldz:is_lightning_immune", true);
    mc.system.runTimeout(() => {
        if (!player.isValid())
            return;
        player.extinguishFire();
        player.setProperty("ldz:is_lightning_immune", false);
    }, 2);
    hitEntity.dimension.spawnEntity("minecraft:lightning_bolt", hitEntity.location);
}
