function init(hero) {
    hero.setName("Hulk/Bruce Banner");
    hero.setTier(7);
    
    hero.setLeggings("Pants");

    hero.addPowers("tgheroes:gamma");
  
	hero.addKeyBindFunc("func_GIANT_MODE", giantModeKey, "Transformation", 5);
    hero.addKeyBind("GROUND_SMASH", "key.groundSmash", 2);
    	
    hero.setModifierEnabled(isModifierEnabled);
    hero.setTierOverride(getTierOverride);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.addAttributeProfile("GIANT_MODE", giantProfile);
    hero.setAttributeProfile(getAttributeProfile);
}

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 isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "func_GIANT_MODE":
        var timer = entity.getData("fiskheroes:dyn/giant_mode_timer");
        return timer == 0 || timer == 1;
	case "GROUND_SMASH":
        return entity.getData("fiskheroes:dyn/giant_mode");
    default:
        return true;
    }
}

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

function giantProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 16.0, 0);
    profile.addAttribute("JUMP_HEIGHT", 5.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 1.0, 1);
	profile.addAttribute("WEAPON_DAMAGE", 2.0, 0);
    profile.addAttribute("SPRINT_SPEED", 0.3, 1);
	profile.addAttribute("MAX_HEALTH", 4.0, 0);
}

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

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:leaping":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:water_breathing":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:potion_immunity":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:fire_immunity":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:regeneration":
        return entity.getData("fiskheroes:dyn/giant_mode");
	case "fiskheroes:projectile_immunity":
        return entity.getData("fiskheroes:dyn/giant_mode");
    case "fiskheroes:damage_immunity":
        return entity.getData("fiskheroes:dyn/giant_mode");
	default:
        return true;
    }
}