function init(hero) {
    hero.setName("Iron Man/\u00A75model 51\u00A75");
	hero.setVersion("\u00A74Iron \u00A76Maniac\u00A7r");
    hero.setTier(4);
    hero.hide();
	
    hero.setHelmet("item.superhero_armor.piece.helmet");
    hero.setChestplate("item.superhero_armor.piece.chestplate");
    hero.setLeggings("item.superhero_armor.piece.leggings");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addPowers("ironmaniac:iron_man_model_51");
    hero.addAttribute("PUNCH_DAMAGE", 8.0, 0);
	hero.addAttribute("WEAPON_DAMAGE", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 8.0, 0);
    
    hero.addKeyBind("AIM", "key.aim", 1);
    hero.addKeyBind("HOVER", "key.hover", 2);	
    hero.addKeyBindFunc("func_GIANT_MODE", giantModeKey, "key.giantMode", 3);
	hero.addKeyBind("CHARGED_BEAM", "Unibeam", 4);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setHasProperty(hasProperty);
    hero.supplyFunction("canAim", canAim);
}

function isModifierEnabled(entity, modifier) {
    return modifier.name() != "fiskheroes:water_breathing" || !entity.getData("fiskheroes:mask_open");
}

function hasProperty(entity, property) {
    return property == "MASK_TOGGLE" || property == "BREATHE_SPACE" && !entity.getData("fiskheroes:mask_open");
}

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

//----

function giantModeKey(player, manager) {
    var flag = player.getData("fiskheroes:dyn/giant_mode");
    manager.setData(player, "fiskheroes:dyn/giant_mode", !flag);
    manager.setData(player, "fiskheroes:size_state", flag ? -1 : 1);
    return true;
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() == "fiskheroes:size_manipulation") {
        var giant = entity.getData("fiskheroes:dyn/giant_mode_timer") > 0;
        return modifier.id() == "giant" ? giant : !giant;
    }
    return true;
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "func_GIANT_MODE":
        return entity.getData("fiskheroes:size_state") == 0 && (entity.getData("fiskheroes:dyn/giant_mode") || entity.getData("fiskheroes:dyn/giant_mode_cooldown") == 0);
    case "SIZE_MANIPULATION":
        return !entity.getData("fiskheroes:dyn/giant_mode");
    default:
        return true;
    }
}
