function init(hero) {
    hero.setName("Blue Beetle");
    hero.setTier(7);
    
    hero.setChestplate("Scarap");
    
    hero.addPowers("tmfp:blue_scarap");
    hero.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 8.0, 0);
    
    hero.addKeyBind("AIM", "Aim", 1);
    hero.addKeyBind("BLADE", "key.blade", 2);
    hero.addKeyBind("SHIELD", "Shield", 3);
    hero.addKeyBind("HOVER", "key.hover", 4);
    hero.addKeyBind("SONIC_WAVES", "key.canaryCry", 2);
    hero.addKeyBind("BB_TRANSFORM", "Active Armor", 5);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setHasProperty(hasProperty);
    hero.setTierOverride(getTierOverride);
    hero.supplyFunction("canAim", canAim);
    
    hero.addAttributeProfile("INACTIVE", inactiveProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.setAttributeProfile(getProfile);
    hero.setDamageProfile(getProfile);
    hero.addDamageProfile("BLADE", {
        "types": {
            "SHARP": 1.0,
            "ENERGY": 0.7
        }
    });
    
}

function getTierOverride(entity) {
    return entity.getData("fiskheroes:dyn/steeled") ? 7 : 0;
}

function inactiveProfile(profile) {
    profile.revokeAugments();
}

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

function getProfile(entity) {
    if (!entity.getData("fiskheroes:dyn/steeled")) {
        return "INACTIVE";
    }
    
    return entity.getData("fiskheroes:blade") ? "BLADE" : null;
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() != "fiskheroes:transformation" && modifier.name() != "fiskheroes:cooldown" && (!entity.getData("fiskheroes:dyn/steeled") || modifier.name() == "fiskheroes:propelled_flight" && entity.getData("fiskheroes:dyn/steel_timer") < 1)) {
        return false;
    }
  
    switch (modifier.name()) {
    case "fiskheroes:sonic_waves":
        return entity.getData("fiskheroes:aimed_timer") >= 1;
    case "fiskheroes:repulsor_blast":
        return entity.getData("fiskheroes:aimed_timer") >= 1;
    case "fiskheroes:blade":
        return !entity.getData("fiskheroes:aiming") && !entity.getData("fiskheroes:shield");
    case "fiskheroes:water_breathing":
        return !entity.getData("fiskheroes:mask_open") && entity.getData("fiskheroes:dyn/steeled");
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    if (keyBind == "BB_TRANSFORM") {
        return entity.getData("fiskheroes:mask_open_timer") == 0;
    }
    else if (!entity.getData("fiskheroes:dyn/steeled")) {
        return false;
    }
    
    switch (keyBind) {
    case "SHIELD":
        return !entity.getData("fiskheroes:blade") && !entity.getData("fiskheroes:aiming");
    case "BLADE":
        return !entity.getData("fiskheroes:shield") && !entity.getData("fiskheroes:aiming");
    default:
        return true;
    }
}

function hasProperty(entity, property) {
    switch (property) {
    case "MASK_TOGGLE":
        return entity.getData("fiskheroes:dyn/steel_timer") == 1;
    case "BREATHE_SPACE":
        return !entity.getData("fiskheroes:mask_open") && entity.getData("fiskheroes:dyn/steeled");
    default:
        return false;
    }
}

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