function init(hero) {
    hero.setName("Blue Lantern");
    hero.setVersion("\u00A7l\u00A7o\u00A74Skarred \u00A7r\u00A7l\u00A76Heroes\u00A7r");
    hero.setTier(5);

    hero.setChestplate("Power Ring");


    hero.addPowers("sfiskpack:hard_light_constructs", "sfiskpack:hope_empowerment");
    hero.addAttribute("PUNCH_DAMAGE", 8.5, 0);
    hero.addAttribute("WEAPON_DAMAGE", 1.5, 0);
    hero.addAttribute("FALL_RESISTANCE", 8.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.1, 1);

    hero.addKeyBind("AIM", "Toggle Ranged Construct", 1);
    hero.addKeyBind("BLADE", "Toggle Melee Construct", 2);
    hero.addKeyBind("SHIELD", "Toggle Shield Construct", 2);
    hero.addKeyBind("TRANSFORM", "Suit Materialization", 5);

    hero.addAttributeProfile("INACTIVE", inactiveProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setHasProperty(hasProperty);
    hero.setTierOverride(getTierOverride);
    hero.supplyFunction("canAim", canAim);
}

function getTierOverride(entity) {
    return entity.getData("sfiskpack:dyn/lantern") ? 5 : 0;
}

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

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

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

function isModifierEnabled(entity, modifier) {
    if (modifier.name() != "fiskheroes:transformation" && modifier.name() != "fiskheroes:cooldown" && (!entity.getData("sfiskpack:dyn/lantern") || modifier.name() == "fiskheroes:propelled_flight" && entity.getData("sfiskpack:dyn/lantern_timer") < 1)) {
        return false;
    }
  
    switch (modifier.name()) {
    case "fiskheroes:energy_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("sfiskpack:dyn/lantern");
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    if (keyBind == "TRANSFORM") {
        return entity.getData("fiskheroes:mask_open_timer") == 0;
    }
    else if (!entity.getData("sfiskpack:dyn/lantern")) {
        return false;
    }
    
    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();
    default:
        return true;
    }
}

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

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