extend("fiskheroes:hero_basic");
loadTextures({
    "hair": "tgheroes:constantine/john_wig",
	"suit": "tgheroes:constantine/john_coat_ns",
    "leggings": "tgheroes:constantine/john_pants",
	"leggings_suit": "tgheroes:constantine/john_pants_coat",
    "boots": "tgheroes:constantine/john_shoes"
});

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

function init(renderer) {
    parent.init(renderer);
    renderer.setTexture((entity, renderLayer) => {
        if (renderLayer == "CHESTPLATE") {
            return entity.getWornHelmet().suitType() == $SUIT_NAME ? "suit" : "suit";
        }
	    else if (renderLayer == "LEGGINGS") {
            return entity.getWornChestplate().suitType() == $SUIT_NAME ? "leggings_suit" : "leggings";
		}
        return renderLayer == "HELMET" ? "hair" : "boots" 
    });

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

function initEffects(renderer) {

	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");
}