function init(hero) {
    hero.setName("Blue Lantern");
    hero.setTier(9);
    
    hero.setChestplate("Ring");
    
    hero.addPowers("tmfp:blue_lantern_ring");
    hero.addAttribute("PUNCH_DAMAGE", 8.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 8.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.5, 1);
    
    hero.addKeyBind("BLADE", "Sword", 1);
    hero.addKeyBind("HAMMER", "Hammer", 1);
    hero.addKeyBind("SHIELD", "Shield", 2);
    hero.addKeyBind("HOVER", "key.hover", 3);
    hero.addKeyBind("ENERGY_PROJECTION", "Heal Beam", 4);
    hero.addKeyBind("SUIT", "Active Armor", 5);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setHasProperty(hasProperty);
    hero.setTierOverride(getTierOverride);
    
    hero.addAttributeProfile("INACTIVE", inactiveProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);
    hero.addAttributeProfile("HAMMER", hammerProfile);
    hero.setAttributeProfile(getProfile);
    hero.setDamageProfile(getProfile);
    hero.addDamageProfile("BLADE", {
        "types": {
            "SHARP": 1.0,
            "ENERGY": 0.7
        }
    });
    
}

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

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

function bladeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 17.5, 0);
}
function hammerProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("BASE_SPEED", -0.2, 1);
    profile.addAttribute("PUNCH_DAMAGE", 20.5, 0);
    profile.addAttribute("SPRINT_SPEED", 0.01, 1);
}

function getProfile(entity) {
    if (!entity.getData("fiskheroes:dyn/nanites")) {
        return "INACTIVE";
    }
    else if (entity.getData("fiskheroes:dyn/steeled")) {
        return "HAMMER";
    }
    
    return entity.getData("fiskheroes:blade") ? "BLADE" : 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:blade":
        return !entity.getData("fiskheroes:aiming") && !entity.getData("fiskheroes:shield");
    case "fiskheroes:flight":
        return !entity.getData("fiskheroes:dyn/steel_timer");
    default:
        return true;
    }
}

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

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