import { world, system } from "@minecraft/server";
import { cooldowns } from "./../../util/utils.js";
const weaponBoost = new Map([
        ["longsword", 3.5],
        ["rapier", 2.5],
    ])

const ability = {
    name: 'V2',
    display_name: "Vibration Blitz",
    button_icon: "textures/items/diamond",
    registry_name: "vibration_blitz",
    description: 'transfers momentun to damage from the inside out',
    indexNum: 24,
    level: "intermediate",
    cooldown: 100,
    damages: 15,
    charge_type: "charge_till_end",
    charge_count: 3,
    charge_interval: 10,
    canSwitch : true,
    filters: ["gauntlet", "war_hammer", "mace", "polehammer", "grand_cross"],
    slots: ["ability"],
    coodname: "vrpcd",
    horizontal: 1.5,
    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_vibration_blitz`)
        let statuser = JSON.parse(player.getDynamicProperty("resetingStatus"))
        statuser["bluntBoost"] = statuser.bluntBoost + 0.25
        player.setDynamicProperty("resetingStatus", JSON.stringify(statuser))
        player.setProperty("aura:color", 3)
        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,20)
    },
    resetStats(player) {
        let statuser = JSON.parse(player.getDynamicProperty("resetingStatus"))
        statuser["bluntBoost"] = statuser.bluntBoost - 0.25
        player.setDynamicProperty("resetingStatus", JSON.stringify(statuser))
        player.setProperty("aura:color", 0)
    }
}

export default ability