function init(hero) {
    hero.setName("Sub-Zero");
    hero.setVersion("Injustice 2");
    hero.setTier(6);
    
    hero.setHelmet("item.superhero_armor.piece.mask");
    hero.setChestplate("item.superhero_armor.piece.jacket");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addPowers("tmfp:sub_zero");
    hero.addAttribute("FALL_RESISTANCE", 13.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.0, 0);
    hero.addAttribute("PUNCH_DAMAGE", 4.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.25, 1);
    hero.addAttribute("STEP_HEIGHT", 0.5, 0);
    
    hero.addKeyBind("CHARGE_ICE", "Charge Ice", 1);
    hero.addKeyBind("SHIELD", "Ice Sword", 2);
    hero.addKeyBind("BLADE", "Hammer", 3);
    hero.addKeyBind("TELEPORT", "Teleportation", 5);

    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);

    hero.addAttributeProfile("SHIELD", shieldProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setDamageProfile(getDamageProfile);
    hero.addDamageProfile("SHIELD", {
        "types": {
            "SHARP": 1.0,
            "COLD": 0.6
        }
    });
    hero.addDamageProfile("ICE_PUNCH", {
        "types": {
            "BLUNT": 1.0,
            "COLD": 0.2
        }
    });
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "CHARGE_ICE":
        return entity.getHeldItem().isEmpty();
    case "SHIELD":
        return !entity.getData("fiskheroes:blade") && entity.getData("fiskheroes:cryo_charge") == 1;
    case "BLADE":
        return !entity.getData("fiskheroes:shield") && entity.getData("fiskheroes:cryo_charge") == 1;
    case "SPELL_MENU":
        return entity.getData("fiskheroes:cryo_charge") == 1;
    case "TELEPORT":
        return entity.getData("fiskheroes:cryo_charge") == 1;
    default:
        return true;
    }
}


function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:cryoball":
        return entity.getData("fiskheroes:cryo_charge")  > 0;
    case "fiskheroes:blade":
        return entity.getData("fiskheroes:cryo_charge") > 0;
    case "fiskheroes:shield":
        return entity.getData("fiskheroes:cryo_charge") > 0;
    case "fiskheroes:damage_bonus":
        return modifier.id() == "blade" == (entity.getData("fiskheroes:blade"));
    case "fiskheroes:damage_bonus":
        return modifier.id() == "hand" == (!entity.getData("fiskheroes:blade"));
    default:
        return true;
    }
}
function shieldProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 14.0, 0);
}
function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:shield") ? "SHIELD" : null;
}
function getDamageProfile(entity) {
    if (entity.getData("fiskheroes:cryo_charge")) {
        return "ICE_PUNCH";
    }
    return entity.getData("fiskheroes:shield") ? "SHIELD" : null;
}
