extend("fiskheroes:hero_basic");
loadTextures({
	"layer1": "tgheroes:constantine/hellblazer_layer1",
    "layer2": "tgheroes:constantine/hellblazer_layer2",
    "cape": "tgheroes:constantine/john_cape"
});

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

function initEffects(renderer) {
	var physics = renderer.createResource("CAPE_PHYSICS", null);
    physics.maxFlare = 0.3;
    physics.flareDegree = 1.5;
    physics.flareFactor = 1.2;
    physics.flareElasticity = 5;
    cape = capes.createDefault(renderer, 24, "fiskheroes:cape_default.mesh.json", physics);
    cape.effect.texture.set("cape");
    cape.effect.width = 16;
	
	var forcefield = renderer.bindProperty("fiskheroes:forcefield");
    forcefield.color.set(0xff6600);
    forcefield.setShape(36, 18).setOffset(0.0, 6.0, 0.0).setScale(1.5);
    forcefield.setCondition(entity => {
        forcefield.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.15;
        return true;
    });
	utils.bindCloud(renderer, "fiskheroes:teleportation", "tgheroes:demon_teleport");
	utils.bindCloud(renderer, "fiskheroes:telekinesis", "tgheroes:demon_telekinesis");
}

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