function init(hero) {
    hero.setName("Magneto");
    hero.setTier(8);
    
    hero.setHelmet("item.superhero_armor.piece.mask");
    hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addPowers("soulhp:magnetic_physiology", "soulhp:new_flight");
    hero.addAttribute("IMPACT_DAMAGE", 0.5, 1);
    hero.addAttribute("FALL_RESISTANCE", 20.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.5, 0);
    hero.addAttribute("PUNCH_DAMAGE", 7.0, 0);
    hero.addAttribute("SPRINT_SPEED", 1.0, 1);
	
    hero.addKeyBind("TELEPORT", "key.teleport", 2);
    hero.addKeyBind("TELEKINESIS", "key.telekinesis", 3);
    hero.addKeyBind("SHIELD", "key.forcefield", 4);

    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.addAttributeProfile("SHIELD", shieldProfile);
    hero.addAttributeProfile("EMPOWERMENT", empowermentProfile);
    hero.setAttributeProfile(getAttributeProfile)
}



function hasProperty(entity, property) {
    return property == "BREATHE_SPACE";
}


function isKeyBindEnabled(entity, keyBind) {

   
   
    switch (keyBind) {
        case "TELEKINESIS":
            return entity.getHeldItem().name() == "minecraft:iron_ingot" || entity.getHeldItem().name() == "minecraft:gold_ingot"
        default:
            return true;
        }
}

function shieldProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("BASE_SPEED", -0.75, 1);
    profile.addAttribute("JUMP_HEIGHT", -2.0, 1);

}



function empowermentProfile(profile) {

    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 12.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 4.0, 0);
    profile.addAttribute("DAMAGE_REDUCTION", 8.0, 0);

}

function getAttributeProfile(entity) {
    if (entity.getData("fiskheroes:shield_blocking")) {
        return "SHIELD";
    }
    else if (entity.getHeldItem().name() == "minecraft:iron_ingot" || entity.getHeldItem().name() == "minecraft:gold_ingot")  {
        return "EMPOWERMENT";
    }
    return null;
}