import { coordExtractor } from "./../../util/utils.js";


const ability = {
    name: 'laceration',
    display_name: "Laceration",
    effect_icon: "textures/items/diamond",
    description: 'Reduce Enemy max health for a short period',
    indexNum: 2,
    execute(player, target, mode, dmg) {
        let newRedux = JSON.parse(target.getDynamicProperty("resetingStatus"))
        if(newRedux.effects["HR"] == undefined) {
            newRedux.effects["HR"] = {dur: 30,redux: (dmg * 0.15)}
            let Loa = coordExtractor(target,1)
            target.dimension.spawnParticle(`combat:bleed_activate`,Loa);
        } else {
            newRedux.effects["HR"] = {
                dur: 30,
                redux: newRedux.effects["HR"].redux + (dmg * 0.15)
            }
        }
        target.setDynamicProperty("resetingStatus",JSON.stringify(newRedux))
    },
    resetStats(player) {
        let statuser = JSON.parse(player.getDynamicProperty("resetingStatus"))
        statuser["Boost"] = statuser.Boost - 0.5
        player.setDynamicProperty("resetingStatus", JSON.stringify(statuser))
        player.setProperty("aura:color", 0)
    }
}

export default ability