function init(hero) {
    hero.setName("black_panther/UCM");
    hero.setAliases("bp");
    hero.setTier(7);
    
    hero.setChestplate("necklace");
    
    hero.addPowers("cwheropack:wakanda_physiology");
    hero.addAttribute("PUNCH_DAMAGE", 7.0, 0);
    hero.addAttribute("WEAPON_DAMAGE", 2.5, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 1.0, 1);
    hero.addAttribute("SPRINT_SPEED", 0.45, 1);
    hero.addAttribute("STEP_HEIGHT", 0.5, 0);

    hero.addKeyBind("BLADE", "key.claws", 1);
    hero.addKeyBind("NANITE_TRANSFORM", "key.naniteTransform", 5);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setHasProperty(hasProperty);
    hero.setTierOverride(getTierOverride);
    
    hero.addAttributeProfile("CLAWS", clawsProfile);
    hero.addDamageProfile("CLAWS", {"types": {"SHARP": 1.0}});
    hero.setAttributeProfile(getProfile);
    hero.setDamageProfile(getProfile);
    
    hero.addSoundEvent("MASK_OPEN", "fiskheroes:mk50_mask_open");
    hero.addSoundEvent("MASK_CLOSE", "fiskheroes:mk50_mask_close");
}

function getTierOverride(entity) {
    return entity.getData("fiskheroes:dyn/nanites") ? 8 : 0;
}
function clawsProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 10.5, 0);
}

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

function isModifierEnabled(entity, modifier) {
    if (modifier.name() != "fiskheroes:transformation" && modifier.name() != "fiskheroes:cooldown" && (!entity.getData("fiskheroes:dyn/nanites") || modifier.name() == "fiskheroes:propelled_flight" && entity.getData("fiskheroes:dyn/nanite_timer") < 1)) {
        return false;
    }
  
    switch (modifier.name()) {
    case "fiskheroes:regeneration":
        return !entity.getData("fiskheroes:blade");
    case "fiskheroes:water_breathing":
        return !entity.getData("fiskheroes:mask_open") && entity.getData("fiskheroes:dyn/nanites");
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    if (keyBind == "NANITE_TRANSFORM") {
        return entity.getData("fiskheroes:mask_open_timer") == 0;
    }
    else if (!entity.getData("fiskheroes:dyn/nanites")) {
        return false;
    }
    
    switch (keyBind) {
    case "SHIELD":
        return entity.getData("fiskheroes:blade_timer") == 0 || entity.isBookPlayer();
    case "CLAWS":
        return entity.getData("fiskheroes:shield_timer") > 0 || entity.getData("fiskheroes:blade_timer") > 0 || entity.isBookPlayer();
    default:
        return true;
    }
}

function hasProperty(entity, property) {
    switch (property) {
    case "MASK_TOGGLE":
        return entity.getData("fiskheroes:dyn/nanite_timer") == 1;
    default:
        return false;
    }
}
