uniform lowp sampler2D g_Texture;
uniform lowp vec4 g_Color;

varying highp vec2 texCoord;


uniform lowp int palleter;
uniform lowp int colorer;
uniform lowp int effecter;
uniform lowp int alphaer;
uniform lowp int sider;

void main()
{
	lowp vec4 colorNew = texture2D(g_Texture, texCoord) ;
	if (colorNew.a<=0.0) discard;
	
	lowp vec4 colorCheck = vec4(colorNew.r  ,colorNew.g  ,colorNew.b  ,1) * 255;
	
		
		if (palleter == 10 || palleter == 20 || palleter == 30){	/// siluet
			if (colorCheck.r == 1) {	colorNew =  vec4(255,0,0,		255) / 255;}
			else if (colorCheck.r == 248) {		colorNew =  vec4(255,0,0,		255) / 255;}	
			else{
				colorNew =  vec4(0,0,0,		255) / 255;
			}
		}
		
		if (palleter == 11) {
							if (colorCheck.r == 133) {	colorNew =  vec4(255,164,87,		255) / 255;}
							/// cloth2
							else if (colorCheck.r == 80) {	colorNew =  vec4(220,100,40,		255) / 255;}
							
							/// hair1
							else if (colorCheck.r == 140) {	colorNew =  vec4(99,148,227,		255) / 255;}
							/// hair2
							else if (colorCheck.r == 79) {	colorNew =  vec4(39,86,116,		255) / 255;}
							/// hair3
							else if (colorCheck.r == 182) {	colorNew =  vec4(149,179,240,		255) / 255;}
							
							/// whiter1
							// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
							/// whiter2
							else if (colorCheck.r == 149) {	colorNew =  vec4(255,208,169,		255) / 255;}
				
				
						}else if (palleter == 12) {
									
										
								if (colorCheck.r == 133) {	colorNew =  vec4(241,136,184,		255) / 255;}
								/// cloth2
								else if (colorCheck.r == 80) {	colorNew =  vec4(217,68,137,		255) / 255;}
								
								/// hair1
								else if (colorCheck.r == 140) {	colorNew =  vec4(255,228,79,		255) / 255;}
								/// hair2
								else if (colorCheck.r == 79) {	colorNew =  vec4(203,168,71,		255) / 255;}
								/// hair3
								else if (colorCheck.r == 182) {	colorNew =  vec4(255,244,182,		255) / 255;}
								
								/// whiter1
								// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
								/// whiter2
								else if (colorCheck.r == 149) {	colorNew =  vec4(227,179,204,		255) / 255;}
									
							
		}else if (palleter == 13) {
					
				if (colorCheck.r == 133) {	colorNew =  vec4(79,235,184,		255) / 255;}
				/// cloth2
				else if (colorCheck.r == 80) {	colorNew =  vec4(31,193,119,		255) / 255;}
				
				/// hair1
				else if (colorCheck.r == 140) {	colorNew =  vec4(172,97,255,		255) / 255;}
				/// hair2
				else if (colorCheck.r == 79) {	colorNew =  vec4(100,42,157,		255) / 255;}
				/// hair3
				else if (colorCheck.r == 182) {	colorNew =  vec4(219,183,255,		255) / 255;}
				
				/// whiter1
				// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
				/// whiter2
				else if (colorCheck.r == 149) {	colorNew =  vec4(169,255,238,		255) / 255;}
			
			
						}else if (palleter == 14) {
									
														
								if (colorCheck.r == 133) {	colorNew =  vec4(253,255,87,		255) / 255;}
								/// cloth2
								else if (colorCheck.r == 80) {	colorNew =  vec4(210,189,38,		255) / 255;}
								
								/// hair1
								else if (colorCheck.r == 140) {	colorNew =  vec4(228,162,5,		255) / 255;}
								/// hair2
								else if (colorCheck.r == 79) {	colorNew =  vec4(119,55,16,		255) / 255;}
								/// hair3
								else if (colorCheck.r == 182) {	colorNew =  vec4(240,210,149,		255) / 255;}
								
								/// whiter1
								// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
								/// whiter2
								else if (colorCheck.r == 149) {	colorNew =  vec4(255,255,169,		255) / 255;}
								
												
												
		}else if (palleter == 15) {
					
				if (colorCheck.r == 133) {	colorNew =  vec4(87,178,255,		255) / 255;}
				/// cloth2
				else if (colorCheck.r == 80) {	colorNew =  vec4(4,135,210,		255) / 255;}
				
				/// hair1
				else if (colorCheck.r == 140) {	colorNew =  vec4(59,222,91,		255) / 255;}
				/// hair2
				else if (colorCheck.r == 79) {	colorNew =  vec4(20,115,17,		255) / 255;}
				/// hair3
				else if (colorCheck.r == 182) {	colorNew =  vec4(149,239,173,		255) / 255;}
				
				/// whiter1
				// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
				/// whiter2
				else if (colorCheck.r == 149) {	colorNew =  vec4(169,216,255,		255) / 255;}
				
				
						}else if (palleter == 16) {
									
				
							if (colorCheck.r == 133) {	colorNew =  vec4(43,204,49,		255) / 255;}
							/// cloth2
							else if (colorCheck.r == 80) {	colorNew =  vec4(19,149,7,		255) / 255;}
							
							/// hair1
							else if (colorCheck.r == 140) {	colorNew =  vec4(226,57,51,		255) / 255;}
							/// hair2
							else if (colorCheck.r == 79) {	colorNew =  vec4(143,31,27,		255) / 255;}
							/// hair3
							else if (colorCheck.r == 182) {	colorNew =  vec4(226,121,118,		255) / 255;}
							
							/// whiter1
							// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
							/// whiter2
							else if (colorCheck.r == 149) {	colorNew =  vec4(144,235,146,		255) / 255;}
							
							
							
		}else if (palleter == 17) {
					
				if (colorCheck.r == 133) {	colorNew =  vec4(189,87,255,		255) / 255;}
				// / cloth2
				else if (colorCheck.r == 80) {	colorNew =  vec4(126,40,220,		255) / 255;}
				
				// / hair1
				else if (colorCheck.r == 140) {	colorNew =  vec4(98,94,110,		255) / 255;}
				// / hair2
				else if (colorCheck.r == 79) {	colorNew =  vec4(43,43,53,		255) / 255;}
				// / hair3
				else if (colorCheck.r == 182) {	colorNew =  vec4(140,150,159,		255) / 255;}
				
				// / whiter1
				// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
				// / whiter2
				else if (colorCheck.r == 149) {	colorNew =  vec4(221,169,255,		255) / 255;}
				
			
							}else if (palleter == 18) {
										
			if (colorCheck.r == 133) {	colorNew =  vec4(255,78,64,		255) / 255;}
			/// cloth2
			else if (colorCheck.r == 80) {	colorNew =  vec4(163,19,29,		255) / 255;}
			
			/// hair1
			else if (colorCheck.r == 140) {	colorNew =  vec4(255,240,220,		255) / 255;}
			/// hair2
			else if (colorCheck.r == 79) {	colorNew =  vec4(200,180,160,		255) / 255;}
			/// hair3
			else if (colorCheck.r == 182) {	colorNew =  vec4(255,255,255,		255) / 255;}
			
			/// whiter1
			// else if (colorCheck.r == 255) {	colorNew =  vec4(255,255,255,		255) / 255;}
			/// whiter2
			else if (colorCheck.r == 149) {	colorNew =  vec4(255,155,149,		255) / 255;}
							
		}
					
		
		if (sider != 0){
			if (sider == 1){/// sider blue 1
				if (colorCheck.r == 0) {
					colorNew.g += 0.2;
					colorNew.b += 0.3;
				}
			}else if (sider == 2){ /// sider yellow 2
				if (colorCheck.r == 0) {
					colorNew.r += 0.5;
					colorNew.g += 0.5;
				}
			}else if (sider == 3){ /// sider blue 2
				if (colorCheck.r == 0) {
					colorNew.g += 0.5;
					colorNew.b += 0.8;
				}
			}else if (sider == 4){/// sider red 1
				if (colorCheck.r == 0) {
					colorNew.r += 0.6;
					colorNew.g += 0.4;
					colorNew.b += 1.0;
				}
			}
					
		}
		
		if (alphaer != 0){	//// for alpha reducer
			if (colorCheck.r != 0) {
				colorNew -= alphaer * 0.02;
			}
		}
		
		if (effecter == 1){	//// rushing
			colorNew.g += 0.1;
			colorNew.b += 0.4;
			colorNew *= vec4(1.1,1.2,1.4,		1.0);
		}else if (effecter == 2){/// no eye
			if (colorCheck.r == 2) {	colorNew =  vec4(255,238,212,		255) / 255;}
			else if (colorCheck.r == 1) {	colorNew =  vec4(255,238,212,		255) / 255;}
			else if (colorCheck.r == 0) {	colorNew =  vec4(255,150,255,		255) / 255;}
		}else if (effecter == 3){/// furious
			colorNew.r += 0.2;
			colorNew.g += 0.2;
			colorNew *= vec4(1.3,1.3,1.0,		1.0);
			
		}
			
		if (colorer == 1){/// red damage
			colorNew.r += 0.4;
			colorNew *= vec4(1.4,1.2,1.2,		1.0);
		}else if (colorer == 2){/// blue pot
			colorNew.g += 0.1;
			colorNew.b += 0.4;
			colorNew *= vec4(1.2,1.3,1.4,		1.0);
		}else if (colorer == 3){ /// green heal
			colorNew.g += 0.5;
			colorNew *= vec4(1.1,1.4,1.1,		1.0);
			
		}else if (colorer == 4){ /// blue bodydouble ice
			colorNew.g += 0.3;
			colorNew.b += 0.6;
			colorNew *= vec4(1.2,1.3,1.5,		1.0);
			if (colorCheck.r == 0) {	colorNew =  vec4(150,200,255,		255) / 255;}
		}else if ((colorer == 5) && (effecter != 1)){ /// blue bodydouble ice
			colorNew.g += 0.1;
			colorNew.b += 0.4;
			colorNew *= vec4(1.1,1.2,1.4,		1.0);
		}else if (colorer == 6){/// purple invi
			colorNew.r += 0.2;
			colorNew.g -= 0.2;
			colorNew.b += 0.2;
			colorNew *= vec4(1.2,1.0,1.2,		1.0);
		}else if (colorer == 7){/// blue heal
			colorNew.g += 0.4;
			colorNew.b += 0.1;
			colorNew *= vec4(1.2,1.4,1.1,		1.0);
		}
		
		
	gl_FragColor = colorNew;
}
