import { world, system } from "@minecraft/server";
import { cooldowns } from "./../../util/utils.js";

const ability = {
    name: 'S6',
    display_name: "Sheathe",
    button_icon: "textures/ui/abilities/sheath",
    registry_name: "strong_right",
    description: 'Sheathes The sword',
    indexNum: 18,
    level: "basic",
    cooldown: 5,
    damages: 1,
    charge_type: "charge_till_end",
    charge_count: 3,
    charge_interval: 10,
    canSwitch : false,
    filters: ["katana"],
    slots: ["ability"],
    coodname: "shrcd",
    horizontal: 0,
    vertical: 0,
    execute(player, weaponType, mode, weapon) {
        const cooldown = this.cooldown
        system.runTimeout(()=>{
            player.setProperty("mode:combat", 0)
            player.playAnimation(`animation.minced.katana.ability_sheath`)
            world.scoreboard.getObjective("combatCooldown").setScore(player, 2)
            world.scoreboard.getObjective("combatCheck").setScore(player, 0)
            player.runCommandAsync("tag @s remove attack")
        },10)

        cooldowns(player,this.name,cooldown,cooldown)
    }, 
    resetStats(player) {
        let statuser = JSON.parse(player.getDynamicProperty("resetingStatus"))
        statuser["Boost"] = statuser.Boost - 0.2
        player.setDynamicProperty("resetingStatus", JSON.stringify(statuser))
        player.setProperty("aura:color", 0)
    }
}

export default ability