var utils = implement("fiskheroes:external/utils");
var landing = implement("pkg:external/superhero_landing_1");

function init(hero) {
    hero.setName("Lex Luthor");
    hero.setTier(4);

    hero.setChestplate("item.superhero_armor.piece.chestpiece");

    hero.addPowers("pkg:lex_corps")
    hero.addAttribute("PUNCH_DAMAGE", 5.5, 0);
    hero.addAttribute("SPRINT_SPEED", 0.25, 1);
    hero.addAttribute("JUMP_HEIGHT", 1.0, 0);
    hero.addAttribute("FALL_RESISTANCE", 1.0, 1);
    hero.addAttribute("BASE_SPEED_LEVELS", 3.0, 0);

    hero.addKeyBind("AIM", "key.aim", -1);
    hero.addKeyBind("SHIELD", "key.shield", 2);
    hero.addKeyBind("ENERGY_PROJECTION", "Beam", 3);
    hero.addKeyBind("SENTRY_MODE", "key.sentryMode", 4);

    hero.setDefaultScale(1.2);
    hero.setHasProperty(hasProperty);


    hero.setTickHandler((entity, manager) => {
        landing.tick(entity, manager);
        manager.incrementData(entity, "fiskheroes:dyn/booster_timer", 2, entity.getData("fiskheroes:flying"));
        if (!entity.isSneaking() && !entity.isOnGround() && entity.motionY() < -0.8) {
            manager.setData(entity, "fiskheroes:flying", true);
        }
    });
}

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

