import {system} from "@minecraft/server";
import { cooldowns } from "./../../util/utils.js";
const weaponBoost = new Map([
        ["glaive", 1],
        ["rapier", 3],
    ])

const ability = {
    name: 'B2',
    display_name: "Blaze Up",
    button_icon: "textures/items/diamond",
    registry_name: "blazeup",
    description: 'Power Up yourself',
    level: "basic",
    cooldown: 15,
    damages: 10,
    charge_type: "charge_till_end",
    charge_count: 3,
    charge_interval: 10,
    canSwitch : false,
    filters: ["hand_cannon"],
    slots: ["ability"],
    coodname: "jmptkcd",
    horizontal: 1.4 ,
    vertical: 0.5,
    execute(player, weaponType, mode, weapon) {
        const cooldown = this.cooldown
        player.runCommand("scoreboard players remove @s exhaust 40")
        player.playAnimation(`animation.minced.${weaponType}.ability_blaze_up`)
        let statuser = JSON.parse(player.getDynamicProperty("resetingStatus"))
        statuser["Boost"] = statuser.Boost + 0.5
        player.setDynamicProperty("resetingStatus", JSON.stringify(statuser))
        player.setProperty("aura:color", 2)
        system.runTimeout(()=>{
            player.setProperty("aura:color", 0)         
        },40)
        player.runCommandAsync("tag @s remove attack")
        player.runCommandAsync("inputpermission set @s movement enabled")
        cooldowns(player,this.name,cooldown,10)
    },
    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