extend("fiskheroes:hero_basic");
loadTextures({
	"layer1": "tgheroes:joker/joker_layer1",
	"layer2": "tgheroes:joker/joker_layer2",
	"knife": "tgheroes:joker/knife"
});

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

function init(renderer) {
    parent.init(renderer);
    renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm", "rightLeg", "leftLeg");
}

function initEffects(renderer) {
	var model_knife = renderer.createResource("MODEL", "tgheroes:knife");
    model_knife.texture.set("knife");
    knife = renderer.createEffect("fiskheroes:model").setModel(model_knife);
    knife.anchor.set("rightArm");
    knife.setScale(1);
	
	utils.bindBeam(renderer, "fiskheroes:charged_beam", "tgheroes:shout_effect","body", 0xbfff00, [
        { "firstPerson": [-2.5, 4.0, 0.0], "offset": [-2.5, 4.0, 0.0],"size": [0.5, 0.5] }
    ]);
}

function render(entity, renderLayer, isFirstPersonArm) {
	if (entity.getData("fiskheroes:blade_timer") > 0.5) {
            var blade_anchor = knife.anchor.set("rightArm");
            var blade_offSet = knife.setOffset(1.0, 8.0, -3.5);
            var blade_rot = knife.setRotation(90, 90, 0);
        			
            knife.anchor = blade_anchor, blade_offSet, blade_rot;
            knife.render();
        }
}