function init(hero) {
    hero.setName("Vigilant CW");
    hero.setTier(2);
    
    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.addAbilities("fiskheroes:enhanced_reflexes", "fiskheroes:cellular_regeneration", "fiskheroes:energy_blast");
    hero.addAbilities("fiskheroes:utility_belt", "fiskheroes:gliding");
    hero.addAttribute("ATTACK_DAMAGE", 0.50, 1);
    hero.addAttribute("FALL_RESISTANCE", 0.60, 1);
    hero.addAttribute("PUNCH_DAMAGE", 5.22, 0);
    hero.addAttribute("SPRINT_SPEED", 0.3, 1);
    
    hero.addKeyBind("AIM", "Aim", 1);
    hero.addKeyBind("UTILITY_SWITCH", "key.utilitySwitch", 2);
    hero.addKeyBind("UTILITY_RESET", "key.utilityReset", 3);
    
    hero.setDefaultScale(0.99);
    hero.setRuleValueModifier(ruleModifier);
    hero.setModifierEnabled(isModifierEnabled);
    hero.supplyFunction("canAim", canAim);

    hero.setHasPermission(hasPermission);
}

function ruleModifier(entity, rule) {
    if (rule.name() == "fiskheroes:cooldown_energyblast") {
        return 7.0;
    }
    return null;
}

function isModifierEnabled(entity, modifier) {
	if (modifier == "fiskheroes:energy_blast") {
        return entity.getData("fiskheroes:aimed_timer") >= 1;
	}
	return true;
}

function canAim(entity) {
    return entity.getHeldItem().name() == "fiskheroes:rip_hunters_gun" || entity.getHeldItem().name() == "fiskheroes:chronos_rifle" || entity.getHeldItem().isEmpty();
}

function hasPermission(entity, permission) {
    return permission == "USE_GRAPPLING_GUN";
}