extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "soulhp:lucifer_layer1",
    "layer2": "soulhp:lucifer_layer1",
    "wings": "soulhp:lucifer_wings",
});

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

var wings;
var spell;

function init(renderer) {
    parent.init(renderer);

renderer.showModel("HELMET", "head", "headwear");
renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm");
renderer.showModel("LEGGINGS", "rightLeg", "leftLeg");
renderer.showModel("BOOTS", "rightLeg", "leftLeg");

}

function initEffects(renderer) {
    wings = renderer.createEffect("fiskheroes:wings");
    wings.texture.set("wings");
    wings.anchor.set("body");
    utils.bindCloud(renderer, "fiskheroes:teleportation", "soulhp:lucifer");
    utils.bindCloud(renderer, "fiskheroes:telekinesis", "soulhp:telekinesis_lucifer");
    utils.bindBeam(renderer, "fiskheroes:energy_projection", "fiskheroes:energy_projection", "body", 0x8B0000, [
        { "firstPerson": [0.0, 6.0, 0.0], "offset": [0.0, 5.0, -4.0], "size": [4.0, 4.0] }
    ]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_energy_projection"));

    var magic = renderer.bindProperty("fiskheroes:spellcasting");
    magic.colorEarthCrack.set(0x920000);
    magic.colorAtmosphere.set(0x7A0000);

    utils.setOpacityWithData(renderer, 0.0, 1.0, "fiskheroes:shadowform_timer");
    utils.bindCloud(renderer, "fiskheroes:particle_cloud", "fiskheroes:shadow_smoke").setCondition(entity => entity.getData("fiskheroes:shadowform"));

}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "CHESTPLATE") {
        renderWingpack(entity, isFirstPersonArm);
    }

}

function renderWingpack(entity) {
    wings.unfold = entity.getInterpolatedData("fiskheroes:wing_animation_timer");
    wings.render();


    
}