function init(hero) {
    hero.setName("Godspeed");
    hero.setAliases("godspeed");
    hero.setTier(5);

    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:flash_ring");

    hero.addPowers("fiskheroes:speed_force", "secretheroes:velocity_serum_godspeed");
    hero.addAttribute("PUNCH_DAMAGE", 4.5, 0);
    hero.addAttribute("WEAPON_DAMAGE", 1.0, 0);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 4.0, 0);
    hero.addAttribute("BASE_SPEED_LEVELS", 6.0, 0);

    hero.addKeyBind("SUPER_SPEED", "key.superSpeed", 1);
    hero.addKeyBind("SLOW_MOTION", "key.slowMotion", 2);
    hero.addKeyBind("SONIC_WAVES", "Vibrational Sonics", 3);
    hero.addKeyBind("GODSPEED_POWER", "Godly Display", 5);

    hero.addAttributeProfile("GODSPEED_POWER", godspeed_powerProfile);
    hero.setAttributeProfile(getAttributeProfile);
    hero.setKeyBindEnabled(isKeyBindEnabled);
    hero.setModifierEnabled(isModifierEnabled);
    hero.setHasProperty(hasProperty);

    hero.setDamageProfile(getDamageProfile);
    hero.addDamageProfile("SPEED_PUNCH", {
        "types": {
            "BLUNT": 1.0
        },
        "properties": {
            "HIT_COOLDOWN": 5
        }
    });
}

function godspeed_powerProfile(profile) {
    profile.inheritDefaults();
    profile.addAttribute("JUMP_HEIGHT", -100.0, 0);
    profile.addAttribute("SPRINT_SPEED", -1.0, 1);
}

function getAttributeProfile(entity) {
    return entity.getData("secretheroes:dyn/godspeed_power") ? "GODSPEED_POWER" : null;
}

function isKeyBindEnabled(entity, keyBind) {
    switch (keyBind) {
    case "SUPER_SPEED":
        return !entity.getData("secretheroes:dyn/godspeed_power") && !entity.getData("fiskheroes:sonic_waves");
    case "SONIC_WAVES":
        return !entity.getData("secretheroes:dyn/godspeed_power");
    case "SLOW_MOTION":
        return !entity.getData("secretheroes:dyn/godspeed_power");
    case "GODSPEED_POWER":
        return !entity.getData("secretheroes:dyn/godspeed_cooldown") || entity.getData("secretheroes:dyn/godspeed_power");
    default:
        return true;
    }
}

function isModifierEnabled(entity, modifier) {
    switch (modifier.name()) {
    case "fiskheroes:super_speed":
        return !entity.getData("secretheroes:dyn/godspeed_power") && !entity.getData("fiskheroes:sonic_waves");
    case "fiskheroes:sonic_waves":
        return !entity.getData("secretheroes:dyn/godspeed_power") && entity.getData('fiskheroes:time_since_damaged') > 20;
    case "fiskheroes:slow_motion":
        return !entity.getData("secretheroes:dyn/godspeed_power");
    default:
        return true;
    }
}

function hasProperty(entity, property) {
    return property == "MASK_TOGGLE";
}

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