function init(hero) {
    hero.setName("The Buzz");
    hero.setTier(7);

    hero.setHelmet("item.superhero_armor.piece.helmet");
    hero.setChestplate("item.superhero_armor.piece.chestplate");
    hero.setLeggings("item.superhero_armor.piece.leggings");
    hero.setBoots("item.superhero_armor.piece.boots");

    hero.addPowers("diminpack:smart_exosuit_2");
    hero.addPowers("diminpack:bee")
    hero.addAttribute("PUNCH_DAMAGE", 10, 0);
    hero.addAttribute("SPRINT_SPEED", 0.15, 1);
    hero.addAttribute("JUMP_HEIGHT", 1, 0);
    hero.addAttribute("FALL_RESISTANCE", 8.9, 1);
    

    hero.addKeyBind("SIZE_MANIPULATION", "key.sizeManipulation", 1);
    hero.addKeyBind("AIM", "Sting", 2);
    hero.addKeyBind("MINIATURIZE_SUIT", "key.miniaturizeSuit", 3);
    hero.addKeyBind("WEB_ZIP", "Grappling Zip", 4);
    hero.addKeyBindFunc("func_WEB_SWINGING", webSwingingKey, "Grappling Swing", 3);
    hero.addKeyBind("UTILITY_BELT", "Toggle Any Concievable Armament", 5)
    /*hero.addKeyBind("TENTACLES", "Activate Grabber Arms", 5);
    hero.addKeyBind("TENTACLE_GRAB", "key.tentacleGrab", 3);
    hero.addKeyBind("TENTACLE_JAB", "key.tentacleJab", 4);
    hero.addKeyBind("TENTACLE_STRIKE", "key.tentacleStrike", 5);*/
    
    
    hero.supplyFunction("canAim", canAim);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setHasProperty(hasProperty);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setTickHandler((entity, manager) => {
        var flap = entity.getData("diminpack:dyn/wasp_flap");
        manager.setData(entity, "diminpack:dyn/wasp_flap", flap + 0.4);
        
        if (entity.getData("fiskheroes:aiming") && entity.getData("fiskheroes:scale") != 1) {
            manager.setData(entity, "fiskheroes:size_state", 1);
        }
        if (entity.getData("fiskheroes:tentacles") && entity.getData("fiskheroes:scale") != 1){
            manager.setData(entity, "fiskheroes:size_state", 1);
        }
        if (entity.getData("fiskheroes:tentacles") && entity.getData("fiskheroes:flying")) {
            manager.setData(entity, "fiskheroes:flying", false)
        }
        manager.incrementData(entity, "fiskheroes:dyn/booster_timer", 2, entity.getData("fiskheroes:flying"));
        manager.incrementData(entity, "fiskheroes:dyn/shrink_timer", 3, entity.getData("fiskheroes:size_state") != 0);
        /*manager.incrementData(entity, "diminpack:dyn/sinister", 1, entity.getData("fiskheroes:aiming") == true);*/
        if ((entity.getData("fiskheroes:aiming") && entity.getData("diminpack:dyn/sinister") == true)) {
            manager.setData(entity, "diminpack:dyn/sinister", false)
        }
        if (entity.getData("fiskheroes:aiming") && entity.getData("diminpack:dyn/sinister") == false) {
            manager.setData(entity, "diminpack:dyn/sinister", true)
        }
         
    });
}
function webSwingingKey(player, manager) {
    var flag = player.getData("fiskheroes:web_swinging");

    if (!flag) {
        manager.setDataWithNotify(player, "fiskheroes:prev_utility_belt_type", player.getData("fiskheroes:utility_belt_type"));
        manager.setDataWithNotify(player, "fiskheroes:utility_belt_type", -1);
        manager.setDataWithNotify(player, "fiskheroes:gliding", false);
    }

    manager.setDataWithNotify(player, "fiskheroes:web_swinging", !flag);
    return true;
}

function isModifierEnabled(entity, modifier) {
    if (modifier.id().startsWith("normal")) {
        return entity.getData("fiskheroes:scale") == 1;
    }
    if (modifier.id().startsWith("small")) {
        return entity.getData("fiskheroes:scale") != 1;
    }
    if (modifier.name() == "fiskheroes:flying") {
        return !entity.getData("fiskheroes:tentacles")
    }
    switch (modifier.name()) {
        case "fiskheroes:water_breathing":
            return entity.getData("fiskheroes:mask_open");
        case "fiskheroes:web_swinging":
            return entity.getHeldItem().isEmpty() && entity.getData("fiskheroes:utility_belt_type") == -1 && !entity.getData("fiskheroes:gliding");
        case "fiskheroes:leaping":
            return modifier.id() == "springboard" == (entity.getData("fiskheroes:ticks_since_swinging") < 5);
        case "fiskheroes:repulsor_blast":
            return entity.getData("fiskheroes:size_state") == 0;
        case "fiskheroes:tentacles":
            return entity.getData("fiskheroes:size_state") == 0;
        default:
            return true;
    }
    
}
function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
        case "func_WEB_SWINGING":
            return entity.getHeldItem().isEmpty() && !entity.isSneaking();
        
    /*case "TENTACLE_JAB":
        return entity.getData("fiskheroes:tentacles") != null;
    case "TENTACLE_STRIKE":
        return !entity.isSneaking() && entity.getData("fiskheroes:tentacles") != null;
    case "TENTACLES":
        return entity.isSneaking() && (entity.getData("fiskheroes:size_state") == 0);
    case "TENTACLE_GRAB":
        return !entity.isSneaking() && entity.getData("fiskheroes:tentacles") != null;*/
    case "MINIATURIZE_SUIT":
        return entity.isSneaking();
    
    default:
        return true;
    }
}
function hasProperty(entity, property) {
    switch (property) {
        case "BREATHE_SPACE":
            return entity.getData("fiskheroes:mask_open");
        default:
            return true;
    }
}



function canAim(entity) {
    return entity.getHeldItem().isEmpty();
}
