extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "knights:ultron_layer1",
    "layer2": "knights:ultron_layer2",
    "cape": "knights:ultron_cape"
});

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

var cape;

function initEffects(renderer) {    
 var color = 0x66FF47;
var beam = renderer.createResource("BEAM_RENDERER", "fiskheroes:mysterio_beam");
utils.bindTrail(renderer, "knights:blur");
utils.bindBeam(renderer, "fiskheroes:charged_beam", beam, "head", 0xFFBB00, [
    { "firstPerson": [0.0, -6.15, 0.0], "offset": [0.0, -6.15, -4.0], "size": [1.0, 0.5] }
]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_charged_beam"));

utils.bindBeam(renderer, "fiskheroes:energy_projection", beam, "rightArm", 0xff4905, [
    { "firstPerson": [-3.75, 3.0, -8.0], "offset": [-0.5, 12.0, 0.0], "size": [5, 1.5] },
    { "firstPerson": [3.75, 3.0, -8.0], "offset": [-0.5, 12.0, 0.0], "size": [5, 1.5], "anchor": "leftArm" }
]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_energy_projection"));

    var physics = renderer.createResource("CAPE_PHYSICS", null);
    physics.maxFlare = 0.4;
    cape = capes.createDefault(renderer, 24, "fiskheroes:cape_default.mesh.json", physics);
    cape.effect.texture.set("cape");
    cape.effect.width = 12;
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    utils.addFlightAnimation(renderer, "vision.FLIGHT", "fiskheroes:flight/default.anim.json");
    utils.addHoverAnimation(renderer, "vision.HOVER", "fiskheroes:flight/idle/neutral");
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (!isFirstPersonArm && renderLayer == "CHESTPLATE") {
        cape.render(entity);
    }
}
