function init(hero) {
    hero.setName("Daredevil");
    hero.setTier(6);
    
    hero.setHelmet("Helmet");
    hero.setChestplate("Chestpiece");
    hero.setLeggings("Pants");
    hero.setBoots("Boots");
    
    hero.addPowers("dlheroes:heightened_senses");
    hero.addAttribute("PUNCH_DAMAGE", 6.5, 0);
    hero.addAttribute("WEAPON_DAMAGE", 3.5, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.5, 0);
    hero.addAttribute("FALL_RESISTANCE", 12.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.3, 1);
    hero.addAttribute("STEP_HEIGHT", 0.5, 0);
    hero.addAttribute("IMPACT_DAMAGE", 0.5, 1);

    hero.addKeyBind("BATON", "Billy Clubs", 1); 
    hero.addKeyBind("STICK", "Baton", 5); 
    hero.addKeyBind("WEB_ZIP", "Billy Clubs Zip", 2);
    hero.addKeyBindFunc("func_WEB_SWINGING", webSwingingKey, "Billy Clubs Swinging", 3);
    hero.addKeyBind("SLOW_MOTION", "Heightened Senses", 4);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.addAttributeProfile("BATON", batonProfile);
    hero.addAttributeProfile("STICK", stickProfile);
    hero.setAttributeProfile(getAttributeProfile);
}

function batonProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 7.5, 0);
}
function stickProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 8.5, 0);
    profile.addAttribute("REACH_DISTANCE", 0.5, 0);
}

function webSwingingKey(player, manager) {
    var flag = player.getData("fiskheroes:web_swinging");
    manager.setDataWithNotify(player, "fiskheroes:web_swinging", !flag);
    return true;
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:web_swinging":
        return entity.getHeldItem().isEmpty() && entity.getData("dlheroes:dyn/baton");
    case "fiskheroes:web_zip":
        return entity.getHeldItem().isEmpty() && entity.getData("dlheroes:dyn/baton");
    case "fiskheroes:leaping":
        return modifier.id() == "springboard" == (entity.getData("fiskheroes:ticks_since_swinging") < 5);
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "STICK":
        return entity.getHeldItem().isEmpty() && !entity.getData("dlheroes:dyn/baton");
    case "BATON":
        return entity.getHeldItem().isEmpty() && !entity.getData("dlheroes:dyn/stick");
    case "func_WEB_SWINGING":
        return entity.getHeldItem().isEmpty() && entity.getData("dlheroes:dyn/baton");
    case "WEB_ZIP":
        return entity.getHeldItem().isEmpty() && entity.getData("dlheroes:dyn/baton");
    default:
        return true;
    }
}

function getAttributeProfile(entity) {
    if (entity.getData("dlheroes:dyn/stick")) {
        return "STICK";
    }
    else if (entity.getData("dlheroes:dyn/baton")) {
        return "BATON";
    }
    return true;
}
