function init(hero) {
    hero.setName("Knight of Ventus");
	hero.setVersion("Duvain");
    hero.setTier(4);
    
    hero.setHelmet("item.superhero_armor.piece.helmet");
	hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");
    
    hero.addAbilities("fiskheroes:fire_immunity", "fiskheroes:heat_resistance", "fiskheroes:flight", "fiskheroes:steel_transformation", "fiskheroes:energy_projection", "fiskheroes:superhuman_durability", "fiskheroes:intangibility");
	hero.addAttribute("MAX_HEALTH", 2, 0);
	hero.addAttribute("ATTACK_DAMAGE", 0.65, 1);
	hero.addAttribute("PUNCH_DAMAGE", 7.5, 0);
    hero.addAttribute("SWORD_DAMAGE", -0.3, 1);
	hero.addAttribute("SPRINT_SPEED", 0.4, 1);
	hero.addAttribute("STEP_HEIGHT", 0.5, 0);
	
	hero.addKeyBind("ENERGY_PROJECTION", "key.energyProjection", 1);
	hero.addKeyBind("AIM", "Energy Projection", 1);
	hero.addKeyBind("INTANGIBILITY", "key.intangibility", 2);
	hero.addKeyBind("STEEL_TRANSFORM", "Overcharge", 3);
	hero.addKeyBind("TRANSFORM", "Energize Suit", 5);
	
	hero.setHasProperty(hasProperty);
	hero.setModifierEnabled(isModifierEnabled);
	hero.addAttributeProfile("STEEL", steelProfile);
    hero.setAttributeProfile(getAttributeProfile);
	hero.supplyFunction("canAim", canAim);
	hero.supplyFunction("getTransformTimerTicks", 2600);
    hero.supplyFunction("getTransformTimerRegen", 4.0);
	hero.setKeyBindEnabled(isKeyBindEnabled);
}

function hasProperty(entity, property) {
    switch (property) {
    case "MASK_TOGGLE":
        return !entity.isAlive() || entity.getData("fiskheroes:transform_timer") == 1;
    case "BREATHE_UNDERWATER":
        return entity.getData("fiskheroes:mask_open");
    case "BREATHE_SPACE":
        return entity.getData("fiskheroes:mask_open");
    default:
        return false;
    }
}
// This is just Duvain saying hello :)
function isModifierEnabled(entity, modifier) {
	if (modifier == "fiskheroes:intangibility" || modifier == "fiskheroes:superhuman_durability") {
		return entity.getData("fiskheroes:mask_open") && entity.getData("fiskheroes:transformed");
	}
	else if (modifier == "fiskheroes:steel_transformation" || modifier == "fiskheroes:flight") {
		return entity.getData("fiskheroes:transformed");
	}
	else if (modifier == "fiskheroes:energy_projection") {
		return entity.getData("fiskheroes:aiming");
	}
	else if (modifier == "fiskheroes:fire_immunity") {
		return entity.getData("fiskheroes:steeled");
	}
	return true;
}

function steelProfile(profile) {
    profile.addAttribute("MAX_HEALTH", 6, 0);
	profile.addAttribute("ATTACK_DAMAGE", 0.85, 1);
	profile.addAttribute("PUNCH_DAMAGE", 9.5, 0);
	profile.addAttribute("KNOCKBACK", 0.5, 1);
    profile.addAttribute("SWORD_DAMAGE", -0.4, 1);
	profile.addAttribute("SPRINT_SPEED", 0.3, 1);
}

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

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

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "TRANSFORM":
        return entity.getData("fiskheroes:mask_open_timer") == 0;
    default:
        return entity.getData("fiskheroes:transformed");
    }
}