function init(hero) {
    hero.setName("Mrs Incredible");
    hero.setVersion ("Red");
    hero.setTier(5);

    hero.setHelmet("Mask");
    hero.setChestplate("Suit");
    hero.setLeggings("Pants");
    hero.setBoots("Shoes");

    hero.addPowers("soulhp:elongation", "soulhp:interchangable_tools", "soulhp:elastic_arms");
    hero.addAttribute("MAX_HEALTH", 5.0, 0);
    hero.addAttribute("PUNCH_DAMAGE", 5.25, 0);
    hero.addAttribute("SPRINT_SPEED", 1.0, 1);
    hero.addAttribute("KNOCKBACK", 2.0, 0);

    hero.addKeyBind("TENTACLE_JAB", "Jab", 1);    
    hero.addKeyBind("TENTACLES", "Toggle Elongation", 2);
    hero.addKeyBind("TENTACLE_GRAB", "Grab", 4);
    hero.addKeyBind("BLADE", "key.blade", 3);
    hero.addKeyBind("SHIELD", "key.shield", 3);
    //hero.addKeyBindFunc("func_GIANT_MODE", giantModeKey, "key.giantMode", 5);

    hero.addAttributeProfile("GIANT_MODE", giantProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.setAttributeProfile(getAttributeProfile);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
}

function giantModeKey(player, manager) {
    var flag = player.getData("fiskheroes:dyn/giant_mode");
    manager.setData(player, "fiskheroes:dyn/giant_mode", !flag);
    manager.setData(player, "fiskheroes:size_state", flag ? -1 : 1);
    return true;
}

function isKeyBindEnabled(entity, keyBind) {
    
        switch (keyBind) {
        case "SHIELD":
            return entity.getData("fiskheroes:blade_timer") == 0 || entity.isBookPlayer();
        case "BLADE":
            return entity.getData("fiskheroes:shield_timer") > 0 || entity.getData("fiskheroes:blade_timer") > 0 || entity.isBookPlayer();
        case "func_GIANT_MODE":
            return entity.getData("fiskheroes:size_state") == 0 && (entity.getData("fiskheroes:dyn/giant_mode") || entity.getData("fiskheroes:dyn/giant_mode_cooldown") == 0);
        case "TENTACLE_JAB":
            return entity.getData("fiskheroes:tentacles") != null;
        case "TENTACLE_GRAB":
            return entity.getData("fiskheroes:tentacles") != null;
        case "TENTACLES":
            return !entity.getData("fiskheroes:dyn/giant_mode");
        default:
            return true;
        }
}

function giantProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 9.25, 0);
    profile.addAttribute("JUMP_HEIGHT", 2.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 4.0, 0);
}

function bladeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 10.5, 0);
    profile.addAttribute("FALL_RESISTANCE", 9.5, 0);
}

function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:dyn/giant_mode_timer") > 0 ? "GIANT_MODE" : null;
}

function isModifierEnabled(entity, modifier) {
    return modifier.name() != "fiskheroes:size_manipulation" || (modifier.id() == "giant") == (entity.getData("fiskheroes:dyn/giant_mode_timer") > 0 || entity.getData("fiskheroes:dyn/giant_mode"));
}