function init(hero) {
    hero.setName("Ghost Rider/\u00A76Robbie Reyes\u00A7f");
    hero.setVersion("\u00A73Agent's of Shield\u00A7r");
    hero.setTier(5);
    
    hero.setChestplate("Jacket");
    hero.setLeggings("Pants");
    hero.setBoots("Boots");

    hero.addPowers("ghr:elias_morrow", "ghr:rage");
    hero.setPrimaryEquipment("fiskheroes:ruptures_scythe");

    hero.addAttribute("PUNCH_DAMAGE", 5.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 0.30, 1);
    hero.addAttribute("SPRINT_SPEED", 0.15, 1);
    hero.addAttribute("JUMP_HEIGHT", 0.5, 0);
    
    hero.addKeyBind("AIM", "Beam of Hellfire", 1);
    hero.addKeyBind("BLADE", "Chains", 2);
    hero.addKeyBind("RAGE", "Rage Enhancement", 3);
    hero.addKeyBind("TELEPORT", "Chain Teleport", 4);
    hero.addKeyBind("STEEL_TRANSFORM", "Elias Morrow", 5);

    hero.addSoundEvent("MASK_OPEN", "fiskheroes:flame_off");
    hero.addSoundEvent("MASK_CLOSE", "ghr:skull_reyes_on");
    
    hero.setAttributeProfile(getAttributeProfile);
    hero.addAttributeProfile("STEEL", steelProfile);
    hero.addAttributeProfile("RAGE", rageProfile);
    hero.addAttributeProfile("BLADE", bladeProfile);

    hero.setTierOverride(getTierOverride);
    hero.setHasProperty(hasProperty);
    hero.supplyFunction("canAim", canAim);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setDamageProfile(getDamageProfile);
    hero.addDamageProfile("BLADE", {"types": {"BLUNT": 1.0},"properties": {"HEAT_TRANSFER": 40,"IGNITE": 2}});
    hero.addDamageProfile("FLAME_PUNCH", {"types": {"FIRE": 0.4},"properties": {"HEAT_TRANSFER": 40,"IGNITE": 2}});
}

function getDamageProfile(entity) {
    if (entity.getHeldItem().isEmpty() && entity.getData("ghr:dyn/rider") && !entity.getData("fiskheroes:mask_open")) {
        return "FLAME_PUNCH"
    } else if (entity.getHeldItem().isEmpty() && entity.getData("ghr:dyn/rider_timer") && entity.getData("fiskheroes:blade")) {
        return "BLADE";
    }
    return null
}

function canAim(entity) {
    return entity.getHeldItem().isEmpty();
}

function hasProperty(entity, property) {
    switch (property) {
        case "MASK_TOGGLE":
            return !entity.isAlive() || entity.getData("ghr:dyn/rider") == 1;
        case "BREATHE_SPACE":
            return !entity.getData("fiskheroes:mask_open") && entity.getData("ghr:dyn/rider");
        default:
            return false;
    }
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() == "fiskheroes:transformation") {
        return entity.getData("ghr:dyn/rider");
	}
	else if (modifier.name() == "fiskheroes:transformation") {
        return entity.getData("ghr:dyn/rage") && !entity.getData("fiskheroes:ghr:dyn/rider");
	}
	return true;
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
        case "AIM":
            return entity.getData("ghr:dyn/rider") && !entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:blade");
        case "TELEPORT":
            return entity.getData("ghr:dyn/rider") && entity.getData("fiskheroes:blade");
        case "BLADE":
            return entity.getData("ghr:dyn/rider") && !entity.getData("fiskheroes:aiming") && !entity.getData("fiskheroes:mask_open");    
        case "RAGE":
            return !entity.getData("ghr:dyn/rage") && entity.getData("ghr:dyn/rider") && !entity.getData("fiskheroes:aiming") && !entity.getData("fiskheroes:mask_open");;
            default:
            return true;
    }
}

function getTierOverride(entity) {
    return entity.getData("ghr:dyn/rider") ? 8 : 5;
}

function steelProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 9.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 0.90, 1);
    profile.addAttribute("SPRINT_SPEED", 0.40, 1);
    profile.addAttribute("JUMP_HEIGHT", 1.0, 0);
    profile.addAttribute("WEAPON_DAMAGE", -0.75, 1);
}

function rageProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 10.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 0.90, 1);
    profile.addAttribute("SPRINT_SPEED", 0.50, 1);
    profile.addAttribute("JUMP_HEIGHT", 1.5, 0);
    profile.addAttribute("MAX_HEALTH", 4.0, 0);
    profile.addAttribute("DAMAGE_REDUCTION", 0.088, 0);
    profile.addAttribute("WEAPON_DAMAGE", -0.75, 1);
}

function bladeProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 10.0, 0);
    profile.addAttribute("FALL_RESISTANCE", 0.90, 1);
    profile.addAttribute("SPRINT_SPEED", 0.45, 1);
    profile.addAttribute("JUMP_HEIGHT", 1.5, 0);
    profile.addAttribute("WEAPON_DAMAGE", -0.75, 1);
}

function getAttributeProfile(entity) {
    if (entity.getData("ghr:dyn/rider") && !entity.getData("fiskheroes:mask_open") && !entity.getData("fiskheroes:blade")) {
        return "STEEL";
    } else if (entity.getHeldItem().isEmpty() && entity.getData("ghr:dyn/rider") && entity.getData("fiskheroes:blade")) {
        return "BLADE";
    } else if (entity.getData("ghr:dyn/rage") && !entity.getData("fiskheroes:mask_open") && !entity.getData("fiskheroes:blade")) {
        return "RAGE";
    }
    return null
}

function getAttributeProfile(entity) {
    return entity.getData("ghr:dyn/rage") ? "RAGE" : "STEEL";
}

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