var utils = implement("fiskheroes:external/utils");
var landing = implement("wv:external/superhero_landing");
var super_boost = implement("fiskheroes:external/super_boost");

function init(hero) {
    hero.setName("Hex Vision");
    hero.setTier(8);

    hero.setHelmet("Head");
    hero.setChestplate("Torso");
    hero.setLeggings("Legs");
    hero.setBoots("Boots");

    hero.addPowers("wv:vibranium_physiology");
    hero.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    hero.addAttribute("WEAPON_DAMAGE", 1.5, 0);
    hero.addAttribute("SPRINT_SPEED", 0.15, 1);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 1.0, 1);

    hero.addKeyBind("CHARGED_BEAM", "key.mindStoneBlast", 1);
    hero.addKeyBind("INTANGIBILITY", "key.intangibility", 2);
    super_boost.addKeyBind(hero, "key.boost", 3);

    hero.setModifierEnabled(isModifierEnabled);

    hero.setKeyBindEnabled((entity, keyBind) => {
        switch(keyBind){
            default:
                return super_boost.isKeyBindEnabled(entity, keyBind);
        }
     
    });

    
    hero.setTickHandler((entity, manager) => {
        utils.flightOnIntangibility(entity, manager);
        landing.tick(entity, manager);
        super_boost.tick(entity, manager);
            manager.incrementData(entity, "wv:dyn/holoanimation", 20, 20, entity.is("DISPLAY") && !entity.as("DISPLAY").isStatic() && entity.as("DISPLAY").getDisplayType() === "HOLOGRAM");
        })

    hero.setHasProperty((entity, property) => property == "BREATHE_SPACE");
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:flight":
        return !entity.getData("fiskheroes:glide_flying");
        default:
            return super_boost.isModifierEnabled(entity, modifier);
    }
} 


