var super_boost = implement("fiskheroes:external/super_boost_with_cooldown");
var falcon_base = implement("fiskheroes:external/falcon_base");

function init(hero) {
    hero.setName("Hawkgirl");
    hero.setTier(4);

    hero.setChestplate("Suit");

    hero.addPowers("eden:thanagarian_physiology");
    hero.addAttribute("PUNCH_DAMAGE", 7.5, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 200, 0);
    hero.addAttribute("SPRINT_SPEED", 0.5, 1);
    hero.addAttribute("IMPACT_DAMAGE", 0.3, 1);

    hero.addKeyBind("BLADE", "Mace", 1);
    hero.addKeyBind("GROUND_SMASH", "Ground Smash", 4);
    hero.addKeyBind("SHIELD", "key.wingShield", 5);
    hero.addKeyBind("CHARGE_ENERGY", "Charge Lightning", 3);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.addAttributeProfile("BLADE", bladeProfile);

    super_boost = super_boost.create(200, 150, 20);
    falcon_base.init(hero, super_boost, 2, 0.25, (entity, manager) => {
        if (entity.getData("fiskheroes:shield")) {
            manager.setData(entity, "fiskheroes:flying", false);
        }
    });

}

function bladeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 10.0, 0);
}

function getProfile(entity) {
    return entity.getData("fiskheroes:blade") ? "BLADE" : null;
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
        case "fiskheroes:controlled_flight":
            return (entity.getData("fiskheroes:flight_timer") > 0 || !entity.getData("fiskheroes:shield")) && super_boost.isModifierEnabled(entity, modifier);
        case "fiskheroes:shield":
            return !(entity.isSprinting() && entity.getData("fiskheroes:flying"));
    default:
        return true;
    }
}
function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
            case "CHARGE_ENERGY":
                return entity.getData("fiskheroes:blade") 
            case "GROUND_SMASH":
                return entity.getData("fiskheroes:blade") 
    default:
            return true;
}
}
