function init(hero) {
    hero.setName("Blue Beetle");
    hero.setVersion("\u00A76\u00A7lYoung \u00A7c\u00A7lJustice\u00A7r");
    hero.setTier(8);
    
    hero.setChestplate("Scarab");
    
    hero.addPowers("ahhp:scarab");
    hero.addAttribute("PUNCH_DAMAGE", 2.5, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 2.5, 0);
    hero.addAttribute("SPRINT_SPEED", 0.1, 1);
    hero.addAttribute("IMPACT_DAMAGE", 0.1, 1);
    
    hero.addKeyBind("AIM", "key.aim", 1);
    hero.addKeyBind("BEETLE_BLADE", "Beetle Blade", 2);
    hero.addKeyBind("SHIELD", "Beetle Shield", 3);
    hero.addKeyBind("CHARGED_BEAM", "Scarab Blast", 4);
    hero.addKeyBind("SCARAB_TRANSFORM", "Transform", 5);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.addAttributeProfile("STEEL", steelProfile);
    hero.addAttributeProfile("BEETLEBLADE", beetlebladeProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setTierOverride(getTierOverride);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setHasProperty(hasProperty);
    hero.supplyFunction("canAim", canAim);

    hero.addSoundEvent("AIM_START", ["ahhp:blue_beetle_cannon_enable", "fiskheroes:mk50_cannon_static"]);
    hero.addSoundEvent("AIM_STOP", "ahhp:blue_beetle_cannon_disable");
}

function hasProperty(entity, property) {
    switch (property) {
    case "BREATHE_SPACE":
        return entity.getData("ahhp:dyn/scarab");
    default:
        return false;
    }
}

function canAim(entity) {
    return entity.getHeldItem().isEmpty() && entity.getData("ahhp:dyn/scarab") && !entity.getData("fiskheroes:shield") && !entity.getData("ahhp:dyn/beetleblade");
}

function getTierOverride(entity) {
    return entity.getData("ahhp:dyn/scarab") ? 4 : 3;
}

function steelProfile(profile) {
    profile.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 1.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 8.5, 0);
    profile.addAttribute("SPRINT_SPEED", 0.25, 1);
    profile.addAttribute("IMPACT_DAMAGE", 0.3, 1);
}

function beetlebladeProfile(profile) {
    profile.addAttribute("PUNCH_DAMAGE", 11.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 1.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 8.5, 0);
    profile.addAttribute("SPRINT_SPEED", 0.25, 1);
    profile.addAttribute("IMPACT_DAMAGE", 0.5, 1);
}

function getAttributeProfile(entity) {
    return entity.getData("ahhp:dyn/scarab") ? "STEEL" : null;
    return entity.getData("ahhp:dyn/beetleblade") ? "BEETLEBLADE" : null;
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() != "fiskheroes:transformation" && (!entity.getData("ahhp:dyn/scarab") || modifier.name() == "fiskheroes:gliding" && entity.getData("ahhp:dyn/scarab_timer") < 1)) {
        return false;
    }
  
    switch (modifier.name()) {
    case "fiskheroes:energy_blast":
        return entity.getData("fiskheroes:aimed_timer") >= 1;
    case "ahhp:dyn/beetleblade":
        return entity.getData("ahhp:dyn/scarab") && !entity.getData("fiskheroes:aiming") && !entity.getData("fiskheroes:shield");
    case "fiskheroes:shield":
        return !entity.getData("fiskheroes:aiming") && !entity.getData("ahhp:dyn/beetleblade");
    case "fiskheroes:regeneration":
        return !entity.getData("ahhp:dyn/beetleblade");
    case "fiskheroes:water_breathing":
        return entity.getData("ahhp:dyn/scarab");
    case "fiskheroes:charged_beam":
        return entity.getData("ahhp:dyn/scarab");
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
        case "CHARGED_BEAM":
            return (entity.getData("ahhp:dyn/scarab"));
        case "BEETLE_BLADE":
            return (entity.getData("ahhp:dyn/scarab"));
        case "SHIELD":
            return (entity.getData("ahhp:dyn/scarab")) && (!entity.getData("ahhp:dyn/beetleblade"));
        case "AIM":
            return (entity.getData("ahhp:dyn/scarab")) && (!entity.getData("fiskheroes:shield")) && (!entity.getData("ahhp:dyn/beetleblade"));
        default:
            return true;
    }
}