extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "soulhp:black_adam_layer1",
    "layer2": "soulhp:black_adam_layer2",
    "lights": "soulhp:black_adam_lights",
});

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


function init(renderer) {
    parent.init(renderer);
    renderer.setLights((entity, renderLayer) => renderLayer == "CHESTPLATE" ? "lights" : null);

    renderer.showModel("CHESTPLATE", "head", "headwear", "body", "rightArm", "leftArm");
    renderer.fixHatLayer("CHESTPLATE");
}

function initEffects(renderer) {


    utils.bindTrail(renderer, "soulhp:blackadam");
    utils.bindBeam(renderer, "fiskheroes:lightning_cast", "fiskheroes:lightning_cast", "rightArm", 0xFFF56D, [
        { "firstPerson": [-8.0, 4.5, -10.0], "offset": [-0.5, 9.0, 0.0], "size": [0.75, 0.75] }
    ]);


renderer.setItemIcons("%s_0", "%s_1", "%s_2", "%s_3");
renderer.showModel("HELMET", "head", "headwear");
renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm");
renderer.showModel("LEGGINGS", "rightLeg", "leftLeg");
renderer.showModel("BOOTS", "rightLeg", "leftLeg");

utils.bindParticles(renderer, "fiskheroes:impact_antimatter").setCondition(entity => entity.getData("fiskheroes:flight_boost_timer") == 0.5);

}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    addAnimation(renderer, "iron_man.FLIGHT", "soulhp:blackadamflight")
        .setData((entity, data) => {
            data.load(0, entity.getInterpolatedData("fiskheroes:flight_timer") * (1 - entity.getInterpolatedData("fiskheroes:dyn/superhero_landing_timer")));
            data.load(1, entity.getInterpolatedData("fiskheroes:flight_boost_timer"));
        })
        .priority = -10;
    
    addAnimationWithData(renderer, "iron_man.LAND", "soulhp:supermanland", "fiskheroes:dyn/superhero_landing_timer")
        .priority = -8;
    
    renderer.reprioritizeDefaultAnimation("PUNCH", -9);
    renderer.reprioritizeDefaultAnimation("AIM_BOW", -9);
}
