function init(hero) {
    hero.setName("Sonic the Hedgehog");
    hero.setTier(3);
    
    hero.setHelmet("item.superhero_armor.piece.cowl");
    hero.setChestplate("item.superhero_armor.piece.chestpiece");
    hero.setLeggings("item.superhero_armor.piece.pants");
    hero.setBoots("item.superhero_armor.piece.boots");
    hero.addEquipment("fiskheroes:eternium_shard");
    
    hero.addPowers("tmfp:blue_hedgehog");
    hero.addAttribute("PUNCH_DAMAGE", 1.5, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 3.0, 0);
    hero.addAttribute("BASE_SPEED_LEVELS", 3.0, 0);

    hero.addKeyBind("SUPER_SPEED", "key.superSpeed", 1);
    hero.addKeyBind("SLOW_MOTION", "key.slowMotion", 2);
    hero.addKeyBind("SUPER", "Super Sonic", 5);
    
    hero.setDefaultScale(0.85);
    hero.addAttributeProfile("SUPER", superProfile);
    hero.addAttributeProfile("SPEED", speedProfile);
    hero.setAttributeProfile(getProfile);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setDamageProfile(getDamageProfile);
    hero.setTierOverride(getTierOverride);
    hero.addDamageProfile("SPEED_PUNCH", {
        "types": {
            "BLUNT": 1.0
        },
        "properties": {
            "HIT_COOLDOWN": 7
        }
    });
}

function getDamageProfile(entity) {
    return entity.getData("fiskheroes:speeding") ? "SPEED_PUNCH" : null;
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "SUPER":
        return entity.getHeldItem().name() == "fiskheroes:eternium_shard" || entity.getData("fiskheroes:dyn/steeled");
    case "SUPER_SPEED":
        return !entity.getData("fiskheroes:dyn/steeled");
    default:
        return true;
    }
}
function speedProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("FALL_RESISTANCE", 35.0, 0);
    profile.addAttribute("STEP_HEIGHT", 250.0, 0);
}
function superProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("PUNCH_DAMAGE", 15.5, 0);
    profile.addAttribute("JUMP_HEIGHT", 3.0, 0);
    profile.addAttribute("SPRINT_SPEED", 8.0, 1);
}

function getProfile(entity) {
    if (entity.getData("fiskheroes:dyn/steeled")) {
        return "SUPER";
    }
    
    return entity.isSneaking() && entity.getData("fiskheroes:speeding") ? "SPEED" : null;
}
function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:flight":
        return entity.getData("fiskheroes:dyn/steeled");
    case "fiskheroes:super_speed":
        return !entity.getData("fiskheroes:dyn/steeled");
    default:
        return true;
    }
}
function getTierOverride(entity) {
    return entity.getData("fiskheroes:dyn/steeled") ? 6 : 3;
}
