import { EntityComponentTypes, world, TicksPerSecond } from "@minecraft/server";
import { phoenixArmorConfig } from "../DATA/ArmorConfig";
let effectOnCooldown = {};
export function applyPhoenixArmorInvincibility(log, player, newValue) {
    const healthComponent = player.getComponent(EntityComponentTypes.Health);
    if (healthComponent && newValue < healthComponent.effectiveMax / 2) {
        if (effectOnCooldown[player.id] !== true) {
            player.addEffect("resistance", phoenixArmorConfig.resistanceDuration * TicksPerSecond, {
                showParticles: false,
                amplifier: 255,
            });
            player.playSound(phoenixArmorConfig.soundEffect.sound);
            player.dimension.spawnParticle("kicu_mmad:phoenix_airburst_particle2", player.location);
            effectOnCooldown[player.id] = true;
            player.setDynamicProperty("kicu_mmad:phoenix_armor_cooldown", Math.floor(phoenixArmorConfig.abilityCooldownDuration * 1000));
        }
    }
}
export function decreasePhoenixArmorCooldown(log) {
    for (const player of world.getAllPlayers()) {
        const cooldown = player.getDynamicProperty("kicu_mmad:phoenix_armor_cooldown");
        if (cooldown && cooldown > 0) {
            player.setDynamicProperty("kicu_mmad:phoenix_armor_cooldown", cooldown - 1);
        }
        else {
            effectOnCooldown[player.id] = false;
        }
    }
}

//# sourceMappingURL=../../../../../_KiCuMountsBPDebug/kicu/mmad/A/PhoenixArmor.js.map
