function init(hero) {
    hero.setName("Groot");
    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("fiskheroes:cellular_regeneration", "fiskheroes:retractable_shield", "pack:treeembiggen", "pack:treedensity");
       hero.addAttribute("WEAPON_DAMAGE", 9, 0);
    hero.addAttribute("FALL_RESISTANCE", 100.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 0.5, 0);
    hero.addAttribute("PUNCH_DAMAGE", 15, 0);
    hero.addAttribute("SPRINT_SPEED", -0.1, 1);
    
   hero.addKeyBind("STEEL_TRANSFORM", "Tree Spike Hands", 1); 
    hero.addKeyBind("SHIELD", "Bark Shield", 3);
    hero.addKeyBindFunc("func_GIANT_MODE", giantModeKey, "Growth Form", 2);
    
			 hero.setDefaultScale(1.25);
	
	
	
    hero.addAttributeProfile("GIANT_MODE", giantProfile);
	
    hero.setAttributeProfile(getAttributeProfile);
    hero.addAttributeProfile("STEEL", steelProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setTierOverride(getTierOverride);
	

}

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 getTierOverride(entity) {
    return entity.getData("fiskheroes:dyn/giant_mode") ? 8 : 6;
}

function giantProfile(profile) {
    profile.addAttribute("FALL_RESISTANCE", 100.0, 0);
    profile.addAttribute("JUMP_HEIGHT", -1.5, 0);
    profile.addAttribute("PUNCH_DAMAGE", 19, 0);
    profile.addAttribute("SPRINT_SPEED", -0.5, 1);
	profile.addAttribute("REACH_DISTANCE", 5.0, 0);
}

function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:dyn/giant_mode_timer") > 0 ? "GIANT_MODE" : null;
}

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

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;
    }
}

function steelProfile(profile) {
  profile.addAttribute("FALL_RESISTANCE", 100.0, 0);
    profile.addAttribute("JUMP_HEIGHT", -1.5, 0);
    profile.addAttribute("PUNCH_DAMAGE", 20.5, 0);
    profile.addAttribute("SPRINT_SPEED", -0.5, 1);
	profile.addAttribute("REACH_DISTANCE", 5.0, 0);
}

function getAttributeProfile(entity) {
    return entity.getData("fiskheroes:dyn/steeled") ? "STEEL" : null;
}

function isModifierEnabled(entity, modifier) {
    return modifier.name() == "fiskheroes:transformation" || modifier.name() == "fiskheroes:cooldown" || entity.getData("fiskheroes:dyn/steeled")|| modifier != "fiskheroes:metal_skin";
}
