function init(hero) {
    hero.setName("Ghost Rider/Agents of SHIELD");
    hero.setTier(9);
    
    hero.setChestplate("item.superhero_armor.piece.jacket");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.shoes");
    
    hero.addPowers("tmfp:spirit_of_vengeance");
    hero.addAttribute("PUNCH_DAMAGE", 12.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 2.0, 0);
    hero.addAttribute("SPRINT_SPEED", 0.5, 1);
    hero.addAttribute("FALL_RESISTANCE", 15.0, 0);
    
    hero.addKeyBind("AIM", "key.shoot", 1);
    hero.addKeyBind("CHARGED_BEAM", "key.heatVision", 2);
    hero.addKeyBind("GHOST_RIDER", "Awake the Spirit Of Vengeance", 5);
    
    hero.setModifierEnabled(isModifierEnabled);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setTierOverride(getTierOverride);
    hero.supplyFunction("canAim", canAim);
    
    hero.addAttributeProfile("INACTIVE", inactiveProfile);
    hero.setAttributeProfile(getProfile);
}

function getTierOverride(entity) {
    return entity.getData("tmfp:dyn/ghost_rider") ? 9 : 0;
}

function inactiveProfile(profile) {
    profile.revokeAugments();
}

function getProfile(entity) {
    if (!entity.getData("tmfp:dyn/ghost_rider")) {
        return "INACTIVE";
    }
    return false;
}

function isModifierEnabled(entity, modifier) {
    if (modifier.name() != "fiskheroes:transformation" && modifier.name() != "fiskheroes:cooldown" && (!entity.getData("tmfp:dyn/ghost_rider") || modifier.name() == "fiskheroes:propelled_flight" && entity.getData("tmfp:dyn/ghost_rider_timer") < 1)) {
        return false;
    }
  
    switch (modifier.name()) {
    case "fiskheroes:sonic_waves":
        return entity.getData("fiskheroes:aimed_timer") >= 1;
    default:
        return true;
    }
}

function isKeyBindEnabled(entity, keyBind) {
    if (keyBind == "GHOST_RIDER") {
        return entity.getData("fiskheroes:mask_open_timer") == 0;
    }
    else if (!entity.getData("tmfp:dyn/ghost_rider")) {
        return false;
    }
    
    switch (keyBind) {
    case "SHIELD":
        return entity.isSneaking() || entity.isBookPlayer();
    case "BLADE":
        return !entity.isSneaking() && !entity.getData("fiskheroes:shield");
    default:
        return true;
    }
}
function canAim(entity) {
    return entity.getHeldItem().isEmpty() && entity.getData("tmfp:dyn/ghost_rider");
}
