extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "tgheroes:kraven/kraven_layer1",
    "layer2": "tgheroes:kraven/kraven_layer2",
    "spear": "tgheroes:kraven/spear"
});

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

function initEffects(renderer) {	
	var model_spear = renderer.createResource("MODEL", "tgheroes:spear");
    model_spear.texture.set("spear");
    spear = renderer.createEffect("fiskheroes:model").setModel(model_spear);
    spear.anchor.set("rightArm");
    spear.setScale(1);
	
}


function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "CHESTPLATE") {
        if (entity.getData("fiskheroes:blade_timer") > 0.5) {
            var blade_anchor = spear.anchor.set("rightArm");
            var blade_offSet = spear.setOffset(1.0, 8.0, -10.0);
            var blade_rot = spear.setRotation(90, 90, 0);
			spear.anchor = blade_anchor, blade_offSet, blade_rot;
            spear.render();
		}
        else{
		    var back_anchor = spear.anchor.set("body");
            var back_offSet = spear.setOffset(-3.5, -2.5, 2.5);
            var back_rot = spear.setRotation(0, 0, 30);
			spear.anchor = back_anchor, back_offSet, back_rot;
            spear.render();			
		}      
	}
}